<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"
      @selection-change="selectionChange"
    >
      <template #menu-left="{ size }">
        <el-button
          :disabled="toDeleteIds.length < 1"
          type="danger"
          icon="el-icon-delete"
          :size="size"
          v-hasPerm="[ButtonPermKeys.DEVICE.BTNS.repair_del]"
          @click="multipleDelete"
          >删除</el-button
        >
      </template>
      <template #menu="{ size, row, index }">
        <el-button
          @click="maintenance(row, 0)"
          icon="el-icon-check"
          text
          type="primary"
          :size="size"
          >流程</el-button
        >
        <el-button
          icon="el-icon-setting"
          text
          @click="showExcel(row)"
          type="primary"
          >表格填充</el-button
        >
        <!--        <el-button @click="maintenance(row,1)"
                   icon="el-icon-fold"
                   text
                   type="primary"
                   :size="size">记录</el-button>-->
      </template>
    </avue-crud>
    <el-dialog
      v-model="dialog.visible"
      :title="dialog.title"
      width="850px"
      @close="dialog.visible = false"
    >
      <device-page @device-info="deviceInfo" :operate="operate" />
    </el-dialog>

    <el-dialog
      v-model="dialog1.visible"
      :title="dialog1.title"
      width="750px"
      height="80%"
      @close="dialog1.visible = false"
    >
      <el-timeline style="max-width: 500px; margin-left: 100px">
        <el-timeline-item center type="success" placement="top">
          <el-card>
            <h4>设备故障</h4>
            <p>设备编号： {{ maintenanceInfo.deviceNo }}</p>
            <p>设备名称： {{ maintenanceInfo.deviceName }}</p>
            <p>使用人： {{ maintenanceInfo.creator }}</p>
            <p>故障现象： {{ maintenanceInfo.bugRemark }}</p>
            <p>日期： {{ maintenanceInfo.created }}</p>
          </el-card>
        </el-timeline-item>
        <el-timeline-item
          center
          placement="top"
          :type="maintenanceInfo.state === 0 ? 'primary' : 'success'"
        >
          <el-card v-if="viewPage">
            <h4>维修情况说明</h4>
            <p>故障确认： {{ maintenanceInfo.faultRemark }}</p>
            <p>维修记录： {{ maintenanceInfo.handleContent }}</p>
            <p>预计费用： {{ maintenanceInfo.handleContent }}</p>
            <p>维修人： {{ maintenanceInfo.handleUser }}</p>
            <p>日期： {{ maintenanceInfo.handleTime }}</p>
            <p>
              处理结果：
              {{
                maintenanceInfo.handleUser
                  ? maintenanceInfo.handleResult === 0
                    ? "可正常运行"
                    : "报废"
                  : ""
              }}
            </p>
          </el-card>
          <el-card v-if="!viewPage">
            <h4>维修情况说明</h4>
            <el-form
              ref="maintenanceInfoForm1"
              :model="maintenanceInfo"
              label-width="auto"
              style="max-width: 400px"
              :rules="rules1"
            >
              <el-form-item label="故障确认" prop="faultRemark">
                <el-input
                  :disabled="maintenanceInfo.state !== 0"
                  type="textarea"
                  :rows="2"
                  v-model="maintenanceInfo.faultRemark"
                />
              </el-form-item>
              <el-form-item label="维修记录" prop="handleContent">
                <el-input
                  :disabled="maintenanceInfo.state !== 0"
                  type="textarea"
                  :rows="2"
                  v-model="maintenanceInfo.handleContent"
                />
              </el-form-item>
              <el-form-item label="预计费用" prop="cost">
                <el-input
                  :disabled="maintenanceInfo.state !== 0"
                  v-model="maintenanceInfo.cost"
                />
              </el-form-item>
              <el-form-item label="维修人员" prop="handleUser">
                <!--                <el-input :disabled="maintenanceInfo.state !== 0" v-model="maintenanceInfo.handleUser" />-->
                <el-select
                  v-model="maintenanceInfo.handleUser"
                  placeholder="维修人员"
                  :disabled="maintenanceInfo.state !== 0"
                  size="large"
                  filterable
                >
                  <el-option
                    v-for="item in userList"
                    :key="item.userName"
                    :label="item.userName"
                    :value="item.userName"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                label="日期"
                prop="handleTime"
                v-if="maintenanceInfo.state !== 0"
              >
                <el-input
                  :disabled="maintenanceInfo.state !== 0"
                  v-model="maintenanceInfo.handleTime"
                />
              </el-form-item>
              <el-form-item label="处理结果">
                <el-radio-group
                  :disabled="maintenanceInfo.state !== 0"
                  v-model="maintenanceInfo.handleResult"
                  class="ml-4"
                >
                  <el-radio :value="0">可正常运行</el-radio>
                  <el-radio :value="1">报废</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item style="margin-left: 45%">
                <el-button
                  type="primary"
                  v-if="maintenanceInfo.state === 0"
                  v-hasPerm="[ButtonPermKeys.DEVICE.BTNS.repair_repair]"
                  :disabled="maintenanceInfo.state !== 0"
                  @click="maintenanceSubmit1"
                  >维修</el-button
                >
              </el-form-item>
            </el-form>
          </el-card>
        </el-timeline-item>
        <el-timeline-item
          center
          placement="top"
          :type="
            maintenanceInfo.state === 1
              ? 'primary'
              : maintenanceInfo.state === 0
                ? 'info'
                : 'success'
          "
        >
          <el-card v-if="viewPage">
            <h4>科研生产部设备管理员计量意见</h4>
            <p>审批人员： {{ maintenanceInfo.auditUser }}</p>
            <p>
              审批结果：
              {{
                maintenanceInfo.auditUser
                  ? maintenanceInfo.auditResult === 0
                    ? "通过"
                    : "不通过"
                  : ""
              }}
            </p>
          </el-card>
          <el-card v-if="!viewPage">
            <h4>科研生产部设备管理员意见</h4>
            <el-form
              ref="maintenanceInfoForm2"
              v-if="maintenanceInfo.state >= 1"
              :model="maintenanceInfo"
              label-width="auto"
              style="max-width: 400px"
              :rules="rules2"
            >
              <el-form-item label="计量意见" prop="auditOpinion">
                <el-input
                  :disabled="maintenanceInfo.state !== 1"
                  type="textarea"
                  :rows="2"
                  v-model="maintenanceInfo.auditOpinion"
                />
              </el-form-item>
              <el-form-item label="审批结果">
                <el-radio-group
                  :disabled="maintenanceInfo.state !== 1 && readonly"
                  v-model="maintenanceInfo.auditResult"
                  class="ml-4"
                >
                  <el-radio :value="0">通过</el-radio>
                  <el-radio :value="1">不通过</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="设备管理员" prop="auditUser">
                <!--                <el-input :disabled="maintenanceInfo.state !== 1 && readonly"  v-model="maintenanceInfo.auditUser" />-->
                <el-select
                  v-model="maintenanceInfo.auditUser"
                  placeholder="设备管理员"
                  :disabled="maintenanceInfo.state !== 1 && readonly"
                  size="large"
                  filterable
                >
                  <el-option
                    v-for="item in userList"
                    :key="item.userName"
                    :label="item.userName"
                    :value="item.userName"
                  />
                </el-select>
              </el-form-item>
              <el-form-item style="margin-left: 45%">
                <el-button
                  type="primary"
                  v-if="maintenanceInfo.state === 1"
                  v-hasPerm="[ButtonPermKeys.DEVICE.BTNS.repair_audit]"
                  :disabled="maintenanceInfo.state !== 1"
                  @click="maintenanceSubmit2"
                  >审批</el-button
                >
              </el-form-item>
            </el-form>
          </el-card>
        </el-timeline-item>

        <el-timeline-item
          center
          placement="top"
          :type="
            maintenanceInfo.state === 3
              ? 'primary'
              : maintenanceInfo.state < 3
                ? 'info'
                : 'success'
          "
        >
          <el-card v-if="viewPage">
            <h4>科研生产部负责人计量意见</h4>
            <p>审批人员： {{ maintenanceInfo.auditUser }}</p>
            <p>
              审批结果：
              {{
                maintenanceInfo.auditUser
                  ? maintenanceInfo.auditResult === 0
                    ? "通过"
                    : "不通过"
                  : ""
              }}
            </p>
          </el-card>
          <el-card v-if="!viewPage">
            <h4>科研生产部负责人意见</h4>
            <el-form
              ref="maintenanceInfoForm3"
              v-if="maintenanceInfo.state >= 3"
              :model="maintenanceInfo"
              label-width="auto"
              style="max-width: 400px"
              :rules="rules3"
            >
              <el-form-item label="计量意见" prop="auditOpinion1">
                <el-input
                  :disabled="maintenanceInfo.state !== 3"
                  type="textarea"
                  :rows="2"
                  v-model="maintenanceInfo.auditOpinion1"
                />
              </el-form-item>
              <el-form-item label="审批结果">
                <el-radio-group
                  :disabled="maintenanceInfo.state !== 3 && readonly"
                  v-model="maintenanceInfo.auditResult1"
                  class="ml-4"
                >
                  <el-radio :value="0">通过</el-radio>
                  <el-radio :value="1">不通过</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="负责人" prop="auditUser1">
                <!--                <el-input :disabled="maintenanceInfo.state !== 1 && readonly"  v-model="maintenanceInfo.auditUser" />-->
                <el-select
                  v-model="maintenanceInfo.auditUser1"
                  placeholder="负责人"
                  :disabled="maintenanceInfo.state !== 3 && readonly"
                  size="large"
                  filterable
                >
                  <el-option
                    v-for="item in userList"
                    :key="item.userName"
                    :label="item.userName"
                    :value="item.userName"
                  />
                </el-select>
              </el-form-item>
              <el-form-item style="margin-left: 45%">
                <el-button
                  type="primary"
                  v-if="maintenanceInfo.state === 3"
                  v-hasPerm="[ButtonPermKeys.DEVICE.BTNS.repair_audit1]"
                  :disabled="maintenanceInfo.state !== 3"
                  @click="maintenanceSubmit3"
                  >审批</el-button
                >
              </el-form-item>
            </el-form>
          </el-card>
        </el-timeline-item>
        <el-timeline-item
          center
          placement="top"
          :type="
            maintenanceInfo.state === 5
              ? 'primary'
              : maintenanceInfo.state < 5
                ? 'info'
                : 'success'
          "
        >
          <el-card v-if="viewPage">
            <h4>使用人验收意见</h4>
            <p>审批人员： {{ maintenanceInfo.auditUser }}</p>
            <p>
              审批结果：
              {{
                maintenanceInfo.auditUser
                  ? maintenanceInfo.auditResult === 0
                    ? "通过"
                    : "不通过"
                  : ""
              }}
            </p>
          </el-card>
          <el-card v-if="!viewPage">
            <h4>使用人验收意见</h4>
            <el-form
              ref="maintenanceInfoForm4"
              v-if="maintenanceInfo.state >= 5"
              :model="maintenanceInfo"
              label-width="auto"
              style="max-width: 400px"
              :rules="rules3"
            >
              <el-form-item label="验收意见" prop="auditOpinion2">
                <el-input
                  :disabled="maintenanceInfo.state !== 5"
                  type="textarea"
                  :rows="2"
                  v-model="maintenanceInfo.auditOpinion2"
                />
              </el-form-item>
              <el-form-item label="审批结果">
                <el-radio-group
                  :disabled="maintenanceInfo.state !== 5 && readonly"
                  v-model="maintenanceInfo.auditResult2"
                  class="ml-4"
                >
                  <el-radio :value="0">通过</el-radio>
                  <el-radio :value="1">不通过</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="使用人" prop="auditUser1">
                <!--                <el-input :disabled="maintenanceInfo.state !== 1 && readonly"  v-model="maintenanceInfo.auditUser" />-->
                <el-select
                  v-model="maintenanceInfo.auditUser2"
                  placeholder="使用人"
                  :disabled="maintenanceInfo.state !== 5 && readonly"
                  size="large"
                  filterable
                >
                  <el-option
                    v-for="item in userList"
                    :key="item.userName"
                    :label="item.userName"
                    :value="item.userName"
                  />
                </el-select>
              </el-form-item>
              <el-form-item style="margin-left: 45%">
                <el-button
                  type="primary"
                  v-if="maintenanceInfo.state === 5"
                  v-hasPerm="[ButtonPermKeys.DEVICE.BTNS.repair_audit2]"
                  :disabled="maintenanceInfo.state !== 5"
                  @click="maintenanceSubmit4"
                  >审批</el-button
                >
              </el-form-item>
            </el-form>
          </el-card>
        </el-timeline-item>
        <el-timeline-item
          center
          placement="top"
          :type="
            maintenanceInfo.state === 7
              ? 'primary'
              : maintenanceInfo.state < 7
                ? 'info'
                : 'success'
          "
        >
          <el-card v-if="viewPage">
            <h4>使用部门负责人验收意见</h4>
            <p>审批人员： {{ maintenanceInfo.auditUser }}</p>
            <p>
              审批结果：
              {{
                maintenanceInfo.auditUser
                  ? maintenanceInfo.auditResult === 0
                    ? "通过"
                    : "不通过"
                  : ""
              }}
            </p>
          </el-card>
          <el-card v-if="!viewPage">
            <h4>使用部门负责人验收意见</h4>
            <el-form
              ref="maintenanceInfoForm5"
              v-if="maintenanceInfo.state >= 7"
              :model="maintenanceInfo"
              label-width="auto"
              style="max-width: 400px"
              :rules="rules3"
            >
              <el-form-item label="计量意见" prop="auditOpinion3">
                <el-input
                  :disabled="maintenanceInfo.state !== 7"
                  type="textarea"
                  :rows="2"
                  v-model="maintenanceInfo.auditOpinion3"
                />
              </el-form-item>
              <el-form-item label="审批结果">
                <el-radio-group
                  :disabled="maintenanceInfo.state !== 7 && readonly"
                  v-model="maintenanceInfo.auditResult3"
                  class="ml-4"
                >
                  <el-radio :value="0">通过</el-radio>
                  <el-radio :value="1">不通过</el-radio>
                </el-radio-group>
              </el-form-item>
              <el-form-item label="部门负责人" prop="auditUser1">
                <!--                <el-input :disabled="maintenanceInfo.state !== 1 && readonly"  v-model="maintenanceInfo.auditUser" />-->
                <el-select
                  v-model="maintenanceInfo.auditUser3"
                  placeholder="部门负责人"
                  :disabled="maintenanceInfo.state !== 7 && readonly"
                  size="large"
                  filterable
                >
                  <el-option
                    v-for="item in userList"
                    :key="item.userName"
                    :label="item.userName"
                    :value="item.userName"
                  />
                </el-select>
              </el-form-item>
              <el-form-item style="margin-left: 45%">
                <el-button
                  type="primary"
                  v-if="maintenanceInfo.state === 7"
                  v-hasPerm="[ButtonPermKeys.DEVICE.BTNS.repair_audit3]"
                  :disabled="maintenanceInfo.state !== 7"
                  @click="maintenanceSubmit5"
                  >审批</el-button
                >
              </el-form-item>
            </el-form>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </el-dialog>
    <el-dialog
      v-model="workOderShow"
      :title="updateTitle"
      @close="workOderShow = false"
      width="1600"
    >
      <AddExcelInfo :data="ExDataObj" :rowDatas="rowData" @close="closeShow" />
    </el-dialog>
  </div>
</template>
<script setup>
import { ref, getCurrentInstance } from "vue";
import { useCrud } from "@/hooks/userCrud";
import ButtonPermKeys from "@/common/configs/buttonPermission";
import { checkPerm } from "@/directive/permission";
import { getUserList } from "@/api/system/user";
import { repair, audit } from "@/api/device/index";
import { useCommonStoreHook } from "@/store";
import { getProExcel, setExcelDatas } from "@/api/excel";
import AddExcelInfo from "../components/addExcelInfo.vue";
import dictDataUtil from "@/common/configs/dictDataUtil";
import proWorkOrderExcel from "./components/proWorkOrderExcel.vue";
const { isShowTable, tableType } = toRefs(useCommonStoreHook());
const ExDataObj = ref({});
const workOderShow = ref(false);
const closeShow = () => {
  workOderShow.value = false;
};
const showProExcel = async (id) => {
  const { data, code } = await getProExcel(id);
  if (code == "200") {
    ExDataObj.value = data;
    workOderShow.value = true;
  } else {
    ExDataObj.value = {};
    workOderShow.value = false;
  }
};
const test = () => {
  isShowTable.value = true;
  tableType.value = tableType.value == 1 ? 2 : 1;
};
const permission = reactive({
  delBtn: checkPerm(ButtonPermKeys.DEVICE.BTNS.repair_del),
  addBtn: checkPerm(ButtonPermKeys.DEVICE.BTNS.repair_add),
  editBtn: checkPerm(ButtonPermKeys.DEVICE.BTNS.repair_edit),
  menu: true,
});
const viewPage = ref(true);

const dialog = reactive({
  title: "设备选择",
  visible: false,
});
const dialog1 = reactive({
  title: "设备维修",
  visible: false,
});
const userList = ref([]);
// 传入一个url，后面不带/
const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
  useCrud({
    src: "/api/v1/device/repair",
  });
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 deviceInfo = (value) => {
  form.value.deviceNo = value.deviceNo;
  form.value.deviceName = value.deviceName;
  form.value.deviceType = value.deviceType;
  form.value.devicePosition = value.devicePosition;
  form.value.specifications = value.specifications;
  dialog.visible = false;
};
const maintenanceInfo = ref(null);
const maintenance = (row, type) => {
  viewPage.value = type === 0 ? false : true;
  maintenanceInfo.value = row;
  if (null == maintenanceInfo.value.handResult) {
    maintenanceInfo.value.handResult = 0;
  }
  if (null == maintenanceInfo.value.handResult1) {
    maintenanceInfo.value.handResult1 = 0;
  }
  if (null == maintenanceInfo.value.handResult2) {
    maintenanceInfo.value.handResult2 = 0;
  }
  if (null == maintenanceInfo.value.handResult3) {
    maintenanceInfo.value.handResult3 = 0;
  }
  if (null == maintenanceInfo.value.handResult4) {
    maintenanceInfo.value.handResult4 = 0;
  }
  dialog1.visible = true;
};
const queryUserList = () => {
  getUserList({}).then((data) => {
    userList.value = data.data;
  });
};
const maintenanceInfoForm1 = ref("maintenanceInfoForm1");
const maintenanceInfoForm2 = ref("maintenanceInfoForm2");
const maintenanceInfoForm3 = ref("maintenanceInfoForm3");
const maintenanceInfoForm4 = ref("maintenanceInfoForm4");
const maintenanceInfoForm5 = ref("maintenanceInfoForm5");
const maintenanceSubmit1 = () => {
  //alert(JSON.stringify(maintenanceInfo.value))
  maintenanceInfoForm1.value.validate((isValid, invalidFields) => {
    if (isValid) {
      repair(maintenanceInfo.value).then((data) => {
        ElMessage({
          message: data.msg,
          type: "success",
        });
        dialog1.visible = false;
        dataList();
      });
    }
  });
};
const operate = ref("repair");
const maintenanceSubmit2 = () => {
  //alert(JSON.stringify(maintenanceInfo.value))
  maintenanceInfoForm2.value.validate((isValid, invalidFields) => {
    if (isValid) {
      audit(maintenanceInfo.value).then((data) => {
        ElMessage({
          message: data.msg,
          type: "success",
        });
        dialog1.visible = false;
        dataList();
      });
    }
  });
};
const showExcel = async (row) => {
  await getExcelData(row);
};
const getExcelData = async (row) => {
  const { data, code } = await setExcelDatas("6", row.id);
  if (code == "200") {
    ExDataObj.value = data;
    ExDataObj.value.formType = "6";
    ExDataObj.value.recordId = row.id;
    workOderShow.value = true;
  } else {
    ExDataObj.value = {};
    workOderShow.value = false;
  }
};
const maintenanceSubmit3 = () => {
  //alert(JSON.stringify(maintenanceInfo.value))
  maintenanceInfoForm3.value.validate((isValid, invalidFields) => {
    if (isValid) {
      maintenanceInfo.value.auditResult = maintenanceInfo.value.auditResult1;
      maintenanceInfo.value.auditOpinion = maintenanceInfo.value.auditOpinion1;
      maintenanceInfo.value.auditUser = maintenanceInfo.value.auditUser1;
      audit(maintenanceInfo.value).then((data) => {
        ElMessage({
          message: data.msg,
          type: "success",
        });
        dialog1.visible = false;
        dataList();
      });
    }
  });
};

const maintenanceSubmit4 = () => {
  //alert(JSON.stringify(maintenanceInfo.value))
  maintenanceInfoForm4.value.validate((isValid, invalidFields) => {
    if (isValid) {
      maintenanceInfo.value.auditResult = maintenanceInfo.value.auditResult2;
      maintenanceInfo.value.auditOpinion = maintenanceInfo.value.auditOpinion2;
      maintenanceInfo.value.auditUser = maintenanceInfo.value.auditUser2;
      audit(maintenanceInfo.value).then((data) => {
        ElMessage({
          message: data.msg,
          type: "success",
        });
        dialog1.visible = false;
        dataList();
      });
    }
  });
};

const maintenanceSubmit5 = () => {
  //alert(JSON.stringify(maintenanceInfo.value))
  maintenanceInfoForm5.value.validate((isValid, invalidFields) => {
    if (isValid) {
      maintenanceInfo.value.auditResult = maintenanceInfo.value.auditResult3;
      maintenanceInfo.value.auditOpinion = maintenanceInfo.value.auditOpinion3;
      maintenanceInfo.value.auditUser = maintenanceInfo.value.auditUser3;
      audit(maintenanceInfo.value).then((data) => {
        ElMessage({
          message: data.msg,
          type: "success",
        });
        dialog1.visible = false;
        dataList();
      });
    }
  });
};
const rules1 = reactive({
  handleUser: [
    { required: true, message: "维修人员不能为空", trigger: "blur" },
  ],
  faultRemark: [
    { required: true, message: "故障确认不能为空", trigger: "blur" },
  ],
  handleContent: [
    { required: true, message: "维修记录不能为空", trigger: "blur" },
  ],
});
const rules2 = reactive({
  auditUser: [
    { required: true, message: "设备管理员不能为空", trigger: "blur" },
  ],
  auditOpinion: [
    { required: true, message: "计量意见不能为空", trigger: "blur" },
  ],
});
const rules3 = reactive({
  auditUser1: [{ required: true, message: "负责人不能为空", trigger: "blur" }],
  auditOpinion1: [
    { required: true, message: "计量意见不能为空", trigger: "blur" },
  ],
});
// 设置表格列或者其他自定义的option
option.value = Object.assign(option.value, {
  delBtn: false,
  selection: true,
  labelWidth: 150,
  viewBtn: false,
  editBtn: false,
  selectable: (row, index) => {
    return row.state === 0;
  },
  column: [
    {
      label: "设备名称",
      prop: "deviceName",
      addDisabled: true,
      search: true,
    },
    {
      label: "编号",
      prop: "deviceNo",
      search: true,
      rules: [
        {
          required: true,
          message: "设备编号不能为空",
          trigger: "trigger",
        },
      ],
      click: ({ value, column }) => {
        if (column.boxType) {
          dialog.visible = true;
        }
      },
      change: ({ value, column }) => {
        if (column.boxType) {
          if (value != form.value.deviceNo) {
            if (column.boxType) {
              dialog.visible = true;
            }
          }
        }
      },
    },
    {
      label: "型号",
      prop: "specifications",
      addDisabled: true,
    },
    {
      label: "故障现象",
      prop: "bugRemark",
      minRows: 2, //最小行/最小值
      type: "textarea", //类型为多行文本域框
      maxlength: 512, //最大输入长度,
      overHidden: true,
      rules: [
        {
          required: true,
          message: "故障描述不能为空",
          trigger: "trigger",
        },
      ],
    },
    {
      label: "使用人",
      prop: "creator",
      display: false,
    },
    {
      label: "日期",
      prop: "created",
      width: "180",
      display: false,
    },
    {
      label: "设备类型",
      prop: "deviceType",
      type: "select",
      addDisabled: true,
      search: true,
      dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.device_type,
      props: {
        label: "dictLabel",
        value: "dictValue",
      },
      rules: [
        {
          required: true,
          message: "设备类型不能为空",
          trigger: "trigger",
        },
      ],
    },
    {
      label: "设备位置",
      addDisabled: true,
      prop: "devicePosition",
    },

    {
      label: "维修状态",
      prop: "state",
      type: "select",
      display: false,
      overHidden: true,
      dicData: [
        { label: "待维修", value: 0 },
        { label: "待科研生产部设备管理员审批 ", value: 1 },
        { label: "审核不通过", value: 2 },
        { label: "待科研生产部负责人审批", value: 3 },
        { label: "审核不通过", value: 4 },
        { label: "待使用人审核", value: 5 },
        { label: "审核不通过", value: 6 },
        { label: "待使用部门负责人审核", value: 7 },
        { label: "审核不通过", value: 8 },
        { label: "已完成", value: 9 },
      ],
    },
  ],
});

onMounted(() => {
  dataList();
  queryUserList();
});
</script>
