Browse Source

更新 优化提示

wzg 1 năm trước cách đây
mục cha
commit
ca997e0c65

+ 58 - 9
src/views/fireSafetyManage/checkFireSafetyExamine.vue

@@ -75,7 +75,7 @@
       </div>
     </div>
     <el-divider />
-    <div v-if="isHistory != 1">
+    <div v-if="status != 1">
       <div class="df aic">
         <div class="mr20">选择安全检查员(可多选):</div>
         <el-select
@@ -288,10 +288,10 @@
         <el-input
           v-model="ruleForm.problems"
           type="textarea"
-          :disabled="isHistory == 1"
+          :disabled="status == 1"
         />
       </el-form-item>
-      <el-form-item label="整改意见" prop="problems">
+      <el-form-item label="整改意见" prop="rectificationOpinions">
         <el-input v-model="ruleForm.rectificationOpinions" type="textarea" />
       </el-form-item>
       <el-form-item>
@@ -348,7 +348,7 @@ import { subTimeStr } from "../../utils/utils";
 import { Picture as IconPicture } from "@element-plus/icons-vue";
 
 const route = useRoute();
-let status = ref(0);
+
 let templateDetail = ref({
   items: [],
 });
@@ -373,11 +373,17 @@ async function getFireSafetyCheckDetail(shipSecurityCheckId) {
 
 async function checkFireSafetyItem(shipSecurityCheckItemId, auditStatus) {
   let shipSecurityCheckId = route.query.id;
+  const loading = ElLoading.service({
+    lock: true,
+    text: "正在提交...",
+    background: "rgba(0, 0, 0, 0.7)",
+  });
   let { data } = await api.checkFireSafetyItem({
     shipSecurityCheckId,
     shipSecurityCheckItemId,
     auditStatus,
   });
+  loading.close();
   if (data.status == 0) {
     ElNotification({
       title: "成功",
@@ -428,13 +434,18 @@ async function saveFireSafetyCheckUser() {
   }
   let checkedUserIds = checkedUsers.value.map((item) => item.key);
   let checkedUserNames = checkedUsers.value.map((item) => item.value);
-  console.log(checkedUsers.value, checkedUserIds, checkedUserNames);
+  const loading = ElLoading.service({
+    lock: true,
+    text: "正在保存...",
+    background: "rgba(0, 0, 0, 0.7)",
+  });
 
   let { data } = await api.saveFireSafetyCheckUser({
     shipSecurityCheckId: route.query.id,
     shippingAccountIds: checkedUserIds.join(","),
     shippingAccountNames: checkedUserNames.join(","),
   });
+  loading.close();
   if (data.status == 0) {
     ElNotification({
       title: "成功",
@@ -511,18 +522,56 @@ function initMap() {
 }
 
 const ruleFormRef = ref(null);
-const ruleForm = ref({});
-const rules = ref({});
+const ruleForm = ref({
+  problems: "",
+  rectificationOpinions: "",
+});
+const rules = ref({
+  problems: [
+    {
+      required: true,
+      message: "请填写问题",
+      trigger: "blur",
+    },
+  ],
+  rectificationOpinions: [
+    {
+      required: true,
+      message: "请填写整改意见",
+      trigger: "blur",
+    },
+  ],
+});
 
 const saveFireSafetyCheckRectification = async (formEl) => {
   if (!formEl) return;
   formEl.validate(async (valid, fields) => {
     if (valid) {
-      console.log("submit!");
+      const loading = ElLoading.service({
+        lock: true,
+        text: "正在保存...",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
       let { data } = await api.saveFireSafetyCheckRectification({
         ...ruleForm.value,
         shipSecurityCheckId: route.query.id,
       });
+      loading.close();
+      if (data.status == 0) {
+        ElNotification.success({
+          title: "成功",
+          duration: 1500,
+          message: data.msg,
+        });
+      } else {
+        ElNotification.error({
+          title: "失败",
+          duration: 2000,
+          message: data.msg,
+        });
+      }
+      getFireSafetyCheckDetail(route.query.id);
     } else {
       console.log("error submit!", fields);
     }
@@ -534,7 +583,7 @@ const resetForm = (formEl) => {
   formEl.resetFields();
 };
 
-const isHistory = ref(route.query.isHistory);
+const status = ref(0);
 
 onMounted(() => {
   getFireSafetyCheckDetail(route.query.id);

+ 0 - 1
src/views/fireSafetyManage/fireSafetyHistoryCheckList.vue

@@ -203,7 +203,6 @@ function goTo(id) {
     path: "/fireSafetyManage/checkFireSafetyExamine",
     query: {
       id,
-      isHistory: 1,
     },
   });
 }

+ 8 - 0
src/views/fireSafetyManage/fireSafetyTemplateDetail.vue

@@ -243,9 +243,17 @@ async function addFireSafetyTemplate() {
         securityCheckFocus,
         isAllShip,
       };
+
+      const loading = ElLoading.service({
+        lock: true,
+        text: "正在提交...",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+
       let res = await api[
         id ? "updateFireSafetyTemplate" : "addFireSafetyTemplate"
       ](postData);
+      loading.close();
       if (res.data.status == 0) {
         ElNotification.success({
           title: id ? "更新成功" : "添加成功",