<template>
  <!-- 充气前后检查 -->
  <div>
    <actionBar menuTitle="充气前后检查" :formList="formList" :ruleForm="searchRuleForm" @searchProtocol="searchProtocol">
    </actionBar>
    <tables :key="Math.random()" :suspension="true" :tableList="tableList" :tableData="tableData"
      @buttonData="buttonData"></tables>
    <!-- 分页 -->
    <div class="paging_bottom" v-if="Total">
      <pagination :total="Total" :currentPage="Pagination.PageIndex" @changeSize="changeSize"
        @changeCurrent="changeCurrent">
      </pagination>
    </div>
    <el-dialog :title="staffTitle" :visible.sync="staffDialogVisible" width="60%" :close-on-click-modal="false">
      <forms ref="childRules" labelPosition="left" :formNewList="formRuleList" :ruleForm="ruleForm" labelWidth="190px">
      </forms>
      <span slot="footer" class="dialog-footer">
        <el-button plain @click="staffDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="staffDialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import {
    getFillCheck
  } from '@/api/inspection'
  import actionBar from '@/components/actionBar'
  import tables from '@/components/tables'
  import pagination from '@/components/pagination'
  import forms from '@/components/forms'
  import {
    formRules,
    employee
  } from "./examine.js";
  export default {
    components: {
      actionBar,
      tables,
      pagination,
      forms
    },
    data() {
      return {
        formList: [{
          type: 'input',
          label: '单位内编码',
          field: 'innerCode',
          placeholder: '单位内编码',
        }, ],
        searchRuleForm: {
          innerCode: '',
        },
        tableList: employee(),
        tableData: [],
        Pagination: {
          PageIndex: 1,
          PageSize: 10,
        },
        Total: 0,
        formRuleList: [],
        staffTitle: '查看',
        staffDialogVisible: false,
        formRuleList: [],
        searchValue: {},
        ruleForm: {},
      }
    },
    mounted() {
      const dataList = formRules();
      this.formRuleList = dataList;
      this.getList()
    },
    methods: {
      // 搜索
      searchProtocol(value) {
        this.searchValue = value
        this.getList()
      },
      // 获取充气前后检查列表
      getList() {
        var params = {
          page: this.Pagination.PageIndex,
          pageSize: this.Pagination.PageSize,
          ...this.searchValue
        }
        getFillCheck(params).then(res => {
          if (res.code == 200) {
            this.tableData = res.data.list
            this.Total = res.data.count
          }
        })
      },
      buttonData(row, type) {
        this.operationType = type
        // console.log(row, type, 25)
        this.staffTitle = '充装前后检查'
        this.staffDialogVisible = true
      },
      changeSize(val) {
        this.Pagination.PageSize = val
        this.getList()
      },
      changeCurrent(val) {
        this.Pagination.PageIndex = val
        this.getList()
      },
    }
  }
</script>

<style lang="scss" scoped>
</style>
