tianheng-ui 0.0.5 → 0.0.9
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/{src → lib}/index.js +1 -1
- package/lib/theme-chalk/cell.css +40 -0
- package/lib/theme-chalk/index.css +2 -1940
- package/lib/tianheng-ui.js +2 -0
- package/lib/tianheng-ui.js.map +1 -0
- package/package.json +9 -6
- package/packages/cell/index.js +8 -0
- package/packages/cell/index.vue +38 -0
- package/packages/codeEditor/index.js +8 -0
- package/packages/codeEditor/index.vue +212 -0
- package/packages/icons/index.js +8 -0
- package/packages/icons/index.vue +360 -0
- package/packages/table/action.vue +126 -0
- package/packages/table/column.vue +111 -0
- package/packages/table/index.js +8 -0
- package/packages/table/index.vue +257 -0
- package/packages/table/search.vue +105 -0
- package/packages/table/tools.vue +98 -0
- package/src/App.vue +0 -31
- package/src/assets/logo.png +0 -0
- package/src/main.js +0 -11
@@ -0,0 +1,212 @@
|
|
1
|
+
<template>
|
2
|
+
<div class="wrap">
|
3
|
+
<div class="code-editor" :ref="generateId"></div>
|
4
|
+
<span v-if="withFullscreenBtn" title="全屏显示">
|
5
|
+
<svg-icon
|
6
|
+
class="icon-fullscreen"
|
7
|
+
icon-class="fullscreen"
|
8
|
+
:style="{ bottom: (withFooterBtns ? 47 : 10) + 'px' }"
|
9
|
+
@click.native="fullscreen"
|
10
|
+
></svg-icon>
|
11
|
+
</span>
|
12
|
+
|
13
|
+
<el-dialog
|
14
|
+
ref="dialog"
|
15
|
+
custom-class="code-dialog"
|
16
|
+
:visible.sync="isVisible"
|
17
|
+
title="脚本编辑"
|
18
|
+
fullscreen
|
19
|
+
append-to-body
|
20
|
+
:show-footer="false"
|
21
|
+
@close="closeEditCode"
|
22
|
+
>
|
23
|
+
<code-editor v-model="dialogValue"></code-editor>
|
24
|
+
</el-dialog>
|
25
|
+
</div>
|
26
|
+
</template>
|
27
|
+
<script>
|
28
|
+
// 引入全局实例
|
29
|
+
import ace from "ace-builds";
|
30
|
+
// 主题风格,引入主题后还需要在 options 中指定主题才会生效
|
31
|
+
import "ace-builds/src-min-noconflict/theme-monokai";
|
32
|
+
import "ace-builds/src-min-noconflict/theme-dracula";
|
33
|
+
// 支持代码格式, 需要引入具体的语法高亮库才会有对应的语法高亮效果
|
34
|
+
import "ace-builds/src-min-noconflict/mode-javascript";
|
35
|
+
import "ace-builds/src-min-noconflict/mode-json";
|
36
|
+
import "ace-builds/src-min-noconflict/mode-css";
|
37
|
+
import "ace-builds/src-min-noconflict/ext-language_tools";
|
38
|
+
import jsWorkerUrl from "file-loader!ace-builds/src-noconflict/worker-javascript";
|
39
|
+
import jsonWorkerUrl from "file-loader!ace-builds/src-noconflict/worker-json";
|
40
|
+
import cssWorkerUrl from "file-loader!ace-builds/src-noconflict/worker-css";
|
41
|
+
ace.config.setModuleUrl("ace/mode/javascript_worker", jsWorkerUrl);
|
42
|
+
ace.config.setModuleUrl("ace/mode/json_worker", jsonWorkerUrl);
|
43
|
+
ace.config.setModuleUrl("ace/mode/css_worker", cssWorkerUrl);
|
44
|
+
ace.config.setModuleUrl(
|
45
|
+
"ace/snippets/javascript",
|
46
|
+
require("file-loader!ace-builds/src-noconflict/snippets/javascript.js")
|
47
|
+
);
|
48
|
+
ace.config.setModuleUrl(
|
49
|
+
"ace/snippets/css",
|
50
|
+
require("file-loader!ace-builds/src-noconflict/snippets/css.js")
|
51
|
+
);
|
52
|
+
|
53
|
+
export default {
|
54
|
+
name: "CodeEditor",
|
55
|
+
model: {
|
56
|
+
event: "change",
|
57
|
+
},
|
58
|
+
props: {
|
59
|
+
// 编辑器内容
|
60
|
+
value: String,
|
61
|
+
// 默认语言
|
62
|
+
language: {
|
63
|
+
type: String,
|
64
|
+
default: "javascript",
|
65
|
+
},
|
66
|
+
// 主题,对应主题库 JS 需要提前引入
|
67
|
+
theme: {
|
68
|
+
type: String,
|
69
|
+
default: "monokai",
|
70
|
+
},
|
71
|
+
// 是否只读
|
72
|
+
readonly: {
|
73
|
+
type: Boolean,
|
74
|
+
default: false,
|
75
|
+
},
|
76
|
+
// 最大行数
|
77
|
+
maxLines: Number,
|
78
|
+
// 是否显示全屏按钮
|
79
|
+
withFullscreenBtn: {
|
80
|
+
type: Boolean,
|
81
|
+
default: false,
|
82
|
+
},
|
83
|
+
withFooterBtns: {
|
84
|
+
type: Boolean,
|
85
|
+
default: false,
|
86
|
+
},
|
87
|
+
},
|
88
|
+
data() {
|
89
|
+
return {
|
90
|
+
editor: null,
|
91
|
+
generateId:
|
92
|
+
"id_" +
|
93
|
+
Math.random()
|
94
|
+
.toString(36)
|
95
|
+
.substr(2, 4),
|
96
|
+
isVisible: false,
|
97
|
+
dialogValue: "",
|
98
|
+
};
|
99
|
+
},
|
100
|
+
mounted() {
|
101
|
+
// 初始化
|
102
|
+
this.initEditor();
|
103
|
+
},
|
104
|
+
watch: {
|
105
|
+
value(val) {
|
106
|
+
if (this.editor.getValue() !== val) {
|
107
|
+
this.editor.setValue(val);
|
108
|
+
this.editor.clearSelection();
|
109
|
+
}
|
110
|
+
},
|
111
|
+
},
|
112
|
+
methods: {
|
113
|
+
// 初始化
|
114
|
+
initEditor() {
|
115
|
+
// 创建实例
|
116
|
+
this.editor = ace.edit(this.$refs[this.generateId], {
|
117
|
+
mode: `ace/mode/${this.language}`,
|
118
|
+
theme: `ace/theme/${this.theme}`,
|
119
|
+
fontSize: 12,
|
120
|
+
tabSize: 2,
|
121
|
+
value: this.value,
|
122
|
+
selectionStyle: "text",
|
123
|
+
maxLines: this.maxLines,
|
124
|
+
readOnly: this.readonly,
|
125
|
+
});
|
126
|
+
// 设置属性等,具体需要可根据官方参数自行设置
|
127
|
+
this.editor.setOptions({
|
128
|
+
enableBasicAutocompletion: true,
|
129
|
+
enableSnippets: true,
|
130
|
+
enableLiveAutocompletion: true,
|
131
|
+
wrap: true,
|
132
|
+
setShowPrintMargin: false,
|
133
|
+
});
|
134
|
+
// 设置值改变监听
|
135
|
+
this.editor.on("change", () => {
|
136
|
+
this.$emit("change", this.editor.getValue());
|
137
|
+
});
|
138
|
+
},
|
139
|
+
// 实例方法,高亮某一行
|
140
|
+
gotoLine(lineNumber) {
|
141
|
+
this.editor.gotoLine(lineNumber);
|
142
|
+
},
|
143
|
+
// 全屏编辑
|
144
|
+
fullscreen() {
|
145
|
+
this.dialogValue = JSON.parse(JSON.stringify(this.editor.getValue()));
|
146
|
+
this.isVisible = true;
|
147
|
+
},
|
148
|
+
closeEditCode() {
|
149
|
+
this.editor.setValue(this.dialogValue);
|
150
|
+
this.editor.clearSelection();
|
151
|
+
},
|
152
|
+
// resize编辑器
|
153
|
+
resize() {
|
154
|
+
this.editor.resize(true);
|
155
|
+
},
|
156
|
+
destroy() {
|
157
|
+
if (this.editor) {
|
158
|
+
this.editor.destroy();
|
159
|
+
this.editor = null;
|
160
|
+
}
|
161
|
+
},
|
162
|
+
},
|
163
|
+
beforeDestroy() {
|
164
|
+
this.destroy();
|
165
|
+
},
|
166
|
+
};
|
167
|
+
</script>
|
168
|
+
<style lang="scss" scoped>
|
169
|
+
.wrap {
|
170
|
+
position: relative;
|
171
|
+
.code-editor {
|
172
|
+
min-height: 150px;
|
173
|
+
height: 100%;
|
174
|
+
border: 1px solid #282f3a;
|
175
|
+
background-color: #0e1013;
|
176
|
+
}
|
177
|
+
.icon-fullscreen {
|
178
|
+
position: absolute;
|
179
|
+
// color: #fff;
|
180
|
+
right: 10px;
|
181
|
+
font-size: 16px;
|
182
|
+
z-index: 9999;
|
183
|
+
cursor: pointer;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
.code-dialog {
|
187
|
+
&::before {
|
188
|
+
content: "";
|
189
|
+
position: absolute;
|
190
|
+
display: block;
|
191
|
+
top: 0;
|
192
|
+
left: 0;
|
193
|
+
right: 0;
|
194
|
+
width: 100%;
|
195
|
+
height: 2px;
|
196
|
+
background-image: linear-gradient(270deg, #00deff, #2483ff 74%);
|
197
|
+
}
|
198
|
+
display: flex;
|
199
|
+
flex-direction: column;
|
200
|
+
background-color: #303640;
|
201
|
+
.el-dialog__header {
|
202
|
+
border: none;
|
203
|
+
.el-dialog__title {
|
204
|
+
color: #ccc;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
.el-dialog__body {
|
208
|
+
flex: 1 1 0;
|
209
|
+
padding-top: 10px;
|
210
|
+
}
|
211
|
+
}
|
212
|
+
</style>
|
@@ -0,0 +1,360 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<el-popover
|
4
|
+
placement="bottom-start"
|
5
|
+
title="Element图标库"
|
6
|
+
:width="width || 400"
|
7
|
+
trigger="click"
|
8
|
+
>
|
9
|
+
<el-input
|
10
|
+
slot="reference"
|
11
|
+
:value="value"
|
12
|
+
placeholder="请选择图标"
|
13
|
+
clearable
|
14
|
+
@clear="handleInputClear"
|
15
|
+
>
|
16
|
+
<div v-if="value" class="input-prefix" slot="prefix">
|
17
|
+
<i :class="value" class="icon"> </i>
|
18
|
+
</div>
|
19
|
+
</el-input>
|
20
|
+
|
21
|
+
<div class="th-icons">
|
22
|
+
<i
|
23
|
+
class="icon"
|
24
|
+
v-for="(icon, index) in icons"
|
25
|
+
:key="index"
|
26
|
+
:class="icon"
|
27
|
+
@click="handleIconClick(icon)"
|
28
|
+
></i>
|
29
|
+
</div>
|
30
|
+
</el-popover>
|
31
|
+
</div>
|
32
|
+
</template>
|
33
|
+
|
34
|
+
<script>
|
35
|
+
export default {
|
36
|
+
name:'ThIcons',
|
37
|
+
props: ["value", "width"],
|
38
|
+
data() {
|
39
|
+
return {
|
40
|
+
icons: [
|
41
|
+
"el-icon-platform-eleme",
|
42
|
+
"el-icon-eleme",
|
43
|
+
"el-icon-delete-solid",
|
44
|
+
"el-icon-delete",
|
45
|
+
"el-icon-s-tools",
|
46
|
+
"el-icon-setting",
|
47
|
+
"el-icon-user-solid",
|
48
|
+
"el-icon-user",
|
49
|
+
"el-icon-phone",
|
50
|
+
"el-icon-phone-outline",
|
51
|
+
"el-icon-more",
|
52
|
+
"el-icon-more-outline",
|
53
|
+
"el-icon-star-on",
|
54
|
+
"el-icon-star-off",
|
55
|
+
"el-icon-s-goods",
|
56
|
+
"el-icon-goods",
|
57
|
+
"el-icon-warning",
|
58
|
+
"el-icon-warning-outline",
|
59
|
+
"el-icon-question",
|
60
|
+
"el-icon-info",
|
61
|
+
"el-icon-remove",
|
62
|
+
"el-icon-circle-plus",
|
63
|
+
"el-icon-success",
|
64
|
+
"el-icon-error",
|
65
|
+
"el-icon-zoom-in",
|
66
|
+
"el-icon-zoom-out",
|
67
|
+
"el-icon-remove-outline",
|
68
|
+
"el-icon-circle-plus-outline",
|
69
|
+
"el-icon-circle-check",
|
70
|
+
"el-icon-circle-close",
|
71
|
+
"el-icon-s-help",
|
72
|
+
"el-icon-help",
|
73
|
+
"el-icon-minus",
|
74
|
+
"el-icon-plus",
|
75
|
+
"el-icon-check",
|
76
|
+
"el-icon-close",
|
77
|
+
"el-icon-picture",
|
78
|
+
"el-icon-picture-outline",
|
79
|
+
"el-icon-picture-outline-round",
|
80
|
+
"el-icon-upload",
|
81
|
+
"el-icon-upload2",
|
82
|
+
"el-icon-download",
|
83
|
+
"el-icon-camera-solid",
|
84
|
+
"el-icon-camera",
|
85
|
+
"el-icon-video-camera-solid",
|
86
|
+
"el-icon-video-camera",
|
87
|
+
"el-icon-message-solid",
|
88
|
+
"el-icon-bell",
|
89
|
+
"el-icon-s-cooperation",
|
90
|
+
"el-icon-s-order",
|
91
|
+
"el-icon-s-platform",
|
92
|
+
"el-icon-s-fold",
|
93
|
+
"el-icon-s-unfold",
|
94
|
+
"el-icon-s-operation",
|
95
|
+
"el-icon-s-promotion",
|
96
|
+
"el-icon-s-home",
|
97
|
+
"el-icon-s-release",
|
98
|
+
"el-icon-s-ticket",
|
99
|
+
"el-icon-s-management",
|
100
|
+
"el-icon-s-open",
|
101
|
+
"el-icon-s-shop",
|
102
|
+
"el-icon-s-marketing",
|
103
|
+
"el-icon-s-flag",
|
104
|
+
"el-icon-s-comment",
|
105
|
+
"el-icon-s-finance",
|
106
|
+
"el-icon-s-claim",
|
107
|
+
"el-icon-s-custom",
|
108
|
+
"el-icon-s-opportunity",
|
109
|
+
"el-icon-s-data",
|
110
|
+
"el-icon-s-check",
|
111
|
+
"el-icon-s-grid",
|
112
|
+
"el-icon-menu",
|
113
|
+
"el-icon-share",
|
114
|
+
"el-icon-d-caret",
|
115
|
+
"el-icon-caret-left",
|
116
|
+
"el-icon-caret-right",
|
117
|
+
"el-icon-caret-bottom",
|
118
|
+
"el-icon-caret-top",
|
119
|
+
"el-icon-bottom-left",
|
120
|
+
"el-icon-bottom-right",
|
121
|
+
"el-icon-back",
|
122
|
+
"el-icon-right",
|
123
|
+
"el-icon-bottom",
|
124
|
+
"el-icon-top",
|
125
|
+
"el-icon-top-left",
|
126
|
+
"el-icon-top-right",
|
127
|
+
"el-icon-arrow-left",
|
128
|
+
"el-icon-arrow-right",
|
129
|
+
"el-icon-arrow-down",
|
130
|
+
"el-icon-arrow-up",
|
131
|
+
"el-icon-d-arrow-left",
|
132
|
+
"el-icon-d-arrow-right",
|
133
|
+
"el-icon-video-pause",
|
134
|
+
"el-icon-video-play",
|
135
|
+
"el-icon-refresh",
|
136
|
+
"el-icon-refresh-right",
|
137
|
+
"el-icon-refresh-left",
|
138
|
+
"el-icon-finished",
|
139
|
+
"el-icon-sort",
|
140
|
+
"el-icon-sort-up",
|
141
|
+
"el-icon-sort-down",
|
142
|
+
"el-icon-rank",
|
143
|
+
"el-icon-loading",
|
144
|
+
"el-icon-view",
|
145
|
+
"el-icon-c-scale-to-original",
|
146
|
+
"el-icon-date",
|
147
|
+
"el-icon-edit",
|
148
|
+
"el-icon-edit-outline",
|
149
|
+
"el-icon-folder",
|
150
|
+
"el-icon-folder-opened",
|
151
|
+
"el-icon-folder-add",
|
152
|
+
"el-icon-folder-remove",
|
153
|
+
"el-icon-folder-delete",
|
154
|
+
"el-icon-folder-checked",
|
155
|
+
"el-icon-tickets",
|
156
|
+
"el-icon-document-remove",
|
157
|
+
"el-icon-document-delete",
|
158
|
+
"el-icon-document-copy",
|
159
|
+
"el-icon-document-checked",
|
160
|
+
"el-icon-document",
|
161
|
+
"el-icon-document-add",
|
162
|
+
"el-icon-printer",
|
163
|
+
"el-icon-paperclip",
|
164
|
+
"el-icon-takeaway-box",
|
165
|
+
"el-icon-search",
|
166
|
+
"el-icon-monitor",
|
167
|
+
"el-icon-attract",
|
168
|
+
"el-icon-mobile",
|
169
|
+
"el-icon-scissors",
|
170
|
+
"el-icon-umbrella",
|
171
|
+
"el-icon-headset",
|
172
|
+
"el-icon-brush",
|
173
|
+
"el-icon-mouse",
|
174
|
+
"el-icon-coordinate",
|
175
|
+
"el-icon-magic-stick",
|
176
|
+
"el-icon-reading",
|
177
|
+
"el-icon-data-line",
|
178
|
+
"el-icon-data-board",
|
179
|
+
"el-icon-pie-chart",
|
180
|
+
"el-icon-data-analysis",
|
181
|
+
"el-icon-collection-tag",
|
182
|
+
"el-icon-film",
|
183
|
+
"el-icon-suitcase",
|
184
|
+
"el-icon-suitcase-1",
|
185
|
+
"el-icon-receiving",
|
186
|
+
"el-icon-collection",
|
187
|
+
"el-icon-files",
|
188
|
+
"el-icon-notebook-1",
|
189
|
+
"el-icon-notebook-2",
|
190
|
+
"el-icon-toilet-paper",
|
191
|
+
"el-icon-office-building",
|
192
|
+
"el-icon-school",
|
193
|
+
"el-icon-table-lamp",
|
194
|
+
"el-icon-house",
|
195
|
+
"el-icon-no-smoking",
|
196
|
+
"el-icon-smoking",
|
197
|
+
"el-icon-shopping-cart-full",
|
198
|
+
"el-icon-shopping-cart-1",
|
199
|
+
"el-icon-shopping-cart-2",
|
200
|
+
"el-icon-shopping-bag-1",
|
201
|
+
"el-icon-shopping-bag-2",
|
202
|
+
"el-icon-sold-out",
|
203
|
+
"el-icon-sell",
|
204
|
+
"el-icon-present",
|
205
|
+
"el-icon-box",
|
206
|
+
"el-icon-bank-card",
|
207
|
+
"el-icon-money",
|
208
|
+
"el-icon-coin",
|
209
|
+
"el-icon-wallet",
|
210
|
+
"el-icon-discount",
|
211
|
+
"el-icon-price-tag",
|
212
|
+
"el-icon-news",
|
213
|
+
"el-icon-guide",
|
214
|
+
"el-icon-male",
|
215
|
+
"el-icon-female",
|
216
|
+
"el-icon-thumb",
|
217
|
+
"el-icon-cpu",
|
218
|
+
"el-icon-link",
|
219
|
+
"el-icon-connection",
|
220
|
+
"el-icon-open",
|
221
|
+
"el-icon-turn-off",
|
222
|
+
"el-icon-set-up",
|
223
|
+
"el-icon-chat-round",
|
224
|
+
"el-icon-chat-line-round",
|
225
|
+
"el-icon-chat-square",
|
226
|
+
"el-icon-chat-dot-round",
|
227
|
+
"el-icon-chat-dot-square",
|
228
|
+
"el-icon-chat-line-square",
|
229
|
+
"el-icon-message",
|
230
|
+
"el-icon-postcard",
|
231
|
+
"el-icon-position",
|
232
|
+
"el-icon-turn-off-microphone",
|
233
|
+
"el-icon-microphone",
|
234
|
+
"el-icon-close-notification",
|
235
|
+
"el-icon-bangzhu",
|
236
|
+
"el-icon-time",
|
237
|
+
"el-icon-odometer",
|
238
|
+
"el-icon-crop",
|
239
|
+
"el-icon-aim",
|
240
|
+
"el-icon-switch-button",
|
241
|
+
"el-icon-full-screen",
|
242
|
+
"el-icon-copy-document",
|
243
|
+
"el-icon-mic",
|
244
|
+
"el-icon-stopwatch",
|
245
|
+
"el-icon-medal-1",
|
246
|
+
"el-icon-medal",
|
247
|
+
"el-icon-trophy",
|
248
|
+
"el-icon-trophy-1",
|
249
|
+
"el-icon-first-aid-kit",
|
250
|
+
"el-icon-discover",
|
251
|
+
"el-icon-place",
|
252
|
+
"el-icon-location",
|
253
|
+
"el-icon-location-outline",
|
254
|
+
"el-icon-location-information",
|
255
|
+
"el-icon-add-location",
|
256
|
+
"el-icon-delete-location",
|
257
|
+
"el-icon-map-location",
|
258
|
+
"el-icon-alarm-clock",
|
259
|
+
"el-icon-timer",
|
260
|
+
"el-icon-watch-1",
|
261
|
+
"el-icon-watch",
|
262
|
+
"el-icon-lock",
|
263
|
+
"el-icon-unlock",
|
264
|
+
"el-icon-key",
|
265
|
+
"el-icon-service",
|
266
|
+
"el-icon-mobile-phone",
|
267
|
+
"el-icon-bicycle",
|
268
|
+
"el-icon-truck",
|
269
|
+
"el-icon-ship",
|
270
|
+
"el-icon-basketball",
|
271
|
+
"el-icon-football",
|
272
|
+
"el-icon-soccer",
|
273
|
+
"el-icon-baseball",
|
274
|
+
"el-icon-wind-power",
|
275
|
+
"el-icon-light-rain",
|
276
|
+
"el-icon-lightning",
|
277
|
+
"el-icon-heavy-rain",
|
278
|
+
"el-icon-sunrise",
|
279
|
+
"el-icon-sunrise-1",
|
280
|
+
"el-icon-sunset",
|
281
|
+
"el-icon-sunny",
|
282
|
+
"el-icon-cloudy",
|
283
|
+
"el-icon-partly-cloudy",
|
284
|
+
"el-icon-cloudy-and-sunny",
|
285
|
+
"el-icon-moon",
|
286
|
+
"el-icon-moon-night",
|
287
|
+
"el-icon-dish",
|
288
|
+
"el-icon-dish-1",
|
289
|
+
"el-icon-food",
|
290
|
+
"el-icon-chicken",
|
291
|
+
"el-icon-fork-spoon",
|
292
|
+
"el-icon-knife-fork",
|
293
|
+
"el-icon-burger",
|
294
|
+
"el-icon-tableware",
|
295
|
+
"el-icon-sugar",
|
296
|
+
"el-icon-dessert",
|
297
|
+
"el-icon-ice-cream",
|
298
|
+
"el-icon-hot-water",
|
299
|
+
"el-icon-water-cup",
|
300
|
+
"el-icon-coffee-cup",
|
301
|
+
"el-icon-cold-drink",
|
302
|
+
"el-icon-goblet",
|
303
|
+
"el-icon-goblet-full",
|
304
|
+
"el-icon-goblet-square",
|
305
|
+
"el-icon-goblet-square-full",
|
306
|
+
"el-icon-refrigerator",
|
307
|
+
"el-icon-grape",
|
308
|
+
"el-icon-watermelon",
|
309
|
+
"el-icon-cherry",
|
310
|
+
"el-icon-apple",
|
311
|
+
"el-icon-pear",
|
312
|
+
"el-icon-orange",
|
313
|
+
"el-icon-coffee",
|
314
|
+
"el-icon-ice-tea",
|
315
|
+
"el-icon-ice-drink",
|
316
|
+
"el-icon-milk-tea",
|
317
|
+
"el-icon-potato-strips",
|
318
|
+
"el-icon-lollipop",
|
319
|
+
"el-icon-ice-cream-square",
|
320
|
+
"el-icon-ice-cream-round"
|
321
|
+
]
|
322
|
+
};
|
323
|
+
},
|
324
|
+
created() {},
|
325
|
+
methods: {
|
326
|
+
handleIconClick(icon) {
|
327
|
+
this.$emit("input", icon);
|
328
|
+
},
|
329
|
+
handleInputClear() {
|
330
|
+
this.$emit("input", "");
|
331
|
+
}
|
332
|
+
}
|
333
|
+
};
|
334
|
+
</script>
|
335
|
+
|
336
|
+
<style lang="less" scoped>
|
337
|
+
.input-prefix {
|
338
|
+
height: 100%;
|
339
|
+
width: 32px;
|
340
|
+
display: flex;
|
341
|
+
align-items: center;
|
342
|
+
.icon {
|
343
|
+
font-size: 20px;
|
344
|
+
}
|
345
|
+
}
|
346
|
+
.th-icons {
|
347
|
+
height: 300px;
|
348
|
+
overflow-y: scroll;
|
349
|
+
.icon {
|
350
|
+
padding: 8px;
|
351
|
+
font-size: 20px;
|
352
|
+
border-radius: 2px;
|
353
|
+
}
|
354
|
+
.icon:hover {
|
355
|
+
cursor: pointer;
|
356
|
+
background-color: #f2f2f2;
|
357
|
+
// transition: .3s;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
</style>
|
@@ -0,0 +1,126 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<template v-for="(item, index) in actions">
|
4
|
+
<el-button
|
5
|
+
v-if="item.act_type === 'edit'"
|
6
|
+
:key="index"
|
7
|
+
:style="{ color: item.btn_disabled ? '' : item.btn_color }"
|
8
|
+
:type="item.btn_type"
|
9
|
+
:icon="item.btn_icon"
|
10
|
+
:disabled="item.btn_disabled"
|
11
|
+
@click="doEdit(item)"
|
12
|
+
>{{ item.btn_name }}</el-button
|
13
|
+
>
|
14
|
+
<el-button
|
15
|
+
v-else-if="item.act_type === 'look'"
|
16
|
+
:key="index"
|
17
|
+
:style="{ color: item.btn_disabled ? '' : item.btn_color }"
|
18
|
+
:type="item.btn_type"
|
19
|
+
:icon="item.btn_icon"
|
20
|
+
:disabled="item.btn_disabled"
|
21
|
+
@click="doLook(item)"
|
22
|
+
>{{ item.btn_name }}</el-button
|
23
|
+
>
|
24
|
+
<el-popover
|
25
|
+
class="action-popover"
|
26
|
+
v-else-if="item.act_type === 'delete'"
|
27
|
+
:key="index"
|
28
|
+
v-model="pop"
|
29
|
+
placement="top"
|
30
|
+
title=""
|
31
|
+
width="180"
|
32
|
+
trigger="manual"
|
33
|
+
>
|
34
|
+
<p>{{ item.btn_delmsg || msg }}</p>
|
35
|
+
<div style="text-align: right; margin: 0">
|
36
|
+
<el-button type="text" :disabled="loadingDel" @click="doCancel"
|
37
|
+
>取消</el-button
|
38
|
+
>
|
39
|
+
<el-button
|
40
|
+
:loading="loadingDel"
|
41
|
+
type="primary"
|
42
|
+
@click="doDelete(item)"
|
43
|
+
>确定</el-button
|
44
|
+
>
|
45
|
+
</div>
|
46
|
+
<el-button
|
47
|
+
:style="{ color: item.btn_disabled ? '' : item.btn_color }"
|
48
|
+
slot="reference"
|
49
|
+
:disabled="loadingDel || item.btn_disabled"
|
50
|
+
:type="item.btn_type"
|
51
|
+
:icon="item.btn_icon"
|
52
|
+
@click="toDelete"
|
53
|
+
>{{ item.btn_name }}</el-button
|
54
|
+
>
|
55
|
+
</el-popover>
|
56
|
+
<el-button
|
57
|
+
v-else
|
58
|
+
:key="index"
|
59
|
+
:style="{ color: item.btn_color }"
|
60
|
+
:type="item.btn_type"
|
61
|
+
:icon="item.btn_icon"
|
62
|
+
:disabled="item.btn_disabled"
|
63
|
+
@click="doEval(item)"
|
64
|
+
>{{ item.btn_name }}</el-button
|
65
|
+
>
|
66
|
+
</template>
|
67
|
+
</div>
|
68
|
+
</template>
|
69
|
+
|
70
|
+
<script>
|
71
|
+
export default {
|
72
|
+
props: {
|
73
|
+
actions: {
|
74
|
+
type: Array,
|
75
|
+
default: () => {
|
76
|
+
return [];
|
77
|
+
},
|
78
|
+
},
|
79
|
+
permission: {
|
80
|
+
type: Object,
|
81
|
+
required: false,
|
82
|
+
},
|
83
|
+
msg: {
|
84
|
+
type: String,
|
85
|
+
default: "确定删除本条数据吗?",
|
86
|
+
},
|
87
|
+
},
|
88
|
+
data() {
|
89
|
+
return {
|
90
|
+
pop: false,
|
91
|
+
loadingDel: false,
|
92
|
+
};
|
93
|
+
},
|
94
|
+
methods: {
|
95
|
+
toDelete() {
|
96
|
+
this.pop = true;
|
97
|
+
},
|
98
|
+
doCancel() {
|
99
|
+
this.pop = false;
|
100
|
+
},
|
101
|
+
doEval(item) {
|
102
|
+
this.$emit("on-eval", item);
|
103
|
+
},
|
104
|
+
doEdit(item) {
|
105
|
+
this.$emit("on-edit", item);
|
106
|
+
},
|
107
|
+
doLook(item) {
|
108
|
+
this.$emit("on-look", item);
|
109
|
+
},
|
110
|
+
doDelete(item) {
|
111
|
+
this.loadingDel = true;
|
112
|
+
const callback = (bool) => {
|
113
|
+
this.loadingDel = false;
|
114
|
+
this.pop = !bool;
|
115
|
+
};
|
116
|
+
this.$emit("on-delete", item, callback);
|
117
|
+
},
|
118
|
+
},
|
119
|
+
};
|
120
|
+
</script>
|
121
|
+
|
122
|
+
<style lang="less">
|
123
|
+
.el-button + .action-popover {
|
124
|
+
margin-left: 10px !important;
|
125
|
+
}
|
126
|
+
</style>
|