<template>
  <div class="data-dictionary h100">
    <common-layout  ref="layoutRef" :table-attrs="{
     'has-operation':true
   }" :form-attrs="{
     'span-attrs':{
       span:5
     }
   }" :table-header="qualityCheckRuleHomeTableHeader" :get-table-list="getTableTata" :filter-form="dataDictionaryHomeFilterForm">
      <template #operation="{data}">
        <el-button type="info" @click="$emit('changeOperation','edit',data)">{{ +data.NUM > 0?'修改规则':'配置规则' }}</el-button>

      </template>
    </common-layout>
  </div>
</template>

<script>
import CommonLayout from "@/components/CommonLayout.vue";
import {dataDictionaryHomeFilterForm} from "@/data/all-forms";
import {

  qualityCheckRuleHomeTableHeader,

} from "@/data/all-table-header";
import {ref} from "vue";
import {qualityCheckRuleHomeTableData} from "@/service/zsk/quality-check-rule";
import {useActiveGetTableData} from "@/unit/use-method/usePagination";

export default {
  name: "QualityCheckRuleHome",
  components: {CommonLayout},
  setup() {
    useActiveGetTableData(getTableTata)
    const layoutRef = ref(null)
    function getTableTata() {
      qualityCheckRuleHomeTableData({
        pageIndex:layoutRef.value.pageIndex,
        pageSize:layoutRef.value.pageSize,
        NAME:layoutRef.value.form.NAME,
        UNITCODE:layoutRef.value.form.UNIT_CODE,
        NUM:layoutRef.value.form.CONFIG_STATES,
      }).then(res => {
        layoutRef.value.getResData(res.msg[0].Rows,res.msg[0].TotalRowCount)
      })

    }
    return {
      dataDictionaryHomeFilterForm,
      qualityCheckRuleHomeTableHeader,
      getTableTata,
      layoutRef
    }
  }
}
</script>

<style scoped lang="scss">

</style>
