cloud-web-corejs 1.1.0-dev.19 → 1.1.0-dev.21
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/baseInputExport/mixins.js +0 -6
- package/src/components/xform/docs/2026-09 /345/212/250/346/200/201/345/255/227/346/256/265/350/247/204/345/210/231/344/270/216/346/265/201/347/250/213/346/216/247/345/210/266/346/211/247/350/241/214/351/241/272/345/272/217/350/220/275/345/234/260/346/226/271/346/241/210.md" +409 -0
- package/src/components/xform/form-designer/designer.js +2086 -2084
- package/src/components/xform/form-designer/form-widget/dialog/importDialogMixin.js +34 -0
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +13 -1
- package/src/components/xform/form-designer/setting-panel/form-dynamicField-setting.vue +687 -602
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +74 -9
- package/src/components/xform/form-designer/setting-panel/property-editor/field-import-button/import2-button-editor.vue +8 -0
- package/src/components/xform/form-render/container-item/data-table-mixin.js +6304 -6285
- package/src/components/xform/form-render/container-item/dynamicFieldMixin.js +55 -1
- package/src/components/xform/form-render/container-item/tab-item.vue +138 -129
- package/src/components/xform/form-render/fieldControlEngine.js +218 -0
- package/src/components/xform/form-render/fieldControlMixin.js +534 -0
- package/src/components/xform/form-render/index.vue +164 -153
- package/src/components/xform/form-render/indexMixin.js +5415 -5331
- package/src/components/xform/mixins/defaultHandle.js +713 -707
- package/src/components/xform/utils/util.js +1710 -1708
- package/src/views/user/home/default.vue +6 -3
- package/src/views/user/home/wjl/content.vue +3 -2
- package/src/components/xform/form-render/container-item/dynamicFieldEngine.js +0 -285
- package/src/components/xform/form-render/formDynamicFieldMixin.js +0 -131
|
@@ -737,15 +737,18 @@ body #app .index-home {
|
|
|
737
737
|
.time {
|
|
738
738
|
color: #b9b9b9;
|
|
739
739
|
font-size: 12px;
|
|
740
|
-
right: 12px;
|
|
740
|
+
right: 12px;
|
|
741
|
+
background: #FFF;
|
|
742
|
+
padding-left: 8px;
|
|
741
743
|
}
|
|
742
744
|
|
|
743
745
|
&:hover {
|
|
744
746
|
color: $baseColor;
|
|
745
|
-
background-color:
|
|
747
|
+
background-color: #F8FAFC;
|
|
746
748
|
|
|
747
749
|
.time {
|
|
748
|
-
color: $baseColor;
|
|
750
|
+
color: $baseColor;
|
|
751
|
+
background-color: #F8FAFC;
|
|
749
752
|
}
|
|
750
753
|
}
|
|
751
754
|
|
|
@@ -483,7 +483,8 @@ export default {
|
|
|
483
483
|
let userInfo = res.objx;
|
|
484
484
|
this.headPhotoUrl = userInfo.headPhotoUrl
|
|
485
485
|
? userInfo.headPhotoUrl
|
|
486
|
-
:
|
|
486
|
+
: require("@/resources/images/default-header.png").default ||
|
|
487
|
+
require("@/resources/images/default-header.png");
|
|
487
488
|
|
|
488
489
|
this.userInfo = userInfo;
|
|
489
490
|
this.initServiceProviderRole();
|
|
@@ -709,7 +710,7 @@ export default {
|
|
|
709
710
|
this.showDealDialog = true;
|
|
710
711
|
},
|
|
711
712
|
openOrderView(row) {
|
|
712
|
-
let dataId = row.
|
|
713
|
+
let dataId = row.order_id;
|
|
713
714
|
if (dataId == null) {
|
|
714
715
|
this.$message.warning(this.$t1("未找到工单"));
|
|
715
716
|
return;
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 动态字段规则引擎(纯逻辑,无 Vue 上下文)。
|
|
3
|
-
*
|
|
4
|
-
* 供「表单级动态规则(form-setting)」与「容器级动态字段(container-item)」共用:
|
|
5
|
-
* - 目标收集:字段 + 命名容器,建立 目标key -> { widget, refKey, isContainer } 映射与设计基线
|
|
6
|
-
* - 规则计算:本地条件/逻辑求值,输出每个目标的最终状态
|
|
7
|
-
* - 状态落地:通过 getWidgetRef 应用到运行时组件,无 ref 时回退改 schema
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
traverseFieldWidgets,
|
|
11
|
-
traverseContainerWidgets,
|
|
12
|
-
traverseFieldWidgetsOfContainer,
|
|
13
|
-
} from "../../../../components/xform/utils/util";
|
|
14
|
-
|
|
15
|
-
// 布局内格容器,不作为可控目标
|
|
16
|
-
const EXCLUDED_CONTAINER_TYPES = ["grid-col", "table-cell", "h5-table-cell"];
|
|
17
|
-
|
|
18
|
-
export function getModelKey(w) {
|
|
19
|
-
return (w.options.keyNameEnabled && w.options.keyName) || w.options.name;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function addFieldTo(map, baseline, w) {
|
|
23
|
-
if (!w || !w.options) return;
|
|
24
|
-
const key = getModelKey(w);
|
|
25
|
-
if (!key) return;
|
|
26
|
-
map[key] = { widget: w, refKey: w.options.name, isContainer: false };
|
|
27
|
-
baseline[key] = {
|
|
28
|
-
visible: !w.options.hidden,
|
|
29
|
-
required: !!w.options.required,
|
|
30
|
-
readonly: !!w.options.readonly,
|
|
31
|
-
disabled: !!w.options.disabled,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function addContainerTo(map, baseline, w) {
|
|
36
|
-
if (!w || !w.options || !w.options.name) return;
|
|
37
|
-
if (EXCLUDED_CONTAINER_TYPES.indexOf(w.type) > -1) return;
|
|
38
|
-
const key = w.options.name;
|
|
39
|
-
if (map[key]) return;
|
|
40
|
-
map[key] = { widget: w, refKey: key, isContainer: true };
|
|
41
|
-
baseline[key] = { visible: !w.options.hidden };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// 整个表单范围:字段 + 命名容器(跳过弹窗/抽屉内部)
|
|
45
|
-
export function buildFormTargetMap(widgetList) {
|
|
46
|
-
const map = {};
|
|
47
|
-
const baseline = {};
|
|
48
|
-
traverseFieldWidgets(widgetList || [], (w) => addFieldTo(map, baseline, w));
|
|
49
|
-
traverseContainerWidgets(
|
|
50
|
-
widgetList || [],
|
|
51
|
-
(w) => addContainerTo(map, baseline, w),
|
|
52
|
-
true
|
|
53
|
-
);
|
|
54
|
-
return { map, baseline };
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// 单个容器范围:容器内字段 + 命名子容器
|
|
58
|
-
export function buildContainerTargetMap(container) {
|
|
59
|
-
const map = {};
|
|
60
|
-
const baseline = {};
|
|
61
|
-
traverseFieldWidgetsOfContainer(container, (w) => addFieldTo(map, baseline, w));
|
|
62
|
-
collectNamedContainersInContainer(container).forEach((w) =>
|
|
63
|
-
addContainerTo(map, baseline, w)
|
|
64
|
-
);
|
|
65
|
-
return { map, baseline };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// 递归收集指定容器内「命名的子容器」
|
|
69
|
-
export function collectNamedContainersInContainer(root) {
|
|
70
|
-
const out = [];
|
|
71
|
-
const walk = (w, isRoot) => {
|
|
72
|
-
if (!w || w.category !== "container") return;
|
|
73
|
-
if (
|
|
74
|
-
!isRoot
|
|
75
|
-
&& w.options
|
|
76
|
-
&& w.options.name
|
|
77
|
-
&& EXCLUDED_CONTAINER_TYPES.indexOf(w.type) === -1
|
|
78
|
-
) {
|
|
79
|
-
out.push(w);
|
|
80
|
-
}
|
|
81
|
-
if (Array.isArray(w.rows)) {
|
|
82
|
-
w.rows.forEach((row) => {
|
|
83
|
-
(row.cols || []).forEach((cell) => walk(cell, false));
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
["cols", "tabs", "widgetList", "panes", "buttonWidgetList"].forEach((k) => {
|
|
87
|
-
if (Array.isArray(w[k])) w[k].forEach((c) => walk(c, false));
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
walk(root, true);
|
|
91
|
-
return out;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/* ------------------- 层级下拉选项(供设计器) ------------------- */
|
|
95
|
-
// 构建带层级的目标候选(字段 + 容器),按表单树 DFS 顺序输出,附带 depth。
|
|
96
|
-
// 布局内格(grid-col/table-cell 等)不单独成节点,仅作为透明层向下展开。
|
|
97
|
-
function makeTreeBuilder() {
|
|
98
|
-
const nodes = [];
|
|
99
|
-
const visitList = (list, depth) => {
|
|
100
|
-
(list || []).forEach((w) => visit(w, depth));
|
|
101
|
-
};
|
|
102
|
-
const visitChildren = (w, depth) => {
|
|
103
|
-
if (Array.isArray(w.rows)) {
|
|
104
|
-
w.rows.forEach((row) => visitList((row && row.cols) || [], depth));
|
|
105
|
-
}
|
|
106
|
-
["cols", "tabs", "widgetList", "panes", "buttonWidgetList"].forEach((k) => {
|
|
107
|
-
if (Array.isArray(w[k])) visitList(w[k], depth);
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
const visit = (w, depth) => {
|
|
111
|
-
if (!w) return;
|
|
112
|
-
if (w.category === "container") {
|
|
113
|
-
// 布局内格:透明展开,深度不变
|
|
114
|
-
if (EXCLUDED_CONTAINER_TYPES.indexOf(w.type) > -1) {
|
|
115
|
-
visitChildren(w, depth);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const name = w.options && w.options.name;
|
|
119
|
-
nodes.push({
|
|
120
|
-
value: name || "__c_" + w.id,
|
|
121
|
-
baseLabel: (w.options && (w.options.label || name)) || w.type,
|
|
122
|
-
depth,
|
|
123
|
-
isContainer: true,
|
|
124
|
-
hasName: !!name,
|
|
125
|
-
type: w.type,
|
|
126
|
-
});
|
|
127
|
-
visitChildren(w, depth + 1);
|
|
128
|
-
} else if (w.formItemFlag) {
|
|
129
|
-
const key = getModelKey(w);
|
|
130
|
-
if (!key) return;
|
|
131
|
-
nodes.push({
|
|
132
|
-
value: key,
|
|
133
|
-
baseLabel: (w.options.label || key) + " (" + key + ")",
|
|
134
|
-
depth,
|
|
135
|
-
isContainer: false,
|
|
136
|
-
hasName: true,
|
|
137
|
-
type: w.type,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
return { nodes, visitList, visitChildren };
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// 整个表单范围的层级候选
|
|
145
|
-
export function buildWidgetTreeOptions(rootList) {
|
|
146
|
-
const b = makeTreeBuilder();
|
|
147
|
-
b.visitList(rootList || [], 0);
|
|
148
|
-
return b.nodes;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// 单个容器范围的层级候选(不含容器自身,从其子级开始)
|
|
152
|
-
export function buildContainerTreeOptions(container) {
|
|
153
|
-
const b = makeTreeBuilder();
|
|
154
|
-
if (container) b.visitChildren(container, 0);
|
|
155
|
-
return b.nodes;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/* ------------------- 规则计算 ------------------- */
|
|
159
|
-
export function computeLocalStates(rules, baseline, formModel) {
|
|
160
|
-
const list = rules || [];
|
|
161
|
-
const states = {};
|
|
162
|
-
const ensure = (key) => {
|
|
163
|
-
if (!states[key]) {
|
|
164
|
-
const base = baseline[key] || { visible: true };
|
|
165
|
-
states[key] = Object.assign({}, base);
|
|
166
|
-
}
|
|
167
|
-
return states[key];
|
|
168
|
-
};
|
|
169
|
-
// 先把所有规则涉及的目标置为基线,未命中时即还原
|
|
170
|
-
list.forEach((rule) => {
|
|
171
|
-
(rule.targets || []).forEach((t) => t.field && ensure(t.field));
|
|
172
|
-
});
|
|
173
|
-
list.forEach((rule) => {
|
|
174
|
-
if (!evalRule(rule, formModel)) return;
|
|
175
|
-
(rule.targets || []).forEach((t) => {
|
|
176
|
-
if (!t.field) return;
|
|
177
|
-
const s = ensure(t.field);
|
|
178
|
-
if (t.visible !== undefined && t.visible !== null) s.visible = !!t.visible;
|
|
179
|
-
if (t.required !== undefined && t.required !== null) {
|
|
180
|
-
s.required = !!t.required;
|
|
181
|
-
}
|
|
182
|
-
if (t.readonly !== undefined && t.readonly !== null) {
|
|
183
|
-
s.readonly = !!t.readonly;
|
|
184
|
-
}
|
|
185
|
-
if (t.disabled !== undefined && t.disabled !== null) {
|
|
186
|
-
s.disabled = !!t.disabled;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
return states;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export function evalRule(rule, model) {
|
|
194
|
-
const conds = (rule && rule.conditions) || [];
|
|
195
|
-
if (!conds.length) return true;
|
|
196
|
-
if (rule.logic === "or") {
|
|
197
|
-
return conds.some((c) => evalCondition(c, model));
|
|
198
|
-
}
|
|
199
|
-
return conds.every((c) => evalCondition(c, model));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export function evalCondition(cond, model) {
|
|
203
|
-
if (!cond || !cond.field) return false;
|
|
204
|
-
const actual = model ? model[cond.field] : undefined;
|
|
205
|
-
const expected = cond.value;
|
|
206
|
-
const isEmpty = (v) =>
|
|
207
|
-
v === undefined
|
|
208
|
-
|| v === null
|
|
209
|
-
|| v === ""
|
|
210
|
-
|| (Array.isArray(v) && v.length === 0);
|
|
211
|
-
const toList = (v) =>
|
|
212
|
-
String(v == null ? "" : v)
|
|
213
|
-
.split(",")
|
|
214
|
-
.map((s) => s.trim())
|
|
215
|
-
.filter((s) => s !== "");
|
|
216
|
-
switch (cond.operator) {
|
|
217
|
-
case "eq":
|
|
218
|
-
return String(actual) === String(expected);
|
|
219
|
-
case "ne":
|
|
220
|
-
return String(actual) !== String(expected);
|
|
221
|
-
case "gt":
|
|
222
|
-
return Number(actual) > Number(expected);
|
|
223
|
-
case "lt":
|
|
224
|
-
return Number(actual) < Number(expected);
|
|
225
|
-
case "ge":
|
|
226
|
-
return Number(actual) >= Number(expected);
|
|
227
|
-
case "le":
|
|
228
|
-
return Number(actual) <= Number(expected);
|
|
229
|
-
case "in":
|
|
230
|
-
return toList(expected).includes(String(actual));
|
|
231
|
-
case "nin":
|
|
232
|
-
return !toList(expected).includes(String(actual));
|
|
233
|
-
case "includes":
|
|
234
|
-
return Array.isArray(actual)
|
|
235
|
-
? actual.map(String).includes(String(expected))
|
|
236
|
-
: String(actual == null ? "" : actual).indexOf(String(expected)) > -1;
|
|
237
|
-
case "empty":
|
|
238
|
-
return isEmpty(actual);
|
|
239
|
-
case "notEmpty":
|
|
240
|
-
return !isEmpty(actual);
|
|
241
|
-
default:
|
|
242
|
-
return false;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/* ------------------- 状态落地 ------------------- */
|
|
247
|
-
// entry: { widget, refKey, isContainer };getWidgetRef: (name) => 运行时组件ref
|
|
248
|
-
export function applyTargetState(entry, state, getWidgetRef) {
|
|
249
|
-
if (!entry || !state) return;
|
|
250
|
-
const widget = entry.widget;
|
|
251
|
-
const isContainer = entry.isContainer;
|
|
252
|
-
const ref = getWidgetRef ? getWidgetRef(entry.refKey) : null;
|
|
253
|
-
const hasVisible = state.visible !== undefined && state.visible !== null;
|
|
254
|
-
if (ref) {
|
|
255
|
-
if (hasVisible && ref.setHidden) ref.setHidden(!state.visible);
|
|
256
|
-
if (isContainer) return;
|
|
257
|
-
if (state.required !== undefined && state.required !== null && ref.setRequired) {
|
|
258
|
-
ref.setRequired(!!state.required);
|
|
259
|
-
}
|
|
260
|
-
if (state.readonly !== undefined && state.readonly !== null && ref.setReadonly) {
|
|
261
|
-
ref.setReadonly(!!state.readonly);
|
|
262
|
-
}
|
|
263
|
-
if (state.disabled !== undefined && state.disabled !== null && ref.setDisabled) {
|
|
264
|
-
ref.setDisabled(!!state.disabled);
|
|
265
|
-
}
|
|
266
|
-
if (state.options !== undefined && state.options !== null && ref.setOptions) {
|
|
267
|
-
ref.setOptions(state.options);
|
|
268
|
-
}
|
|
269
|
-
if (state.value !== undefined && ref.setValue) {
|
|
270
|
-
ref.setValue(state.value);
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
if (hasVisible) widget.options.hidden = !state.visible;
|
|
274
|
-
if (isContainer) return;
|
|
275
|
-
if (state.required !== undefined && state.required !== null) {
|
|
276
|
-
widget.options.required = !!state.required;
|
|
277
|
-
}
|
|
278
|
-
if (state.readonly !== undefined && state.readonly !== null) {
|
|
279
|
-
widget.options.readonly = !!state.readonly;
|
|
280
|
-
}
|
|
281
|
-
if (state.disabled !== undefined && state.disabled !== null) {
|
|
282
|
-
widget.options.disabled = !!state.disabled;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 表单级「动态字段规则」运行时混入(挂载于 VFormRender 根组件)。
|
|
3
|
-
*
|
|
4
|
-
* 配置来源:formConfig.dynamicFieldEnabled / dynamicFieldSourceType / dynamicFieldRules /
|
|
5
|
-
* dynamicFieldScriptCode / dynamicFieldScriptParam(额外参数) / dynamicFieldTriggerFields
|
|
6
|
-
* 作用范围:整个表单内任意字段 / 命名容器的 显隐/必填/只读/禁用/取值。
|
|
7
|
-
*
|
|
8
|
-
* 依赖根组件(indexMixin)已提供:formConfig、widgetList、formModel、getWidgetRef、formHttp。
|
|
9
|
-
*/
|
|
10
|
-
import {
|
|
11
|
-
buildFormTargetMap,
|
|
12
|
-
computeLocalStates,
|
|
13
|
-
applyTargetState,
|
|
14
|
-
} from "./container-item/dynamicFieldEngine";
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
created() {
|
|
18
|
-
// 目标key -> { widget, refKey, isContainer }
|
|
19
|
-
this._fdfMap = {};
|
|
20
|
-
// 设计期基线,未命中规则时还原
|
|
21
|
-
this._fdfBaseline = {};
|
|
22
|
-
this._fdfWatcher = null;
|
|
23
|
-
this._fdfTimer = null;
|
|
24
|
-
this._fdfInited = false;
|
|
25
|
-
},
|
|
26
|
-
watch: {
|
|
27
|
-
showFormContent(val) {
|
|
28
|
-
// 表单内容渲染(字段ref注册)完成后再初始化
|
|
29
|
-
if (val && !this._fdfInited) {
|
|
30
|
-
this.$nextTick(() => this.initFormDynamicFields());
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
beforeDestroy() {
|
|
35
|
-
if (this._fdfWatcher) {
|
|
36
|
-
this._fdfWatcher();
|
|
37
|
-
this._fdfWatcher = null;
|
|
38
|
-
}
|
|
39
|
-
if (this._fdfTimer) {
|
|
40
|
-
clearTimeout(this._fdfTimer);
|
|
41
|
-
this._fdfTimer = null;
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
methods: {
|
|
45
|
-
initFormDynamicFields() {
|
|
46
|
-
const cfg = this.formConfig || {};
|
|
47
|
-
if (!cfg.dynamicFieldEnabled) return;
|
|
48
|
-
this._fdfInited = true;
|
|
49
|
-
const { map, baseline } = buildFormTargetMap(this.widgetList);
|
|
50
|
-
this._fdfMap = map;
|
|
51
|
-
this._fdfBaseline = baseline;
|
|
52
|
-
this.applyFormDynamicFields();
|
|
53
|
-
this.setupFormDynamicWatcher();
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
applyFormDynamicFields() {
|
|
57
|
-
const cfg = this.formConfig || {};
|
|
58
|
-
if (!cfg.dynamicFieldEnabled) return;
|
|
59
|
-
if (cfg.dynamicFieldSourceType === "script") {
|
|
60
|
-
this.applyFormScriptStates();
|
|
61
|
-
} else {
|
|
62
|
-
const states = computeLocalStates(
|
|
63
|
-
cfg.dynamicFieldRules || [],
|
|
64
|
-
this._fdfBaseline,
|
|
65
|
-
this.formModel
|
|
66
|
-
);
|
|
67
|
-
Object.keys(states).forEach((key) =>
|
|
68
|
-
this.applyFormFieldState(key, states[key])
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
applyFormFieldState(targetKey, state) {
|
|
74
|
-
const entry = this._fdfMap[targetKey];
|
|
75
|
-
if (!entry) return;
|
|
76
|
-
applyTargetState(entry, state, (name) => this.getWidgetRef(name));
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
setupFormDynamicWatcher() {
|
|
80
|
-
const cfg = this.formConfig || {};
|
|
81
|
-
if (cfg.dynamicFieldSourceType === "script") {
|
|
82
|
-
const triggers = cfg.dynamicFieldTriggerFields || [];
|
|
83
|
-
if (!triggers.length) return;
|
|
84
|
-
this._fdfWatcher = this.$watch(
|
|
85
|
-
() =>
|
|
86
|
-
triggers
|
|
87
|
-
.map((f) => this.formModel && this.formModel[f])
|
|
88
|
-
.join("\u0001"),
|
|
89
|
-
() => this.debouncedFormApply()
|
|
90
|
-
);
|
|
91
|
-
} else {
|
|
92
|
-
this._fdfWatcher = this.$watch(
|
|
93
|
-
() => this.formModel,
|
|
94
|
-
() => this.debouncedFormApply(),
|
|
95
|
-
{ deep: true }
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
debouncedFormApply() {
|
|
101
|
-
if (this._fdfTimer) clearTimeout(this._fdfTimer);
|
|
102
|
-
this._fdfTimer = setTimeout(() => this.applyFormDynamicFields(), 120);
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
applyFormScriptStates() {
|
|
106
|
-
const cfg = this.formConfig || {};
|
|
107
|
-
if (!cfg.dynamicFieldScriptCode) return;
|
|
108
|
-
const extra = this.handleCustomEvent(cfg.dynamicFieldScriptParam) || {};
|
|
109
|
-
this.formHttp({
|
|
110
|
-
scriptCode: cfg.dynamicFieldScriptCode,
|
|
111
|
-
isLoading: false,
|
|
112
|
-
data: {
|
|
113
|
-
formData: this.formModel,
|
|
114
|
-
...extra,
|
|
115
|
-
},
|
|
116
|
-
success: (res) => {
|
|
117
|
-
const result = (res && res.objx) || {};
|
|
118
|
-
const fieldStates = result.fieldStates || {};
|
|
119
|
-
Object.keys(this._fdfBaseline).forEach((key) => {
|
|
120
|
-
if (!fieldStates[key]) {
|
|
121
|
-
this.applyFormFieldState(key, this._fdfBaseline[key]);
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
Object.keys(fieldStates).forEach((key) =>
|
|
125
|
-
this.applyFormFieldState(key, fieldStates[key])
|
|
126
|
-
);
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
};
|