<template>
  <div class="mainContentBox">
    <avue-crud
      ref="crudRef"
      v-model:search="search"
      v-model="form"
      :data="data"
      :option="option"
      v-model:page="page"
    />
  </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/info",
});
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对象

onMounted(() => {
  commonConfig.value.params = { seqNo: "-1" };
  dataList();
});

option.value = Object.assign(option.value, {
  selection: false,
  column: [
    {
      label: "缺陷类型",
      prop: "bugType",
      minWidth: 200,
      search: true,
      overHidden: true,
      rules: [
        {
          required: true,
          message: "缺陷类型不能为空",
          trigger: "change",
        },
      ],
      type: "select",
      dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.defect_mana,
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
    },
  ],
});
</script>
