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,48 +1,48 @@
|
|
|
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" @action="handleColumnAction">
|
|
5
|
-
<template :slot="column.value" slot-scope="scope">
|
|
6
|
-
<slot :name="column.value" v-bind="getBindProps(scope, column)"></slot>
|
|
7
|
-
</template>
|
|
8
|
-
</STablecolumn>
|
|
9
|
-
</el-table>
|
|
10
|
-
</template>
|
|
11
|
-
<script>
|
|
12
|
-
import { Table } from 'element-ui';
|
|
13
|
-
import STablecolumn from './STablecolumn.vue';
|
|
14
|
-
export default {
|
|
15
|
-
name: 'STable',
|
|
16
|
-
props: {
|
|
17
|
-
...Table.props,
|
|
18
|
-
border: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: true,
|
|
21
|
-
},
|
|
22
|
-
columns: {
|
|
23
|
-
type: Array,
|
|
24
|
-
default: () => [],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
components: {
|
|
28
|
-
STablecolumn,
|
|
29
|
-
},
|
|
30
|
-
data() {
|
|
31
|
-
return {};
|
|
32
|
-
},
|
|
33
|
-
computed: {},
|
|
34
|
-
deactivated() {},
|
|
35
|
-
methods: {
|
|
36
|
-
// 处理操作列事件
|
|
37
|
-
handleColumnAction(actionName, row, column) {
|
|
38
|
-
this.$emit('action', actionName, row, column);
|
|
39
|
-
},
|
|
40
|
-
getBindProps(params, column) {
|
|
41
|
-
return {
|
|
42
|
-
...params,
|
|
43
|
-
column,
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
</script>
|
|
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" @action="handleColumnAction">
|
|
5
|
+
<template :slot="column.value" slot-scope="scope">
|
|
6
|
+
<slot :name="column.value" v-bind="getBindProps(scope, column)"></slot>
|
|
7
|
+
</template>
|
|
8
|
+
</STablecolumn>
|
|
9
|
+
</el-table>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
import { Table } from 'element-ui';
|
|
13
|
+
import STablecolumn from './STablecolumn.vue';
|
|
14
|
+
export default {
|
|
15
|
+
name: 'STable',
|
|
16
|
+
props: {
|
|
17
|
+
...Table.props,
|
|
18
|
+
border: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true,
|
|
21
|
+
},
|
|
22
|
+
columns: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default: () => [],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
components: {
|
|
28
|
+
STablecolumn,
|
|
29
|
+
},
|
|
30
|
+
data() {
|
|
31
|
+
return {};
|
|
32
|
+
},
|
|
33
|
+
computed: {},
|
|
34
|
+
deactivated() {},
|
|
35
|
+
methods: {
|
|
36
|
+
// 处理操作列事件
|
|
37
|
+
handleColumnAction(actionName, row, column) {
|
|
38
|
+
this.$emit('action', actionName, row, column);
|
|
39
|
+
},
|
|
40
|
+
getBindProps(params, column) {
|
|
41
|
+
return {
|
|
42
|
+
...params,
|
|
43
|
+
column,
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
</script>
|
|
@@ -1,111 +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
|
-
|
|
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
|
+
|
|
@@ -1,96 +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 'chain-lodash';
|
|
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>
|
|
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 'chain-lodash';
|
|
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>
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="saas-unit">
|
|
3
|
-
<span :class="`saas-unit-${typeCom}`"></span>
|
|
4
|
-
<span class="saas-unit-text">
|
|
5
|
-
<slot>
|
|
6
|
-
{{ getValue }}
|
|
7
|
-
</slot>
|
|
8
|
-
</span>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
<script>
|
|
12
|
-
import { isEmpty, getOptionValue, formatIfJson } from 'chain-lodash';
|
|
13
|
-
export default {
|
|
14
|
-
name: 'SUnit',
|
|
15
|
-
props: {
|
|
16
|
-
value: [String, Number],
|
|
17
|
-
type: {
|
|
18
|
-
type: String,
|
|
19
|
-
default: '',
|
|
20
|
-
},
|
|
21
|
-
options: {
|
|
22
|
-
type: Array,
|
|
23
|
-
default: () => [],
|
|
24
|
-
},
|
|
25
|
-
props: {
|
|
26
|
-
type: Object,
|
|
27
|
-
default: () => ({
|
|
28
|
-
value: 'value',
|
|
29
|
-
label: 'label',
|
|
30
|
-
style: 'style',
|
|
31
|
-
type: '',
|
|
32
|
-
isShowCode: false,
|
|
33
|
-
}),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
data() {
|
|
37
|
-
return {};
|
|
38
|
-
},
|
|
39
|
-
computed: {
|
|
40
|
-
typeCom() {
|
|
41
|
-
if (!isEmpty(this.value)) {
|
|
42
|
-
const style = this.props.style || 'style';
|
|
43
|
-
return (
|
|
44
|
-
getOptionValue(this.options, this.value, {
|
|
45
|
-
...this.props,
|
|
46
|
-
label: style,
|
|
47
|
-
}) || 'primary'
|
|
48
|
-
);
|
|
49
|
-
} else {
|
|
50
|
-
return this.type || 'primary';
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
getValue() {
|
|
54
|
-
if (!isEmpty(this.value)) {
|
|
55
|
-
const label = getOptionValue(this.options, this.value, this.props);
|
|
56
|
-
return formatIfJson(label);
|
|
57
|
-
}
|
|
58
|
-
return '';
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
methods: {
|
|
62
|
-
handleSubmit() {
|
|
63
|
-
this.$emit('confirm');
|
|
64
|
-
},
|
|
65
|
-
handleClose() {
|
|
66
|
-
this.$emit('close');
|
|
67
|
-
},
|
|
68
|
-
goBack() {
|
|
69
|
-
this.$emit('close');
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
</script>
|
|
74
|
-
<style lang="scss" scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="saas-unit">
|
|
3
|
+
<span :class="`saas-unit-${typeCom}`"></span>
|
|
4
|
+
<span class="saas-unit-text">
|
|
5
|
+
<slot>
|
|
6
|
+
{{ getValue }}
|
|
7
|
+
</slot>
|
|
8
|
+
</span>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
<script>
|
|
12
|
+
import { isEmpty, getOptionValue, formatIfJson } from 'chain-lodash';
|
|
13
|
+
export default {
|
|
14
|
+
name: 'SUnit',
|
|
15
|
+
props: {
|
|
16
|
+
value: [String, Number],
|
|
17
|
+
type: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: '',
|
|
20
|
+
},
|
|
21
|
+
options: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => [],
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: () => ({
|
|
28
|
+
value: 'value',
|
|
29
|
+
label: 'label',
|
|
30
|
+
style: 'style',
|
|
31
|
+
type: '',
|
|
32
|
+
isShowCode: false,
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
data() {
|
|
37
|
+
return {};
|
|
38
|
+
},
|
|
39
|
+
computed: {
|
|
40
|
+
typeCom() {
|
|
41
|
+
if (!isEmpty(this.value)) {
|
|
42
|
+
const style = this.props.style || 'style';
|
|
43
|
+
return (
|
|
44
|
+
getOptionValue(this.options, this.value, {
|
|
45
|
+
...this.props,
|
|
46
|
+
label: style,
|
|
47
|
+
}) || 'primary'
|
|
48
|
+
);
|
|
49
|
+
} else {
|
|
50
|
+
return this.type || 'primary';
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
getValue() {
|
|
54
|
+
if (!isEmpty(this.value)) {
|
|
55
|
+
const label = getOptionValue(this.options, this.value, this.props);
|
|
56
|
+
return formatIfJson(label);
|
|
57
|
+
}
|
|
58
|
+
return '';
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
methods: {
|
|
62
|
+
handleSubmit() {
|
|
63
|
+
this.$emit('confirm');
|
|
64
|
+
},
|
|
65
|
+
handleClose() {
|
|
66
|
+
this.$emit('close');
|
|
67
|
+
},
|
|
68
|
+
goBack() {
|
|
69
|
+
this.$emit('close');
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
<style lang="scss" scoped></style>
|