lw-cdp-ui 1.2.4 → 1.2.5

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.
@@ -304,6 +304,31 @@
304
304
  </template>
305
305
 
306
306
  </div>
307
+
308
+ <div class="form-title">表单校验</div>
309
+ <div class="form-body">
310
+ <el-form-item label="输入校验">
311
+ <el-input v-model="item.rules"
312
+ placeholder="请输入"
313
+ clearable />
314
+ </el-form-item>
315
+ <el-form-item label="隐藏校验">
316
+ <el-input v-model="item.hideHandle"
317
+ placeholder="请输入"
318
+ clearable />
319
+ </el-form-item>
320
+ <el-form-item label="标题位置">
321
+ <el-select v-model="item.labelPosition"
322
+ placeholder="请选择">
323
+ <el-option label="顶部"
324
+ value="top" />
325
+ <el-option label="左"
326
+ value="left" />
327
+ <el-option label="右"
328
+ value="right" />
329
+ </el-select>
330
+ </el-form-item>
331
+ </div>
307
332
  </template>
308
333
  <template v-else>
309
334
  <div class="form-title">表单样式</div>
@@ -336,7 +361,17 @@ export default {
336
361
  data() {
337
362
  return {
338
363
  tagVisible: {},
339
- tagValue: ''
364
+ tagValue: '',
365
+ rules: [
366
+ {
367
+ label: '必填',
368
+ value: { required: true, message: '请输入', trigger: 'blur' }
369
+ },
370
+ {
371
+ label: '必选',
372
+ value: { required: true, message: '请选择', trigger: 'change' }
373
+ },
374
+ ]
340
375
  }
341
376
  },
342
377
  props: {
@@ -108,7 +108,7 @@ export default {
108
108
  * ...
109
109
  * }
110
110
  * **/
111
- config: { type: Object, default: () => { } },
111
+ config: { type: Object, default: () => { return {} } },
112
112
  // 自定义组件
113
113
  custom: { type: Array, default: () => [] },
114
114
  // 是否显示加载中
@@ -146,12 +146,6 @@ export default {
146
146
  },
147
147
  deep: true
148
148
  },
149
- // form: {
150
- // handler(val) {
151
- // this.$emit("update:modelValue", val)
152
- // },
153
- // deep: true
154
- // },
155
149
  localConfig: {
156
150
  handler(val) {
157
151
  this.render(val)
@@ -240,13 +234,15 @@ export default {
240
234
  }
241
235
 
242
236
  let form = parse(config.formItems, this.modelValue);
243
- this.form = {
237
+ form = {
244
238
  ...this.modelValue,
245
239
  ...form
246
240
  }
241
+ this.form = this.parseNestedObject(form)
242
+ this.$emit("update:modelValue", this.form);
243
+ this.localConfig = config;
244
+
247
245
 
248
- this.$emit("update:modelValue", this.parseNestedObject(this.form));
249
- this.localConfig = this.config;
250
246
  },
251
247
  parseNestedObject(obj) {
252
248
  const result = {};
@@ -261,7 +257,10 @@ export default {
261
257
  current = current[k];
262
258
  });
263
259
 
264
- delete obj[key]
260
+ if (keys.length > 1) {
261
+ delete obj[key]
262
+ }
263
+
265
264
  }
266
265
  return result;
267
266
  },
@@ -306,6 +305,9 @@ export default {
306
305
 
307
306
  <style lang="scss" scoped>
308
307
  .menu-list {
308
+ :deep(.el-collapse){
309
+ border-top: 0;
310
+ }
309
311
  .menu-list-title {
310
312
  :deep(.el-collapse-item__header) {
311
313
  font-weight: bold;
@@ -207,14 +207,13 @@ export default {
207
207
  }
208
208
 
209
209
  let form = parse(config.formItems, this.modelValue);
210
-
211
- this.form = {
210
+ form = {
212
211
  ...this.modelValue,
213
212
  ...form
214
213
  }
215
-
216
- this.$emit("update:modelValue", this.parseNestedObject(this.form));
217
- this.localConfig = this.config;
214
+ this.form = this.parseNestedObject(form)
215
+ this.$emit("update:modelValue", this.form);
216
+ this.localConfig = config;
218
217
  },
219
218
 
220
219
  parseNestedObject(obj) {
@@ -31,6 +31,18 @@
31
31
  :sortable="t.sortable"
32
32
  :show-overflow-tooltip="t.tooltip"
33
33
  :key="t">
34
+ <template #header="{ column, $index }">
35
+ <template v-if="!t?.header">
36
+ {{ t.title }}
37
+ </template>
38
+ <slot v-else
39
+ :name="t.header"
40
+ :scope="{column, $index, t}">
41
+ <el-tag type="danger">
42
+ [{{ item.header }}]没有这个自定义表头
43
+ </el-tag>
44
+ </slot>
45
+ </template>
34
46
  <template #default="scope">
35
47
  <!-- 操作 -->
36
48
  <template v-if="t?.operation">