n20-common-lib 2.1.24 → 2.1.26
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
CHANGED
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
@keydown.native="stepFn"
|
|
17
17
|
>
|
|
18
18
|
<template v-if="type === 'rate'">
|
|
19
|
-
<span v-if="
|
|
20
|
-
suffix
|
|
21
|
-
}}</span>
|
|
19
|
+
<span v-if="suffixV" slot="suffix" class="el-input__icon">{{ suffix }}</span>
|
|
22
20
|
</template>
|
|
23
21
|
</el-input>
|
|
24
22
|
</div>
|
|
@@ -99,6 +97,12 @@ export default {
|
|
|
99
97
|
}
|
|
100
98
|
},
|
|
101
99
|
computed: {
|
|
100
|
+
suffixV() {
|
|
101
|
+
if (!this.isClearable) return true
|
|
102
|
+
if (!this.valueStr) return true
|
|
103
|
+
if (!(this.isHove || this.isFocus)) return true
|
|
104
|
+
return false
|
|
105
|
+
},
|
|
102
106
|
phd() {
|
|
103
107
|
if (this.placeholder) {
|
|
104
108
|
return this.placeholder
|
|
@@ -106,7 +106,9 @@ export default {
|
|
|
106
106
|
},
|
|
107
107
|
computed: {
|
|
108
108
|
activeNavC() {
|
|
109
|
-
|
|
109
|
+
let acTab = this.tabList.find((t) => t.uuid === this.activeNav)
|
|
110
|
+
let acNav = acTab?.query?.startPath || this.activeNav
|
|
111
|
+
return getShowUuid(acNav, this.menuList)
|
|
110
112
|
}
|
|
111
113
|
},
|
|
112
114
|
watch: {
|
|
@@ -406,11 +408,11 @@ export default {
|
|
|
406
408
|
this.updateK = ''
|
|
407
409
|
})
|
|
408
410
|
} else {
|
|
409
|
-
window.postMessage({
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
})
|
|
411
|
+
// window.postMessage({
|
|
412
|
+
// updateActiveCache: true,
|
|
413
|
+
// targetName: '*',
|
|
414
|
+
// originName: 'main'
|
|
415
|
+
// })
|
|
414
416
|
this.CompatibleUpdateCache(tab.route) // 兼容旧的子模块清除缓存
|
|
415
417
|
}
|
|
416
418
|
}
|
package/src/index.js
CHANGED
|
@@ -95,8 +95,8 @@ import auth from './utils/auth.js'
|
|
|
95
95
|
import { msgPor, msgboxPor } from './utils/msgboxPor.js'
|
|
96
96
|
import getJsonc from './assets/getJsonc.js'
|
|
97
97
|
import downloadBlob from './utils/downloadBlob.js'
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
98
|
+
import { setTabs } from './utils/handleTab.js'
|
|
99
|
+
import { linkPush, linkGo, closeTab } from './utils/urlToGo'
|
|
100
100
|
import forEachs from './utils/forEachs'
|
|
101
101
|
import list2tree from './utils/list2tree'
|
|
102
102
|
import { has as isHas } from './directives/VHas/index.js'
|
|
@@ -219,6 +219,7 @@ export default {
|
|
|
219
219
|
version,
|
|
220
220
|
install
|
|
221
221
|
}
|
|
222
|
+
const linkClose = closeTab
|
|
222
223
|
export {
|
|
223
224
|
version,
|
|
224
225
|
// 方法
|
|
@@ -230,9 +231,13 @@ export {
|
|
|
230
231
|
forEachs,
|
|
231
232
|
list2tree,
|
|
232
233
|
repairEl,
|
|
234
|
+
// 页签/路由
|
|
235
|
+
setTabs,
|
|
236
|
+
closeTab,
|
|
233
237
|
linkPush,
|
|
234
238
|
linkGo,
|
|
235
239
|
linkClose,
|
|
240
|
+
// 权限
|
|
236
241
|
isHas,
|
|
237
242
|
isHasG,
|
|
238
243
|
dayjs,
|
package/src/utils/numberPor.js
CHANGED
|
@@ -176,7 +176,9 @@ export function evaluate(evalStr = '', decimal = 10, proceDecimal) {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
*
|
|
179
|
+
* 将数字或字符串截取为指定的小数位
|
|
180
|
+
* @param {number|string} n
|
|
181
|
+
* @param {number} [decimal=10]
|
|
180
182
|
* @return {string}
|
|
181
183
|
*/
|
|
182
184
|
export const subFixed = function (n, decimal = 6) {
|
|
@@ -185,9 +187,7 @@ export const subFixed = function (n, decimal = 6) {
|
|
|
185
187
|
let ns = toString(n)
|
|
186
188
|
if (isNaN(ns)) return ''
|
|
187
189
|
|
|
188
|
-
let
|
|
189
|
-
let intC = nss[0] || '0'
|
|
190
|
-
let floatC = nss[1] || ''
|
|
190
|
+
let [intC = '0', floatC = ''] = ns.split('.')
|
|
191
191
|
if (decimal > 0) {
|
|
192
192
|
let floatCn = ''
|
|
193
193
|
for (let i = 0; i < decimal; i++) {
|
|
@@ -201,54 +201,58 @@ export const subFixed = function (n, decimal = 6) {
|
|
|
201
201
|
return res
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
|
-
*
|
|
205
|
-
* @
|
|
204
|
+
* 将数字或字符串格式的数字转换为千位分隔符格式的字符串
|
|
205
|
+
* @param {number|string} number - 待转换的数字或字符串格式的数字
|
|
206
|
+
* @returns {string} 转换后的千位分隔符格式的字符串
|
|
206
207
|
*/
|
|
207
|
-
export const addThousands = function (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
let
|
|
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 = ''
|
|
208
|
+
export const addThousands = function (number) {
|
|
209
|
+
if (number === undefined || number === null || number === '') return ''
|
|
210
|
+
let stringifiedNumber = toString(number)
|
|
211
|
+
// 分离整数部分和小数部分
|
|
212
|
+
let [integerPart = '0', decimalPart = ''] = stringifiedNumber.split('.')
|
|
213
|
+
// 遍历整数部分,每隔三位添加一个逗号
|
|
214
|
+
let L = integerPart.length
|
|
215
|
+
let integerPartWithCommas = ''
|
|
227
216
|
for (let i = 1; i <= L; i++) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
217
|
+
if (i > 1 && i % 3 === 1) {
|
|
218
|
+
integerPartWithCommas = integerPart[L - i] + ',' + integerPartWithCommas
|
|
219
|
+
} else {
|
|
220
|
+
integerPartWithCommas = integerPart[L - i] + integerPartWithCommas
|
|
231
221
|
}
|
|
232
222
|
}
|
|
233
|
-
|
|
234
|
-
res = intT + '.' + floatC
|
|
235
|
-
} else {
|
|
236
|
-
res = intT
|
|
237
|
-
}
|
|
238
|
-
return res
|
|
239
|
-
}
|
|
223
|
+
integerPartWithCommas = integerPartWithCommas.replace(/^-,/, '-')
|
|
240
224
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
225
|
+
// 如果存在小数部分,将整数部分和小数部分用小数点连接起来,否则只返回整数部分
|
|
226
|
+
const formattedNumber = decimalPart ? integerPartWithCommas + '.' + decimalPart : integerPartWithCommas
|
|
227
|
+
return formattedNumber
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* 将数字或科学技术法的数字转换字符串
|
|
231
|
+
* @param {number|string} notation - 待转换的数字或字符串格式的数字
|
|
232
|
+
* @returns {string} 转换后的字符串
|
|
233
|
+
*/
|
|
234
|
+
export const toString = function (notation) {
|
|
235
|
+
let number = notation
|
|
236
|
+
if (typeof notation === 'string') {
|
|
237
|
+
// 如果输入是字符串,则去除逗号和空格
|
|
238
|
+
number = notation.replace(/,/g, '').trim()
|
|
239
|
+
} else if (typeof notation === 'number' && notation.toString().includes('e')) {
|
|
240
|
+
// 如果输入是科学计数法表示的数字
|
|
241
|
+
let [coefficient, exponent] = notation.toString().split('e')
|
|
242
|
+
let decimalIndex = coefficient.indexOf('.')
|
|
243
|
+
if (decimalIndex !== -1) exponent -= coefficient.length - 1 - decimalIndex
|
|
244
|
+
// 找到小数点位置,计算指数大小
|
|
245
|
+
if (exponent >= 0) {
|
|
246
|
+
// 如果指数大于等于0,将小数点移动到末尾
|
|
247
|
+
number = coefficient.replace('.', '') + '0'.repeat(exponent)
|
|
248
|
+
} else {
|
|
249
|
+
// 如果指数小于0,将小数点移动到前面
|
|
250
|
+
const absoluteExponent = Math.abs(exponent) - 1
|
|
251
|
+
const zeros = '0'.repeat(absoluteExponent)
|
|
252
|
+
number = (coefficient.indexOf('-') === 0 ? '-0.' : '0.') + zeros + coefficient.replace(/-|\./g, '')
|
|
247
253
|
}
|
|
248
|
-
} else if (typeof n === 'string') {
|
|
249
|
-
ns = n.replace(/,/g, '').trim()
|
|
250
254
|
}
|
|
251
|
-
return
|
|
255
|
+
return number.toString()
|
|
252
256
|
}
|
|
253
257
|
|
|
254
258
|
function N(val) {
|
package/src/utils/urlToGo.js
CHANGED
|
@@ -59,7 +59,7 @@ export function linkPush(url = '', query = {}, $router) {
|
|
|
59
59
|
query._fromNo = Date.now()
|
|
60
60
|
sessionStorage.setItem(query._fromNo, location.href)
|
|
61
61
|
// 如果提供vue-router
|
|
62
|
-
if (
|
|
62
|
+
if (process.env.NODE_ENV === 'development' && $router?.push) {
|
|
63
63
|
let base = $router.options.base || ''
|
|
64
64
|
base = base.replace(/\/$/, '')
|
|
65
65
|
base = new RegExp('^' + base)
|
|
@@ -89,7 +89,7 @@ export function linkGo(N = -1, $router) {
|
|
|
89
89
|
|
|
90
90
|
if (_fromUrl) {
|
|
91
91
|
// 如果提供vue-router
|
|
92
|
-
if (
|
|
92
|
+
if (process.env.NODE_ENV === 'development' && $router?.push) {
|
|
93
93
|
let base = $router.options.base || ''
|
|
94
94
|
base = base.replace(/\/$/, '')
|
|
95
95
|
base = new RegExp('^' + base)
|
|
@@ -107,3 +107,16 @@ export function linkGo(N = -1, $router) {
|
|
|
107
107
|
window.history.go(N)
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
import { closeTab as _closeTab } from './handleTab.js'
|
|
112
|
+
export function closeTab(url, $router) {
|
|
113
|
+
let path = url || window.location.pathname
|
|
114
|
+
if (process.env.NODE_ENV === 'development' && $router?.options) {
|
|
115
|
+
let base = $router.options.base || ''
|
|
116
|
+
base = base.replace(/\/$/, '')
|
|
117
|
+
base = new RegExp('^' + base)
|
|
118
|
+
_closeTab({ path: path.replace(base, '') }, '*')
|
|
119
|
+
} else {
|
|
120
|
+
_closeTab({ path: path }, '*')
|
|
121
|
+
}
|
|
122
|
+
}
|