cloud-web-corejs 1.0.54-dev.728 → 1.0.54-dev.729
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
package/src/components/xform/form-designer/form-widget/field-widget/baseAttachment-widget.vue
CHANGED
|
@@ -153,8 +153,20 @@ export default {
|
|
|
153
153
|
},
|
|
154
154
|
setValue(val) {
|
|
155
155
|
let data = val || []
|
|
156
|
+
// 按 tableParam 决定落点:行内附件写回当前行对象,主表写回表单模型。
|
|
157
|
+
// 旧实现固定写 getFormRef().formDataModel(顶层),行内附件会写错位置并丢失联动,
|
|
158
|
+
// 且多行会互相覆盖同一个顶层字段。
|
|
159
|
+
let currentData = this.tableParam && this.tableParam.row
|
|
160
|
+
? this.tableParam.row
|
|
161
|
+
: this.formModel;
|
|
162
|
+
if (currentData[this.fieldKeyName] === undefined) {
|
|
163
|
+
this.$set(currentData, this.fieldKeyName, [])
|
|
164
|
+
}
|
|
165
|
+
// 赋值 fieldModel 会触发 watch.fieldModel -> handleChangeEvent(内部再走
|
|
166
|
+
// syncUpdateFormModel + emitFieldDataChange,异步一次)。这里再同步写一次模型,
|
|
167
|
+
// 保证 setValue 返回后立即可读到最新值,且落点与 watcher 一致,不会重复触发变更事件。
|
|
156
168
|
this.fieldModel = data;
|
|
157
|
-
this.
|
|
169
|
+
this.syncUpdateFormModel(data);
|
|
158
170
|
},
|
|
159
171
|
loadDataDefaultHandle() {
|
|
160
172
|
let dataId = this.formDataId;
|
|
@@ -726,9 +726,17 @@ modules = {
|
|
|
726
726
|
unregisterFromRefList: function () {
|
|
727
727
|
if (null !== this.refList && this.field.options.name) {
|
|
728
728
|
let e = this.field.options.name;
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
729
|
+
// 注销 key 必须与 registerToRefList 对齐:行内组件用 name + "_" + row._X_ROW_KEY,
|
|
730
|
+
// 否则行组件销毁时删不掉引用,widgetRefList 里会残留指向旧行的“幽灵”组件,
|
|
731
|
+
// 导致数组必填等校验读到旧空行而误报。
|
|
732
|
+
let key =
|
|
733
|
+
this.tableParam && !this.designState
|
|
734
|
+
? e + "_" + this.tableParam.row._X_ROW_KEY
|
|
735
|
+
: e;
|
|
736
|
+
// 仅当该 key 仍指向当前实例时才删除,避免同 key 重建时误删新注册的实例。
|
|
737
|
+
if (this.refList[key] === this) {
|
|
738
|
+
delete this.refList[key];
|
|
739
|
+
}
|
|
732
740
|
}
|
|
733
741
|
},
|
|
734
742
|
initOptionItemsHandle() {
|
|
@@ -3116,6 +3116,28 @@ modules = {
|
|
|
3116
3116
|
});
|
|
3117
3117
|
return error;
|
|
3118
3118
|
},
|
|
3119
|
+
/**
|
|
3120
|
+
* 判断某个组件引用是否为“幽灵”行组件:其 tableParam.row 已不在任何表格数据数组中。
|
|
3121
|
+
* 依据当前渲染的行组件持有的 row 一定与 formModel 中的行对象同引用;行被重建替换后,
|
|
3122
|
+
* 旧组件持有的 row 在所有数组里都找不到。非行内组件恒返回 false(走正常校验)。
|
|
3123
|
+
* @param {Object} ref 组件引用。@returns {Boolean}
|
|
3124
|
+
*/
|
|
3125
|
+
isDetachedRowWidget(ref) {
|
|
3126
|
+
const tableParam = ref && ref.tableParam;
|
|
3127
|
+
if (!tableParam || !tableParam.row) {
|
|
3128
|
+
return false;
|
|
3129
|
+
}
|
|
3130
|
+
const row = tableParam.row;
|
|
3131
|
+
const model = this.formModel || {};
|
|
3132
|
+
const keys = Object.keys(model);
|
|
3133
|
+
for (let i = 0; i < keys.length; i++) {
|
|
3134
|
+
const arr = model[keys[i]];
|
|
3135
|
+
if (Array.isArray(arr) && arr.indexOf(row) !== -1) {
|
|
3136
|
+
return false;
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
return true;
|
|
3140
|
+
},
|
|
3119
3141
|
validateArrayValueFieldsRequired() {
|
|
3120
3142
|
let error = null;
|
|
3121
3143
|
const refList = this.widgetRefList || {};
|
|
@@ -3139,6 +3161,11 @@ modules = {
|
|
|
3139
3161
|
if (!isArrayValueWidgetType(field.type, field.options)) {
|
|
3140
3162
|
return;
|
|
3141
3163
|
}
|
|
3164
|
+
// 兜底:跳过已从表格数据中移除的“幽灵”行组件引用(正常情况下已由
|
|
3165
|
+
// fieldMixin.unregisterFromRefList 的 key 对齐修复摘除,这里防残留误伤校验)。
|
|
3166
|
+
if (this.isDetachedRowWidget(ref)) {
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3142
3169
|
const actualValue =
|
|
3143
3170
|
typeof ref.getCurrentValue === "function"
|
|
3144
3171
|
? ref.getCurrentValue()
|
|
@@ -3618,7 +3645,12 @@ modules = {
|
|
|
3618
3645
|
currentName !== "first" &&
|
|
3619
3646
|
currentName !== "second" &&
|
|
3620
3647
|
!/^otherTab/.test(currentName);
|
|
3621
|
-
if (
|
|
3648
|
+
if (
|
|
3649
|
+
listFormConfig &&
|
|
3650
|
+
listFormConfig.multiTabEnabled &&
|
|
3651
|
+
xTabs &&
|
|
3652
|
+
isDynamicTab
|
|
3653
|
+
) {
|
|
3622
3654
|
return {
|
|
3623
3655
|
xTabs,
|
|
3624
3656
|
currentName,
|