<template>
  <div class="mainContentBox">
    <avue-crud
        ref="crudRef"
        v-model:search="search"
        v-model="form"
        :data="data"
        :option="option"
        v-model:page="page"
        @row-save="createRow"
        @row-update="updateRow"
        @row-del="deleteRow"
        @search-change="searchChange"
        @search-reset="resetChange"
        @size-change="dataList"
        @current-change="dataList"
    >
    </avue-crud>
    <el-dialog
        v-model="dialog.visible"
        :title="dialog.title"
        width="1250px"
        @close="dialog.visible = false"
    >

      <div class="dialog-footer" align="center">
        <el-button @click="dialog.visible = false">取消</el-button>
        <el-button type="primary" @click="printPage">--</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script setup>
import { ref, getCurrentInstance } from "vue";
import { useCrud } from "@/hooks/userCrud";
import { useCommonStoreHook } from "@/store";
import dictDataUtil from "@/common/configs/dictDataUtil";
const { isShowTable, tableType } = toRefs(useCommonStoreHook());
const toPrintRef = ref(null);
// 传入一个url，后面不带/
const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
    useCrud({
      src: "/api/v1/flowTask",
    });
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 dialog = reactive({
  title: "二维码打印",
  visible: false,
});
// 设置表格列或者其他自定义的option
option.value = Object.assign(option.value, {
  searchEnter: true,
  delBtn: false,
  selection: false,
  addBtn: false,
  column: [
    {
      label: "待办类型",
      prop: "taskType",
      type: "select",
      search: true,
      editDisabled: true,
      dicUrl: dictDataUtil.request_url + "flow_type",
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
    },
    {
      label: "任务名称",
      prop: "taskName",
      editDisabled: true,
    },
    {
      label: "业务名称",
      prop: "businessName",
      search: true,
    },
    {
      label: "当前节点",
      prop: "currentStep",
    },
    {
      label: "审核状态",
      prop: "state",
      type: "select",
      dicUrl:
          dictDataUtil.request_url + "flow_state",
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
    }
  ],
});

onMounted(() => {
  search.value.state = "1"
  dataList();
});
</script>
