lw-cdp-ui 1.2.2 → 1.2.3
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.
|
@@ -146,12 +146,12 @@ export default {
|
|
|
146
146
|
},
|
|
147
147
|
deep: true
|
|
148
148
|
},
|
|
149
|
-
form: {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
},
|
|
149
|
+
// form: {
|
|
150
|
+
// handler(val) {
|
|
151
|
+
// this.$emit("update:modelValue", val)
|
|
152
|
+
// },
|
|
153
|
+
// deep: true
|
|
154
|
+
// },
|
|
155
155
|
localConfig: {
|
|
156
156
|
handler(val) {
|
|
157
157
|
this.render(val)
|
|
@@ -239,10 +239,32 @@ export default {
|
|
|
239
239
|
return result;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
this
|
|
242
|
+
let form = parse(config.formItems, this.modelValue);
|
|
243
|
+
this.form = {
|
|
244
|
+
...this.modelValue,
|
|
245
|
+
...form
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
this.$emit("update:modelValue", this.parseNestedObject(this.form));
|
|
244
249
|
this.localConfig = this.config;
|
|
245
250
|
},
|
|
251
|
+
parseNestedObject(obj) {
|
|
252
|
+
const result = {};
|
|
253
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
254
|
+
const keys = key.split('.');
|
|
255
|
+
let current = result;
|
|
256
|
+
|
|
257
|
+
keys.forEach((k, index) => {
|
|
258
|
+
if (!current[k]) {
|
|
259
|
+
current[k] = index === keys.length - 1 ? value : {};
|
|
260
|
+
}
|
|
261
|
+
current = current[k];
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
delete obj[key]
|
|
265
|
+
}
|
|
266
|
+
return result;
|
|
267
|
+
},
|
|
246
268
|
|
|
247
269
|
//数据验证
|
|
248
270
|
validate(valid, obj) {
|
|
@@ -268,10 +268,10 @@ export default {
|
|
|
268
268
|
handler(val) {
|
|
269
269
|
if (val.component === 'checkbox' || val.component === 'upload') {
|
|
270
270
|
val.options?.items?.forEach((option) => {
|
|
271
|
-
this.unflattenObject(this.form, option.name, option
|
|
271
|
+
this.unflattenObject(this.form, option.name, option.value)
|
|
272
272
|
});
|
|
273
273
|
} else {
|
|
274
|
-
this.unflattenObject(this.form, this.item.name, val
|
|
274
|
+
this.unflattenObject(this.form, this.item.name, val.value)
|
|
275
275
|
}
|
|
276
276
|
},
|
|
277
277
|
deep: true
|
|
@@ -281,6 +281,7 @@ export default {
|
|
|
281
281
|
flattenObject(obj, key, defaultValue = '') {
|
|
282
282
|
if (!key || !obj) { return false }
|
|
283
283
|
const keys = key.split('.'); // 将路径拆分成数组
|
|
284
|
+
|
|
284
285
|
let current = obj;
|
|
285
286
|
// 遍历路径并逐层查找
|
|
286
287
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -291,7 +292,7 @@ export default {
|
|
|
291
292
|
// 否则,继续向下查找
|
|
292
293
|
current = current[keys[i]];
|
|
293
294
|
}
|
|
294
|
-
|
|
295
|
+
|
|
295
296
|
return current;
|
|
296
297
|
},
|
|
297
298
|
unflattenObject(obj, path, value) {
|
|
@@ -310,6 +311,8 @@ export default {
|
|
|
310
311
|
current = current[key]; // 进入下一层
|
|
311
312
|
}
|
|
312
313
|
});
|
|
314
|
+
|
|
315
|
+
|
|
313
316
|
},
|
|
314
317
|
// 删除tag
|
|
315
318
|
tagClose(tag, item) {
|
|
@@ -437,11 +440,11 @@ export default {
|
|
|
437
440
|
}
|
|
438
441
|
}
|
|
439
442
|
|
|
440
|
-
:deep(.el-tag){
|
|
441
|
-
|
|
443
|
+
:deep(.el-tag) {
|
|
444
|
+
& + .button-new-tag {
|
|
442
445
|
margin-left: 10px;
|
|
443
446
|
}
|
|
444
|
-
|
|
447
|
+
& + .w-20 {
|
|
445
448
|
margin-left: 10px;
|
|
446
449
|
}
|
|
447
450
|
}
|
|
@@ -135,20 +135,12 @@ export default {
|
|
|
135
135
|
})
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
|
-
immediate: true,
|
|
139
|
-
deep: true
|
|
140
|
-
},
|
|
141
|
-
form: {
|
|
142
|
-
handler(val) {
|
|
143
|
-
this.$emit("update:modelValue", val)
|
|
144
|
-
},
|
|
145
138
|
deep: true
|
|
146
139
|
},
|
|
147
140
|
localConfig: {
|
|
148
141
|
handler(val) {
|
|
149
142
|
this.render(val)
|
|
150
143
|
this.$emit("update:config", val)
|
|
151
|
-
|
|
152
144
|
},
|
|
153
145
|
deep: true
|
|
154
146
|
},
|
|
@@ -206,6 +198,7 @@ export default {
|
|
|
206
198
|
result[item.name] = existingValue ?? (item.value !== undefined ? Number(item.value) : item.options?.min || 0);
|
|
207
199
|
} else {
|
|
208
200
|
result[item.name] = existingValue ?? item.value;
|
|
201
|
+
|
|
209
202
|
}
|
|
210
203
|
}
|
|
211
204
|
});
|
|
@@ -213,10 +206,35 @@ export default {
|
|
|
213
206
|
return result;
|
|
214
207
|
}
|
|
215
208
|
|
|
216
|
-
|
|
217
|
-
|
|
209
|
+
let form = parse(config.formItems, this.modelValue);
|
|
210
|
+
|
|
211
|
+
this.form = {
|
|
212
|
+
...this.modelValue,
|
|
213
|
+
...form
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
this.$emit("update:modelValue", this.parseNestedObject(this.form));
|
|
218
217
|
this.localConfig = this.config;
|
|
219
218
|
},
|
|
219
|
+
|
|
220
|
+
parseNestedObject(obj) {
|
|
221
|
+
const result = {};
|
|
222
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
223
|
+
const keys = key.split('.');
|
|
224
|
+
let current = result;
|
|
225
|
+
|
|
226
|
+
keys.forEach((k, index) => {
|
|
227
|
+
if (!current[k]) {
|
|
228
|
+
current[k] = index === keys.length - 1 ? value : {};
|
|
229
|
+
}
|
|
230
|
+
current = current[k];
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
delete obj[key]
|
|
234
|
+
}
|
|
235
|
+
return result;
|
|
236
|
+
},
|
|
237
|
+
|
|
220
238
|
//处理动态隐藏
|
|
221
239
|
hideHandle(item) {
|
|
222
240
|
if (typeof item?.hideHandle === 'string') {
|