cloud-web-corejs 1.1.0-dev.37 → 1.1.0-dev.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloud-web-corejs",
3
3
  "private": false,
4
- "version": "1.1.0-dev.37",
4
+ "version": "1.1.0-dev.39",
5
5
  "scripts": {
6
6
  "build:ace-resources": "node build/build-ace-resources.js",
7
7
  "build:tinymce-resources": "node build/build-tinymce-resources.js",
@@ -58,9 +58,7 @@
58
58
  import { on, off } from 'element-ui/src/utils/dom';
59
59
  import { rafThrottle, isFirefox } from 'element-ui/src/utils/util';
60
60
  import { PopupManager } from 'element-ui/src/utils/popup';
61
- import Swiper from 'swiper';
62
- import 'swiper/dist/css/swiper.min.css';
63
- import 'swiper/dist/js/swiper.min';
61
+ import { loadSwiper } from '@base/utils/swiperLoader';
64
62
  const Mode = {
65
63
  CONTAIN: {
66
64
  name: 'contain',
@@ -293,15 +291,17 @@ export default {
293
291
  this.mode = Mode[modeNames[nextIndex]];
294
292
  this.reset();
295
293
  },
296
- prev() {
297
- if (this.isFirst && !this.infinite) return;
294
+ prev() {
295
+ if (this.isFirst && !this.infinite) return;
296
+ if (!this.swiper) return;
298
297
  const len = this.urlArr.length;
299
298
  this.index = (this.index - 1 + len) % len;
300
299
  this.swiper.slideTo(this.index, 100);
301
300
  this.swiperIndex = this.index;
302
301
  },
303
- next() {
304
- if (this.isLast && !this.infinite) return;
302
+ next() {
303
+ if (this.isLast && !this.infinite) return;
304
+ if (!this.swiper) return;
305
305
  const len = this.urlArr.length;
306
306
  this.index = (this.index + 1) % len;
307
307
  this.swiper.slideTo(this.index, 100);
@@ -346,7 +346,7 @@ export default {
346
346
  return this.getHandleImage(imgDTO, 2);
347
347
  });
348
348
  },
349
- mounted() {
349
+ async mounted() {
350
350
  this.deviceSupportInstall();
351
351
  if (this.appendToBody) {
352
352
  document.body.appendChild(this.$el);
@@ -355,8 +355,16 @@ export default {
355
355
  // focus wrapper so arrow key can't cause inner scroll behavior underneath
356
356
  this.$refs['el-image-viewer__wrapper'].focus();
357
357
 
358
- let that = this;
359
- let ff = this.urlArr2;
358
+ let that = this;
359
+ let ff = this.urlArr2;
360
+ let Swiper;
361
+ try {
362
+ Swiper = await loadSwiper();
363
+ } catch (error) {
364
+ this.$message.error('图片预览组件加载失败,请关闭后重试');
365
+ return;
366
+ }
367
+ if (this._isDestroyed) return;
360
368
  setTimeout(function() {
361
369
  that.swiper = new Swiper('.small-slide', {
362
370
  slidesPerView: 'auto',
@@ -1,8 +1,7 @@
1
- /**version-1.0*/
2
- import { read, utils } from "xlsx";
3
-
4
- let tmixins = {};
5
- var XLSX = window.XLSX || { read, utils };
1
+ /**version-1.0*/
2
+ import { loadXlsx } from "@base/utils/xlsxLoader";
3
+
4
+ let tmixins = {};
6
5
  import { getToken } from "../../utils/auth";
7
6
  import XEUtils from "xe-utils";
8
7
  import { getErrorMsg } from "@base/utils/index.js";
@@ -15,11 +14,10 @@ import {
15
14
  toFileSizeMb,
16
15
  } from "../../utils/importLimit";
17
16
 
18
- let configUtil = {
19
- baseUrl: process.env.VUE_APP_BASE_API,
20
- XLSX,
21
- getToken,
22
- };
17
+ let configUtil = {
18
+ baseUrl: process.env.VUE_APP_BASE_API,
19
+ getToken,
20
+ };
23
21
  // 计时器与遮罩句柄必须挂实例:模块级单例在 tagsView 同时开两个导入页时会被后开的
24
22
  // 那个覆盖,先开的 100ms interval 永远停不掉,还会把整个组件钉住不被回收。
25
23
  tmixins = {
@@ -231,9 +229,9 @@ tmixins = {
231
229
  failRows: this.failRows,
232
230
  };
233
231
  },
234
- async readExcel(file, callback) {
235
- let that = this;
236
- let option = this.option;
232
+ async readExcel(file, callback) {
233
+ let that = this;
234
+ let option = this.option;
237
235
 
238
236
  // 整文件读进内存前先卡一刀:下面的 readAsBinaryString + XLSX.read 是同步的,
239
237
  // 占用约为文件体积的 5~20 倍,超限时崩在库内部,连提示都给不出来。
@@ -250,15 +248,23 @@ tmixins = {
250
248
  }
251
249
  )
252
250
  );
253
- return false;
254
- }
255
-
256
- const fileReader = new FileReader();
251
+ return false;
252
+ }
253
+
254
+ let XLSX;
255
+ try {
256
+ XLSX = await loadXlsx();
257
+ } catch (error) {
258
+ this.$baseAlert(this.$t1("Excel解析组件加载失败,请刷新页面后重试"));
259
+ return false;
260
+ }
261
+
262
+ const fileReader = new FileReader();
257
263
  fileReader.onload = async (ev) => {
258
264
  var resultData;
259
265
  try {
260
266
  const data = ev.target.result;
261
- const workbook = configUtil.XLSX.read(data, {
267
+ const workbook = XLSX.read(data, {
262
268
  type: "binary",
263
269
  });
264
270
 
@@ -275,7 +281,7 @@ tmixins = {
275
281
  );
276
282
  return false;
277
283
  }
278
- var range = configUtil.XLSX.utils.decode_range(sheet["!ref"]);
284
+ var range = XLSX.utils.decode_range(sheet["!ref"]);
279
285
  var dataSize = range.e.r + 1; //行数
280
286
  that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
281
287
  // 行数闸门:下面逐格取值、建行对象、再整批发包全是同步的,行数失控时
@@ -312,7 +318,7 @@ tmixins = {
312
318
  for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
313
319
  var nextCell
314
320
  = sheet[
315
- configUtil.XLSX.utils.encode_cell({
321
+ XLSX.utils.encode_cell({
316
322
  r: rowNum,
317
323
  c: colNum,
318
324
  })
@@ -1,18 +1,14 @@
1
- /**version-1.0*/
2
- import {read, utils} from 'xlsx'
3
-
4
- let tmixins = {};
5
- var XLSX = window.XLSX || {read, utils};
1
+ /**version-1.0*/
2
+ let tmixins = {};
6
3
  import {
7
4
  getToken
8
5
  } from '../../utils/auth';
9
6
  import { getErrorMsg } from '@base/utils/index.js'
10
7
 
11
- let configUtil = {
12
- baseUrl: process.env.VUE_APP_BASE_API,
13
- XLSX,
14
- getToken
15
- };
8
+ let configUtil = {
9
+ baseUrl: process.env.VUE_APP_BASE_API,
10
+ getToken
11
+ };
16
12
  // importTimer / loadingObj 原为模块级单例:两个导入弹窗并存时后者覆盖前者引用,
17
13
  // 前一个 interval(100ms/次)与 loading 永久失控——已改为实例属性 this.importTimer / this.loadingObj
18
14
  tmixins = {
@@ -1,18 +1,14 @@
1
- /**version-1.0*/
2
- import {read, utils} from 'xlsx'
3
-
4
- let tmixins = {};
5
- var XLSX = window.XLSX || {read, utils};
1
+ /**version-1.0*/
2
+ let tmixins = {};
6
3
  import {
7
4
  getToken
8
5
  } from '../../utils/auth';
9
6
  import { getErrorMsg } from '@base/utils/index.js'
10
7
 
11
- let configUtil = {
12
- baseUrl: process.env.VUE_APP_BASE_API,
13
- XLSX,
14
- getToken
15
- };
8
+ let configUtil = {
9
+ baseUrl: process.env.VUE_APP_BASE_API,
10
+ getToken
11
+ };
16
12
  // importTimer / loadingObj 原为模块级单例:两个导入弹窗并存时后者覆盖前者引用,
17
13
  // 前一个 interval(100ms/次)与 loading 永久失控——已改为实例属性 this.importTimer / this.loadingObj
18
14
  tmixins = {
@@ -1,10 +1,9 @@
1
1
  /**version-1.0*/
2
- import { read, utils } from "xlsx";
3
2
  import axios from "axios";
4
3
  import SparkMD5 from "spark-md5";
4
+ import { loadXlsx } from "@base/utils/xlsxLoader";
5
5
 
6
6
  let tmixins = {};
7
- let XLSX = window.XLSX || { read, utils };
8
7
  import { getToken } from "../../../../../utils/auth";
9
8
  import XEUtils from "xe-utils";
10
9
  import { getErrorMsg } from "@base/utils/index.js";
@@ -23,7 +22,6 @@ import {
23
22
 
24
23
  let configUtil = {
25
24
  baseUrl: process.env.VUE_APP_BASE_API,
26
- XLSX,
27
25
  getToken,
28
26
  };
29
27
  // 执行壳打在行上的记账字段:只服务进度框与结果表。行对象是原地复用的,
@@ -482,12 +480,20 @@ tmixins = {
482
480
  this.fileCellFields = [];
483
481
  this.urlAttachFields = {};
484
482
 
483
+ let XLSX;
484
+ try {
485
+ XLSX = await loadXlsx();
486
+ } catch (error) {
487
+ this.$baseAlert(this.$t1("Excel解析组件加载失败,请刷新页面后重试"));
488
+ return false;
489
+ }
490
+
485
491
  const fileReader = new FileReader();
486
492
  fileReader.onload = async (ev) => {
487
493
  let resultData;
488
494
  try {
489
495
  const data = ev.target.result;
490
- const workbook = configUtil.XLSX.read(data, {
496
+ const workbook = XLSX.read(data, {
491
497
  type: "binary",
492
498
  });
493
499
 
@@ -505,7 +511,7 @@ tmixins = {
505
511
  that.handleClose2();
506
512
  return false;
507
513
  }
508
- let range = configUtil.XLSX.utils.decode_range(sheet["!ref"]);
514
+ let range = XLSX.utils.decode_range(sheet["!ref"]);
509
515
  let dataSize = range.e.r + 1; //行数
510
516
  that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
511
517
  // 行数闸门:下面逐格取值、建行对象、再整批发包全是同步的,行数失控时主线程会被
@@ -541,7 +547,7 @@ tmixins = {
541
547
  for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
542
548
  let nextCell =
543
549
  sheet[
544
- configUtil.XLSX.utils.encode_cell({
550
+ XLSX.utils.encode_cell({
545
551
  r: rowNum,
546
552
  c: colNum,
547
553
  })
@@ -2204,6 +2210,7 @@ tmixins = {
2204
2210
  async generateNewExcel() {
2205
2211
  let file = this.fileRaw;
2206
2212
  try {
2213
+ const XLSX = await loadXlsx();
2207
2214
  // 1. 读取原始文件
2208
2215
  const workbook = XLSX.read(file, { type: "binary" });
2209
2216
  const sheetName = workbook.SheetNames[0];
@@ -2285,12 +2292,20 @@ tmixins = {
2285
2292
  this.fileCellFields = [];
2286
2293
  this.urlAttachFields = {};
2287
2294
 
2295
+ let XLSX;
2296
+ try {
2297
+ XLSX = await loadXlsx();
2298
+ } catch (error) {
2299
+ this.$baseAlert(this.$t1("Excel解析组件加载失败,请刷新页面后重试"));
2300
+ return false;
2301
+ }
2302
+
2288
2303
  const fileReader = new FileReader();
2289
2304
  fileReader.onload = async (ev) => {
2290
2305
  let resultData;
2291
2306
  try {
2292
2307
  const data = ev.target.result;
2293
- const workbook = configUtil.XLSX.read(data, {
2308
+ const workbook = XLSX.read(data, {
2294
2309
  type: "binary",
2295
2310
  });
2296
2311
 
@@ -2309,7 +2324,7 @@ tmixins = {
2309
2324
  that.handleClose2();
2310
2325
  return false;
2311
2326
  }
2312
- let range = configUtil.XLSX.utils.decode_range(sheet["!ref"]);
2327
+ let range = XLSX.utils.decode_range(sheet["!ref"]);
2313
2328
  let dataSize = range.e.r + 1; //行数
2314
2329
  that.dataSize = dataSize - 3 >= 0 ? dataSize - 3 : 0;
2315
2330
  // 行数闸门:下面逐格取值、建行对象、再整批发包全是同步的,行数失控时主线程会被
@@ -2345,7 +2360,7 @@ tmixins = {
2345
2360
  for (colNum = range.s.c; colNum <= range.e.c; colNum++) {
2346
2361
  let nextCell =
2347
2362
  sheet[
2348
- configUtil.XLSX.utils.encode_cell({
2363
+ XLSX.utils.encode_cell({
2349
2364
  r: rowNum,
2350
2365
  c: colNum,
2351
2366
  })
@@ -1,4 +1,8 @@
1
- const requireComponent = require.context('./', false, /\w+\.vue$/)
1
+ const requireComponent = require.context(
2
+ './',
3
+ false,
4
+ /^(?!\.\/echart-(bar|category|pie)-widget\.vue$).*\w+\.vue$/
5
+ )
2
6
 
3
7
  let comps = {}
4
8
 
@@ -7,4 +11,9 @@ requireComponent.keys().map(fileName => {
7
11
  if(comp.name)comps[comp.name] = comp
8
12
  })
9
13
 
14
+ // 图表控件整体异步注册:普通表单没有图表字段时,不下载 vue-echarts/echarts。
15
+ comps['echart-bar-widget'] = () => import('./echart-bar-widget.vue')
16
+ comps['echart-category-widget'] = () => import('./echart-category-widget.vue')
17
+ comps['echart-pie-widget'] = () => import('./echart-pie-widget.vue')
18
+
10
19
  export default comps;
@@ -0,0 +1,20 @@
1
+ let swiperPromise = null;
2
+
3
+ function normalizeSwiperModule(mod) {
4
+ return (mod && mod.default) || mod;
5
+ }
6
+
7
+ export function loadSwiper() {
8
+ if (!swiperPromise) {
9
+ swiperPromise = Promise.all([
10
+ import("swiper"),
11
+ import("swiper/dist/css/swiper.min.css"),
12
+ ])
13
+ .then(([mod]) => normalizeSwiperModule(mod))
14
+ .catch((error) => {
15
+ swiperPromise = null;
16
+ throw error;
17
+ });
18
+ }
19
+ return swiperPromise;
20
+ }
@@ -0,0 +1,29 @@
1
+ let xlsxPromise = null;
2
+
3
+ function normalizeXlsxModule(mod) {
4
+ return (mod && mod.default) || mod;
5
+ }
6
+
7
+ /**
8
+ * Excel 解析库按操作加载。
9
+ *
10
+ * xlsx 体积较大,若在导入组件模块顶层静态 import,会被 webpack 提升成所有
11
+ * 表单视图的公共前置 chunk,导致普通菜单首次打开也必须等待 chunk-xlsx。
12
+ */
13
+ export function loadXlsx() {
14
+ if (typeof window !== "undefined" && window.XLSX) {
15
+ return Promise.resolve(window.XLSX);
16
+ }
17
+ if (!xlsxPromise) {
18
+ // chunk 名交给消费方的 splitChunks.cacheGroups.xlsx 统一管理,避免 webpack 5
19
+ // 中动态 import 显式命名与 cache group 同名时发生 chunk 冲突。
20
+ xlsxPromise = import("xlsx")
21
+ .then(normalizeXlsxModule)
22
+ .catch((error) => {
23
+ // 网络抖动或版本切换失败后允许下一次操作重新请求。
24
+ xlsxPromise = null;
25
+ throw error;
26
+ });
27
+ }
28
+ return xlsxPromise;
29
+ }
@@ -8,6 +8,15 @@
8
8
  <div class="menu-fallback-title">{{ menuTitle }}</div>
9
9
  <div class="menu-fallback-msg">{{ message }}</div>
10
10
  <div v-if="detail" class="menu-fallback-detail">{{ detail }}</div>
11
+ <el-button
12
+ v-if="canReload"
13
+ class="menu-fallback-action"
14
+ type="primary"
15
+ size="small"
16
+ @click="reloadPage"
17
+ >
18
+ {{ $t1("刷新页面") }}
19
+ </el-button>
11
20
  </div>
12
21
  </div>
13
22
  </template>
@@ -78,6 +87,16 @@ export default {
78
87
  }
79
88
  return parts.join(" | ");
80
89
  },
90
+ canReload() {
91
+ return !this.foreignApp && /页面资源加载失败|Loading (CSS )?chunk|ChunkLoadError|Failed to fetch dynamically imported module/i.test(
92
+ this.loadError || ""
93
+ );
94
+ },
95
+ },
96
+ methods: {
97
+ reloadPage() {
98
+ window.location.reload();
99
+ },
81
100
  },
82
101
  };
83
102
  </script>
@@ -119,5 +138,9 @@ export default {
119
138
  color: #909399;
120
139
  word-break: break-all;
121
140
  }
141
+
142
+ .menu-fallback-action {
143
+ margin-top: 20px;
144
+ }
122
145
  }
123
146
  </style>
@@ -6,7 +6,7 @@
6
6
  :close-on-click-modal="false"
7
7
  :visible.sync="showWfDialog"
8
8
  :modal="false"
9
- custom-class="el-dialog dialog-style designer-dialog indexUse"
9
+ custom-class="el-dialog dialog-style designer-dialog indexUse wf-content-dialog"
10
10
  width="100%"
11
11
  height="100%"
12
12
  top="0px"
@@ -156,4 +156,30 @@ export default {
156
156
  };
157
157
  </script>
158
158
 
159
- <style scoped></style>
159
+ <style lang="scss">
160
+ /*
161
+ * 待办详情弹框只允许详情正文滚动。
162
+ *
163
+ * vform 的宿主比普通详情页多两层 div;如果高度链断掉,.designer-view 会退化成
164
+ * 实际滚动容器,详情标题栏和绝对定位的模块导航就会一起被卷走。
165
+ */
166
+ .wf-content-dialog > .el-dialog__body > #containt {
167
+ > div,
168
+ > div > .designer-view,
169
+ > div > .designer-view > div,
170
+ > div > .designer-view > div > .render-form {
171
+ height: 100%;
172
+ min-height: 0;
173
+ box-sizing: border-box;
174
+ }
175
+
176
+ > div > .designer-view {
177
+ overflow: hidden;
178
+ }
179
+
180
+ > div > .designer-view > div > .render-form > .container-wrapper {
181
+ height: 100%;
182
+ min-height: 0;
183
+ }
184
+ }
185
+ </style>