tianheng-ui 0.1.69 → 0.1.71
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/theme-chalk/styles/dialog.scss +56 -40
- package/lib/theme-chalk/styles/feature.scss +7 -0
- package/lib/tianheng-ui.js +12 -12
- package/package.json +1 -1
- package/packages/Dialog/index.vue +18 -9
- package/packages/FormMaking/GenerateForm.vue +27 -42
- package/packages/FormMaking/GenerateFormItem.vue +10 -26
- package/packages/FormMaking/WidgetFormItem.vue +9 -7
- package/packages/FormMaking/WidgetGuide.vue +86 -0
- package/packages/FormMaking/WidgetSelect.vue +2 -2
- package/packages/FormMaking/WidgetTools.vue +10 -6
- package/packages/FormMaking/custom/config.js +2 -31
- package/packages/FormMaking/custom/configs/list.vue +11 -12
- package/packages/FormMaking/custom/configs/radio.vue +2 -5
- package/packages/FormMaking/custom/configs/table.vue +12 -9
- package/packages/FormMaking/custom/configs/tabs.vue +69 -55
- package/packages/FormMaking/custom/index.js +1 -1
- package/packages/FormMaking/custom/items/grid_dev.vue +5 -8
- package/packages/FormMaking/custom/items/list_dev.vue +19 -23
- package/packages/FormMaking/custom/items/list_pro.vue +16 -14
- package/packages/FormMaking/custom/items/table_dev.vue +13 -12
- package/packages/FormMaking/custom/items/table_pro.vue +5 -5
- package/packages/FormMaking/custom/items/tabs_dev.vue +4 -7
- package/packages/FormMaking/custom/items/tabs_pro.vue +7 -9
- package/packages/FormMaking/index.vue +62 -76
- package/packages/FormMaking/styles/index.scss +1 -1
- package/packages/Icons/index.js +886 -1
- package/packages/Icons/index.vue +53 -306
- package/packages/TableMaking/index.vue +18 -3
- package/packages/TableMaking/widgetGuide.vue +122 -58
- package/packages/FormMaking/custom/configs/tableH5.vue +0 -98
- package/packages/FormMaking/custom/items/tableH5_dev.vue +0 -112
- package/packages/FormMaking/custom/items/tableH5_pro.vue +0 -119
package/package.json
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
<template>
|
2
2
|
<el-dialog
|
3
|
-
class="
|
4
|
-
|
3
|
+
:class="
|
4
|
+
`th-dialog ${customClass} ${showFooter ? '' : 'th-dialog_hideFooter'}`
|
5
|
+
"
|
5
6
|
:visible.sync="visible"
|
6
7
|
:width="width"
|
7
8
|
:top="top"
|
@@ -15,18 +16,24 @@
|
|
15
16
|
:before-close="handleBeforeClose"
|
16
17
|
:destroy-on-close="destroyOnClose"
|
17
18
|
>
|
18
|
-
<div slot="title" class="th-
|
19
|
-
<div
|
20
|
-
|
19
|
+
<div slot="title" class="th-dialog_header">
|
20
|
+
<div
|
21
|
+
:class="
|
22
|
+
`th-dialog_title ${titleCenter ? 'th-dialog_title__center' : ''}`
|
23
|
+
"
|
24
|
+
>
|
25
|
+
{{ title }}
|
26
|
+
</div>
|
27
|
+
<div class="th-dialog_action">
|
21
28
|
<i
|
22
29
|
v-if="showFullscreen"
|
23
|
-
class="th-
|
30
|
+
class="th-dialog_action_item fullscreen th-animation_button__hover"
|
24
31
|
:class="fullscreenIcon"
|
25
32
|
@click="handleFullscreenChange"
|
26
33
|
></i>
|
27
34
|
<i
|
28
35
|
v-if="showClose"
|
29
|
-
class="th-
|
36
|
+
class="th-dialog_action_item close th-animation_button__hover"
|
30
37
|
:class="closeIcon"
|
31
38
|
@click="handleBeforeClose"
|
32
39
|
></i>
|
@@ -41,11 +48,12 @@
|
|
41
48
|
<el-button
|
42
49
|
v-if="showAffirm"
|
43
50
|
type="primary"
|
51
|
+
size="small"
|
44
52
|
:loading="affirmLoading"
|
45
53
|
@click="handleAffirm"
|
46
54
|
>{{ affirmText }}</el-button
|
47
55
|
>
|
48
|
-
<el-button v-if="showCancel" @click="handleClose">{{
|
56
|
+
<el-button v-if="showCancel" size="small" @click="handleClose">{{
|
49
57
|
cancelText
|
50
58
|
}}</el-button>
|
51
59
|
</template>
|
@@ -61,8 +69,9 @@ export default {
|
|
61
69
|
},
|
62
70
|
props: {
|
63
71
|
visible: Boolean,
|
64
|
-
title: { type: String, default: "" },
|
65
72
|
width: { type: String, default: "800px" },
|
73
|
+
title: { type: String, default: "" },
|
74
|
+
titleCenter: { type: Boolean, default: false },
|
66
75
|
fullscreen: { type: Boolean, default: false },
|
67
76
|
top: { type: String, default: "15vh" },
|
68
77
|
modal: { type: Boolean, default: true },
|
@@ -4,11 +4,11 @@
|
|
4
4
|
class="generateForm"
|
5
5
|
:class="{ isHideLabel: formConfig.config.hideLabel }"
|
6
6
|
:style="{ width: formConfig.config.width }"
|
7
|
-
:label-suffix="formConfig.config.labelSuffix"
|
8
|
-
:size="formConfig.config.size"
|
9
7
|
:model="models"
|
8
|
+
:label-suffix="formConfig.config.labelSuffix"
|
10
9
|
:label-position="formConfig.config.labelPosition"
|
11
10
|
:label-width="formConfig.config.labelWidth + 'px'"
|
11
|
+
:size="formConfig.config.size"
|
12
12
|
ref="generateForm"
|
13
13
|
>
|
14
14
|
<genetate-form-item
|
@@ -110,7 +110,7 @@ export default {
|
|
110
110
|
this.showForm = true;
|
111
111
|
},
|
112
112
|
methods: {
|
113
|
-
generateModle(genList, modelObj
|
113
|
+
generateModle(genList, modelObj) {
|
114
114
|
if (!genList) return;
|
115
115
|
genList.map(item => {
|
116
116
|
if (item.type === "grid") {
|
@@ -134,28 +134,25 @@ export default {
|
|
134
134
|
dic[item2.value] = {};
|
135
135
|
this.generateModle(item2.list, dic[item2.value]);
|
136
136
|
});
|
137
|
-
} else if (item.type === "table" || item.type === "
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
137
|
+
} else if (item.type === "table" || item.type === "list") {
|
138
|
+
!item.options.defaultValue && (item.options.defaultValue = []);
|
139
|
+
modelObj[item.model] = deepClone(item.options.defaultValue);
|
140
|
+
this.generateModle(item.options.columns);
|
141
|
+
} else if (item.type === "blank" && modelObj) {
|
142
|
+
const value =
|
143
|
+
getProperty(this.value, item.model) ||
|
144
|
+
{ String: "", Object: {}, Array: [] }[item.options.defaultType];
|
145
|
+
// setProperty(modelObj, item.model, value);
|
146
|
+
this.$set(modelObj, item.model, value);
|
147
|
+
this.generateRules(item);
|
148
|
+
} else if (modelObj) {
|
149
|
+
const value =
|
150
|
+
getProperty(this.value, item.model) ||
|
151
|
+
JSON.parse(JSON.stringify(item.options.defaultValue));
|
152
|
+
// setProperty(modelObj, item.model, value);
|
153
|
+
this.$set(modelObj, item.model, value);
|
151
154
|
this.generateRules(item);
|
152
155
|
} else {
|
153
|
-
// const value = this.value ? eval(`this.value.${item.model}`) : "";
|
154
|
-
const value = this.value[item.model];
|
155
|
-
const defaultValue = JSON.parse(
|
156
|
-
JSON.stringify(item.options.defaultValue)
|
157
|
-
);
|
158
|
-
this.$set(modelObj, item.model, value || defaultValue);
|
159
156
|
this.generateRules(item);
|
160
157
|
}
|
161
158
|
});
|
@@ -172,13 +169,13 @@ export default {
|
|
172
169
|
item.rules = [];
|
173
170
|
}
|
174
171
|
// 配置必填项校验
|
175
|
-
if (item.options.required) {
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
}
|
172
|
+
// if (item.options.required) {
|
173
|
+
// item.rules.push({
|
174
|
+
// required: true,
|
175
|
+
// message: "必需项",
|
176
|
+
// trigger: "change"
|
177
|
+
// });
|
178
|
+
// }
|
182
179
|
this.hendleElementRemoteData(item);
|
183
180
|
},
|
184
181
|
// 获取组件的远端数据
|
@@ -386,17 +383,5 @@ export default {
|
|
386
383
|
margin-left: 0 !important;
|
387
384
|
}
|
388
385
|
}
|
389
|
-
|
390
|
-
.tableH5 {
|
391
|
-
// 操作按钮布局
|
392
|
-
.tableH5-item > div {
|
393
|
-
display: flex;
|
394
|
-
|
395
|
-
.actions {
|
396
|
-
align-items: center;
|
397
|
-
justify-content: right;
|
398
|
-
}
|
399
|
-
}
|
400
|
-
}
|
401
386
|
}
|
402
387
|
</style>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
:label="widget.options.hideLabel ? '' : widget.name"
|
9
9
|
:label-width="labelWidth"
|
10
10
|
:prop="pModel ? `${pModel}.${widget.model}` : widget.model"
|
11
|
-
:rules="
|
11
|
+
:rules="getRules"
|
12
12
|
:ref="widget.model"
|
13
13
|
>
|
14
14
|
<component
|
@@ -31,9 +31,7 @@
|
|
31
31
|
|
32
32
|
<script>
|
33
33
|
import { deepClone } from "./util/index";
|
34
|
-
import { VueEditor } from "vue2-editor";
|
35
34
|
import compsData from "./custom/register";
|
36
|
-
import FmUpload from "./Upload";
|
37
35
|
|
38
36
|
export default {
|
39
37
|
name: "generate-form-item",
|
@@ -46,12 +44,10 @@ export default {
|
|
46
44
|
"config",
|
47
45
|
"componentsData"
|
48
46
|
],
|
49
|
-
components: { FmUpload, VueEditor },
|
50
47
|
data() {
|
51
48
|
return {
|
52
49
|
compsData: deepClone(compsData),
|
53
50
|
dataModel: this.model
|
54
|
-
// dataModel: this.models[this.widget.model]
|
55
51
|
};
|
56
52
|
},
|
57
53
|
watch: {
|
@@ -60,26 +56,7 @@ export default {
|
|
60
56
|
},
|
61
57
|
dataModel(val) {
|
62
58
|
this.$emit("update:model", val);
|
63
|
-
}
|
64
|
-
// dataModel: {
|
65
|
-
// deep: true,
|
66
|
-
// handler(val) {
|
67
|
-
// console.log("watch dataModel =>", val);
|
68
|
-
// this.models[this.widget.model] = val;
|
69
|
-
// this.$emit("update:models", {
|
70
|
-
// ...this.models,
|
71
|
-
// [this.widget.model]: val
|
72
|
-
// });
|
73
|
-
// this.$emit("input-change", val, this.widget.model);
|
74
|
-
// }
|
75
|
-
// },
|
76
|
-
// models: {
|
77
|
-
// deep: true,
|
78
|
-
// handler(val) {
|
79
|
-
// console.log("watch models =>", val);
|
80
|
-
// this.dataModel = val[this.widget.model];
|
81
|
-
// }
|
82
|
-
// }
|
59
|
+
}
|
83
60
|
},
|
84
61
|
computed: {
|
85
62
|
labelWidth() {
|
@@ -88,13 +65,20 @@ export default {
|
|
88
65
|
return `${this.widget.options.labelWidth}px`;
|
89
66
|
|
90
67
|
return "";
|
68
|
+
},
|
69
|
+
getRules() {
|
70
|
+
return this.widget.options.required
|
71
|
+
? [
|
72
|
+
...this.widget.rules,
|
73
|
+
{ required: true, message: "必需项", trigger: "change" }
|
74
|
+
]
|
75
|
+
: this.widget.rules;
|
91
76
|
}
|
92
77
|
},
|
93
78
|
created() {
|
94
79
|
const proComponentsPath = {
|
95
80
|
grid: "grid_pro",
|
96
81
|
table: "table_pro",
|
97
|
-
tableH5: "tableH5_pro",
|
98
82
|
list: "list_pro",
|
99
83
|
tabs: "tabs_pro",
|
100
84
|
blank: "blank_pro"
|
@@ -61,7 +61,7 @@ export default {
|
|
61
61
|
return {
|
62
62
|
compsData: deepClone(compsData),
|
63
63
|
selectWidget: this.select,
|
64
|
-
layoutElements: ["grid", "tabs", "table", "
|
64
|
+
layoutElements: ["grid", "tabs", "table", "list", "alliance"]
|
65
65
|
};
|
66
66
|
},
|
67
67
|
watch: {
|
@@ -88,7 +88,6 @@ export default {
|
|
88
88
|
const devComponentsPath = {
|
89
89
|
grid: "grid_dev",
|
90
90
|
table: "table_dev",
|
91
|
-
tableH5: "tableH5_dev",
|
92
91
|
list: "list_dev",
|
93
92
|
tabs: "tabs_dev",
|
94
93
|
blank: "blank_dev"
|
@@ -128,12 +127,11 @@ export default {
|
|
128
127
|
const key = `${Date.parse(new Date().toString())}_${Math.ceil(
|
129
128
|
Math.random() * 99999
|
130
129
|
)}`;
|
131
|
-
|
132
130
|
item.key = key;
|
133
131
|
item.model = `${item.type}_${key}`;
|
134
132
|
|
135
|
-
if (["table", "
|
136
|
-
item.
|
133
|
+
if (["table", "list"].includes(item.type)) {
|
134
|
+
item.options.columns.forEach(element => {
|
137
135
|
initKey(element);
|
138
136
|
});
|
139
137
|
}
|
@@ -154,8 +152,12 @@ export default {
|
|
154
152
|
};
|
155
153
|
initKey(data);
|
156
154
|
|
157
|
-
|
158
|
-
this.
|
155
|
+
// 追加在最后
|
156
|
+
this.widgetArray.push(data);
|
157
|
+
|
158
|
+
// 追加在当前组件前
|
159
|
+
// this.widgetArray.splice(this.widgetIndex, 0, data);
|
160
|
+
// this.selectWidget = data;
|
159
161
|
}
|
160
162
|
}
|
161
163
|
};
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="widgetGuide">
|
3
|
+
<el-steps :active="step" finish-status="success" simple>
|
4
|
+
<el-step title="表单配置" icon="el-icon-s-operation" description="">
|
5
|
+
</el-step>
|
6
|
+
<el-step title="按钮配置" icon="el-icon-set-up" description=""></el-step>
|
7
|
+
</el-steps>
|
8
|
+
<div class="content">
|
9
|
+
<div v-show="step === 0">
|
10
|
+
<div>你好</div>
|
11
|
+
<div>让我们来了解一些基本信息</div>
|
12
|
+
</div>
|
13
|
+
<div v-show="step === 1"></div>
|
14
|
+
</div>
|
15
|
+
<div class="footer">
|
16
|
+
<div></div>
|
17
|
+
<div class="stepView">
|
18
|
+
<el-button
|
19
|
+
type="primary"
|
20
|
+
icon="el-icon-back"
|
21
|
+
size="small"
|
22
|
+
:disabled="step === 0"
|
23
|
+
@click="handleBack"
|
24
|
+
>上一步</el-button
|
25
|
+
>
|
26
|
+
<el-button type="primary" size="small" @click="handleNext"
|
27
|
+
>下一步<i class="el-icon-right el-icon--right"></i
|
28
|
+
></el-button>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</template>
|
33
|
+
|
34
|
+
<script>
|
35
|
+
export default {
|
36
|
+
props: { visible: { type: Boolean, default: true } },
|
37
|
+
data() {
|
38
|
+
return {
|
39
|
+
show: this.visible,
|
40
|
+
step: 0
|
41
|
+
};
|
42
|
+
},
|
43
|
+
watch: {
|
44
|
+
visible(val) {
|
45
|
+
this.show = val;
|
46
|
+
},
|
47
|
+
show(val) {
|
48
|
+
this.$emit("update:visible", val);
|
49
|
+
}
|
50
|
+
},
|
51
|
+
created() {},
|
52
|
+
mounted() {},
|
53
|
+
methods: {
|
54
|
+
handleBack() {
|
55
|
+
this.step--;
|
56
|
+
},
|
57
|
+
handleNext() {
|
58
|
+
this.step++;
|
59
|
+
},
|
60
|
+
handleClose() {
|
61
|
+
this.show = !this.show;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
};
|
65
|
+
</script>
|
66
|
+
|
67
|
+
<style lang="scss" scoped>
|
68
|
+
.widgetGuide {
|
69
|
+
width: 100%;
|
70
|
+
height: 100%;
|
71
|
+
|
72
|
+
.content {
|
73
|
+
height: calc(100% - 50px);
|
74
|
+
}
|
75
|
+
.footer {
|
76
|
+
height: 50px;
|
77
|
+
display: flex;
|
78
|
+
align-items: center;
|
79
|
+
justify-content: space-between;
|
80
|
+
box-sizing: border-box;
|
81
|
+
|
82
|
+
.stepView {
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
</style>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
'grid',
|
8
8
|
'tabs',
|
9
9
|
'table',
|
10
|
-
'
|
10
|
+
'list',
|
11
11
|
'alliance'
|
12
12
|
].includes(widget.type)
|
13
13
|
}"
|
@@ -74,7 +74,7 @@ export default {
|
|
74
74
|
item.key = key;
|
75
75
|
item.model = `${item.type}_${key}`;
|
76
76
|
|
77
|
-
if (["table", "
|
77
|
+
if (["table", "list"].includes(item.type)) {
|
78
78
|
item.list.forEach(element => {
|
79
79
|
initKey(element);
|
80
80
|
});
|
@@ -176,8 +176,10 @@
|
|
176
176
|
</div>
|
177
177
|
</generate-form>
|
178
178
|
<template slot="footer">
|
179
|
-
<el-button type="primary" @click="handleGetData"
|
180
|
-
|
179
|
+
<el-button type="primary" size="small" @click="handleGetData"
|
180
|
+
>获取数据</el-button
|
181
|
+
>
|
182
|
+
<el-button size="small" @click="handleReset">重置</el-button>
|
181
183
|
</template>
|
182
184
|
</template>
|
183
185
|
<template v-if="dialog.action === 'previewH5'">
|
@@ -198,8 +200,10 @@
|
|
198
200
|
</generate-form>
|
199
201
|
</div>
|
200
202
|
<template slot="footer">
|
201
|
-
<el-button type="primary" @click="handleGetData"
|
202
|
-
|
203
|
+
<el-button type="primary" size="small" @click="handleGetData"
|
204
|
+
>获取数据</el-button
|
205
|
+
>
|
206
|
+
<el-button size="small" @click="handleReset">重置</el-button>
|
203
207
|
</template>
|
204
208
|
</template>
|
205
209
|
</th-dialog>
|
@@ -477,11 +481,11 @@ export default {
|
|
477
481
|
item.options.columns.forEach(e => {
|
478
482
|
initList(e.list);
|
479
483
|
});
|
480
|
-
} else if (item.type === "table" || item.type === "
|
484
|
+
} else if (item.type === "table" || item.type === "list") {
|
481
485
|
initList(item.options.columns);
|
482
486
|
} else if (item.type === "workflow") {
|
483
487
|
initList(item.options.buttons);
|
484
|
-
}
|
488
|
+
} else if (item.options.remote?.open || item.options.remote?.api) {
|
485
489
|
fieldsApi[item.model || item.name] = item.options.remote.api;
|
486
490
|
}
|
487
491
|
}
|
@@ -602,7 +602,7 @@ export const advanceComponents = [
|
|
602
602
|
icon: "th-icon-insertrowabove",
|
603
603
|
options: {
|
604
604
|
height: "",
|
605
|
-
defaultValue:
|
605
|
+
defaultValue: [],
|
606
606
|
columns: [],
|
607
607
|
customClass: "",
|
608
608
|
labelWidth: 100,
|
@@ -628,39 +628,10 @@ export const advanceComponents = [
|
|
628
628
|
events: {},
|
629
629
|
rules: []
|
630
630
|
},
|
631
|
-
{
|
632
|
-
name: "子表格H5",
|
633
|
-
type: "tableH5",
|
634
|
-
icon: "th-icon-insertrowleft",
|
635
|
-
options: {
|
636
|
-
defaultValue: "",
|
637
|
-
columns: [],
|
638
|
-
customClass: "",
|
639
|
-
labelWidth: 100,
|
640
|
-
isLabelWidth: false,
|
641
|
-
dataBind: true,
|
642
|
-
validatorCheck: false,
|
643
|
-
validator: "",
|
644
|
-
paging: false,
|
645
|
-
pageSize: 5,
|
646
|
-
tableColumn: false,
|
647
|
-
hidden: false,
|
648
|
-
hideLabel: false,
|
649
|
-
disabled: false,
|
650
|
-
required: false,
|
651
|
-
isAdd: true,
|
652
|
-
addButtonText: "新增",
|
653
|
-
isDelete: true,
|
654
|
-
deleteButtonText: "删除",
|
655
|
-
deleteIndex: 0 // 可删除的最小索引
|
656
|
-
},
|
657
|
-
events: {},
|
658
|
-
rules: []
|
659
|
-
},
|
660
631
|
{
|
661
632
|
name: "子列表",
|
662
633
|
type: "list",
|
663
|
-
icon: "th-icon-
|
634
|
+
icon: "th-icon-insertrowleft",
|
664
635
|
options: {
|
665
636
|
defaultValue: [],
|
666
637
|
columns: [],
|
@@ -25,12 +25,17 @@
|
|
25
25
|
<el-form-item label-width="0">
|
26
26
|
<div class="config-header">
|
27
27
|
<span class="title">默认值</span>
|
28
|
-
<
|
28
|
+
<div class="value">
|
29
|
+
<el-button type="text" @click="handleAddData">添加数据</el-button>
|
30
|
+
<el-button type="text" @click="widget.options.defaultValue = []"
|
31
|
+
>重置</el-button
|
32
|
+
>
|
33
|
+
</div>
|
29
34
|
</div>
|
30
|
-
<code-editor
|
35
|
+
<th-code-editor
|
31
36
|
v-model="widget.options.defaultValue"
|
32
37
|
language="json"
|
33
|
-
></code-editor>
|
38
|
+
></th-code-editor>
|
34
39
|
</el-form-item>
|
35
40
|
|
36
41
|
<el-form-item label="新增按钮">
|
@@ -64,18 +69,15 @@
|
|
64
69
|
<script>
|
65
70
|
import Draggable from "vuedraggable";
|
66
71
|
import { configComponent } from "../mixins";
|
67
|
-
import CodeEditor from "ui/CodeEditor/index.vue";
|
68
72
|
export default {
|
69
73
|
components: {
|
70
|
-
Draggable
|
71
|
-
CodeEditor
|
74
|
+
Draggable
|
72
75
|
},
|
73
|
-
props: {},
|
74
76
|
mixins: [configComponent],
|
77
|
+
props: {},
|
75
78
|
mounted() {},
|
76
79
|
methods: {
|
77
80
|
handleAddData() {
|
78
|
-
let defaultValue = JSON.parse(this.widget.options.defaultValue || "[]");
|
79
81
|
let dic = {};
|
80
82
|
this.widget.options.columns.forEach(item => {
|
81
83
|
if (item.type === "grid") {
|
@@ -90,11 +92,8 @@ export default {
|
|
90
92
|
dic[item.model] = item.options.defaultValue;
|
91
93
|
}
|
92
94
|
});
|
93
|
-
defaultValue.push(dic);
|
94
|
-
this.widget.options.defaultValue = JSON.stringify(defaultValue, null, 2);
|
95
|
+
this.widget.options.defaultValue.push(dic);
|
95
96
|
}
|
96
97
|
}
|
97
98
|
};
|
98
99
|
</script>
|
99
|
-
|
100
|
-
<style lang="scss" scoped></style>
|
@@ -76,15 +76,12 @@
|
|
76
76
|
>
|
77
77
|
<div slot="prepend">标签</div>
|
78
78
|
</el-input>
|
79
|
-
<el-input
|
80
|
-
style="margin-bottom:5px;"
|
81
|
-
v-model="widget.options.remote.props.children"
|
82
|
-
>
|
79
|
+
<el-input v-model="widget.options.remote.props.children">
|
83
80
|
<div slot="prepend">子选项</div>
|
84
81
|
</el-input>
|
85
82
|
</template>
|
86
83
|
<template v-else>
|
87
|
-
<el-radio-group
|
84
|
+
<el-radio-group v-model="widget.options.defaultValue">
|
88
85
|
<draggable
|
89
86
|
:list="widget.options.options"
|
90
87
|
v-bind="{
|
@@ -20,15 +20,20 @@
|
|
20
20
|
</div>
|
21
21
|
</el-form-item>
|
22
22
|
|
23
|
-
<el-form-item>
|
24
|
-
<div class="config-header"
|
23
|
+
<el-form-item label-width="0">
|
24
|
+
<div class="config-header">
|
25
25
|
<span class="title">默认值</span>
|
26
|
-
<
|
26
|
+
<div class="value">
|
27
|
+
<el-button type="text" @click="handleAddData">添加数据</el-button>
|
28
|
+
<el-button type="text" @click="widget.options.defaultValue = []"
|
29
|
+
>重置</el-button
|
30
|
+
>
|
31
|
+
</div>
|
27
32
|
</div>
|
28
|
-
<code-editor
|
33
|
+
<th-code-editor
|
29
34
|
v-model="widget.options.defaultValue"
|
30
35
|
language="json"
|
31
|
-
></code-editor>
|
36
|
+
></th-code-editor>
|
32
37
|
</el-form-item>
|
33
38
|
|
34
39
|
<!-- <el-form-item label="高度">
|
@@ -76,9 +81,8 @@ export default {
|
|
76
81
|
mounted() {},
|
77
82
|
methods: {
|
78
83
|
handleAddData() {
|
79
|
-
let defaultValue = JSON.parse(this.widget.options.defaultValue || "[]");
|
80
84
|
let dic = {};
|
81
|
-
this.widget.
|
85
|
+
this.widget.options.columns.forEach(item => {
|
82
86
|
if (item.type === "grid") {
|
83
87
|
for (let i = 0; i < item.options.columns.length; i++) {
|
84
88
|
const element = item.options.columns[i];
|
@@ -91,8 +95,7 @@ export default {
|
|
91
95
|
dic[item.model] = item.options.defaultValue;
|
92
96
|
}
|
93
97
|
});
|
94
|
-
defaultValue.push(dic);
|
95
|
-
this.widget.options.defaultValue = JSON.stringify(defaultValue, null, 2);
|
98
|
+
this.widget.options.defaultValue.push(dic);
|
96
99
|
}
|
97
100
|
}
|
98
101
|
};
|