Browse Source

导入功能,报错提示调整

ljb 7 months ago
parent
commit
df229c1409

+ 6 - 1
src/components/upload-excel-dialog/index.vue

@@ -9,6 +9,7 @@
       :option="options"
       v-model="excelForm"
       :upload-after="handleUploadAfter"
+      :upload-error="handleUploadError"
     >
       <template slot="excelTemplate">
         <el-button type="primary" @click="handleTemplate">
@@ -64,7 +65,7 @@ export default {
             },
             data: this.excelParams,
             tip: "请上传 .xls,.xlsx 标准格式文件",
-            action: this.url,
+            action: this.url+'?source=uploadImport',
           },
           {
             label: "模板下载",
@@ -84,10 +85,14 @@ export default {
       this.excelParams = excelParams;
     },
     handleUploadAfter(res, done, loading, column) {
+      console.log(res)
       this.excelBox = false;
       this.uploadAfter && this.uploadAfter(res, done, loading, column);
       done();
     },
+    handleUploadError(err, column) {
+      console.log(err, column)
+    },
     handleTemplate() {
       getDictValueByKey('import-template', this.templateKey).then(({ data }) => {
         if (data.code == 200) {

+ 10 - 6
src/router/axios.js

@@ -10,7 +10,7 @@ import store from '@/store/';
 import router from '@/router/router';
 import {serialize} from '@/util/util';
 import {getToken, removeToken, removeRefreshToken} from '@/util/auth';
-import {Message} from 'element-ui';
+import {Message, MessageBox} from 'element-ui';
 import {isURL, validatenull} from "@/util/validate";
 import website from '@/config/website';
 import {Base64} from 'js-base64';
@@ -203,11 +203,15 @@ axios.interceptors.response.use(res => {
   }
 
   // 如果请求为非200否者默认统一处理
-  if (status !== 200) {
-    Message({
-      message: message,
-      type: 'error'
-    });
+  if (status !== 200) {   
+    if (config.url.indexOf("source=uploadImport") > -1) {
+      MessageBox.alert(message, '提示');
+    } else {
+       Message({
+        message: message,
+        type: 'error'
+      });
+    }
     return Promise.reject(new Error(message));
   }
 

+ 1 - 0
src/views/authority/role.vue

@@ -145,6 +145,7 @@ import {validatenull} from "@/util/validate";
           menuWidth: 350,
           dialogWidth: 600,
           dialogClickModal: false,
+          defaultExpandAll: true,
           column: [
             {
               label: "上级角色",

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

@@ -125,7 +125,6 @@ export default window.$crudCommon({
   },
   watch: {
     'params.yearAndMonth'(newVal) {
-      console.log(moment(newVal).startOf('months').format('YYYY-MM-DD'), moment(newVal).endOf('months').format('YYYY-MM-DD'))
       if (newVal.length > 4) {
         // 是否勾选未全年
         this.isSelAnnual = false;
@@ -136,20 +135,21 @@ export default window.$crudCommon({
       this.getList(this.page);
 
 
-      // this.option.column.forEach(item => {
-      //   if (item.prop == 'hireDate') {
-      //     let lastMonthEndDate = moment(newVal).subtract(1, 'months').endOf('months').format('YYYY-MM-DD'); // 上个月最后一天
-      //     let monthEndDate = moment(newVal).endOf('months').format('YYYY-MM-DD'); // 当前月最后一天
-      //     item.defaultValue = monthEndDate;
-      //     item.pickerOptions = {
-      //       disabledDate(time) {
+      this.option.column.forEach(item => {
+        if (item.prop == 'hireDate') {
+          let lastMonthEndDate = moment(newVal).subtract(1, 'months').endOf('months').format('YYYY-MM-DD'); // 上个月最后一天
+          let monthEndDate = moment(newVal).endOf('months').format('YYYY-MM-DD'); // 当前月最后一天
+          item.defaultValue = monthEndDate;
+          item.pickerOptions = {
+            disabledDate(time) {
               
 
-      //         return time.getTime() < new Date(lastMonthEndDate).getTime() || time.getTime() > new Date(monthEndDate).getTime();
-      //       }
-      //     };
-      //   }
-      // });
+              // return time.getTime() < new Date(lastMonthEndDate).getTime() || time.getTime() > new Date(monthEndDate).getTime();
+              return time.getTime() > new Date(monthEndDate).getTime();
+            }
+          };
+        }
+      });
     },
   },
   computed: {