tianheng-ui 0.1.10 → 0.1.12
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/theme-chalk/styles/reset.scss +0 -2
- package/lib/tianheng-ui.js +13 -14
- package/package.json +1 -1
- package/packages/FormMaking/GenerateForm.vue +16 -11
- package/packages/FormMaking/GenerateFormItem.vue +73 -581
- package/packages/FormMaking/GenerateFormItemH5.vue +6 -6
- package/packages/FormMaking/Upload/index.vue +0 -1
- package/packages/FormMaking/WidgetConfig.vue +100 -77
- package/packages/FormMaking/WidgetForm.vue +7 -48
- package/packages/FormMaking/WidgetFormItem.vue +41 -65
- package/packages/FormMaking/WidgetSelect.vue +160 -0
- package/packages/FormMaking/WidgetTools.vue +538 -0
- package/packages/FormMaking/config/index.js +6 -0
- package/packages/FormMaking/custom/config.js +119 -87
- package/packages/FormMaking/custom/configs/button.vue +24 -25
- package/packages/FormMaking/custom/configs/cascader.vue +7 -7
- package/packages/FormMaking/custom/configs/checkbox.vue +23 -22
- package/packages/FormMaking/custom/configs/color.vue +3 -3
- package/packages/FormMaking/custom/configs/date.vue +3 -3
- package/packages/FormMaking/custom/configs/grid.vue +4 -4
- package/packages/FormMaking/custom/configs/input.vue +138 -31
- package/packages/FormMaking/custom/configs/number.vue +5 -5
- package/packages/FormMaking/custom/configs/radio.vue +23 -19
- package/packages/FormMaking/custom/configs/rate.vue +3 -3
- package/packages/FormMaking/custom/configs/select.vue +25 -20
- package/packages/FormMaking/custom/configs/slider.vue +3 -3
- package/packages/FormMaking/custom/configs/switch.vue +3 -3
- package/packages/FormMaking/custom/configs/table.vue +2 -2
- package/packages/FormMaking/custom/configs/{table_h5.vue → tableH5.vue} +2 -2
- package/packages/FormMaking/custom/configs/tabs.vue +18 -23
- package/packages/FormMaking/custom/configs/textarea.vue +124 -22
- package/packages/FormMaking/custom/configs/time.vue +3 -3
- package/packages/FormMaking/custom/configs/upload.vue +5 -5
- package/packages/FormMaking/custom/index.js +2 -4
- package/packages/FormMaking/custom/items/alliance.vue +30 -29
- package/packages/FormMaking/custom/items/blank_pro.vue +14 -0
- package/packages/FormMaking/custom/items/button.vue +36 -1
- package/packages/FormMaking/custom/items/cascader.vue +6 -2
- package/packages/FormMaking/custom/items/cell.vue +0 -2
- package/packages/FormMaking/custom/items/checkbox.vue +18 -8
- package/packages/FormMaking/custom/items/color.vue +1 -1
- package/packages/FormMaking/custom/items/date.vue +1 -1
- package/packages/FormMaking/custom/items/editor.vue +1 -1
- package/packages/FormMaking/custom/items/{grid.vue → grid_dev.vue} +16 -47
- package/packages/FormMaking/custom/items/grid_pro.vue +45 -0
- package/packages/FormMaking/custom/items/image.vue +0 -28
- package/packages/FormMaking/custom/items/input.vue +15 -9
- package/packages/FormMaking/custom/items/number.vue +4 -4
- package/packages/FormMaking/custom/items/radio.vue +17 -7
- package/packages/FormMaking/custom/items/rate.vue +1 -1
- package/packages/FormMaking/custom/items/select.vue +12 -6
- package/packages/FormMaking/custom/items/slider.vue +1 -1
- package/packages/FormMaking/custom/items/switch.vue +1 -1
- package/packages/FormMaking/custom/items/{table_h5.vue → tableH5_dev.vue} +44 -49
- package/packages/FormMaking/custom/items/tableH5_pro.vue +113 -0
- package/packages/FormMaking/custom/items/{table.vue → table_dev.vue} +21 -41
- package/packages/FormMaking/custom/items/table_pro.vue +114 -0
- package/packages/FormMaking/custom/items/tabs_dev.vue +101 -0
- package/packages/FormMaking/custom/items/tabs_pro.vue +50 -0
- package/packages/FormMaking/custom/items/text.vue +1 -1
- package/packages/FormMaking/custom/items/textarea.vue +4 -13
- package/packages/FormMaking/custom/items/time.vue +3 -3
- package/packages/FormMaking/custom/items/upload.vue +15 -14
- package/packages/FormMaking/custom/mixins/index.js +28 -6
- package/packages/FormMaking/custom/register.js +22 -11
- package/packages/FormMaking/index.vue +95 -468
- package/packages/FormMaking/styles/index.scss +235 -242
- package/packages/FormMaking/util/generateCode.js +3 -3
- package/packages/FormMaking/util/index.js +33 -23
- package/packages/FormMaking/util/request.js +9 -12
- package/packages/FormMaking/custom/items/tabs.vue +0 -145
- /package/packages/FormMaking/custom/items/{blank.vue → blank_dev.vue} +0 -0
@@ -502,7 +502,7 @@
|
|
502
502
|
</el-table>
|
503
503
|
</template>
|
504
504
|
|
505
|
-
<template v-if="widget.type == '
|
505
|
+
<template v-if="widget.type == 'tableH5'">
|
506
506
|
<div class="tableH5">
|
507
507
|
<div
|
508
508
|
class="tableH5-item"
|
@@ -567,7 +567,7 @@
|
|
567
567
|
:align="widget.options.align"
|
568
568
|
>
|
569
569
|
<el-col
|
570
|
-
v-for="(column, columnIndex) in widget.columns"
|
570
|
+
v-for="(column, columnIndex) in widget.options.columns"
|
571
571
|
:key="columnIndex"
|
572
572
|
:span="column.span"
|
573
573
|
>
|
@@ -593,7 +593,7 @@
|
|
593
593
|
<template v-if="widget.type == 'tabs'">
|
594
594
|
<el-tabs v-model="widget.options.defaultValue">
|
595
595
|
<el-tab-pane
|
596
|
-
v-for="(column, columnIndex) in widget.
|
596
|
+
v-for="(column, columnIndex) in widget.options.columns"
|
597
597
|
:key="`tabs_${columnIndex}`"
|
598
598
|
:label="column.label"
|
599
599
|
:name="column.value"
|
@@ -750,8 +750,8 @@ export default {
|
|
750
750
|
let dic = {};
|
751
751
|
this.widget.list.forEach(item => {
|
752
752
|
if (item.type === "grid") {
|
753
|
-
for (let i = 0; i < item.columns.length; i++) {
|
754
|
-
const element = item.columns[i];
|
753
|
+
for (let i = 0; i < item.options.columns.length; i++) {
|
754
|
+
const element = item.options.columns[i];
|
755
755
|
for (let j = 0; j < element.list.length; j++) {
|
756
756
|
const element2 = element.list[j];
|
757
757
|
dic[element2.model] = element2.options.defaultValue;
|
@@ -774,7 +774,7 @@ export default {
|
|
774
774
|
for (let i = 0; i < eventScript.length; i++) {
|
775
775
|
const element = eventScript[i];
|
776
776
|
if (element.key === key) {
|
777
|
-
const func = `(item,value)=>{${element.
|
777
|
+
const func = `(item,value)=>{${element.value}}`;
|
778
778
|
eval(func)(this.widget, this.dataModel);
|
779
779
|
}
|
780
780
|
}
|
@@ -1,9 +1,36 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="widgetConfig" v-if="show">
|
3
|
+
<div style="line-height: 30px;"></div>
|
4
|
+
<div class="flexView">
|
5
|
+
<div style="width:100px">类型切换</div>
|
6
|
+
<el-select
|
7
|
+
:value="data.type"
|
8
|
+
style="width:100%;"
|
9
|
+
size="small"
|
10
|
+
placeholder="请选择类型"
|
11
|
+
@change="handleTypeChange"
|
12
|
+
>
|
13
|
+
<el-option
|
14
|
+
v-for="item in Object.values(compsData)"
|
15
|
+
:key="item.type"
|
16
|
+
:label="item.name"
|
17
|
+
:value="item.type"
|
18
|
+
>
|
19
|
+
</el-option>
|
20
|
+
</el-select>
|
21
|
+
<el-tooltip
|
22
|
+
style="padding-left:10px;color:#F56C6C;"
|
23
|
+
effect="dark"
|
24
|
+
content="切换类型会导致该组件配置信息重置,请谨慎使用!"
|
25
|
+
placement="top"
|
26
|
+
>
|
27
|
+
<i class="el-icon-warning"></i>
|
28
|
+
</el-tooltip>
|
29
|
+
</div>
|
30
|
+
|
3
31
|
<component
|
4
32
|
:widget="data"
|
5
33
|
:config="config"
|
6
|
-
:remoteApis="remoteApis"
|
7
34
|
:is="compsData[data.type].content"
|
8
35
|
@events-show="handleEventDialogShow"
|
9
36
|
@events-edit="handleEventsCollapseClick"
|
@@ -17,9 +44,13 @@
|
|
17
44
|
>
|
18
45
|
<div class="eventsSetting">
|
19
46
|
<div class="list">
|
20
|
-
<div class="list-header"
|
47
|
+
<div class="list-header">
|
21
48
|
<div>动作库</div>
|
22
|
-
<el-button
|
49
|
+
<el-button
|
50
|
+
type="text"
|
51
|
+
icon="el-icon-plus"
|
52
|
+
size="mini"
|
53
|
+
@click="handleAddEvent"
|
23
54
|
>添加</el-button
|
24
55
|
>
|
25
56
|
</div>
|
@@ -30,9 +61,9 @@
|
|
30
61
|
@click="eventsDialog.active = item"
|
31
62
|
>
|
32
63
|
<div class="list-item-title">Function</div>
|
33
|
-
<div class="list-item-value">{{ item.
|
64
|
+
<div class="list-item-value">{{ item.label }}</div>
|
34
65
|
<el-popconfirm
|
35
|
-
:title="`是否确定删除方法 ${item.
|
66
|
+
:title="`是否确定删除方法 ${item.label}`"
|
36
67
|
confirm-button-text="删除"
|
37
68
|
confirm-button-type="danger"
|
38
69
|
@confirm="handleEventDialogDelete(item, index)"
|
@@ -45,12 +76,12 @@
|
|
45
76
|
<div>
|
46
77
|
<span>Function Name</span>
|
47
78
|
<el-input
|
48
|
-
v-model="eventsDialog.active.
|
79
|
+
v-model="eventsDialog.active.label"
|
49
80
|
placeholder="请输入动作名称"
|
50
81
|
size="small"
|
51
82
|
:disabled="
|
52
|
-
eventsDialog.active.
|
53
|
-
eventsDialog.active.
|
83
|
+
eventsDialog.active.label === 'mounted' ||
|
84
|
+
eventsDialog.active.label === 'refresh'
|
54
85
|
"
|
55
86
|
></el-input>
|
56
87
|
</div>
|
@@ -58,8 +89,8 @@
|
|
58
89
|
<div>
|
59
90
|
function(
|
60
91
|
{{
|
61
|
-
eventsDialog.active.
|
62
|
-
eventsDialog.active.
|
92
|
+
eventsDialog.active.label !== "mounted" &&
|
93
|
+
eventsDialog.active.label !== "refresh"
|
63
94
|
? "item,value"
|
64
95
|
: ""
|
65
96
|
}}
|
@@ -76,17 +107,21 @@
|
|
76
107
|
slot="reference"
|
77
108
|
class="el-icon-question"
|
78
109
|
></i>
|
79
|
-
<div
|
80
|
-
<div
|
81
|
-
|
82
|
-
|
83
|
-
|
110
|
+
<div>
|
111
|
+
<div
|
112
|
+
style="display: flex;justify-content: space-between;"
|
113
|
+
v-for="item in aceCompletions"
|
114
|
+
:key="item.caption"
|
115
|
+
>
|
116
|
+
<div>{{ item.caption }}</div>
|
117
|
+
<div>{{ item.meta }}</div>
|
118
|
+
</div>
|
84
119
|
</div>
|
85
120
|
</el-popover>
|
86
121
|
</div>
|
87
122
|
<th-code-editor
|
88
123
|
style="height:calc(100% - 48px)"
|
89
|
-
v-model="eventsDialog.active.
|
124
|
+
v-model="eventsDialog.active.value"
|
90
125
|
:completions="aceCompletions"
|
91
126
|
ref="codeEditor"
|
92
127
|
></th-code-editor>
|
@@ -108,10 +143,7 @@
|
|
108
143
|
|
109
144
|
<script>
|
110
145
|
import compsData from "./custom/register";
|
111
|
-
import ThDialog from "ui/Dialog/index.vue";
|
112
|
-
import ThCodeEditor from "ui/CodeEditor/index.vue";
|
113
146
|
export default {
|
114
|
-
components: { ThDialog, ThCodeEditor },
|
115
147
|
props: {
|
116
148
|
data: {
|
117
149
|
type: Object,
|
@@ -119,12 +151,6 @@ export default {
|
|
119
151
|
return {};
|
120
152
|
}
|
121
153
|
},
|
122
|
-
remoteApis: {
|
123
|
-
type: Array,
|
124
|
-
default: () => {
|
125
|
-
return [];
|
126
|
-
}
|
127
|
-
},
|
128
154
|
config: {
|
129
155
|
type: Object,
|
130
156
|
default: () => {
|
@@ -171,10 +197,44 @@ export default {
|
|
171
197
|
caption: "hide",
|
172
198
|
value: "hide([ ])",
|
173
199
|
score: 1
|
200
|
+
},
|
201
|
+
{
|
202
|
+
meta: "跳转页面",
|
203
|
+
caption: "goPage",
|
204
|
+
value: "goPage({path:'',query:{}})",
|
205
|
+
score: 1
|
174
206
|
}
|
175
207
|
]
|
176
208
|
};
|
177
209
|
},
|
210
|
+
// watch: {
|
211
|
+
// "data.options.isRange": function(val) {
|
212
|
+
// if (typeof val !== "undefined") {
|
213
|
+
// if (val) {
|
214
|
+
// this.data.options.defaultValue = null;
|
215
|
+
// } else {
|
216
|
+
// if (Object.keys(this.data.options).indexOf("defaultValue") >= 0)
|
217
|
+
// this.data.options.defaultValue = "";
|
218
|
+
// }
|
219
|
+
// }
|
220
|
+
// },
|
221
|
+
// "data.options.required": function(val) {
|
222
|
+
// this.validateRequired(val);
|
223
|
+
// },
|
224
|
+
// "data.options.dataType": function(val) {
|
225
|
+
// this.validateDataType(val);
|
226
|
+
// },
|
227
|
+
// "data.options.pattern": function(val) {
|
228
|
+
// this.valiatePattern(val);
|
229
|
+
// },
|
230
|
+
// "data.name": function(val) {
|
231
|
+
// if (this.data.options) {
|
232
|
+
// this.validateRequired(this.data.options.required);
|
233
|
+
// this.validateDataType(this.data.options.dataType);
|
234
|
+
// this.valiatePattern(this.data.options.pattern);
|
235
|
+
// }
|
236
|
+
// }
|
237
|
+
// },
|
178
238
|
computed: {
|
179
239
|
show() {
|
180
240
|
if (this.data && Object.keys(this.data).length > 0) {
|
@@ -271,9 +331,9 @@ export default {
|
|
271
331
|
handleAddEvent() {
|
272
332
|
const key = new Date().getTime();
|
273
333
|
const dic = {
|
274
|
-
|
275
|
-
|
276
|
-
|
334
|
+
id: key,
|
335
|
+
label: key,
|
336
|
+
value: ""
|
277
337
|
};
|
278
338
|
this.eventsDialog.eventScript.push(dic);
|
279
339
|
this.eventsDialog.active = dic;
|
@@ -310,56 +370,17 @@ export default {
|
|
310
370
|
break;
|
311
371
|
}
|
312
372
|
}
|
313
|
-
}
|
314
|
-
},
|
315
|
-
watch: {
|
316
|
-
"data.options.isRange": function(val) {
|
317
|
-
if (typeof val !== "undefined") {
|
318
|
-
if (val) {
|
319
|
-
this.data.options.defaultValue = null;
|
320
|
-
} else {
|
321
|
-
if (Object.keys(this.data.options).indexOf("defaultValue") >= 0)
|
322
|
-
this.data.options.defaultValue = "";
|
323
|
-
}
|
324
|
-
}
|
325
|
-
},
|
326
|
-
"data.options.required": function(val) {
|
327
|
-
this.validateRequired(val);
|
328
373
|
},
|
329
|
-
|
330
|
-
this.
|
331
|
-
|
332
|
-
"data.options.pattern": function(val) {
|
333
|
-
this.valiatePattern(val);
|
334
|
-
},
|
335
|
-
"data.name": function(val) {
|
336
|
-
if (this.data.options) {
|
337
|
-
this.validateRequired(this.data.options.required);
|
338
|
-
this.validateDataType(this.data.options.dataType);
|
339
|
-
this.valiatePattern(this.data.options.pattern);
|
340
|
-
}
|
374
|
+
handleTypeChange(val) {
|
375
|
+
const config = JSON.parse(JSON.stringify(this.compsData[val].config));
|
376
|
+
this.$emit("update", config);
|
341
377
|
}
|
342
378
|
}
|
343
379
|
};
|
344
380
|
</script>
|
345
381
|
|
346
|
-
<style lang="
|
382
|
+
<style lang="scss" scoped>
|
347
383
|
.widgetConfig {
|
348
|
-
.remoteApis {
|
349
|
-
width: 100%;
|
350
|
-
margin-bottom: 6px;
|
351
|
-
|
352
|
-
/deep/ .el-input--prefix .el-input__inner {
|
353
|
-
padding-left: 85px;
|
354
|
-
}
|
355
|
-
|
356
|
-
/deep/ .el-input__prefix {
|
357
|
-
left: 0;
|
358
|
-
width: 75px;
|
359
|
-
color: #999;
|
360
|
-
}
|
361
|
-
}
|
362
|
-
|
363
384
|
.el-dialog__body {
|
364
385
|
padding: 20px;
|
365
386
|
}
|
@@ -424,7 +445,7 @@ export default {
|
|
424
445
|
margin-bottom: 20px;
|
425
446
|
padding-left: 10px;
|
426
447
|
|
427
|
-
|
448
|
+
.el-input {
|
428
449
|
flex: 1;
|
429
450
|
margin-left: 10px;
|
430
451
|
}
|
@@ -454,15 +475,17 @@ export default {
|
|
454
475
|
.selectableRange {
|
455
476
|
width: 100%;
|
456
477
|
|
457
|
-
|
478
|
+
.el-range-separator {
|
458
479
|
width: 20px;
|
459
480
|
}
|
460
481
|
}
|
461
482
|
|
462
|
-
.
|
463
|
-
|
464
|
-
|
465
|
-
|
483
|
+
.flexView {
|
484
|
+
display: flex;
|
485
|
+
align-items: center;
|
486
|
+
padding-bottom: 10px;
|
487
|
+
margin-bottom: 10px;
|
488
|
+
border-bottom: 1px solid #e1e1e1;
|
466
489
|
}
|
467
490
|
}
|
468
491
|
</style>
|
@@ -1,8 +1,5 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="widget-form-container" ref="formContainer">
|
3
|
-
<!-- <div v-if="data.list.length == 0" class="form-empty">
|
4
|
-
从左侧拖拽来添加字段
|
5
|
-
</div> -->
|
6
3
|
<th-empty
|
7
4
|
class="form-empty"
|
8
5
|
v-if="data.list.length == 0"
|
@@ -10,7 +7,7 @@
|
|
10
7
|
description="从左侧拖拽来添加字段"
|
11
8
|
></th-empty>
|
12
9
|
<el-form
|
13
|
-
:class="{
|
10
|
+
:class="{ isHideFormLabel: data.config.hideLabel }"
|
14
11
|
style="margin: 0 auto;padding:5px;height:100%;"
|
15
12
|
:style="{ width: formWidth }"
|
16
13
|
:size="data.config.size"
|
@@ -20,7 +17,7 @@
|
|
20
17
|
:disabled="data.config.disabled"
|
21
18
|
>
|
22
19
|
<draggable
|
23
|
-
|
20
|
+
class="draggable"
|
24
21
|
v-model="data.list"
|
25
22
|
v-bind="{
|
26
23
|
group: 'people',
|
@@ -28,16 +25,15 @@
|
|
28
25
|
animation: 200,
|
29
26
|
handle: '.drag-widget'
|
30
27
|
}"
|
31
|
-
@end="handleMoveEnd"
|
32
28
|
@add="handleWidgetAdd"
|
33
29
|
>
|
34
|
-
<transition-group name="fade" tag="div" class="
|
30
|
+
<transition-group name="fade" tag="div" class="draggable-list">
|
35
31
|
<widget-form-item
|
36
32
|
v-for="(element, elementIndex) in widgetList"
|
37
33
|
:key="element.key"
|
38
34
|
:widget="element"
|
35
|
+
:widgetArray="data.list"
|
39
36
|
:widgetIndex="elementIndex"
|
40
|
-
:widgetArray="data"
|
41
37
|
:config="data.config"
|
42
38
|
:select.sync="selectWidget"
|
43
39
|
></widget-form-item>
|
@@ -49,11 +45,10 @@
|
|
49
45
|
|
50
46
|
<script>
|
51
47
|
import Draggable from "vuedraggable";
|
52
|
-
import WidgetFormItem from "./WidgetFormItem";
|
53
|
-
import ThEmpty from "ui/Empty/index.vue";
|
48
|
+
import WidgetFormItem from "./WidgetFormItem.vue";
|
54
49
|
|
55
50
|
export default {
|
56
|
-
components: { Draggable, WidgetFormItem
|
51
|
+
components: { Draggable, WidgetFormItem },
|
57
52
|
props: ["data", "select", "client"],
|
58
53
|
data() {
|
59
54
|
return {
|
@@ -99,7 +94,6 @@ export default {
|
|
99
94
|
};
|
100
95
|
},
|
101
96
|
methods: {
|
102
|
-
handleMoveEnd({ newIndex, oldIndex }) {},
|
103
97
|
handleSelectWidget(index) {
|
104
98
|
this.selectWidget = this.data.list[index];
|
105
99
|
},
|
@@ -113,45 +107,10 @@ export default {
|
|
113
107
|
let dic = JSON.parse(JSON.stringify(this.data.list[newIndex]));
|
114
108
|
dic.key = key;
|
115
109
|
dic.model = dic.type + "_" + key;
|
116
|
-
dic.rules = [];
|
110
|
+
// dic.rules = [{ id: new Date().getTime(), patternStr: "", pattern: "" }];
|
117
111
|
|
118
112
|
this.$set(this.data.list, newIndex, dic);
|
119
113
|
|
120
|
-
// if (
|
121
|
-
// this.data.list[newIndex].type === "radio" ||
|
122
|
-
// this.data.list[newIndex].type === "checkbox" ||
|
123
|
-
// this.data.list[newIndex].type === "select"
|
124
|
-
// ) {
|
125
|
-
// this.$set(this.data.list, newIndex, {
|
126
|
-
// ...this.data.list[newIndex],
|
127
|
-
// options: {
|
128
|
-
// ...this.data.list[newIndex].options,
|
129
|
-
// options: this.data.list[newIndex].options.options.map(item => ({
|
130
|
-
// ...item
|
131
|
-
// }))
|
132
|
-
// }
|
133
|
-
// });
|
134
|
-
// }
|
135
|
-
|
136
|
-
// if (this.data.list[newIndex].type === "grid") {
|
137
|
-
// this.$set(
|
138
|
-
// this.data.list,
|
139
|
-
// newIndex,
|
140
|
-
// JSON.parse(JSON.stringify(this.data.list[newIndex]))
|
141
|
-
// );
|
142
|
-
// }
|
143
|
-
|
144
|
-
// if (this.data.list[newIndex].type === "tabs") {
|
145
|
-
// this.$set(this.data.list, newIndex, JSON.parse(JSON.stringify(this.data.list[newIndex])));
|
146
|
-
// }
|
147
|
-
|
148
|
-
// if (this.data.list[newIndex].type === "table") {
|
149
|
-
// this.$set(this.data.list, newIndex, {
|
150
|
-
// ...this.data.list[newIndex],
|
151
|
-
// list: this.data.list[newIndex].list.map(item => ({ ...item }))
|
152
|
-
// });
|
153
|
-
// }
|
154
|
-
|
155
114
|
this.selectWidget = this.data.list[newIndex];
|
156
115
|
}
|
157
116
|
}
|
@@ -1,11 +1,10 @@
|
|
1
1
|
<template>
|
2
2
|
<el-form-item
|
3
|
-
class="
|
3
|
+
class="widgetFormItem"
|
4
4
|
:class="{
|
5
5
|
active: selectWidget.model == widget.model,
|
6
|
-
|
7
|
-
|
8
|
-
'widget-col': ['grid', 'tabs', 'table', 'table_h5', 'alliance'].includes(
|
6
|
+
isRequired: widget.options.required,
|
7
|
+
isLayout: ['grid', 'tabs', 'table', 'tableH5', 'alliance'].includes(
|
9
8
|
widget.type
|
10
9
|
),
|
11
10
|
[`widget-form-list-${widget.type}`]: true,
|
@@ -14,10 +13,11 @@
|
|
14
13
|
:label="widget.options.hideLabel ? '' : widget.name"
|
15
14
|
:label-width="labelWidth"
|
16
15
|
:ref="widget.model"
|
17
|
-
@click.native.stop="
|
16
|
+
@click.native.stop="selectWidget = widget"
|
18
17
|
>
|
19
18
|
<component
|
20
19
|
:is="compsData[widget.type].content"
|
20
|
+
:value.sync="widget.options.defaultValue"
|
21
21
|
:widget="widget"
|
22
22
|
:config="config"
|
23
23
|
:select.sync="selectWidget"
|
@@ -32,20 +32,14 @@
|
|
32
32
|
'grid',
|
33
33
|
'tabs',
|
34
34
|
'table',
|
35
|
-
'
|
35
|
+
'tableH5',
|
36
36
|
'alliance'
|
37
37
|
].includes(widget.type)
|
38
38
|
}"
|
39
39
|
>
|
40
40
|
<div class="actions">
|
41
|
-
<i
|
42
|
-
|
43
|
-
@click.stop="handleWidgetClone(widgetIndex)"
|
44
|
-
></i>
|
45
|
-
<i
|
46
|
-
class="iconfont icon-trash"
|
47
|
-
@click.stop="handleWidgetDelete(widgetIndex)"
|
48
|
-
></i>
|
41
|
+
<i class="iconfont icon-icon_clone" @click.stop="handleWidgetClone"></i>
|
42
|
+
<i class="iconfont icon-trash" @click.stop="handleWidgetDelete"></i>
|
49
43
|
</div>
|
50
44
|
|
51
45
|
<div class="drag">
|
@@ -90,59 +84,69 @@ export default {
|
|
90
84
|
}
|
91
85
|
},
|
92
86
|
created() {
|
87
|
+
const devComponentsPath = {
|
88
|
+
grid: "grid_dev",
|
89
|
+
table: "table_dev",
|
90
|
+
tableH5: "tableH5_dev",
|
91
|
+
tabs: "tabs_dev",
|
92
|
+
blank: "blank_dev"
|
93
|
+
};
|
93
94
|
const keys = Object.keys(this.compsData);
|
94
95
|
for (const key of keys) {
|
95
|
-
|
96
|
+
if (devComponentsPath[key])
|
97
|
+
this.compsData[
|
98
|
+
key
|
99
|
+
].content = require(`./custom/items/${devComponentsPath[key]}`).default;
|
100
|
+
else
|
101
|
+
this.compsData[key].content = require(`./custom/items/${key}`).default;
|
96
102
|
}
|
97
103
|
},
|
98
104
|
mounted() {},
|
99
105
|
methods: {
|
100
|
-
|
101
|
-
this.
|
102
|
-
|
103
|
-
handleWidgetDelete(index) {
|
104
|
-
if (this.widgetArray.list.length - 1 === index) {
|
105
|
-
if (index === 0) {
|
106
|
+
handleWidgetDelete() {
|
107
|
+
if (this.widgetArray.length - 1 === this.widgetIndex) {
|
108
|
+
if (this.widgetIndex === 0) {
|
106
109
|
this.selectWidget = {};
|
107
110
|
} else {
|
108
|
-
this.selectWidget = this.widgetArray.
|
111
|
+
this.selectWidget = this.widgetArray[this.widgetIndex - 1];
|
109
112
|
}
|
110
113
|
} else {
|
111
|
-
this.selectWidget = this.widgetArray.
|
114
|
+
this.selectWidget = this.widgetArray[this.widgetIndex + 1];
|
112
115
|
}
|
113
116
|
|
114
117
|
this.$nextTick(() => {
|
115
|
-
this.widgetArray.
|
118
|
+
this.widgetArray.splice(this.widgetIndex, 1);
|
116
119
|
});
|
117
120
|
},
|
118
121
|
|
119
|
-
handleWidgetClone(
|
120
|
-
const data = JSON.parse(
|
122
|
+
handleWidgetClone() {
|
123
|
+
const data = JSON.parse(
|
124
|
+
JSON.stringify(this.widgetArray[this.widgetIndex])
|
125
|
+
);
|
121
126
|
|
122
127
|
const initKey = item => {
|
123
|
-
const key =
|
124
|
-
|
125
|
-
|
126
|
-
Math.ceil(Math.random() * 99999);
|
128
|
+
const key = `${Date.parse(new Date().toString())}_${Math.ceil(
|
129
|
+
Math.random() * 99999
|
130
|
+
)}`;
|
127
131
|
|
128
|
-
item.options.remoteFunc = `func__${key}`;
|
129
132
|
item.key = key;
|
130
|
-
item.
|
133
|
+
item.options.remoteFunc = `func__${key}`;
|
134
|
+
item.model = `${item.type}_${key}`;
|
131
135
|
|
132
|
-
if (["table", "
|
136
|
+
if (["table", "tableH5"].includes(item.type)) {
|
133
137
|
item.list.forEach(element => {
|
134
138
|
initKey(element);
|
135
139
|
});
|
136
140
|
}
|
137
141
|
if (["tabs"].includes(item.type)) {
|
138
|
-
item.
|
142
|
+
item.options.columns.forEach(tab => {
|
139
143
|
tab.forEach(element => {
|
140
144
|
initKey(element);
|
141
145
|
});
|
142
146
|
});
|
143
147
|
}
|
144
148
|
if (["grid"].includes(item.type)) {
|
145
|
-
item.columns.forEach(column => {
|
149
|
+
item.options.columns.forEach(column => {
|
146
150
|
column.list.forEach(element => {
|
147
151
|
initKey(element);
|
148
152
|
});
|
@@ -151,36 +155,8 @@ export default {
|
|
151
155
|
};
|
152
156
|
initKey(data);
|
153
157
|
|
154
|
-
|
155
|
-
|
156
|
-
// options: {
|
157
|
-
// ...this.widgetArray.list[index].options,
|
158
|
-
// remoteFunc: "func_" + key
|
159
|
-
// },
|
160
|
-
// key,
|
161
|
-
// model: this.widgetArray.list[index].type + "_" + key,
|
162
|
-
// rules: this.widgetArray.list[index].rules || []
|
163
|
-
// };
|
164
|
-
|
165
|
-
// if (
|
166
|
-
// this.widgetArray.list[index].type === "radio" ||
|
167
|
-
// this.widgetArray.list[index].type === "checkbox" ||
|
168
|
-
// this.widgetArray.list[index].type === "select"
|
169
|
-
// ) {
|
170
|
-
// cloneData = {
|
171
|
-
// ...cloneData,
|
172
|
-
// options: {
|
173
|
-
// ...cloneData.options,
|
174
|
-
// options: cloneData.options.options.map(item => ({ ...item }))
|
175
|
-
// }
|
176
|
-
// };
|
177
|
-
// }
|
178
|
-
|
179
|
-
this.widgetArray.list.splice(index, 0, data);
|
180
|
-
|
181
|
-
this.$nextTick(() => {
|
182
|
-
this.selectWidget = this.widgetArray.list[index + 1];
|
183
|
-
});
|
158
|
+
this.widgetArray.splice(this.widgetIndex, 0, data);
|
159
|
+
this.selectWidget = data;
|
184
160
|
}
|
185
161
|
}
|
186
162
|
};
|