tianheng-ui 0.1.28 → 0.1.30
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/tianheng-ui.js +13 -13
- package/package.json +1 -1
- package/packages/FormMaking/FormConfig.vue +12 -4
- package/packages/FormMaking/WidgetConfig.vue +3 -1
- package/packages/FormMaking/custom/config.js +1 -1
- package/packages/FormMaking/custom/configs/button.vue +1 -1
- package/packages/FormMaking/custom/configs/cascader.vue +1 -1
- package/packages/FormMaking/custom/configs/checkbox.vue +1 -1
- package/packages/FormMaking/custom/configs/radio.vue +1 -1
- package/packages/FormMaking/custom/configs/select.vue +1 -1
- package/packages/FormMaking/custom/configs/tabs.vue +1 -1
- package/packages/FormMaking/custom/configs/upload.vue +1 -1
- package/packages/FormMaking/custom/mixins/index.js +1 -6
- package/packages/FormMaking/index.vue +26 -15
- package/packages/TableMaking/WidgetTools.vue +10 -2
- package/packages/TableMaking/custom/config.js +38 -32
- package/packages/TableMaking/custom/items/search/index.vue +79 -121
- package/packages/TableMaking/custom/items/table/index.vue +43 -0
- package/packages/TableMaking/custom/items/tools/index.vue +21 -15
- package/packages/TableMaking/generateTable.vue +45 -43
- package/packages/TableMaking/widgetConfig.vue +19 -8
- package/packages/TableMaking/widgetTable.vue +3 -5
package/package.json
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
@change="handleFieldsApiChange"
|
47
47
|
>
|
48
48
|
<el-option
|
49
|
-
v-for="item in
|
49
|
+
v-for="item in Object.values(apiConfig)"
|
50
50
|
:key="item.id"
|
51
51
|
:label="item.label"
|
52
52
|
:value="item.id"
|
@@ -80,7 +80,15 @@
|
|
80
80
|
</el-collapse-item>
|
81
81
|
|
82
82
|
<el-collapse-item title="数据配置" name="group-resultData">
|
83
|
-
<el-form-item
|
83
|
+
<el-form-item>
|
84
|
+
<el-tooltip
|
85
|
+
slot="label"
|
86
|
+
effect="dark"
|
87
|
+
content="一般用于编辑和详情的数据回显"
|
88
|
+
placement="top"
|
89
|
+
>
|
90
|
+
<span style="color: #409EFF;">数据回填</span>
|
91
|
+
</el-tooltip>
|
84
92
|
<el-select
|
85
93
|
v-model="config.mounted.api"
|
86
94
|
value-key="id"
|
@@ -89,7 +97,7 @@
|
|
89
97
|
no-data-text="暂无接口,请前往【接口模块】创建"
|
90
98
|
>
|
91
99
|
<el-option
|
92
|
-
v-for="item in
|
100
|
+
v-for="item in Object.values(apiConfig)"
|
93
101
|
:key="item.id"
|
94
102
|
:label="item.label"
|
95
103
|
:value="item.id"
|
@@ -127,7 +135,7 @@
|
|
127
135
|
|
128
136
|
<script>
|
129
137
|
export default {
|
130
|
-
props: ["config", "
|
138
|
+
props: ["config", "apiConfig"],
|
131
139
|
data() {
|
132
140
|
return {
|
133
141
|
collapseValue: [
|
@@ -79,6 +79,7 @@
|
|
79
79
|
:widget="data"
|
80
80
|
:config="config"
|
81
81
|
:fields="fields"
|
82
|
+
:apiConfig="apiConfig"
|
82
83
|
:is="compsData[data.type].content"
|
83
84
|
@events-show="handleEventDialogShow"
|
84
85
|
@events-edit="handleEventsCollapseClick"
|
@@ -257,7 +258,8 @@ export default {
|
|
257
258
|
return {};
|
258
259
|
}
|
259
260
|
},
|
260
|
-
fields: Array
|
261
|
+
fields: Array,
|
262
|
+
apiConfig: Object
|
261
263
|
},
|
262
264
|
data() {
|
263
265
|
return {
|
@@ -152,13 +152,14 @@
|
|
152
152
|
:data="widgetFormSelect"
|
153
153
|
:config="formConfig.config"
|
154
154
|
:fields="fields"
|
155
|
+
:apiConfig="apiConfig"
|
155
156
|
@update="handleWidgetConfigUpdate"
|
156
157
|
>
|
157
158
|
</widget-config>
|
158
159
|
<form-config
|
159
160
|
v-if="configTab == 'form'"
|
160
161
|
:config="formConfig.config"
|
161
|
-
:
|
162
|
+
:apiConfig="apiConfig"
|
162
163
|
@fieldsChange="handleFieldsChange"
|
163
164
|
ref="formConfigRef"
|
164
165
|
></form-config>
|
@@ -205,6 +206,7 @@ export default {
|
|
205
206
|
return {};
|
206
207
|
}
|
207
208
|
},
|
209
|
+
apiOptions: Array,
|
208
210
|
permissions: {
|
209
211
|
type: Array,
|
210
212
|
default: () => [
|
@@ -248,8 +250,7 @@ export default {
|
|
248
250
|
layoutFields: {
|
249
251
|
type: Array,
|
250
252
|
default: () => ["grid", "filler", "divider"]
|
251
|
-
}
|
252
|
-
apiOptions: Array
|
253
|
+
}
|
253
254
|
},
|
254
255
|
data() {
|
255
256
|
this.basicComponents = basicComponents;
|
@@ -262,7 +263,8 @@ export default {
|
|
262
263
|
widgetValue: {},
|
263
264
|
configTab: "form",
|
264
265
|
client: "monitor",
|
265
|
-
fields: []
|
266
|
+
fields: [],
|
267
|
+
apiConfig: {}
|
266
268
|
};
|
267
269
|
},
|
268
270
|
computed: {
|
@@ -295,12 +297,13 @@ export default {
|
|
295
297
|
config(val) {
|
296
298
|
this.setConfig(val);
|
297
299
|
},
|
298
|
-
apiOptions() {
|
300
|
+
apiOptions(val) {
|
301
|
+
this.initApiConfig();
|
299
302
|
this.handleFieldsChange();
|
300
303
|
}
|
301
304
|
},
|
302
305
|
created() {
|
303
|
-
this.
|
306
|
+
this.initOauthConfig();
|
304
307
|
this.formConfig = Object.assign(this.baseConfig, this.config);
|
305
308
|
|
306
309
|
if (this.formConfig.list && this.formConfig.list.length) {
|
@@ -309,10 +312,12 @@ export default {
|
|
309
312
|
this.formConfig.list = [];
|
310
313
|
}
|
311
314
|
},
|
312
|
-
mounted() {
|
315
|
+
mounted() {
|
316
|
+
this.initApiConfig();
|
317
|
+
},
|
313
318
|
methods: {
|
314
319
|
// 初始化组件配置
|
315
|
-
|
320
|
+
initOauthConfig() {
|
316
321
|
if (this.oauthConfig.token) {
|
317
322
|
const oauthInfo = {
|
318
323
|
token: this.oauthConfig.token,
|
@@ -335,6 +340,14 @@ export default {
|
|
335
340
|
});
|
336
341
|
}
|
337
342
|
},
|
343
|
+
initApiConfig() {
|
344
|
+
this.apiConfig = {};
|
345
|
+
if (this.apiOptions.length) {
|
346
|
+
this.apiOptions.map(item => {
|
347
|
+
this.apiConfig[item.id] = item;
|
348
|
+
});
|
349
|
+
}
|
350
|
+
},
|
338
351
|
|
339
352
|
handleConfigSelect(value) {
|
340
353
|
this.configTab = value;
|
@@ -373,11 +386,9 @@ export default {
|
|
373
386
|
this.widgetFormSelect = Object.assign(this.widgetFormSelect, val);
|
374
387
|
},
|
375
388
|
handleFieldsChange() {
|
376
|
-
const
|
377
|
-
|
378
|
-
|
379
|
-
if (dataArr.length && dataArr[0].paramsOut) {
|
380
|
-
this.fields = dataArr[0].paramsOut.map(item => {
|
389
|
+
const data = this.apiConfig[this.formConfig.config.fieldsApi];
|
390
|
+
if (data) {
|
391
|
+
this.fields = data.paramsOut.map(item => {
|
381
392
|
return {
|
382
393
|
label: item.note || item.name,
|
383
394
|
alias: item.name,
|
@@ -397,7 +408,7 @@ export default {
|
|
397
408
|
this.$refs.formConfigRef.formValidate().then(res => {
|
398
409
|
if (res) {
|
399
410
|
const data = deepClone(this.formConfig);
|
400
|
-
data.config.network = this.
|
411
|
+
data.config.network = this.apiConfig;
|
401
412
|
resolve(data);
|
402
413
|
} else {
|
403
414
|
reject();
|
@@ -419,7 +430,7 @@ export default {
|
|
419
430
|
return reject();
|
420
431
|
}
|
421
432
|
const data = deepClone(this.formConfig);
|
422
|
-
data.config.network = this.
|
433
|
+
data.config.network = this.apiConfig;
|
423
434
|
resolve(data);
|
424
435
|
});
|
425
436
|
}
|
@@ -129,7 +129,7 @@
|
|
129
129
|
@on-affirm="handleDialogAffirm"
|
130
130
|
>
|
131
131
|
<template v-if="dialog.action === 'preview'">
|
132
|
-
<th-table-generate :config="config"> </th-table-generate>
|
132
|
+
<th-table-generate :config="deepClone(config)"> </th-table-generate>
|
133
133
|
</template>
|
134
134
|
<template v-else-if="dialog.action === 'importJson'">
|
135
135
|
<el-alert
|
@@ -154,6 +154,8 @@
|
|
154
154
|
</template>
|
155
155
|
|
156
156
|
<script>
|
157
|
+
import { deepClone } from "./util";
|
158
|
+
|
157
159
|
export default {
|
158
160
|
props: {
|
159
161
|
config: Object,
|
@@ -179,6 +181,7 @@ export default {
|
|
179
181
|
created() {},
|
180
182
|
mounted() {},
|
181
183
|
methods: {
|
184
|
+
deepClone: deepClone,
|
182
185
|
handleClick(val, data) {
|
183
186
|
this.$emit("click", val, data);
|
184
187
|
},
|
@@ -195,7 +198,12 @@ export default {
|
|
195
198
|
this.dialog = { show: true, action, data };
|
196
199
|
},
|
197
200
|
handleDialogFullscreen() {
|
198
|
-
|
201
|
+
if (
|
202
|
+
this.dialog.action === "importJson" ||
|
203
|
+
this.dialog.action === "generateJson"
|
204
|
+
) {
|
205
|
+
this.$refs.codeEditor.resize();
|
206
|
+
}
|
199
207
|
},
|
200
208
|
handleDialogAffirm() {
|
201
209
|
const action = this.dialog.action;
|
@@ -10,30 +10,6 @@ export const table = {
|
|
10
10
|
api: ""
|
11
11
|
},
|
12
12
|
fieldsType: "fieldsApi",
|
13
|
-
style: {
|
14
|
-
cell: {
|
15
|
-
customStyle: "",
|
16
|
-
margin: "",
|
17
|
-
padding: "20rpx",
|
18
|
-
"border-bottom": "1px solid #e5e5e5"
|
19
|
-
},
|
20
|
-
title: {
|
21
|
-
customStyle: "",
|
22
|
-
margin: "",
|
23
|
-
padding: "",
|
24
|
-
width: "",
|
25
|
-
"text-align": "",
|
26
|
-
color: "#999"
|
27
|
-
},
|
28
|
-
value: {
|
29
|
-
customStyle: "",
|
30
|
-
margin: "",
|
31
|
-
padding: "",
|
32
|
-
width: "",
|
33
|
-
"text-align": "",
|
34
|
-
color: "#333"
|
35
|
-
}
|
36
|
-
},
|
37
13
|
options: [],
|
38
14
|
pageInfo: {
|
39
15
|
show: true,
|
@@ -59,7 +35,37 @@ export const table = {
|
|
59
35
|
text: "暂无数据",
|
60
36
|
image: ""
|
61
37
|
},
|
62
|
-
sequence: true
|
38
|
+
sequence: true,
|
39
|
+
style: {
|
40
|
+
table: {
|
41
|
+
border: true,
|
42
|
+
height: "",
|
43
|
+
maxHeight: "",
|
44
|
+
customStyle: ""
|
45
|
+
},
|
46
|
+
cell: {
|
47
|
+
customStyle: "",
|
48
|
+
margin: "",
|
49
|
+
padding: "20rpx",
|
50
|
+
"border-bottom": "1px solid #e5e5e5"
|
51
|
+
},
|
52
|
+
title: {
|
53
|
+
customStyle: "",
|
54
|
+
margin: "",
|
55
|
+
padding: "",
|
56
|
+
width: "",
|
57
|
+
"text-align": "",
|
58
|
+
color: "#999"
|
59
|
+
},
|
60
|
+
value: {
|
61
|
+
customStyle: "",
|
62
|
+
margin: "",
|
63
|
+
padding: "",
|
64
|
+
width: "",
|
65
|
+
"text-align": "",
|
66
|
+
color: "#333"
|
67
|
+
}
|
68
|
+
}
|
63
69
|
};
|
64
70
|
|
65
71
|
// 按钮配置
|
@@ -82,7 +88,7 @@ export const tools = {
|
|
82
88
|
position: "header",
|
83
89
|
form: "",
|
84
90
|
api: "",
|
85
|
-
style: buttonStyle
|
91
|
+
style: { ...buttonStyle, type: "primary" }
|
86
92
|
},
|
87
93
|
edit: {
|
88
94
|
show: true,
|
@@ -92,7 +98,7 @@ export const tools = {
|
|
92
98
|
position: "row",
|
93
99
|
form: "",
|
94
100
|
api: "",
|
95
|
-
style: buttonStyle
|
101
|
+
style: { ...buttonStyle, type: "primary", plain: true }
|
96
102
|
},
|
97
103
|
look: {
|
98
104
|
show: false,
|
@@ -102,7 +108,7 @@ export const tools = {
|
|
102
108
|
position: "row",
|
103
109
|
form: "",
|
104
110
|
api: "",
|
105
|
-
style: buttonStyle
|
111
|
+
style: { ...buttonStyle, type: "primary", plain: true }
|
106
112
|
},
|
107
113
|
delete: {
|
108
114
|
show: true,
|
@@ -112,7 +118,7 @@ export const tools = {
|
|
112
118
|
position: "row",
|
113
119
|
form: "",
|
114
120
|
api: "",
|
115
|
-
style: buttonStyle
|
121
|
+
style: { ...buttonStyle, type: "danger", plain: true }
|
116
122
|
},
|
117
123
|
batchDelete: {
|
118
124
|
show: false,
|
@@ -122,7 +128,7 @@ export const tools = {
|
|
122
128
|
position: "header",
|
123
129
|
form: "",
|
124
130
|
api: "",
|
125
|
-
style: buttonStyle
|
131
|
+
style: { ...buttonStyle, type: "danger", plain: true }
|
126
132
|
},
|
127
133
|
export: {
|
128
134
|
show: false,
|
@@ -132,7 +138,7 @@ export const tools = {
|
|
132
138
|
position: "header",
|
133
139
|
form: "",
|
134
140
|
api: "",
|
135
|
-
style: buttonStyle
|
141
|
+
style: { ...buttonStyle }
|
136
142
|
},
|
137
143
|
import: {
|
138
144
|
show: false,
|
@@ -142,7 +148,7 @@ export const tools = {
|
|
142
148
|
position: "header",
|
143
149
|
form: "",
|
144
150
|
api: "",
|
145
|
-
style: buttonStyle
|
151
|
+
style: { ...buttonStyle }
|
146
152
|
}
|
147
153
|
};
|
148
154
|
|
@@ -1,74 +1,78 @@
|
|
1
1
|
<template>
|
2
|
-
<div class="
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<span class="th-table-search-item-title">{{ item.label }}:</span>
|
9
|
-
<el-input
|
10
|
-
v-if="item.type === 'input'"
|
11
|
-
v-model="params[item.prop]"
|
12
|
-
:style="{ width: `${item.width || '180'}px` }"
|
13
|
-
:placeholder="item.placeholder || '请输入'"
|
14
|
-
:disabled="item.disabled"
|
15
|
-
clearable
|
16
|
-
></el-input>
|
17
|
-
<el-date-picker
|
18
|
-
v-if="item.type === 'date'"
|
19
|
-
v-model="params[item.prop]"
|
20
|
-
:style="{ width: `${item.width || '180'}px` }"
|
21
|
-
:type="item.dateType || 'date'"
|
22
|
-
:format="item.format"
|
23
|
-
:value-format="item.valueFormat"
|
24
|
-
range-separator="至"
|
25
|
-
start-placeholder="开始日期"
|
26
|
-
end-placeholder="结束日期"
|
27
|
-
clearable
|
2
|
+
<div class="generateTable-search">
|
3
|
+
<el-form :inline="true" :model="data" size="small">
|
4
|
+
<el-form-item
|
5
|
+
v-for="item in options"
|
6
|
+
:key="item.prop"
|
7
|
+
:label="item.label"
|
28
8
|
>
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
</
|
50
|
-
<
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
9
|
+
<el-input
|
10
|
+
v-if="item.type === 'input' || item.elType === 'input'"
|
11
|
+
v-model="data[item.prop]"
|
12
|
+
:style="{ width: `${item.width || '180'}px` }"
|
13
|
+
:placeholder="item.placeholder || '请输入'"
|
14
|
+
:disabled="item.disabled"
|
15
|
+
clearable
|
16
|
+
></el-input>
|
17
|
+
<el-date-picker
|
18
|
+
v-if="item.type === 'date' || item.elType === 'date'"
|
19
|
+
v-model="data[item.prop]"
|
20
|
+
:style="{ width: `${item.width || '180'}px` }"
|
21
|
+
:type="item.dateType || 'date'"
|
22
|
+
:format="item.format"
|
23
|
+
:value-format="item.valueFormat"
|
24
|
+
range-separator="至"
|
25
|
+
start-placeholder="开始日期"
|
26
|
+
end-placeholder="结束日期"
|
27
|
+
clearable
|
28
|
+
>
|
29
|
+
</el-date-picker>
|
30
|
+
<el-select
|
31
|
+
v-if="item.type === 'select' || item.elType === 'select'"
|
32
|
+
v-model="data[item.prop]"
|
33
|
+
:style="{ width: `${item.width || '180'}px` }"
|
34
|
+
:placeholder="item.placeholder || '请选择'"
|
35
|
+
:multiple="item.multiple"
|
36
|
+
:multiple-limit="item.multipleLimit"
|
37
|
+
:filterable="item.filterable"
|
38
|
+
:disabled="item.disabled"
|
39
|
+
clearable
|
40
|
+
>
|
41
|
+
<template v-if="item.remote">
|
42
|
+
<el-option
|
43
|
+
v-for="option in item.remoteData"
|
44
|
+
:key="option[item.props.value]"
|
45
|
+
:label="option[item.props.label]"
|
46
|
+
:value="option[item.props.value]"
|
47
|
+
>
|
48
|
+
</el-option>
|
49
|
+
</template>
|
50
|
+
<template v-else>
|
51
|
+
<el-option
|
52
|
+
v-for="option in item.staticData"
|
53
|
+
:key="option.value"
|
54
|
+
:label="option.label"
|
55
|
+
:value="option.value"
|
56
|
+
>
|
57
|
+
</el-option>
|
58
|
+
</template>
|
59
|
+
</el-select>
|
60
|
+
</el-form-item>
|
61
|
+
<el-form-item>
|
62
|
+
<el-button type="primary" icon="el-icon-search" plain @click="doSearch">
|
63
|
+
查询
|
64
|
+
</el-button>
|
65
|
+
</el-form-item>
|
66
|
+
<el-form-item>
|
67
|
+
<el-button
|
68
|
+
type="primary"
|
69
|
+
icon="el-icon-refresh-right"
|
70
|
+
plain
|
71
|
+
@click="doReset"
|
72
|
+
>重置</el-button
|
73
|
+
>
|
74
|
+
</el-form-item>
|
75
|
+
</el-form>
|
72
76
|
</div>
|
73
77
|
</template>
|
74
78
|
|
@@ -89,70 +93,24 @@ export default {
|
|
89
93
|
}
|
90
94
|
},
|
91
95
|
data() {
|
92
|
-
return {
|
93
|
-
params: this.data,
|
94
|
-
datePickerTypes: [
|
95
|
-
"year",
|
96
|
-
"month",
|
97
|
-
"date",
|
98
|
-
"dates",
|
99
|
-
"week",
|
100
|
-
"datetime",
|
101
|
-
"datetimerange",
|
102
|
-
"daterange",
|
103
|
-
"monthrange"
|
104
|
-
]
|
105
|
-
};
|
106
|
-
},
|
107
|
-
watch: {
|
108
|
-
options: {
|
109
|
-
handler(newVal, oldVal) {
|
110
|
-
if (newVal && newVal.length) {
|
111
|
-
newVal.map(item => {
|
112
|
-
this.$set(this.params, item.prop, item.defaultValue || "");
|
113
|
-
});
|
114
|
-
}
|
115
|
-
},
|
116
|
-
deep: true,
|
117
|
-
immediate: true
|
118
|
-
},
|
119
|
-
data(val) {
|
120
|
-
this.params = val;
|
121
|
-
},
|
122
|
-
params: {
|
123
|
-
deep: true,
|
124
|
-
handler(val) {
|
125
|
-
this.$emit("update:data", val);
|
126
|
-
}
|
127
|
-
}
|
96
|
+
return {};
|
128
97
|
},
|
129
98
|
methods: {
|
130
99
|
doSearch() {
|
131
|
-
this.$emit("
|
100
|
+
this.$emit("search", this.data);
|
132
101
|
},
|
133
102
|
doReset() {
|
134
103
|
this.options.map(item => {
|
135
|
-
this.$set(this.
|
104
|
+
this.$set(this.data, item.prop, item.defaultValue || "");
|
136
105
|
});
|
137
|
-
this.$emit("
|
106
|
+
this.$emit("reset", this.data);
|
138
107
|
}
|
139
108
|
}
|
140
109
|
};
|
141
110
|
</script>
|
142
111
|
|
143
112
|
<style lang="scss" scoped>
|
144
|
-
.
|
145
|
-
|
146
|
-
&-item {
|
147
|
-
display: inline-block;
|
148
|
-
margin-right: 15px;
|
149
|
-
margin-bottom: 10px;
|
150
|
-
&-title {
|
151
|
-
font-size: 14px;
|
152
|
-
}
|
153
|
-
}
|
154
|
-
.th-table-search-item:last-child {
|
155
|
-
margin-right: 20px !important;
|
156
|
-
}
|
113
|
+
.generateTable-search {
|
114
|
+
width: 100%;
|
157
115
|
}
|
158
116
|
</style>
|