n20-common-lib 2.22.65 → 2.22.66-patch

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.22.65",
3
+ "version": "2.22.66-patch",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -187,7 +187,9 @@
187
187
  <el-button v-if="showApprovalTo && showApproveTo" type="primary" @click="approvalToV = true"
188
188
  >{{ $lc(btnsNames['approval']) }}{{ '至' | $lc }}</el-button
189
189
  >
190
- <el-button v-if="authList.includes('rejectTo')" plain @click="rejectToB">{{ $lc(btnsNames['rejectTo']) }}</el-button>
190
+ <el-button v-if="authList.includes('rejectTo')" plain @click="rejectToB">{{
191
+ $lc(btnsNames['rejectTo'])
192
+ }}</el-button>
191
193
  <el-button v-if="authList.includes('reject')" plain @click="rejectFn">{{ $lc(btnsNames['reject']) }}</el-button>
192
194
  <el-button v-if="authList.includes('rejectPre')" plain @click="rejectPreFn">{{
193
195
  $lc(btnsNames['rejectPre'])
@@ -341,6 +343,7 @@
341
343
  <script>
342
344
  import selectSpr from './selectSpr.vue'
343
345
  import getJsonc from '../../assets/getJsonc.js'
346
+ import { getServerConfig } from '../../utils/serverConfig'
344
347
  import { closeTagsForBackPage } from '../../plugins/CompatibleOld'
345
348
  import axios from '../../utils/axios'
346
349
  import { $lc } from '../../utils/i18n/index'
@@ -643,7 +646,7 @@ export default {
643
646
  },
644
647
  // 意见是否必填
645
648
  getConfiguration() {
646
- getJsonc('portal/server-config.jsonc', null, true)
649
+ getServerConfig()
647
650
  .then(({ opinionRequired, showApproveTo }) => {
648
651
  this.requiredC = opinionRequired ?? this.required
649
652
  this.showApproveTo = showApproveTo ?? true
@@ -126,7 +126,9 @@
126
126
  </div>
127
127
 
128
128
  <div v-else-if="!authList.includes('byAddTask')" class="text-c">
129
- <div v-if="!approveBtns" style="text-align: center; font-size: 18px">{{ $lc('请点击左上角返回处,进入OA待办页面') }}</div>
129
+ <div v-if="!approveBtns" style="text-align: center; font-size: 18px">
130
+ {{ $lc('请点击左上角返回处,进入OA待办页面') }}
131
+ </div>
130
132
  <!-- 特殊会签按钮 START -->
131
133
  <el-button v-if="authList.includes('pass')" type="primary" @click="checkFlowFn">{{
132
134
  $lc(btnsNames['pass'])
@@ -303,6 +305,7 @@
303
305
  <script>
304
306
  import selectSpr from './selectSpr.vue'
305
307
  import getJsonc from '../../assets/getJsonc.js'
308
+ import { getServerConfig } from '../../utils/serverConfig'
306
309
  import { closeTagsForBackPage } from '../../plugins/CompatibleOld'
307
310
  import axios from '../../utils/axios'
308
311
  import { $lc } from '../../utils/i18n/index'
@@ -554,7 +557,7 @@ export default {
554
557
  },
555
558
  // 意见是否必填
556
559
  getConfiguration() {
557
- getJsonc('portal/server-config.jsonc', null, true)
560
+ getServerConfig()
558
561
  .then(({ opinionRequired }) => {
559
562
  this.requiredC = opinionRequired ?? this.required
560
563
  // 读取该工作流是否意见必填
@@ -860,7 +863,7 @@ export default {
860
863
  if (this.isWyfk) {
861
864
  this.attributes = {
862
865
  appOrPc: '3',
863
- ebsPaymentRiskWarning: $lc("核实无误")
866
+ ebsPaymentRiskWarning: $lc('核实无误')
864
867
  }
865
868
  } else {
866
869
  this.attributes = { appOrPc: '3' }
@@ -61,7 +61,7 @@
61
61
  import expandableWrap from '../Expandable/main.vue'
62
62
  import approvalCard from '../ApprovalCard/index.vue'
63
63
  import approvalImg from './approvalImg.vue'
64
- import getJsonc from '../../assets/getJsonc'
64
+ import { getServerConfig } from '../../utils/serverConfig'
65
65
  export default {
66
66
  name: 'ApprovalRecord',
67
67
  components: {
@@ -100,7 +100,7 @@ export default {
100
100
  }
101
101
  },
102
102
  mounted() {
103
- getJsonc('portal/server-config.jsonc').then(({ approvalMode }) => {
103
+ getServerConfig().then(({ approvalMode }) => {
104
104
  this.approvalMode = approvalMode || 'dialog'
105
105
  })
106
106
  }
@@ -13,7 +13,6 @@
13
13
  <script>
14
14
  import approvalCard from 'n20-common-lib/src/components/ApprovalCard/indexApp.vue'
15
15
  import approvalImg from 'n20-common-lib/src/components/ApprovalRecord/approvalImg.vue'
16
- import getJsonc from 'n20-common-lib/src/assets/getJsonc'
17
16
  export default {
18
17
  name: 'ApprovalRecord',
19
18
  components: {
@@ -46,10 +45,6 @@ export default {
46
45
  return this.procInstId || this.$route.query.processInstanceId
47
46
  }
48
47
  },
49
- mounted() {
50
- /* getJsonc('portal/server-config.jsonc').then(({ approvalMode }) => {
51
- this.approvalMode = approvalMode
52
- }) */
53
- }
48
+ mounted() {}
54
49
  }
55
50
  </script>
@@ -188,7 +188,8 @@
188
188
  </el-table-column>
189
189
  </el-table> -->
190
190
  <div class="flex-box flex-v flex-lr">
191
- <div class="title">{{ $lc('附件上传') }}<span>{{ $lc('(带 * 为必要上传的附件)') }}</span>
191
+ <div class="title">
192
+ {{ $lc('附件上传') }}<span>{{ $lc('(带 * 为必要上传的附件)') }}</span>
192
193
  </div>
193
194
  </div>
194
195
  <div class="file-list">
@@ -313,10 +314,10 @@
313
314
  </template>
314
315
 
315
316
  <script>
316
- import getJsonc from '../../assets/getJsonc.js'
317
317
  import _axios from 'axios'
318
318
  import dayjs from 'dayjs'
319
319
  import XEUtils from 'xe-utils'
320
+ import { getServerConfig } from '../../utils/serverConfig'
320
321
 
321
322
  import 'viewerjs/dist/viewer.css'
322
323
  import auth from '../../utils/auth.js'
@@ -326,7 +327,6 @@ import importG from '../../utils/importGlobal.js'
326
327
  import Dialog from '../Dialog/index.vue'
327
328
  import Upload from '../Upload/index.vue'
328
329
 
329
-
330
330
  const ViewerImg = async function () {
331
331
  let { component } = await importG('v-viewer', () => import(/*webpackChunkName: "v-viewer"*/ 'v-viewer'))
332
332
  return component
@@ -340,9 +340,9 @@ const keysDefault = {
340
340
  user: 'user'
341
341
  }
342
342
  const typeOptionsDefault = [
343
- { type: '001', label: $lc("信贷合同") },
344
- { type: '002', label: $lc("贴现合同") },
345
- { type: '003', label: $lc("其他合同") }
343
+ { type: '001', label: $lc('信贷合同') },
344
+ { type: '002', label: $lc('贴现合同') },
345
+ { type: '003', label: $lc('其他合同') }
346
346
  ]
347
347
 
348
348
  export default {
@@ -499,7 +499,7 @@ export default {
499
499
  return this.dataPorp.fileSize || undefined
500
500
  },
501
501
  fileAcceptTip() {
502
- return this.dataPorp.fileAcceptTip || $lc("支持扩展名:.rar .zip .doc .docx .pdf .jpg...")
502
+ return this.dataPorp.fileAcceptTip || $lc('支持扩展名:.rar .zip .doc .docx .pdf .jpg...')
503
503
  },
504
504
  fileData() {
505
505
  return this.dataPorp.fileData || undefined
@@ -540,7 +540,7 @@ export default {
540
540
  // ai识别
541
541
  async AiFn(row) {
542
542
  if (!this.AIOptions.bussType) {
543
- this.$message.error($lc("请先配置bussType"))
543
+ this.$message.error($lc('请先配置bussType'))
544
544
  return false
545
545
  }
546
546
  const { data, code } = await axios.post(
@@ -582,7 +582,7 @@ export default {
582
582
  }
583
583
  },
584
584
  getConfiguration() {
585
- getJsonc('portal/server-config.jsonc', null, true)
585
+ getServerConfig()
586
586
  .then(({ loginConf, fileRequired }) => {
587
587
  this.fileText = loginConf?.sLogan?.fileText
588
588
  this.fileRequired = fileRequired ?? true
@@ -704,7 +704,7 @@ export default {
704
704
  deleteRows() {
705
705
  if (!this.selectionList.length) {
706
706
  return this.$message({
707
- message: $lc("请先勾选要删除的数据!"),
707
+ message: $lc('请先勾选要删除的数据!'),
708
708
  type: 'warning',
709
709
  showClose: true
710
710
  })
@@ -332,7 +332,7 @@ import XEUtils from 'xe-utils'
332
332
 
333
333
  import aiCheckDialog from './aiCheckDialog.vue'
334
334
 
335
- import getJsonc from '../../assets/getJsonc.js'
335
+ import { getServerConfig } from '../../utils/serverConfig'
336
336
  import auth from '../../utils/auth'
337
337
  import axios from '../../utils/axios'
338
338
  import { $lc } from '../../utils/i18n/index'
@@ -742,7 +742,7 @@ export default {
742
742
  }
743
743
  },
744
744
  getConfiguration() {
745
- getJsonc('portal/server-config.jsonc', null, true)
745
+ getServerConfig()
746
746
  .then(({ loginConf, fileRequired }) => {
747
747
  this.fileText = loginConf?.sLogan?.fileText
748
748
  this.fileRequired = fileRequired ?? true
package/src/utils/auth.js CHANGED
@@ -64,7 +64,7 @@ const auth = {
64
64
  }
65
65
  let token = auth.getToken()
66
66
  let defaultHd = {
67
- Authorization: token ? 'Bearer ' + token : 'Basic TlNUQzpWVkIxVG1sVlVURlNMemxyTkhoc2VtNXdObFJaUVQwOQ==',
67
+ Authorization: token ? 'Bearer ' + token : '',
68
68
  OperationDesc: desc ? encodeURI(desc) : encodeURI(OperationDesc),
69
69
  timestamp: Date.now(),
70
70
  requestKey: Date.now(),
@@ -0,0 +1,77 @@
1
+ import axios from './axios'
2
+ import CryptoJS from 'crypto-js'
3
+
4
+ let configPromise = null
5
+
6
+ // 生成密钥
7
+ const generateKey = () => {
8
+ const now = new Date()
9
+ const year = now.getFullYear()
10
+ const month = String(now.getMonth() + 1).padStart(2, '0')
11
+ const day = String(now.getDate()).padStart(2, '0')
12
+ const dateStr = `${year}${month}${day}`
13
+ const keyStr = dateStr.padEnd(32, '0')
14
+ return keyStr
15
+ }
16
+ /**
17
+ * AES 解密 - 后端返回 Base64 编码的密文和 IV
18
+ * @param ciphertextBase64 Base64编码的密文
19
+ * @param ivBase64 Base64编码的IV
20
+ */
21
+ const decrypt = (ciphertextBase64, ivBase64) => {
22
+ const keyStr = generateKey()
23
+
24
+ const key = CryptoJS.enc.Utf8.parse(keyStr)
25
+ // 后端返回的 IV 是 Base64 编码,需要解码
26
+ const iv = CryptoJS.enc.Base64.parse(ivBase64)
27
+
28
+ // 执行解密(CryptoJS.AES.decrypt 可以直接解析 Base64 密文)
29
+ const decrypted = CryptoJS.AES.decrypt(ciphertextBase64, key, {
30
+ iv: iv,
31
+ mode: CryptoJS.mode.CBC,
32
+ padding: CryptoJS.pad.Pkcs7
33
+ })
34
+ return decrypted.toString(CryptoJS.enc.Utf8)
35
+ }
36
+ /**
37
+ * 获取服务端配置(带缓存)
38
+ * 替代原有的 getJsonc('/server-config.jsonc')
39
+ * 后端接口返回与 server-config.jsonc 一致的 JSON 结构
40
+ * @returns {Promise<Object>} 配置对象
41
+ */
42
+ export function getServerConfig() {
43
+ if (!configPromise) {
44
+ configPromise = axios
45
+ .get('/bems/getPortalServerConfig', null, {
46
+ loading: false,
47
+ noMsg: true
48
+ })
49
+ .then(({ data, code }) => {
50
+ if (code !== 200) return
51
+ // 检查是否有密文数据需要解密
52
+ if (data.ciphertext && data.iv) {
53
+ const decryptedData = decrypt(data.ciphertext, data.iv)
54
+
55
+ // 如果解密成功,解析JSON并合并到列表
56
+ if (decryptedData) {
57
+ return JSON.parse(decryptedData) || {}
58
+ }
59
+ return {}
60
+ }
61
+ return data || {}
62
+ })
63
+ .catch((err) => {
64
+ console.error('获取服务端配置失败:', err)
65
+ // 返回空对象,避免阻塞应用启动
66
+ return {}
67
+ })
68
+ }
69
+ return configPromise
70
+ }
71
+
72
+ /**
73
+ * 清除配置缓存(如需刷新配置时调用)
74
+ */
75
+ export function clearConfigCache() {
76
+ configPromise = null
77
+ }