src/views/safeProduction/accidentReportingRecord/index.vue
@@ -52,7 +52,8 @@
      <el-form ref="formRef"
               :model="form"
               :rules="rules"
               label-width="140px">
               label-position="top"
               label-width="150px">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="事故编号"
@@ -202,9 +203,9 @@
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary"
                     @click="submitForm">确定</el-button>
          <el-button @click="dialogVisible = false">取消</el-button>
        </span>
      </template>
    </el-dialog>
@@ -229,10 +230,10 @@
            {{ currentKnowledge.happenLocation }}
          </el-descriptions-item>
          <el-descriptions-item label="事故等级">
            {{ currentKnowledge.accidentGrade }}
            <el-tag :type="accidentGradeType(currentKnowledge.accidentGrade)">{{ currentKnowledge.accidentGrade }}</el-tag>
          </el-descriptions-item>
          <el-descriptions-item label="事故类型">
            {{ currentKnowledge.accidentType }}
            <el-tag type="info">{{ accidentTypeLabel(currentKnowledge.accidentType) }}</el-tag>
          </el-descriptions-item>
          <el-descriptions-item label="人员伤亡情况">
            {{ currentKnowledge.personLoss }}
@@ -409,6 +410,9 @@
      label: "事故类型",
      prop: "accidentType",
      showOverflowTooltip: true,
      formatData: params => {
        return accidentTypeLabel(params);
      },
    },
    {
      dataType: "action",
@@ -462,6 +466,20 @@
    page.value.current = 1;
    getList();
  };
  const accidentGradeType = val => {
    switch (val) {
      case "轻微事故":
        return "info";
      case "一般事故":
        return "info";
      case "较大事故":
        return "warning";
      case "重大事故":
        return "danger";
      default:
        return "info";
    }
  };
  const accidentGradeOptions = [
    {
      label: "轻微事故",
@@ -480,32 +498,22 @@
      value: "重大事故",
    },
  ];
  const accidentTypeOptions = [
    {
      label: "责任事故",
      value: "责任事故",
    },
    {
      label: "非责任事故",
      value: "非责任事故",
    },
    {
      label: "破坏性事故",
      value: "破坏性事故",
    },
    {
      label: "重大事故",
      value: "重大事故",
    },
  ];
  const { proxy } = getCurrentInstance();
  const { accident_type } = proxy.useDict("accident_type");
  const accidentTypeOptions = computed(() => accident_type?.value || []);
  const accidentTypeLabel = val => {
    const item = accidentTypeOptions.value.find(
      i => String(i.value) === String(val)
    );
    return item ? item.label : val;
  };
  const getList = () => {
    tableLoading.value = true;
    safeAccidentListPage({ ...page.value, ...searchForm.value })
      .then(res => {
        tableLoading.value = false;
        tableData.value = res.data.records;
        page.total = res.data.total;
        page.value.total = res.data.total;
      })
      .catch(err => {
        tableLoading.value = false;
@@ -516,7 +524,7 @@
  const pagination = obj => {
    page.value.current = obj.page;
    page.value.size = obj.limit;
    handleQuery();
    getList();
  };
  const currentUserId = ref("");
  const currentUserName = ref("");
@@ -711,10 +719,6 @@
        // 用户取消
      });
  };
  // 导出
  const { proxy } = getCurrentInstance();
  const { knowledge_type } = proxy.useDict("knowledge_type");
  // 字典工具
  const knowledgeTypeOptions = computed(() => knowledge_type?.value || []);