cloud-web-corejs 1.0.54-dev.756 → 1.0.54-dev.759
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 +1 -1
- package/src/components/jsonImport/mixins.js +350 -350
- package/src/components/langImport/mixins.js +502 -502
- package/src/components/wf/wf.js +2221 -2221
- package/src/components/xform/form-designer/designer.js +2027 -2027
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +1774 -1774
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +1553 -1553
- package/src/components/xform/form-designer/setting-panel/indexMixin.js +370 -370
- package/src/components/xform/form-designer/toolbar-panel/indexMixin.js +655 -655
- package/src/components/xform/form-render/container-item/detail-h5-item.vue +173 -173
- package/src/components/xform/form-render/container-item/detail-item.vue +287 -287
- package/src/components/xform/form-render/indexMixin.js +23 -23
- package/src/components/xform/utils/util.js +5 -5
- package/src/index.js +17 -0
- package/src/layout/components/AppMain.vue +7 -0
- package/src/microRouter/index.js +83 -7
- package/src/store/modules/micro.js +5 -0
- package/src/store/modules/permission.js +46 -1
- package/src/views/user/home/default2.vue +1158 -1158
- package/src/views/user/login/indexMixin.js +661 -661
|
@@ -1,287 +1,287 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
/**
|
|
3
|
-
* author: vformAdmin
|
|
4
|
-
* email: vdpadmin@163.com
|
|
5
|
-
* website: https://www.vform666.com
|
|
6
|
-
* date: 2021.08.18
|
|
7
|
-
* remark: 如果要分发VForm源码,需在本文件顶部保留此文件头信息!!
|
|
8
|
-
*/
|
|
9
|
-
-->
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<container-item-wrapper :widget="widget">
|
|
13
|
-
<div
|
|
14
|
-
class="detail-wrap grid-container"
|
|
15
|
-
:class="[customClass]"
|
|
16
|
-
:ref="widget.id"
|
|
17
|
-
>
|
|
18
|
-
<div class="d-header clearfix">
|
|
19
|
-
<div class="fl">
|
|
20
|
-
<i class="el-icon-info" />
|
|
21
|
-
{{ getI18nLabel(widget.options.label) }}
|
|
22
|
-
</div>
|
|
23
|
-
<!-- <div class="fr">
|
|
24
|
-
<el-button type="primary" plain class="button-sty" icon="el-icon-refresh-right" @click="reload">重置
|
|
25
|
-
</el-button>
|
|
26
|
-
<el-button type="primary" class="button-sty" icon="el-icon-check" @click="saveData" v-if="!wfInfo.id">保存
|
|
27
|
-
</el-button>
|
|
28
|
-
</div>-->
|
|
29
|
-
<div class="fr">
|
|
30
|
-
<template v-if="billNav">
|
|
31
|
-
<el-button
|
|
32
|
-
class="button-sty"
|
|
33
|
-
size="mini"
|
|
34
|
-
icon="el-icon-arrow-left"
|
|
35
|
-
:disabled="!billNav.canPrev"
|
|
36
|
-
@click="navBill(-1)"
|
|
37
|
-
>上一单</el-button
|
|
38
|
-
>
|
|
39
|
-
<el-button
|
|
40
|
-
class="button-sty"
|
|
41
|
-
size="mini"
|
|
42
|
-
:disabled="!billNav.canNext"
|
|
43
|
-
@click="navBill(1)"
|
|
44
|
-
>下一单<i class="el-icon-arrow-right el-icon--right"></i
|
|
45
|
-
></el-button>
|
|
46
|
-
</template>
|
|
47
|
-
<el-button
|
|
48
|
-
v-if="showWfStartBtn()"
|
|
49
|
-
class="button-sty yyy"
|
|
50
|
-
type="success"
|
|
51
|
-
icon="el-icon-video-play"
|
|
52
|
-
@click="startWf"
|
|
53
|
-
>{{ wfStartButtonName }}</el-button
|
|
54
|
-
>
|
|
55
|
-
<template v-for="(subWidget, swIdx) in widget.widgetList">
|
|
56
|
-
<template v-if="'container' === subWidget.category">
|
|
57
|
-
<component
|
|
58
|
-
:is="subWidget.type + '-item'"
|
|
59
|
-
:widget="subWidget"
|
|
60
|
-
:key="swIdx"
|
|
61
|
-
:parent-list="widget.widgetList"
|
|
62
|
-
:index-of-parent-list="swIdx"
|
|
63
|
-
:parent-widget="widget"
|
|
64
|
-
>
|
|
65
|
-
<!-- 递归传递插槽!!! -->
|
|
66
|
-
<template
|
|
67
|
-
v-for="slot in Object.keys($scopedSlots)"
|
|
68
|
-
v-slot:[slot]="scope"
|
|
69
|
-
>
|
|
70
|
-
<slot :name="slot" v-bind="scope" />
|
|
71
|
-
</template>
|
|
72
|
-
</component>
|
|
73
|
-
</template>
|
|
74
|
-
<template v-else>
|
|
75
|
-
<component
|
|
76
|
-
:is="subWidget.type + '-widget'"
|
|
77
|
-
:field="subWidget"
|
|
78
|
-
:designer="null"
|
|
79
|
-
:key="swIdx"
|
|
80
|
-
:parent-list="widget.widgetList"
|
|
81
|
-
:index-of-parent-list="swIdx"
|
|
82
|
-
:parent-widget="widget"
|
|
83
|
-
>
|
|
84
|
-
<!-- 递归传递插槽!!! -->
|
|
85
|
-
<template
|
|
86
|
-
v-for="slot in Object.keys($scopedSlots)"
|
|
87
|
-
v-slot:[slot]="scope"
|
|
88
|
-
>
|
|
89
|
-
<slot :name="slot" v-bind="scope" />
|
|
90
|
-
</template>
|
|
91
|
-
</component>
|
|
92
|
-
</template>
|
|
93
|
-
</template>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
<baseTabs :showNav="!widget.options.hideNav">
|
|
97
|
-
<detail-pane-widget
|
|
98
|
-
v-for="(paneWidget, index) in widget.panes"
|
|
99
|
-
:key="index"
|
|
100
|
-
:widget="paneWidget"
|
|
101
|
-
:parent-list="widget.panes"
|
|
102
|
-
:index-of-parent-list="index"
|
|
103
|
-
:parent-widget="widget"
|
|
104
|
-
:col-height="widget.options.colHeight"
|
|
105
|
-
tabRef="baseTabRef"
|
|
106
|
-
:tabPaneGrade="2"
|
|
107
|
-
></detail-pane-widget>
|
|
108
|
-
</baseTabs>
|
|
109
|
-
</div>
|
|
110
|
-
</container-item-wrapper>
|
|
111
|
-
</template>
|
|
112
|
-
|
|
113
|
-
<script>
|
|
114
|
-
import emitter from "../../../../components/xform/utils/emitter";
|
|
115
|
-
import i18n from "../../../../components/xform/utils/i18n";
|
|
116
|
-
import refMixin from "../../../../components/xform/form-render/refMixin";
|
|
117
|
-
import ContainerItemWrapper from "./container-item-wrapper";
|
|
118
|
-
import containerItemMixin from "./containerItemMixin";
|
|
119
|
-
import detailPaneWidget from "../../../../components/xform/form-render/container-item/detail-pane-item";
|
|
120
|
-
import FieldComponents from "../../../../components/xform/form-designer/form-widget/field-widget/index";
|
|
121
|
-
|
|
122
|
-
import { initWf, openStartWfDialog } from "../../../../components/wf/wfUtil";
|
|
123
|
-
import settingConfig from "@/settings.js";
|
|
124
|
-
|
|
125
|
-
export default {
|
|
126
|
-
name: "detail-item",
|
|
127
|
-
componentName: "ContainerItem",
|
|
128
|
-
mixins: [emitter, i18n, refMixin, containerItemMixin],
|
|
129
|
-
components: {
|
|
130
|
-
ContainerItemWrapper,
|
|
131
|
-
detailPaneWidget,
|
|
132
|
-
...FieldComponents,
|
|
133
|
-
},
|
|
134
|
-
props: {
|
|
135
|
-
widget: Object,
|
|
136
|
-
},
|
|
137
|
-
inject: ["refList", "sfRefList", "globalModel", "previewState"],
|
|
138
|
-
created() {
|
|
139
|
-
this.initRefList();
|
|
140
|
-
this.handleOnCreated();
|
|
141
|
-
},
|
|
142
|
-
mounted() {
|
|
143
|
-
this.handleOnMounted();
|
|
144
|
-
this.$nextTick(() => {
|
|
145
|
-
this.createWf();
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
beforeDestroy() {
|
|
149
|
-
this.unregisterFromRefList();
|
|
150
|
-
},
|
|
151
|
-
data() {
|
|
152
|
-
return {
|
|
153
|
-
wfInfo: {},
|
|
154
|
-
wfReady: false, // 流程状态是否已就绪(callback 返回后)
|
|
155
|
-
wfHasStarted: false, // 流程是否已启动(已启动则不显示启动按钮)
|
|
156
|
-
wfStartOption: null, // 启动流程所需 option(createWf 构造)
|
|
157
|
-
wfStartCtx: null, // openStartWfDialog 的执行上下文(与 initWf 一致)
|
|
158
|
-
};
|
|
159
|
-
},
|
|
160
|
-
computed: {
|
|
161
|
-
wfStartButtonName() {
|
|
162
|
-
return (
|
|
163
|
-
settingConfig.wfStartButtonName ||
|
|
164
|
-
this.$t2("流程启动", "components.wf.wfStart")
|
|
165
|
-
);
|
|
166
|
-
},
|
|
167
|
-
// 「上一单/下一单」翻单按钮状态:详情表单开启 billNavEnabled 且宿主列表有翻单快照时才显示。
|
|
168
|
-
// detail-item 在每次翻单时随详情表单重挂载,故此处按当前挂载时机取一次即可。
|
|
169
|
-
billNav() {
|
|
170
|
-
let formRef = this.getFormRef && this.getFormRef();
|
|
171
|
-
if (
|
|
172
|
-
!formRef ||
|
|
173
|
-
!formRef.formConfig ||
|
|
174
|
-
!formRef.formConfig.billNavEnabled
|
|
175
|
-
) {
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
let host = formRef.getListPageRef && formRef.getListPageRef();
|
|
179
|
-
if (!host || typeof host.getActiveBillNavState !== "function")
|
|
180
|
-
return null;
|
|
181
|
-
let state = host.getActiveBillNavState();
|
|
182
|
-
if (!state) return null;
|
|
183
|
-
return {
|
|
184
|
-
canPrev: state.index > 0,
|
|
185
|
-
canNext: state.index < state.rows.length - 1,
|
|
186
|
-
};
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
methods: {
|
|
190
|
-
// 解析流程启动信息:优先取表单实例(indexMixin,xform 主链路)暴露的,回退到本组件 createWf(旧路径)。
|
|
191
|
-
// 用方法实时求值,避免 computed 缓存导致早于 wf 就绪时求值后不再更新。
|
|
192
|
-
wfStart() {
|
|
193
|
-
let formRef = this.getFormRef && this.getFormRef();
|
|
194
|
-
if (formRef && formRef.wfStartOption) {
|
|
195
|
-
return {
|
|
196
|
-
ctx: formRef.wfStartCtx || formRef,
|
|
197
|
-
option: formRef.wfStartOption,
|
|
198
|
-
hasWf: !!formRef.hasWf,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
if (this.wfReady && this.wfStartOption && this.wfStartCtx) {
|
|
202
|
-
return {
|
|
203
|
-
ctx: this.wfStartCtx,
|
|
204
|
-
option: this.wfStartOption,
|
|
205
|
-
hasWf: this.wfHasStarted,
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
return null;
|
|
209
|
-
},
|
|
210
|
-
// 流程启动按钮:有启动信息、需要按钮(showStartBtn 未显式关闭)、未启动、非预览态才显示。
|
|
211
|
-
// 声明式渲染,替代 wfUtil 的 DOM 强制注入。
|
|
212
|
-
showWfStartBtn() {
|
|
213
|
-
let ws = this.wfStart();
|
|
214
|
-
if (!ws || this.previewState) return false;
|
|
215
|
-
let opt = ws.option || {};
|
|
216
|
-
return opt.showStartBtn !== false && !ws.hasWf;
|
|
217
|
-
},
|
|
218
|
-
// 声明式触发流程启动(替代原注入按钮的点击),复用 wfUtil 的 openStartWfDialog
|
|
219
|
-
startWf() {
|
|
220
|
-
let ws = this.wfStart();
|
|
221
|
-
if (!ws || !ws.option || !ws.ctx) return;
|
|
222
|
-
openStartWfDialog(ws.ctx, ws.option);
|
|
223
|
-
},
|
|
224
|
-
// 触发宿主翻单:step = -1 上一单 / +1 下一单
|
|
225
|
-
navBill(step) {
|
|
226
|
-
let host = this.getFormRef && this.getFormRef();
|
|
227
|
-
host = host && host.getListPageRef && host.getListPageRef();
|
|
228
|
-
host && host.navigateActiveBill && host.navigateActiveBill(step);
|
|
229
|
-
},
|
|
230
|
-
reload() {
|
|
231
|
-
this.getFormRef().$parent.$baseReload();
|
|
232
|
-
},
|
|
233
|
-
saveData() {
|
|
234
|
-
if (!!this.previewState) return;
|
|
235
|
-
this.getFormRef().saveForm();
|
|
236
|
-
},
|
|
237
|
-
createWf() {
|
|
238
|
-
if (!!this.previewState || !this.widget.options.wfEnabled) return;
|
|
239
|
-
let formTarget = this.getFormRef();
|
|
240
|
-
let formData = formTarget.formData;
|
|
241
|
-
if (formData && formData.object_foreign_id) {
|
|
242
|
-
let reportTemplate = formTarget.reportTemplate;
|
|
243
|
-
let formCode = reportTemplate.formCode;
|
|
244
|
-
let option = {
|
|
245
|
-
objId: formData.object_foreign_id, //单据ID
|
|
246
|
-
wfCode: formCode, //流程编码
|
|
247
|
-
showStartBtn: true, //需要启动按钮(语义不变)
|
|
248
|
-
injectStartBtn: false, //不走 DOM 强制注入,改由本组件模板声明式渲染
|
|
249
|
-
serviceId: "user",
|
|
250
|
-
startConfirmText: () => formTarget.getWfStartConfirmText(),
|
|
251
|
-
callback: ({ wfInfo, hasWf }) => {
|
|
252
|
-
this.wfInfo = wfInfo;
|
|
253
|
-
this.wfHasStarted = !!hasWf; //已启动则不显示启动按钮(与原注入条件 !hasWf 一致)
|
|
254
|
-
this.wfReady = true; //状态就绪后才显示按钮,避免回调前闪现
|
|
255
|
-
},
|
|
256
|
-
};
|
|
257
|
-
this.wfStartOption = option;
|
|
258
|
-
this.wfStartCtx = formTarget.$parent; //与 initWf 执行上下文一致,供 openStartWfDialog 使用
|
|
259
|
-
initWf.call(formTarget.$parent, option);
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
};
|
|
264
|
-
</script>
|
|
265
|
-
|
|
266
|
-
<style lang="scss" scoped>
|
|
267
|
-
.grid-container {
|
|
268
|
-
min-height: 50px;
|
|
269
|
-
//line-height: 48px;
|
|
270
|
-
//padding: 6px;
|
|
271
|
-
outline: 1px dashed #336699;
|
|
272
|
-
|
|
273
|
-
> div {
|
|
274
|
-
height: 100%;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
.form-widget-list {
|
|
278
|
-
// min-height: 28px;
|
|
279
|
-
height: 100%;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.grid-container.selected,
|
|
284
|
-
.grid-cell.selected {
|
|
285
|
-
outline: 2px solid $--color-primary !important;
|
|
286
|
-
}
|
|
287
|
-
</style>
|
|
1
|
+
<!--
|
|
2
|
+
/**
|
|
3
|
+
* author: vformAdmin
|
|
4
|
+
* email: vdpadmin@163.com
|
|
5
|
+
* website: https://www.vform666.com
|
|
6
|
+
* date: 2021.08.18
|
|
7
|
+
* remark: 如果要分发VForm源码,需在本文件顶部保留此文件头信息!!
|
|
8
|
+
*/
|
|
9
|
+
-->
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<container-item-wrapper :widget="widget">
|
|
13
|
+
<div
|
|
14
|
+
class="detail-wrap grid-container"
|
|
15
|
+
:class="[customClass]"
|
|
16
|
+
:ref="widget.id"
|
|
17
|
+
>
|
|
18
|
+
<div class="d-header clearfix">
|
|
19
|
+
<div class="fl">
|
|
20
|
+
<i class="el-icon-info" />
|
|
21
|
+
{{ getI18nLabel(widget.options.label) }}
|
|
22
|
+
</div>
|
|
23
|
+
<!-- <div class="fr">
|
|
24
|
+
<el-button type="primary" plain class="button-sty" icon="el-icon-refresh-right" @click="reload">重置
|
|
25
|
+
</el-button>
|
|
26
|
+
<el-button type="primary" class="button-sty" icon="el-icon-check" @click="saveData" v-if="!wfInfo.id">保存
|
|
27
|
+
</el-button>
|
|
28
|
+
</div>-->
|
|
29
|
+
<div class="fr">
|
|
30
|
+
<template v-if="billNav">
|
|
31
|
+
<el-button
|
|
32
|
+
class="button-sty"
|
|
33
|
+
size="mini"
|
|
34
|
+
icon="el-icon-arrow-left"
|
|
35
|
+
:disabled="!billNav.canPrev"
|
|
36
|
+
@click="navBill(-1)"
|
|
37
|
+
>上一单</el-button
|
|
38
|
+
>
|
|
39
|
+
<el-button
|
|
40
|
+
class="button-sty"
|
|
41
|
+
size="mini"
|
|
42
|
+
:disabled="!billNav.canNext"
|
|
43
|
+
@click="navBill(1)"
|
|
44
|
+
>下一单<i class="el-icon-arrow-right el-icon--right"></i
|
|
45
|
+
></el-button>
|
|
46
|
+
</template>
|
|
47
|
+
<el-button
|
|
48
|
+
v-if="showWfStartBtn()"
|
|
49
|
+
class="button-sty yyy"
|
|
50
|
+
type="success"
|
|
51
|
+
icon="el-icon-video-play"
|
|
52
|
+
@click="startWf"
|
|
53
|
+
>{{ wfStartButtonName }}</el-button
|
|
54
|
+
>
|
|
55
|
+
<template v-for="(subWidget, swIdx) in widget.widgetList">
|
|
56
|
+
<template v-if="'container' === subWidget.category">
|
|
57
|
+
<component
|
|
58
|
+
:is="subWidget.type + '-item'"
|
|
59
|
+
:widget="subWidget"
|
|
60
|
+
:key="swIdx"
|
|
61
|
+
:parent-list="widget.widgetList"
|
|
62
|
+
:index-of-parent-list="swIdx"
|
|
63
|
+
:parent-widget="widget"
|
|
64
|
+
>
|
|
65
|
+
<!-- 递归传递插槽!!! -->
|
|
66
|
+
<template
|
|
67
|
+
v-for="slot in Object.keys($scopedSlots)"
|
|
68
|
+
v-slot:[slot]="scope"
|
|
69
|
+
>
|
|
70
|
+
<slot :name="slot" v-bind="scope" />
|
|
71
|
+
</template>
|
|
72
|
+
</component>
|
|
73
|
+
</template>
|
|
74
|
+
<template v-else>
|
|
75
|
+
<component
|
|
76
|
+
:is="subWidget.type + '-widget'"
|
|
77
|
+
:field="subWidget"
|
|
78
|
+
:designer="null"
|
|
79
|
+
:key="swIdx"
|
|
80
|
+
:parent-list="widget.widgetList"
|
|
81
|
+
:index-of-parent-list="swIdx"
|
|
82
|
+
:parent-widget="widget"
|
|
83
|
+
>
|
|
84
|
+
<!-- 递归传递插槽!!! -->
|
|
85
|
+
<template
|
|
86
|
+
v-for="slot in Object.keys($scopedSlots)"
|
|
87
|
+
v-slot:[slot]="scope"
|
|
88
|
+
>
|
|
89
|
+
<slot :name="slot" v-bind="scope" />
|
|
90
|
+
</template>
|
|
91
|
+
</component>
|
|
92
|
+
</template>
|
|
93
|
+
</template>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<baseTabs :showNav="!widget.options.hideNav">
|
|
97
|
+
<detail-pane-widget
|
|
98
|
+
v-for="(paneWidget, index) in widget.panes"
|
|
99
|
+
:key="index"
|
|
100
|
+
:widget="paneWidget"
|
|
101
|
+
:parent-list="widget.panes"
|
|
102
|
+
:index-of-parent-list="index"
|
|
103
|
+
:parent-widget="widget"
|
|
104
|
+
:col-height="widget.options.colHeight"
|
|
105
|
+
tabRef="baseTabRef"
|
|
106
|
+
:tabPaneGrade="2"
|
|
107
|
+
></detail-pane-widget>
|
|
108
|
+
</baseTabs>
|
|
109
|
+
</div>
|
|
110
|
+
</container-item-wrapper>
|
|
111
|
+
</template>
|
|
112
|
+
|
|
113
|
+
<script>
|
|
114
|
+
import emitter from "../../../../components/xform/utils/emitter";
|
|
115
|
+
import i18n from "../../../../components/xform/utils/i18n";
|
|
116
|
+
import refMixin from "../../../../components/xform/form-render/refMixin";
|
|
117
|
+
import ContainerItemWrapper from "./container-item-wrapper";
|
|
118
|
+
import containerItemMixin from "./containerItemMixin";
|
|
119
|
+
import detailPaneWidget from "../../../../components/xform/form-render/container-item/detail-pane-item";
|
|
120
|
+
import FieldComponents from "../../../../components/xform/form-designer/form-widget/field-widget/index";
|
|
121
|
+
|
|
122
|
+
import { initWf, openStartWfDialog } from "../../../../components/wf/wfUtil";
|
|
123
|
+
import settingConfig from "@/settings.js";
|
|
124
|
+
|
|
125
|
+
export default {
|
|
126
|
+
name: "detail-item",
|
|
127
|
+
componentName: "ContainerItem",
|
|
128
|
+
mixins: [emitter, i18n, refMixin, containerItemMixin],
|
|
129
|
+
components: {
|
|
130
|
+
ContainerItemWrapper,
|
|
131
|
+
detailPaneWidget,
|
|
132
|
+
...FieldComponents,
|
|
133
|
+
},
|
|
134
|
+
props: {
|
|
135
|
+
widget: Object,
|
|
136
|
+
},
|
|
137
|
+
inject: ["refList", "sfRefList", "globalModel", "previewState"],
|
|
138
|
+
created() {
|
|
139
|
+
this.initRefList();
|
|
140
|
+
this.handleOnCreated();
|
|
141
|
+
},
|
|
142
|
+
mounted() {
|
|
143
|
+
this.handleOnMounted();
|
|
144
|
+
this.$nextTick(() => {
|
|
145
|
+
this.createWf();
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
beforeDestroy() {
|
|
149
|
+
this.unregisterFromRefList();
|
|
150
|
+
},
|
|
151
|
+
data() {
|
|
152
|
+
return {
|
|
153
|
+
wfInfo: {},
|
|
154
|
+
wfReady: false, // 流程状态是否已就绪(callback 返回后)
|
|
155
|
+
wfHasStarted: false, // 流程是否已启动(已启动则不显示启动按钮)
|
|
156
|
+
wfStartOption: null, // 启动流程所需 option(createWf 构造)
|
|
157
|
+
wfStartCtx: null, // openStartWfDialog 的执行上下文(与 initWf 一致)
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
computed: {
|
|
161
|
+
wfStartButtonName() {
|
|
162
|
+
return (
|
|
163
|
+
settingConfig.wfStartButtonName ||
|
|
164
|
+
this.$t2("流程启动", "components.wf.wfStart")
|
|
165
|
+
);
|
|
166
|
+
},
|
|
167
|
+
// 「上一单/下一单」翻单按钮状态:详情表单开启 billNavEnabled 且宿主列表有翻单快照时才显示。
|
|
168
|
+
// detail-item 在每次翻单时随详情表单重挂载,故此处按当前挂载时机取一次即可。
|
|
169
|
+
billNav() {
|
|
170
|
+
let formRef = this.getFormRef && this.getFormRef();
|
|
171
|
+
if (
|
|
172
|
+
!formRef ||
|
|
173
|
+
!formRef.formConfig ||
|
|
174
|
+
!formRef.formConfig.billNavEnabled
|
|
175
|
+
) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
let host = formRef.getListPageRef && formRef.getListPageRef();
|
|
179
|
+
if (!host || typeof host.getActiveBillNavState !== "function")
|
|
180
|
+
return null;
|
|
181
|
+
let state = host.getActiveBillNavState();
|
|
182
|
+
if (!state) return null;
|
|
183
|
+
return {
|
|
184
|
+
canPrev: state.index > 0,
|
|
185
|
+
canNext: state.index < state.rows.length - 1,
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
methods: {
|
|
190
|
+
// 解析流程启动信息:优先取表单实例(indexMixin,xform 主链路)暴露的,回退到本组件 createWf(旧路径)。
|
|
191
|
+
// 用方法实时求值,避免 computed 缓存导致早于 wf 就绪时求值后不再更新。
|
|
192
|
+
wfStart() {
|
|
193
|
+
let formRef = this.getFormRef && this.getFormRef();
|
|
194
|
+
if (formRef && formRef.wfStartOption) {
|
|
195
|
+
return {
|
|
196
|
+
ctx: formRef.wfStartCtx || formRef,
|
|
197
|
+
option: formRef.wfStartOption,
|
|
198
|
+
hasWf: !!formRef.hasWf,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
if (this.wfReady && this.wfStartOption && this.wfStartCtx) {
|
|
202
|
+
return {
|
|
203
|
+
ctx: this.wfStartCtx,
|
|
204
|
+
option: this.wfStartOption,
|
|
205
|
+
hasWf: this.wfHasStarted,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
return null;
|
|
209
|
+
},
|
|
210
|
+
// 流程启动按钮:有启动信息、需要按钮(showStartBtn 未显式关闭)、未启动、非预览态才显示。
|
|
211
|
+
// 声明式渲染,替代 wfUtil 的 DOM 强制注入。
|
|
212
|
+
showWfStartBtn() {
|
|
213
|
+
let ws = this.wfStart();
|
|
214
|
+
if (!ws || this.previewState) return false;
|
|
215
|
+
let opt = ws.option || {};
|
|
216
|
+
return opt.showStartBtn !== false && !ws.hasWf;
|
|
217
|
+
},
|
|
218
|
+
// 声明式触发流程启动(替代原注入按钮的点击),复用 wfUtil 的 openStartWfDialog
|
|
219
|
+
startWf() {
|
|
220
|
+
let ws = this.wfStart();
|
|
221
|
+
if (!ws || !ws.option || !ws.ctx) return;
|
|
222
|
+
openStartWfDialog(ws.ctx, ws.option);
|
|
223
|
+
},
|
|
224
|
+
// 触发宿主翻单:step = -1 上一单 / +1 下一单
|
|
225
|
+
navBill(step) {
|
|
226
|
+
let host = this.getFormRef && this.getFormRef();
|
|
227
|
+
host = host && host.getListPageRef && host.getListPageRef();
|
|
228
|
+
host && host.navigateActiveBill && host.navigateActiveBill(step);
|
|
229
|
+
},
|
|
230
|
+
reload() {
|
|
231
|
+
this.getFormRef().$parent.$baseReload();
|
|
232
|
+
},
|
|
233
|
+
saveData() {
|
|
234
|
+
if (!!this.previewState) return;
|
|
235
|
+
this.getFormRef().saveForm();
|
|
236
|
+
},
|
|
237
|
+
createWf() {
|
|
238
|
+
if (!!this.previewState || !this.widget.options.wfEnabled) return;
|
|
239
|
+
let formTarget = this.getFormRef();
|
|
240
|
+
let formData = formTarget.formData;
|
|
241
|
+
if (formData && formData.object_foreign_id) {
|
|
242
|
+
let reportTemplate = formTarget.reportTemplate;
|
|
243
|
+
let formCode = reportTemplate.formCode;
|
|
244
|
+
let option = {
|
|
245
|
+
objId: formData.object_foreign_id, //单据ID
|
|
246
|
+
wfCode: formCode, //流程编码
|
|
247
|
+
showStartBtn: true, //需要启动按钮(语义不变)
|
|
248
|
+
injectStartBtn: false, //不走 DOM 强制注入,改由本组件模板声明式渲染
|
|
249
|
+
serviceId: "user",
|
|
250
|
+
startConfirmText: () => formTarget.getWfStartConfirmText(),
|
|
251
|
+
callback: ({ wfInfo, hasWf }) => {
|
|
252
|
+
this.wfInfo = wfInfo;
|
|
253
|
+
this.wfHasStarted = !!hasWf; //已启动则不显示启动按钮(与原注入条件 !hasWf 一致)
|
|
254
|
+
this.wfReady = true; //状态就绪后才显示按钮,避免回调前闪现
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
this.wfStartOption = option;
|
|
258
|
+
this.wfStartCtx = formTarget.$parent; //与 initWf 执行上下文一致,供 openStartWfDialog 使用
|
|
259
|
+
initWf.call(formTarget.$parent, option);
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
</script>
|
|
265
|
+
|
|
266
|
+
<style lang="scss" scoped>
|
|
267
|
+
.grid-container {
|
|
268
|
+
min-height: 50px;
|
|
269
|
+
//line-height: 48px;
|
|
270
|
+
//padding: 6px;
|
|
271
|
+
outline: 1px dashed #336699;
|
|
272
|
+
|
|
273
|
+
> div {
|
|
274
|
+
height: 100%;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.form-widget-list {
|
|
278
|
+
// min-height: 28px;
|
|
279
|
+
height: 100%;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.grid-container.selected,
|
|
284
|
+
.grid-cell.selected {
|
|
285
|
+
outline: 2px solid $--color-primary !important;
|
|
286
|
+
}
|
|
287
|
+
</style>
|
|
@@ -1364,12 +1364,12 @@ modules = {
|
|
|
1364
1364
|
objId: dataId, //单据ID
|
|
1365
1365
|
wfCode: wfCode, //流程编码
|
|
1366
1366
|
showStartBtn: true, //需要启动按钮(语义不变)
|
|
1367
|
-
injectStartBtn: false, //但不走 wfUtil 的 DOM 强制注入,改由 detail-item 模板声明式渲染
|
|
1368
|
-
showWfFold: true,
|
|
1369
|
-
formCode: formCode,
|
|
1370
|
-
startConfirmText: () => this.getWfStartConfirmText(),
|
|
1371
|
-
callback: (wfParam) => {
|
|
1372
|
-
this.setFormData(formData);
|
|
1367
|
+
injectStartBtn: false, //但不走 wfUtil 的 DOM 强制注入,改由 detail-item 模板声明式渲染
|
|
1368
|
+
showWfFold: true,
|
|
1369
|
+
formCode: formCode,
|
|
1370
|
+
startConfirmText: () => this.getWfStartConfirmText(),
|
|
1371
|
+
callback: (wfParam) => {
|
|
1372
|
+
this.setFormData(formData);
|
|
1373
1373
|
|
|
1374
1374
|
let { hasWf } = wfParam;
|
|
1375
1375
|
this.hasWf = hasWf;
|
|
@@ -1776,9 +1776,9 @@ modules = {
|
|
|
1776
1776
|
eventParamValues: [dataId, formCode],
|
|
1777
1777
|
};
|
|
1778
1778
|
},
|
|
1779
|
-
handleCustomEvent(funtionStr, eventParamNames = [], eventParamValues = []) {
|
|
1780
|
-
if (!this.designState && funtionStr) {
|
|
1781
|
-
let eventParam = this.getEventParam();
|
|
1779
|
+
handleCustomEvent(funtionStr, eventParamNames = [], eventParamValues = []) {
|
|
1780
|
+
if (!this.designState && funtionStr) {
|
|
1781
|
+
let eventParam = this.getEventParam();
|
|
1782
1782
|
let e = new Function(
|
|
1783
1783
|
...eventParam.eventParamNames,
|
|
1784
1784
|
...eventParamNames,
|
|
@@ -1787,20 +1787,20 @@ modules = {
|
|
|
1787
1787
|
return e.call(
|
|
1788
1788
|
this,
|
|
1789
1789
|
...eventParam.eventParamValues,
|
|
1790
|
-
...eventParamValues
|
|
1791
|
-
);
|
|
1792
|
-
}
|
|
1793
|
-
},
|
|
1794
|
-
getWfStartConfirmText() {
|
|
1795
|
-
let currentFormData = this.getSysFormData(this.getRealFormData());
|
|
1796
|
-
return this.handleCustomEvent(
|
|
1797
|
-
this.formConfig?.wfStartConfirmText,
|
|
1798
|
-
["formData"],
|
|
1799
|
-
[currentFormData]
|
|
1800
|
-
);
|
|
1801
|
-
},
|
|
1802
|
-
|
|
1803
|
-
handleOnCreated: function () {
|
|
1790
|
+
...eventParamValues
|
|
1791
|
+
);
|
|
1792
|
+
}
|
|
1793
|
+
},
|
|
1794
|
+
getWfStartConfirmText() {
|
|
1795
|
+
let currentFormData = this.getSysFormData(this.getRealFormData());
|
|
1796
|
+
return this.handleCustomEvent(
|
|
1797
|
+
this.formConfig?.wfStartConfirmText,
|
|
1798
|
+
["formData"],
|
|
1799
|
+
[currentFormData]
|
|
1800
|
+
);
|
|
1801
|
+
},
|
|
1802
|
+
|
|
1803
|
+
handleOnCreated: function () {
|
|
1804
1804
|
this.handleCustomEvent(this.formConfig?.onFormCreated);
|
|
1805
1805
|
/*if (this.formConfig && this.formConfig.onFormCreated) {
|
|
1806
1806
|
let e = new Function(this.formConfig.onFormCreated);
|
|
@@ -1026,11 +1026,11 @@ export function getDefaultFormConfig() {
|
|
|
1026
1026
|
formScriptCode: "getOne",
|
|
1027
1027
|
formScriptParam: null,
|
|
1028
1028
|
formScriptSuccess: null,
|
|
1029
|
-
saveScriptCode: "saveUpdate",
|
|
1030
|
-
wfConfig: null,
|
|
1031
|
-
wfStartBindSave: false,
|
|
1032
|
-
wfStartConfirmText: null,
|
|
1033
|
-
wfAgreenBindSave: false,
|
|
1029
|
+
saveScriptCode: "saveUpdate",
|
|
1030
|
+
wfConfig: null,
|
|
1031
|
+
wfStartBindSave: false,
|
|
1032
|
+
wfStartConfirmText: null,
|
|
1033
|
+
wfAgreenBindSave: false,
|
|
1034
1034
|
wfAgreeConfigData: [],
|
|
1035
1035
|
wfConfigDataEnabled: false,
|
|
1036
1036
|
wfConfigData: [],
|