chain-saasui 1.0.6 → 1.0.7
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 +5 -5
- package/babel.config.js +13 -13
- package/build/version-alpha.js +51 -51
- package/build/version-patch.js +44 -44
- package/build/webpack.common.js +54 -54
- package/build/webpack.components.js +69 -69
- package/build/webpack.demo.js +40 -40
- package/components/css/card.scss +19 -19
- package/components/css/common.scss +10 -10
- package/components/css/container.scss +14 -14
- package/components/css/detail.scss +87 -87
- package/components/css/dialog.scss +83 -83
- package/components/css/group.scss +82 -82
- package/components/css/index.scss +11 -11
- package/components/css/messagebox.scss +59 -59
- package/components/css/pagetable.scss +89 -89
- package/components/css/tablebuttons.scss +15 -15
- package/components/css/unit.scss +25 -25
- package/components/src/SCard/index.vue +34 -34
- package/components/src/SContainer/index.vue +35 -35
- package/components/src/SDialog/index.vue +101 -101
- package/components/src/SDrawer/index.vue +97 -97
- package/components/src/SForm/SSelect/index.vue +108 -108
- package/components/src/SGroup/index.vue +81 -81
- package/components/src/SMessagebox/index.js +66 -66
- package/components/src/SMessagebox/messagebox.vue +83 -83
- package/components/src/SPage/Pagedetail.vue +112 -112
- package/components/src/SPage/Pagestep.vue +94 -94
- package/components/src/SPage/Pagetable.vue +112 -112
- package/components/src/STable/STablecolumn.vue +111 -111
- package/components/src/STable/index.vue +48 -48
- package/components/src/STableButtons/STableButtons.md +111 -111
- package/components/src/STableButtons/index.vue +96 -96
- package/components/src/SUnit/index.vue +74 -74
- package/components/src/index.js +48 -48
- package/gulpfile.js +20 -20
- package/jsconfig.json +25 -25
- package/lib/saasui.common.js +1 -1
- package/package.json +84 -84
- package/public/html/ie.html +45 -45
- package/public/index.html +273 -273
- package/public/robots.txt +1 -1
- package/src/App.vue +30 -30
- package/src/components/HelloWorld.vue +58 -58
- package/src/main.js +16 -16
- package/vue.config.js +40 -40
|
@@ -1,94 +1,94 @@
|
|
|
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
|
-
</div>
|
|
22
|
-
<div class="saas-pagestep-content">
|
|
23
|
-
<slot></slot>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
<script>
|
|
29
|
-
export default {
|
|
30
|
-
name: 'SPagestep',
|
|
31
|
-
props: {
|
|
32
|
-
showFooter: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: () => true,
|
|
35
|
-
},
|
|
36
|
-
loadingBtn: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: () => false,
|
|
39
|
-
},
|
|
40
|
-
width: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: '1000px',
|
|
43
|
-
},
|
|
44
|
-
title: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: '',
|
|
47
|
-
},
|
|
48
|
-
titleSub: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: '',
|
|
51
|
-
},
|
|
52
|
-
confirmText: {
|
|
53
|
-
type: String,
|
|
54
|
-
default() {
|
|
55
|
-
return this.$t('buttonGroup.sure');
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
cancelText: {
|
|
59
|
-
type: String,
|
|
60
|
-
default() {
|
|
61
|
-
return this.$t('buttonGroup.cancel');
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
data() {
|
|
66
|
-
return {};
|
|
67
|
-
},
|
|
68
|
-
computed: {
|
|
69
|
-
show: {
|
|
70
|
-
get() {
|
|
71
|
-
return this.visible;
|
|
72
|
-
},
|
|
73
|
-
set(val) {
|
|
74
|
-
this.$emit('update:visible', val);
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
deactivated() {
|
|
79
|
-
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
80
|
-
},
|
|
81
|
-
methods: {
|
|
82
|
-
handleSubmit() {
|
|
83
|
-
this.$emit('confirm');
|
|
84
|
-
},
|
|
85
|
-
handleClose() {
|
|
86
|
-
this.$emit('close');
|
|
87
|
-
},
|
|
88
|
-
goBack() {
|
|
89
|
-
this.$emit('close');
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
</script>
|
|
94
|
-
<style lang="scss" scoped></style>
|
|
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
|
+
</div>
|
|
22
|
+
<div class="saas-pagestep-content">
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
export default {
|
|
30
|
+
name: 'SPagestep',
|
|
31
|
+
props: {
|
|
32
|
+
showFooter: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: () => true,
|
|
35
|
+
},
|
|
36
|
+
loadingBtn: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: () => false,
|
|
39
|
+
},
|
|
40
|
+
width: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: '1000px',
|
|
43
|
+
},
|
|
44
|
+
title: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: '',
|
|
47
|
+
},
|
|
48
|
+
titleSub: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
52
|
+
confirmText: {
|
|
53
|
+
type: String,
|
|
54
|
+
default() {
|
|
55
|
+
return this.$t('buttonGroup.sure');
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
cancelText: {
|
|
59
|
+
type: String,
|
|
60
|
+
default() {
|
|
61
|
+
return this.$t('buttonGroup.cancel');
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
data() {
|
|
66
|
+
return {};
|
|
67
|
+
},
|
|
68
|
+
computed: {
|
|
69
|
+
show: {
|
|
70
|
+
get() {
|
|
71
|
+
return this.visible;
|
|
72
|
+
},
|
|
73
|
+
set(val) {
|
|
74
|
+
this.$emit('update:visible', val);
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
deactivated() {
|
|
79
|
+
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
handleSubmit() {
|
|
83
|
+
this.$emit('confirm');
|
|
84
|
+
},
|
|
85
|
+
handleClose() {
|
|
86
|
+
this.$emit('close');
|
|
87
|
+
},
|
|
88
|
+
goBack() {
|
|
89
|
+
this.$emit('close');
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
94
|
+
<style lang="scss" scoped></style>
|
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="saas-page-table">
|
|
3
|
-
<div class="saas-page-table-header">
|
|
4
|
-
<div v-if="showTitle" 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
|
-
export default {
|
|
35
|
-
name: 'SPagetable',
|
|
36
|
-
props: {
|
|
37
|
-
showFooter: {
|
|
38
|
-
type: Boolean,
|
|
39
|
-
default: () => true,
|
|
40
|
-
},
|
|
41
|
-
showClose: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: () => false,
|
|
44
|
-
},
|
|
45
|
-
loadingBtn: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: () => false,
|
|
48
|
-
},
|
|
49
|
-
computeStyle: {
|
|
50
|
-
type: Object,
|
|
51
|
-
default: () => ({
|
|
52
|
-
width: '1000px',
|
|
53
|
-
margin: '0 auto',
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
title: {
|
|
57
|
-
type: String,
|
|
58
|
-
default() {
|
|
59
|
-
return this.$t(`saasmenu.${this.$route.meta.code}`);
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
titleSub: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: '',
|
|
65
|
-
},
|
|
66
|
-
confirmText: {
|
|
67
|
-
type: String,
|
|
68
|
-
default() {
|
|
69
|
-
return this.$t('buttonGroup.sure');
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
cancelText: {
|
|
73
|
-
type: String,
|
|
74
|
-
default() {
|
|
75
|
-
return this.$t('buttonGroup.cancel');
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
showTitle: {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
default: true,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
data() {
|
|
84
|
-
return {};
|
|
85
|
-
},
|
|
86
|
-
computed: {
|
|
87
|
-
show: {
|
|
88
|
-
get() {
|
|
89
|
-
return this.visible;
|
|
90
|
-
},
|
|
91
|
-
set(val) {
|
|
92
|
-
this.$emit('update:visible', val);
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
deactivated() {
|
|
97
|
-
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
98
|
-
},
|
|
99
|
-
methods: {
|
|
100
|
-
handleSubmit() {
|
|
101
|
-
this.$emit('confirm');
|
|
102
|
-
},
|
|
103
|
-
handleClose() {
|
|
104
|
-
this.$emit('close');
|
|
105
|
-
},
|
|
106
|
-
goBack() {
|
|
107
|
-
this.$emit('close');
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
</script>
|
|
112
|
-
<style lang="scss" scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="saas-page-table">
|
|
3
|
+
<div class="saas-page-table-header">
|
|
4
|
+
<div v-if="showTitle" 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
|
+
export default {
|
|
35
|
+
name: 'SPagetable',
|
|
36
|
+
props: {
|
|
37
|
+
showFooter: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: () => true,
|
|
40
|
+
},
|
|
41
|
+
showClose: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: () => false,
|
|
44
|
+
},
|
|
45
|
+
loadingBtn: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: () => false,
|
|
48
|
+
},
|
|
49
|
+
computeStyle: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => ({
|
|
52
|
+
width: '1000px',
|
|
53
|
+
margin: '0 auto',
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
title: {
|
|
57
|
+
type: String,
|
|
58
|
+
default() {
|
|
59
|
+
return this.$t(`saasmenu.${this.$route.meta.code}`);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
titleSub: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
confirmText: {
|
|
67
|
+
type: String,
|
|
68
|
+
default() {
|
|
69
|
+
return this.$t('buttonGroup.sure');
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
cancelText: {
|
|
73
|
+
type: String,
|
|
74
|
+
default() {
|
|
75
|
+
return this.$t('buttonGroup.cancel');
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
showTitle: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
data() {
|
|
84
|
+
return {};
|
|
85
|
+
},
|
|
86
|
+
computed: {
|
|
87
|
+
show: {
|
|
88
|
+
get() {
|
|
89
|
+
return this.visible;
|
|
90
|
+
},
|
|
91
|
+
set(val) {
|
|
92
|
+
this.$emit('update:visible', val);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
deactivated() {
|
|
97
|
+
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
98
|
+
},
|
|
99
|
+
methods: {
|
|
100
|
+
handleSubmit() {
|
|
101
|
+
this.$emit('confirm');
|
|
102
|
+
},
|
|
103
|
+
handleClose() {
|
|
104
|
+
this.$emit('close');
|
|
105
|
+
},
|
|
106
|
+
goBack() {
|
|
107
|
+
this.$emit('close');
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
</script>
|
|
112
|
+
<style lang="scss" scoped></style>
|
|
@@ -1,111 +1,111 @@
|
|
|
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-if="column.type === 'operate'" #default="scope">
|
|
20
|
-
<slot :name="column.value" v-bind="getBindProps(scope)">
|
|
21
|
-
<s-table-buttons :list="column.actionList" :row="scope.row" @action="handleAction"></s-table-buttons>
|
|
22
|
-
</slot>
|
|
23
|
-
</template>
|
|
24
|
-
<template v-else-if="column.type === 'unit'" #default="scope">
|
|
25
|
-
<slot :name="column.value" v-bind="getBindProps(scope)">
|
|
26
|
-
<s-unit :value="scope.row[column.value]" :options="column.options"></s-unit>
|
|
27
|
-
</slot>
|
|
28
|
-
</template>
|
|
29
|
-
<template v-else #default="scope">
|
|
30
|
-
<slot :name="column.value" v-bind="getBindProps(scope)">
|
|
31
|
-
{{ selectValue(scope.row) }}
|
|
32
|
-
</slot>
|
|
33
|
-
</template>
|
|
34
|
-
</el-table-column>
|
|
35
|
-
</template>
|
|
36
|
-
<script>
|
|
37
|
-
import { isEmpty, formatIfJson, formatSubmitTime } from 'chain-lodash';
|
|
38
|
-
import STableButton from '../STableButtons';
|
|
39
|
-
import SUnit from '../SUnit';
|
|
40
|
-
export default {
|
|
41
|
-
name: 'STablecolumn',
|
|
42
|
-
components: {
|
|
43
|
-
STableButton,
|
|
44
|
-
SUnit,
|
|
45
|
-
},
|
|
46
|
-
props: {
|
|
47
|
-
column: Object,
|
|
48
|
-
minWidth: {
|
|
49
|
-
type: [Number, String],
|
|
50
|
-
default: 150,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
data() {
|
|
54
|
-
return {};
|
|
55
|
-
},
|
|
56
|
-
computed: {
|
|
57
|
-
columnProps() {
|
|
58
|
-
const { type = null, fixed = null } = this.column;
|
|
59
|
-
return {
|
|
60
|
-
...this.column,
|
|
61
|
-
fixed: fixed ? fixed : type === 'operate' ? 'right' : null,
|
|
62
|
-
'min-width': this.column.minWidth || this.minWidth,
|
|
63
|
-
prop: this.column.value,
|
|
64
|
-
label: this.column.label,
|
|
65
|
-
showOverflowTooltip: this.column.showOverflowTooltip != null ? this.column.showOverflowTooltip : true,
|
|
66
|
-
index: this.column.indexMethod || null,
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
methods: {
|
|
71
|
-
selectValue(row) {
|
|
72
|
-
let str = '';
|
|
73
|
-
const { options = [], type = 'txt' } = this.column;
|
|
74
|
-
const value = row[this.column.value];
|
|
75
|
-
if (this.column.formatValue) {
|
|
76
|
-
return this.column.formatValue(row, this.column);
|
|
77
|
-
}
|
|
78
|
-
switch (type) {
|
|
79
|
-
case 'select':
|
|
80
|
-
let obj = options.find(f => f.value == value) || {};
|
|
81
|
-
str = formatIfJson(obj.label);
|
|
82
|
-
break;
|
|
83
|
-
case 'time':
|
|
84
|
-
str = formatSubmitTime(value, 'DD/MM/YYYY');
|
|
85
|
-
break;
|
|
86
|
-
default:
|
|
87
|
-
str = formatIfJson(value);
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
if (isEmpty(str)) {
|
|
91
|
-
str = this.column.defaultValue || '-';
|
|
92
|
-
} else if (str.length > 500) {
|
|
93
|
-
str = str.slice(0, 500) + '...';
|
|
94
|
-
}
|
|
95
|
-
return str;
|
|
96
|
-
},
|
|
97
|
-
getBindProps(params) {
|
|
98
|
-
return {
|
|
99
|
-
...params,
|
|
100
|
-
column: this.column,
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
getIndex($index) {
|
|
104
|
-
return this.indexMethod ? this.indexMethod($index) : $index + 1;
|
|
105
|
-
},
|
|
106
|
-
handleAction(actionName, row) {
|
|
107
|
-
this.$emit('action', actionName, row, this.column);
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
</script>
|
|
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-if="column.type === 'operate'" #default="scope">
|
|
20
|
+
<slot :name="column.value" v-bind="getBindProps(scope)">
|
|
21
|
+
<s-table-buttons :list="column.actionList" :row="scope.row" @action="handleAction"></s-table-buttons>
|
|
22
|
+
</slot>
|
|
23
|
+
</template>
|
|
24
|
+
<template v-else-if="column.type === 'unit'" #default="scope">
|
|
25
|
+
<slot :name="column.value" v-bind="getBindProps(scope)">
|
|
26
|
+
<s-unit :value="scope.row[column.value]" :options="column.options"></s-unit>
|
|
27
|
+
</slot>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-else #default="scope">
|
|
30
|
+
<slot :name="column.value" v-bind="getBindProps(scope)">
|
|
31
|
+
{{ selectValue(scope.row) }}
|
|
32
|
+
</slot>
|
|
33
|
+
</template>
|
|
34
|
+
</el-table-column>
|
|
35
|
+
</template>
|
|
36
|
+
<script>
|
|
37
|
+
import { isEmpty, formatIfJson, formatSubmitTime } from 'chain-lodash';
|
|
38
|
+
import STableButton from '../STableButtons';
|
|
39
|
+
import SUnit from '../SUnit';
|
|
40
|
+
export default {
|
|
41
|
+
name: 'STablecolumn',
|
|
42
|
+
components: {
|
|
43
|
+
STableButton,
|
|
44
|
+
SUnit,
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
column: Object,
|
|
48
|
+
minWidth: {
|
|
49
|
+
type: [Number, String],
|
|
50
|
+
default: 150,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
data() {
|
|
54
|
+
return {};
|
|
55
|
+
},
|
|
56
|
+
computed: {
|
|
57
|
+
columnProps() {
|
|
58
|
+
const { type = null, fixed = null } = this.column;
|
|
59
|
+
return {
|
|
60
|
+
...this.column,
|
|
61
|
+
fixed: fixed ? fixed : type === 'operate' ? 'right' : null,
|
|
62
|
+
'min-width': this.column.minWidth || this.minWidth,
|
|
63
|
+
prop: this.column.value,
|
|
64
|
+
label: this.column.label,
|
|
65
|
+
showOverflowTooltip: this.column.showOverflowTooltip != null ? this.column.showOverflowTooltip : true,
|
|
66
|
+
index: this.column.indexMethod || null,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
methods: {
|
|
71
|
+
selectValue(row) {
|
|
72
|
+
let str = '';
|
|
73
|
+
const { options = [], type = 'txt' } = this.column;
|
|
74
|
+
const value = row[this.column.value];
|
|
75
|
+
if (this.column.formatValue) {
|
|
76
|
+
return this.column.formatValue(row, this.column);
|
|
77
|
+
}
|
|
78
|
+
switch (type) {
|
|
79
|
+
case 'select':
|
|
80
|
+
let obj = options.find(f => f.value == value) || {};
|
|
81
|
+
str = formatIfJson(obj.label);
|
|
82
|
+
break;
|
|
83
|
+
case 'time':
|
|
84
|
+
str = formatSubmitTime(value, 'DD/MM/YYYY');
|
|
85
|
+
break;
|
|
86
|
+
default:
|
|
87
|
+
str = formatIfJson(value);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (isEmpty(str)) {
|
|
91
|
+
str = this.column.defaultValue || '-';
|
|
92
|
+
} else if (str.length > 500) {
|
|
93
|
+
str = str.slice(0, 500) + '...';
|
|
94
|
+
}
|
|
95
|
+
return str;
|
|
96
|
+
},
|
|
97
|
+
getBindProps(params) {
|
|
98
|
+
return {
|
|
99
|
+
...params,
|
|
100
|
+
column: this.column,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
getIndex($index) {
|
|
104
|
+
return this.indexMethod ? this.indexMethod($index) : $index + 1;
|
|
105
|
+
},
|
|
106
|
+
handleAction(actionName, row) {
|
|
107
|
+
this.$emit('action', actionName, row, this.column);
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
</script>
|