cloud-web-corejs 1.0.54-dev.793 → 1.0.54-dev.795
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/xform/form-designer/form-widget/dialog/fileReferenceDialog.vue +1 -1
- package/src/components/xform/form-designer/form-widget/dialog/formDialog.vue +1 -1
- package/src/components/xform/form-designer/form-widget/dialog/formDrawer.vue +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/date-widget.vue +22 -2
- package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js +67 -2
- package/src/components/xform/form-designer/setting-panel/form-setting.vue +9 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-dateLimit-editor.vue +23 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/field-date/date-defaultValue-editor.vue +20 -2
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-defaultValue-editor.vue +8 -11
- package/src/components/xform/form-designer/setting-panel/property-editor/field-time/time-timeLimit-editor.vue +8 -11
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +2 -0
- package/src/components/xform/form-render/container-item/data-table-mixin.js +5 -11
- package/src/components/xform/form-render/indexMixin.js +5 -23
- package/src/components/xform/mixins/defaultHandle.js +29 -37
- package/src/store/config/index.js +12 -3
- package/src/views/bd/setting/form_template/mixins/edit.js +77 -74
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
:clearable="field.options.clearable" :editable="field.options.editable"
|
|
10
10
|
:format="field.options.format" :value-format="field.options.valueFormat"
|
|
11
11
|
:placeholder="getI18nLabel(field.options.placeholder || '选择日期')"
|
|
12
|
-
@focus="
|
|
12
|
+
@focus="handleDateFocusEvent" @blur="handleBlurCustomEvent"
|
|
13
13
|
@change="handleDateChangeEvent"
|
|
14
14
|
:picker-options="pickerOptions"
|
|
15
15
|
>
|
|
@@ -91,6 +91,9 @@ export default {
|
|
|
91
91
|
"field.options.maxDate"() {
|
|
92
92
|
this.initDateLimitPickerOptions();
|
|
93
93
|
},
|
|
94
|
+
"field.options.minDateType"() {
|
|
95
|
+
this.initDateLimitPickerOptions();
|
|
96
|
+
},
|
|
94
97
|
},
|
|
95
98
|
beforeCreate() {
|
|
96
99
|
/* 这里不能访问方法和属性!! */
|
|
@@ -99,7 +102,7 @@ export default {
|
|
|
99
102
|
created() {
|
|
100
103
|
/* 注意:子组件mounted在父组件created之后、父组件mounted之前触发,故子组件mounted需要用到的prop
|
|
101
104
|
需要在父组件created中初始化!! */
|
|
102
|
-
this.
|
|
105
|
+
this.initDateFieldModel()
|
|
103
106
|
this.registerToRefList()
|
|
104
107
|
this.initEventHandler()
|
|
105
108
|
this.buildFieldRules()
|
|
@@ -118,6 +121,13 @@ export default {
|
|
|
118
121
|
},
|
|
119
122
|
|
|
120
123
|
methods: {
|
|
124
|
+
handleDateFocusEvent(event) {
|
|
125
|
+
/* 最小日期为「当前时间」时,每次展开面板都需按当前时刻重新计算 */
|
|
126
|
+
if (this.isNowDateValueType(this.field.options.minDateType)) {
|
|
127
|
+
this.initDateLimitPickerOptions();
|
|
128
|
+
}
|
|
129
|
+
this.handleFocusCustomEvent(event);
|
|
130
|
+
},
|
|
121
131
|
handleDateChangeEvent(value) {
|
|
122
132
|
if (this.isDateLimitViolated(value)) {
|
|
123
133
|
this.$message.warning(this.getDateLimitViolationMessage());
|
|
@@ -128,6 +138,16 @@ export default {
|
|
|
128
138
|
},
|
|
129
139
|
setNow() {
|
|
130
140
|
this.$refs.fieldEditor.panel.changeToNow()
|
|
141
|
+
},
|
|
142
|
+
refreshDefaultValue() {
|
|
143
|
+
if (this.designState !== true) {
|
|
144
|
+
return
|
|
145
|
+
}
|
|
146
|
+
if (this.isNowDateValueType(this.field.options.defaultValueType)) {
|
|
147
|
+
this.fieldModel = this.getNowDateValue()
|
|
148
|
+
} else if (this.field.options.defaultValue !== undefined) {
|
|
149
|
+
this.fieldModel = this.field.options.defaultValue
|
|
150
|
+
}
|
|
131
151
|
}
|
|
132
152
|
}
|
|
133
153
|
}
|
package/src/components/xform/form-designer/form-widget/field-widget/mixins/date-limit-mixin.js
CHANGED
|
@@ -1,8 +1,51 @@
|
|
|
1
|
+
/* 日期组件的最小日期、默认值支持配置为「当前时间」,此处统一解析 */
|
|
2
|
+
export const DATE_VALUE_TYPE_NOW = "now";
|
|
3
|
+
|
|
1
4
|
export default {
|
|
2
5
|
methods: {
|
|
3
6
|
getDateLimitOptions() {
|
|
4
7
|
return this.field.options || {};
|
|
5
8
|
},
|
|
9
|
+
isNowDateValueType(valueType) {
|
|
10
|
+
return valueType === DATE_VALUE_TYPE_NOW;
|
|
11
|
+
},
|
|
12
|
+
/* 按组件的valueFormat格式化,valueFormat为空时picker的值为Date对象 */
|
|
13
|
+
formatDateValue(date, valueFormat) {
|
|
14
|
+
if (!valueFormat) {
|
|
15
|
+
return date;
|
|
16
|
+
}
|
|
17
|
+
if (valueFormat === "timestamp") {
|
|
18
|
+
return date.getTime();
|
|
19
|
+
}
|
|
20
|
+
const pad = (val) => (val < 10 ? "0" + val : String(val));
|
|
21
|
+
const tokenMap = {
|
|
22
|
+
yyyy: String(date.getFullYear()),
|
|
23
|
+
yy: String(date.getFullYear()).slice(-2),
|
|
24
|
+
MM: pad(date.getMonth() + 1),
|
|
25
|
+
dd: pad(date.getDate()),
|
|
26
|
+
HH: pad(date.getHours()),
|
|
27
|
+
mm: pad(date.getMinutes()),
|
|
28
|
+
ss: pad(date.getSeconds()),
|
|
29
|
+
};
|
|
30
|
+
return valueFormat.replace(
|
|
31
|
+
/yyyy|yy|MM|dd|HH|mm|ss/g,
|
|
32
|
+
(token) => tokenMap[token]
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
/* 当前时间,dates(多选日期)类型的值为数组 */
|
|
36
|
+
getNowDateValue() {
|
|
37
|
+
const options = this.getDateLimitOptions();
|
|
38
|
+
const nowValue = this.formatDateValue(new Date(), options.valueFormat);
|
|
39
|
+
return options.type === "dates" ? [nowValue] : nowValue;
|
|
40
|
+
},
|
|
41
|
+
/* 最小日期:固定日期或当前时间 */
|
|
42
|
+
getDateLimitMinValue() {
|
|
43
|
+
const options = this.getDateLimitOptions();
|
|
44
|
+
if (this.isNowDateValueType(options.minDateType)) {
|
|
45
|
+
return new Date();
|
|
46
|
+
}
|
|
47
|
+
return options.minDate;
|
|
48
|
+
},
|
|
6
49
|
initDateLimitPickerOptions() {
|
|
7
50
|
const pickerOptions = { ...(this.pickerOptions || {}) };
|
|
8
51
|
if (["year", "month", "date", "datetime"].includes(this.field.options.type)) {
|
|
@@ -58,6 +101,12 @@ export default {
|
|
|
58
101
|
if (val === null || val === undefined || val === "") {
|
|
59
102
|
return null;
|
|
60
103
|
}
|
|
104
|
+
if (val instanceof Date) {
|
|
105
|
+
return isNaN(val.getTime()) ? null : val.getTime();
|
|
106
|
+
}
|
|
107
|
+
if (typeof val === "number") {
|
|
108
|
+
return isNaN(val) ? null : val;
|
|
109
|
+
}
|
|
61
110
|
const date = new Date(String(val).replace(/-/g, "/"));
|
|
62
111
|
return isNaN(date.getTime()) ? null : date.getTime();
|
|
63
112
|
},
|
|
@@ -73,7 +122,7 @@ export default {
|
|
|
73
122
|
const options = this.getDateLimitOptions();
|
|
74
123
|
const currentTime = time.getTime();
|
|
75
124
|
|
|
76
|
-
const minDate = this.parseDateLimitValue(
|
|
125
|
+
const minDate = this.parseDateLimitValue(this.getDateLimitMinValue());
|
|
77
126
|
if (minDate !== null && currentTime < this.normalizeDateLimitDayTime(minDate, false)) {
|
|
78
127
|
return true;
|
|
79
128
|
}
|
|
@@ -113,7 +162,7 @@ export default {
|
|
|
113
162
|
}
|
|
114
163
|
|
|
115
164
|
const options = this.getDateLimitOptions();
|
|
116
|
-
const minDate = this.parseDateLimitValue(
|
|
165
|
+
const minDate = this.parseDateLimitValue(this.getDateLimitMinValue());
|
|
117
166
|
if (minDate !== null && currentTime < this.normalizeDateLimitDayTime(minDate, false)) {
|
|
118
167
|
return true;
|
|
119
168
|
}
|
|
@@ -153,5 +202,21 @@ export default {
|
|
|
153
202
|
}
|
|
154
203
|
return "日期超出允许范围";
|
|
155
204
|
},
|
|
205
|
+
/* 默认值配置为「当前时间」时,临时替换 defaultValue 后再走通用的取值逻辑 */
|
|
206
|
+
initDateFieldModel() {
|
|
207
|
+
const options = this.getDateLimitOptions();
|
|
208
|
+
if (!this.isNowDateValueType(options.defaultValueType)) {
|
|
209
|
+
this.initFieldModel();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const rawDefaultValue = options.defaultValue;
|
|
214
|
+
options.defaultValue = this.getNowDateValue();
|
|
215
|
+
try {
|
|
216
|
+
this.initFieldModel();
|
|
217
|
+
} finally {
|
|
218
|
+
options.defaultValue = rawDefaultValue;
|
|
219
|
+
}
|
|
220
|
+
},
|
|
156
221
|
},
|
|
157
222
|
};
|
|
@@ -285,7 +285,12 @@
|
|
|
285
285
|
</a>
|
|
286
286
|
</el-form-item>
|
|
287
287
|
</el-collapse-item>
|
|
288
|
-
<el-collapse-item name="4" title="
|
|
288
|
+
<el-collapse-item name="4" title="列表标签页信息(仅列表表单生效)">
|
|
289
|
+
<el-form-item>
|
|
290
|
+
<span style="color: #999; font-size: 12px; line-height: 1.6">
|
|
291
|
+
本组配置只从「查询列表页」所用的表单读取,在详情/编辑表单里设置不会生效
|
|
292
|
+
</span>
|
|
293
|
+
</el-form-item>
|
|
289
294
|
<el-form-item :label="i18nt('列表启用详情多标签')">
|
|
290
295
|
<el-switch v-model="formConfig.multiTabEnabled"></el-switch>
|
|
291
296
|
</el-form-item>
|
|
@@ -309,6 +314,9 @@
|
|
|
309
314
|
<el-radio label="closeToList">关闭页签并回列表刷新</el-radio>
|
|
310
315
|
<el-radio label="refreshCurrent">刷新当前页签</el-radio>
|
|
311
316
|
</el-radio-group>
|
|
317
|
+
<div style="color: #999; font-size: 12px; line-height: 1.6">
|
|
318
|
+
详情页「保存并提交」「直接启动流程」成功后的行为,不填默认「刷新当前页签」
|
|
319
|
+
</div>
|
|
312
320
|
</el-form-item>
|
|
313
321
|
</el-collapse-item>
|
|
314
322
|
<el-collapse-item name="5" title="其他标签页信息">
|
|
@@ -45,8 +45,10 @@
|
|
|
45
45
|
></el-input>
|
|
46
46
|
</el-form-item>
|
|
47
47
|
<el-form-item label="最小日期">
|
|
48
|
+
<el-checkbox v-model="nowMinDate">当前日期</el-checkbox>
|
|
48
49
|
<el-date-picker
|
|
49
|
-
v-
|
|
50
|
+
v-if="!nowMinDate"
|
|
51
|
+
v-model="minDate"
|
|
50
52
|
:type="pickerType"
|
|
51
53
|
:format="optionModel.format"
|
|
52
54
|
:value-format="optionModel.valueFormat"
|
|
@@ -84,6 +86,26 @@ export default {
|
|
|
84
86
|
tableColumns: Array,
|
|
85
87
|
},
|
|
86
88
|
computed: {
|
|
89
|
+
/* 老表单的options可能没有这些属性,统一用$set赋值,保证响应式 */
|
|
90
|
+
nowMinDate: {
|
|
91
|
+
get() {
|
|
92
|
+
return this.optionModel.minDateType === "now";
|
|
93
|
+
},
|
|
94
|
+
set(checked) {
|
|
95
|
+
this.$set(this.optionModel, "minDateType", checked ? "now" : "");
|
|
96
|
+
if (checked) {
|
|
97
|
+
this.$set(this.optionModel, "minDate", null);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
minDate: {
|
|
102
|
+
get() {
|
|
103
|
+
return this.optionModel.minDate || null;
|
|
104
|
+
},
|
|
105
|
+
set(value) {
|
|
106
|
+
this.$set(this.optionModel, "minDate", value || null);
|
|
107
|
+
},
|
|
108
|
+
},
|
|
87
109
|
pickerType() {
|
|
88
110
|
return this.optionModel.type || "date";
|
|
89
111
|
},
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-form-item :label="i18nt('designer.setting.defaultValue')">
|
|
3
|
-
<el-
|
|
4
|
-
|
|
3
|
+
<el-checkbox v-model="nowDefaultValue">当前日期</el-checkbox>
|
|
4
|
+
<el-date-picker v-if="!nowDefaultValue" :type="optionModel.type"
|
|
5
|
+
v-model="optionModel.defaultValue" @change="emitDefaultValueChange"
|
|
6
|
+
:format="optionModel.format" :value-format="optionModel.valueFormat"
|
|
7
|
+
style="width: 100%">
|
|
5
8
|
</el-date-picker>
|
|
6
9
|
</el-form-item>
|
|
7
10
|
</template>
|
|
@@ -18,6 +21,21 @@
|
|
|
18
21
|
selectedWidget: Object,
|
|
19
22
|
optionModel: Object,
|
|
20
23
|
},
|
|
24
|
+
computed: {
|
|
25
|
+
/* 老表单的options可能没有defaultValueType属性,用$set赋值保证响应式 */
|
|
26
|
+
nowDefaultValue: {
|
|
27
|
+
get() {
|
|
28
|
+
return this.optionModel.defaultValueType === 'now'
|
|
29
|
+
},
|
|
30
|
+
set(checked) {
|
|
31
|
+
this.$set(this.optionModel, 'defaultValueType', checked ? 'now' : '')
|
|
32
|
+
if (checked) {
|
|
33
|
+
this.$set(this.optionModel, 'defaultValue', null)
|
|
34
|
+
}
|
|
35
|
+
this.emitDefaultValueChange()
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
21
39
|
}
|
|
22
40
|
</script>
|
|
23
41
|
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-form-item :label="i18nt('designer.setting.defaultValue')">
|
|
3
|
-
<el-
|
|
4
|
-
|
|
5
|
-
<el-radio-button label="now">当前时间</el-radio-button>
|
|
6
|
-
</el-radio-group>
|
|
7
|
-
<el-time-picker v-if="defaultValueType !== 'now'" v-model="optionModel.defaultValue"
|
|
3
|
+
<el-checkbox v-model="nowDefaultValue">当前时间</el-checkbox>
|
|
4
|
+
<el-time-picker v-if="!nowDefaultValue" v-model="optionModel.defaultValue"
|
|
8
5
|
@change="emitDefaultValueChange"
|
|
9
6
|
:format="optionModel.format" value-format="HH:mm:ss"
|
|
10
|
-
style="width: 100
|
|
7
|
+
style="width: 100%">
|
|
11
8
|
</el-time-picker>
|
|
12
9
|
</el-form-item>
|
|
13
10
|
</template>
|
|
@@ -26,13 +23,13 @@
|
|
|
26
23
|
},
|
|
27
24
|
computed: {
|
|
28
25
|
/* 老表单的options可能没有defaultValueType属性,用$set赋值保证响应式 */
|
|
29
|
-
|
|
26
|
+
nowDefaultValue: {
|
|
30
27
|
get() {
|
|
31
|
-
return this.optionModel.defaultValueType
|
|
28
|
+
return this.optionModel.defaultValueType === 'now'
|
|
32
29
|
},
|
|
33
|
-
set(
|
|
34
|
-
this.$set(this.optionModel, 'defaultValueType',
|
|
35
|
-
if (
|
|
30
|
+
set(checked) {
|
|
31
|
+
this.$set(this.optionModel, 'defaultValueType', checked ? 'now' : '')
|
|
32
|
+
if (checked) {
|
|
36
33
|
this.$set(this.optionModel, 'defaultValue', null)
|
|
37
34
|
}
|
|
38
35
|
this.emitDefaultValueChange()
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<el-form-item label="最小时间">
|
|
4
|
-
<el-
|
|
5
|
-
|
|
6
|
-
<el-radio-button label="now">当前时间</el-radio-button>
|
|
7
|
-
</el-radio-group>
|
|
8
|
-
<el-time-picker v-if="minTimeType !== 'now'" v-model="minTime"
|
|
4
|
+
<el-checkbox v-model="nowMinTime">当前时间</el-checkbox>
|
|
5
|
+
<el-time-picker v-if="!nowMinTime" v-model="minTime"
|
|
9
6
|
:format="optionModel.format" value-format="HH:mm:ss"
|
|
10
|
-
style="width: 100
|
|
7
|
+
style="width: 100%"
|
|
11
8
|
clearable placeholder="留空则不限制">
|
|
12
9
|
</el-time-picker>
|
|
13
10
|
</el-form-item>
|
|
@@ -28,13 +25,13 @@
|
|
|
28
25
|
},
|
|
29
26
|
computed: {
|
|
30
27
|
/* 老表单的options可能没有这些属性,统一用$set赋值,保证响应式 */
|
|
31
|
-
|
|
28
|
+
nowMinTime: {
|
|
32
29
|
get() {
|
|
33
|
-
return this.optionModel.minTimeType
|
|
30
|
+
return this.optionModel.minTimeType === 'now'
|
|
34
31
|
},
|
|
35
|
-
set(
|
|
36
|
-
this.$set(this.optionModel, 'minTimeType',
|
|
37
|
-
if (
|
|
32
|
+
set(checked) {
|
|
33
|
+
this.$set(this.optionModel, 'minTimeType', checked ? 'now' : '')
|
|
34
|
+
if (checked) {
|
|
38
35
|
this.$set(this.optionModel, 'minTime', null)
|
|
39
36
|
}
|
|
40
37
|
},
|
|
@@ -1733,6 +1733,7 @@ export const basicFields = [
|
|
|
1733
1733
|
labelAlign: "",
|
|
1734
1734
|
type: "date",
|
|
1735
1735
|
defaultValue: null,
|
|
1736
|
+
defaultValueType: "", //默认值类型:空为固定日期,now为当前时间
|
|
1736
1737
|
placeholder: "",
|
|
1737
1738
|
columnWidth: "200px",
|
|
1738
1739
|
size: "",
|
|
@@ -1749,6 +1750,7 @@ export const basicFields = [
|
|
|
1749
1750
|
limitStartField: null,
|
|
1750
1751
|
limitEndField: null,
|
|
1751
1752
|
minDate: null,
|
|
1753
|
+
minDateType: "", //最小日期类型:空为固定日期,now为当前时间
|
|
1752
1754
|
maxDate: null,
|
|
1753
1755
|
utcTransformEnabled: !1,
|
|
1754
1756
|
required: !1,
|
|
@@ -3892,13 +3892,11 @@ modules = {
|
|
|
3892
3892
|
}
|
|
3893
3893
|
if (transactional) {
|
|
3894
3894
|
let formRef = this.getFormRef();
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
: formRef?.reloadForm;
|
|
3899
|
-
if (typeof reloadMethod === "function") {
|
|
3895
|
+
// 整单刷新只能走宿主重挂载:就地 setFormData 会在表单已挂载时逐字段广播赋值,
|
|
3896
|
+
// 当场触发各字段 onChange(读到兄弟组件的旧值)并清空子表。
|
|
3897
|
+
if (typeof formRef?.reloadForm === "function") {
|
|
3900
3898
|
try {
|
|
3901
|
-
await
|
|
3899
|
+
await formRef.reloadForm();
|
|
3902
3900
|
} catch (error) {
|
|
3903
3901
|
let reloadError = error instanceof Error
|
|
3904
3902
|
? error
|
|
@@ -4071,17 +4069,13 @@ modules = {
|
|
|
4071
4069
|
}
|
|
4072
4070
|
this.treeSingleSavePending = true;
|
|
4073
4071
|
let keepSaveLocked = false;
|
|
4074
|
-
let reloadMethod
|
|
4075
|
-
= typeof formRef.reloadSavedFormData === "function"
|
|
4076
|
-
? formRef.reloadSavedFormData
|
|
4077
|
-
: formRef.reloadForm;
|
|
4078
4072
|
let installReloadRetry = () => {
|
|
4079
4073
|
let retryPromise = null;
|
|
4080
4074
|
this.treeSingleSaveReconcileTask = () => {
|
|
4081
4075
|
if (retryPromise) return retryPromise;
|
|
4082
4076
|
retryPromise = (async () => {
|
|
4083
4077
|
try {
|
|
4084
|
-
await
|
|
4078
|
+
await formRef.reloadForm();
|
|
4085
4079
|
delete obj.$table.editCloneRow;
|
|
4086
4080
|
this.treeSingleSaveReconcileTask = null;
|
|
4087
4081
|
this.treeSingleSavePending = false;
|
|
@@ -4489,29 +4489,11 @@ modules = {
|
|
|
4489
4489
|
return Promise.reject(error);
|
|
4490
4490
|
}
|
|
4491
4491
|
},
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
throw new Error("缺少保存后的数据 ID,无法重新加载表单。");
|
|
4498
|
-
}
|
|
4499
|
-
let response = await this.loadFormData({
|
|
4500
|
-
dataId: nextDataId,
|
|
4501
|
-
replace: true,
|
|
4502
|
-
});
|
|
4503
|
-
if (!response || response.type !== "success") {
|
|
4504
|
-
throw new Error(response?.content || "保存后的表单数据重新加载失败。");
|
|
4505
|
-
}
|
|
4506
|
-
if (nextDataId !== undefined && nextDataId !== null) {
|
|
4507
|
-
this.$emit("update:dataId", nextDataId);
|
|
4508
|
-
}
|
|
4509
|
-
if (nextFormCode) {
|
|
4510
|
-
this.$emit("update:formCode", nextFormCode);
|
|
4511
|
-
}
|
|
4512
|
-
await new Promise((resolve) => this.$nextTick(resolve));
|
|
4513
|
-
return response;
|
|
4514
|
-
},
|
|
4492
|
+
// 注:此处曾有 reloadSavedFormData(就地整单取数 + setFormData)。它在表单已挂载时
|
|
4493
|
+
// 逐字段广播赋值,每个字段的 onChange 当场同步执行,先赋值组件的脚本读到的是后赋值
|
|
4494
|
+
// 组件的旧值(getFieldValue 取的是对方尚未刷新的 fieldModel),公式与 keyName 联动
|
|
4495
|
+
// 乱序,getOne 不返回的子表/表头附件字段还会被清空。整单刷新一律走 reloadForm
|
|
4496
|
+
// (宿主 toggle v-if 重挂载),保持「先填满 formDataModel 再挂载组件」这个前提。
|
|
4515
4497
|
saveForm(callback) {
|
|
4516
4498
|
this.validateForm((valid) => {
|
|
4517
4499
|
if (!valid) return;
|
|
@@ -270,14 +270,37 @@ modules = {
|
|
|
270
270
|
if (editFormCode) {
|
|
271
271
|
updateParam.formCode = editFormCode;
|
|
272
272
|
}
|
|
273
|
-
let reloadMethod
|
|
274
|
-
= typeof formRef.reloadSavedFormData === "function"
|
|
275
|
-
? formRef.reloadSavedFormData
|
|
276
|
-
: formRef.reloadForm;
|
|
277
273
|
// 保存成功后一律让宿主整页重挂载(toggle v-if):新增/编辑都需要出流程信息、
|
|
278
|
-
//
|
|
274
|
+
// 切编辑模板、按新状态重算显隐与只读——这些就地取数做不到。
|
|
279
275
|
// 唯一例外是「保存并提交」路径(skipHostReloadAfterSave=true),
|
|
280
276
|
// 它的刷新交给流程结束后的 onWfStartSuccess / onWfStartAbort,避免刷两次。
|
|
277
|
+
//
|
|
278
|
+
// 刷新前只同步「元数据」,绝不做整单 setFormData:表单已挂载时那是逐字段同步
|
|
279
|
+
// 广播赋值,每个字段的 onChange 会当场执行,先赋值组件的脚本读到的是后赋值
|
|
280
|
+
// 组件的旧值,公式与 keyName 联动乱序,子表还会被整体清空(getOne 不返回子表)。
|
|
281
|
+
// 首屏之所以正确,靠的是「先填满 formDataModel 再挂载组件」,就地整单赋值破坏
|
|
282
|
+
// 了这个前提,故整单刷新只能走重挂载。
|
|
283
|
+
let syncSavedMeta = () => {
|
|
284
|
+
let nextDataId = updateParam.dataId;
|
|
285
|
+
if (
|
|
286
|
+
nextDataId !== undefined
|
|
287
|
+
&& nextDataId !== null
|
|
288
|
+
&& nextDataId !== ""
|
|
289
|
+
) {
|
|
290
|
+
// 提交报文的主表以 currentFormData 打底(见 form-render getSubData2),
|
|
291
|
+
// 主键 id 不是表单控件,只能在此回写;否则 skip 路径下再次保存会重复入库。
|
|
292
|
+
if (
|
|
293
|
+
formRef.currentFormData
|
|
294
|
+
&& formRef.currentFormData.id == null
|
|
295
|
+
) {
|
|
296
|
+
formRef.currentFormData.id = nextDataId;
|
|
297
|
+
}
|
|
298
|
+
formRef.$emit("update:dataId", nextDataId);
|
|
299
|
+
}
|
|
300
|
+
if (updateParam.formCode) {
|
|
301
|
+
formRef.$emit("update:formCode", updateParam.formCode);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
281
304
|
let runHostReload = async () => {
|
|
282
305
|
if (skipHostReloadAfterSave) return;
|
|
283
306
|
await formRef.reloadForm({ updateParam });
|
|
@@ -356,38 +379,7 @@ modules = {
|
|
|
356
379
|
};
|
|
357
380
|
showHostReloadFailure(false, error);
|
|
358
381
|
};
|
|
359
|
-
|
|
360
|
-
await reloadMethod.call(formRef, { updateParam });
|
|
361
|
-
} catch (error) {
|
|
362
|
-
keepSaveLocked = true;
|
|
363
|
-
let retryPromise = null;
|
|
364
|
-
formRef.formSaveReconcileTask = () => {
|
|
365
|
-
if (retryPromise) return retryPromise;
|
|
366
|
-
retryPromise = (async () => {
|
|
367
|
-
try {
|
|
368
|
-
await reloadMethod.call(formRef, { updateParam });
|
|
369
|
-
} catch (retryError) {
|
|
370
|
-
showHostReloadFailure(true, retryError);
|
|
371
|
-
retryPromise = null;
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
let result = await runPostReloadCallbacks();
|
|
375
|
-
try {
|
|
376
|
-
await runHostReload();
|
|
377
|
-
} catch (hostReloadError) {
|
|
378
|
-
installHostReloadRetry(hostReloadError);
|
|
379
|
-
return false;
|
|
380
|
-
}
|
|
381
|
-
clearReconcileState();
|
|
382
|
-
return result;
|
|
383
|
-
})();
|
|
384
|
-
return retryPromise;
|
|
385
|
-
};
|
|
386
|
-
showHostReloadFailure(false, error);
|
|
387
|
-
rejectOnce(error);
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
|
|
382
|
+
syncSavedMeta();
|
|
391
383
|
await runPostReloadCallbacks();
|
|
392
384
|
try {
|
|
393
385
|
await runHostReload();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
//bdadmin 7,dev_admin 6, 普通dev账号 8
|
|
2
2
|
|
|
3
|
+
import settings from "@/settings";
|
|
4
|
+
|
|
3
5
|
// 通用工程/分支工程/数据表管理:分组父节点不配 url,仅作侧边栏分组,叶子的 menuCode 与壳组件 name 一致
|
|
4
6
|
const bdProjectMenus = [
|
|
5
7
|
{
|
|
@@ -219,6 +221,13 @@ const bdProjectMenusForDev = bdProjectMenus.map((group) => ({
|
|
|
219
221
|
children: group.children.filter((item) => item.menuCode !== "bd_branch:list"),
|
|
220
222
|
}));
|
|
221
223
|
|
|
224
|
+
// 这几个分组默认不放出,需在应用自身的 settings.js 显式配置 bdProjectMenuEnabled: true
|
|
225
|
+
const bdProjectMenuEnabled = settings.bdProjectMenuEnabled === true;
|
|
226
|
+
const bdProjectMenuList = bdProjectMenuEnabled ? bdProjectMenus : [];
|
|
227
|
+
const bdProjectMenuListForDev = bdProjectMenuEnabled
|
|
228
|
+
? bdProjectMenusForDev
|
|
229
|
+
: [];
|
|
230
|
+
|
|
222
231
|
let modules = {};
|
|
223
232
|
modules = {
|
|
224
233
|
userFlagMenuMap: {
|
|
@@ -517,7 +526,7 @@ modules = {
|
|
|
517
526
|
grade: 2,
|
|
518
527
|
type: 0,
|
|
519
528
|
},
|
|
520
|
-
...
|
|
529
|
+
...bdProjectMenuList,
|
|
521
530
|
],
|
|
522
531
|
7: [
|
|
523
532
|
{
|
|
@@ -654,7 +663,7 @@ modules = {
|
|
|
654
663
|
grade: 2,
|
|
655
664
|
type: 0,
|
|
656
665
|
},
|
|
657
|
-
...
|
|
666
|
+
...bdProjectMenuList,
|
|
658
667
|
],
|
|
659
668
|
8: [
|
|
660
669
|
{
|
|
@@ -883,7 +892,7 @@ modules = {
|
|
|
883
892
|
grade: 2,
|
|
884
893
|
type: 0,
|
|
885
894
|
},
|
|
886
|
-
...
|
|
895
|
+
...bdProjectMenuListForDev,
|
|
887
896
|
],
|
|
888
897
|
},
|
|
889
898
|
};
|
|
@@ -2,24 +2,24 @@ import projectTagView from "@base/components/projectTag/view.vue";
|
|
|
2
2
|
import MenuKindDialog from "@base/views/bd/setting/menu_kind/dialog.vue";
|
|
3
3
|
import preformDialog from "@base/views/bd/setting/form_template/preformDialog.vue";
|
|
4
4
|
import formOplogTable from "@base/components/formOplog/index.vue";
|
|
5
|
-
import {getBdFlag} from "@base/api/user";
|
|
5
|
+
import { getBdFlag } from "@base/api/user";
|
|
6
6
|
import otherAuthDialog from "../otherAuthDialog.vue";
|
|
7
7
|
|
|
8
8
|
let modules = {};
|
|
9
9
|
modules = {
|
|
10
|
-
name:
|
|
10
|
+
name: "bd_form_templateEdit",
|
|
11
11
|
props: {
|
|
12
12
|
_dataId: [String, Number],
|
|
13
13
|
currentFormType: Object,
|
|
14
14
|
// readonly: Boolean,
|
|
15
|
-
otherFlag:Boolean,
|
|
15
|
+
otherFlag: Boolean,
|
|
16
16
|
extractedObj: {
|
|
17
|
-
type:Object,
|
|
18
|
-
default:()=> null
|
|
17
|
+
type: Object,
|
|
18
|
+
default: () => null,
|
|
19
19
|
},
|
|
20
|
-
hData:{
|
|
21
|
-
type:Object,
|
|
22
|
-
default:()=> null
|
|
20
|
+
hData: {
|
|
21
|
+
type: Object,
|
|
22
|
+
default: () => null,
|
|
23
23
|
},
|
|
24
24
|
compareHData: Object,
|
|
25
25
|
},
|
|
@@ -28,62 +28,63 @@ modules = {
|
|
|
28
28
|
MenuKindDialog,
|
|
29
29
|
preformDialog,
|
|
30
30
|
formOplogTable,
|
|
31
|
-
otherAuthDialog
|
|
31
|
+
otherAuthDialog,
|
|
32
32
|
},
|
|
33
33
|
data() {
|
|
34
34
|
return {
|
|
35
35
|
isEdit: false,
|
|
36
|
-
tabIndex:
|
|
37
|
-
dataId:
|
|
36
|
+
tabIndex: "first",
|
|
37
|
+
dataId: "",
|
|
38
38
|
formTemplate: {
|
|
39
39
|
enabled: true,
|
|
40
40
|
history: false,
|
|
41
|
-
serviceId:
|
|
41
|
+
serviceId: "user",
|
|
42
42
|
formTypeCode: null,
|
|
43
43
|
menuKindName: null,
|
|
44
44
|
menuKindCode: null,
|
|
45
45
|
serviceName: null,
|
|
46
46
|
formTemplateTagDTOs: [],
|
|
47
|
-
hasWf: false
|
|
47
|
+
hasWf: false,
|
|
48
48
|
},
|
|
49
49
|
oldFormTemplate: {
|
|
50
50
|
enabled: true,
|
|
51
51
|
history: false,
|
|
52
|
-
serviceId:
|
|
52
|
+
serviceId: "user",
|
|
53
53
|
formTypeCode: null,
|
|
54
54
|
menuKindName: null,
|
|
55
55
|
menuKindCode: null,
|
|
56
56
|
serviceName: null,
|
|
57
57
|
formTemplateTagDTOs: [],
|
|
58
|
-
hasWf: false
|
|
58
|
+
hasWf: false,
|
|
59
59
|
},
|
|
60
60
|
isInited: false,
|
|
61
|
-
serviceIds: [
|
|
61
|
+
serviceIds: ["user"],
|
|
62
62
|
showMenuKindDialog: false,
|
|
63
63
|
isDev: true,
|
|
64
64
|
showPreformDialog: false,
|
|
65
65
|
menuKindAuth: {
|
|
66
|
-
editAuth: 0
|
|
66
|
+
editAuth: 0,
|
|
67
67
|
},
|
|
68
68
|
sid: null,
|
|
69
|
-
showOtherAuthDialog:false,
|
|
69
|
+
showOtherAuthDialog: false,
|
|
70
70
|
readonly: false,
|
|
71
71
|
isCompare: false,
|
|
72
72
|
};
|
|
73
73
|
},
|
|
74
74
|
created() {
|
|
75
|
-
if(this.hData){
|
|
75
|
+
if (this.hData) {
|
|
76
76
|
this.readonly = true;
|
|
77
|
-
}else{
|
|
77
|
+
} else {
|
|
78
78
|
this.readonly = this.$attrs.readonly || false;
|
|
79
79
|
}
|
|
80
|
-
if(this.extractedObj?.objx?.id){
|
|
80
|
+
if (this.extractedObj?.objx?.id) {
|
|
81
81
|
this.dataId = this.extractedObj.obj.id;
|
|
82
|
-
}else if (this._dataId) {
|
|
82
|
+
} else if (this._dataId) {
|
|
83
83
|
this.dataId = this._dataId;
|
|
84
84
|
} else {
|
|
85
85
|
this.formTemplate.menuKindName = this.currentFormType?.name || null;
|
|
86
|
-
this.formTemplate.menuKindCode =
|
|
86
|
+
this.formTemplate.menuKindCode =
|
|
87
|
+
this.currentFormType?.menuKindCode || null;
|
|
87
88
|
this.formTemplate.serviceName = this.currentFormType?.serviceName || null;
|
|
88
89
|
}
|
|
89
90
|
},
|
|
@@ -92,7 +93,7 @@ modules = {
|
|
|
92
93
|
this.getData();
|
|
93
94
|
},
|
|
94
95
|
methods: {
|
|
95
|
-
initData(formData){
|
|
96
|
+
initData(formData) {
|
|
96
97
|
this.isEdit = true;
|
|
97
98
|
this.formTemplate = formData || {};
|
|
98
99
|
this.getMenuKindAuth(this.formTemplate.menuKindCode);
|
|
@@ -101,38 +102,38 @@ modules = {
|
|
|
101
102
|
});
|
|
102
103
|
},
|
|
103
104
|
getData() {
|
|
104
|
-
if(this.extractedObj){
|
|
105
|
+
if (this.extractedObj) {
|
|
105
106
|
this.dataId = this.extractedObj.id;
|
|
106
|
-
this.initData(this.extractedObj)
|
|
107
|
+
this.initData(this.extractedObj);
|
|
107
108
|
//获取操作日志数据
|
|
108
|
-
this.$refs[
|
|
109
|
+
this.$refs["oplogTable"].initData({
|
|
109
110
|
param: () => {
|
|
110
111
|
return {
|
|
111
112
|
logType: "FormTemplate",
|
|
112
|
-
logObjCode: this.formTemplate.formCode
|
|
113
|
+
logObjCode: this.formTemplate.formCode,
|
|
113
114
|
};
|
|
114
|
-
}
|
|
115
|
+
},
|
|
115
116
|
});
|
|
116
|
-
}else if (this.dataId) {
|
|
117
|
+
} else if (this.dataId) {
|
|
117
118
|
this.$commonHttp({
|
|
118
119
|
aes: true,
|
|
119
120
|
url: USER_PREFIX + `/formTemplate/get`,
|
|
120
121
|
method: `post`,
|
|
121
122
|
data: {
|
|
122
|
-
id: this.dataId
|
|
123
|
+
id: this.dataId,
|
|
123
124
|
},
|
|
124
125
|
isLoading: true,
|
|
125
126
|
modalStrictly: true,
|
|
126
|
-
success: res => {
|
|
127
|
-
this.initData(res.objx)
|
|
127
|
+
success: (res) => {
|
|
128
|
+
this.initData(res.objx);
|
|
128
129
|
//获取操作日志数据
|
|
129
|
-
this.$refs[
|
|
130
|
+
this.$refs["oplogTable"].initData({
|
|
130
131
|
param: () => {
|
|
131
132
|
return {
|
|
132
133
|
logType: "FormTemplate",
|
|
133
|
-
logObjCode: this.formTemplate.formCode
|
|
134
|
+
logObjCode: this.formTemplate.formCode,
|
|
134
135
|
};
|
|
135
|
-
}
|
|
136
|
+
},
|
|
136
137
|
});
|
|
137
138
|
/* this.formTemplate = res.objx || {};
|
|
138
139
|
this.getMenuKindAuth(this.formTemplate.menuKindCode);
|
|
@@ -148,12 +149,12 @@ modules = {
|
|
|
148
149
|
};
|
|
149
150
|
}
|
|
150
151
|
}); */
|
|
151
|
-
}
|
|
152
|
+
},
|
|
152
153
|
});
|
|
153
|
-
} else if (this.hData){
|
|
154
|
+
} else if (this.hData) {
|
|
154
155
|
this.isEdit = true;
|
|
155
156
|
this.formTemplate = this.$baseLodash.cloneDeep(this.hData);
|
|
156
|
-
this.dataId = this.hData.id
|
|
157
|
+
this.dataId = this.hData.id;
|
|
157
158
|
this.isInited = true;
|
|
158
159
|
this.getMenuKindAuth(this.formTemplate.menuKindCode);
|
|
159
160
|
if (this.compareHData && this.$attrs.isCompare) {
|
|
@@ -166,17 +167,19 @@ modules = {
|
|
|
166
167
|
}
|
|
167
168
|
},
|
|
168
169
|
saveData() {
|
|
169
|
-
this.$refs.editForm.$baseValidate(valid => {
|
|
170
|
+
this.$refs.editForm.$baseValidate((valid) => {
|
|
170
171
|
if (valid) {
|
|
171
172
|
this.openPreformDialog();
|
|
172
173
|
}
|
|
173
174
|
});
|
|
174
175
|
},
|
|
175
176
|
saveDataHandle(preformData) {
|
|
176
|
-
var url =
|
|
177
|
+
var url =
|
|
178
|
+
USER_PREFIX +
|
|
179
|
+
(this.isEdit ? `/formTemplate/update` : `/formTemplate/save`);
|
|
177
180
|
let formData = {
|
|
178
181
|
...this.formTemplate,
|
|
179
|
-
logContent: preformData.logContent
|
|
182
|
+
logContent: preformData.logContent,
|
|
180
183
|
};
|
|
181
184
|
this.$http({
|
|
182
185
|
aes: true,
|
|
@@ -184,24 +187,24 @@ modules = {
|
|
|
184
187
|
method: `post`,
|
|
185
188
|
data: formData,
|
|
186
189
|
isLoading: true,
|
|
187
|
-
success: res => {
|
|
190
|
+
success: (res) => {
|
|
188
191
|
this.$message({
|
|
189
192
|
message: res.content,
|
|
190
|
-
type:
|
|
193
|
+
type: "success",
|
|
191
194
|
duration: 500,
|
|
192
|
-
onClose: t => {
|
|
195
|
+
onClose: (t) => {
|
|
193
196
|
if (this.isEdit) {
|
|
194
197
|
this.$baseReload();
|
|
195
198
|
} else {
|
|
196
199
|
this.$baseReload({
|
|
197
200
|
updateParam: {
|
|
198
|
-
_dataId: res.objx || this.formTemplate.id
|
|
199
|
-
}
|
|
201
|
+
_dataId: res.objx.id || this.formTemplate.id,
|
|
202
|
+
},
|
|
200
203
|
});
|
|
201
204
|
}
|
|
202
|
-
}
|
|
205
|
+
},
|
|
203
206
|
});
|
|
204
|
-
}
|
|
207
|
+
},
|
|
205
208
|
});
|
|
206
209
|
},
|
|
207
210
|
openPreformDialog() {
|
|
@@ -213,40 +216,40 @@ modules = {
|
|
|
213
216
|
confirmInsertMenuKind(rows) {
|
|
214
217
|
if (rows.length > 0) {
|
|
215
218
|
let row = rows[0];
|
|
216
|
-
this.$set(this.formTemplate,
|
|
217
|
-
this.$set(this.formTemplate,
|
|
219
|
+
this.$set(this.formTemplate, "menuKindCode", row.menuKindCode);
|
|
220
|
+
this.$set(this.formTemplate, "menuKindName", row.name);
|
|
218
221
|
}
|
|
219
222
|
},
|
|
220
223
|
getBdEnv() {
|
|
221
224
|
getBdFlag({
|
|
222
|
-
success: res => {
|
|
223
|
-
this.isDev = res.objx === 1
|
|
224
|
-
}
|
|
225
|
+
success: (res) => {
|
|
226
|
+
this.isDev = res.objx === 1;
|
|
227
|
+
},
|
|
225
228
|
});
|
|
226
229
|
},
|
|
227
230
|
openDesignDialog() {
|
|
228
|
-
let readonly = this.readonly || !this.menuKindAuth.editAuth
|
|
229
|
-
this.$emit(
|
|
231
|
+
let readonly = this.readonly || !this.menuKindAuth.editAuth;
|
|
232
|
+
this.$emit("openDesignDialog", {
|
|
230
233
|
row: this.formTemplate,
|
|
231
234
|
readonly,
|
|
232
235
|
callback: () => {
|
|
233
|
-
this.$baseReload()
|
|
234
|
-
}
|
|
235
|
-
})
|
|
236
|
+
this.$baseReload();
|
|
237
|
+
},
|
|
238
|
+
});
|
|
236
239
|
},
|
|
237
240
|
getMenuKindAuth(menuKindCode) {
|
|
238
|
-
if(this.otherFlag){
|
|
241
|
+
if (this.otherFlag) {
|
|
239
242
|
this.getOtherMenuKindAuth();
|
|
240
|
-
}else if (menuKindCode) {
|
|
243
|
+
} else if (menuKindCode) {
|
|
241
244
|
this.$http({
|
|
242
245
|
// aes: true,
|
|
243
|
-
url: USER_PREFIX +
|
|
246
|
+
url: USER_PREFIX + "/menu_kind_auth/getAuth",
|
|
244
247
|
method: `post`,
|
|
245
|
-
data: {stringOne: menuKindCode},
|
|
248
|
+
data: { stringOne: menuKindCode },
|
|
246
249
|
isLoading: true,
|
|
247
|
-
success: res => {
|
|
248
|
-
this.menuKindAuth = res.objx || {}
|
|
249
|
-
}
|
|
250
|
+
success: (res) => {
|
|
251
|
+
this.menuKindAuth = res.objx || {};
|
|
252
|
+
},
|
|
250
253
|
});
|
|
251
254
|
}
|
|
252
255
|
},
|
|
@@ -257,7 +260,7 @@ modules = {
|
|
|
257
260
|
aes: true,
|
|
258
261
|
url: USER_PREFIX + "/form_template_auth/getAuth",
|
|
259
262
|
method: `post`,
|
|
260
|
-
data: {stringOne: this.formTemplate.sid},
|
|
263
|
+
data: { stringOne: this.formTemplate.sid },
|
|
261
264
|
isLoading: true,
|
|
262
265
|
success: (res) => {
|
|
263
266
|
this.menuKindAuth = res.objx || {};
|
|
@@ -265,13 +268,13 @@ modules = {
|
|
|
265
268
|
});
|
|
266
269
|
}
|
|
267
270
|
},
|
|
268
|
-
openOtherAuthDialog(){
|
|
269
|
-
this.sid = this.formTemplate.sid
|
|
270
|
-
this.showOtherAuthDialog = true
|
|
271
|
+
openOtherAuthDialog() {
|
|
272
|
+
this.sid = this.formTemplate.sid;
|
|
273
|
+
this.showOtherAuthDialog = true;
|
|
271
274
|
},
|
|
272
|
-
confirmOtherAuthDialog(){
|
|
273
|
-
this.$baseReload()
|
|
275
|
+
confirmOtherAuthDialog() {
|
|
276
|
+
this.$baseReload();
|
|
274
277
|
},
|
|
275
|
-
}
|
|
278
|
+
},
|
|
276
279
|
};
|
|
277
|
-
export default modules
|
|
280
|
+
export default modules;
|