chain-saasui 1.0.0
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/README.md +6 -0
- package/babel.config.js +13 -0
- package/build/webpack.common.js +54 -0
- package/build/webpack.components.js +69 -0
- package/build/webpack.demo.js +40 -0
- package/components/css/card.scss +19 -0
- package/components/css/common.scss +10 -0
- package/components/css/container.scss +14 -0
- package/components/css/detail.scss +87 -0
- package/components/css/dialog.scss +83 -0
- package/components/css/group.scss +82 -0
- package/components/css/index.scss +11 -0
- package/components/css/messagebox.scss +59 -0
- package/components/css/pagetable.scss +89 -0
- package/components/css/table.scss +0 -0
- package/components/css/tablebuttons.scss +15 -0
- package/components/css/unit.scss +25 -0
- package/components/src/SCard/index.vue +41 -0
- package/components/src/SContainer/index.vue +36 -0
- package/components/src/SDialog/index.vue +99 -0
- package/components/src/SDrawer/index.vue +95 -0
- package/components/src/SForm/SSelect/index.vue +108 -0
- package/components/src/SGroup/icon_rtsuc.png +0 -0
- package/components/src/SGroup/index.vue +81 -0
- package/components/src/SMessagebox/index.js +66 -0
- package/components/src/SMessagebox/messagebox.vue +85 -0
- package/components/src/SPage/Pagedetail.vue +114 -0
- package/components/src/SPage/Pagestep.vue +97 -0
- package/components/src/SPage/Pagetable.vue +109 -0
- package/components/src/STable/STablecolumn.vue +91 -0
- package/components/src/STable/index.vue +34 -0
- package/components/src/STableButtons/STableButtons.md +111 -0
- package/components/src/STableButtons/index.vue +96 -0
- package/components/src/SUnit/index.vue +75 -0
- package/components/src/index.js +46 -0
- package/gulpfile.js +20 -0
- package/jsconfig.json +25 -0
- package/lib/css/index.css +1 -0
- package/lib/saasui.common.js +1 -0
- package/package.json +82 -0
- package/public/favicon.ico +0 -0
- package/public/html/ie.html +46 -0
- package/public/index.html +274 -0
- package/public/robots.txt +2 -0
- package/public/template/base/Template_Account.xls +0 -0
- package/public/template/base/Template_Feedback.xls +0 -0
- package/public/template/base/Template_Team.xls +0 -0
- package/public/template/base/Template_Team_Member.xls +0 -0
- package/src/App.vue +30 -0
- package/src/assets/logo.png +0 -0
- package/src/components/HelloWorld.vue +58 -0
- package/src/main.js +16 -0
- package/vue.config.js +40 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="saas-detail">
|
|
3
|
+
<div class="saas-detail-top">
|
|
4
|
+
<div class="saas-detail-header">
|
|
5
|
+
<div class="saas-detail-backbox">
|
|
6
|
+
<div v-if="showClose" class="saas-detail-back" @click="goBack">
|
|
7
|
+
<span class="el-icon-arrow-left"></span>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="saas-detail-titlebox" :style="computeStyle">
|
|
11
|
+
<div class="saas-detail-title">
|
|
12
|
+
<span class="saas-title-line"></span>
|
|
13
|
+
<template v-if="$slots.title">
|
|
14
|
+
<slot name="title"></slot>
|
|
15
|
+
</template>
|
|
16
|
+
<span v-else>
|
|
17
|
+
{{title}}
|
|
18
|
+
</span>
|
|
19
|
+
</div>
|
|
20
|
+
<div v-if="titleSub" class="saas-detail-sub">{{titleSub}}</div>
|
|
21
|
+
</div>
|
|
22
|
+
<slot name="header-append"></slot>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="saas-detail-content">
|
|
25
|
+
<slot></slot>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<template v-if="showFooter">
|
|
29
|
+
<div class="saas-detail-footer">
|
|
30
|
+
<slot v-if="$slots.footer" name="footer"></slot>
|
|
31
|
+
<template v-else>
|
|
32
|
+
<el-button @click="handleClose">{{ cancelText }}</el-button>
|
|
33
|
+
<el-button :loading="loadingBtn" type="primary" @click="handleSubmit" v-preventReClick="5000">{{confirmText}}</el-button>
|
|
34
|
+
</template>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
<script>
|
|
40
|
+
import { omit } from "@saas/utils";
|
|
41
|
+
export default {
|
|
42
|
+
name: "SPagedetail",
|
|
43
|
+
props: {
|
|
44
|
+
showFooter: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: () => true,
|
|
47
|
+
},
|
|
48
|
+
showClose: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: () => true,
|
|
51
|
+
},
|
|
52
|
+
loadingBtn: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: () => false,
|
|
55
|
+
},
|
|
56
|
+
computeStyle: {
|
|
57
|
+
type: Object,
|
|
58
|
+
default: () => ({
|
|
59
|
+
width: "1000px",
|
|
60
|
+
margin: "0 auto",
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
title: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "",
|
|
66
|
+
},
|
|
67
|
+
titleSub: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "",
|
|
70
|
+
},
|
|
71
|
+
confirmText: {
|
|
72
|
+
type: String,
|
|
73
|
+
default() {
|
|
74
|
+
return this.$t("buttonGroup.sure");
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
cancelText: {
|
|
78
|
+
type: String,
|
|
79
|
+
default() {
|
|
80
|
+
return this.$t("buttonGroup.cancel");
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
data() {
|
|
85
|
+
return {};
|
|
86
|
+
},
|
|
87
|
+
computed: {
|
|
88
|
+
show: {
|
|
89
|
+
get() {
|
|
90
|
+
return this.visible;
|
|
91
|
+
},
|
|
92
|
+
set(val) {
|
|
93
|
+
this.$emit("update:visible", val);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
deactivated() {
|
|
98
|
+
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
99
|
+
},
|
|
100
|
+
methods: {
|
|
101
|
+
handleSubmit() {
|
|
102
|
+
this.$emit("confirm");
|
|
103
|
+
},
|
|
104
|
+
handleClose() {
|
|
105
|
+
this.$emit("close");
|
|
106
|
+
},
|
|
107
|
+
goBack() {
|
|
108
|
+
this.$emit("close");
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
</script>
|
|
113
|
+
<style lang="scss" scoped>
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="saas-pagestep">
|
|
3
|
+
<div class="saas-pagestep-top">
|
|
4
|
+
<div class="saas-pagestep-header">
|
|
5
|
+
<div class="saas-pagestep-backbox">
|
|
6
|
+
<div class="saas-pagestep-back" @click="goBack">
|
|
7
|
+
<span class="el-icon-arrow-left"></span>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="saas-pagestep-titlebox" :style="{width:width}">
|
|
11
|
+
<div class="saas-pagestep-title">
|
|
12
|
+
<span class="saas-title-line"></span>
|
|
13
|
+
<template v-if="$slots.title">
|
|
14
|
+
<slot name="title"></slot>
|
|
15
|
+
</template>
|
|
16
|
+
<span v-else>
|
|
17
|
+
{{title}}
|
|
18
|
+
</span>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
</div>
|
|
23
|
+
<div class="saas-pagestep-content">
|
|
24
|
+
<slot></slot>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
<script>
|
|
30
|
+
import { omit } from "@saas/utils";
|
|
31
|
+
export default {
|
|
32
|
+
name: "SPagestep",
|
|
33
|
+
props: {
|
|
34
|
+
showFooter: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: () => true,
|
|
37
|
+
},
|
|
38
|
+
loadingBtn: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: () => false,
|
|
41
|
+
},
|
|
42
|
+
width: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "1000px",
|
|
45
|
+
},
|
|
46
|
+
title: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: "",
|
|
49
|
+
},
|
|
50
|
+
titleSub: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: "",
|
|
53
|
+
},
|
|
54
|
+
confirmText: {
|
|
55
|
+
type: String,
|
|
56
|
+
default() {
|
|
57
|
+
return this.$t("buttonGroup.sure");
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
cancelText: {
|
|
61
|
+
type: String,
|
|
62
|
+
default() {
|
|
63
|
+
return this.$t("buttonGroup.cancel");
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {};
|
|
69
|
+
},
|
|
70
|
+
computed: {
|
|
71
|
+
show: {
|
|
72
|
+
get() {
|
|
73
|
+
return this.visible;
|
|
74
|
+
},
|
|
75
|
+
set(val) {
|
|
76
|
+
this.$emit("update:visible", val);
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
deactivated() {
|
|
81
|
+
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
82
|
+
},
|
|
83
|
+
methods: {
|
|
84
|
+
handleSubmit() {
|
|
85
|
+
this.$emit("confirm");
|
|
86
|
+
},
|
|
87
|
+
handleClose() {
|
|
88
|
+
this.$emit("close");
|
|
89
|
+
},
|
|
90
|
+
goBack() {
|
|
91
|
+
this.$emit("close");
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
</script>
|
|
96
|
+
<style lang="scss" scoped>
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="saas-page-table">
|
|
3
|
+
<div class="saas-page-table-header">
|
|
4
|
+
<div class="saas-page-table-menu" :class="{ hasClose: showClose }">
|
|
5
|
+
<template v-if="showClose">
|
|
6
|
+
<div class="saas-page-table-back" @click="goBack">
|
|
7
|
+
<span class="el-icon-arrow-left"></span>
|
|
8
|
+
</div>
|
|
9
|
+
<span class="saas-page-table-back_title">{{ $t('atSalaryFileImport.return') }}</span>
|
|
10
|
+
<span class="saas-page-table-title_line"></span>
|
|
11
|
+
</template>
|
|
12
|
+
<span v-if="!showClose" class="saas-page-title-line"></span>
|
|
13
|
+
<span class="saas-page-table-title">
|
|
14
|
+
<template v-if="$slots.title">
|
|
15
|
+
<slot name="title"></slot>
|
|
16
|
+
</template>
|
|
17
|
+
<span v-else>{{ title }}</span>
|
|
18
|
+
</span>
|
|
19
|
+
<slot name="header-append"></slot>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="saas-page-table-form">
|
|
22
|
+
<slot name="form"></slot>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="saas-page-table-content">
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="saas-page-table-footer">
|
|
29
|
+
<slot name="footer"></slot>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
<script>
|
|
34
|
+
import { omit } from '@saas/utils';
|
|
35
|
+
export default {
|
|
36
|
+
name: 'SPagetable',
|
|
37
|
+
props: {
|
|
38
|
+
showFooter: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: () => true,
|
|
41
|
+
},
|
|
42
|
+
showClose: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: () => false,
|
|
45
|
+
},
|
|
46
|
+
loadingBtn: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: () => false,
|
|
49
|
+
},
|
|
50
|
+
computeStyle: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default: () => ({
|
|
53
|
+
width: '1000px',
|
|
54
|
+
margin: '0 auto',
|
|
55
|
+
}),
|
|
56
|
+
},
|
|
57
|
+
title: {
|
|
58
|
+
type: String,
|
|
59
|
+
default() {
|
|
60
|
+
return this.$t(`saasmenu.${this.$route.meta.code}`);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
titleSub: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '',
|
|
66
|
+
},
|
|
67
|
+
confirmText: {
|
|
68
|
+
type: String,
|
|
69
|
+
default() {
|
|
70
|
+
return this.$t('buttonGroup.sure');
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
cancelText: {
|
|
74
|
+
type: String,
|
|
75
|
+
default() {
|
|
76
|
+
return this.$t('buttonGroup.cancel');
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
data() {
|
|
81
|
+
return {};
|
|
82
|
+
},
|
|
83
|
+
computed: {
|
|
84
|
+
show: {
|
|
85
|
+
get() {
|
|
86
|
+
return this.visible;
|
|
87
|
+
},
|
|
88
|
+
set(val) {
|
|
89
|
+
this.$emit('update:visible', val);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
deactivated() {
|
|
94
|
+
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
95
|
+
},
|
|
96
|
+
methods: {
|
|
97
|
+
handleSubmit() {
|
|
98
|
+
this.$emit('confirm');
|
|
99
|
+
},
|
|
100
|
+
handleClose() {
|
|
101
|
+
this.$emit('close');
|
|
102
|
+
},
|
|
103
|
+
goBack() {
|
|
104
|
+
this.$emit('close');
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
</script>
|
|
109
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-table-column v-bind="columnProps">
|
|
3
|
+
<template slot="header">
|
|
4
|
+
<template v-if="!$slots['header-' + column.value]">
|
|
5
|
+
<span>{{ column.label }}</span>
|
|
6
|
+
<el-tooltip placement="top" v-if="column.tip" :content="column.tip">
|
|
7
|
+
<i style="color: #a1a5b2; margin-left: 6px" class="smart-info-filled"></i>
|
|
8
|
+
</el-tooltip>
|
|
9
|
+
</template>
|
|
10
|
+
<slot v-else :name="'header-' + column.value" :column="column">
|
|
11
|
+
{{ column.label }}
|
|
12
|
+
</slot>
|
|
13
|
+
</template>
|
|
14
|
+
<template v-if="column.type === 'index'" #default="{ $index, row }">
|
|
15
|
+
<slot :index="getIndex($index)" :row="row">
|
|
16
|
+
{{ getIndex($index) }}
|
|
17
|
+
</slot>
|
|
18
|
+
</template>
|
|
19
|
+
<template v-else #default="scope">
|
|
20
|
+
<slot :name="column.value" v-bind="getBindProps(scope)">
|
|
21
|
+
{{ selectValue(scope.row) }}
|
|
22
|
+
</slot>
|
|
23
|
+
</template>
|
|
24
|
+
</el-table-column>
|
|
25
|
+
</template>
|
|
26
|
+
<script>
|
|
27
|
+
import { isEmpty, formatIfJson, formatSubmitTime } from '@saas/utils';
|
|
28
|
+
export default {
|
|
29
|
+
name: 'STablecolumn',
|
|
30
|
+
components: {},
|
|
31
|
+
props: {
|
|
32
|
+
column: Object,
|
|
33
|
+
minWidth: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: 150,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
data() {
|
|
39
|
+
return {};
|
|
40
|
+
},
|
|
41
|
+
computed: {
|
|
42
|
+
columnProps() {
|
|
43
|
+
return {
|
|
44
|
+
...this.column,
|
|
45
|
+
'min-width': this.column.minWidth || this.minWidth,
|
|
46
|
+
prop: this.column.value,
|
|
47
|
+
label: this.column.label,
|
|
48
|
+
showOverflowTooltip: this.column.showOverflowTooltip != null ? this.column.showOverflowTooltip : true,
|
|
49
|
+
index: this.column.indexMethod || null,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
methods: {
|
|
54
|
+
selectValue(row) {
|
|
55
|
+
let str = '';
|
|
56
|
+
const { options = [], type = 'txt' } = this.column;
|
|
57
|
+
const value = row[this.column.value];
|
|
58
|
+
if (this.column.formatValue) {
|
|
59
|
+
return this.column.formatValue(row, this.column);
|
|
60
|
+
}
|
|
61
|
+
switch (type) {
|
|
62
|
+
case 'select':
|
|
63
|
+
let obj = options.find(f => f.value == value) || {};
|
|
64
|
+
str = formatIfJson(obj.label);
|
|
65
|
+
break;
|
|
66
|
+
case 'time':
|
|
67
|
+
str = formatSubmitTime(value, 'DD/MM/YYYY');
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
str = formatIfJson(value);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
if (isEmpty(str)) {
|
|
74
|
+
str = this.column.defaultValue || '-';
|
|
75
|
+
} else if (str.length > 500) {
|
|
76
|
+
str = str.slice(0, 500) + '...';
|
|
77
|
+
}
|
|
78
|
+
return str;
|
|
79
|
+
},
|
|
80
|
+
getBindProps(params) {
|
|
81
|
+
return {
|
|
82
|
+
...params,
|
|
83
|
+
column: this.column,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
getIndex($index) {
|
|
87
|
+
return this.indexMethod ? this.indexMethod($index) : $index + 1;
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-table ref="saasTable" class="saas-table" v-bind="$props" v-on="$listeners">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<STablecolumn v-for="column in columns" :key="column.value" :column="column"></STablecolumn>
|
|
5
|
+
</el-table>
|
|
6
|
+
</template>
|
|
7
|
+
<script>
|
|
8
|
+
import { omit } from '@saas/utils';
|
|
9
|
+
import { Table } from 'element-ui';
|
|
10
|
+
import STablecolumn from './STablecolumn.vue';
|
|
11
|
+
export default {
|
|
12
|
+
name: 'STable',
|
|
13
|
+
props: {
|
|
14
|
+
...Table.props,
|
|
15
|
+
border: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true,
|
|
18
|
+
},
|
|
19
|
+
columns: {
|
|
20
|
+
type: Array,
|
|
21
|
+
default: () => [],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
components: {
|
|
25
|
+
STablecolumn,
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
return {};
|
|
29
|
+
},
|
|
30
|
+
computed: {},
|
|
31
|
+
deactivated() {},
|
|
32
|
+
methods: {},
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
# `STableButtons` 行内操作按钮组组件
|
|
3
|
+
|
|
4
|
+
`<STableButtons />` 是一个智能化按钮组组件,支持 **操作按钮自动折叠、tooltip 提示、显示条件控制、简洁模式** 等特性,适用于表格、卡片等操作列场景。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 📦 功能特性
|
|
9
|
+
|
|
10
|
+
* ✅ 超过指定数量按钮自动折叠进下拉菜单
|
|
11
|
+
* ✅ 支持 `tooltip` 提示信息展示
|
|
12
|
+
* ✅ 支持 `show` 控制按钮显示(支持布尔值和函数)
|
|
13
|
+
* ✅ 支持简洁图标模式与文本下拉模式切换
|
|
14
|
+
* ✅ 按钮属性自由传入(disabled、type、icon等)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 💻 使用示例
|
|
19
|
+
|
|
20
|
+
```vue
|
|
21
|
+
<STableButtons :list="actionList" :row="row" :maxLength="2" moreType="more" @action="handleAction"/>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 示例按钮数据结构:
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
actionList: [
|
|
28
|
+
{
|
|
29
|
+
label: '编辑',
|
|
30
|
+
tip: '编辑该项',
|
|
31
|
+
attrs: {
|
|
32
|
+
type: 'primary',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: '删除',
|
|
37
|
+
tip: '不可恢复,请慎重',
|
|
38
|
+
attrs: {
|
|
39
|
+
type: 'danger',
|
|
40
|
+
disabled: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: '更多操作',
|
|
45
|
+
show: () => true, // 支持函数
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## ⚙️ Props 参数
|
|
53
|
+
|
|
54
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
55
|
+
| ----------- | --------- | ------------------------ | --------------- |
|
|
56
|
+
| `list` | `Array` | `[]` | 按钮配置数组,见下方格式说明 |
|
|
57
|
+
| `maxLength` | `Number` | `2` | 最多显示多少个按钮,其余收起 |
|
|
58
|
+
| `moreType` | `String` | ` text,more` | 更多类型 |
|
|
59
|
+
| `text` | `String` | `$t('buttonGroup.more')` | 下拉按钮显示文本(非简洁模式) |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 📌 按钮项结构(list)
|
|
64
|
+
|
|
65
|
+
每个按钮对象的字段如下:
|
|
66
|
+
|
|
67
|
+
| 字段名 | 类型 | 说明 |
|
|
68
|
+
| --------- | --------------------- | ------------------------- |
|
|
69
|
+
| `label` | `String` | 按钮文字内容 |
|
|
70
|
+
| `onClick` | `Function` | 点击事件 |
|
|
71
|
+
| `tip` | `String` | 鼠标悬浮提示内容,可选 |
|
|
72
|
+
| `show` | `Boolean \| Function` | 控制按钮是否显示,默认 `true` |
|
|
73
|
+
| `attrs` | `Object` | 按钮属性(type、disabled、icon等) |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 🧠 show 控制说明
|
|
78
|
+
|
|
79
|
+
支持传入布尔值或函数:
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
{
|
|
83
|
+
label: '操作',
|
|
84
|
+
show: true, // 或 () => user.hasPermission('xxx')
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
未设置 `show` 时默认为 `true`。
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 🎨 效果图(简化描述)
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
[编辑] [删除] [更多 ⏷]
|
|
96
|
+
点击更多 ⟶
|
|
97
|
+
├── 更多操作1
|
|
98
|
+
└── 更多操作2
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 💡 简洁模式 `moreType=more`
|
|
104
|
+
|
|
105
|
+
```vue
|
|
106
|
+
<STableButtons :list="actionList" moreType="more" />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
折叠按钮会只展示图标(默认使用 `smart-More` 样式),适合空间有限场景。
|
|
110
|
+
|
|
111
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="saas-table-buttons">
|
|
3
|
+
<template v-for="(btn, index) in buttonList">
|
|
4
|
+
<el-tooltip :disabled="!btn.tip" placement="top" :content="btn.tip" :key="index">
|
|
5
|
+
<el-button v-bind="finalAttrs(btn.attrs)" @click="handelClick(btn.action)">{{ btn.label }}</el-button>
|
|
6
|
+
</el-tooltip>
|
|
7
|
+
</template>
|
|
8
|
+
<el-dropdown v-if="dropdownList.length" @command="handleCommand">
|
|
9
|
+
<el-button v-bind="btnProps">
|
|
10
|
+
<i v-if="moreType == 'more'" class="smart-More"></i>
|
|
11
|
+
<template v-else-if="moreType == 'text'">
|
|
12
|
+
{{ text }}
|
|
13
|
+
<i class="el-icon-arrow-down"></i>
|
|
14
|
+
</template>
|
|
15
|
+
</el-button>
|
|
16
|
+
<el-dropdown-menu slot="dropdown">
|
|
17
|
+
<el-dropdown-item v-for="(drop, index) in dropdownList" :key="index" v-bind="finalAttrs(drop.attrs)" :command="drop.action">
|
|
18
|
+
<el-tooltip :disabled="!drop.tip" placement="top" :content="drop.tip">
|
|
19
|
+
<span>{{ drop.label }}</span>
|
|
20
|
+
</el-tooltip>
|
|
21
|
+
</el-dropdown-item>
|
|
22
|
+
</el-dropdown-menu>
|
|
23
|
+
</el-dropdown>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script>
|
|
28
|
+
import { isEmpty } from '@saas/utils';
|
|
29
|
+
export default {
|
|
30
|
+
name: 'STableButtons',
|
|
31
|
+
props: {
|
|
32
|
+
list: {
|
|
33
|
+
type: Array,
|
|
34
|
+
default: () => [],
|
|
35
|
+
},
|
|
36
|
+
maxLength: {
|
|
37
|
+
type: Number,
|
|
38
|
+
default: 2,
|
|
39
|
+
},
|
|
40
|
+
moreType: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'more', // 'text' | 'more'
|
|
43
|
+
},
|
|
44
|
+
text: {
|
|
45
|
+
type: String,
|
|
46
|
+
default() {
|
|
47
|
+
return this.$t('buttonGroup.more');
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
row: {
|
|
51
|
+
type: Object,
|
|
52
|
+
default() {
|
|
53
|
+
return {};
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
btnProps: {
|
|
61
|
+
size: 'mini',
|
|
62
|
+
type: 'text',
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
computed: {
|
|
67
|
+
showList() {
|
|
68
|
+
return this.list.filter(item => {
|
|
69
|
+
const show = isEmpty(item.show) ? true : item.show;
|
|
70
|
+
if (typeof show === 'function') return show(this.row);
|
|
71
|
+
return Boolean(show);
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
buttonList() {
|
|
75
|
+
return this.showList.slice(0, this.maxLength);
|
|
76
|
+
},
|
|
77
|
+
dropdownList() {
|
|
78
|
+
return this.showList.slice(this.maxLength);
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
finalAttrs(attrs = {}) {
|
|
83
|
+
return {
|
|
84
|
+
...this.btnProps,
|
|
85
|
+
...attrs,
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
handleCommand(command) {
|
|
89
|
+
this.$emit('action', command, this.row);
|
|
90
|
+
},
|
|
91
|
+
handelClick(command) {
|
|
92
|
+
this.$emit('action', command, this.row);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
</script>
|