n20-common-lib 2.8.36 → 2.8.38

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.8.36",
3
+ "version": "2.8.38",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -13,8 +13,10 @@
13
13
 
14
14
  <script>
15
15
  import axios from '../../utils/axios'
16
+ import list2tree from '../../utils/list2tree'
17
+
16
18
  window._china_area_tree_ = undefined
17
- import cloneDeep from 'lodash/cloneDeep'
19
+
18
20
  export default {
19
21
  name: 'CascaderArea',
20
22
  props: {
@@ -30,15 +32,10 @@ export default {
30
32
  type: Boolean,
31
33
  default: true
32
34
  },
33
-
34
35
  isUrban: {
35
36
  type: Boolean,
36
37
  default: false
37
38
  },
38
- isStreet: {
39
- type: Boolean,
40
- default: false
41
- },
42
39
  labelSort: {
43
40
  type: Boolean,
44
41
  default: false
@@ -63,8 +60,7 @@ export default {
63
60
  value: 'regionNo',
64
61
  label: 'regionName',
65
62
  children: 'children',
66
- expandTrigger: 'hover',
67
- checkStrictly: this.isUrban ? false : true
63
+ expandTrigger: 'hover'
68
64
  }
69
65
  return Object.assign(_prop, this.props)
70
66
  },
@@ -73,44 +69,46 @@ export default {
73
69
  },
74
70
  urbanKey() {
75
71
  return this.countryId === 'CHN' ? '_china_urban_tree_' : `_${this.countryId}_urban_tree_`
76
- },
77
- streetKey() {
78
- return this.countryId === 'CHN' ? '_china_street_tree_' : `_${this.countryId}_street_tree_`
79
72
  }
80
73
  },
81
74
  mounted() {
82
75
  if (!window[this.areaKey]) {
83
76
  this.getAreaTree()
84
77
  } else {
85
- this.areaTree = this.isUrban
86
- ? window[this.urbanKey]
87
- : this.isStreet
88
- ? window[this.streetKey]
89
- : window[this.areaKey]
78
+ this.areaTree = this.isUrban ? window[this.urbanKey] : window[this.areaKey]
90
79
  }
91
80
  },
92
81
  methods: {
93
82
  getAreaTree() {
94
83
  axios
95
- .get(
96
- `/bems/1.0/area?t=${Math.random()}`,
97
- { countryId: this.countryId, isEnable: '1', resultType: 2, queryLeave4: this.isStreet },
98
- { loading: false, noMsg: true }
99
- )
84
+ .get('/bems/1.0/area', { countryId: this.countryId, isEnable: '1' }, { loading: false, noMsg: true })
100
85
  .then(({ data }) => {
101
- if (data) {
102
- let result = cloneDeep(data)
103
- if (this.isUrban) {
104
- window[this.urbanKey] = isUrbanFn(result)
105
- this.areaTree = window[this.urbanKey]
106
- } else if (this.isStreet) {
107
- window[this.streetKey] = treeFn(result)
108
- this.areaTree = window[this.streetKey]
109
- } else {
110
- window[this.areaKey] = treeFn(result)
111
- this.areaTree = window[this.areaKey]
112
- }
86
+ let dataAr = JSON.parse(JSON.stringify(data))
87
+ let dataUb = JSON.parse(JSON.stringify(data))
88
+
89
+ let areaTree = list2tree(
90
+ dataAr,
91
+ 'regionNo',
92
+ 'fatherNo',
93
+ 'children',
94
+ this.labelSort ? 'regionName' : 'regionNo'
95
+ )
96
+ let noAreaTree = areaTree.filter((a) => a.regionLevel !== '1')
97
+ if (noAreaTree.length > 0) {
98
+ console.warn('这些区域找不到父级节点:', noAreaTree)
113
99
  }
100
+ window[this.areaKey] = areaTree.filter((a) => a.regionLevel === '1')
101
+
102
+ let urbanTree = list2tree(
103
+ dataUb.filter((d) => d.regionLevel !== '3'),
104
+ 'regionNo',
105
+ 'fatherNo',
106
+ 'children',
107
+ this.labelSort ? 'regionName' : 'regionNo'
108
+ )
109
+
110
+ window[this.urbanKey] = urbanTree.filter((a) => a.regionLevel === '1')
111
+ this.areaTree = this.isUrban ? window[this.urbanKey] : window[this.areaKey]
114
112
  })
115
113
  },
116
114
  updateArea() {
@@ -118,30 +116,4 @@ export default {
118
116
  }
119
117
  }
120
118
  }
121
-
122
- const treeFn = (data) => {
123
- return data?.map((res) => {
124
- if (!['3', '4', '5'].includes(res.regionLevel)) {
125
- res.disabled = true
126
- }
127
-
128
- if (!res.children?.length) {
129
- res.children = null
130
- } else {
131
- res.children = treeFn(res.children)
132
- }
133
- return res
134
- })
135
- }
136
-
137
- const isUrbanFn = (data) => {
138
- return data?.map((res) => {
139
- if (res.regionLevel === '2') {
140
- res.children = null
141
- } else {
142
- res.children = isUrbanFn(res.children)
143
- }
144
- return res
145
- })
146
- }
147
119
  </script>
@@ -2503,13 +2503,14 @@ const config = {
2503
2503
 
2504
2504
  function init() {
2505
2505
  let url = window.NetSignName || `/portal/天诚安信数字证书助手-3.7.7.0.exe`
2506
+ let name = window.NetSignDownloadName || '天诚安信数字证书助手'
2506
2507
  try {
2507
2508
  TCA.config(config)
2508
2509
  } catch (error) {
2509
2510
  Notification({
2510
2511
  title: '提示',
2511
2512
  dangerouslyUseHTMLString: true,
2512
- message: `<div>检测到您的电脑中没有安装签名助手,为了不影响使用请使用管理员权限<a class="color-primary" href="${url}" download>下载安装</a>天诚安信数字证书助手</div>`,
2513
+ message: `<div>检测到您的电脑中没有安装签名助手,为了不影响使用请使用管理员权限<a class="color-primary" href="${url}" download>下载安装</a>${name}</div>`,
2513
2514
  duration: 5000
2514
2515
  })
2515
2516
  }
@@ -41,6 +41,7 @@ export function availableSign(fn, url) {
41
41
  }
42
42
 
43
43
  function checkAvailable(fn, url, count) {
44
+ let name = window.NetSignDownloadName || 'NetSignCNG签名助手'
44
45
  let available = IWSAGetAvailable()
45
46
  if (available) {
46
47
  fn && fn(available)
@@ -49,7 +50,7 @@ function checkAvailable(fn, url, count) {
49
50
  Notification({
50
51
  title: '提示',
51
52
  dangerouslyUseHTMLString: true,
52
- message: `<div>检测到您的电脑中没有安装签名助手,为了不影响使用请使用管理员权限<a class="color-primary" href="${url}" download>下载安装</a>NetSignCNG签名助手</div>`,
53
+ message: `<div>检测到您的电脑中没有安装签名助手,为了不影响使用请使用管理员权限<a class="color-primary" href="${url}" download>下载安装</a>${name}</div>`,
53
54
  duration: 5000
54
55
  })
55
56
  } else {
@@ -42,6 +42,7 @@ export function availableSign(fn, url) {
42
42
 
43
43
  function checkAvailable(fn, url, count) {
44
44
  available = IWSAGetAvailable()
45
+ let name = window.NetSignDownloadName || 'NetSignCNG签名助手'
45
46
  if (available) {
46
47
  fn && fn(available)
47
48
  } else if (count == 10) {
@@ -49,7 +50,7 @@ function checkAvailable(fn, url, count) {
49
50
  Notification({
50
51
  title: '提示',
51
52
  dangerouslyUseHTMLString: true,
52
- message: `<div>检测到您的电脑中没有安装签名助手,为了不影响使用请使用管理员权限<a class="color-primary" href="${url}" download>下载安装</a>NetSignCNG签名助手</div>`,
53
+ message: `<div>检测到您的电脑中没有安装签名助手,为了不影响使用请使用管理员权限<a class="color-primary" href="${url}" download>下载安装</a>${name}</div>`,
53
54
  duration: 5000
54
55
  })
55
56
  } else {
@@ -35,6 +35,7 @@ export function availableSign(fn, url) {
35
35
  }
36
36
 
37
37
  function checkAvailable(fn, url, count) {
38
+ let name = window.NetSignDownloadName || 'NetSignCNG签名助手'
38
39
  let available = IWSAGetAvailable()
39
40
  if (available) {
40
41
  fn && fn(available)
@@ -43,7 +44,7 @@ function checkAvailable(fn, url, count) {
43
44
  Notification({
44
45
  title: '提示',
45
46
  dangerouslyUseHTMLString: true,
46
- message: `<div>检测到您的电脑中没有安装签名助手,为了不影响使用请使用管理员权限<a class="color-primary" href="${url}" download>下载安装</a>NetSignCNG签名助手</div>`,
47
+ message: `<div>检测到您的电脑中没有安装签名助手,为了不影响使用请使用管理员权限<a class="color-primary" href="${url}" download>下载安装</a>${name}</div>`,
47
48
  duration: 5000
48
49
  })
49
50
  } else {