t20-common-lib 0.15.18 → 0.15.19

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,6 +1,6 @@
1
1
  {
2
2
  "name": "t20-common-lib",
3
- "version": "0.15.18",
3
+ "version": "0.15.19",
4
4
  "description": "T20",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -217,15 +217,10 @@ export default {
217
217
  deep: true,
218
218
  handler() {
219
219
  if (this.isApplyingLinkage) return
220
+ // 编辑场景下 value 可能由页面先行组装,等模板就绪后仅补齐缺失字段,不覆盖已传数据。
221
+ if (!this.formGroups.length) return
220
222
  this.ensureFormDataShape()
221
223
  }
222
- },
223
- formData: {
224
- deep: true,
225
- handler() {
226
- if (this.isApplyingLinkage) return
227
- this.applyFieldStates()
228
- }
229
224
  }
230
225
  },
231
226
  methods: {
@@ -355,14 +350,11 @@ export default {
355
350
  },
356
351
  setFieldValue(groupProp, fieldProp, value) {
357
352
  const sourceFormData = this.formData && typeof this.formData === 'object' ? this.formData : {}
358
- const groupData = {
359
- ...(sourceFormData[groupProp] || {})
360
- }
361
- groupData[fieldProp] = value
362
- this.formData = {
363
- ...sourceFormData,
364
- [groupProp]: groupData
353
+ if (!sourceFormData[groupProp] || typeof sourceFormData[groupProp] !== 'object' || Array.isArray(sourceFormData[groupProp])) {
354
+ this.$set(sourceFormData, groupProp, {})
365
355
  }
356
+ this.$set(sourceFormData[groupProp], fieldProp, value)
357
+ this.$emit('input', sourceFormData)
366
358
  },
367
359
  /**
368
360
  * 场景4:与 value 配套的展示字段(模板里的 nameProp),用于下拉等回显名称。