<template>
  <fvSearchForm :searchConfig="searchConfig" @search="search">
  </fvSearchForm>
  <fvTable ref="tableIns" :tableConfig="tableConfig" :data="mockData" @headBtnClick="headBtnClick"></fvTable>
</template>

<script setup lang="jsx">
import { shallowRef } from 'vue';
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
const router = useRouter()
const tableIns = ref()
const mockData = ref([
  {
    workOrderNumber: 1211,
    workOrderTime: '2022-02-09 00 : 12',
    state: 0,
    callState: 0
  },
  {
    workOrderNumber: 232,
    state: 1,
    callState: 1
  }
])
const searchConfig = reactive([
  {
    label: '名称',
    prop: 'requirementName',
    props: {
      placeholder: '请输入名称查询',
      clearable: true,
      checkStrictly: true
    },
    component: 'el-input',
  },
  {
    label: '状态',
    prop: 'requirementName',
    props: {
      placeholder: '请选择状态查询',
      cacheKey: 'work_order_status',
      clearable: true,
      filterable: true,
    },
    component: shallowRef(fvSelect),
  },
])
const tableConfig = reactive({
  columns: [
    {
      prop: 'index',
      type: 'index',
      label: '序号',
      align: 'center',
      width: 80,
    },
    {
      prop: 'workOrderNumber',
      label: 'ID',
      align: 'center'
    },
    {
      prop: 'workOrderNumber',
      label: '名称',
      align: 'center'
    },
    {
      prop: 'workOrderNumber',
      label: '类型',
      align: 'center'
    },
    {
      prop: 'workOrderNumber',
      label: '内容',
      align: 'center'
    },
    {
      prop: 'workOrderNumber',
      label: '创建时间',
      align: 'center'
    },
    {
      prop: 'state',
      label: '状态',
      align: 'center',
      showOverflowTooltip: false,
      currentRender: ({ row, index }) => {
        if (row.state !== null) {
          return (<Tag dictType={'work_order_status'} value={row.state} />)
        } else {
          return '--'
        }
      }
    },
    {
      prop: 'workOrderNumber',
      label: '备注',
      align: 'center'
    }
  ],
  api: '',
  params: {},
  btns: [
    {name: '新增', key: 'add',type:'primary',icon:'Plus'},
  ]
})
const headBtnClick = (key) => {
  switch (key) {
    case 'add':
      handleAdd()
      break;
  }
}
</script>

<style scoped>

</style>
