lin.liu 3 viikkoa sitten
vanhempi
commit
2ed532a54b

+ 18 - 0
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/controller/DangerCheckFormController.java

@@ -106,6 +106,24 @@ public class DangerCheckFormController extends BasicController {
         return this.service.get(id);
     }
 
+    /**
+     * 停用[隐患检查表]
+     * @author lin.liu
+     */
+    @PostMapping(value = "stop/{id}")
+    public ExecutedResult<String> stop(@PathVariable Long id) {
+        return this.service.stop(id);
+    }
+
+    /**
+     * 启用[隐患检查表]
+     * @author lin.liu
+     */
+    @PostMapping(value = "enable/{id}")
+    public ExecutedResult<String> enable(@PathVariable Long id) {
+        return this.service.enable(id);
+    }
+
     /**
      * 根据id批量获取[隐患检查表]
      * @author lin.liu

+ 6 - 1
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/domain/vo/DangerCheckFormVO.java

@@ -24,6 +24,7 @@ package com.customs.cq.datacenter.business.domain.vo;
 
 import com.customs.cq.datacenter.business.entity.request.dangercheckitem.ReqCreateDangerCheckItem;
 import com.customs.cq.datacenter.common.enums.ECheckCycle;
+import com.customs.cq.datacenter.common.enums.EState;
 import lombok.Data;
 
 import com.customs.cq.datacenter.common.utils.LocalDateTimeUtil;
@@ -68,7 +69,11 @@ public class DangerCheckFormVO extends DangerCheckFormPO implements BasicVO {
      */
     private String dangerCategoryTxt;
 
-    public String getDangerCategoryTxt() {
+    public String getCheckCycleTxt() {
         return ECheckCycle.getByValue(this.getCheckCycle()).getDesc();
     }
+
+    public String getStatusTxt() {
+        return EState.getByValue(this.getStatus()).getDesc();
+    }
 }

+ 16 - 0
secure-producting-vue/src/api/form/DangerCheckForm.js

@@ -34,3 +34,19 @@ export function modify(data) {
     data: data
   })
 }
+
+// 停用[隐患检查表]
+export function stop(id) {
+  return request({
+    url: '/dangerCheckForm/stop/' + id,
+    method: 'post'
+  })
+}
+
+// 启用[隐患检查表]
+export function enable(id) {
+  return request({
+    url: '/dangerCheckForm/enable/' + id,
+    method: 'post'
+  })
+}

+ 78 - 13
secure-producting-vue/src/views/form/DangerCheckForm.vue

@@ -95,22 +95,38 @@
       <el-table-column label="检查表名称" align="center" prop="name" />
       <el-table-column label="隐患分类" align="center" prop="dangerCategoryTxt" />
       <el-table-column label="检查频率" align="center" prop="checkCycleTxt" />
-      <el-table-column label="创建时间" align="center" prop="createTimeView" />
-      <el-table-column label="隐患分类" align="center" prop="dangerCategoryTxt" />
+      <el-table-column label="状态" align="center" prop="statusTxt" />
       <el-table-column label="数据创建人" align="center" prop="createByName" />
-      <el-table-column label="操作" align="center" width="150" fixed="right" class-name="small-padding fixed-width">
+      <el-table-column label="创建时间" align="center" prop="createTimeView" />
+      <el-table-column label="最后更新时间" align="center" prop="updateTimeView" />
+      <el-table-column label="操作" align="center" width="300" fixed="right" class-name="small-padding fixed-width">
         <template #default="scope">
           <el-button
             link
             type="primary"
+            icon="View"
             @click="handleDetail(scope.row)"
           >详情</el-button>
           <el-button
             link
-            type="primary"
+            type="info"
             icon="Edit"
             @click="handleUpdate(scope.row)"
           >修改</el-button>
+          <el-button :disabled="scope.row.status === 2"
+            link
+            type="danger"
+            icon="Remove"
+            :loading="disableLoading"
+            @click="handleDisable(scope.row)"
+          >停用</el-button>
+          <el-button :disabled="scope.row.status === 1"
+            link
+            type="success"
+            icon="Refresh"
+            :loading="enableLoading"
+            @click="handleEnable(scope.row)"
+          >启用</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -300,7 +316,7 @@
 <script setup name="DangerCheckForm">
 import { listEnumValue } from "@/api/system/base"
 import { listAllDangerCategory } from "@/api/danger/DangerCategory";
-import { detail, modify, create, search } from "@/api/form/DangerCheckForm";
+import { detail, modify, create, search, stop, enable } from "@/api/form/DangerCheckForm";
 
 const { proxy } = getCurrentInstance();
 
@@ -314,6 +330,9 @@ const dialogOpenCreate = ref(false);
 const modifyLoading = ref(false);
 const dialogOpenModify = ref(false);
 
+const disableLoading = ref(false);
+const enableLoading = ref(false);
+
 const total = ref(0);
 const dateRangeCreateTime = ref([]);
 const ids = ref([]);
@@ -520,14 +539,14 @@ function submitModify() {
       modifyLoading.value = true;
 
       modify(formModify.value)
-        .then((response) => {
-          proxy.$modal.msgSuccess("修改成功");
-          dialogOpenModify.value = false;
-          getList();
-        })
-        .finally(() => {
-          modifyLoading.value = false;
-        });
+      .then((response) => {
+        proxy.$modal.msgSuccess("修改成功");
+        dialogOpenModify.value = false;
+        getList();
+      })
+      .finally(() => {
+        modifyLoading.value = false;
+      });
     }
   });
 }
@@ -561,6 +580,52 @@ function handleRemovePoint(type, item) {
 }
 
 
+/** 停用 */
+function handleDisable(row) {
+  const id = row.id || ids.value[0];
+  proxy.$modal.confirm('确认停用吗?')
+  .then(() => {
+    disableLoading.value = true;
+
+    stop(id)
+    .then((response) => {
+      proxy.$modal.msgSuccess("操作成功");
+      getList();
+    })
+    .finally(() => {
+      disableLoading.value = false;
+    });
+  })
+  .catch((action) => {
+    if (action === 'cancel') {
+    proxy.$modal.msg('取消操作');
+    }
+  });
+}
+/** 启用 */
+function handleEnable(row) {
+  const id = row.id || ids.value[0];
+  proxy.$modal.confirm('确认启用吗?')
+  .then(() => {
+    enableLoading.value = true;
+
+    enable(id)
+    .then((response) => {
+      proxy.$modal.msgSuccess("操作成功");
+      getList();
+    })
+    .finally(() => {
+      enableLoading.value = false;
+    });
+  })
+  .catch((action) => {
+    if (action === 'cancel') {
+    proxy.$modal.msg('取消操作');
+    }
+  });
+}
+
+
 
 /** 获取检查频率下拉框枚举值列表 */
 function getCheckCycleList() {