n20-common-lib 2.10.19 → 2.10.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.10.19",
3
+ "version": "2.10.21",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -61,7 +61,7 @@
61
61
  :field="item.prop"
62
62
  >
63
63
  <template slot-scope="scope">
64
- <renderer :renderContent="item.render" :scope="scope"></renderer>
64
+ <renderer :render-content="item.render" :scope="scope" />
65
65
  </template>
66
66
  </vxe-column>
67
67
  <vxe-column
@@ -216,6 +216,11 @@ export default {
216
216
  key: 0
217
217
  }
218
218
  },
219
+ computed: {
220
+ _columns() {
221
+ return this.calcColumnWidth(this.columns)
222
+ }
223
+ },
219
224
  watch: {
220
225
  columns() {
221
226
  this.colsKey = this.colsKey + 1
@@ -231,11 +236,6 @@ export default {
231
236
  }
232
237
  }
233
238
  },
234
- computed: {
235
- _columns() {
236
- return this.calcColumnWidth(this.columns)
237
- }
238
- },
239
239
  activated() {
240
240
  this.$refs.vxeTable.loadData(this.data)
241
241
  },
@@ -336,9 +336,7 @@ export default {
336
336
  calcColumnWidth(columns) {
337
337
  columns = XEUtils.clone(columns, true)
338
338
  const wrapperEl = document.querySelector('div#app')
339
- const notHasWidth = columns.filter(
340
- (column) => !column.width && !column.minWidth && column.label !== $lc('操作')
341
- )
339
+ const notHasWidth = columns.filter((column) => !column.width && !column.minWidth && column.label !== $lc('操作'))
342
340
  if (!wrapperEl || notHasWidth.length > 0) {
343
341
  return columns
344
342
  }
@@ -349,7 +347,7 @@ export default {
349
347
  if (column.static && column.label === $lc('操作') && !column.width && !column.minWidth) {
350
348
  column.width = 80
351
349
  }
352
- if (column.type) {
350
+ if (column.type === 'checkbox') {
353
351
  column.width = 80
354
352
  }
355
353
  const width = column.minWidth || column.width
@@ -358,6 +356,7 @@ export default {
358
356
  column['minWidth'] = undefined
359
357
  columnsWidth += column.width
360
358
  })
359
+
361
360
  if (columnsWidth >= windowWidth) return columns
362
361
  return columns.map((column) => {
363
362
  if (!column.type) {
@@ -365,9 +364,11 @@ export default {
365
364
  column['width'] = windowWidth * rate
366
365
  return column
367
366
  }
367
+
368
368
  return column
369
369
  })
370
370
  }
371
+
371
372
  return calc(columns)
372
373
  }
373
374
  }
@@ -34,11 +34,8 @@ async function disposeSign(config, p1, p2, p3) {
34
34
  config = CaMap['SkfSign']
35
35
  }
36
36
 
37
- const path =
38
- typeof config.path === 'function' ? config.path(p3) : config.path
39
- const module = await importG(config.type, () =>
40
- import(`${path}`)
41
- )
37
+ const path = typeof config.path === 'function' ? config.path(p3) : config.path
38
+ const module = await importG(config.type, () => import(`${path}`))
42
39
 
43
40
  if (config.needAvailable) {
44
41
  await new Promise((resolve, reject) => {
@@ -89,29 +86,38 @@ export async function getSign(p1, p2, p3) {
89
86
  * @param {string} dn - 证书DN
90
87
  * @returns {Promise<*>} 证书信息
91
88
  */
92
- export async function getCert(dn) {
93
- const signType = window.sessionStorage.getItem('signType')
94
- const signModules = {
95
- inetSign: { path: './sign.js', method: 'getCertInfo' },
96
- SkfSign: { path: './SkfSign/index.js', method: 'getCertInfo' },
97
- NetSM3: { path: './NetSM3/index.js', method: 'getCertInfo' },
98
- ItrusSign: { path: './Itrus/index.js', method: 'getCert' }
99
- }
100
-
101
- const module = signModules[signType]
102
- if (!module) {
103
- throw new Error('不支持的签名类型')
104
- }
105
-
106
- try {
107
- const { [module.method]: certMethod } = await importG(signType, () =>
108
- import(/*webpackChunkName: "[request]"*/ module.path)
109
- )
110
- return await certMethod(dn)
111
- } catch (error) {
112
- console.error('获取证书失败:', error)
113
- throw error
114
- }
89
+ export function getCert(dn) {
90
+ let signType = window.sessionStorage.getItem('signType')
91
+ return new Promise((resolve, reject) => {
92
+ if (signType === 'inetSign' /* 信安CA */) {
93
+ importG('inetSign', () => import(/*webpackChunkName: "inetSign"*/ './sign.js')).then(({ getCertInfo }) => {
94
+ getCertInfo(dn).then((res) => {
95
+ resolve(res)
96
+ })
97
+ })
98
+ } else if (signType === 'SkfSign') {
99
+ importG('SkfSign', () => import(/*webpackChunkName: "SkfSign"*/ './SkfSign/index.js')).then(({ getCertInfo }) => {
100
+ getCertInfo(dn).then((res) => {
101
+ resolve(res)
102
+ })
103
+ })
104
+ } else if (signType === 'NetSM3') {
105
+ importG('NetSM3', () => import(/*webpackChunkName: "NetSM3"*/ './NetSM3/index.js')).then(({ getCertInfo }) => {
106
+ getCertInfo(dn).then((res) => {
107
+ resolve(res)
108
+ })
109
+ })
110
+ } else if (signType === 'ItrusSign') {
111
+ importG('ItrusSign', () => import(/*webpackChunkName: "ItrusSign"*/ './Itrus/index.js')).then(({ getCert }) => {
112
+ try {
113
+ const itrusGetCert = getCert(dn)
114
+ resolve(itrusGetCert)
115
+ } catch (error) {
116
+ reject()
117
+ }
118
+ })
119
+ }
120
+ })
115
121
  }
116
122
 
117
123
  /**
@@ -120,9 +126,7 @@ export async function getCert(dn) {
120
126
  * @returns {Promise<void>}
121
127
  */
122
128
  export async function updateCert(cspName) {
123
- const { updateCert } = await importG('NetV3', () =>
124
- import(/*webpackChunkName: "NetV3"*/ './NetV3/index.js')
125
- )
129
+ const { updateCert } = await importG('NetV3', () => import(/*webpackChunkName: "NetV3"*/ './NetV3/index.js'))
126
130
  await updateCert(cspName)
127
131
  }
128
132
 
@@ -132,8 +136,6 @@ export async function updateCert(cspName) {
132
136
  * @returns {Promise<void>}
133
137
  */
134
138
  export async function updateCertHG(uno) {
135
- const { updateCertHG } = await importG('NetV3', () =>
136
- import(/*webpackChunkName: "NetV3"*/ './NetV3/index.js')
137
- )
139
+ const { updateCertHG } = await importG('NetV3', () => import(/*webpackChunkName: "NetV3"*/ './NetV3/index.js'))
138
140
  await updateCertHG(uno)
139
141
  }