src/views/equipmentManagement/repair/index.vue
@@ -71,9 +71,10 @@
          <el-button
            type="primary"
            icon="Plus"
            :disabled="multipleList.length !== 1"
            :disabled="multipleList.length !== 1 || multipleList[0]?.status !== 1"
            @click="addMaintain"
          >
            新增维修
          </el-button>
          <el-button type="success" icon="Van" @click="addRepair">
@@ -86,7 +87,7 @@
            type="danger"
            icon="Delete"
            :disabled="multipleList.length <= 0"
            @click="delRepairByIds(multipleList.map((item) => item.id))"
            @click="delRepairByIds(multipleList)"
          >
            批量删除
          </el-button>
@@ -106,9 +107,12 @@
        @pagination="changePage"
      >
        <template #statusRef="{ row }">
          <el-tag v-if="row.status === 2" type="danger">失败</el-tag>
          <el-tag v-if="row.status === 1" type="success">完结</el-tag>
          <el-tag v-if="row.status === 0" type="warning">待维修</el-tag>
          <el-tag v-if="row.status === 5" type="danger">维修失败</el-tag>
          <el-tag v-if="row.status === 4" type="danger">维修成功</el-tag>
          <el-tag v-if="row.status === 3" type="danger">维修中</el-tag>
          <el-tag v-if="row.status === 2" type="danger">审核失败</el-tag>
          <el-tag v-if="row.status === 1" type="success">审核通过</el-tag>
          <el-tag v-if="row.status === 0" type="warning">审核中</el-tag>
        </template>
        <template #operation="{ row }">
          <el-button
@@ -116,6 +120,7 @@
            text
            icon="editPen"
            @click="editRepair(row.id)"
            :disabled="row.status !== 0"
          >
            编辑
          </el-button>
@@ -123,7 +128,8 @@
            type="danger"
            text
            icon="delete"
            @click="delRepairByIds(row.id)"
            @click="delRepairByIds(row)"
            :disabled="row.status !== 0"
          >
            删除
          </el-button>
@@ -270,6 +276,7 @@
// 新增维修
const addMaintain = () => {
  const row = multipleList.value[0];
  maintainModalRef.value.open(row.id, row);
};
@@ -282,15 +289,40 @@
// 单行删除
const delRepairByIds = async (ids) => {
  let isDel = false
  if(Array.isArray(ids)){
    ids.forEach((item)=>{
      if(item.status !== 0){
        isDel = true
      }
    })
  }else{
    if(ids.status !== 0){
      isDel = true
    }
  }
  if(isDel){
    ElMessage.warning("只能删除审核中的报修数据");
    return
  }
  ElMessageBox.confirm("确认删除报修数据, 此操作不可逆?", "警告", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  }).then(async () => {
    const { code } = await delRepair(ids);
    let idsList = ""
    if(Array.isArray(ids)){
      idsList = multipleList.value.map((item) => item.id);
      console.log(idsList)
    }else{
      idsList = ids.id
    }
    const { code } = await delRepair(idsList);
    if (code === 200) {
      ElMessage.success("删除成功");
      getTableData();
      await getTableData();
    }
  });
};