Selaa lähdekoodia

fix: 加班功能

chenzhen2 2 vuotta sitten
vanhempi
commit
f4dd86d0c9
2 muutettua tiedostoa jossa 22 lisäystä ja 5 poistoa
  1. 2 0
      src/main.ts
  2. 20 5
      src/views/envmonitor/components/workOvertime/index.vue

+ 2 - 0
src/main.ts

@@ -10,6 +10,8 @@ import { Toast, Icon, Tab, Tabs, Loading, Popup } from 'vant'
 import '@/permission'
 
 const app = createApp(App)
+
+// Toast.setDefaultOptions()
 const loadingStart = (duration: any = 0) => {
   Toast.loading({
     duration: duration, // 持续展示 toast

+ 20 - 5
src/views/envmonitor/components/workOvertime/index.vue

@@ -67,6 +67,7 @@ import {
   onUpdated,
   nextTick,
   watch,
+  getCurrentInstance,
 } from "vue";
 import { swiper } from "@/utils/swiper";
 import {
@@ -100,6 +101,7 @@ export default defineComponent({
     },
   },
   setup(props, context) {
+    const proxyGlobal: any = getCurrentInstance();
     const screenInfo: any = {
       screenWidth: 0,
       screenHeight: 0,
@@ -982,11 +984,24 @@ export default defineComponent({
       },
       // 提交加班记录
       saveBatchCustomScene(formTimerArr: any, type: any = 1) {
-        saveBatchCustomScene(formTimerArr).then((res) => {
-          if (type === 1) {
-            context.emit("closeWork");
-          }
-        });
+        proxyGlobal.proxy.$loadingStart(0);
+        proxyData.formBtn = true;
+        saveBatchCustomScene(formTimerArr)
+          .then((res) => {
+            let timer: any = setTimeout(() => {
+              proxyGlobal.proxy.$loadinngEnd();
+              if (type === 1) {
+                context.emit("closeWork");
+              }
+              timer = null;
+              clearTimeout(timer);
+              proxyData.formBtn = false;
+            }, 1000);
+          })
+          .catch(() => {
+            proxyGlobal.proxy.$loadinngEnd();
+            proxyData.formBtn = false;
+          });
       },
       // 删除
       triggerDelTime() {