tianheng-ui 0.0.45 → 0.0.48
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/lib/index.js +1 -1
- package/lib/tianheng-ui.js +3 -3
- package/package.json +1 -1
- package/packages/formMaking/Container.vue +14 -25
- package/packages/formMaking/GenerateForm.vue +93 -101
- package/packages/formMaking/GenerateFormItem.vue +200 -18
- package/packages/formMaking/WidgetConfig.vue +187 -13
- package/packages/formMaking/WidgetForm.vue +51 -185
- package/packages/formMaking/WidgetFormItem.vue +369 -29
- package/packages/formMaking/componentsConfig.js +129 -13
- package/packages/formMaking/styles/cover.scss +40 -40
- package/packages/formMaking/styles/index.scss +30 -8
@@ -10,7 +10,6 @@
|
|
10
10
|
:label-width="data.config.labelWidth + 'px'"
|
11
11
|
>
|
12
12
|
<draggable
|
13
|
-
class=""
|
14
13
|
v-model="data.list"
|
15
14
|
v-bind="{
|
16
15
|
group: 'people',
|
@@ -23,82 +22,14 @@
|
|
23
22
|
>
|
24
23
|
<transition-group name="fade" tag="div" class="widget-form-list">
|
25
24
|
<template v-for="(element, index) in data.list">
|
26
|
-
<
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
:justify="element.options.justify"
|
35
|
-
:align="element.options.align"
|
36
|
-
@click.native="handleSelectWidget(index)"
|
37
|
-
>
|
38
|
-
<el-col
|
39
|
-
v-for="(col, colIndex) in element.columns"
|
40
|
-
:key="colIndex"
|
41
|
-
:span="col.span ? col.span : 0"
|
42
|
-
>
|
43
|
-
<draggable
|
44
|
-
v-model="col.list"
|
45
|
-
:no-transition-on-drag="true"
|
46
|
-
v-bind="{
|
47
|
-
group: 'people',
|
48
|
-
ghostClass: 'ghost',
|
49
|
-
animation: 200,
|
50
|
-
handle: '.drag-widget'
|
51
|
-
}"
|
52
|
-
@end="handleMoveEnd"
|
53
|
-
@add="handleWidgetColAdd($event, element, colIndex)"
|
54
|
-
>
|
55
|
-
<transition-group
|
56
|
-
name="fade"
|
57
|
-
tag="div"
|
58
|
-
class="widget-col-list"
|
59
|
-
>
|
60
|
-
<template v-for="(el, i) in col.list">
|
61
|
-
<widget-form-item
|
62
|
-
:key="el.key"
|
63
|
-
v-if="el.key"
|
64
|
-
:element="el"
|
65
|
-
:select.sync="selectWidget"
|
66
|
-
:index="i"
|
67
|
-
:data="col"
|
68
|
-
>
|
69
|
-
</widget-form-item>
|
70
|
-
</template>
|
71
|
-
</transition-group>
|
72
|
-
</draggable>
|
73
|
-
</el-col>
|
74
|
-
<div
|
75
|
-
class="widget-view-action widget-col-action"
|
76
|
-
v-if="selectWidget.key == element.key"
|
77
|
-
>
|
78
|
-
<i
|
79
|
-
class="iconfont icon-trash"
|
80
|
-
@click.stop="handleWidgetDelete(index)"
|
81
|
-
></i>
|
82
|
-
</div>
|
83
|
-
|
84
|
-
<div
|
85
|
-
class="widget-view-drag widget-col-drag"
|
86
|
-
v-if="selectWidget.key == element.key"
|
87
|
-
>
|
88
|
-
<i class="iconfont icon-drag drag-widget"></i>
|
89
|
-
</div>
|
90
|
-
</el-row>
|
91
|
-
</template>
|
92
|
-
<template v-else>
|
93
|
-
<widget-form-item
|
94
|
-
v-if="element && element.key"
|
95
|
-
:key="element.key"
|
96
|
-
:element="element"
|
97
|
-
:select.sync="selectWidget"
|
98
|
-
:index="index"
|
99
|
-
:data="data"
|
100
|
-
></widget-form-item>
|
101
|
-
</template>
|
25
|
+
<widget-form-item
|
26
|
+
v-if="element && element.key"
|
27
|
+
:key="element.key"
|
28
|
+
:element="element"
|
29
|
+
:select.sync="selectWidget"
|
30
|
+
:index="index"
|
31
|
+
:data="data"
|
32
|
+
></widget-form-item>
|
102
33
|
</template>
|
103
34
|
</transition-group>
|
104
35
|
</draggable>
|
@@ -118,7 +49,8 @@ export default {
|
|
118
49
|
props: ["data", "select"],
|
119
50
|
data() {
|
120
51
|
return {
|
121
|
-
selectWidget: this.select
|
52
|
+
selectWidget: this.select,
|
53
|
+
config: {}
|
122
54
|
};
|
123
55
|
},
|
124
56
|
mounted() {
|
@@ -142,115 +74,49 @@ export default {
|
|
142
74
|
//为拖拽到容器的元素添加唯一 key
|
143
75
|
const key =
|
144
76
|
Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
}
|
77
|
+
let dic = JSON.parse(JSON.stringify(this.data.list[newIndex]));
|
78
|
+
dic.key = key;
|
79
|
+
dic.model = dic.type + "_" + key;
|
80
|
+
dic.rules = [];
|
81
|
+
|
82
|
+
this.$set(this.data.list, newIndex, dic);
|
83
|
+
|
84
|
+
// if (
|
85
|
+
// this.data.list[newIndex].type === "radio" ||
|
86
|
+
// this.data.list[newIndex].type === "checkbox" ||
|
87
|
+
// this.data.list[newIndex].type === "select"
|
88
|
+
// ) {
|
89
|
+
// this.$set(this.data.list, newIndex, {
|
90
|
+
// ...this.data.list[newIndex],
|
91
|
+
// options: {
|
92
|
+
// ...this.data.list[newIndex].options,
|
93
|
+
// options: this.data.list[newIndex].options.options.map(item => ({
|
94
|
+
// ...item
|
95
|
+
// }))
|
96
|
+
// }
|
97
|
+
// });
|
98
|
+
// }
|
99
|
+
|
100
|
+
// if (this.data.list[newIndex].type === "grid") {
|
101
|
+
// this.$set(
|
102
|
+
// this.data.list,
|
103
|
+
// newIndex,
|
104
|
+
// JSON.parse(JSON.stringify(this.data.list[newIndex]))
|
105
|
+
// );
|
106
|
+
// }
|
107
|
+
|
108
|
+
// if (this.data.list[newIndex].type === "tabs") {
|
109
|
+
// this.$set(this.data.list, newIndex, JSON.parse(JSON.stringify(this.data.list[newIndex])));
|
110
|
+
// }
|
111
|
+
|
112
|
+
// if (this.data.list[newIndex].type === "table") {
|
113
|
+
// this.$set(this.data.list, newIndex, {
|
114
|
+
// ...this.data.list[newIndex],
|
115
|
+
// list: this.data.list[newIndex].list.map(item => ({ ...item }))
|
116
|
+
// });
|
117
|
+
// }
|
179
118
|
|
180
119
|
this.selectWidget = this.data.list[newIndex];
|
181
|
-
},
|
182
|
-
handleWidgetColAdd($event, row, colIndex) {
|
183
|
-
console.log("coladd", $event, row, colIndex);
|
184
|
-
const newIndex = $event.newIndex;
|
185
|
-
const oldIndex = $event.oldIndex;
|
186
|
-
const item = $event.item;
|
187
|
-
|
188
|
-
// 防止布局元素的嵌套拖拽
|
189
|
-
if (item.className.indexOf("data-grid") >= 0) {
|
190
|
-
// 如果是列表中拖拽的元素需要还原到原来位置
|
191
|
-
item.tagName === "DIV" &&
|
192
|
-
this.data.list.splice(
|
193
|
-
oldIndex,
|
194
|
-
0,
|
195
|
-
row.columns[colIndex].list[newIndex]
|
196
|
-
);
|
197
|
-
|
198
|
-
row.columns[colIndex].list.splice(newIndex, 1);
|
199
|
-
|
200
|
-
return false;
|
201
|
-
}
|
202
|
-
|
203
|
-
console.log("from", item);
|
204
|
-
|
205
|
-
const key =
|
206
|
-
Date.parse(new Date()) + "_" + Math.ceil(Math.random() * 99999);
|
207
|
-
|
208
|
-
this.$set(row.columns[colIndex].list, newIndex, {
|
209
|
-
...row.columns[colIndex].list[newIndex],
|
210
|
-
options: {
|
211
|
-
...row.columns[colIndex].list[newIndex].options,
|
212
|
-
// remoteFunc: "func_" + key
|
213
|
-
},
|
214
|
-
key,
|
215
|
-
// 绑定键值
|
216
|
-
model: row.columns[colIndex].list[newIndex].type + "_" + key,
|
217
|
-
rules: []
|
218
|
-
});
|
219
|
-
|
220
|
-
if (
|
221
|
-
row.columns[colIndex].list[newIndex].type === "radio" ||
|
222
|
-
row.columns[colIndex].list[newIndex].type === "checkbox" ||
|
223
|
-
row.columns[colIndex].list[newIndex].type === "select"
|
224
|
-
) {
|
225
|
-
this.$set(row.columns[colIndex].list, newIndex, {
|
226
|
-
...row.columns[colIndex].list[newIndex],
|
227
|
-
options: {
|
228
|
-
...row.columns[colIndex].list[newIndex].options,
|
229
|
-
options: row.columns[colIndex].list[newIndex].options.options.map(
|
230
|
-
item => ({
|
231
|
-
...item
|
232
|
-
})
|
233
|
-
)
|
234
|
-
}
|
235
|
-
});
|
236
|
-
}
|
237
|
-
|
238
|
-
this.selectWidget = row.columns[colIndex].list[newIndex];
|
239
|
-
},
|
240
|
-
handleWidgetDelete(index) {
|
241
|
-
if (this.data.list.length - 1 === index) {
|
242
|
-
if (index === 0) {
|
243
|
-
this.selectWidget = {};
|
244
|
-
} else {
|
245
|
-
this.selectWidget = this.data.list[index - 1];
|
246
|
-
}
|
247
|
-
} else {
|
248
|
-
this.selectWidget = this.data.list[index + 1];
|
249
|
-
}
|
250
|
-
|
251
|
-
this.$nextTick(() => {
|
252
|
-
this.data.list.splice(index, 1);
|
253
|
-
});
|
254
120
|
}
|
255
121
|
},
|
256
122
|
watch: {
|