Explorar o código

4.0.49 解决cas单点登录和消息推送播放声音问题 优化数据导入

liuyanpeng %!s(int64=2) %!d(string=hai) anos
pai
achega
1e10145bb0
Modificáronse 4 ficheiros con 36 adicións e 27 borrados
  1. 1 1
      package.json
  2. 0 2
      src/client/Login.vue
  3. 17 1
      src/common/pushMessage.js
  4. 18 23
      src/customer/DataImportPanel.vue

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-base-v4",
   "description": "Leanwo Prodog Client",
-  "version": "4.0.48",
+  "version": "4.0.49",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",

+ 0 - 2
src/client/Login.vue

@@ -314,8 +314,6 @@ export default {
             if (success.datas !== null && success.datas !== undefined) {
               this.authSetting = success.datas;
             }
-          } else {
-            message.warning(success.errorMessage);
           }
         },
         error => {

+ 17 - 1
src/common/pushMessage.js

@@ -35,7 +35,7 @@ export default {
         notification.close(_self.notificationId);
         _self.openNotification(item);
         _self.isShowNotification(item);
-        if (!window.opener && window.opener !== window && allowSound == 'true') {
+        if (_self.JudgmentDomain() && allowSound === 'true') {
           _self.playSound(true);
         }
         _self.allMessage.splice(index, 1);
@@ -45,6 +45,22 @@ export default {
       }
     }, 5000);
   },
+
+  // 判断域名是否相同如果不同才播放声音
+  JudgmentDomain: function () {
+    const prevUrl = localStorage.getItem('#prevUrl');
+    if (prevUrl) {
+      const currentUrl = window.location.hostname;
+      if (prevUrl === currentUrl) {
+        return false;
+      } else {
+        return true;
+      }
+    } else {
+      return true;
+    }
+  },
+
   // 播放声音
   playSound: async function (isPlay) {
     const _self = this;

+ 18 - 23
src/customer/DataImportPanel.vue

@@ -123,7 +123,7 @@
                   v-if="testSuccess"
                   type="button"
                   class="btn btn-primary btn-primary-1 btn-primary-import"
-                  @click="runProcessImport(selectedDataTemplateNo)"
+                  @click="runProcessImport"
                 >
                   {{ $t("lang.DataImportPanel.formalImport") }}
                 </button>
@@ -146,12 +146,9 @@
             </div>
           </div>
 
-          <div class="row">
+          <div v-if="selectedDataTemplate.description != null" class="row">
             <div>
-              <div
-                v-if="selectedDataTemplate != null"
-                style="white-space: pre-wrap"
-              >
+              <div style="white-space: pre-wrap">
                 {{ selectedDataTemplate.description }}
               </div>
             </div>
@@ -161,6 +158,7 @@
             v-if="current === 2"
             :columns="columns"
             :data-source="dataSource"
+            :extra-height="66"
           >
             <template #bodyCell="{ column, record }">
               <template v-if="column.key === 'ImportResult'">
@@ -253,6 +251,7 @@ export default {
       columnCount: null, // 导入列数
       testSuccess: false, // 测试导入是否成功
       isError: false,
+      batchNo: null, //批次号
     };
   },
 
@@ -616,6 +615,7 @@ export default {
       }
 
       var importTableData = {
+        no: _self.selectedDataTemplateNo,
         isForamlImport: isformalImport,
         sheetIndex: sheetIndex,
         importTable: _self.importTable,
@@ -640,6 +640,7 @@ export default {
           _self.showTestImportTable(data.dataList);
           _self.uploadClassFile();
           if (data.isSuccess) {
+            _self.batchNo = data.batchNo;
             Notify.info(
               _self.$t('lang.Notify.success'),
               _self.$t('lang.DataImportPanel.describe5'),
@@ -648,7 +649,8 @@ export default {
           } else {
             Notify.error(
               _self.$t('lang.Notify.fail'),
-              _self.$t('lang.DataImportPanel.describe7') + `导入成功${data.successCount}条,导入失败${data.errorCount}条。`,
+              _self.$t('lang.DataImportPanel.describe7') +
+                `导入成功${data.successCount}条,导入失败${data.errorCount}条。`,
               false,
             );
           }
@@ -662,6 +664,7 @@ export default {
 
     // 导出表格数据
     exportErrorExcel: function () {
+      const _self = this;
       const url = Common.getApiURL('dataImportResource/downloadTemplateExcel');
       const xhr = new XMLHttpRequest();
       xhr.open('get', url, true);
@@ -674,14 +677,13 @@ export default {
           let blob = new Blob([res]);
           const blobUrl = URL.createObjectURL(blob);
           const link = document.createElement('a');
-          link.download = '数据.xlsx';
+          link.download = `${_self.selectedDataTemplate.dataTemplateName}.xlsx`;
           link.style.display = 'none';
           link.href = blobUrl;
           document.body.appendChild(link);
           link.click();
           URL.revokeObjectURL(blobUrl);
           document.body.removeChild(link);
-          message.success('导出数据成功。');
         }
       };
       xhr.send();
@@ -726,14 +728,9 @@ export default {
       }
 
       _self.dataSource = [];
-      let successCount = 0;
       data.forEach(function (item) {
-        if (item.ImportResult === '成功') {
-          successCount += 1;
-        }
         _self.dataSource.push(item.data);
       });
-      let errorCount = data.length - successCount;
       // message
       const flag = _self.dataSource.every(item => {
         return item.ImportResult === '成功';
@@ -750,7 +747,7 @@ export default {
     /**
      * 点击正式导入、清空临时表按钮
      */
-    runProcessImport: function (selectedDataTemplateNo) {
+    runProcessImport: function () {
       var _self = this;
       if (_self.lineCount <= 0) {
         message.warning('请输入正确的导入行数!');
@@ -760,15 +757,10 @@ export default {
         message.warning('请输入正确的导入列数!');
         return;
       }
-      var no = selectedDataTemplateNo;
-      const lineCount = _self.lineCount;
-      const columnCount = _self.columnCount;
+      const no = _self.batchNo;
       _self.loading = true;
       $.ajax({
-        url:
-          Common.getApiURL('dataImportResource/formalDataImportByIds/') +
-          no +
-          `?lineCount=${lineCount}&columnCount=${columnCount}`,
+        url: Common.getApiURL('dataImportResource/formalDataImportByIds/') + no,
         type: 'post',
         dataType: 'json',
         beforeSend: function (request) {
@@ -901,7 +893,7 @@ export default {
 }
 .prevFixed {
   position: fixed;
-  top: 93%;
+  top: 92%;
 }
 .btn-primary-1 {
   color: #fff;
@@ -923,4 +915,7 @@ export default {
 :deep(.ant-table-sticky-scroll) {
   display: none !important;
 }
+.ant-divider-horizontal {
+  margin: 12px 0 !important;
+}
 </style>