cloud-web-corejs 1.0.307 → 1.0.309

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.0.307",
4
+ "version": "1.0.309",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "check:package-resources": "node build/check-package-resources.js",
@@ -190,6 +190,7 @@
190
190
 
191
191
  <script>
192
192
  import { openComponentDialog } from "@base/utils/componentDialog";
193
+ import { getCachedServiceName } from "@base/components/xform/utils/serviceNameCache";
193
194
  import {
194
195
  resolveActionButtons,
195
196
  hasButtonPermission,
@@ -561,14 +562,13 @@ export default {
561
562
  }
562
563
  const [formCode, scriptCode] = parts;
563
564
  this.$set(this.optionsLoadingMap, field.prop, true);
564
- this.$http({
565
- aes: true,
566
- url: USER_PREFIX + "/formScript/getServiceName",
567
- method: "post",
568
- data: { formCode, scriptCode },
565
+ getCachedServiceName(this, {
566
+ formCode,
567
+ scriptCode,
569
568
  isLoading: false,
570
- success: (res) => {
571
- const serviceName = res.objx;
569
+ aes: true,
570
+ }).then(
571
+ (serviceName) => {
572
572
  if (!serviceName) {
573
573
  this.$set(this.optionsLoadingMap, field.prop, false);
574
574
  this.$baseAlert("服务名不存在");
@@ -605,7 +605,10 @@ export default {
605
605
  },
606
606
  });
607
607
  },
608
- });
608
+ () => {
609
+ this.$set(this.optionsLoadingMap, field.prop, false);
610
+ }
611
+ );
609
612
  },
610
613
  // 搜索框默认禁止手输(值由选择回填),传 props: { editable: true } 可放开
611
614
  searchReadonly(field) {
@@ -284,7 +284,7 @@ tmixins = {
284
284
  method: `post`,
285
285
  data: {operateTime: time},
286
286
  modal: false,
287
- ...(silent ? { ignoreNetworkError: true, ignore502: true } : {}),
287
+ ...(silent ? { errorMsg: false } : {}),
288
288
  success: res => {
289
289
  let records = res.objx || [];
290
290
  records.forEach(record => {
@@ -388,7 +388,7 @@ tmixins = {
388
388
  direction: direction
389
389
  },
390
390
  modal: false,
391
- ...(silent ? { ignoreNetworkError: true, ignore502: true } : {}),
391
+ ...(silent ? { errorMsg: false } : {}),
392
392
  success: res => {
393
393
  let rows = res.objx || [];
394
394
  if (rows.length) {
@@ -490,8 +490,7 @@ tmixins = {
490
490
  method: `post`,
491
491
  data: {},
492
492
  modal: false,
493
- ignoreNetworkError: true,
494
- ignore502: true,
493
+ errorMsg: false,
495
494
  success: res => {
496
495
  this.isExitsRead = res.objx === 1;
497
496
  }
@@ -30,6 +30,7 @@ import {
30
30
  } from "@base/components/xform/utils/formula-util";
31
31
  import * as formulajs from "@formulajs/formulajs";
32
32
  import settingConfig from "@/settings.js";
33
+ import { isQueryTableConditionWidget } from "@base/components/xform/utils/fixedQueryUtil";
33
34
 
34
35
  let modules = {};
35
36
  const isDev = process.env.NODE_ENV === "development";
@@ -755,6 +756,17 @@ modules = {
755
756
  }
756
757
  this.initGloatOptionItems(true);
757
758
  },
759
+ /**
760
+ * 查询表格条件区拉选项时不盖加载层。列组件(有 tableParam)和按钮区不走这里。
761
+ * @returns {Object}
762
+ */
763
+ getQueryConditionHttpOption() {
764
+ if (this.tableParam) return {};
765
+ let formRef = this.getFormRef && this.getFormRef();
766
+ let widgetList = formRef && formRef.widgetList;
767
+ if (!isQueryTableConditionWidget(widgetList, this.field)) return {};
768
+ return { isLoading: false, modal: false };
769
+ },
758
770
  initGloatOptionItems(initFlag) {
759
771
  let t = this;
760
772
  if (this.designState) {
@@ -792,6 +804,7 @@ modules = {
792
804
  );
793
805
  return this.formHttp({
794
806
  scriptCode: scriptCode,
807
+ ...this.getQueryConditionHttpOption(),
795
808
  data: this.buildFormScriptData(reportTemplate, { ...accessParam }),
796
809
  callback: (res) => {
797
810
  let rows = res.objx?.records || res.objx || [];
@@ -941,6 +954,7 @@ modules = {
941
954
  );
942
955
  return this.formHttp({
943
956
  scriptCode: scriptCode,
957
+ ...this.getQueryConditionHttpOption(),
944
958
  data: this.buildFormScriptData(reportTemplate, { ...accessParam }),
945
959
  callback: (res) => {
946
960
  let rows = res.objx || [];
@@ -1,5 +1,6 @@
1
1
  import { initWf } from "../../../components/wf/wfUtil";
2
2
  import { getReportGlobalMap } from "../../../components/xform/utils/util";
3
+ import { getCachedServiceName } from "../../../components/xform/utils/serviceNameCache";
3
4
  import { decrypt } from "@base/utils/aes";
4
5
 
5
6
  let modules = {};
@@ -78,26 +79,25 @@ modules = {
78
79
 
79
80
  let getServiceName = (callback) => {
80
81
  if (formCode && formCode !== reportTemplate.formCode) {
81
- this.getHttpTarget().$http({
82
- aes: true,
83
- url: USER_PREFIX + `/formScript/getServiceName`,
84
- method: `post`,
85
- data: {
86
- formCode,
87
- scriptCode,
88
- },
82
+ getCachedServiceName(this.getHttpTarget(), {
83
+ formCode,
84
+ scriptCode,
89
85
  isLoading,
90
- // loadingTarget: this.getLoadingTarget(),
91
- // modalStrictly: true,
92
- success: (res) => {
93
- let serviceName = res.objx;
86
+ // 调用方关掉 modal 时,查服务名这一跳也别再盖遮罩
87
+ modal: opts.modal,
88
+ aes: true,
89
+ }).then(
90
+ (serviceName) => {
94
91
  if (serviceName) {
95
92
  callback(serviceName);
96
93
  } else {
97
94
  this.$baseAlert("服务名不存在");
98
95
  }
99
96
  },
100
- });
97
+ () => {
98
+ // 失败提示由请求层处理,不继续请求脚本
99
+ }
100
+ );
101
101
  } else {
102
102
  callback(reportTemplate.serviceName);
103
103
  }
@@ -63,13 +63,14 @@ export function isLockedSearchColumn(column) {
63
63
  }
64
64
 
65
65
  /**
66
- * 组件是否位于某个数据表格的查询区(data-table 的 widgetList 分支,不含 buttons、
67
- * 不含表格列组件)。属性面板据此决定要不要显示「固定查询条件」开关。
68
- * @param {Array} widgetList 表单顶层组件列表(designer.widgetList)
66
+ * 字段是否落在某个数据表格的查询区(data-table 的 widgetList 分支,不含 buttons、
67
+ * 不含表格列组件)。
68
+ * @param {Array} widgetList 表单顶层组件列表
69
69
  * @param {Object} widget 待判定的字段组件
70
+ * @param {Function} [acceptTable] 额外过滤数据表格节点,返回 false 则跳过该表
70
71
  * @returns {Boolean}
71
72
  */
72
- export function isQueryAreaWidget(widgetList, widget) {
73
+ function isInDataTableQueryArea(widgetList, widget, acceptTable) {
73
74
  if (!widget || !widget.id || !Array.isArray(widgetList)) return false;
74
75
  let inQueryArea = false;
75
76
  widgetList.forEach((item) => {
@@ -79,6 +80,7 @@ export function isQueryAreaWidget(widgetList, widget) {
79
80
  node.category !== "container"
80
81
  || node.type !== "data-table"
81
82
  || !Array.isArray(node.widgetList)
83
+ || (acceptTable && !acceptTable(node))
82
84
  ) {
83
85
  return;
84
86
  }
@@ -91,3 +93,26 @@ export function isQueryAreaWidget(widgetList, widget) {
91
93
  });
92
94
  return inQueryArea;
93
95
  }
96
+
97
+ /**
98
+ * 组件是否位于某个数据表格的查询区。属性面板据此决定要不要显示「固定查询条件」开关。
99
+ * @param {Array} widgetList 表单顶层组件列表(designer.widgetList)
100
+ * @param {Object} widget 待判定的字段组件
101
+ * @returns {Boolean}
102
+ */
103
+ export function isQueryAreaWidget(widgetList, widget) {
104
+ return isInDataTableQueryArea(widgetList, widget);
105
+ }
106
+
107
+ /**
108
+ * 字段是否位于「查询表格」的查询条件区:数据表格已打开 isQueryTable,且字段在其
109
+ * widgetList 里(含栅格等容器嵌套)。按钮区、表格列、主表单字段都不算。
110
+ * @param {Array} widgetList 表单顶层组件列表
111
+ * @param {Object} widget 待判定的字段组件
112
+ * @returns {Boolean}
113
+ */
114
+ export function isQueryTableConditionWidget(widgetList, widget) {
115
+ return isInDataTableQueryArea(widgetList, widget, (node) => {
116
+ return !!(node.options && node.options.isQueryTable);
117
+ });
118
+ }
@@ -0,0 +1,62 @@
1
+ /** 会话内服务名。刷新页面即失效,不落本地存储。 */
2
+ const cache = new Map();
3
+ /** 同一键进行中的请求,避免并发时各自打一次接口。 */
4
+ const pending = new Map();
5
+
6
+ function cacheKey(formCode, scriptCode, aes) {
7
+ return [formCode, scriptCode, aes ? "1" : "0"].join("\0");
8
+ }
9
+
10
+ /**
11
+ * 查询表单脚本所属服务名。
12
+ * 命中内存缓存直接返回;同一 formCode + scriptCode + aes 的并发请求合并为一次。
13
+ * 只缓存成功且有服务名的结果。
14
+ *
15
+ * @param {Vue} vm 发起 $http 的实例
16
+ * @param {{formCode: string, scriptCode: string, isLoading?: boolean, modal?: boolean, aes?: boolean}} opts
17
+ * @returns {Promise<string>} 有服务名时 resolve 服务名;成功但没有服务名时 resolve 空字符串;请求失败 reject
18
+ */
19
+ export function getCachedServiceName(vm, opts) {
20
+ const formCode = opts.formCode;
21
+ const scriptCode = opts.scriptCode;
22
+ const aes = !!opts.aes;
23
+ const key = cacheKey(formCode, scriptCode, aes);
24
+
25
+ if (cache.has(key)) {
26
+ return Promise.resolve(cache.get(key));
27
+ }
28
+ const inflight = pending.get(key);
29
+ if (inflight) {
30
+ return inflight;
31
+ }
32
+
33
+ const task = vm
34
+ .$http({
35
+ ...(aes ? { aes: true } : {}),
36
+ url: USER_PREFIX + "/formScript/getServiceName",
37
+ method: "post",
38
+ data: {
39
+ formCode,
40
+ scriptCode,
41
+ },
42
+ isLoading: opts.isLoading,
43
+ modal: opts.modal,
44
+ })
45
+ .then((res) => {
46
+ if (!res || res.type !== "success") {
47
+ return Promise.reject(res);
48
+ }
49
+ const serviceName = res.objx;
50
+ if (serviceName) {
51
+ cache.set(key, serviceName);
52
+ return serviceName;
53
+ }
54
+ return "";
55
+ })
56
+ .finally(() => {
57
+ pending.delete(key);
58
+ });
59
+
60
+ pending.set(key, task);
61
+ return task;
62
+ }
@@ -511,7 +511,7 @@ service.interceptors.response.use(
511
511
  // 所以只有整批请求全军覆没时才暴露出来 —— 正好就是详情页 mounted 一口气发
512
512
  // 8+ 个 isLoading + modalStrictly 请求、网络一抖就整页白屏且滚动被锁死的场景。
513
513
  // 下面两处一律 removeModel:正常情况下本来也会被别的请求关掉,行为不变。
514
- if (handleRequestNetworkError()) {
514
+ if (handleRequestNetworkError()) {
515
515
  removeModel(config);
516
516
  return swallowError ? Promise.resolve() : Promise.reject(error);
517
517
  }
@@ -545,7 +545,7 @@ service.interceptors.response.use(
545
545
  });
546
546
  }
547
547
  }
548
- return swallowError ? Promise.resolve() : Promise.reject(error);
548
+ return swallowError ? Promise.resolve() : Promise.reject(error);
549
549
  }
550
550
  );
551
551
 
@@ -18,7 +18,7 @@
18
18
  * 因此无需注册表——归属靠访问路径结构 + 本应用 appCode 比较即可;独立运行 /
19
19
  * 主应用态(appCode 为空、无 /micro/ 前缀)会自动退化为与历史一致的本地解析。
20
20
  *
21
- * webpack 硬约束:@base/views 与 @/views 两条动态 import 必须保留字面前缀,
21
+ * webpack 硬约束:@base/views 与 @/views 两条 require 必须保留字面前缀,
22
22
  * 不可把前缀变量化,否则 webpack 无法收集 context。包被消费时 @base 指向包内
23
23
  * views、@/ 指向消费应用 views——这正是 base / localPrivate 的语义来源。
24
24
  */
@@ -136,28 +136,22 @@ export function resolveViewPath(rawUrl, options = {}) {
136
136
  return { kind: "localPrivate", base: false, rel: ensureVue(ensureLeadingSlash(path)) };
137
137
  }
138
138
 
139
- // ——— 以下为 import 落地层(依赖 webpack context,不进纯函数单测) ———
139
+ // ——— 以下为组件落地层(依赖 webpack context,不进纯函数单测) ———
140
140
 
141
141
  function importBaseView(rel) {
142
- if (process.env.NODE_ENV === "development") {
143
- try {
144
- return Promise.resolve(require("@base/views" + rel));
145
- } catch (e) {
146
- return Promise.reject(e);
147
- }
142
+ try {
143
+ return Promise.resolve(require("@base/views" + rel));
144
+ } catch (e) {
145
+ return Promise.reject(e);
148
146
  }
149
- return import(/* webpackInclude: /\.vue$/ */ `@base/views${rel}`);
150
147
  }
151
148
 
152
149
  function importAppView(rel) {
153
- if (process.env.NODE_ENV === "development") {
154
- try {
155
- return Promise.resolve(require("@/views" + rel));
156
- } catch (e) {
157
- return Promise.reject(e);
158
- }
150
+ try {
151
+ return Promise.resolve(require("@/views" + rel));
152
+ } catch (e) {
153
+ return Promise.reject(e);
159
154
  }
160
- return import(/* webpackInclude: /\.vue$/ */ `@/views${rel}`);
161
155
  }
162
156
 
163
157
  const viewModuleCache = new Map();
@@ -339,8 +339,8 @@ export default {
339
339
  if (!this.activating) {
340
340
  return;
341
341
  }
342
- this.getWfInfoList(isLoading);
343
- this.getUnreadMessageNum(isLoading);
342
+ this.getWfInfoList(isLoading, true);
343
+ this.getUnreadMessageNum(isLoading, true);
344
344
  this.$emit("timerHandle");
345
345
  },
346
346
  clearTimer() {
@@ -621,12 +621,12 @@ export default {
621
621
  },
622
622
  });
623
623
  },
624
- getWfInfoList(isLoading) {
624
+ getWfInfoList(isLoading, silent = false) {
625
625
  if (!this.activating) {
626
626
  return;
627
627
  }
628
- this.$http({
629
- url: USER_PREFIX + "/wf_info/listPage",
628
+ this.$http({
629
+ url: USER_PREFIX + "/wf_info/listPage",
630
630
  data: { type: 0, size: 20, searchCount: false },
631
631
  method: "post",
632
632
  isLoading: isLoading,
@@ -636,17 +636,12 @@ export default {
636
636
  this.unDoWfRows =
637
637
  res.objx && res.objx.records ? res.objx.records : [];
638
638
  },
639
- failMsg: false,
640
- ignoreNetworkError: true,
641
- ignore502: true,
642
- fail: (res, response) => {
643
- if (response && response.status == 200) {
644
- this.$errorMsg(res);
645
- }
646
- },
647
- });
639
+ ...(silent
640
+ ? { errorMsg: false }
641
+ : { ignoreNetworkError: true, ignore502: true }),
642
+ });
648
643
  },
649
- getUnreadMessageNum(isLoading) {
644
+ getUnreadMessageNum(isLoading, silent = false) {
650
645
  if (!this.activating) {
651
646
  return;
652
647
  }
@@ -660,15 +655,10 @@ export default {
660
655
  success: (res) => {
661
656
  this.unreadMessageNum = res.objx || 0;
662
657
  },
663
- failMsg: false,
664
- ignoreNetworkError: true,
665
- ignore502: true,
666
- fail: (res, response) => {
667
- if (response && response.status == 200) {
668
- this.$errorMsg(res);
669
- }
670
- },
671
- });
658
+ ...(silent
659
+ ? { errorMsg: false }
660
+ : { ignoreNetworkError: true, ignore502: true }),
661
+ });
672
662
  },
673
663
  wfhandleCallback(flag) {
674
664
  if ([1, 2, 3].includes(flag)) {
@@ -578,8 +578,8 @@ export default {
578
578
  if (!this.activating) {
579
579
  return;
580
580
  }
581
- this.getWfInfoList(isLoading);
582
- this.getUnreadMessageNum(isLoading);
581
+ this.getWfInfoList(isLoading, true);
582
+ this.getUnreadMessageNum(isLoading, true);
583
583
  this.$emit("timerHandle");
584
584
  },
585
585
  clearTimer() {
@@ -862,7 +862,7 @@ export default {
862
862
  },
863
863
  });
864
864
  },
865
- getWfInfoList(isLoading) {
865
+ getWfInfoList(isLoading, silent = false) {
866
866
  if (!this.activating) {
867
867
  return;
868
868
  }
@@ -877,17 +877,12 @@ export default {
877
877
  this.unDoWfRows =
878
878
  res.objx && res.objx.records ? res.objx.records : [];
879
879
  },
880
- failMsg: false,
881
- ignoreNetworkError: true,
882
- ignore502: true,
883
- fail: (res, response) => {
884
- if (response && response.status === 200) {
885
- this.$errorMsg(res);
886
- }
887
- },
888
- });
880
+ ...(silent
881
+ ? { errorMsg: false }
882
+ : { ignoreNetworkError: true, ignore502: true }),
883
+ });
889
884
  },
890
- getUnreadMessageNum(isLoading) {
885
+ getUnreadMessageNum(isLoading, silent = false) {
891
886
  if (!this.activating) {
892
887
  return;
893
888
  }
@@ -901,15 +896,10 @@ export default {
901
896
  success: (res) => {
902
897
  this.unreadMessageNum = res.objx || 0;
903
898
  },
904
- failMsg: false,
905
- ignoreNetworkError: true,
906
- ignore502: true,
907
- fail: (res, response) => {
908
- if (response && response.status === 200) {
909
- this.$errorMsg(res);
910
- }
911
- },
912
- });
899
+ ...(silent
900
+ ? { errorMsg: false }
901
+ : { ignoreNetworkError: true, ignore502: true }),
902
+ });
913
903
  },
914
904
  wfhandleCallback(flag) {
915
905
  if ([1, 2, 3].includes(flag)) {