<!-- 点检判定 -->
<template>
  <div class="mainContentBox">
    <avue-crud
      ref="crudRef2"
      v-model:search="search"
      v-model="form"
      :data="data"
      :option="option"
      v-model:page="page"
    />
    <!-- <el-collapse accordion>
      <el-collapse-item
        :title="item.opName"
        :name="item.id"
        v-for="item in data"
        :key="item.id"
      />
    </el-collapse> -->
  </div>
</template>
<script setup>
import { ref, getCurrentInstance } from "vue";
import { useCrud } from "@/hooks/userCrud";
import dictDataUtil from "@/common/configs/dictDataUtil";
import ButtonPermKeys from "@/common/configs/buttonPermission";
import { useCommonStoreHook, useDictionaryStore } from "@/store";

// 数据字典相关
const { dicts } = useDictionaryStore();

// 传入一个url，后面不带/
const {
  form,
  data,
  option,
  search,
  page,
  toDeleteIds,
  Methords,
  Utils,
  commonConfig,
} = useCrud({
  src: "/api/v1/process/web/traceability/checkRecordInfo",
});
const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
  Methords; //增删改查
const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具

const crudRef = ref(null); //crudRef.value 获取avue-crud对象

const refreshTra = (row) => {
  commonConfig.value.params = { seqNo: row.seqNo,workOrderCode: row.workOrderCode };
  dataList();
};
defineExpose({ refreshTra });
onMounted(() => {});

option.value = Object.assign(option.value, {
  selection: false,
  border: true,
  index: false,
  expandLevel: 3,
  headerAlign: "center",
  align: "center",
  labelWidth: 100,
  addBtn: false,
  menu: false,
  header: false,
  rowKey: "opId",
  column: [
    {
      label: "工序Id",
      prop: "opId",
      display: false,
      hide: true,
    },
    {
      label: "工序名称",
      prop: "opName",
    },
    {
      label: "点检项名称",
      prop: "checkName",
      search: false,
    },
    {
      label: "点检项编码",
      prop: "checkCode",
      search: false,
    },
    {
      label: "内容",
      prop: "content",
      search: false,
    },
    {
      label: "结果",
      prop: "result",
      dicData: dicts.process_check_result,
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
      search: false,
    },
    // {
    //   label: "操作人",
    //   prop: "operator",
    //   search: false,
    // },
    {
      label: "标准值",
      prop: "standard",
      search: false,
    },
    {
      label: "上限值",
      prop: "upper",
      search: false,
    },
    {
      label: "下限值",
      prop: "lower",
      search: false,
    },
    // {
    //   label: "实测值",
    //   prop: "realValue",
    //   search: false,
    // },
    // {
    //   label: "单位",
    //   prop: "unit",
    //   search: false,
    //   dicData: dicts.danwei_type,
    //   props: {
    //     label: "dictLabel",
    //     value: "dictValue",
    //   },
    // },
    {
      label: "录入时间",
      prop: "created",
      search: false,
    },
  ],
});
</script>
