n20-common-lib 2.1.21 → 2.1.23
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 +1 -1
- package/src/components/ApprovalButtons/index.vue +1 -7
- package/src/components/CascaderArea/index.vue +14 -6
- package/src/components/Filters/indexO.vue +2 -2
- package/src/components/InputNumber/index.vue +64 -72
- package/src/components/Layout/HeaderWrap/index.vue +32 -1
- package/src/components/Layout/HeaderWrap/indexN.vue +75 -15
- package/src/components/Layout/HeaderWrap/noticePop.vue +8 -64
- package/src/components/Statis/statisItem.vue +2 -2
- package/src/components/Table/filters.js +2 -2
- package/src/index.js +10 -4
- package/src/utils/element-ui-emitter.js +19 -0
- package/src/utils/numberPor.js +274 -0
package/package.json
CHANGED
|
@@ -52,13 +52,7 @@
|
|
|
52
52
|
/>
|
|
53
53
|
</el-form-item>
|
|
54
54
|
<template v-if="taskId && showBtn">
|
|
55
|
-
<show-app-opi
|
|
56
|
-
v-if="authList.includes('showAppOpi')"
|
|
57
|
-
class="flex-1 m-l-s"
|
|
58
|
-
:task-id="taskId"
|
|
59
|
-
:message.sync="messageC"
|
|
60
|
-
style="width: 20%"
|
|
61
|
-
/>
|
|
55
|
+
<show-app-opi class="flex-1 m-l-s" :task-id="taskId" :message.sync="messageC" style="width: 20%" />
|
|
62
56
|
<show-other-att
|
|
63
57
|
v-if="authList.includes('showOtherAtt')"
|
|
64
58
|
class="flex-1 m-l"
|
|
@@ -6,12 +6,7 @@
|
|
|
6
6
|
:options="areaTree"
|
|
7
7
|
:filterable="filterable"
|
|
8
8
|
:clearable="clearable"
|
|
9
|
-
:props="
|
|
10
|
-
value: 'regionNo',
|
|
11
|
-
label: 'regionName',
|
|
12
|
-
children: 'children',
|
|
13
|
-
expandTrigger: 'hover'
|
|
14
|
-
}"
|
|
9
|
+
:props="propsAs"
|
|
15
10
|
v-on="$listeners"
|
|
16
11
|
/>
|
|
17
12
|
</template>
|
|
@@ -44,6 +39,10 @@ export default {
|
|
|
44
39
|
countryId: {
|
|
45
40
|
type: String,
|
|
46
41
|
default: 'CHN'
|
|
42
|
+
},
|
|
43
|
+
props: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: undefined
|
|
47
46
|
}
|
|
48
47
|
},
|
|
49
48
|
data() {
|
|
@@ -52,6 +51,15 @@ export default {
|
|
|
52
51
|
}
|
|
53
52
|
},
|
|
54
53
|
computed: {
|
|
54
|
+
propsAs() {
|
|
55
|
+
let _prop = {
|
|
56
|
+
value: 'regionNo',
|
|
57
|
+
label: 'regionName',
|
|
58
|
+
children: 'children',
|
|
59
|
+
expandTrigger: 'hover'
|
|
60
|
+
}
|
|
61
|
+
return Object.assign(_prop, this.props)
|
|
62
|
+
},
|
|
55
63
|
areaKey() {
|
|
56
64
|
return this.countryId === 'CHN' ? '_china_area_tree_' : `_${this.countryId}_area_tree_`
|
|
57
65
|
},
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
<div class="text-c m-t m-b">
|
|
29
29
|
<slot name="actions">
|
|
30
|
-
<el-button
|
|
30
|
+
<el-button type="primary" @click="filter">
|
|
31
31
|
{{ filterText }}
|
|
32
32
|
</el-button>
|
|
33
|
-
<el-button
|
|
33
|
+
<el-button plain @click="clear">
|
|
34
34
|
{{ clearText }}
|
|
35
35
|
</el-button>
|
|
36
36
|
</slot>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="n20-num-w" @mouseenter="isHove = true" @mouseleave="isHove = false">
|
|
3
3
|
<el-input
|
|
4
|
+
ref="input"
|
|
4
5
|
v-model="valueStr"
|
|
5
6
|
class="n20-stc"
|
|
6
7
|
:disabled="disabled"
|
|
7
8
|
:placeholder="phd"
|
|
8
9
|
:clearable="isClearable"
|
|
10
|
+
:validate-event="false"
|
|
9
11
|
@clear="closeFn"
|
|
10
12
|
@focus="focusFn"
|
|
11
13
|
@input="inputFn"
|
|
@@ -24,9 +26,12 @@
|
|
|
24
26
|
|
|
25
27
|
<script>
|
|
26
28
|
import { $lc } from '../../utils/i18n/index'
|
|
27
|
-
import
|
|
29
|
+
import emitter from '../../utils/element-ui-emitter'
|
|
30
|
+
import N from '../../utils/numberPor'
|
|
31
|
+
|
|
28
32
|
export default {
|
|
29
33
|
name: 'InputNumber',
|
|
34
|
+
mixins: [emitter],
|
|
30
35
|
props: {
|
|
31
36
|
value: {
|
|
32
37
|
type: [Number, String],
|
|
@@ -41,11 +46,11 @@ export default {
|
|
|
41
46
|
},
|
|
42
47
|
min: {
|
|
43
48
|
type: Number,
|
|
44
|
-
default: -9999999999999
|
|
49
|
+
default: -9999999999999.99
|
|
45
50
|
},
|
|
46
51
|
max: {
|
|
47
52
|
type: Number,
|
|
48
|
-
default: 9999999999999
|
|
53
|
+
default: 9999999999999.99
|
|
49
54
|
},
|
|
50
55
|
step: {
|
|
51
56
|
type: Number,
|
|
@@ -78,6 +83,10 @@ export default {
|
|
|
78
83
|
suffix: {
|
|
79
84
|
type: String,
|
|
80
85
|
default: '%'
|
|
86
|
+
},
|
|
87
|
+
rangeAuto: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: false
|
|
81
90
|
}
|
|
82
91
|
},
|
|
83
92
|
data() {
|
|
@@ -98,36 +107,37 @@ export default {
|
|
|
98
107
|
} else {
|
|
99
108
|
return $lc('请输入金额')
|
|
100
109
|
}
|
|
110
|
+
},
|
|
111
|
+
fNum() {
|
|
112
|
+
if (this.format) {
|
|
113
|
+
let i_f = this.format.indexOf('.')
|
|
114
|
+
return i_f === -1 ? 0 : this.format.length - i_f - 1
|
|
115
|
+
}
|
|
116
|
+
if (this.dNum) {
|
|
117
|
+
return this.dNum
|
|
118
|
+
}
|
|
119
|
+
if (this.type === 'rate') {
|
|
120
|
+
return 4
|
|
121
|
+
}
|
|
122
|
+
if (this.type === 'money') {
|
|
123
|
+
return 2
|
|
124
|
+
}
|
|
125
|
+
return 2
|
|
101
126
|
}
|
|
102
127
|
},
|
|
103
128
|
watch: {
|
|
104
129
|
value: {
|
|
105
130
|
handler(val) {
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this
|
|
110
|
-
this.valueStr = this.num2str(val)
|
|
111
|
-
return
|
|
131
|
+
if (this.rangeAuto) {
|
|
132
|
+
this.valueStr = N.addThousands(val)
|
|
133
|
+
} else {
|
|
134
|
+
this.valueStr = N.addThousands(N.subFixed(val, this.fNum))
|
|
112
135
|
}
|
|
113
|
-
this.valueStr = this.num2str(val)
|
|
114
136
|
},
|
|
115
137
|
immediate: true
|
|
116
138
|
}
|
|
117
139
|
},
|
|
118
140
|
methods: {
|
|
119
|
-
num2str(val = '') {
|
|
120
|
-
if (val === '' || val === null || val === undefined) {
|
|
121
|
-
return ''
|
|
122
|
-
}
|
|
123
|
-
switch (this.type) {
|
|
124
|
-
case 'rate':
|
|
125
|
-
return numerify(val, this.format || '0.0000')
|
|
126
|
-
case 'money':
|
|
127
|
-
default:
|
|
128
|
-
return numerify(val, this.format || '0,0.00')
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
141
|
focusFn() {
|
|
132
142
|
this.isFocus = true
|
|
133
143
|
if (!this.disabled && this.valueStr) {
|
|
@@ -143,7 +153,7 @@ export default {
|
|
|
143
153
|
},
|
|
144
154
|
stepFn(ev) {
|
|
145
155
|
if ((ev.code === 'ArrowUp' || ev.code === 'ArrowDown') && !this.disabled) {
|
|
146
|
-
let val =
|
|
156
|
+
let val = N(this.valueStr)
|
|
147
157
|
if (!isNaN(val)) {
|
|
148
158
|
ev.preventDefault()
|
|
149
159
|
val = ev.code === 'ArrowUp' ? val + this.step : val - this.step
|
|
@@ -152,9 +162,11 @@ export default {
|
|
|
152
162
|
} else if (val > this.max) {
|
|
153
163
|
val = this.max
|
|
154
164
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
if (this.rangeAuto) {
|
|
166
|
+
this.valueStr = N.toString(val)
|
|
167
|
+
} else {
|
|
168
|
+
this.valueStr = N.subFixed(val, this.fNum)
|
|
169
|
+
}
|
|
158
170
|
}
|
|
159
171
|
}
|
|
160
172
|
},
|
|
@@ -172,51 +184,42 @@ export default {
|
|
|
172
184
|
this.changeIng = false
|
|
173
185
|
})
|
|
174
186
|
|
|
175
|
-
|
|
176
|
-
let val = NumberP(valStr)
|
|
177
|
-
|
|
187
|
+
let val = N(valStr)
|
|
178
188
|
if (isNaN(val)) {
|
|
179
189
|
this.valueStr = ''
|
|
180
190
|
this.$emit('input', undefined)
|
|
181
191
|
this.$emit('change', undefined)
|
|
192
|
+
this.dispatch('ElFormItem', 'el.form.change', [undefined])
|
|
182
193
|
return
|
|
183
194
|
}
|
|
184
195
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
} else
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
196
|
+
let nStr
|
|
197
|
+
if (this.rangeAuto) {
|
|
198
|
+
nStr = N.toString(val)
|
|
199
|
+
this.valueStr = N.addThousands(valStr)
|
|
200
|
+
} else {
|
|
201
|
+
if (this.stepStrictly) {
|
|
202
|
+
let N = val / this.step
|
|
203
|
+
if (val % this.step !== 0) {
|
|
204
|
+
val = Math.round(N) * this.step
|
|
205
|
+
}
|
|
193
206
|
}
|
|
207
|
+
if (val < this.min) {
|
|
208
|
+
val = this.min
|
|
209
|
+
} else if (val > this.max) {
|
|
210
|
+
val = this.max
|
|
211
|
+
}
|
|
212
|
+
nStr = N.subFixed(val, this.fNum)
|
|
213
|
+
this.valueStr = N.addThousands(nStr)
|
|
194
214
|
}
|
|
195
|
-
this.valueStr = this.num2str(val)
|
|
196
215
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
this.$emit('change', nVar)
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
break
|
|
208
|
-
case 'money':
|
|
209
|
-
default:
|
|
210
|
-
{
|
|
211
|
-
let dNum = this.dNum !== undefined ? this.dNum : 2
|
|
212
|
-
let nVar = Number(val.toFixed(dNum))
|
|
213
|
-
this.$nextTick(() => {
|
|
214
|
-
this.$emit('input', nVar)
|
|
215
|
-
this.$emit('change', nVar)
|
|
216
|
-
})
|
|
217
|
-
}
|
|
218
|
-
break
|
|
219
|
-
}
|
|
216
|
+
this.$nextTick(() => {
|
|
217
|
+
let nVar = Number(nStr)
|
|
218
|
+
this.$emit('input', nVar)
|
|
219
|
+
this.$emit('change', nVar)
|
|
220
|
+
|
|
221
|
+
this.dispatch('ElFormItem', 'el.form.change', [nVar])
|
|
222
|
+
})
|
|
220
223
|
},
|
|
221
224
|
closeFn() {
|
|
222
225
|
this.$emit('input', undefined)
|
|
@@ -224,15 +227,4 @@ export default {
|
|
|
224
227
|
}
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
|
-
|
|
228
|
-
function NumberP(val) {
|
|
229
|
-
if (typeof val === 'string') {
|
|
230
|
-
val = val.replace(/,/g, '').trim()
|
|
231
|
-
}
|
|
232
|
-
if (val === undefined || val === null || val === '') {
|
|
233
|
-
return NaN
|
|
234
|
-
} else {
|
|
235
|
-
return Number(val)
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
230
|
</script>
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
</dialogWrap>
|
|
156
156
|
<!-- 消息/通知 -->
|
|
157
157
|
<el-popover ref="noticePop" trigger="click" width="400" @after-enter="$refs.noticeContent.show()">
|
|
158
|
-
<noticePop ref="noticeContent"
|
|
158
|
+
<noticePop ref="noticeContent" />
|
|
159
159
|
</el-popover>
|
|
160
160
|
<el-dialog :visible.sync="scV" :title="'切换用户' | $lc" append-to-body width="600px">
|
|
161
161
|
<switchUser :visible.sync="scV" :user-no="userNo" />
|
|
@@ -270,6 +270,10 @@ export default {
|
|
|
270
270
|
this.show = true
|
|
271
271
|
}
|
|
272
272
|
})
|
|
273
|
+
|
|
274
|
+
this.getNNum()
|
|
275
|
+
document.addEventListener('visibilitychange', this.getNNum)
|
|
276
|
+
window.addEventListener('message', this.updateNotice)
|
|
273
277
|
},
|
|
274
278
|
mounted() {
|
|
275
279
|
let userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}')
|
|
@@ -281,6 +285,10 @@ export default {
|
|
|
281
285
|
}
|
|
282
286
|
this.rolesList = userInfo.roles || []
|
|
283
287
|
},
|
|
288
|
+
beforeDestroy() {
|
|
289
|
+
document.removeEventListener('visibilitychange', this.getNNum)
|
|
290
|
+
window.removeEventListener('message', this.updateNotice)
|
|
291
|
+
},
|
|
284
292
|
methods: {
|
|
285
293
|
// 跳转打主数据人员页面
|
|
286
294
|
goMdmUser() {
|
|
@@ -422,6 +430,29 @@ export default {
|
|
|
422
430
|
})
|
|
423
431
|
|
|
424
432
|
this.underway = !!res.data
|
|
433
|
+
},
|
|
434
|
+
// 更新消息条数
|
|
435
|
+
updateNotice(ev) {
|
|
436
|
+
if (ev.data === 'NstcUpdateNotice') {
|
|
437
|
+
this.getNNum()
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
// 获取消息条数
|
|
441
|
+
getNNum() {
|
|
442
|
+
clearTimeout(this.getNNumTimeOut)
|
|
443
|
+
if (!document.hidden) {
|
|
444
|
+
Promise.all([
|
|
445
|
+
axios.get('/bems/wkb/messageCenter/getUnReadTotal/' + this.username, null, { loading: false, noMsg: true }),
|
|
446
|
+
axios.get('/bems/1.0/notice/notReadCount', null, {
|
|
447
|
+
loading: false,
|
|
448
|
+
noMsg: true
|
|
449
|
+
})
|
|
450
|
+
]).then(([res_1, res_2]) => {
|
|
451
|
+
this.noticeNum = (res_1.data.data || 0) + (res_2.data || 0)
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
this.getNNumTimeOut = setTimeout(this.loopGetNNum, 1000 * 60 * 3)
|
|
455
|
+
}
|
|
425
456
|
}
|
|
426
457
|
}
|
|
427
458
|
}
|
|
@@ -74,7 +74,8 @@
|
|
|
74
74
|
</el-tooltip>
|
|
75
75
|
|
|
76
76
|
<el-badge :hidden="noticeNum === 0" :value="noticeNum">
|
|
77
|
-
<span v-popover:noticePop class="news-btn iconfont icon-xiaoxi header-color"></span>
|
|
77
|
+
<span v-if="!noticeDrw" v-popover:noticePop class="news-btn iconfont icon-xiaoxi header-color"></span>
|
|
78
|
+
<span v-else class="news-btn iconfont icon-xiaoxi header-color" @click="customOpt.noticeDrawer"></span>
|
|
78
79
|
</el-badge>
|
|
79
80
|
|
|
80
81
|
<el-popover ref="by_popover" v-model="byV" placement="bottom-start" trigger="manual" popper-class="uby-w">
|
|
@@ -121,8 +122,11 @@
|
|
|
121
122
|
<div class="uif-gs text-ellipsis">{{ userInfo.companyName }}</div>
|
|
122
123
|
<div class="uif-js text-ellipsis">{{ rolesList.map((el) => el.name).join('/') }}</div>
|
|
123
124
|
<div class="uif-by">
|
|
124
|
-
<
|
|
125
|
-
|
|
125
|
+
<template v-if="!byEV">
|
|
126
|
+
<span>{{ byLabel }}</span>
|
|
127
|
+
<span class="_edit el-icon-edit" @click="byEShow"></span>
|
|
128
|
+
</template>
|
|
129
|
+
<el-input v-else v-model="byLabel" size="mini" style="width: 92%" @blur="editByLabel" />
|
|
126
130
|
</div>
|
|
127
131
|
</div>
|
|
128
132
|
<el-dropdown-item command="changePassword">
|
|
@@ -212,8 +216,8 @@
|
|
|
212
216
|
<changePwd :visible.sync="cpwdV" />
|
|
213
217
|
</dialogWrap>
|
|
214
218
|
<!-- 消息/通知 -->
|
|
215
|
-
<el-popover ref="noticePop" trigger="click" width="400" @after-enter="$refs.noticeContent.show()">
|
|
216
|
-
<noticePop ref="noticeContent"
|
|
219
|
+
<el-popover v-if="!noticeDrw" ref="noticePop" trigger="click" width="400" @after-enter="$refs.noticeContent.show()">
|
|
220
|
+
<noticePop ref="noticeContent" />
|
|
217
221
|
</el-popover>
|
|
218
222
|
<el-dialog :visible.sync="scV" :title="'切换用户' | $lc" append-to-body width="600px">
|
|
219
223
|
<switchUser :visible.sync="scV" :user-no="userNo" />
|
|
@@ -303,10 +307,16 @@ export default {
|
|
|
303
307
|
/* */
|
|
304
308
|
byV: false,
|
|
305
309
|
byLabel: '',
|
|
310
|
+
byEV: false,
|
|
306
311
|
headerUserInfoBg: realUrl('/server-assets/userInfoBg.png'),
|
|
307
312
|
inBack: window.localStorage.getItem('pageInType') === 'inBack'
|
|
308
313
|
}
|
|
309
314
|
},
|
|
315
|
+
computed: {
|
|
316
|
+
noticeDrw() {
|
|
317
|
+
return !!this.customOpt.noticeDrawer
|
|
318
|
+
}
|
|
319
|
+
},
|
|
310
320
|
created() {
|
|
311
321
|
getJsonc('/server-config.jsonc').then(({ _layoutData = {}, loginSetting }) => {
|
|
312
322
|
let _loginSetting = loginSetting || _layoutData.loginSetting
|
|
@@ -343,6 +353,10 @@ export default {
|
|
|
343
353
|
}, 6000)
|
|
344
354
|
})
|
|
345
355
|
})
|
|
356
|
+
|
|
357
|
+
this.getNNum()
|
|
358
|
+
document.addEventListener('visibilitychange', this.getNNum)
|
|
359
|
+
window.addEventListener('message', this.updateNotice)
|
|
346
360
|
},
|
|
347
361
|
mounted() {
|
|
348
362
|
let userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}')
|
|
@@ -354,6 +368,10 @@ export default {
|
|
|
354
368
|
}
|
|
355
369
|
this.rolesList = userInfo.roles || []
|
|
356
370
|
},
|
|
371
|
+
beforeDestroy() {
|
|
372
|
+
document.removeEventListener('visibilitychange', this.getNNum)
|
|
373
|
+
window.removeEventListener('message', this.updateNotice)
|
|
374
|
+
},
|
|
357
375
|
methods: {
|
|
358
376
|
// 跳转打主数据人员页面
|
|
359
377
|
goMdmUser() {
|
|
@@ -377,6 +395,10 @@ export default {
|
|
|
377
395
|
},
|
|
378
396
|
// 打开帮助文档
|
|
379
397
|
openHelp() {
|
|
398
|
+
if (this.customOpt.openHelp) {
|
|
399
|
+
this.customOpt.openHelp()
|
|
400
|
+
return false
|
|
401
|
+
}
|
|
380
402
|
axios
|
|
381
403
|
.get(`/bems/1.0/userManual`, {}, { responseType: 'blob' })
|
|
382
404
|
.then((res) => {
|
|
@@ -454,7 +476,10 @@ export default {
|
|
|
454
476
|
window.location.reload()
|
|
455
477
|
},
|
|
456
478
|
dowApp() {
|
|
457
|
-
|
|
479
|
+
if (this.customOpt.dowApp) {
|
|
480
|
+
this.customOpt.dowApp()
|
|
481
|
+
return false
|
|
482
|
+
}
|
|
458
483
|
let name = 'download.exe'
|
|
459
484
|
let aDom = document.createElement('a')
|
|
460
485
|
aDom.href = `${prefix}server-assets/${name}`
|
|
@@ -537,21 +562,56 @@ export default {
|
|
|
537
562
|
this.headerUserUrl = window.URL.createObjectURL(login)
|
|
538
563
|
})
|
|
539
564
|
},
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
})
|
|
546
|
-
|
|
565
|
+
byEShow() {
|
|
566
|
+
this.byLabelO = this.byLabel
|
|
567
|
+
this.byEV = true
|
|
568
|
+
},
|
|
569
|
+
editByLabel() {
|
|
570
|
+
// let { value } = await this.$prompt($lc('请输入欢迎语'), $lc('修改'), {
|
|
571
|
+
// confirmButtonText: $lc('确定'),
|
|
572
|
+
// cancelButtonText: $lc('取消'),
|
|
573
|
+
// inputValue: this.byLabel
|
|
574
|
+
// })
|
|
575
|
+
// await this.$axios.get(`/bems/portal/portalUserIndexConfig/saveConfigSign/${value}`)
|
|
576
|
+
// this.byLabel = value
|
|
547
577
|
|
|
548
|
-
this
|
|
578
|
+
this.$axios
|
|
579
|
+
.get(`/bems/portal/portalUserIndexConfig/saveConfigSign/${this.byLabel}`)
|
|
580
|
+
.then(() => {
|
|
581
|
+
this.byEV = false
|
|
582
|
+
})
|
|
583
|
+
.catch(() => {
|
|
584
|
+
this.byLabel = this.byLabelO
|
|
585
|
+
})
|
|
549
586
|
},
|
|
550
587
|
getByLabel() {
|
|
551
588
|
return this.$axios.get(`/bems/portal/portalUserIndexConfig/getConfigByUno`).then((res) => {
|
|
552
589
|
let data = res.data || {}
|
|
553
|
-
this.byLabel = data.signature
|
|
590
|
+
data.signature && (this.byLabel = data.signature)
|
|
554
591
|
})
|
|
592
|
+
},
|
|
593
|
+
// 更新消息条数
|
|
594
|
+
updateNotice(ev) {
|
|
595
|
+
if (ev.data === 'NstcUpdateNotice') {
|
|
596
|
+
this.getNNum()
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
// 获取消息条数
|
|
600
|
+
getNNum() {
|
|
601
|
+
clearTimeout(this.getNNumTimeOut)
|
|
602
|
+
if (!document.hidden) {
|
|
603
|
+
Promise.all([
|
|
604
|
+
axios.get('/bems/wkb/messageCenter/getUnReadTotal/' + this.username, null, { loading: false, noMsg: true }),
|
|
605
|
+
axios.get('/bems/1.0/notice/notReadCount', null, {
|
|
606
|
+
loading: false,
|
|
607
|
+
noMsg: true
|
|
608
|
+
})
|
|
609
|
+
]).then(([res_1, res_2]) => {
|
|
610
|
+
this.noticeNum = (res_1.data.data || 0) + (res_2.data || 0)
|
|
611
|
+
})
|
|
612
|
+
|
|
613
|
+
this.getNNumTimeOut = setTimeout(this.loopGetNNum, 1000 * 60 * 3)
|
|
614
|
+
}
|
|
555
615
|
}
|
|
556
616
|
}
|
|
557
617
|
}
|
|
@@ -81,12 +81,6 @@ export default {
|
|
|
81
81
|
return `【${msgT}】${item.title}`
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
|
-
props: {
|
|
85
|
-
num: {
|
|
86
|
-
type: Number,
|
|
87
|
-
default: 0
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
84
|
data() {
|
|
91
85
|
return {
|
|
92
86
|
showKey: 0,
|
|
@@ -102,25 +96,6 @@ export default {
|
|
|
102
96
|
afficheTotal: 0
|
|
103
97
|
}
|
|
104
98
|
},
|
|
105
|
-
computed: {
|
|
106
|
-
numC: {
|
|
107
|
-
get() {
|
|
108
|
-
return this.num
|
|
109
|
-
},
|
|
110
|
-
set(n) {
|
|
111
|
-
this.$emit('update:num', n)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
created() {
|
|
116
|
-
this.getNNum()
|
|
117
|
-
document.addEventListener('visibilitychange', this.getNNum)
|
|
118
|
-
window.addEventListener('message', this.updateNotice)
|
|
119
|
-
},
|
|
120
|
-
beforeDestroy() {
|
|
121
|
-
document.removeEventListener('visibilitychange', this.getNNum)
|
|
122
|
-
window.removeEventListener('message', this.updateNotice)
|
|
123
|
-
},
|
|
124
99
|
methods: {
|
|
125
100
|
show() {
|
|
126
101
|
this.showKey = this.showKey + 1
|
|
@@ -128,30 +103,6 @@ export default {
|
|
|
128
103
|
this.getMsgList()
|
|
129
104
|
this.getAfficheList()
|
|
130
105
|
},
|
|
131
|
-
updateNotice(ev) {
|
|
132
|
-
if (ev.data === 'NstcUpdateNotice') {
|
|
133
|
-
this.getNNum()
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
getNNum() {
|
|
137
|
-
clearTimeout(this.getNNumTimeOut)
|
|
138
|
-
if (!document.hidden) {
|
|
139
|
-
Promise.all([
|
|
140
|
-
axios.get('/bems/wkb/messageCenter/getUnReadTotal/' + this.username, null, { loading: false, noMsg: true }),
|
|
141
|
-
axios.get('/bems/1.0/notice/notReadCount', null, {
|
|
142
|
-
loading: false,
|
|
143
|
-
noMsg: true
|
|
144
|
-
})
|
|
145
|
-
]).then(([res_1, res_2]) => {
|
|
146
|
-
this.noticeNum = res_1.data.data
|
|
147
|
-
this.afficheNum = res_2.data
|
|
148
|
-
|
|
149
|
-
this.numC = this.noticeNum + this.afficheNum
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
this.getNNumTimeOut = setTimeout(this.loopGetNNum, 1000 * 60 * 5)
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
106
|
getMsgList() {
|
|
156
107
|
this.nLd = true
|
|
157
108
|
axios
|
|
@@ -221,25 +172,18 @@ export default {
|
|
|
221
172
|
.then(() => {
|
|
222
173
|
item.readState = '1'
|
|
223
174
|
this.noticeNum = this.noticeNum - 1
|
|
224
|
-
|
|
175
|
+
window.postMessage('NstcUpdateNotice')
|
|
225
176
|
})
|
|
226
177
|
}
|
|
227
178
|
},
|
|
228
179
|
seeDetailsAffiche(item) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}, 500)
|
|
237
|
-
} else {
|
|
238
|
-
this.$router.push({
|
|
239
|
-
path: `/notice/views`,
|
|
240
|
-
query: { ntId: item.ntId, status: '1' }
|
|
241
|
-
})
|
|
242
|
-
}
|
|
180
|
+
this.$router.push({
|
|
181
|
+
path: `/notice/views`,
|
|
182
|
+
query: { ntId: item.ntId, status: '1' }
|
|
183
|
+
})
|
|
184
|
+
setTimeout(function () {
|
|
185
|
+
window.postMessage('NstcUpdateNotice')
|
|
186
|
+
}, 3000)
|
|
243
187
|
},
|
|
244
188
|
readAll() {
|
|
245
189
|
this.$msgboxPor({
|
|
@@ -21,12 +21,12 @@ export default {
|
|
|
21
21
|
numerify({ label, value }, f, w, unit = '') {
|
|
22
22
|
unit = unit ? (unit === true ? $lc('元') : unit) : ''
|
|
23
23
|
if (!w) {
|
|
24
|
-
return numerify(value, f) + unit
|
|
24
|
+
return numerify(value, f, Math.floor) + unit
|
|
25
25
|
} else {
|
|
26
26
|
if (value > n) {
|
|
27
27
|
return numerify(value / n, f) + $lc('万') + unit
|
|
28
28
|
} else {
|
|
29
|
-
return numerify(value, f) + unit
|
|
29
|
+
return numerify(value, f, Math.floor) + unit
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -14,10 +14,10 @@ function tplFn(row, sc, mck, map = {}) {
|
|
|
14
14
|
let type = kA[1]
|
|
15
15
|
switch (type) {
|
|
16
16
|
case 'money':
|
|
17
|
-
str += numerify(row[key], '0,0.00')
|
|
17
|
+
str += numerify(row[key], '0,0.00', Math.floor)
|
|
18
18
|
break
|
|
19
19
|
case 'rate':
|
|
20
|
-
str += numerify(row[key], '0.000000')
|
|
20
|
+
str += numerify(row[key], '0.000000', Math.floor)
|
|
21
21
|
break
|
|
22
22
|
case 'map':
|
|
23
23
|
str += map[row[key]]
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import './utils/importGlobal.js' // 联合加载组件保存位置
|
|
2
1
|
import './utils/storagePro.js' // 扩展Storage
|
|
3
2
|
/** 提供组件给外部使用的入口 */
|
|
4
3
|
import ContentLoading from './components/ContentLoading/index.vue'
|
|
@@ -87,7 +86,10 @@ import VHas from './directives/VHas/index.js'
|
|
|
87
86
|
|
|
88
87
|
/** 注入方法 */
|
|
89
88
|
import dayjs from 'dayjs'
|
|
90
|
-
import
|
|
89
|
+
import _numerify from 'numerify'
|
|
90
|
+
function numerify(input, formatType, roundingFunction) {
|
|
91
|
+
return _numerify(input, formatType, roundingFunction || Math.floor)
|
|
92
|
+
}
|
|
91
93
|
import axios from './utils/axios.js'
|
|
92
94
|
import auth from './utils/auth.js'
|
|
93
95
|
import { msgPor, msgboxPor } from './utils/msgboxPor.js'
|
|
@@ -100,6 +102,8 @@ import list2tree from './utils/list2tree'
|
|
|
100
102
|
import { has as isHas } from './directives/VHas/index.js'
|
|
101
103
|
import { hasG as isHasG } from './directives/VHas/index.js'
|
|
102
104
|
import asyncGetRelaNos from './utils/asyncGetRelaNos.js'
|
|
105
|
+
import importG from './utils/importGlobal.js' // 联合加载组件保存位置
|
|
106
|
+
import N from './utils/numberPor.js' // 扩展Number
|
|
103
107
|
|
|
104
108
|
/** 国际化 */
|
|
105
109
|
import i18n, { $l } from './utils/i18n'
|
|
@@ -220,7 +224,8 @@ export {
|
|
|
220
224
|
// 方法
|
|
221
225
|
auth,
|
|
222
226
|
axios,
|
|
223
|
-
|
|
227
|
+
$l,
|
|
228
|
+
N,
|
|
224
229
|
downloadBlob,
|
|
225
230
|
forEachs,
|
|
226
231
|
list2tree,
|
|
@@ -233,7 +238,8 @@ export {
|
|
|
233
238
|
dayjs,
|
|
234
239
|
numerify,
|
|
235
240
|
asyncGetRelaNos,
|
|
236
|
-
|
|
241
|
+
getJsonc,
|
|
242
|
+
importG,
|
|
237
243
|
// 组件
|
|
238
244
|
ContentLoading,
|
|
239
245
|
ContentNull,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
methods: {
|
|
3
|
+
dispatch(componentName, eventName, params) {
|
|
4
|
+
var parent = this.$parent || this.$root
|
|
5
|
+
var name = parent.$options.componentName
|
|
6
|
+
|
|
7
|
+
while (parent && (!name || name !== componentName)) {
|
|
8
|
+
parent = parent.$parent
|
|
9
|
+
|
|
10
|
+
if (parent) {
|
|
11
|
+
name = parent.$options.componentName
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (parent) {
|
|
15
|
+
parent.$emit.apply(parent, [eventName].concat(params))
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/* eslint-disable no-extend-native */
|
|
2
|
+
let i = 1
|
|
3
|
+
|
|
4
|
+
// 去括号
|
|
5
|
+
const splitPts = function (obj) {
|
|
6
|
+
let mc = obj.mEl.match(/\([^()]+\)/g)
|
|
7
|
+
if (mc) {
|
|
8
|
+
mc.forEach((m) => {
|
|
9
|
+
let vk = 'El' + i++
|
|
10
|
+
obj.Els[vk] = m.replace(/\(|\)/g, '')
|
|
11
|
+
obj.mEl = obj.mEl.replace(m, vk)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
return splitPts(obj)
|
|
15
|
+
} else {
|
|
16
|
+
return obj
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// 负数转括号
|
|
20
|
+
const negToPts = function (Els, k) {
|
|
21
|
+
if (/\+-/.test(Els[k])) {
|
|
22
|
+
Els[k] = Els[k].replace(/\+-/, '-')
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (/--/.test(Els[k])) {
|
|
26
|
+
Els[k] = Els[k].replace(/--/, '+')
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (/\*-/.test(Els[k])) {
|
|
30
|
+
let mc = Els[k].match(/\*-[^+|-|*|/]+/g)
|
|
31
|
+
if (mc) {
|
|
32
|
+
mc.forEach((m) => {
|
|
33
|
+
let vk = 'El' + i++
|
|
34
|
+
Els[vk] = m.replace('*', '0')
|
|
35
|
+
Els[k] = Els[k].replace(m, '*' + vk)
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (/\/-/.test(Els[k])) {
|
|
41
|
+
let mc = Els[k].match(/\/-[^+|-|*|/]+/g)
|
|
42
|
+
if (mc) {
|
|
43
|
+
mc.forEach((m) => {
|
|
44
|
+
let vk = 'El' + i++
|
|
45
|
+
Els[vk] = m.replace('/', '0')
|
|
46
|
+
Els[k] = Els[k].replace(m, '/' + vk)
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// 乘除转括号
|
|
52
|
+
const muldivToPts = function (Els, k) {
|
|
53
|
+
if (/\*|\//.test(Els[k]) && /\+|-/.test(Els[k])) {
|
|
54
|
+
let mc = Els[k].match(/[^+|-]*[*|/][^+|-]*/g)
|
|
55
|
+
if (mc) {
|
|
56
|
+
mc.forEach((m) => {
|
|
57
|
+
let vk = 'El' + i++
|
|
58
|
+
Els[vk] = m.replace(/\(|\)/g, '')
|
|
59
|
+
Els[k] = Els[k].replace(m, vk)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// 符号切割运算
|
|
65
|
+
const splitSmb = function (Els) {
|
|
66
|
+
for (let k in Els) {
|
|
67
|
+
Els[k + 'O'] = Els[k]
|
|
68
|
+
Els[k] = Els[k].replace(/\+|-|\*|\//g, (v) => ',' + v + ',')
|
|
69
|
+
Els[k] = Els[k].split(',')
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const compute = function (Els, k, fc) {
|
|
74
|
+
let El = Els[k]
|
|
75
|
+
El.forEach((e, i) => {
|
|
76
|
+
if (/^El/.test(e)) {
|
|
77
|
+
El[i] = compute(Els, e, fc)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
let L = El.length
|
|
82
|
+
let Val = Number(El[0])
|
|
83
|
+
for (let i = 1; i < L; i) {
|
|
84
|
+
if (['+', '-', '*', '/'].includes(El[i])) {
|
|
85
|
+
switch (El[i]) {
|
|
86
|
+
case '+':
|
|
87
|
+
Val = add(Val, Number(El[i + 1]), fc)
|
|
88
|
+
break
|
|
89
|
+
case '-':
|
|
90
|
+
Val = sub(Val, Number(El[i + 1]), fc)
|
|
91
|
+
break
|
|
92
|
+
case '*':
|
|
93
|
+
Val = mul(Val, Number(El[i + 1]), fc)
|
|
94
|
+
break
|
|
95
|
+
case '/':
|
|
96
|
+
Val = div(Val, Number(El[i + 1]), fc)
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
i += 2
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return Val
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function nFloor(n, f) {
|
|
106
|
+
return Number(subFixed(n, f))
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function add(m, n, decimal = 10) {
|
|
110
|
+
if (decimal) {
|
|
111
|
+
return nFloor(nFloor(m, decimal) + nFloor(n, decimal), decimal)
|
|
112
|
+
} else {
|
|
113
|
+
return m + n
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export function sub(m, n, decimal = 10) {
|
|
117
|
+
if (decimal) {
|
|
118
|
+
return nFloor(nFloor(m, decimal) - nFloor(n, decimal), decimal)
|
|
119
|
+
} else {
|
|
120
|
+
return m - n
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export function mul(m, n, decimal = 10) {
|
|
124
|
+
if (decimal) {
|
|
125
|
+
return nFloor(nFloor(m, decimal) * nFloor(n, decimal), decimal)
|
|
126
|
+
} else {
|
|
127
|
+
return m * n
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
export function div(m, n, decimal = 10) {
|
|
131
|
+
if (decimal) {
|
|
132
|
+
return nFloor(nFloor(m, decimal) / nFloor(n, decimal), decimal)
|
|
133
|
+
} else {
|
|
134
|
+
return m / n
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @param {string} [evalStr='']
|
|
140
|
+
* @param {number} [decimal=10]
|
|
141
|
+
* @param {number} proceDecimal
|
|
142
|
+
* @return {number}
|
|
143
|
+
*/
|
|
144
|
+
export function evaluate(evalStr = '', decimal = 10, proceDecimal) {
|
|
145
|
+
if (decimal) {
|
|
146
|
+
i = 1
|
|
147
|
+
let obj = { mEl: evalStr.replace(/\s/g, ''), Els: {} }
|
|
148
|
+
|
|
149
|
+
splitPts(obj)
|
|
150
|
+
|
|
151
|
+
let Els = obj.Els
|
|
152
|
+
Els['Elm'] = obj.mEl
|
|
153
|
+
obj = undefined
|
|
154
|
+
|
|
155
|
+
negToPts(Els, 'Elm')
|
|
156
|
+
for (let k in Els) {
|
|
157
|
+
k !== 'Elm' && negToPts(Els, k)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
muldivToPts(Els, 'Elm')
|
|
161
|
+
for (let k in Els) {
|
|
162
|
+
k !== 'Elm' && muldivToPts(Els, k)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
splitSmb(Els)
|
|
166
|
+
|
|
167
|
+
let RES = compute(Els, 'Elm', proceDecimal || decimal)
|
|
168
|
+
RES = nFloor(RES, decimal)
|
|
169
|
+
return RES
|
|
170
|
+
} else {
|
|
171
|
+
// eslint-disable-next-line no-eval
|
|
172
|
+
eval('window._number_eval_res=' + evalStr)
|
|
173
|
+
let RES = window._number_eval_res
|
|
174
|
+
delete window._number_eval_res
|
|
175
|
+
return RES
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @param {number}
|
|
180
|
+
* @return {string}
|
|
181
|
+
*/
|
|
182
|
+
export const subFixed = function (n, decimal = 6) {
|
|
183
|
+
let res = ''
|
|
184
|
+
if (n === undefined || n === null || n === '') return ''
|
|
185
|
+
let ns = toString(n)
|
|
186
|
+
if (isNaN(ns)) return ''
|
|
187
|
+
|
|
188
|
+
let nss = ns.split('.')
|
|
189
|
+
let intC = nss[0] || '0'
|
|
190
|
+
let floatC = nss[1] || ''
|
|
191
|
+
if (decimal > 0) {
|
|
192
|
+
let floatCn = ''
|
|
193
|
+
for (let i = 0; i < decimal; i++) {
|
|
194
|
+
let fIs = floatC[i] || '0'
|
|
195
|
+
floatCn = floatCn + fIs
|
|
196
|
+
}
|
|
197
|
+
res = intC + '.' + floatCn
|
|
198
|
+
} else {
|
|
199
|
+
res = intC
|
|
200
|
+
}
|
|
201
|
+
return res
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @param {number}
|
|
205
|
+
* @return {string}
|
|
206
|
+
*/
|
|
207
|
+
export const addThousands = function (n) {
|
|
208
|
+
let res = ''
|
|
209
|
+
if (n === undefined || n === null || n === '') {
|
|
210
|
+
return res
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
let ns = toString(n)
|
|
214
|
+
|
|
215
|
+
let intC = ''
|
|
216
|
+
let floatC = ''
|
|
217
|
+
let nss = ns.split('.')
|
|
218
|
+
if (nss.length === 2) {
|
|
219
|
+
intC = nss[0] || '0'
|
|
220
|
+
floatC = nss[1] || ''
|
|
221
|
+
} else {
|
|
222
|
+
intC = ns
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
let L = intC.length
|
|
226
|
+
let intT = ''
|
|
227
|
+
for (let i = 1; i <= L; i++) {
|
|
228
|
+
intT = intC[L - i] + intT
|
|
229
|
+
if (i % 3 === 0 && i !== L) {
|
|
230
|
+
intT = ',' + intT
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (floatC) {
|
|
234
|
+
res = intT + '.' + floatC
|
|
235
|
+
} else {
|
|
236
|
+
res = intT
|
|
237
|
+
}
|
|
238
|
+
return res
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export const toString = function (n) {
|
|
242
|
+
let ns = n
|
|
243
|
+
if (typeof n === 'number') {
|
|
244
|
+
ns = n.toString()
|
|
245
|
+
if (ns.includes('e+')) {
|
|
246
|
+
ns = n.toLocaleString().replace(/,/g, '')
|
|
247
|
+
}
|
|
248
|
+
} else if (typeof n === 'string') {
|
|
249
|
+
ns = n.replace(/,/g, '').trim()
|
|
250
|
+
}
|
|
251
|
+
return ns
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function N(val) {
|
|
255
|
+
if (typeof val === 'string') {
|
|
256
|
+
val = val.replace(/,/g, '').trim()
|
|
257
|
+
}
|
|
258
|
+
if (val === undefined || val === null || val === '') {
|
|
259
|
+
return NaN
|
|
260
|
+
} else {
|
|
261
|
+
return Number(val)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
N.add = add
|
|
265
|
+
N.sub = sub
|
|
266
|
+
N.mul = mul
|
|
267
|
+
N.div = div
|
|
268
|
+
N.eval = evaluate
|
|
269
|
+
N.evaluate = evaluate
|
|
270
|
+
N.toString = toString
|
|
271
|
+
N.subFixed = subFixed
|
|
272
|
+
N.addThousands = addThousands
|
|
273
|
+
|
|
274
|
+
export default N
|