tianheng-ui 0.1.9 → 0.1.11

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.
Files changed (58) hide show
  1. package/lib/theme-chalk/styles/reset.scss +0 -2
  2. package/lib/tianheng-ui.js +14 -14
  3. package/package.json +1 -1
  4. package/packages/FormMaking/GenerateForm.vue +10 -10
  5. package/packages/FormMaking/GenerateFormItem.vue +66 -578
  6. package/packages/FormMaking/GenerateFormItemH5.vue +5 -5
  7. package/packages/FormMaking/Upload/index.vue +0 -1
  8. package/packages/FormMaking/WidgetConfig.vue +66 -30
  9. package/packages/FormMaking/WidgetForm.vue +7 -48
  10. package/packages/FormMaking/WidgetFormItem.vue +41 -65
  11. package/packages/FormMaking/WidgetSelect.vue +160 -0
  12. package/packages/FormMaking/custom/config.js +98 -63
  13. package/packages/FormMaking/custom/configs/grid.vue +4 -4
  14. package/packages/FormMaking/custom/configs/input.vue +135 -28
  15. package/packages/FormMaking/custom/configs/number.vue +2 -2
  16. package/packages/FormMaking/custom/configs/table.vue +2 -2
  17. package/packages/FormMaking/custom/configs/{table_h5.vue → tableH5.vue} +2 -2
  18. package/packages/FormMaking/custom/configs/tabs.vue +6 -6
  19. package/packages/FormMaking/custom/configs/textarea.vue +121 -19
  20. package/packages/FormMaking/custom/index.js +2 -4
  21. package/packages/FormMaking/custom/items/alliance.vue +30 -29
  22. package/packages/FormMaking/custom/items/blank_pro.vue +14 -0
  23. package/packages/FormMaking/custom/items/button.vue +1 -0
  24. package/packages/FormMaking/custom/items/cascader.vue +6 -2
  25. package/packages/FormMaking/custom/items/cell.vue +0 -2
  26. package/packages/FormMaking/custom/items/checkbox.vue +17 -7
  27. package/packages/FormMaking/custom/items/color.vue +1 -1
  28. package/packages/FormMaking/custom/items/date.vue +1 -1
  29. package/packages/FormMaking/custom/items/editor.vue +1 -1
  30. package/packages/FormMaking/custom/items/{grid.vue → grid_dev.vue} +16 -47
  31. package/packages/FormMaking/custom/items/grid_pro.vue +45 -0
  32. package/packages/FormMaking/custom/items/image.vue +0 -28
  33. package/packages/FormMaking/custom/items/input.vue +15 -9
  34. package/packages/FormMaking/custom/items/number.vue +4 -4
  35. package/packages/FormMaking/custom/items/radio.vue +17 -7
  36. package/packages/FormMaking/custom/items/rate.vue +1 -1
  37. package/packages/FormMaking/custom/items/select.vue +12 -6
  38. package/packages/FormMaking/custom/items/slider.vue +1 -1
  39. package/packages/FormMaking/custom/items/switch.vue +1 -1
  40. package/packages/FormMaking/custom/items/{table_h5.vue → tableH5_dev.vue} +44 -49
  41. package/packages/FormMaking/custom/items/tableH5_pro.vue +113 -0
  42. package/packages/FormMaking/custom/items/{table.vue → table_dev.vue} +21 -41
  43. package/packages/FormMaking/custom/items/table_pro.vue +114 -0
  44. package/packages/FormMaking/custom/items/tabs_dev.vue +101 -0
  45. package/packages/FormMaking/custom/items/tabs_pro.vue +50 -0
  46. package/packages/FormMaking/custom/items/text.vue +1 -1
  47. package/packages/FormMaking/custom/items/textarea.vue +4 -13
  48. package/packages/FormMaking/custom/items/time.vue +3 -3
  49. package/packages/FormMaking/custom/items/upload.vue +15 -14
  50. package/packages/FormMaking/custom/mixins/index.js +23 -1
  51. package/packages/FormMaking/custom/register.js +22 -11
  52. package/packages/FormMaking/index.vue +11 -7
  53. package/packages/FormMaking/styles/index.scss +235 -221
  54. package/packages/FormMaking/util/generateCode.js +3 -3
  55. package/packages/FormMaking/util/index.js +33 -23
  56. package/packages/TableMaking/generateTable.vue +2 -2
  57. package/packages/FormMaking/custom/items/tabs.vue +0 -145
  58. /package/packages/FormMaking/custom/items/{blank.vue → blank_dev.vue} +0 -0
@@ -92,7 +92,7 @@
92
92
  <el-radio-group v-model="widget.options.defaultValue">
93
93
  <draggable
94
94
  tag="ul"
95
- :list="widget.tabs"
95
+ :list="widget.options.columns"
96
96
  v-bind="{
97
97
  group: { name: 'tabs' },
98
98
  ghostClass: 'ghost',
@@ -100,7 +100,7 @@
100
100
  }"
101
101
  handle=".drag-item"
102
102
  >
103
- <li v-for="(item, index) in widget.tabs" :key="index">
103
+ <li v-for="(item, index) in widget.options.columns" :key="index">
104
104
  <el-radio :label="item.value" style="margin-right: 5px;">
105
105
  <el-input
106
106
  v-model="item.value"
@@ -159,12 +159,12 @@ export default {
159
159
  mounted() {},
160
160
  methods: {
161
161
  handleOptionsRemove(index) {
162
- this.widget.tabs.splice(index, 1);
162
+ this.widget.options.columns.splice(index, 1);
163
163
  },
164
164
  handleAddOption() {
165
- this.widget.tabs.push({
166
- label: `选项${this.widget.tabs.length + 1}`,
167
- value: `tab${this.widget.tabs.length + 1}`,
165
+ this.widget.options.columns.push({
166
+ label: `选项${this.widget.options.columns.length + 1}`,
167
+ value: `tab${this.widget.options.columns.length + 1}`,
168
168
  list: []
169
169
  });
170
170
  }
@@ -81,27 +81,54 @@
81
81
  </el-form-item>
82
82
 
83
83
  <el-form-item label="校验">
84
- <el-checkbox v-model="widget.options.required">必填</el-checkbox>
85
- <el-select style="width:100%" v-model="widget.options.dataType">
86
- <el-option value="string" label="字符串"></el-option>
87
- <el-option value="number" label="数字"></el-option>
88
- <el-option value="boolean" label="布尔值"></el-option>
89
- <el-option value="integer" label="整数"></el-option>
90
- <el-option value="float" label="浮点数"></el-option>
91
- <el-option value="url" label="URL地址"></el-option>
92
- <el-option value="email" label="邮箱地址"></el-option>
93
- <el-option value="hex" label="十六进制"></el-option>
94
- </el-select>
84
+ <div class="flexView">
85
+ <el-checkbox v-model="widget.options.required">必填</el-checkbox>
86
+ <el-select
87
+ style="flex: 1;margin-left:10px;"
88
+ v-model="widget.options.dataType"
89
+ @change="handleInputTypeChange"
90
+ >
91
+ <el-option
92
+ v-for="rule in Object.values(rulesOptions)"
93
+ :key="rule.value"
94
+ :value="rule.value"
95
+ :label="rule.label"
96
+ ></el-option>
97
+ </el-select>
98
+ </div>
95
99
 
96
- <el-input
97
- class="config-pattern-input"
98
- style=" width: 100%;"
99
- v-model.lazy="widget.options.pattern"
100
- placeholder="填写正则表达式"
100
+ <div
101
+ v-for="(rule, index) in widget.rules"
102
+ class="flexView"
103
+ :key="rule.id"
101
104
  >
102
- <template slot="prepend">/</template>
103
- <template slot="append">/</template>
104
- </el-input>
105
+ <el-input
106
+ class="config-pattern-input"
107
+ style="flex: 1;margin-right:10px;"
108
+ v-model="rule.patternStr"
109
+ placeholder="填写正则表达式"
110
+ clearable
111
+ >
112
+ <template slot="prepend">/</template>
113
+ <template slot="append">/</template>
114
+ </el-input>
115
+ <el-button
116
+ v-if="index === widget.rules.length - 1"
117
+ type="primary"
118
+ icon="el-icon-plus"
119
+ size="mini"
120
+ @click="
121
+ widget.rules.push({ id: new Date().getTime(), patternStr: '' })
122
+ "
123
+ ></el-button>
124
+ <el-button
125
+ v-else
126
+ type="danger"
127
+ icon="el-icon-delete"
128
+ size="mini"
129
+ @click="widget.rules.splice(index, 1)"
130
+ ></el-button>
131
+ </div>
105
132
  </el-form-item>
106
133
 
107
134
  <el-form-item>
@@ -153,12 +180,87 @@ export default {
153
180
  },
154
181
  props: {},
155
182
  mixins: [configComponent],
183
+ data(){
184
+ return {
185
+ rulesOptions: {
186
+ string: { label: "字符串", value: "string", pattern: "" },
187
+ number: { label: "数字", value: "number", pattern: "^[0-9]*$" },
188
+ numberOrAlphabet: {
189
+ label: "数字和大小写英文字母",
190
+ value: "numberOrAlphabet",
191
+ pattern: "^[A-Za-z0-9]+$"
192
+ },
193
+ integer: {
194
+ label: "正整数",
195
+ value: "integer",
196
+ pattern: "^[1-9]+[0-9]*$"
197
+ },
198
+ url: { label: "URL地址", value: "url", pattern: "" },
199
+ email: { label: "邮箱地址", value: "email", pattern: "" },
200
+ chineseName: {
201
+ label: "中文名(2-16位)",
202
+ value: "chineseName",
203
+ pattern: "^(?:[\\u4e00-\\u9fa5·]{2,16})$"
204
+ },
205
+ englishName: {
206
+ label: "英文名(2-22位)",
207
+ value: "englishName",
208
+ pattern: "(^[a-zA-Z]{1}[a-zA-Z\\s]{0,20}[a-zA-Z]{1}$)"
209
+ },
210
+ tel: { label: "手机号", value: "tel", pattern: "^1\\d{10}$" },
211
+ specialPlane: {
212
+ label: "座机号(xxx-xxxxxxxx)",
213
+ value: "specialPlane",
214
+ pattern: "^\\d{3}-\\d{8}$|^\\d{4}-\\d{7}$"
215
+ },
216
+ idCard: {
217
+ label: "身份证(18位)",
218
+ value: "idCard",
219
+ pattern: "^\\d{17}(\\d|X)$"
220
+ },
221
+ bankCard: {
222
+ label: "银行卡号",
223
+ value: "bankCard",
224
+ pattern: "^[1-9]\\d{9,29}$"
225
+ },
226
+ creditCode: {
227
+ label: "统一社会信用代码",
228
+ value: "creditCode",
229
+ pattern: "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$"
230
+ }
231
+ }
232
+ }
233
+ },
156
234
  mounted() {},
157
235
  methods: {
158
236
  handleInputNumberChange() {
159
237
  if (this.widget.options.minRows > this.widget.options.maxRows) {
160
238
  this.widget.options.maxRows = this.widget.options.minRows;
161
239
  }
240
+ },
241
+ handleInputTypeChange() {
242
+ const ruleType = this.widget.options.dataType;
243
+ if (this.rulesOptions[ruleType].pattern) {
244
+ let isNew = true;
245
+ this.widget.rules.forEach(rule => {
246
+ if (rule.name) {
247
+ rule.name = ruleType;
248
+ rule.patternStr = this.rulesOptions[ruleType].pattern;
249
+ isNew = false;
250
+ }
251
+ });
252
+ if (isNew) {
253
+ this.widget.rules.unshift({
254
+ id: new Date().getTime(),
255
+ name: ruleType,
256
+ patternStr: this.rulesOptions[ruleType].pattern
257
+ });
258
+ }
259
+ } else {
260
+ this.widget.rules = this.widget.rules.filter(rule => {
261
+ return !rule.name;
262
+ });
263
+ }
162
264
  }
163
265
  }
164
266
  };
@@ -12,17 +12,15 @@ const basicComponents = [
12
12
  "color",
13
13
  "switch",
14
14
  "button",
15
- "slider",
16
15
  "number",
16
+ "slider",
17
17
  "rate",
18
18
  "image",
19
19
  "upload",
20
20
  "editor",
21
21
  "cascader"
22
22
  ];
23
-
24
- const advanceComponents = ["table", "table_h5", "tabs", "blank"];
25
-
23
+ const advanceComponents = ["table", "tableH5", "tabs", "blank"];
26
24
  const layoutComponents = ["grid", "alliance", "filler", "divider"];
27
25
 
28
26
  module.exports = {
@@ -19,7 +19,7 @@
19
19
  :key="element.key"
20
20
  :widget="element"
21
21
  :widgetIndex="elementIndex"
22
- :widgetArray="column"
22
+ :widgetArray="column.list"
23
23
  :select.sync="selectWidget"
24
24
  :config="config"
25
25
  ></widget-form-item>
@@ -61,13 +61,13 @@ export default {
61
61
  if (item.className.indexOf("alliance") >= 0) {
62
62
  // 如果是列表中拖拽的元素需要还原到原来位置
63
63
  item.tagName === "DIV" &&
64
- this.widgetArray.list.splice(
64
+ this.widgetArray.splice(
65
65
  oldIndex,
66
66
  0,
67
- row.tabs[colIndex].list[newIndex]
67
+ row.options.columns[colIndex].list[newIndex]
68
68
  );
69
69
 
70
- row.tabs[colIndex].list.splice(newIndex, 1);
70
+ row.options.columns[colIndex].list.splice(newIndex, 1);
71
71
 
72
72
  return false;
73
73
  }
@@ -75,58 +75,59 @@ export default {
75
75
  const key =
76
76
  Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
77
77
 
78
- this.$set(row.tabs[colIndex].list, newIndex, {
79
- ...row.tabs[colIndex].list[newIndex],
78
+ this.$set(row.options.columns[colIndex].list, newIndex, {
79
+ ...row.options.columns[colIndex].list[newIndex],
80
80
  options: {
81
- ...row.tabs[colIndex].list[newIndex].options
81
+ ...row.options.columns[colIndex].list[newIndex].options
82
82
  // remoteFunc: "func_" + key
83
83
  },
84
84
  key,
85
85
  // 绑定键值
86
- model: row.tabs[colIndex].list[newIndex].type + "_" + key,
86
+ model: row.options.columns[colIndex].list[newIndex].type + "_" + key,
87
87
  rules: []
88
88
  });
89
89
 
90
90
  if (
91
- row.tabs[colIndex].list[newIndex].type === "radio" ||
92
- row.tabs[colIndex].list[newIndex].type === "checkbox" ||
93
- row.tabs[colIndex].list[newIndex].type === "select"
91
+ row.options.columns[colIndex].list[newIndex].type === "radio" ||
92
+ row.options.columns[colIndex].list[newIndex].type === "checkbox" ||
93
+ row.options.columns[colIndex].list[newIndex].type === "select"
94
94
  ) {
95
- this.$set(row.tabs[colIndex].list, newIndex, {
96
- ...row.tabs[colIndex].list[newIndex],
95
+ this.$set(row.options.columns[colIndex].list, newIndex, {
96
+ ...row.options.columns[colIndex].list[newIndex],
97
97
  options: {
98
- ...row.tabs[colIndex].list[newIndex].options,
99
- options: row.tabs[colIndex].list[newIndex].options.options.map(
100
- item => ({
101
- ...item
102
- })
103
- )
98
+ ...row.options.columns[colIndex].list[newIndex].options,
99
+ options: row.options.columns[colIndex].list[
100
+ newIndex
101
+ ].options.options.map(item => ({
102
+ ...item
103
+ }))
104
104
  }
105
105
  });
106
106
  }
107
107
 
108
- if (row.tabs[colIndex].list[newIndex].type === "grid") {
108
+ if (row.options.columns[colIndex].list[newIndex].type === "grid") {
109
109
  this.$set(
110
- row.tabs[colIndex].list,
110
+ row.options.columns[colIndex].list,
111
111
  newIndex,
112
- JSON.parse(JSON.stringify(row.tabs[colIndex].list[newIndex]))
112
+ JSON.parse(
113
+ JSON.stringify(row.options.columns[colIndex].list[newIndex])
114
+ )
113
115
  );
114
116
  }
115
117
 
116
- if (row.tabs[colIndex].list[newIndex].type === "table") {
117
- this.$set(row.tabs[colIndex].list, newIndex, {
118
- ...row.tabs[colIndex].list[newIndex],
119
- list: row.tabs[colIndex].list[newIndex].list.map(item => ({
118
+ if (row.options.columns[colIndex].list[newIndex].type === "table") {
119
+ this.$set(row.options.columns[colIndex].list, newIndex, {
120
+ ...row.options.columns[colIndex].list[newIndex],
121
+ list: row.options.columns[colIndex].list[newIndex].list.map(item => ({
120
122
  ...item
121
123
  }))
122
124
  });
123
125
  }
124
126
 
125
- this.selectWidget = row.tabs[colIndex].list[newIndex];
127
+ this.selectWidget = row.options.columns[colIndex].list[newIndex];
126
128
  }
127
129
  }
128
130
  };
129
131
  </script>
130
132
 
131
- <style lang="scss" scoped>
132
- </style>
133
+ <style lang="scss" scoped></style>
@@ -0,0 +1,14 @@
1
+ <template>
2
+ <div>
3
+ <slot :name="widget.model" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import { itemsComponent } from "../mixins/index";
9
+ export default {
10
+ mixins: [itemsComponent]
11
+ };
12
+ </script>
13
+
14
+ <style></style>
@@ -12,6 +12,7 @@
12
12
  :loading="widget.options.loading"
13
13
  :disabled="widget.options.disabled"
14
14
  :icon="widget.options.buttonIcon"
15
+ @click="handleEventAction(widget.events.onClick)"
15
16
  >
16
17
  {{ widget.options.defaultValue }}
17
18
  </th-button>
@@ -1,14 +1,18 @@
1
1
  <template>
2
2
  <el-cascader
3
- v-model="widget.options.defaultValue"
3
+ v-model="dataModel"
4
4
  :disabled="widget.options.disabled"
5
5
  :clearable="widget.options.clearable"
6
6
  :placeholder="widget.options.placeholder"
7
- :style="{ width: widget.options.width }"
7
+ :style="{
8
+ width: widget.options.width,
9
+ height: widget.options.height
10
+ }"
8
11
  :options="widget.options.remoteOptions"
9
12
  :props="widget.options.props"
10
13
  :show-all-levels="widget.options.showAllLevels ? false : true"
11
14
  :collapse-tags="widget.options.collapseTags"
15
+ :filterable="widget.options.filterable"
12
16
  @change="handleEventAction(widget.events.onChange)"
13
17
  >
14
18
  <template slot-scope="{ data }">
@@ -8,9 +8,7 @@
8
8
 
9
9
  <script>
10
10
  import { itemsComponent } from "../mixins/index";
11
- import ThCell from "ui/Cell/index.vue";
12
11
  export default {
13
- components: { ThCell },
14
12
  mixins: [itemsComponent]
15
13
  };
16
14
  </script>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <el-checkbox-group
3
- v-model="widget.options.defaultValue"
3
+ v-model="dataModel"
4
4
  :style="{ width: widget.options.width }"
5
5
  :disabled="widget.options.disabled"
6
6
  :min="widget.options.min"
@@ -14,10 +14,15 @@
14
14
  }"
15
15
  :label="item.value"
16
16
  :border="widget.options.border"
17
- v-for="(item, index) in widget.options.options"
18
- :key="`checkbox_${index}_${item.value}`"
17
+ v-for="(item, index) in widget.options.remote
18
+ ? widget.options.remoteOptions
19
+ : widget.options.options"
20
+ :key="index"
19
21
  >
20
- {{ widget.options.showLabel ? item.label : item.value }}
22
+ <template v-if="widget.options.remote">{{ item.label }}</template>
23
+ <template v-else>{{
24
+ widget.options.showLabel ? item.label : item.value
25
+ }}</template>
21
26
  </el-checkbox-button>
22
27
  </template>
23
28
  <template v-else>
@@ -27,10 +32,15 @@
27
32
  }"
28
33
  :label="item.value"
29
34
  :border="widget.options.border"
30
- v-for="(item, index) in widget.options.options"
31
- :key="`checkbox_${index}_${item.value}`"
35
+ v-for="(item, index) in widget.options.remote
36
+ ? widget.options.remoteOptions
37
+ : widget.options.options"
38
+ :key="index"
32
39
  >
33
- {{ widget.options.showLabel ? item.label : item.value }}
40
+ <template v-if="widget.options.remote">{{ item.label }}</template>
41
+ <template v-else>{{
42
+ widget.options.showLabel ? item.label : item.value
43
+ }}</template>
34
44
  </el-checkbox>
35
45
  </template>
36
46
  </el-checkbox-group>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <el-color-picker
3
- v-model="widget.options.defaultValue"
3
+ v-model="dataModel"
4
4
  :disabled="widget.options.disabled"
5
5
  :show-alpha="widget.options.showAlpha"
6
6
  :color-format="widget.options.showAlpha ? 'rgb' : 'hex'"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <el-date-picker
3
- v-model="widget.options.defaultValue"
3
+ v-model="dataModel"
4
4
  :style="{ width: widget.options.width }"
5
5
  :type="widget.options.type"
6
6
  :is-range="widget.options.isRange"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <vue-editor
3
- v-model="widget.options.defaultValue"
3
+ v-model="dataModel"
4
4
  :style="{
5
5
  width: widget.options.width,
6
6
  height: widget.options.height
@@ -1,5 +1,4 @@
1
1
  <template>
2
- <!-- widget.key -->
3
2
  <th-row
4
3
  :class="{ active: selectWidget.model == widget.model }"
5
4
  :gutter="widget.options.gutter ? widget.options.gutter : 0"
@@ -7,7 +6,7 @@
7
6
  :align="widget.options.align"
8
7
  >
9
8
  <th-col
10
- v-for="(column, columnIndex) in widget.columns"
9
+ v-for="(column, columnIndex) in widget.options.columns"
11
10
  :key="`grid_${columnIndex}`"
12
11
  :span="column.span ? column.span : 0"
13
12
  >
@@ -20,7 +19,7 @@
20
19
  animation: 200,
21
20
  handle: '.drag-widget'
22
21
  }"
23
- @add="handleWidgetColAdd($event, widget, columnIndex)"
22
+ @add="handleWidgetAdd($event, widget, columnIndex)"
24
23
  >
25
24
  <transition-group name="fade" tag="div" class="widget-col-list">
26
25
  <widget-form-item
@@ -29,8 +28,8 @@
29
28
  })"
30
29
  :key="element.key"
31
30
  :widget="element"
31
+ :widgetArray="column.list"
32
32
  :widgetIndex="elementIndex"
33
- :widgetArray="column"
34
33
  :select.sync="selectWidget"
35
34
  :config="config"
36
35
  >
@@ -45,10 +44,9 @@
45
44
  import { itemsComponent } from "../mixins/index";
46
45
  import Draggable from "vuedraggable";
47
46
  import WidgetFormItem from "../../WidgetFormItem.vue";
48
- import ThRow from "ui/Row/index.vue";
49
- import ThCol from "ui/Col/index.vue";
47
+
50
48
  export default {
51
- components: { Draggable, WidgetFormItem, ThRow, ThCol },
49
+ components: { Draggable, WidgetFormItem },
52
50
  mixins: [itemsComponent],
53
51
  data() {
54
52
  return {
@@ -67,61 +65,32 @@ export default {
67
65
  }
68
66
  },
69
67
  methods: {
70
- handleWidgetColAdd($event, row, colIndex) {
68
+ handleWidgetAdd($event, row, colIndex) {
71
69
  const newIndex = $event.newIndex;
72
70
  const oldIndex = $event.oldIndex;
73
71
  const item = $event.item;
72
+ const newComponent = JSON.parse(
73
+ JSON.stringify(row.options.columns[colIndex].list[newIndex])
74
+ );
74
75
 
75
76
  // 防止布局元素的嵌套拖拽
76
77
  if (item.className.indexOf("data-grid") >= 0) {
77
78
  // 如果是列表中拖拽的元素需要还原到原来位置
78
79
  item.tagName === "DIV" &&
79
- this.widgetArray.list.splice(
80
- oldIndex,
81
- 0,
82
- row.columns[colIndex].list[newIndex]
83
- );
84
-
85
- row.columns[colIndex].list.splice(newIndex, 1);
80
+ this.widgetArray.splice(oldIndex, 0, newComponent);
86
81
 
82
+ row.options.columns[colIndex].list.splice(newIndex, 1);
87
83
  return false;
88
84
  }
89
85
 
90
86
  const key =
91
87
  Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
92
-
93
- this.$set(row.columns[colIndex].list, newIndex, {
94
- ...row.columns[colIndex].list[newIndex],
95
- options: {
96
- ...row.columns[colIndex].list[newIndex].options
97
- // remoteFunc: "func_" + key
98
- },
99
- key,
100
- // 绑定键值
101
- model: row.columns[colIndex].list[newIndex].type + "_" + key,
102
- rules: []
103
- });
104
-
105
- if (
106
- row.columns[colIndex].list[newIndex].type === "radio" ||
107
- row.columns[colIndex].list[newIndex].type === "checkbox" ||
108
- row.columns[colIndex].list[newIndex].type === "select"
109
- ) {
110
- this.$set(row.columns[colIndex].list, newIndex, {
111
- ...row.columns[colIndex].list[newIndex],
112
- options: {
113
- ...row.columns[colIndex].list[newIndex].options,
114
- options: row.columns[colIndex].list[newIndex].options.options.map(
115
- item => ({
116
- ...item
117
- })
118
- )
119
- }
120
- });
88
+ if (!newComponent.model) {
89
+ newComponent.key = key;
90
+ newComponent.model = `${newComponent.type}_${key}`;
121
91
  }
122
-
123
- // this.$emit("update:select", row.columns[colIndex].list[newIndex]);
124
- this.selectWidget = row.columns[colIndex].list[newIndex];
92
+ this.$set(row.options.columns[colIndex].list, newIndex, newComponent);
93
+ this.selectWidget = newComponent;
125
94
  }
126
95
  }
127
96
  };
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <th-row
3
+ :gutter="widget.options.gutter ? widget.options.gutter : 0"
4
+ :justify="widget.options.justify"
5
+ :align="widget.options.align"
6
+ >
7
+ <th-col
8
+ v-for="(column, columnIndex) in widget.options.columns"
9
+ :key="columnIndex"
10
+ :span="column.span"
11
+ >
12
+ <generate-form-item
13
+ v-for="element in column.list"
14
+ :key="element.key"
15
+ :widget="element"
16
+ :models="models"
17
+ :config="config"
18
+ :remote="remote"
19
+ :prop="prop ? `${prop}.${element.model}` : element.model"
20
+ :slotKeys="slotKeys"
21
+ :componentsData="componentsData"
22
+ >
23
+ <template v-for="name in slotKeys" :slot="name">
24
+ <slot :name="name" />
25
+ </template>
26
+ </generate-form-item>
27
+ </th-col>
28
+ </th-row>
29
+ </template>
30
+
31
+ <script>
32
+ import { itemsComponent } from "../mixins/index";
33
+ import GenerateFormItem from "../../GenerateFormItem.vue";
34
+ export default {
35
+ components: { GenerateFormItem },
36
+ mixins: [itemsComponent],
37
+ props: ["models", "remote", "prop", "slotKeys", "componentsData"],
38
+ data() {
39
+ return {};
40
+ },
41
+ methods: {}
42
+ };
43
+ </script>
44
+
45
+ <style></style>
@@ -1,32 +1,4 @@
1
1
  <template>
2
- <!-- <div>
3
- <th-image
4
- v-if="!widget.options.remote"
5
- :src="widget.options.defaultValue"
6
- :height="widget.options.height"
7
- :width="widget.options.width"
8
- :fit="widget.options.fit"
9
- :border-radius="widget.options.borderRadius"
10
- :display-style="widget.options.displayStyle"
11
- :error-src="widget.options.errorSrc"
12
- :is-loding="widget.options.isLoding"
13
- ></th-image>
14
- <div v-for="item in widget.options.defaultValueArr" :key="item.url">
15
- <th-image
16
- v-if="widget.options.remote"
17
- :src="item"
18
- src-key="url"
19
- :height="widget.options.height"
20
- :width="widget.options.width"
21
- :fit="widget.options.fit"
22
- :border-radius="widget.options.borderRadius"
23
- :preview-list="widget.options.defaultValueArr"
24
- :display-style="widget.options.displayStyle"
25
- :error-src="widget.options.errorSrc"
26
- :is-loding="widget.options.isLoding"
27
- ></th-image>
28
- </div>
29
- </div> -->
30
2
  <div>
31
3
  <el-image
32
4
  v-for="(item, index) in widget.options.defaultValue"