n20-common-lib 1.2.18 → 1.2.21
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 +3 -2
- package/src/assets/css/cl-form-item.scss +1 -1
- package/src/assets/css/cl-pagination.scss +63 -0
- package/src/assets/css/cl-secondary-tab.scss +5 -0
- package/src/assets/css/cl-tertiary-tab.scss +46 -1
- package/src/components/DragList/index.vue +10 -3
- package/src/components/LoginTemporary/form.vue +46 -16
- package/src/components/Pagination/index.vue +96 -27
- package/src/components/ShowColumn/index.vue +5 -1
- package/src/components/Table/index.vue +61 -31
- package/src/components/TertiaryTab/index.vue +25 -15
- package/src/components/WornPagination/index.vue +1 -1
- package/src/directives/VHas/index.js +26 -0
- package/src/index.js +12 -8
- package/src/utils/i18n/index.js +0 -4
- package/src/utils/relaNo.js +8 -1
- package/style/index.css +1 -1
- package/style/index.css.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n20-common-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,8 +30,10 @@
|
|
|
30
30
|
"axios": "^0.21.4",
|
|
31
31
|
"dayjs": "^1.10.6",
|
|
32
32
|
"js-cookie": "^3.0.1",
|
|
33
|
+
"jsonwebtoken": "^8.5.1",
|
|
33
34
|
"normalize.css": "^8.0.1",
|
|
34
35
|
"numerify": "^1.2.9",
|
|
36
|
+
"qrcode": "^1.5.0",
|
|
35
37
|
"resize-detector": "^0.3.0",
|
|
36
38
|
"vuedraggable": "^2.24.3"
|
|
37
39
|
},
|
|
@@ -55,7 +57,6 @@
|
|
|
55
57
|
"mockjs": "^1.1.0",
|
|
56
58
|
"node-sass": "6.0.0",
|
|
57
59
|
"qiankun": "^2.5.1",
|
|
58
|
-
"qrcode": "^1.5.0",
|
|
59
60
|
"sass-loader": "^10.2.0",
|
|
60
61
|
"strip-json-comments": "^3.1.1",
|
|
61
62
|
"vue": "^2.6.11",
|
|
@@ -1,3 +1,66 @@
|
|
|
1
|
+
.n20-pagination-1 {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
padding-right: 5px;
|
|
4
|
+
> * {
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
}
|
|
7
|
+
.el-pagination {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
}
|
|
10
|
+
.btn-prev,
|
|
11
|
+
.btn-next {
|
|
12
|
+
padding-left: 6px;
|
|
13
|
+
padding-right: 6px;
|
|
14
|
+
border: 1px solid $--border-color-base;
|
|
15
|
+
&:not([disabled]):hover {
|
|
16
|
+
border-color: $--color-primary;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
.btn-next {
|
|
20
|
+
margin-left: 6px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.n20-pagination-jumper-1 {
|
|
24
|
+
width: 36px;
|
|
25
|
+
margin-left: 6px;
|
|
26
|
+
margin-right: 6px;
|
|
27
|
+
&.is-without-controls {
|
|
28
|
+
.el-input__inner {
|
|
29
|
+
height: 26px;
|
|
30
|
+
line-height: 26px;
|
|
31
|
+
padding-left: 4px;
|
|
32
|
+
padding-right: 4px;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
.n20-pagination-sizes-1 {
|
|
37
|
+
.el-radio-button__inner {
|
|
38
|
+
border-radius: $--border-radius-base !important;
|
|
39
|
+
border: 1px solid $--border-color-base;
|
|
40
|
+
box-shadow: none;
|
|
41
|
+
}
|
|
42
|
+
.el-radio-button__orig-radio:checked + .el-radio-button__inner {
|
|
43
|
+
border-color: $--color-primary;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
.n20-pagination-usersizes-1 {
|
|
47
|
+
width: 52px;
|
|
48
|
+
vertical-align: middle;
|
|
49
|
+
&.is-without-controls {
|
|
50
|
+
.el-input__inner {
|
|
51
|
+
height: 26px;
|
|
52
|
+
line-height: 26px;
|
|
53
|
+
padding-left: 4px;
|
|
54
|
+
padding-right: 4px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
&.is-active {
|
|
58
|
+
.el-input__inner {
|
|
59
|
+
border-color: $--border-color-base;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
1
64
|
.n20-pagination {
|
|
2
65
|
display: inline-block;
|
|
3
66
|
> * {
|
|
@@ -1,6 +1,51 @@
|
|
|
1
|
+
.n20-tertiary-tab-1 {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
& > .el-tabs__header {
|
|
5
|
+
border: none;
|
|
6
|
+
margin-bottom: 0;
|
|
7
|
+
.el-tabs__nav {
|
|
8
|
+
border: none;
|
|
9
|
+
}
|
|
10
|
+
.el-tabs__item {
|
|
11
|
+
height: auto;
|
|
12
|
+
line-height: 1;
|
|
13
|
+
padding: 6px 16px !important;
|
|
14
|
+
border: 1px solid $--border-color-light !important;
|
|
15
|
+
margin-left: -1px;
|
|
16
|
+
|
|
17
|
+
&:first-child {
|
|
18
|
+
margin-left: 0;
|
|
19
|
+
border-radius: 4px 0 0 4px;
|
|
20
|
+
}
|
|
21
|
+
&:last-child {
|
|
22
|
+
border-radius: 0 4px 4px 0;
|
|
23
|
+
}
|
|
24
|
+
&.is-active {
|
|
25
|
+
border: 1px solid $--color-primary !important;
|
|
26
|
+
z-index: 1;
|
|
27
|
+
}
|
|
28
|
+
&.is-disabled {
|
|
29
|
+
color: $--color-text-placeholder;
|
|
30
|
+
background-color: $--button-disabled-background-color;
|
|
31
|
+
border-color: $--button-default-border-color !important;
|
|
32
|
+
cursor: not-allowed;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.el-tabs__nav-prev,
|
|
38
|
+
.el-tabs__nav-next {
|
|
39
|
+
line-height: 28px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
1
43
|
.n20-tertiary-tab {
|
|
44
|
+
max-width: 100%;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
overflow-x: auto;
|
|
2
47
|
.el-radio-button--mini .el-radio-button__inner {
|
|
3
|
-
|
|
48
|
+
padding: 6px 16px;
|
|
4
49
|
}
|
|
5
50
|
.el-radio-button__orig-radio:checked + .el-radio-button__inner {
|
|
6
51
|
color: $--color-primary;
|
|
@@ -12,11 +12,13 @@
|
|
|
12
12
|
<slot :item="item" :index="index">
|
|
13
13
|
<span>{{ item[labelKey] || item }}</span>
|
|
14
14
|
</slot>
|
|
15
|
-
<
|
|
15
|
+
<el-link
|
|
16
16
|
v-if="!disabled"
|
|
17
|
-
class="n20-
|
|
17
|
+
class="n20-icon-shanchu"
|
|
18
|
+
:underline="false"
|
|
19
|
+
:disabled="inSC && item.checked"
|
|
18
20
|
@click="remove(index)"
|
|
19
|
-
|
|
21
|
+
/>
|
|
20
22
|
</div>
|
|
21
23
|
</vue-draggable>
|
|
22
24
|
</template>
|
|
@@ -45,6 +47,11 @@ export default {
|
|
|
45
47
|
default: 'label'
|
|
46
48
|
}
|
|
47
49
|
},
|
|
50
|
+
computed: {
|
|
51
|
+
inSC() {
|
|
52
|
+
return !!this.$attrs['in-show-column']
|
|
53
|
+
}
|
|
54
|
+
},
|
|
48
55
|
methods: {
|
|
49
56
|
change() {
|
|
50
57
|
this.$emit('change', this.list)
|
|
@@ -177,6 +177,7 @@
|
|
|
177
177
|
</template>
|
|
178
178
|
|
|
179
179
|
<script>
|
|
180
|
+
import decode from 'jsonwebtoken/decode'
|
|
180
181
|
import axios from '../../utils/axios'
|
|
181
182
|
import auth from '../../utils/auth'
|
|
182
183
|
import qrCode from './qrcode.vue'
|
|
@@ -223,6 +224,7 @@ export default {
|
|
|
223
224
|
accountPthon: '账户密码验证码登录'
|
|
224
225
|
},
|
|
225
226
|
theType: this.loginTypes[0],
|
|
227
|
+
userNo: undefined,
|
|
226
228
|
form: {
|
|
227
229
|
username: '',
|
|
228
230
|
password: '',
|
|
@@ -243,7 +245,8 @@ export default {
|
|
|
243
245
|
]
|
|
244
246
|
},
|
|
245
247
|
fPwV: false,
|
|
246
|
-
codeNum: '验证码'
|
|
248
|
+
codeNum: '验证码',
|
|
249
|
+
getAzCount: 0
|
|
247
250
|
}
|
|
248
251
|
},
|
|
249
252
|
methods: {
|
|
@@ -321,22 +324,41 @@ export default {
|
|
|
321
324
|
})
|
|
322
325
|
},
|
|
323
326
|
// 获取加密参数
|
|
324
|
-
|
|
327
|
+
authorizationCode(username, password, code) {
|
|
328
|
+
this.getAzCount = this.getAzCount + 1
|
|
329
|
+
|
|
325
330
|
let pwdArr = code ? [username, password, code] : [username, password]
|
|
326
331
|
let pwd = pwdArr.join('@@')
|
|
327
332
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
333
|
+
return new Promise((resolve, reject) => {
|
|
334
|
+
if (this.getAzCount <= 3) {
|
|
335
|
+
axios
|
|
336
|
+
.get(
|
|
337
|
+
'/bems/prod_1.0/uas/api/authorization/authorizationCode',
|
|
338
|
+
{},
|
|
339
|
+
{ loading: false }
|
|
340
|
+
)
|
|
341
|
+
.then(({ data = {} }) => {
|
|
342
|
+
try {
|
|
343
|
+
pwd = encode(pwd, data.authorizationValue)
|
|
344
|
+
this.pwd = pwd + '@@' + data.authorizationKey
|
|
345
|
+
|
|
346
|
+
this.getAzCount = 0
|
|
347
|
+
resolve()
|
|
348
|
+
} catch (error) {
|
|
349
|
+
console.error('密码加密错误:' + JSON.stringify(data))
|
|
350
|
+
this.authorizationCode(username, password, code) // 再次请求
|
|
351
|
+
.then(resolve)
|
|
352
|
+
.catch(reject)
|
|
353
|
+
}
|
|
354
|
+
})
|
|
355
|
+
} else {
|
|
356
|
+
// 当重新请求大于3次,抛出错误
|
|
357
|
+
this.$message.warning(`登录失败,请重新登录!`)
|
|
358
|
+
this.getAzCount = 0
|
|
359
|
+
reject()
|
|
360
|
+
}
|
|
361
|
+
})
|
|
340
362
|
},
|
|
341
363
|
// 账号/密码登录
|
|
342
364
|
async passwordLogin() {
|
|
@@ -467,6 +489,14 @@ export default {
|
|
|
467
489
|
// 登录成功后
|
|
468
490
|
loginAfter(data) {
|
|
469
491
|
auth.setToken(data.accessToken)
|
|
492
|
+
try {
|
|
493
|
+
let tokenObj = decode(data.accessToken)
|
|
494
|
+
let userInfo = JSON.parse(tokenObj.user_name)
|
|
495
|
+
this.userNo = userInfo.userNo
|
|
496
|
+
} catch (error) {
|
|
497
|
+
console.error('accessToken解析错误:' + data.accessToken)
|
|
498
|
+
}
|
|
499
|
+
|
|
470
500
|
Promise.all([
|
|
471
501
|
this.getUserInfo(),
|
|
472
502
|
this.getMicroAppsInfo(),
|
|
@@ -483,7 +513,7 @@ export default {
|
|
|
483
513
|
},
|
|
484
514
|
// 获取用户基本信息
|
|
485
515
|
async getUserInfo() {
|
|
486
|
-
let username = this.
|
|
516
|
+
let username = this.userNo
|
|
487
517
|
let { data } = await axios.get(
|
|
488
518
|
// '/bems/prod_1.0/user/api/userController/userCltAdDep/' + username
|
|
489
519
|
'/bems/prod_1.0/user/api/userController/userCltAdRole/' + username
|
|
@@ -517,7 +547,7 @@ export default {
|
|
|
517
547
|
axios
|
|
518
548
|
.post(
|
|
519
549
|
'/bems/prod_1.0/user/api/userController/qryBusyInfoNo',
|
|
520
|
-
{ uno: this.
|
|
550
|
+
{ uno: this.userNo },
|
|
521
551
|
{ loading: false, noMsg: true }
|
|
522
552
|
)
|
|
523
553
|
.then(({ data: cltrelaMap = [] }) => {
|
|
@@ -1,38 +1,79 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="n20-pagination">
|
|
2
|
+
<div class="n20-pagination-1">
|
|
3
3
|
<el-pagination
|
|
4
|
-
layout="prev,next,slot
|
|
4
|
+
layout="prev,next,slot"
|
|
5
5
|
:current-page.sync="pageObj[pageKey.no]"
|
|
6
6
|
:page-size="pageObj[pageKey.size]"
|
|
7
7
|
:total="pageObj[pageKey.total]"
|
|
8
8
|
:size="size"
|
|
9
9
|
@current-change="setnoOrsize"
|
|
10
|
+
/>
|
|
11
|
+
<span class="m-r-ss"
|
|
12
|
+
><span class="color-primary">{{ pageObj[pageKey.no] }}</span
|
|
13
|
+
>/{{ max }}</span
|
|
10
14
|
>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
<span>到第</span>
|
|
16
|
+
<el-input-number
|
|
17
|
+
v-model="toNo"
|
|
18
|
+
class="n20-pagination-jumper-1 m-r-ss"
|
|
19
|
+
:min="1"
|
|
20
|
+
:max="max"
|
|
21
|
+
:step="1"
|
|
22
|
+
:step-strictly="true"
|
|
23
|
+
:controls="false"
|
|
24
|
+
:size="size"
|
|
25
|
+
@change="setnoOrsize"
|
|
26
|
+
/>
|
|
27
|
+
<span class="m-r-s">页</span>
|
|
28
|
+
<el-popover v-model="settingV" placement="top" trigger="click">
|
|
29
|
+
<el-link
|
|
30
|
+
slot="reference"
|
|
31
|
+
icon="n20-icon-shezhi"
|
|
32
|
+
:underline="false"
|
|
33
|
+
style="font-size: 18px"
|
|
34
|
+
/>
|
|
35
|
+
<div>
|
|
36
|
+
<span>每页显示</span>
|
|
37
|
+
<el-radio-group
|
|
17
38
|
v-model="pageObj[pageKey.size]"
|
|
39
|
+
class="n20-pagination-sizes-1 m-l-s"
|
|
18
40
|
size="mini"
|
|
19
|
-
|
|
20
|
-
|
|
41
|
+
@change="
|
|
42
|
+
() => {
|
|
43
|
+
setnoOrsize()
|
|
44
|
+
settingV = false
|
|
45
|
+
}
|
|
46
|
+
"
|
|
21
47
|
>
|
|
22
|
-
<el-
|
|
48
|
+
<el-radio-button
|
|
23
49
|
v-for="item in pageSizes"
|
|
24
50
|
:key="item"
|
|
25
|
-
|
|
26
|
-
:label="item
|
|
27
|
-
/>
|
|
28
|
-
<el-option
|
|
29
|
-
:value="pageObj[pageKey.size]"
|
|
30
|
-
:label="pageObj[pageKey.size] + '条/页'"
|
|
31
|
-
style="display: none"
|
|
51
|
+
class="m-r-s"
|
|
52
|
+
:label="item"
|
|
32
53
|
/>
|
|
33
|
-
</el-
|
|
34
|
-
|
|
35
|
-
|
|
54
|
+
</el-radio-group>
|
|
55
|
+
<el-input-number
|
|
56
|
+
v-model="userSize"
|
|
57
|
+
class="n20-pagination-usersizes-1"
|
|
58
|
+
:class="{
|
|
59
|
+
'is-active': !pageSizes.includes(pageObj[pageKey.size])
|
|
60
|
+
}"
|
|
61
|
+
:min="1"
|
|
62
|
+
:max="sizeMax"
|
|
63
|
+
:step="1"
|
|
64
|
+
:step-strictly="true"
|
|
65
|
+
:controls="false"
|
|
66
|
+
size="mini"
|
|
67
|
+
placeholder="自定义"
|
|
68
|
+
@change="
|
|
69
|
+
() => {
|
|
70
|
+
setnoOrsize()
|
|
71
|
+
settingV = false
|
|
72
|
+
}
|
|
73
|
+
"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
</el-popover>
|
|
36
77
|
</div>
|
|
37
78
|
</template>
|
|
38
79
|
|
|
@@ -62,11 +103,16 @@ export default {
|
|
|
62
103
|
},
|
|
63
104
|
pageSizes: {
|
|
64
105
|
type: Array,
|
|
65
|
-
default: () => [20, 50, 100
|
|
106
|
+
default: () => [20, 50, 100]
|
|
107
|
+
},
|
|
108
|
+
sizeMax: {
|
|
109
|
+
type: Number,
|
|
110
|
+
default: 1000
|
|
66
111
|
}
|
|
67
112
|
},
|
|
68
113
|
data() {
|
|
69
114
|
return {
|
|
115
|
+
settingV: false,
|
|
70
116
|
noOrsize: ''
|
|
71
117
|
}
|
|
72
118
|
},
|
|
@@ -76,6 +122,31 @@ export default {
|
|
|
76
122
|
let size = this.pageObj[this.pageKey.size]
|
|
77
123
|
|
|
78
124
|
return Math.ceil(total / size)
|
|
125
|
+
},
|
|
126
|
+
toNo: {
|
|
127
|
+
get() {
|
|
128
|
+
return this.pageObj[this.pageKey.no]
|
|
129
|
+
},
|
|
130
|
+
set(val) {
|
|
131
|
+
if (val) {
|
|
132
|
+
this.pageObj[this.pageKey.no] = val
|
|
133
|
+
} else {
|
|
134
|
+
this.pageObj[this.pageKey.no] = 1
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
userSize: {
|
|
139
|
+
get() {
|
|
140
|
+
return this.pageObj[this.pageKey.size]
|
|
141
|
+
},
|
|
142
|
+
set(val) {
|
|
143
|
+
if (val) {
|
|
144
|
+
this.pageObj[this.pageKey.size] = val
|
|
145
|
+
} else {
|
|
146
|
+
this.pageObj[this.pageKey.size] = this.pageSizes[0]
|
|
147
|
+
}
|
|
148
|
+
this.pageObj[this.pageKey.no] = 1
|
|
149
|
+
}
|
|
79
150
|
}
|
|
80
151
|
},
|
|
81
152
|
watch: {
|
|
@@ -85,11 +156,9 @@ export default {
|
|
|
85
156
|
},
|
|
86
157
|
methods: {
|
|
87
158
|
setnoOrsize() {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.noOrsize = no + ',' + size
|
|
92
|
-
})
|
|
159
|
+
let no = this.pageObj[this.pageKey.no]
|
|
160
|
+
let size = this.pageObj[this.pageKey.size]
|
|
161
|
+
this.noOrsize = no + ',' + size
|
|
93
162
|
}
|
|
94
163
|
}
|
|
95
164
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<el-table-column
|
|
21
21
|
v-else
|
|
22
22
|
:key="'cl-table-' + i"
|
|
23
|
-
:formatter="item.formatter | colfF"
|
|
23
|
+
:formatter="item.formatter | colfF(item.formatterMap)"
|
|
24
24
|
:filters="item.filters | colftF(filtersMap)"
|
|
25
25
|
v-bind="item"
|
|
26
26
|
/>
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
<script>
|
|
72
72
|
import numerify from 'numerify'
|
|
73
|
+
import dayjs from 'dayjs'
|
|
73
74
|
import Pagination from '../Pagination/index.vue'
|
|
74
75
|
|
|
75
76
|
const columnRender = {
|
|
@@ -86,6 +87,63 @@ const columnRender = {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
|
|
90
|
+
function colfF(colf, map) {
|
|
91
|
+
if (typeof colf !== 'string') return colf
|
|
92
|
+
let sc = colf.split(/{.+?}/g) || []
|
|
93
|
+
let mc = colf.match(/{.+?}/g) || []
|
|
94
|
+
let mck = []
|
|
95
|
+
mc.forEach((t) => {
|
|
96
|
+
t = t.replace(/^{|\s+|}$/g, '').split('|')
|
|
97
|
+
mck.push(t)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
return (row) => tplFn(row, sc, mck, map)
|
|
101
|
+
}
|
|
102
|
+
function tplFn(row, sc, mck, map = {}) {
|
|
103
|
+
let str = ''
|
|
104
|
+
sc.forEach((s, i) => {
|
|
105
|
+
str += s
|
|
106
|
+
let kA = mck[i]
|
|
107
|
+
if (kA && kA.length) {
|
|
108
|
+
let key = kA[0]
|
|
109
|
+
if (kA.length === 1) {
|
|
110
|
+
str += row[key]
|
|
111
|
+
} else {
|
|
112
|
+
let type = kA[1]
|
|
113
|
+
switch (type) {
|
|
114
|
+
case 'money':
|
|
115
|
+
str += numerify(row[key], '0,0.00')
|
|
116
|
+
break
|
|
117
|
+
case 'rate':
|
|
118
|
+
str += numerify(row[key], '0.000000')
|
|
119
|
+
break
|
|
120
|
+
case 'map':
|
|
121
|
+
str += map[row[key]]
|
|
122
|
+
break
|
|
123
|
+
case 'date':
|
|
124
|
+
str += dayjs(row[key]).format('YYYY-MM-DD')
|
|
125
|
+
break
|
|
126
|
+
case 'datetime':
|
|
127
|
+
str += dayjs(row[key]).format('YYYY-MM-DD HH:mm:ss')
|
|
128
|
+
break
|
|
129
|
+
case 'time':
|
|
130
|
+
str += dayjs(row[key]).format('HH:mm:ss')
|
|
131
|
+
break
|
|
132
|
+
default:
|
|
133
|
+
str += row[key]
|
|
134
|
+
break
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
return str
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function colftF(colft, fMap) {
|
|
143
|
+
if (typeof colft !== 'string') return colft
|
|
144
|
+
return fMap[colft]
|
|
145
|
+
}
|
|
146
|
+
|
|
89
147
|
export default {
|
|
90
148
|
name: 'Table',
|
|
91
149
|
components: {
|
|
@@ -93,36 +151,8 @@ export default {
|
|
|
93
151
|
columnRender
|
|
94
152
|
},
|
|
95
153
|
filters: {
|
|
96
|
-
colfF
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (/\|money/.test(colf)) {
|
|
100
|
-
let mc = colf.match(/{(\S+)\|money}/)
|
|
101
|
-
let key = mc && mc[1]
|
|
102
|
-
|
|
103
|
-
return (row) => numerify(row[key], '0,0.00')
|
|
104
|
-
} else if (/\|rate/.test(colf)) {
|
|
105
|
-
let mc = colf.match(/{(\S+)\|rate}/)
|
|
106
|
-
let key = mc && mc[1]
|
|
107
|
-
|
|
108
|
-
return (row) => numerify(row[key], '0.000000')
|
|
109
|
-
} else {
|
|
110
|
-
let mc = colf.match(/{[^}]+}/g) || []
|
|
111
|
-
let mcv = mc.map((m) => m.replace(/{|}/g, ''))
|
|
112
|
-
|
|
113
|
-
return (row) => {
|
|
114
|
-
let str = colf
|
|
115
|
-
mc.forEach((tp, i) => {
|
|
116
|
-
str = str.replace(tp, row[mcv[i]])
|
|
117
|
-
})
|
|
118
|
-
return str
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
colftF(colft, fMap) {
|
|
123
|
-
if (typeof colft !== 'string') return colft
|
|
124
|
-
return fMap[colft]
|
|
125
|
-
}
|
|
154
|
+
colfF,
|
|
155
|
+
colftF
|
|
126
156
|
},
|
|
127
157
|
props: {
|
|
128
158
|
column: {
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
|
|
2
2
|
<template>
|
|
3
|
-
<el-
|
|
4
|
-
|
|
3
|
+
<el-tabs
|
|
4
|
+
:value="init"
|
|
5
|
+
class="n20-tertiary-tab-1"
|
|
6
|
+
type="card"
|
|
7
|
+
:before-leave="beforeFn"
|
|
8
|
+
@tab-click="clickFn"
|
|
9
|
+
>
|
|
10
|
+
<el-tab-pane
|
|
5
11
|
v-for="item of data"
|
|
6
12
|
:key="item.name"
|
|
7
|
-
:
|
|
13
|
+
:tab-info="item"
|
|
14
|
+
:name="item.name"
|
|
15
|
+
:icon="item.icon"
|
|
8
16
|
:disabled="item.disabled"
|
|
9
|
-
@click.native.prevent="(ev) => clickFn(item, ev)"
|
|
10
17
|
>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
<template slot="label">
|
|
19
|
+
<span v-if="item.icon" :class="item.icon"></span>
|
|
20
|
+
{{ item.name }}
|
|
21
|
+
</template>
|
|
22
|
+
</el-tab-pane>
|
|
23
|
+
</el-tabs>
|
|
15
24
|
</template>
|
|
16
25
|
|
|
17
26
|
<script>
|
|
@@ -31,22 +40,23 @@ export default {
|
|
|
31
40
|
default: 'mini'
|
|
32
41
|
}
|
|
33
42
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
computed: {
|
|
44
|
+
stop() {
|
|
45
|
+
return !this.$listeners['update:init']
|
|
37
46
|
}
|
|
38
|
-
return {}
|
|
39
47
|
},
|
|
40
48
|
methods: {
|
|
41
|
-
clickFn(
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
clickFn(C) {
|
|
50
|
+
let item = C.$attrs['tab-info']
|
|
44
51
|
if (this.$listeners['update:init']) {
|
|
45
52
|
!item.disabled && this.$emit('update:init', item.name)
|
|
46
53
|
}
|
|
47
54
|
if (this.$listeners['click']) {
|
|
48
55
|
this.$emit('click', item)
|
|
49
56
|
}
|
|
57
|
+
},
|
|
58
|
+
beforeFn(name) {
|
|
59
|
+
return name === this.init ? true : !this.stop
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
}
|