tianheng-ui 0.0.22 → 0.0.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/index.js +1 -1
- package/lib/tianheng-ui.js +1 -1
- package/lib/tianheng-ui.js.map +1 -1
- package/package.json +1 -1
- package/packages/table/action.vue +82 -34
package/package.json
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
<template>
|
2
|
-
<div>
|
2
|
+
<div class="thTable-action" @click.stop>
|
3
3
|
<template v-for="(item, index) in actions">
|
4
4
|
<el-button
|
5
|
-
v-if="item.
|
5
|
+
v-if="item.act === 'edit'"
|
6
6
|
:key="index"
|
7
|
-
:style="
|
8
|
-
:type="item.
|
9
|
-
:icon="item.
|
7
|
+
:style="item.style"
|
8
|
+
:type="item.type"
|
9
|
+
:icon="item.icon"
|
10
10
|
:disabled="btnDisabled(item)"
|
11
11
|
@click="doEdit(item)"
|
12
|
-
>{{ item.
|
12
|
+
>{{ item.name }}</el-button
|
13
13
|
>
|
14
14
|
<el-button
|
15
|
-
v-else-if="item.
|
15
|
+
v-else-if="item.act === 'look'"
|
16
16
|
:key="index"
|
17
|
-
:style="
|
18
|
-
:type="item.
|
19
|
-
:icon="item.
|
17
|
+
:style="item.style"
|
18
|
+
:type="item.type"
|
19
|
+
:icon="item.icon"
|
20
20
|
:disabled="btnDisabled(item)"
|
21
21
|
@click="doLook(item)"
|
22
|
-
>{{ item.
|
22
|
+
>{{ item.name }}</el-button
|
23
23
|
>
|
24
24
|
<el-popover
|
25
25
|
class="action-popover"
|
26
|
-
v-else-if="item.
|
26
|
+
v-else-if="item.act === 'delete'"
|
27
27
|
:key="index"
|
28
28
|
v-model="pop"
|
29
29
|
placement="top"
|
@@ -31,37 +31,65 @@
|
|
31
31
|
width="180"
|
32
32
|
trigger="manual"
|
33
33
|
>
|
34
|
-
<p>{{ item.
|
34
|
+
<p>{{ item.delmsg || msg }}</p>
|
35
35
|
<div style="text-align: right; margin: 0">
|
36
36
|
<el-button type="text" :disabled="loadingDel" @click="doCancel"
|
37
37
|
>取消</el-button
|
38
38
|
>
|
39
|
-
<el-button
|
40
|
-
:loading="loadingDel"
|
41
|
-
type="primary"
|
42
|
-
@click="doDelete(item)"
|
39
|
+
<el-button type="text" :loading="loadingDel" @click="doDelete(item)"
|
43
40
|
>确定</el-button
|
44
41
|
>
|
45
42
|
</div>
|
46
43
|
<el-button
|
47
|
-
:style="
|
44
|
+
:style="item.style"
|
48
45
|
slot="reference"
|
49
46
|
:disabled="loadingDel || btnDisabled(item)"
|
50
|
-
:type="item.
|
51
|
-
:icon="item.
|
47
|
+
:type="item.type"
|
48
|
+
:icon="item.icon"
|
52
49
|
@click="toDelete"
|
53
|
-
>{{ item.
|
50
|
+
>{{ item.name }}</el-button
|
54
51
|
>
|
55
52
|
</el-popover>
|
53
|
+
<el-dropdown
|
54
|
+
v-else-if="item.act === 'more'"
|
55
|
+
:key="index"
|
56
|
+
:trigger="item.trigger || 'click'"
|
57
|
+
:placement="item.placement || 'bottom-end'"
|
58
|
+
:disabled="btnDisabled(item)"
|
59
|
+
@command="
|
60
|
+
value => {
|
61
|
+
doMore(value, index, item);
|
62
|
+
}
|
63
|
+
"
|
64
|
+
>
|
65
|
+
<el-button
|
66
|
+
:style="item.style"
|
67
|
+
:disabled="loadingDel || btnDisabled(item)"
|
68
|
+
:type="item.type"
|
69
|
+
:icon="item.icon"
|
70
|
+
>{{ item.name }}</el-button
|
71
|
+
>
|
72
|
+
<el-dropdown-menu slot="dropdown">
|
73
|
+
<el-dropdown-item
|
74
|
+
v-for="(btnItem, btnIndex) in item.children"
|
75
|
+
:key="btnIndex"
|
76
|
+
:style="btnItem.style"
|
77
|
+
:command="btnItem.act"
|
78
|
+
:icon="btnItem.icon"
|
79
|
+
:disabled="btnItem.disabled"
|
80
|
+
>{{ btnItem.name }}</el-dropdown-item
|
81
|
+
>
|
82
|
+
</el-dropdown-menu>
|
83
|
+
</el-dropdown>
|
56
84
|
<el-button
|
57
85
|
v-else
|
58
86
|
:key="index"
|
59
|
-
:style="
|
60
|
-
:type="item.
|
61
|
-
:icon="item.
|
87
|
+
:style="item.style"
|
88
|
+
:type="item.type"
|
89
|
+
:icon="item.icon"
|
62
90
|
:disabled="btnDisabled(item)"
|
63
91
|
@click="doEval(item)"
|
64
|
-
>{{ item.
|
92
|
+
>{{ item.name }}</el-button
|
65
93
|
>
|
66
94
|
</template>
|
67
95
|
</div>
|
@@ -78,7 +106,7 @@ export default {
|
|
78
106
|
}
|
79
107
|
},
|
80
108
|
scope: {
|
81
|
-
type: Object | String
|
109
|
+
type: Object | String
|
82
110
|
},
|
83
111
|
permission: {
|
84
112
|
type: Object,
|
@@ -97,15 +125,15 @@ export default {
|
|
97
125
|
},
|
98
126
|
computed: {
|
99
127
|
btnDisabled() {
|
100
|
-
return
|
101
|
-
if (item.
|
102
|
-
return item.
|
128
|
+
return item => {
|
129
|
+
if (item.disabled instanceof Boolean) {
|
130
|
+
return item.disabled;
|
103
131
|
}
|
104
|
-
if (item.
|
105
|
-
return item.
|
132
|
+
if (item.disabled instanceof Function) {
|
133
|
+
return item.disabled(this.scope);
|
106
134
|
}
|
107
135
|
};
|
108
|
-
}
|
136
|
+
}
|
109
137
|
},
|
110
138
|
methods: {
|
111
139
|
toDelete() {
|
@@ -130,13 +158,33 @@ export default {
|
|
130
158
|
this.pop = !bool;
|
131
159
|
};
|
132
160
|
this.$emit("on-delete", item, callback);
|
161
|
+
},
|
162
|
+
doMore(value, index, item) {
|
163
|
+
for (let i = 0; i < item.children.length; i++) {
|
164
|
+
const element = item.children[i];
|
165
|
+
if (element.act === value) {
|
166
|
+
this.$emit("on-more", element);
|
167
|
+
break;
|
168
|
+
}
|
169
|
+
}
|
133
170
|
}
|
134
171
|
}
|
135
172
|
};
|
136
173
|
</script>
|
137
174
|
|
138
175
|
<style lang="less">
|
139
|
-
.
|
140
|
-
|
176
|
+
.thTable-action {
|
177
|
+
width: 100%;
|
178
|
+
display: flex;
|
179
|
+
align-items: center;
|
180
|
+
justify-content: space-around;
|
181
|
+
|
182
|
+
.el-button + .el-button {
|
183
|
+
margin-left: 0px;
|
184
|
+
}
|
141
185
|
}
|
186
|
+
|
187
|
+
// .el-button + .action-popover {
|
188
|
+
// margin-left: 10px !important;
|
189
|
+
// }
|
142
190
|
</style>
|