Browse Source

引入或者读取功能增加loading框

ljb 6 months ago
parent
commit
521357dfda

+ 8 - 0
src/mixins/crud.js

@@ -237,6 +237,14 @@ export default (app, option = {}) => {
       },
       refreshChange() {
         this.getList();
+      },
+      getPageLoading(text = '正在努力加载中,请耐心等待...') {
+        return this.$loading({
+          lock: true,
+          text,
+          spinner: 'el-icon-loading',
+          background: 'rgba(0, 0, 0, 0.7)'
+        });
       }
     }
   }

+ 4 - 0
src/views/basic-resource/comp-basic-info/ky-asset-list.vue

@@ -276,7 +276,9 @@ export default window.$crudCommon({
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
+        const _pageLoading = this.getPageLoading('数据读取中,请耐心等待...');
         getLastMonthData({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+          _pageLoading.close();
           let data = res.data;
           if (data.success) {
 
@@ -284,6 +286,8 @@ export default window.$crudCommon({
             this.page.currentPage = 1;
             this.getList(this.page);
           }
+        }).catch(err => {
+          _pageLoading.close();
         });
       });
     },

+ 4 - 0
src/views/basic-resource/comp-basic-info/technician-roster.vue

@@ -252,7 +252,9 @@ export default window.$crudCommon({
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
+        const _pageLoading = this.getPageLoading('数据读取中,请耐心等待...');
         getLastMonthData({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+          _pageLoading.close();
           let data = res.data;
           if (data.success) {
 
@@ -260,6 +262,8 @@ export default window.$crudCommon({
             this.page.currentPage = 1;
             this.getList(this.page);
           }
+        }).catch(err => {
+          _pageLoading.close();
         });
       });
     },

+ 4 - 0
src/views/external-reports/components/ky-project-list.vue

@@ -148,11 +148,15 @@ export default window.$crudCommon({
       })
     },
     handleReadMonthProject() {
+      const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
       readMonthProject({ yearAndMonth: this.params.yearAndMonth, type: this.type }).then(({ data }) => {
+        _pageLoading.close();
         if (data.code == 200) {
           this.$message.success("引入成功!");
           this.loadData();
         }
+      }).catch(err => {
+        _pageLoading.close();
       })
     },
   },

+ 4 - 0
src/views/tech-person/month-cjcyry.vue

@@ -140,12 +140,16 @@ export default window.$crudCommon({
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
+        const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
         yyysbmd({ yearAndMonth: this.params.yearAndMonth }).then(({ data }) => {
+          _pageLoading.close();
           if (data.code == 200) {
             this.$message.success("引用预算表成功");
             this.page.currentPage = 1;
             this.getList(this.page);
           }
+        }).catch(err => {
+          _pageLoading.close();
         });
       })
     },

+ 4 - 0
src/views/yf-cost-manage/basic-data-setting/atten-info.vue

@@ -199,13 +199,17 @@ export default window.$crudCommon({
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
+        const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
         this.api.feachProjectPersonList({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+          _pageLoading.close();
           let data = res.data;
           if (data.success) {
             this.$message.success('引用成功!');
             this.page.currentPage = 1;
             this.getList(this.page);
           }
+        }).catch(err => {
+          _pageLoading.close();
         });
       });
     },

+ 4 - 0
src/views/yf-cost-manage/basic-data-setting/dt-cost-allocation-list.vue

@@ -214,7 +214,9 @@ export default window.$crudCommon({
       })
     },
     handleReadyLastData() {
+      const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
       fetchLastMonthData({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+        _pageLoading.close();
         let data = res.data;
         if (data.success) {
 
@@ -222,6 +224,8 @@ export default window.$crudCommon({
           this.page.currentPage = 1;
           this.getList(this.page);
         }
+      }).catch(err => {
+        _pageLoading.close();
       });
     },
   },

+ 4 - 0
src/views/yf-cost-manage/basic-data-setting/hourse-details-list.vue

@@ -206,7 +206,9 @@ export default window.$crudCommon({
       })
     },
     handleReadyDevData() {
+      const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
       fetchDeviceData({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+        _pageLoading.close();
         let data = res.data;
         if (data.success) {
 
@@ -214,6 +216,8 @@ export default window.$crudCommon({
           this.page.currentPage = 1;
           this.getList(this.page);
         }
+      }).catch(err => {
+        _pageLoading.close();
       });
     },
     handleAssetChange({ zcbm }) {

+ 4 - 0
src/views/yf-cost-manage/basic-data-setting/ky-device-list.vue

@@ -206,7 +206,9 @@ export default window.$crudCommon({
       })
     },
     handleReadyDevData() {
+      const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
       fetchDeviceData({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+        _pageLoading.close();
         let data = res.data;
         if (data.success) {
 
@@ -214,6 +216,8 @@ export default window.$crudCommon({
           this.page.currentPage = 1;
           this.getList(this.page);
         }
+      }).catch(err => {
+        _pageLoading.close();
       });
     },
     handleAssetChange({ zcbm }) {

+ 4 - 0
src/views/yf-cost-manage/basic-data-setting/month-salary-list.vue

@@ -229,13 +229,17 @@ export default window.$crudCommon({
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
+        const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
         getLastMonthData({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+          _pageLoading.close();
           let data = res.data;
           if (data.success) {
             this.$message.success('引用成功!');
             this.page.currentPage = 1;
             this.getList(this.page);
           }
+        }).catch(err => {
+          _pageLoading.close();
         });
       });
     },

+ 7 - 8
src/views/yf-cost-manage/basic-data-setting/working-hours-records.vue

@@ -413,19 +413,14 @@ export default window.$crudCommon({
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
-      const loading = this.$loading({
-        lock: true,
-        text: '数据同步中...',
-        spinner: 'el-icon-loading',
-        background: 'rgba(0, 0, 0, 0.7)'
-      });
+        const _pageLoading = this.getPageLoading("数据同步中,请耐心等待...");
         obj[type].method({ yearAndMonth: this.params.yearAndMonth }).then(() => {
           this.$message.success('同步成功!');
           this.page.currentPage = 1;
           this.getList();
-          loading.close();
+          _pageLoading.close();
         }).catch(() => {
-          loading.close();
+          _pageLoading.close();
         });
       });
     },
@@ -435,13 +430,17 @@ export default window.$crudCommon({
         cancelButtonText: "取消",
         type: "warning"
       }).then(() => {
+        const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
         this.api.feachProjectPersonList({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+          _pageLoading.close();
           let data = res.data;
           if (data.success) {
             this.$message.success('引用成功!');
             this.page.currentPage = 1;
             this.getList(this.page);
           }
+        }).catch(err => {
+          _pageLoading.close();
         });
       });
     },

+ 4 - 0
src/views/yf-cost-manage/basic-data-setting/wxzc-details.vue

@@ -227,7 +227,9 @@ export default window.$crudCommon({
       })
     },
     handleReadyDevData() {
+      const _pageLoading = this.getPageLoading("数据读取中,请耐心等待...");
       fetchDeviceData({ yearAndMonth: this.params.yearAndMonth}).then(res => {
+        _pageLoading.close();
         let data = res.data;
         if (data.success) {
 
@@ -235,6 +237,8 @@ export default window.$crudCommon({
           this.page.currentPage = 1;
           this.getList(this.page);
         }
+      }).catch(err => {
+        _pageLoading.close();
       });
     },
     handleAssetChange({ assetId }) {