Sfoglia il codice sorgente

新增 发起消防安检

wzg 1 anno fa
parent
commit
fc0d4685f4
1 ha cambiato i file con 50 aggiunte e 1 eliminazioni
  1. 50 1
      src/views/fireSafetyManage/fireSafetyTemplateList.vue

+ 50 - 1
src/views/fireSafetyManage/fireSafetyTemplateList.vue

@@ -69,6 +69,16 @@
             >
               删除
             </el-button>
+            <el-button
+              @click="
+                addFireSafetyCheck(scope.row.id, scope.row.securityCheckName)
+              "
+              type="success"
+              text
+              size="small"
+            >
+              发起
+            </el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -86,7 +96,12 @@
 </template>
 <script setup>
 import { ref, h, reactive, toRefs, onMounted } from "vue";
-import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
+import {
+  ElNotification,
+  ElMessageBox,
+  ElMessage,
+  ElLoading,
+} from "element-plus";
 import store from "../../store";
 import router from "../../router";
 import md5 from "md5";
@@ -132,9 +147,15 @@ function deleteFireSafetyTemplate(id, securityCheckName) {
     type: "warning",
   })
     .then(async () => {
+      const loading = ElLoading.service({
+        lock: true,
+        text: "正在删除...",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
       let { data } = await api.deleteFireSafetyTemplate({
         id,
       });
+      loading.close();
       if (data.status == 0) {
         ElMessage({
           type: "success",
@@ -151,6 +172,34 @@ function pageChange(e) {
   currentPage.value = e;
   getFireSafetyTemplateList();
 }
+
+function addFireSafetyCheck(templateId, securityCheckName) {
+  ElMessageBox.confirm(`确认发起消防安检: ${securityCheckName} ?`, "提示", {
+    confirmButtonText: "确认",
+    cancelButtonText: "取消",
+    type: "warning",
+  })
+    .then(async () => {
+      const loading = ElLoading.service({
+        lock: true,
+        text: "正在发起消防安检...",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      let { data } = await api.addFireSafetyCheck({
+        templateId,
+      });
+      loading.close();
+      if (data.status == 0) {
+        ElMessage({
+          type: "success",
+          message: data.msg,
+          duration: 1500,
+        });
+      }
+      getFireSafetyTemplateList();
+    })
+    .catch(() => {});
+}
 onMounted(() => {
   getFireSafetyTemplateList();
 });