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,97 +1,97 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-drawer class="saas-drawer" v-bind="bindProps" :wrapperClosable="false" v-on="$listeners" :visible.sync="show">
|
|
3
|
-
<template v-if="$slots.title" slot="title">
|
|
4
|
-
<slot name="title"></slot>
|
|
5
|
-
</template>
|
|
6
|
-
<div class="saas-drawer-content">
|
|
7
|
-
<slot></slot>
|
|
8
|
-
</div>
|
|
9
|
-
<div v-if="showFooter" class="saas-drawer-footer">
|
|
10
|
-
<slot v-if="$slots.footer" name="footer"></slot>
|
|
11
|
-
<template v-else>
|
|
12
|
-
<el-button v-if="showCancelButton" @click="handleClose">{{ cancelText }}</el-button>
|
|
13
|
-
<el-button v-if="showConfirmButton" :loading="loadingBtn" type="primary" @click="handleSubmit" v-preventReClick="5000">
|
|
14
|
-
{{ confirmText }}
|
|
15
|
-
</el-button>
|
|
16
|
-
</template>
|
|
17
|
-
</div>
|
|
18
|
-
</el-drawer>
|
|
19
|
-
</template>
|
|
20
|
-
<script>
|
|
21
|
-
import { Drawer } from 'element-ui';
|
|
22
|
-
import { omit } from 'chain-lodash';
|
|
23
|
-
export default {
|
|
24
|
-
name: 'SDrawer',
|
|
25
|
-
props: {
|
|
26
|
-
...Drawer.props,
|
|
27
|
-
showFooter: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: () => true,
|
|
30
|
-
},
|
|
31
|
-
size: {
|
|
32
|
-
type: [String, Number],
|
|
33
|
-
default: () => '800px',
|
|
34
|
-
},
|
|
35
|
-
wrapperClosable: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: () => false,
|
|
38
|
-
},
|
|
39
|
-
loadingBtn: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: () => false,
|
|
42
|
-
},
|
|
43
|
-
appendToBody: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: true,
|
|
46
|
-
},
|
|
47
|
-
showCancelButton: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: true,
|
|
50
|
-
},
|
|
51
|
-
showConfirmButton: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: true,
|
|
54
|
-
},
|
|
55
|
-
confirmText: {
|
|
56
|
-
type: String,
|
|
57
|
-
default() {
|
|
58
|
-
return this.$t('buttonGroup.sure');
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
cancelText: {
|
|
62
|
-
type: String,
|
|
63
|
-
default() {
|
|
64
|
-
return this.$t('buttonGroup.cancel');
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
data() {
|
|
69
|
-
return {};
|
|
70
|
-
},
|
|
71
|
-
computed: {
|
|
72
|
-
show: {
|
|
73
|
-
get() {
|
|
74
|
-
return this.visible;
|
|
75
|
-
},
|
|
76
|
-
set(val) {
|
|
77
|
-
this.$emit('update:visible', val);
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
bindProps() {
|
|
81
|
-
return omit(this.$props, ['visible']);
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
deactivated() {
|
|
85
|
-
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
86
|
-
},
|
|
87
|
-
methods: {
|
|
88
|
-
handleSubmit() {
|
|
89
|
-
this.$emit('confirm');
|
|
90
|
-
},
|
|
91
|
-
handleClose() {
|
|
92
|
-
this.$emit('update:visible', false);
|
|
93
|
-
this.$emit('close');
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
};
|
|
97
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<el-drawer class="saas-drawer" v-bind="bindProps" :wrapperClosable="false" v-on="$listeners" :visible.sync="show">
|
|
3
|
+
<template v-if="$slots.title" slot="title">
|
|
4
|
+
<slot name="title"></slot>
|
|
5
|
+
</template>
|
|
6
|
+
<div class="saas-drawer-content">
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-if="showFooter" class="saas-drawer-footer">
|
|
10
|
+
<slot v-if="$slots.footer" name="footer"></slot>
|
|
11
|
+
<template v-else>
|
|
12
|
+
<el-button v-if="showCancelButton" @click="handleClose">{{ cancelText }}</el-button>
|
|
13
|
+
<el-button v-if="showConfirmButton" :loading="loadingBtn" type="primary" @click="handleSubmit" v-preventReClick="5000">
|
|
14
|
+
{{ confirmText }}
|
|
15
|
+
</el-button>
|
|
16
|
+
</template>
|
|
17
|
+
</div>
|
|
18
|
+
</el-drawer>
|
|
19
|
+
</template>
|
|
20
|
+
<script>
|
|
21
|
+
import { Drawer } from 'element-ui';
|
|
22
|
+
import { omit } from 'chain-lodash';
|
|
23
|
+
export default {
|
|
24
|
+
name: 'SDrawer',
|
|
25
|
+
props: {
|
|
26
|
+
...Drawer.props,
|
|
27
|
+
showFooter: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: () => true,
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
type: [String, Number],
|
|
33
|
+
default: () => '800px',
|
|
34
|
+
},
|
|
35
|
+
wrapperClosable: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: () => false,
|
|
38
|
+
},
|
|
39
|
+
loadingBtn: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: () => false,
|
|
42
|
+
},
|
|
43
|
+
appendToBody: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true,
|
|
46
|
+
},
|
|
47
|
+
showCancelButton: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true,
|
|
50
|
+
},
|
|
51
|
+
showConfirmButton: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true,
|
|
54
|
+
},
|
|
55
|
+
confirmText: {
|
|
56
|
+
type: String,
|
|
57
|
+
default() {
|
|
58
|
+
return this.$t('buttonGroup.sure');
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
cancelText: {
|
|
62
|
+
type: String,
|
|
63
|
+
default() {
|
|
64
|
+
return this.$t('buttonGroup.cancel');
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
data() {
|
|
69
|
+
return {};
|
|
70
|
+
},
|
|
71
|
+
computed: {
|
|
72
|
+
show: {
|
|
73
|
+
get() {
|
|
74
|
+
return this.visible;
|
|
75
|
+
},
|
|
76
|
+
set(val) {
|
|
77
|
+
this.$emit('update:visible', val);
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
bindProps() {
|
|
81
|
+
return omit(this.$props, ['visible']);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
deactivated() {
|
|
85
|
+
this.handleClose(); // 在缓存组件时关闭弹窗
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
handleSubmit() {
|
|
89
|
+
this.$emit('confirm');
|
|
90
|
+
},
|
|
91
|
+
handleClose() {
|
|
92
|
+
this.$emit('update:visible', false);
|
|
93
|
+
this.$emit('close');
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
</script>
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="saas-select" :class="{ 'saas-search-textbox': from === 'text' }">
|
|
3
|
-
<span v-if="from === 'text'" class="search-dict">{{ selectValue }}</span>
|
|
4
|
-
<el-select
|
|
5
|
-
v-else
|
|
6
|
-
style="width: 100%"
|
|
7
|
-
v-model="newValue"
|
|
8
|
-
:size="size"
|
|
9
|
-
:multiple="multiple"
|
|
10
|
-
:placeholder="placeholder"
|
|
11
|
-
v-bind="$attrs"
|
|
12
|
-
filterable
|
|
13
|
-
clearable>
|
|
14
|
-
<template v-for="item in options">
|
|
15
|
-
<!-- 如果item有options属性,说明是分组 -->
|
|
16
|
-
<el-option-group v-if="item.options" :key="item.value" :label="item.label">
|
|
17
|
-
<el-option
|
|
18
|
-
v-for="option in item.options"
|
|
19
|
-
:disabled="option.disabled"
|
|
20
|
-
:key="option.value"
|
|
21
|
-
:label="option.label"
|
|
22
|
-
:value="option.value"></el-option>
|
|
23
|
-
</el-option-group>
|
|
24
|
-
<!-- 否则是普通选项 -->
|
|
25
|
-
<el-option v-else :disabled="item.disabled" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
26
|
-
</template>
|
|
27
|
-
</el-select>
|
|
28
|
-
</div>
|
|
29
|
-
</template>
|
|
30
|
-
<script>
|
|
31
|
-
import { isEmpty, omit } from 'chain-lodash';
|
|
32
|
-
import { Select } from 'element-ui';
|
|
33
|
-
export default {
|
|
34
|
-
name: 'SSelect',
|
|
35
|
-
props: {
|
|
36
|
-
...omit(Select.props, ['value', 'clearable']),
|
|
37
|
-
value: {
|
|
38
|
-
type: [String, Number, Array],
|
|
39
|
-
},
|
|
40
|
-
clearable: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: () => true,
|
|
43
|
-
},
|
|
44
|
-
placeholder: {
|
|
45
|
-
type: String,
|
|
46
|
-
default() {
|
|
47
|
-
return this.$t('
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
from: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: 'select',
|
|
53
|
-
},
|
|
54
|
-
options: {
|
|
55
|
-
type: Array,
|
|
56
|
-
default: () => [],
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
data() {
|
|
60
|
-
return {};
|
|
61
|
-
},
|
|
62
|
-
computed: {
|
|
63
|
-
newValue: {
|
|
64
|
-
get() {
|
|
65
|
-
let value = this.multiple ? [] : '';
|
|
66
|
-
if (this.multiple) {
|
|
67
|
-
value = (this.value || []).map(m => (m != null ? String(m) : ''));
|
|
68
|
-
} else {
|
|
69
|
-
if (!isEmpty(this.value) && this.value != null) {
|
|
70
|
-
value = String(this.value);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return value;
|
|
74
|
-
},
|
|
75
|
-
set(val) {
|
|
76
|
-
this.$emit('input', val);
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
selectValue() {
|
|
80
|
-
const multiple = this.multiple;
|
|
81
|
-
// 扁平化所有选项,包括分组中的选项
|
|
82
|
-
const allOptions = this.flattenOptions(this.options || []);
|
|
83
|
-
|
|
84
|
-
if (multiple) {
|
|
85
|
-
const nameArr = allOptions.filter(f => this.newValue.includes(f.value)).map(m => m.label);
|
|
86
|
-
return nameArr.length > 1 ? `${nameArr[0]} +${nameArr.length - 1}` : nameArr[0];
|
|
87
|
-
} else {
|
|
88
|
-
const obj = allOptions.find(f => f.value == this.newValue) || {};
|
|
89
|
-
return obj.label || '-';
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
methods: {
|
|
94
|
-
flattenOptions(options) {
|
|
95
|
-
const result = [];
|
|
96
|
-
options.forEach(item => {
|
|
97
|
-
if (item.options) {
|
|
98
|
-
result.push(...item.options);
|
|
99
|
-
} else {
|
|
100
|
-
result.push(item);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
return result;
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
</script>
|
|
108
|
-
<style lang="scss" scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="saas-select" :class="{ 'saas-search-textbox': from === 'text' }">
|
|
3
|
+
<span v-if="from === 'text'" class="search-dict">{{ selectValue }}</span>
|
|
4
|
+
<el-select
|
|
5
|
+
v-else
|
|
6
|
+
style="width: 100%"
|
|
7
|
+
v-model="newValue"
|
|
8
|
+
:size="size"
|
|
9
|
+
:multiple="multiple"
|
|
10
|
+
:placeholder="placeholder"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
filterable
|
|
13
|
+
clearable>
|
|
14
|
+
<template v-for="item in options">
|
|
15
|
+
<!-- 如果item有options属性,说明是分组 -->
|
|
16
|
+
<el-option-group v-if="item.options" :key="item.value" :label="item.label">
|
|
17
|
+
<el-option
|
|
18
|
+
v-for="option in item.options"
|
|
19
|
+
:disabled="option.disabled"
|
|
20
|
+
:key="option.value"
|
|
21
|
+
:label="option.label"
|
|
22
|
+
:value="option.value"></el-option>
|
|
23
|
+
</el-option-group>
|
|
24
|
+
<!-- 否则是普通选项 -->
|
|
25
|
+
<el-option v-else :disabled="item.disabled" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
26
|
+
</template>
|
|
27
|
+
</el-select>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
<script>
|
|
31
|
+
import { isEmpty, omit } from 'chain-lodash';
|
|
32
|
+
import { Select } from 'element-ui';
|
|
33
|
+
export default {
|
|
34
|
+
name: 'SSelect',
|
|
35
|
+
props: {
|
|
36
|
+
...omit(Select.props, ['value', 'clearable']),
|
|
37
|
+
value: {
|
|
38
|
+
type: [String, Number, Array],
|
|
39
|
+
},
|
|
40
|
+
clearable: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: () => true,
|
|
43
|
+
},
|
|
44
|
+
placeholder: {
|
|
45
|
+
type: String,
|
|
46
|
+
default() {
|
|
47
|
+
return this.$t('selectGroup.pleaseSelect');;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
from: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: 'select',
|
|
53
|
+
},
|
|
54
|
+
options: {
|
|
55
|
+
type: Array,
|
|
56
|
+
default: () => [],
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
data() {
|
|
60
|
+
return {};
|
|
61
|
+
},
|
|
62
|
+
computed: {
|
|
63
|
+
newValue: {
|
|
64
|
+
get() {
|
|
65
|
+
let value = this.multiple ? [] : '';
|
|
66
|
+
if (this.multiple) {
|
|
67
|
+
value = (this.value || []).map(m => (m != null ? String(m) : ''));
|
|
68
|
+
} else {
|
|
69
|
+
if (!isEmpty(this.value) && this.value != null) {
|
|
70
|
+
value = String(this.value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return value;
|
|
74
|
+
},
|
|
75
|
+
set(val) {
|
|
76
|
+
this.$emit('input', val);
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
selectValue() {
|
|
80
|
+
const multiple = this.multiple;
|
|
81
|
+
// 扁平化所有选项,包括分组中的选项
|
|
82
|
+
const allOptions = this.flattenOptions(this.options || []);
|
|
83
|
+
|
|
84
|
+
if (multiple) {
|
|
85
|
+
const nameArr = allOptions.filter(f => this.newValue.includes(f.value)).map(m => m.label);
|
|
86
|
+
return nameArr.length > 1 ? `${nameArr[0]} +${nameArr.length - 1}` : nameArr[0];
|
|
87
|
+
} else {
|
|
88
|
+
const obj = allOptions.find(f => f.value == this.newValue) || {};
|
|
89
|
+
return obj.label || '-';
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
methods: {
|
|
94
|
+
flattenOptions(options) {
|
|
95
|
+
const result = [];
|
|
96
|
+
options.forEach(item => {
|
|
97
|
+
if (item.options) {
|
|
98
|
+
result.push(...item.options);
|
|
99
|
+
} else {
|
|
100
|
+
result.push(item);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return result;
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
</script>
|
|
108
|
+
<style lang="scss" scoped></style>
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="saas-group">
|
|
3
|
-
<div class="saas-sort-group" v-for="(group, index) in list" :key="index">
|
|
4
|
-
<div
|
|
5
|
-
v-for="(item, index) in group.children"
|
|
6
|
-
:key="index"
|
|
7
|
-
class="saas-sort-item"
|
|
8
|
-
:class="{ active: getActive(item, group) }"
|
|
9
|
-
@click="handleClick(item, group)">
|
|
10
|
-
<div class="title" :style="getSortStyle(item)">{{ item.formatValue(item, data) }}</div>
|
|
11
|
-
<div class="text">
|
|
12
|
-
<span>
|
|
13
|
-
<slot :item="item">
|
|
14
|
-
{{ item.label }}
|
|
15
|
-
<el-tooltip v-if="item.tip" :content="item.tip">
|
|
16
|
-
<div slot="content" v-html="item.tip"></div>
|
|
17
|
-
<i style="color: #a1a5b2; margin-left: 4px" class="smart-info-filled"></i>
|
|
18
|
-
</el-tooltip>
|
|
19
|
-
</slot>
|
|
20
|
-
</span>
|
|
21
|
-
</div>
|
|
22
|
-
<img src="./icon_rtsuc.png" alt="" srcset="" />
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
27
|
-
<script>
|
|
28
|
-
import { omit } from 'chain-lodash';
|
|
29
|
-
export default {
|
|
30
|
-
name: 'SGroup',
|
|
31
|
-
props: {
|
|
32
|
-
title: {
|
|
33
|
-
type: String,
|
|
34
|
-
default: '',
|
|
35
|
-
},
|
|
36
|
-
list: {
|
|
37
|
-
type: Array,
|
|
38
|
-
default: () => [],
|
|
39
|
-
},
|
|
40
|
-
data: {
|
|
41
|
-
type: Object,
|
|
42
|
-
default: () => ({}),
|
|
43
|
-
},
|
|
44
|
-
isActive: {
|
|
45
|
-
type: Function,
|
|
46
|
-
default: null,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
data() {
|
|
50
|
-
return {};
|
|
51
|
-
},
|
|
52
|
-
computed: {},
|
|
53
|
-
deactivated() {},
|
|
54
|
-
methods: {
|
|
55
|
-
getSortStyle(item) {
|
|
56
|
-
let obj = {};
|
|
57
|
-
if (item.type === 'percent') {
|
|
58
|
-
const num = this.data[item.field];
|
|
59
|
-
if (num <= 30) {
|
|
60
|
-
obj.color = '#FF3B30';
|
|
61
|
-
} else if (num <= 60) {
|
|
62
|
-
obj.color = '#FF9900';
|
|
63
|
-
} else {
|
|
64
|
-
obj.color = '#28B86A';
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return obj;
|
|
68
|
-
},
|
|
69
|
-
handleClick(item, group) {
|
|
70
|
-
this.$emit('tab-click', item, group);
|
|
71
|
-
},
|
|
72
|
-
getActive(item, group) {
|
|
73
|
-
if (this.isActive) {
|
|
74
|
-
return this.isActive(item, group);
|
|
75
|
-
}
|
|
76
|
-
return false;
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
</script>
|
|
81
|
-
<style lang="scss" scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="saas-group">
|
|
3
|
+
<div class="saas-sort-group" v-for="(group, index) in list" :key="index">
|
|
4
|
+
<div
|
|
5
|
+
v-for="(item, index) in group.children"
|
|
6
|
+
:key="index"
|
|
7
|
+
class="saas-sort-item"
|
|
8
|
+
:class="{ active: getActive(item, group) }"
|
|
9
|
+
@click="handleClick(item, group)">
|
|
10
|
+
<div class="title" :style="getSortStyle(item)">{{ item.formatValue(item, data) }}</div>
|
|
11
|
+
<div class="text">
|
|
12
|
+
<span>
|
|
13
|
+
<slot :item="item">
|
|
14
|
+
{{ item.label }}
|
|
15
|
+
<el-tooltip v-if="item.tip" :content="item.tip">
|
|
16
|
+
<div slot="content" v-html="item.tip"></div>
|
|
17
|
+
<i style="color: #a1a5b2; margin-left: 4px" class="smart-info-filled"></i>
|
|
18
|
+
</el-tooltip>
|
|
19
|
+
</slot>
|
|
20
|
+
</span>
|
|
21
|
+
</div>
|
|
22
|
+
<img src="./icon_rtsuc.png" alt="" srcset="" />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
<script>
|
|
28
|
+
import { omit } from 'chain-lodash';
|
|
29
|
+
export default {
|
|
30
|
+
name: 'SGroup',
|
|
31
|
+
props: {
|
|
32
|
+
title: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '',
|
|
35
|
+
},
|
|
36
|
+
list: {
|
|
37
|
+
type: Array,
|
|
38
|
+
default: () => [],
|
|
39
|
+
},
|
|
40
|
+
data: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => ({}),
|
|
43
|
+
},
|
|
44
|
+
isActive: {
|
|
45
|
+
type: Function,
|
|
46
|
+
default: null,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
data() {
|
|
50
|
+
return {};
|
|
51
|
+
},
|
|
52
|
+
computed: {},
|
|
53
|
+
deactivated() {},
|
|
54
|
+
methods: {
|
|
55
|
+
getSortStyle(item) {
|
|
56
|
+
let obj = {};
|
|
57
|
+
if (item.type === 'percent') {
|
|
58
|
+
const num = this.data[item.field];
|
|
59
|
+
if (num <= 30) {
|
|
60
|
+
obj.color = '#FF3B30';
|
|
61
|
+
} else if (num <= 60) {
|
|
62
|
+
obj.color = '#FF9900';
|
|
63
|
+
} else {
|
|
64
|
+
obj.color = '#28B86A';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return obj;
|
|
68
|
+
},
|
|
69
|
+
handleClick(item, group) {
|
|
70
|
+
this.$emit('tab-click', item, group);
|
|
71
|
+
},
|
|
72
|
+
getActive(item, group) {
|
|
73
|
+
if (this.isActive) {
|
|
74
|
+
return this.isActive(item, group);
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
</script>
|
|
81
|
+
<style lang="scss" scoped></style>
|