tianheng-ui 0.0.5 → 0.0.6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -38,12 +38,13 @@
38
38
  },
39
39
  "files": [
40
40
  "lib",
41
- "pachages",
41
+ "packages",
42
42
  "src"
43
43
  ],
44
44
  "homepage": "http://element.eleme.io",
45
45
  "keywords": [
46
46
  "tianheng",
47
47
  "prompt"
48
- ]
48
+ ],
49
+ "style": "lib/theme-chalk/index.css"
49
50
  }
@@ -0,0 +1,8 @@
1
+ import Cell from "./index.vue";
2
+
3
+ /* istanbul ignore next */
4
+ Cell.install = function(Vue) {
5
+ Vue.component(Cell.name, Cell);
6
+ };
7
+
8
+ export default Cell;
@@ -0,0 +1,144 @@
1
+ <template>
2
+ <div>
3
+ <el-skeleton :loading="loading" animated>
4
+ <template slot="template">
5
+ <div class="skeleton">
6
+ <el-skeleton-item class="skeleton-icon" variant="image" />
7
+ <div class="skeleton-content">
8
+ <el-skeleton-item class="skeleton-title" variant="h4" />
9
+ <el-skeleton-item class="skeleton-label" variant="text" />
10
+ </div>
11
+ <el-skeleton-item class="skeleton-value" variant="text" />
12
+ </div>
13
+ </template>
14
+ </el-skeleton>
15
+ <div v-if="!loading" class="th-cell" :style="customStyle">
16
+ <i v-if="icon" class="th-cell-icon" :class="icon"></i>
17
+ <slot v-else name="icon" />
18
+ <div class="th-cell-content">
19
+ <div v-if="title" class="th-cell-title">{{ title }}</div>
20
+ <slot v-else name="title" />
21
+ <div v-if="label" class="th-cell-label">{{ label }}</div>
22
+ <slot v-else name="label" />
23
+ </div>
24
+ <div v-if="value" class="th-cell-value">{{ value }}</div>
25
+ <slot v-else />
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ export default {
32
+ name:'ThCell',
33
+ props: {
34
+ title: {
35
+ type: String,
36
+ default: () => {
37
+ return "";
38
+ },
39
+ },
40
+ value: {
41
+ type: String,
42
+ default: () => {
43
+ return "";
44
+ },
45
+ },
46
+ label: {
47
+ type: String,
48
+ default: () => {
49
+ return "";
50
+ },
51
+ },
52
+ icon: {
53
+ type: String,
54
+ default: () => {
55
+ return "";
56
+ },
57
+ },
58
+ customStyle: {
59
+ type: String,
60
+ default: () => {
61
+ return "";
62
+ },
63
+ },
64
+ loading: {
65
+ type: Boolean,
66
+ default: () => {
67
+ return false;
68
+ },
69
+ },
70
+ },
71
+ };
72
+ </script>
73
+
74
+ <style lang="less" scoped>
75
+ .th-cell {
76
+ position: relative;
77
+ display: flex;
78
+ align-items: center;
79
+ padding: 10px 15px;
80
+ border-radius: 4px;
81
+ border: 1px solid #ebeef5;
82
+ background-color: white;
83
+ overflow: hidden;
84
+ transition: 0.3s;
85
+ .th-cell-icon {
86
+ margin-right: 10px;
87
+ font-size: 18px;
88
+ }
89
+ .th-cell-content {
90
+ flex: 1;
91
+ }
92
+ &-title {
93
+ font-size: 16px;
94
+ color: #333333;
95
+ }
96
+ &-label {
97
+ margin-top: 5px;
98
+ font-size: 14px;
99
+ color: #666666;
100
+ word-wrap: break-word;
101
+ word-break: break-all;
102
+ }
103
+ &-value {
104
+ margin-left: 10px;
105
+ max-width: 50%;
106
+ font-size: 14px;
107
+ color: #999999;
108
+ word-wrap: break-word;
109
+ word-break: break-all;
110
+ }
111
+ }
112
+ .th-cell:hover {
113
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
114
+ }
115
+
116
+ .skeleton {
117
+ display: flex;
118
+ align-items: center;
119
+ // height: 64px;
120
+ margin-bottom: 20px;
121
+ padding: 10px 15px;
122
+ border-radius: 4px;
123
+ border: 1px solid #ebeef5;
124
+ &-icon {
125
+ width: 30px;
126
+ height: 30px;
127
+ margin-right: 10px;
128
+ font-size: 18px;
129
+ }
130
+ &-content {
131
+ flex: 1;
132
+ }
133
+ &-title {
134
+ width: 100px;
135
+ }
136
+ &-label {
137
+ margin-top: 5px;
138
+ }
139
+ &-value {
140
+ margin-left: 10px;
141
+ width: 100px;
142
+ }
143
+ }
144
+ </style>
@@ -0,0 +1,8 @@
1
+ import Icons from "./index.vue";
2
+
3
+ /* istanbul ignore next */
4
+ Icons.install = function(Vue) {
5
+ Vue.component(Icons.name, Icons);
6
+ };
7
+
8
+ export default Icons;
@@ -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>
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <div>
3
+ <template v-for="(item, index) in options">
4
+ <template v-if="!item.hide">
5
+ <el-table-column
6
+ v-if="item.type"
7
+ :key="index"
8
+ :type="item.type"
9
+ :label="item.label"
10
+ width="50"
11
+ >
12
+ </el-table-column>
13
+ <el-table-column
14
+ v-else-if="item.children"
15
+ :key="index"
16
+ :prop="item.prop"
17
+ :label="item.label"
18
+ :width="item.width"
19
+ :align="item.align"
20
+ :fixed="item.fixed"
21
+ :sortable="item.sortable"
22
+ :sort-method="item.sortMethod"
23
+ show-overflow-tooltip
24
+ >
25
+ <TableColumn :key="index" :options="item.children"></TableColumn>
26
+ </el-table-column>
27
+ <el-table-column
28
+ v-else
29
+ :key="index"
30
+ :prop="item.prop"
31
+ :label="item.label"
32
+ :width="item.width"
33
+ :align="item.align"
34
+ :fixed="item.fixed"
35
+ :sortable="item.sortable"
36
+ :sort-method="item.sortMethod"
37
+ show-overflow-tooltip
38
+ >
39
+ <template slot-scope="scope">
40
+ <slot v-if="item.slot" name="slot" :scope="scope" :option="item" />
41
+ <div v-else>{{ scope.row[item.prop] }}</div>
42
+ </template>
43
+ </el-table-column>
44
+ </template>
45
+ </template>
46
+ </div>
47
+ </template>
48
+
49
+ <script>
50
+ export default {
51
+ name: "TableColumn",
52
+ props: {
53
+ options: {
54
+ type: Array,
55
+ default: () => {
56
+ return [];
57
+ },
58
+ },
59
+ },
60
+ created(){
61
+ /**
62
+ *
63
+ * <template v-if={!item.hide}>
64
+ <el-table-column
65
+ v-if={item.type}
66
+ type={item.type}
67
+ label={item.label}
68
+ width="50"
69
+ ></el-table-column>
70
+ <el-table-column
71
+ v-else-if={item.children}
72
+ prop={item.prop}
73
+ label={item.label}
74
+ width={item.width}
75
+ align={item.align}
76
+ fixed={item.fixed}
77
+ sortable={item.sortable}
78
+ sort-method={item.sortMethod}
79
+ show-overflow-tooltip
80
+ >
81
+ {this.dynamicItem(item.children)}
82
+ </el-table-column>
83
+ <el-table-column
84
+ v-else
85
+ prop={item.prop}
86
+ label={item.label}
87
+ width={item.width}
88
+ align={item.align}
89
+ fixed={item.fixed}
90
+ sortable={item.sortable}
91
+ sort-method={item.sortMethod}
92
+ show-overflow-tooltip
93
+ >
94
+ <template slot-scope="scope">
95
+ <slot
96
+ v-if={item.slot}
97
+ name="slot"
98
+ scope={scope}
99
+ option={item}
100
+ />
101
+ <div v-else>{scope.row[item.prop]}</div>
102
+ </template>
103
+ </el-table-column>
104
+ </template>
105
+ */
106
+ console.log(this.options)
107
+ }
108
+ };
109
+ </script>
110
+
111
+ <style></style>
@@ -0,0 +1,8 @@
1
+ import Table from "./index.vue";
2
+
3
+ /* istanbul ignore next */
4
+ Table.install = function(Vue) {
5
+ Vue.component(Table.name, Table);
6
+ };
7
+
8
+ export default Table;
@@ -0,0 +1,251 @@
1
+ <template>
2
+ <div class="th-table">
3
+ <el-table
4
+ ref="th_table"
5
+ v-loading="loading"
6
+ :data="data"
7
+ :row-key="rowKey"
8
+ stripe
9
+ :highlight-current-row="selectType === 'single'"
10
+ :tree-props="treeProps"
11
+ @current-change="handleSingleSelect"
12
+ @row-dblclick="dblclick"
13
+ @selection-change="handleSelectionChange"
14
+ >
15
+ <template v-for="(item, index) in options">
16
+ <template v-if="!item.hide">
17
+ <el-table-column
18
+ v-if="item.type"
19
+ :key="index"
20
+ :type="item.type"
21
+ :label="item.label"
22
+ width="50"
23
+ >
24
+ </el-table-column>
25
+ <el-table-column
26
+ v-else-if="item.children"
27
+ :key="index"
28
+ :prop="item.prop"
29
+ :label="item.label"
30
+ :width="item.width"
31
+ :align="item.align || 'left'"
32
+ :fixed="item.fixed || null"
33
+ :sortable="item.sortable"
34
+ :sort-method="item.sortMethod"
35
+ show-overflow-tooltip
36
+ >
37
+ <table-column :options="item.children"></table-column>
38
+ </el-table-column>
39
+ <el-table-column
40
+ v-else
41
+ :key="index"
42
+ :prop="item.prop"
43
+ :label="item.label"
44
+ :width="item.width"
45
+ :align="item.align || 'left'"
46
+ :fixed="item.fixed || null"
47
+ :sortable="item.sortable"
48
+ :sort-method="item.sortMethod"
49
+ show-overflow-tooltip
50
+ >
51
+ <template slot-scope="scope">
52
+ <slot
53
+ v-if="item.slot"
54
+ :name="item.slot"
55
+ :scope="scope"
56
+ :option="item"
57
+ />
58
+ <div v-else>{{ scope.row[item.prop] }}</div>
59
+ </template>
60
+ </el-table-column>
61
+ </template>
62
+ </template>
63
+ <!-- <table-column :options="options">
64
+ <template #slot="{ scope,option }">
65
+ <slot :name="option.slot" :scope="scope" :option="option" />
66
+ </template>
67
+ </table-column> -->
68
+ <template #empty>
69
+ <div>
70
+ {{ loading ? loadingText || "加载中" : emptyText || "暂无数据" }}
71
+ </div>
72
+ </template>
73
+ </el-table>
74
+ <!-- <i class="th-table-more el-icon-setting"></i> -->
75
+
76
+ <div v-if="Object.keys(pageInfo).length > 0 && showPage" class="pagination">
77
+ <el-pagination
78
+ :current-page="pageInfo.currentPage"
79
+ :page-sizes="pageInfo.sizes"
80
+ :page-size="pageInfo.pageSize"
81
+ layout="total, prev, pager, next, sizes"
82
+ :total="pageInfo.total"
83
+ @size-change="handleSizeChange"
84
+ @current-change="handleCurrentChange"
85
+ @prev-click="handlePrevClick"
86
+ @next-click="handleNextClick"
87
+ />
88
+ </div>
89
+ </div>
90
+ </template>
91
+
92
+ <script>
93
+ import TableColumn from "./column.vue";
94
+
95
+ export default {
96
+ name:'ThTable',
97
+ components: {
98
+ TableColumn,
99
+ },
100
+ props: {
101
+ data: {
102
+ type: Array,
103
+ default: () => {
104
+ return [];
105
+ },
106
+ },
107
+ options: {
108
+ type: Array,
109
+ default: () => {
110
+ return [];
111
+ },
112
+ },
113
+ // single:单行选中 multiple:多行选中
114
+ selectType: {
115
+ type: String,
116
+ default: () => {
117
+ return "";
118
+ },
119
+ },
120
+ // 行双击事件
121
+ dblclick: {
122
+ type: Function,
123
+ default: () => {
124
+ return null;
125
+ },
126
+ },
127
+ treeProps: {
128
+ type: Object,
129
+ default: function() {
130
+ return {};
131
+ },
132
+ },
133
+ // 对象,不传表示没有分页,包含三个参数,均必填pageSize:每页展示的条数。currentPage:当前页码。pageCount:总页数
134
+ pageInfo: {
135
+ type: Object,
136
+ default: function() {
137
+ return {};
138
+ },
139
+ },
140
+ loading: {
141
+ type: Boolean,
142
+ default: () => {
143
+ return false;
144
+ },
145
+ },
146
+ height: {
147
+ type: String,
148
+ default: () => {
149
+ return "";
150
+ },
151
+ },
152
+ rowKey: {
153
+ type: String,
154
+ default: () => {
155
+ return "";
156
+ },
157
+ },
158
+ showPage: {
159
+ type: Boolean,
160
+ default: () => {
161
+ return true;
162
+ },
163
+ },
164
+ emptyText: {
165
+ type: String,
166
+ default: () => {
167
+ return "暂无数据";
168
+ },
169
+ },
170
+ loadingText: {
171
+ type: String,
172
+ default: () => {
173
+ return "加载中";
174
+ },
175
+ },
176
+ },
177
+ data() {
178
+ return {};
179
+ },
180
+ methods: {
181
+ handleSelectionChange(currentRow) {
182
+ if (currentRow) {
183
+ this.$emit("selection-change", currentRow);
184
+ }
185
+ },
186
+ // 选中行--单选
187
+ handleSingleSelect(currentRow, oldCurrentRow) {
188
+ if (currentRow) {
189
+ this.$emit("select-row-change", currentRow);
190
+ }
191
+ },
192
+ // 每页展示的条数 改变时
193
+ handleSizeChange(val) {
194
+ this.pageInfo.pageSize = val;
195
+ this.$emit(
196
+ "pageNumberChange",
197
+ this.pageInfo.currentPage,
198
+ this.pageInfo.pageSize
199
+ );
200
+ },
201
+ // 当前页码 改变时
202
+ handleCurrentChange(val) {
203
+ this.pageInfo.currentPage = val;
204
+ this.$emit(
205
+ "pageNumberChange",
206
+ this.pageInfo.currentPage,
207
+ this.pageInfo.pageSize
208
+ );
209
+ },
210
+ // 点击上一页
211
+ handlePrevClick() {
212
+ if (this.pageInfo.currentPage === 1) return;
213
+ this.pageInfo.currentPage -= 1;
214
+ this.$emit(
215
+ "pageNumberChange",
216
+ this.pageInfo.currentPage,
217
+ this.pageInfo.pageSize
218
+ );
219
+ },
220
+ // 点击下一页
221
+ handleNextClick() {
222
+ if (this.pageInfo.currentPage === this.pageInfo.pageCount) return;
223
+ this.pageInfo.currentPage += 1;
224
+ this.$emit(
225
+ "pageNumberChange",
226
+ this.pageInfo.currentPage,
227
+ this.pageInfo.pageSize
228
+ );
229
+ },
230
+ getTable() {
231
+ return this.$refs["th_table"];
232
+ },
233
+ },
234
+ };
235
+ </script>
236
+
237
+ <style lang="less" scoped>
238
+ .th-table {
239
+ position: relative;
240
+ width: 100%;
241
+ .pagination {
242
+ margin-top: 20px;
243
+ }
244
+ &-more {
245
+ position: absolute;
246
+ top: 13px;
247
+ right: 5px;
248
+ cursor: pointer;
249
+ }
250
+ }
251
+ </style>
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <div class="table-search">
3
+ <template v-for="(item, index) in options">
4
+ <el-input
5
+ v-if="item.type === 'input'"
6
+ class="table-search-item"
7
+ v-model="params[item.value]"
8
+ :key="index"
9
+ :style="{ width: item.width + 'px' }"
10
+ :placeholder="item.placeholder || '请输入'"
11
+ :size="item.size || 'mini'"
12
+ clearable
13
+ ></el-input>
14
+ <el-date-picker
15
+ v-if="item.type === 'date'"
16
+ class="table-search-item"
17
+ v-model="params[item.value]"
18
+ :key="index"
19
+ :style="{ width: item.width + 'px' }"
20
+ :type="item.dateType || 'date'"
21
+ :format="item.format"
22
+ :value-format="item.valueFormat"
23
+ :size="item.size || 'mini'"
24
+ range-separator="至"
25
+ start-placeholder="开始日期"
26
+ end-placeholder="结束日期"
27
+ >
28
+ </el-date-picker>
29
+ </template>
30
+
31
+ <el-button
32
+ type="primary"
33
+ icon="el-icon-search"
34
+ size="mini"
35
+ plain
36
+ @click="doSearch"
37
+ >查询</el-button
38
+ >
39
+ <el-button
40
+ type="primary"
41
+ icon="el-icon-refresh-right"
42
+ size="mini"
43
+ plain
44
+ @click="doReset"
45
+ >重置</el-button
46
+ >
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ export default {
52
+ props: {
53
+ options: {
54
+ type: Array,
55
+ default: () => {
56
+ return [];
57
+ },
58
+ },
59
+ params: {
60
+ type: Object,
61
+ default: () => {
62
+ return {};
63
+ },
64
+ },
65
+ },
66
+ data() {
67
+ return {
68
+ datePickerTypes: [
69
+ "year",
70
+ "month",
71
+ "date",
72
+ "dates",
73
+ "week",
74
+ "datetime",
75
+ "datetimerange",
76
+ "daterange",
77
+ "monthrange",
78
+ ],
79
+ };
80
+ },
81
+ methods: {
82
+ doSearch() {
83
+ this.$emit("on-search", this.params);
84
+ },
85
+ doReset() {
86
+ this.params = {};
87
+ this.$emit("on-reset", this.params);
88
+ },
89
+ },
90
+ };
91
+ </script>
92
+
93
+ <style lang="less" scoped>
94
+ .table-search {
95
+ display: flex;
96
+ align-items: center;
97
+ margin-bottom: 10px;
98
+ &-item {
99
+ margin-right: 10px;
100
+ }
101
+ }
102
+ .table-search-item:last-child {
103
+ margin-right: 20px !important;
104
+ }
105
+ </style>
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <div class="tableTools">
3
+ <template v-for="(item, index) in options">
4
+ <el-button
5
+ v-if="item.act_type === 'add'"
6
+ :key="index"
7
+ :style="{ color: item.btn_color }"
8
+ :type="item.btn_type"
9
+ :icon="item.btn_icon"
10
+ :disabled="item.btn_disabled"
11
+ @click="doAdd(item)"
12
+ >{{ item.btn_name }}</el-button
13
+ >
14
+ <el-button
15
+ v-if="item.act_type === 'refresh'"
16
+ :key="index"
17
+ :style="{ color: item.btn_color }"
18
+ :type="item.btn_type"
19
+ :icon="item.btn_icon"
20
+ :disabled="item.btn_disabled"
21
+ @click="doRefresh(item)"
22
+ >{{ item.btn_name }}</el-button
23
+ >
24
+ <el-button
25
+ v-if="item.act_type === 'export'"
26
+ :key="index"
27
+ :style="{ color: item.btn_color }"
28
+ :type="item.btn_type"
29
+ :icon="item.btn_icon"
30
+ :disabled="item.btn_disabled"
31
+ @click="doExport(item)"
32
+ >{{ item.btn_name }}</el-button
33
+ >
34
+ <el-button
35
+ v-if="item.act_type === 'batch'"
36
+ :key="index"
37
+ :style="{ color: item.btn_color }"
38
+ :type="item.btn_type"
39
+ :icon="item.btn_icon"
40
+ :disabled="item.btn_disabled || selectionDisabled"
41
+ :loading="loadingDel"
42
+ @click="doBatch(item)"
43
+ >{{ item.btn_name }}</el-button
44
+ >
45
+ </template>
46
+ </div>
47
+ </template>
48
+
49
+ <script>
50
+ export default {
51
+ props: {
52
+ options: {
53
+ type: Array,
54
+ default: () => {
55
+ return [];
56
+ },
57
+ },
58
+ selectionDisabled: {
59
+ type: Boolean,
60
+ default: () => {
61
+ return true;
62
+ },
63
+ },
64
+ },
65
+ data() {
66
+ return {
67
+ loadingDel: false,
68
+ };
69
+ },
70
+ methods: {
71
+ doEval(item) {
72
+ this.$emit("on-eval", item);
73
+ },
74
+ doAdd(item) {
75
+ this.$emit("on-add", item);
76
+ },
77
+ doRefresh(item) {
78
+ this.$emit("on-refresh", item);
79
+ },
80
+ doExport(item) {
81
+ this.$emit("on-export", item);
82
+ },
83
+ doBatch(item) {
84
+ this.loadingDel = true;
85
+ const callback = (bool) => {
86
+ this.loadingDel = false;
87
+ };
88
+ this.$emit("on-batch", item, callback);
89
+ },
90
+ },
91
+ };
92
+ </script>
93
+
94
+ <style lang="less">
95
+ .tableTools {
96
+ margin-bottom: 10px;
97
+ }
98
+ </style>
package/src/index.js CHANGED
@@ -15,7 +15,7 @@ if (typeof window !== "undefined" && window.Vue) {
15
15
  }
16
16
 
17
17
  export default {
18
- version: "0.0.5",
18
+ version: "0.0.6",
19
19
  install,
20
20
  ...components
21
21
  };