tianheng-ui 0.1.32 → 0.1.34
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/Empty/index.vue +1 -1
- package/packages/FormMaking/WidgetConfig.vue +13 -32
- package/packages/TableMaking/WidgetTools.vue +64 -43
- package/packages/TableMaking/custom/config.js +0 -2
- package/packages/TableMaking/custom/items/search/index-h5.vue +105 -0
- package/packages/TableMaking/custom/items/table/index-h5.vue +140 -0
- package/packages/TableMaking/custom/items/table/{index.vue → index-pc.vue} +0 -1
- package/packages/TableMaking/custom/items/tools/index-h5.vue +50 -0
- package/packages/TableMaking/generateList.js +5 -0
- package/packages/TableMaking/generateList.vue +100 -0
- package/packages/TableMaking/generateTable.js +5 -0
- package/packages/TableMaking/generateTable.vue +3 -3
- package/packages/TableMaking/index.vue +0 -1
- package/packages/TableMaking/making.js +4 -4
- package/packages/TableMaking/widgetConfig.vue +78 -24
- package/packages/index.js +20 -16
- package/packages/TableMaking/generate.js +0 -5
- /package/packages/TableMaking/custom/items/search/{index.vue → index-pc.vue} +0 -0
- /package/packages/TableMaking/custom/items/tools/{index.vue → index-pc.vue} +0 -0
package/package.json
CHANGED
package/packages/Empty/index.vue
CHANGED
@@ -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>
|
@@ -81,8 +81,6 @@
|
|
81
81
|
:fields="fields"
|
82
82
|
:apiConfig="apiConfig"
|
83
83
|
:is="compsData[data.type].content"
|
84
|
-
@events-show="handleEventDialogShow"
|
85
|
-
@events-edit="handleEventsCollapseClick"
|
86
84
|
></component>
|
87
85
|
|
88
86
|
<el-collapse-item
|
@@ -93,7 +91,7 @@
|
|
93
91
|
<span>动作设置</span>
|
94
92
|
<span
|
95
93
|
style="float: right;margin-right: 10px;"
|
96
|
-
@click.stop="
|
94
|
+
@click.stop="handleEventDialogShow"
|
97
95
|
>配置</span
|
98
96
|
>
|
99
97
|
</div>
|
@@ -102,7 +100,7 @@
|
|
102
100
|
:key="event"
|
103
101
|
:label="event"
|
104
102
|
>
|
105
|
-
<div class="
|
103
|
+
<div class="events-item">
|
106
104
|
<el-select
|
107
105
|
v-model="data.events[event]"
|
108
106
|
placeholder="请选择"
|
@@ -119,7 +117,7 @@
|
|
119
117
|
<i
|
120
118
|
v-if="data.events[event]"
|
121
119
|
class="el-icon-edit"
|
122
|
-
@click="
|
120
|
+
@click="handleEventsCollapseClick(data.events[event])"
|
123
121
|
></i>
|
124
122
|
</div>
|
125
123
|
</el-form-item>
|
@@ -127,15 +125,6 @@
|
|
127
125
|
</el-collapse>
|
128
126
|
</el-form>
|
129
127
|
|
130
|
-
<!-- <component
|
131
|
-
:widget="data"
|
132
|
-
:config="config"
|
133
|
-
:fields="fields"
|
134
|
-
:is="compsData[data.type].content"
|
135
|
-
@events-show="handleEventDialogShow"
|
136
|
-
@events-edit="handleEventsCollapseClick"
|
137
|
-
></component> -->
|
138
|
-
|
139
128
|
<th-dialog
|
140
129
|
title="动作设置"
|
141
130
|
v-model="eventsDialog.visible"
|
@@ -498,13 +487,20 @@ export default {
|
|
498
487
|
.el-radio-button__inner {
|
499
488
|
padding: 7px !important;
|
500
489
|
}
|
490
|
+
.el-dialog__body {
|
491
|
+
padding: 20px !important;
|
492
|
+
}
|
501
493
|
}
|
502
494
|
</style>
|
503
495
|
|
504
496
|
<style lang="scss" scoped>
|
505
497
|
.widget-config {
|
506
|
-
.
|
507
|
-
|
498
|
+
.events-item {
|
499
|
+
display: flex;
|
500
|
+
align-items: center;
|
501
|
+
> i {
|
502
|
+
margin-left: 10px;
|
503
|
+
}
|
508
504
|
}
|
509
505
|
|
510
506
|
.eventsSetting {
|
@@ -594,20 +590,5 @@ export default {
|
|
594
590
|
}
|
595
591
|
}
|
596
592
|
}
|
597
|
-
.selectableRange {
|
598
|
-
width: 100%;
|
599
|
-
|
600
|
-
.el-range-separator {
|
601
|
-
width: 20px;
|
602
|
-
}
|
603
|
-
}
|
604
|
-
|
605
|
-
.flexView {
|
606
|
-
display: flex;
|
607
|
-
align-items: center;
|
608
|
-
padding-bottom: 10px;
|
609
|
-
margin-bottom: 10px;
|
610
|
-
border-bottom: 1px solid #e1e1e1;
|
611
|
-
}
|
612
593
|
}
|
613
594
|
</style>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<template>
|
2
2
|
<div class="widgetTools">
|
3
3
|
<div class="left">
|
4
|
-
<el-button
|
4
|
+
<!-- <el-button
|
5
5
|
:class="{ active: client === 'monitor' }"
|
6
6
|
type="text"
|
7
7
|
size="medium"
|
@@ -16,7 +16,7 @@
|
|
16
16
|
icon="el-icon-mobile"
|
17
17
|
@click="handleClick('mobile')"
|
18
18
|
>
|
19
|
-
</el-button>
|
19
|
+
</el-button> -->
|
20
20
|
</div>
|
21
21
|
<div class="right">
|
22
22
|
<slot> </slot>
|
@@ -30,14 +30,35 @@
|
|
30
30
|
@click="handleClick('clear')"
|
31
31
|
>重置
|
32
32
|
</el-button>
|
33
|
-
<el-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
<el-popover style="margin-left:10px;" placement="bottom" trigger="hover">
|
34
|
+
<el-button
|
35
|
+
v-if="permissions.includes('preview')"
|
36
|
+
type="text"
|
37
|
+
size="medium"
|
38
|
+
icon="el-icon-view"
|
39
|
+
slot="reference"
|
40
|
+
>预览
|
41
|
+
</el-button>
|
42
|
+
<div>
|
43
|
+
<el-button
|
44
|
+
type="text"
|
45
|
+
size="medium"
|
46
|
+
icon="el-icon-monitor"
|
47
|
+
@click="handleDialogOpen('preview_pc')"
|
48
|
+
>电脑端
|
49
|
+
</el-button>
|
50
|
+
</div>
|
51
|
+
<div>
|
52
|
+
<el-button
|
53
|
+
type="text"
|
54
|
+
size="medium"
|
55
|
+
icon="el-icon-mobile"
|
56
|
+
@click="handleDialogOpen('preview_h5')"
|
57
|
+
>移动端
|
58
|
+
</el-button>
|
59
|
+
</div>
|
60
|
+
</el-popover>
|
61
|
+
|
41
62
|
<el-popover style="margin-left:10px;" placement="bottom" trigger="hover">
|
42
63
|
<el-button
|
43
64
|
v-if="permissions.includes('upload')"
|
@@ -48,37 +69,33 @@
|
|
48
69
|
>导入</el-button
|
49
70
|
>
|
50
71
|
<div>
|
51
|
-
<
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
<
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
>
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
@click="handleDialogOpen('importTemplate')"
|
79
|
-
>导入模板
|
80
|
-
</el-button>
|
81
|
-
</div>
|
72
|
+
<el-button
|
73
|
+
type="text"
|
74
|
+
size="medium"
|
75
|
+
@click="handleDialogOpen('importJson')"
|
76
|
+
>导入JSON
|
77
|
+
</el-button>
|
78
|
+
</div>
|
79
|
+
<div>
|
80
|
+
<el-upload
|
81
|
+
action
|
82
|
+
accept=".xlsx, .xls"
|
83
|
+
:auto-upload="false"
|
84
|
+
:show-file-list="false"
|
85
|
+
disabled
|
86
|
+
:on-change="handleExcelFileChange"
|
87
|
+
>
|
88
|
+
<el-button type="text" size="medium" disabled>导入EXCEL</el-button>
|
89
|
+
</el-upload>
|
90
|
+
</div>
|
91
|
+
<div>
|
92
|
+
<el-button
|
93
|
+
type="text"
|
94
|
+
size="medium"
|
95
|
+
disabled
|
96
|
+
@click="handleDialogOpen('importTemplate')"
|
97
|
+
>导入模板
|
98
|
+
</el-button>
|
82
99
|
</div>
|
83
100
|
</el-popover>
|
84
101
|
<el-popover style="margin-left:10px;" placement="bottom" trigger="hover">
|
@@ -128,9 +145,12 @@
|
|
128
145
|
@on-close="handleDialogClose"
|
129
146
|
@on-affirm="handleDialogAffirm"
|
130
147
|
>
|
131
|
-
<template v-if="dialog.action === '
|
148
|
+
<template v-if="dialog.action === 'preview_pc'">
|
132
149
|
<th-table-generate :config="deepClone(config)"> </th-table-generate>
|
133
150
|
</template>
|
151
|
+
<template v-if="dialog.action === 'preview_h5'">
|
152
|
+
<th-list-generate :data="[]" :config="deepClone(config)"> </th-list-generate>
|
153
|
+
</template>
|
134
154
|
<template v-else-if="dialog.action === 'importJson'">
|
135
155
|
<el-alert
|
136
156
|
type="info"
|
@@ -170,7 +190,8 @@ export default {
|
|
170
190
|
data: {}
|
171
191
|
},
|
172
192
|
dialogTitles: {
|
173
|
-
|
193
|
+
preview_pc: "预览-电脑端",
|
194
|
+
preview_h5: "预览-移动端",
|
174
195
|
importJson: "导入JSON",
|
175
196
|
importTemplate: "导入模板",
|
176
197
|
generateJson: "生成JSON",
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="generateTable-search">
|
3
|
+
<el-row :gutter="10">
|
4
|
+
<el-col
|
5
|
+
v-for="item in options"
|
6
|
+
:key="item.prop"
|
7
|
+
:span="24 / options.length"
|
8
|
+
>
|
9
|
+
<el-input
|
10
|
+
v-if="item.type === 'input' || item.elType === 'input'"
|
11
|
+
v-model="data[item.prop]"
|
12
|
+
:placeholder="item.label"
|
13
|
+
:disabled="item.disabled"
|
14
|
+
clearable
|
15
|
+
></el-input>
|
16
|
+
<el-date-picker
|
17
|
+
v-if="item.type === 'date' || item.elType === 'date'"
|
18
|
+
v-model="data[item.prop]"
|
19
|
+
:type="item.dateType || 'date'"
|
20
|
+
:format="item.format"
|
21
|
+
:value-format="item.valueFormat"
|
22
|
+
range-separator="至"
|
23
|
+
start-placeholder="开始日期"
|
24
|
+
end-placeholder="结束日期"
|
25
|
+
clearable
|
26
|
+
>
|
27
|
+
</el-date-picker>
|
28
|
+
<el-select
|
29
|
+
v-if="item.type === 'select' || item.elType === 'select'"
|
30
|
+
v-model="data[item.prop]"
|
31
|
+
:placeholder="item.label"
|
32
|
+
:multiple="item.multiple"
|
33
|
+
:multiple-limit="item.multipleLimit"
|
34
|
+
:filterable="item.filterable"
|
35
|
+
:disabled="item.disabled"
|
36
|
+
clearable
|
37
|
+
>
|
38
|
+
<template v-if="item.remote">
|
39
|
+
<el-option
|
40
|
+
v-for="option in item.remoteData"
|
41
|
+
:key="option[item.props.value]"
|
42
|
+
:label="option[item.props.label]"
|
43
|
+
:value="option[item.props.value]"
|
44
|
+
>
|
45
|
+
</el-option>
|
46
|
+
</template>
|
47
|
+
<template v-else>
|
48
|
+
<el-option
|
49
|
+
v-for="option in item.staticData"
|
50
|
+
:key="option.value"
|
51
|
+
:label="option.label"
|
52
|
+
:value="option.value"
|
53
|
+
>
|
54
|
+
</el-option>
|
55
|
+
</template>
|
56
|
+
</el-select>
|
57
|
+
</el-col>
|
58
|
+
</el-row>
|
59
|
+
</div>
|
60
|
+
</template>
|
61
|
+
|
62
|
+
<script>
|
63
|
+
export default {
|
64
|
+
props: {
|
65
|
+
options: {
|
66
|
+
type: Array,
|
67
|
+
default: () => {
|
68
|
+
return [];
|
69
|
+
}
|
70
|
+
},
|
71
|
+
data: {
|
72
|
+
type: Object,
|
73
|
+
default: () => {
|
74
|
+
return {};
|
75
|
+
}
|
76
|
+
}
|
77
|
+
},
|
78
|
+
data() {
|
79
|
+
return {};
|
80
|
+
},
|
81
|
+
methods: {
|
82
|
+
doSearch() {
|
83
|
+
this.$emit("search", this.data);
|
84
|
+
},
|
85
|
+
doReset() {
|
86
|
+
this.options.map(item => {
|
87
|
+
this.$set(this.data, item.prop, item.defaultValue || "");
|
88
|
+
});
|
89
|
+
this.$emit("reset", this.data);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
};
|
93
|
+
</script>
|
94
|
+
|
95
|
+
<style lang="scss" scoped>
|
96
|
+
.generateTable-search {
|
97
|
+
position: sticky;
|
98
|
+
top: 0;
|
99
|
+
width: 100%;
|
100
|
+
padding: 5px;
|
101
|
+
border-bottom: 1px solid #e5e5e5;
|
102
|
+
background-color: white;
|
103
|
+
z-index: 100;
|
104
|
+
}
|
105
|
+
</style>
|
@@ -0,0 +1,140 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="generateTable-table">
|
3
|
+
<div
|
4
|
+
v-for="item in data"
|
5
|
+
class="table-list-item"
|
6
|
+
:style="cellStyle"
|
7
|
+
:key="item.id"
|
8
|
+
@click="handleCellClick(item)"
|
9
|
+
>
|
10
|
+
<div
|
11
|
+
v-for="(column, index) in getList"
|
12
|
+
class="table-list-item-row"
|
13
|
+
:key="index"
|
14
|
+
>
|
15
|
+
<div class="table-list-item-row-label" :style="titleStyle">
|
16
|
+
{{ column.label }}
|
17
|
+
</div>
|
18
|
+
<div class="table-list-item-row-value" :style="valueStyle">
|
19
|
+
{{ item[column.prop] != null ? item[column.prop] : "" }}
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<div class="table-list-item-tools">
|
23
|
+
<el-button
|
24
|
+
v-for="button in config.actions"
|
25
|
+
:key="button.name"
|
26
|
+
:type="button.style.type"
|
27
|
+
:icon="button.style.icon"
|
28
|
+
:plain="button.style.plain"
|
29
|
+
:round="button.style.round"
|
30
|
+
:circle="button.style.circle"
|
31
|
+
:size="button.style.size"
|
32
|
+
@click="handleActionClick(button, item)"
|
33
|
+
>{{ button.text }}</el-button
|
34
|
+
>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</template>
|
39
|
+
|
40
|
+
<script>
|
41
|
+
export default {
|
42
|
+
props: {
|
43
|
+
data: Array,
|
44
|
+
config: Object
|
45
|
+
},
|
46
|
+
data() {
|
47
|
+
return {};
|
48
|
+
},
|
49
|
+
computed: {
|
50
|
+
getList() {
|
51
|
+
if (this.config.options) {
|
52
|
+
const data = this.config.options.filter(item => {
|
53
|
+
return !item.hide;
|
54
|
+
});
|
55
|
+
return data;
|
56
|
+
}
|
57
|
+
return [];
|
58
|
+
},
|
59
|
+
cellStyle() {
|
60
|
+
let styleText = "";
|
61
|
+
if (this.config.style) {
|
62
|
+
const style = this.config.style.cell || {};
|
63
|
+
const keys = Object.keys(style).filter(key => {
|
64
|
+
return key !== "customStyle";
|
65
|
+
});
|
66
|
+
for (let key of keys) {
|
67
|
+
styleText += `${key}: ${style[key]};`;
|
68
|
+
}
|
69
|
+
styleText += style.customStyle;
|
70
|
+
styleText = styleText.replace(/rpx/g, "px");
|
71
|
+
return styleText;
|
72
|
+
}
|
73
|
+
},
|
74
|
+
titleStyle() {
|
75
|
+
let styleText = "";
|
76
|
+
if (this.config.style) {
|
77
|
+
const style = this.config.style.title || {};
|
78
|
+
const keys = Object.keys(style).filter(key => {
|
79
|
+
return key !== "customStyle";
|
80
|
+
});
|
81
|
+
for (let key of keys) {
|
82
|
+
styleText += `${key}: ${style[key]};`;
|
83
|
+
}
|
84
|
+
styleText += style.customStyle;
|
85
|
+
styleText = styleText.replace(/rpx/g, "px");
|
86
|
+
return styleText;
|
87
|
+
}
|
88
|
+
},
|
89
|
+
valueStyle() {
|
90
|
+
let styleText = "";
|
91
|
+
if (this.config.style) {
|
92
|
+
const style = this.config.style.value || {};
|
93
|
+
const keys = Object.keys(style).filter(key => {
|
94
|
+
return key !== "customStyle";
|
95
|
+
});
|
96
|
+
for (let key of keys) {
|
97
|
+
styleText += `${key}: ${style[key]};`;
|
98
|
+
}
|
99
|
+
styleText += style.customStyle;
|
100
|
+
styleText = styleText.replace(/rpx/g, "px");
|
101
|
+
return styleText;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
},
|
105
|
+
methods: {
|
106
|
+
stopClick() {},
|
107
|
+
handleCellClick(item) {
|
108
|
+
this.$emit("click", item);
|
109
|
+
},
|
110
|
+
handleActionClick(action, item) {
|
111
|
+
this.$emit("action", action, item);
|
112
|
+
}
|
113
|
+
}
|
114
|
+
};
|
115
|
+
</script>
|
116
|
+
|
117
|
+
<style lang="scss" scoped>
|
118
|
+
.generateTable-table {
|
119
|
+
width: 100%;
|
120
|
+
|
121
|
+
.table-list-item {
|
122
|
+
.table-list-item-row {
|
123
|
+
display: flex;
|
124
|
+
align-items: center;
|
125
|
+
padding: 5px 0;
|
126
|
+
.table-list-item-row-label {
|
127
|
+
}
|
128
|
+
.table-list-item-row-value {
|
129
|
+
flex: 1;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
.table-list-item-tools {
|
134
|
+
display: flex;
|
135
|
+
align-items: center;
|
136
|
+
justify-content: flex-end;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
</style>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="generateTable-tools">
|
3
|
+
<el-row :gutter="10">
|
4
|
+
<el-col
|
5
|
+
v-for="button in config"
|
6
|
+
:key="button.name"
|
7
|
+
:span="24 / config.length"
|
8
|
+
>
|
9
|
+
<el-button
|
10
|
+
style="width:100%"
|
11
|
+
:type="button.style.type"
|
12
|
+
:icon="button.style.icon"
|
13
|
+
:plain="button.style.plain"
|
14
|
+
:round="button.style.round"
|
15
|
+
:circle="button.style.circle"
|
16
|
+
:size="button.style.size"
|
17
|
+
@click="handleClick(button)"
|
18
|
+
>{{ button.text }}</el-button
|
19
|
+
>
|
20
|
+
</el-col>
|
21
|
+
</el-row>
|
22
|
+
</div>
|
23
|
+
</template>
|
24
|
+
|
25
|
+
<script>
|
26
|
+
export default {
|
27
|
+
props: {
|
28
|
+
config: Array
|
29
|
+
},
|
30
|
+
data() {
|
31
|
+
return {};
|
32
|
+
},
|
33
|
+
methods: {
|
34
|
+
handleClick(item) {
|
35
|
+
this.$emit("click", item);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
};
|
39
|
+
</script>
|
40
|
+
|
41
|
+
<style lang="less" scoped>
|
42
|
+
.generateTable-tools {
|
43
|
+
position: sticky;
|
44
|
+
bottom: 0;
|
45
|
+
width: 100%;
|
46
|
+
padding: 10px 5px;
|
47
|
+
background-color: white;
|
48
|
+
z-index: 100;
|
49
|
+
}
|
50
|
+
</style>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="generateList">
|
3
|
+
<!-- 搜索栏 -->
|
4
|
+
<search v-if="searchConfig.show" :options="searchConfig.options" />
|
5
|
+
<list
|
6
|
+
v-if="tableData.length"
|
7
|
+
:data="tableData"
|
8
|
+
:config="tableConfig"
|
9
|
+
></list>
|
10
|
+
<th-empty v-else style="padding:100px 0;">
|
11
|
+
<img
|
12
|
+
slot="image"
|
13
|
+
:src="require('../../lib/theme-chalk/images/notData.png')"
|
14
|
+
style="width:150px;"
|
15
|
+
alt=""
|
16
|
+
/>
|
17
|
+
</th-empty>
|
18
|
+
<tools :config="toolsConfig" @click="handleActionClick"></tools>
|
19
|
+
</div>
|
20
|
+
</template>
|
21
|
+
|
22
|
+
<script>
|
23
|
+
import Search from "./custom/items/search/index-h5.vue";
|
24
|
+
import List from "./custom/items/table/index-h5.vue";
|
25
|
+
import Tools from "./custom/items/tools/index-h5.vue";
|
26
|
+
export default {
|
27
|
+
name: "thListGenerate",
|
28
|
+
components: { Search, List, Tools },
|
29
|
+
props: {
|
30
|
+
config: Object,
|
31
|
+
data: Array
|
32
|
+
},
|
33
|
+
data() {
|
34
|
+
return {
|
35
|
+
searchConfig: {},
|
36
|
+
toolsConfig: [],
|
37
|
+
tableConfig: {},
|
38
|
+
tableData: this.data,
|
39
|
+
networkConfig: {}
|
40
|
+
};
|
41
|
+
},
|
42
|
+
watch: {
|
43
|
+
config(val) {
|
44
|
+
this.initConfig();
|
45
|
+
},
|
46
|
+
data(val) {
|
47
|
+
this.tableData = val;
|
48
|
+
}
|
49
|
+
},
|
50
|
+
mounted() {
|
51
|
+
this.initConfig();
|
52
|
+
},
|
53
|
+
methods: {
|
54
|
+
// 处理配置信息
|
55
|
+
initConfig() {
|
56
|
+
if (!this.config || !this.config.table) return;
|
57
|
+
// 搜索配置
|
58
|
+
this.searchConfig = this.config.search;
|
59
|
+
|
60
|
+
// 操作配置
|
61
|
+
const toolsConfig = this.config.tools;
|
62
|
+
this.toolsConfig = Object.values(toolsConfig).filter(item => {
|
63
|
+
return item.position === "header" && item.show;
|
64
|
+
});
|
65
|
+
|
66
|
+
// 表格配置
|
67
|
+
const tableConfig = this.config.table;
|
68
|
+
const rowActions = Object.values(toolsConfig).filter(item => {
|
69
|
+
return item.position === "row" && item.show;
|
70
|
+
});
|
71
|
+
tableConfig.actions = rowActions;
|
72
|
+
this.tableConfig = tableConfig;
|
73
|
+
|
74
|
+
// 网络请求
|
75
|
+
this.networkConfig = this.config.network;
|
76
|
+
},
|
77
|
+
handleSearchChange(data) {
|
78
|
+
this.$emit("search", data);
|
79
|
+
},
|
80
|
+
handleTableClick(data) {
|
81
|
+
this.$emit("click", data);
|
82
|
+
},
|
83
|
+
handleActionClick(action, data) {
|
84
|
+
this.tableData.push({ id: new Date().getTime() });
|
85
|
+
this.$emit("action", action, data);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
};
|
89
|
+
</script>
|
90
|
+
|
91
|
+
<style lang="scss" scoped>
|
92
|
+
.generateList {
|
93
|
+
width: 300px;
|
94
|
+
height: 649px;
|
95
|
+
margin: auto;
|
96
|
+
overflow-y: scroll;
|
97
|
+
border: 1px solid #e5e5e5;
|
98
|
+
border-radius: 10px;
|
99
|
+
}
|
100
|
+
</style>
|