cloud-web-corejs 1.1.0-dev.31 → 1.1.0-dev.32

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.31",
4
+ "version": "1.1.0-dev.32",
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
7
7
  "dev:micro": "vue-cli-service serve --port 17527",
@@ -43,6 +43,7 @@ import {
43
43
  isWfUserRangeEnabled,
44
44
  loadWfUserRange,
45
45
  } from "@base/components/wf/wfUserRange";
46
+ import { loadWfTransferEnabled } from "@base/components/wf/wfTransferEnabled";
46
47
 
47
48
  // wf 组件回调 _handleCallback(flag) 的 flag → 页签行为类型
48
49
  const WF_FLAG_KIND = {
@@ -185,6 +186,7 @@ export default {
185
186
  //预热,点击路径上的 await 直接命中缓存
186
187
  loadWfAutoConfirm(this);
187
188
  loadWfUserRange(this);
189
+ loadWfTransferEnabled(this);
188
190
  this.checkBillHooks();
189
191
  // 登记到宿主:关页签确认要问详情脏没脏、翻单要按 tabName 找回实例
190
192
  let host = this.bizTabHost;
@@ -42,7 +42,7 @@
42
42
  icon="iconfont icon-a-bohui1">{{ $t2('驳回', 'components.wf.reject') }}
43
43
  </el-button>
44
44
  <el-button type="primary" plain class="btn" @click="openChangeWfForm"
45
- v-show="(wfInfo.toTransfer===null || wfInfo.toTransfer===undefined) ? wfInfo.toSubmit: wfInfo.toTransfer"
45
+ v-show="transferEnabled && ((wfInfo.toTransfer===null || wfInfo.toTransfer===undefined) ? wfInfo.toSubmit: wfInfo.toTransfer)"
46
46
  icon="iconfont icon-zhuanban">{{ $t2('转办', 'components.wf.transfer') }}
47
47
  </el-button>
48
48
  <el-button type="primary" plain class="btn" @click="openUrgingDialog" v-show="wfInfo.toInterrupt"
@@ -93,12 +93,12 @@
93
93
  <div class="tit"><span>{{
94
94
  (wfInfo.createDate ? wfInfo.createDate.substring(0, 10) : '') + wfInfo.name
95
95
  }}</span></div>
96
- <iframe
97
- ref="wfPreviewFrame"
98
- style="width: 100%;flex:1"
99
- :src="wfImage"
100
- @load="fitWorkflowPreview"
101
- ></iframe>
96
+ <iframe
97
+ ref="wfPreviewFrame"
98
+ style="width: 100%;flex:1"
99
+ :src="wfImage"
100
+ @load="fitWorkflowPreview"
101
+ ></iframe>
102
102
  </el-form>
103
103
  </div>
104
104
  <span slot="footer" class="dialog-footer">
@@ -407,6 +407,7 @@ import Vue from "vue";
407
407
  import settingConfig from "@/settings";
408
408
  import commonMixin from "../../../mixins/mobile/common/index";
409
409
  import {getToken} from "../../../utils/auth";
410
+ import {isWfTransferEnabled, loadWfTransferEnabled} from "../../wf/wfTransferEnabled";
410
411
 
411
412
  let configUtil = {
412
413
  baseUrl: process.env.VUE_APP_BASE_API,
@@ -464,6 +465,9 @@ export default {
464
465
  let that = this.viewTarget;
465
466
  let _hideWf = that._hideWf || that.$attrs._hideWf;
466
467
  return _hideWf === true || _hideWf === 'true';
468
+ },
469
+ transferEnabled() {
470
+ return isWfTransferEnabled();
467
471
  }
468
472
  },
469
473
  data() {
@@ -625,27 +629,27 @@ export default {
625
629
  mounted() {
626
630
  this.init();
627
631
  },
628
- methods: {
629
- fitWorkflowPreview() {
630
- /* warm-flow-ui 是独立 iframe,窄屏下默认画布宽于视口,左右节点会被
631
- 它自己的 overflow:hidden 裁掉。复用其「自适应」能力,在数据逐步
632
- 渲染的几个时点重新 fit;跨域部署时访问 document 会抛错,静默跳过。 */
633
- [0, 300, 800, 1500].forEach((delay) => {
634
- window.setTimeout(() => {
635
- try {
636
- const frame = this.$refs.wfPreviewFrame;
637
- const buttons = frame?.contentDocument?.querySelectorAll("button") || [];
638
- const fitButton = Array.from(buttons).find(
639
- (button) => button.textContent.trim() === "自适应"
640
- );
641
- fitButton?.click();
642
- } catch (e) {
643
- // 跨域 iframe 无法读取内部 DOM,保留 warm-flow-ui 原有交互。
644
- }
645
- }, delay);
646
- });
647
- },
648
- getWfStatusLabel() {
632
+ methods: {
633
+ fitWorkflowPreview() {
634
+ /* warm-flow-ui 是独立 iframe,窄屏下默认画布宽于视口,左右节点会被
635
+ 它自己的 overflow:hidden 裁掉。复用其「自适应」能力,在数据逐步
636
+ 渲染的几个时点重新 fit;跨域部署时访问 document 会抛错,静默跳过。 */
637
+ [0, 300, 800, 1500].forEach((delay) => {
638
+ window.setTimeout(() => {
639
+ try {
640
+ const frame = this.$refs.wfPreviewFrame;
641
+ const buttons = frame?.contentDocument?.querySelectorAll("button") || [];
642
+ const fitButton = Array.from(buttons).find(
643
+ (button) => button.textContent.trim() === "自适应"
644
+ );
645
+ fitButton?.click();
646
+ } catch (e) {
647
+ // 跨域 iframe 无法读取内部 DOM,保留 warm-flow-ui 原有交互。
648
+ }
649
+ }, delay);
650
+ });
651
+ },
652
+ getWfStatusLabel() {
649
653
  return this.wfStatusMap[this.wfInfo.stat]?.label;
650
654
  },
651
655
  getWfStatusType() {
@@ -763,6 +767,7 @@ export default {
763
767
  },
764
768
  initForAll() {
765
769
  let that = getTarget(this);
770
+ loadWfTransferEnabled(that);
766
771
  this.initWf(() => {
767
772
  if (this.wfInfo.procInstId) {
768
773
  this.initCurrentTask(this.wfInfo.procInstId, () => {
@@ -45,9 +45,10 @@
45
45
  class="button-sty"
46
46
  @click="openChangeWfForm"
47
47
  v-show="
48
- wfInfo.toTransfer === null || wfInfo.toTransfer === undefined
48
+ transferEnabled &&
49
+ (wfInfo.toTransfer === null || wfInfo.toTransfer === undefined
49
50
  ? wfInfo.toSubmit
50
- : wfInfo.toTransfer
51
+ : wfInfo.toTransfer)
51
52
  "
52
53
  icon="iconfont icon-zhuanban"
53
54
  >{{ $t2("转办", "components.wf.transfer") }}
@@ -32,7 +32,7 @@
32
32
  @click="rejectWfTask('reject')" v-show="wfInfo.toReject">驳回
33
33
  </el-button>
34
34
  <el-button type="primary" class="btn" :class="{on:operateType == 'transfer'}"
35
- @click="openChangeWfForm('transfer')" v-show="wfInfo.toSubmit">转办
35
+ @click="openChangeWfForm('transfer')" v-show="transferEnabled && wfInfo.toSubmit">转办
36
36
  </el-button>
37
37
  <el-button type="primary" class="btn" :class="{on:operateType == 'urging'}"
38
38
  @click="openUrgingDialog(null)" v-show="wfInfo.toInterrupt">催办
@@ -5,6 +5,7 @@ import {selectDialogMixins} from "../../mixins/selectDialog";
5
5
  import {requireViewAsync} from "@base/utils/resolveViewComponent";
6
6
  import {getWfButtonNames, loadWfButtonNames} from "./wfButtonName";
7
7
  import {isWfAutoConfirm, loadWfAutoConfirm} from "./wfAutoConfirm";
8
+ import {isWfTransferEnabled, loadWfTransferEnabled} from "./wfTransferEnabled";
8
9
 
9
10
  let configUtil = {
10
11
  baseUrl: process.env.VUE_APP_BASE_API,
@@ -237,6 +238,10 @@ wfContentMixin = {
237
238
  let that = this.viewTarget;
238
239
  let _hideWf = that._hideWf || that.$attrs._hideWf;
239
240
  return _hideWf === true || _hideWf === 'true';
241
+ },
242
+ //转办:param20,未配置默认开启。读 observable,接口回来后按钮条会重算
243
+ transferEnabled() {
244
+ return isWfTransferEnabled();
240
245
  }
241
246
  },
242
247
  data() {
@@ -555,6 +560,8 @@ wfContentMixin = {
555
560
  },
556
561
  initForAll() {
557
562
  let that = getTarget(this);
563
+ //转办 param20:与 initWf 并行拉,未配置默认开
564
+ loadWfTransferEnabled(that);
558
565
  this.initWf(() => {
559
566
  if (this.wfInfo.procInstId) {
560
567
  this.initCurrentTask(this.wfInfo.procInstId, () => {
@@ -7,6 +7,7 @@
7
7
  * buttonType 只在「平铺成独立按钮」时用得上(见 HEADER_STANDALONE_KEYS),
8
8
  * 取值与流程模块按钮条里同名按钮保持一致。
9
9
  */
10
+ import { isWfTransferEnabled } from "./wfTransferEnabled";
10
11
 
11
12
  /* 详情标题栏里不收进下拉、直接平铺成独立按钮的操作。
12
13
  顺序按 getWfActionItems 的定义序,不按这里的书写序。 */
@@ -18,6 +19,8 @@ export function getWfActionItems(vm) {
18
19
  = wfInfo.toTransfer === null || wfInfo.toTransfer === undefined
19
20
  ? !!wfInfo.toSubmit
20
21
  : !!wfInfo.toTransfer;
22
+ //param20 关掉时整项不出,哪怕节点本身允许转办
23
+ toTransfer = isWfTransferEnabled() && toTransfer;
21
24
 
22
25
  return [
23
26
  {
@@ -0,0 +1,54 @@
1
+ /**
2
+ * 流程转办开关:后台 wf_diy_attribute 的 param20,全局拉取一次后缓存。
3
+ * 格式 true/false,未配置时默认开启。
4
+ */
5
+ import Vue from "vue";
6
+
7
+ const wfTransfer = Vue.observable({
8
+ enabled: true,
9
+ });
10
+
11
+ let pending = null;
12
+
13
+ function parseEnabled(val) {
14
+ //只认明确关掉;布尔 false 和字符串 "false" 都关,其余(含没配)一律开
15
+ if (val === false || val === "false") return false;
16
+ return true;
17
+ }
18
+
19
+ export function isWfTransferEnabled() {
20
+ return wfTransfer.enabled !== false;
21
+ }
22
+
23
+ /**
24
+ * 拉取转办开关。全局只发一次请求,重复调用复用同一个 promise。
25
+ * @param {Object} vm 任意 Vue 实例(取 $http),不传则退回 window.$vueRoot
26
+ * @returns {Promise<Boolean>}
27
+ */
28
+ export function loadWfTransferEnabled(vm) {
29
+ if (pending) return pending;
30
+ let target = vm || window.$vueRoot;
31
+ if (!target || !target.$http) return Promise.resolve(wfTransfer.enabled);
32
+ let errored = false;
33
+ let request = new Promise((resolve) => {
34
+ target.$http({
35
+ url: USER_PREFIX + "/wf_diy_attribute/getValue",
36
+ method: "post",
37
+ data: { attributeKey: "param20" },
38
+ success: (res) => {
39
+ let val = res ? res.objx : null;
40
+ wfTransfer.enabled = parseEnabled(val);
41
+ resolve(wfTransfer.enabled);
42
+ },
43
+ fail: () => resolve(wfTransfer.enabled),
44
+ error: () => {
45
+ errored = true;
46
+ pending = null; //失败不锁死,下次进流程表单可重试
47
+ resolve(wfTransfer.enabled);
48
+ },
49
+ });
50
+ });
51
+ //回调若是同步回来的(拦截器短路、单测桩),上面那句 pending = null 会被下面这句盖掉
52
+ pending = errored ? null : request;
53
+ return request;
54
+ }
@@ -2,6 +2,7 @@ import { openStartWfDialog } from "@base/components/wf/wfUtil";
2
2
  import { getWfButtonNames, loadWfButtonNames, DEFAULT_SUBMIT_BTN } from "@base/components/wf/wfButtonName";
3
3
  import { loadWfAutoConfirm } from "@base/components/wf/wfAutoConfirm";
4
4
  import { loadWfUserRange } from "@base/components/wf/wfUserRange";
5
+ import { loadWfTransferEnabled } from "@base/components/wf/wfTransferEnabled";
5
6
  import settingConfig from "@/settings";
6
7
 
7
8
  // PC 与 H5 共用启动规则、校验和回调;容器提供 wfStart() 获取各自的流程状态。
@@ -17,6 +18,7 @@ export default {
17
18
  loadWfButtonNames(this);
18
19
  loadWfAutoConfirm(this);
19
20
  loadWfUserRange(this);
21
+ loadWfTransferEnabled(this);
20
22
  }
21
23
  },
22
24
  // 流程启动按钮:有启动信息、需要按钮(showStartBtn 未显式关闭)、未启动、非预览态才显示。
@@ -1,3 +1,5 @@
1
+ import {isWfTransferEnabled, loadWfTransferEnabled} from "@base/components/wf/wfTransferEnabled";
2
+
1
3
  export default {
2
4
  data() {
3
5
  return {
@@ -34,6 +36,11 @@ export default {
34
36
 
35
37
  }
36
38
  },
39
+ computed: {
40
+ transferEnabled() {
41
+ return isWfTransferEnabled();
42
+ }
43
+ },
37
44
  methods: {
38
45
  initCurrentPrefix() {
39
46
  let url = this.billJson.getUrl;
@@ -43,6 +50,7 @@ export default {
43
50
  },
44
51
  async initWf(option) {
45
52
  this.wfOption = option;
53
+ loadWfTransferEnabled(this);
46
54
  let hasWf = false;
47
55
  let wfInfo, currentTask, taskParam = {};
48
56
  await this.initWfInfo(option).then(res => {
@@ -300,7 +300,7 @@
300
300
  icon="iconfont icon-a-bohui1">{{ $t1('驳回') }}
301
301
  </el-button>
302
302
  <el-button class="btn" type="primary" @click="openChangeWfForm"
303
- v-if="wfEnabled && ((wfInfo.toTransfer===null || wfInfo.toTransfer===undefined) ? wfInfo.toSubmit: wfInfo.toTransfer)"
303
+ v-if="wfEnabled && transferEnabled && ((wfInfo.toTransfer===null || wfInfo.toTransfer===undefined) ? wfInfo.toSubmit: wfInfo.toTransfer)"
304
304
  icon="iconfont icon-zhuanban">{{ $t1('转办') }}
305
305
  </el-button>
306
306
  <!--end-->