tianheng-ui 0.1.24 → 0.1.25
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 +4 -4
- package/package.json +1 -1
- package/packages/FormMaking/FormConfig.vue +37 -15
- package/packages/FormMaking/WidgetConfig.vue +12 -7
- package/packages/FormMaking/custom/config.js +2 -2
- package/packages/FormMaking/index.vue +2 -4
- package/packages/TableMaking/WidgetTools.vue +8 -8
- package/packages/TableMaking/custom/config.js +1 -0
- package/packages/TableMaking/index.vue +5 -21
- package/packages/TableMaking/widgetConfig.vue +48 -30
package/package.json
CHANGED
@@ -8,27 +8,39 @@
|
|
8
8
|
>
|
9
9
|
<el-collapse v-model="collapseValue">
|
10
10
|
<el-collapse-item title="表单配置" name="group-form">
|
11
|
-
<el-form-item
|
11
|
+
<el-form-item required>
|
12
|
+
<el-tooltip
|
13
|
+
slot="label"
|
14
|
+
effect="dark"
|
15
|
+
content="字段的配置方式"
|
16
|
+
placement="top"
|
17
|
+
>
|
18
|
+
<span style="color: #409EFF;">字段类型</span>
|
19
|
+
</el-tooltip>
|
12
20
|
<el-radio-group v-model="config.fieldsType">
|
13
21
|
<el-radio-button label="custom">自定义</el-radio-button>
|
14
|
-
<el-radio-button label="
|
22
|
+
<el-radio-button label="fieldsApi">接口导入</el-radio-button>
|
15
23
|
</el-radio-group>
|
16
24
|
</el-form-item>
|
17
|
-
<el-form-item
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
25
|
+
<el-form-item v-if="config.fieldsType === 'fieldsApi'" required>
|
26
|
+
<el-tooltip
|
27
|
+
slot="label"
|
28
|
+
effect="dark"
|
29
|
+
content="使用接口的出参配置可选字段"
|
30
|
+
placement="top"
|
31
|
+
>
|
32
|
+
<span style="color: #409EFF;">字段接口</span>
|
33
|
+
</el-tooltip>
|
22
34
|
<el-select
|
23
|
-
v-model="config.
|
35
|
+
v-model="config.fieldsApi"
|
24
36
|
style="width:100%"
|
25
37
|
clearable
|
26
38
|
placeholder="请选择"
|
27
39
|
no-data-text="暂无接口,请前往【数据源模块】创建"
|
28
|
-
@change="
|
40
|
+
@change="handleFieldsApiChange"
|
29
41
|
>
|
30
42
|
<el-option
|
31
|
-
v-for="item in
|
43
|
+
v-for="item in config.network"
|
32
44
|
:key="item.id"
|
33
45
|
:label="item.label"
|
34
46
|
:value="item.id"
|
@@ -109,7 +121,7 @@
|
|
109
121
|
|
110
122
|
<script>
|
111
123
|
export default {
|
112
|
-
props: ["config"
|
124
|
+
props: ["config"],
|
113
125
|
data() {
|
114
126
|
return {
|
115
127
|
collapseValue: [
|
@@ -121,12 +133,22 @@ export default {
|
|
121
133
|
};
|
122
134
|
},
|
123
135
|
methods: {
|
124
|
-
|
125
|
-
const
|
136
|
+
handleFieldsApiChange(val) {
|
137
|
+
const dataArr = this.config.network.filter(item => {
|
126
138
|
return item.id === val;
|
127
139
|
});
|
128
|
-
if (
|
129
|
-
|
140
|
+
if (dataArr.length && dataArr[0].paramsOut) {
|
141
|
+
const fields = dataArr[0].paramsOut.map(item => {
|
142
|
+
return {
|
143
|
+
label: item.note || item.name,
|
144
|
+
alias: item.name,
|
145
|
+
prop: item.name,
|
146
|
+
type: "input",
|
147
|
+
align: "left"
|
148
|
+
};
|
149
|
+
});
|
150
|
+
this.$emit("fieldsChange", fields);
|
151
|
+
} else this.$emit("fieldsChange", []);
|
130
152
|
}
|
131
153
|
}
|
132
154
|
};
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<el-tooltip
|
15
15
|
slot="label"
|
16
16
|
effect="dark"
|
17
|
-
content="
|
17
|
+
content="会导致该组件配置信息重置,请谨慎使用!"
|
18
18
|
placement="top"
|
19
19
|
>
|
20
20
|
<span style="color: #409EFF;">组件切换</span>
|
@@ -38,10 +38,10 @@
|
|
38
38
|
<el-tooltip
|
39
39
|
slot="label"
|
40
40
|
effect="dark"
|
41
|
-
content="
|
41
|
+
content="组件关联数据表中的唯一字段"
|
42
42
|
placement="top"
|
43
43
|
>
|
44
|
-
<span style="color: #409EFF;"
|
44
|
+
<span style="color: #409EFF;">组件字段</span>
|
45
45
|
</el-tooltip>
|
46
46
|
<el-input
|
47
47
|
v-if="config.fieldsType === 'custom'"
|
@@ -62,10 +62,15 @@
|
|
62
62
|
</el-option>
|
63
63
|
</el-select>
|
64
64
|
</el-form-item>
|
65
|
-
<el-form-item
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
<el-form-item v-if="config.fieldsType === 'fieldsApi'">
|
66
|
+
<el-tooltip
|
67
|
+
slot="label"
|
68
|
+
effect="dark"
|
69
|
+
content="表单提交时的入参名,对应数据表中的字段"
|
70
|
+
placement="top"
|
71
|
+
>
|
72
|
+
<span style="color: #409EFF;">字段标识</span>
|
73
|
+
</el-tooltip>
|
69
74
|
<el-input v-model="data.model" readonly></el-input>
|
70
75
|
</el-form-item>
|
71
76
|
</el-collapse-item>
|
@@ -772,8 +772,8 @@ export const layoutComponents = [
|
|
772
772
|
export const templateComponents = [];
|
773
773
|
|
774
774
|
export const baseConfig = {
|
775
|
-
fieldsType: "
|
776
|
-
|
775
|
+
fieldsType: "fieldsApi",
|
776
|
+
fieldsApi: "",
|
777
777
|
ui: "element",
|
778
778
|
title: "",
|
779
779
|
width: "",
|
@@ -158,8 +158,7 @@
|
|
158
158
|
<form-config
|
159
159
|
v-if="configTab == 'form'"
|
160
160
|
:config="formConfig.config"
|
161
|
-
|
162
|
-
@fieldsTableChange="handleFieldsTableChange"
|
161
|
+
@fieldsChange="handleFieldsChange"
|
163
162
|
></form-config>
|
164
163
|
</el-main>
|
165
164
|
</el-container>
|
@@ -253,7 +252,6 @@ export default {
|
|
253
252
|
type: Array,
|
254
253
|
default: () => ["grid", "filler", "divider"]
|
255
254
|
},
|
256
|
-
fieldsOptions: Array,
|
257
255
|
apiOptions: Array
|
258
256
|
},
|
259
257
|
data() {
|
@@ -386,7 +384,7 @@ export default {
|
|
386
384
|
handleWidgetConfigUpdate(val) {
|
387
385
|
this.widgetFormSelect = Object.assign(this.widgetFormSelect, val);
|
388
386
|
},
|
389
|
-
|
387
|
+
handleFieldsChange(val) {
|
390
388
|
this.fields = val;
|
391
389
|
},
|
392
390
|
clear() {
|
@@ -9,14 +9,14 @@
|
|
9
9
|
@click="handleClick('monitor')"
|
10
10
|
>
|
11
11
|
</el-button>
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
<el-button
|
13
|
+
:class="{ active: client === 'mobile' }"
|
14
|
+
type="text"
|
15
|
+
size="medium"
|
16
|
+
icon="el-icon-mobile"
|
17
|
+
@click="handleClick('mobile')"
|
18
|
+
>
|
19
|
+
</el-button>
|
20
20
|
</div>
|
21
21
|
<div class="right">
|
22
22
|
<slot> </slot>
|
@@ -10,6 +10,7 @@
|
|
10
10
|
<slot name="action"></slot>
|
11
11
|
</widget-tools>
|
12
12
|
<widget-table
|
13
|
+
v-if="client === 'monitor'"
|
13
14
|
style="height:calc(100% - 45px)"
|
14
15
|
:config="tableConfig"
|
15
16
|
></widget-table>
|
@@ -17,7 +18,6 @@
|
|
17
18
|
<div class="th-flex_aside th-is_border_left" style="width:300px">
|
18
19
|
<widget-config
|
19
20
|
:config="tableConfig"
|
20
|
-
:fieldsOptions="fieldsOptions"
|
21
21
|
:formOptions="formOptions"
|
22
22
|
:apiOptions="apiOptions"
|
23
23
|
ref="configRef"
|
@@ -43,26 +43,6 @@ export default {
|
|
43
43
|
}
|
44
44
|
},
|
45
45
|
|
46
|
-
/**
|
47
|
-
* 字段表配置列表。
|
48
|
-
* [
|
49
|
-
* {
|
50
|
-
* id:'', 表单id
|
51
|
-
* label:'', 表单名称
|
52
|
-
* children:[
|
53
|
-
* {
|
54
|
-
label: "主键",
|
55
|
-
alias: "id",
|
56
|
-
prop: "id",
|
57
|
-
type: "input",
|
58
|
-
align: "left"
|
59
|
-
}
|
60
|
-
* ]
|
61
|
-
* }
|
62
|
-
* ]
|
63
|
-
*/
|
64
|
-
fieldsOptions: Array,
|
65
|
-
|
66
46
|
/**
|
67
47
|
* 表单配置列表。
|
68
48
|
* 只关联表单id,渲染器通过接口查询表单配置信息
|
@@ -140,6 +120,10 @@ export default {
|
|
140
120
|
case "import-json":
|
141
121
|
this.tableConfig = data;
|
142
122
|
break;
|
123
|
+
case "monitor":
|
124
|
+
case "mobile":
|
125
|
+
this.client = action;
|
126
|
+
break;
|
143
127
|
|
144
128
|
default:
|
145
129
|
break;
|
@@ -54,17 +54,40 @@
|
|
54
54
|
>
|
55
55
|
<el-collapse v-model="collapseValue">
|
56
56
|
<el-collapse-item title="列表配置" name="group-table">
|
57
|
-
<el-form-item
|
57
|
+
<el-form-item required prop="table.fieldsType">
|
58
|
+
<el-tooltip
|
59
|
+
slot="label"
|
60
|
+
effect="dark"
|
61
|
+
content="字段的配置方式"
|
62
|
+
placement="top"
|
63
|
+
>
|
64
|
+
<span style="color: #409EFF;">字段类型</span>
|
65
|
+
</el-tooltip>
|
66
|
+
<el-radio-group v-model="config.table.fieldsType">
|
67
|
+
<el-radio-button label="custom" disabled
|
68
|
+
>自定义</el-radio-button
|
69
|
+
>
|
70
|
+
<el-radio-button label="fieldsApi">接口导入</el-radio-button>
|
71
|
+
</el-radio-group> </el-form-item
|
72
|
+
><el-form-item required prop="table.mounted.api">
|
73
|
+
<el-tooltip
|
74
|
+
slot="label"
|
75
|
+
effect="dark"
|
76
|
+
content="列表初始化完成后,调用该接口获取列表数据"
|
77
|
+
placement="top"
|
78
|
+
>
|
79
|
+
<span style="color: #409EFF;">列表接口</span>
|
80
|
+
</el-tooltip>
|
58
81
|
<el-select
|
59
|
-
v-model="config.table.
|
82
|
+
v-model="config.table.mounted.api"
|
60
83
|
style="width:100%"
|
61
84
|
clearable
|
62
85
|
placeholder="请选择"
|
63
|
-
no-data-text="
|
64
|
-
@change="
|
86
|
+
no-data-text="暂无接口,请前往【接口模块】创建"
|
87
|
+
@change="handleFieldsApiChange"
|
65
88
|
>
|
66
89
|
<el-option
|
67
|
-
v-for="item in
|
90
|
+
v-for="item in apiOptions"
|
68
91
|
:key="item.id"
|
69
92
|
:label="item.label"
|
70
93
|
:value="item.id"
|
@@ -78,29 +101,12 @@
|
|
78
101
|
placeholder="请输入"
|
79
102
|
></el-input>
|
80
103
|
</el-form-item>
|
81
|
-
<el-form-item label="
|
82
|
-
<el-
|
83
|
-
v-model="config.table.mounted.api"
|
84
|
-
style="width:100%"
|
85
|
-
clearable
|
86
|
-
placeholder="请选择"
|
87
|
-
no-data-text="暂无接口,请前往【接口模块】创建"
|
88
|
-
>
|
89
|
-
<el-option
|
90
|
-
v-for="item in apiOptions"
|
91
|
-
:key="item.id"
|
92
|
-
:label="item.label"
|
93
|
-
:value="item.id"
|
94
|
-
>
|
95
|
-
</el-option>
|
96
|
-
</el-select>
|
104
|
+
<el-form-item label="列表序号">
|
105
|
+
<el-switch v-model="config.table.sequence"> </el-switch>
|
97
106
|
</el-form-item>
|
98
107
|
<el-form-item label="开启查询">
|
99
108
|
<el-switch v-model="config.search.show"> </el-switch>
|
100
109
|
</el-form-item>
|
101
|
-
<el-form-item label="列表序号">
|
102
|
-
<el-switch v-model="config.table.sequence"> </el-switch>
|
103
|
-
</el-form-item>
|
104
110
|
</el-collapse-item>
|
105
111
|
<el-collapse-item title="排序配置" name="group-sort">
|
106
112
|
<el-form-item label="排序类型">
|
@@ -434,7 +440,6 @@ export default {
|
|
434
440
|
return {};
|
435
441
|
}
|
436
442
|
},
|
437
|
-
fieldsOptions: Array,
|
438
443
|
formOptions: Array,
|
439
444
|
apiOptions: Array
|
440
445
|
},
|
@@ -467,7 +472,10 @@ export default {
|
|
467
472
|
"group-button"
|
468
473
|
],
|
469
474
|
formRules: {
|
470
|
-
"table.
|
475
|
+
"table.fieldsType": [
|
476
|
+
{ required: true, message: "请选择字段类型", trigger: "change" }
|
477
|
+
],
|
478
|
+
"table.fieldsApi": [
|
471
479
|
{ required: true, message: "请选择字段表", trigger: "change" }
|
472
480
|
],
|
473
481
|
"table.title": [
|
@@ -584,12 +592,22 @@ export default {
|
|
584
592
|
handleActionConfig(data) {
|
585
593
|
this.dialog = { show: true, data };
|
586
594
|
},
|
587
|
-
|
588
|
-
const
|
595
|
+
handleFieldsApiChange(val) {
|
596
|
+
const dataArr = this.apiOptions.filter(item => {
|
589
597
|
return item.id === val;
|
590
598
|
});
|
591
|
-
if (
|
592
|
-
|
599
|
+
if (dataArr.length && dataArr[0].paramsOut) {
|
600
|
+
const fields = dataArr[0].paramsOut.map(item => {
|
601
|
+
return {
|
602
|
+
label: item.note || item.name,
|
603
|
+
alias: item.name,
|
604
|
+
prop: item.name,
|
605
|
+
type: "input",
|
606
|
+
align: "left"
|
607
|
+
};
|
608
|
+
});
|
609
|
+
this.fields = fields;
|
610
|
+
} else this.fields = [];
|
593
611
|
},
|
594
612
|
handleFormValidate() {
|
595
613
|
return new Promise((resolve, reject) => {
|