n20-common-lib 1.3.45 → 1.3.48

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.
@@ -5,7 +5,11 @@
5
5
  <div class="uploadfiletip">
6
6
  <div>附件信息</div>
7
7
  <div>
8
- <el-button type="primary" size="small" @click="createRow"
8
+ <el-button
9
+ v-if="viewMode"
10
+ type="primary"
11
+ size="small"
12
+ @click="createRow"
9
13
  >新增</el-button
10
14
  >
11
15
  <el-button size="small" plain @click="batchload">下载</el-button>
@@ -26,6 +30,7 @@
26
30
  <el-table-column label="附件类型">
27
31
  <template slot-scope="scope">
28
32
  <el-select
33
+ v-if="scope.row.updateType != 0"
29
34
  v-model="scope.row.attnoadd"
30
35
  placeholder="请选择"
31
36
  size="small"
@@ -38,22 +43,25 @@
38
43
  :value="item.attno"
39
44
  />
40
45
  </el-select>
46
+ <span v-if="scope.row.updateType === 0">{{ scope.row.attname }}</span>
41
47
  </template>
42
48
  </el-table-column>
43
49
  <el-table-column label="附件名称" width="200">
44
50
  <template slot-scope="scope">
45
51
  <el-input
52
+ v-if="scope.row.updateType != 0"
46
53
  v-model="scope.row.memo"
47
54
  size="small"
48
55
  autocomplete="off"
49
56
  placeholder="请输入"
50
57
  clearable
51
58
  />
59
+ <span v-if="scope.row.updateType === 0">{{ scope.row.memo }}</span>
52
60
  </template>
53
61
  </el-table-column>
54
62
  <el-table-column label="附件上传">
55
63
  <template slot-scope="scope">
56
- <div class="cantpick">
64
+ <div v-if="scope.row.updateType != 0" class="cantpick">
57
65
  <div
58
66
  v-show="!scope.row.attnoadd"
59
67
  class="canttip"
@@ -103,16 +111,23 @@
103
111
  </el-input>
104
112
  </el-upload>
105
113
  </div>
114
+ <span v-if="scope.row.updateType === 0">{{
115
+ scope.row.recordname
116
+ }}</span>
106
117
  </template>
107
118
  </el-table-column>
108
119
  <el-table-column label="文件大小">
109
120
  <template slot-scope="scope">
110
121
  <span v-if="scope.row.file != null">{{ scope.row.file.size }}</span>
122
+ <span v-if="scope.row.updateType === 0">{{
123
+ scope.row.fileSize
124
+ }}</span>
111
125
  </template>
112
126
  </el-table-column>
113
127
  <el-table-column label="上传时间" align="left">
114
128
  <template slot-scope="scope">
115
129
  <span v-if="scope.row.file != null">{{ uploadDate }}</span>
130
+ <span>{{ format(scope.row.uploadtime, 'yyyy-MM-dd hh:mm:ss') }}</span>
116
131
  </template>
117
132
  </el-table-column>
118
133
  <el-table-column label="上传进度">
@@ -157,9 +172,14 @@
157
172
  <el-table-column label="操作" type="index" width="100">
158
173
  <template slot-scope="scope">
159
174
  <i
160
- v-show="scope.row.recordno"
175
+ v-show="scope.row.beid && scope.row.updateType != 0"
161
176
  class="el-icon-view"
162
- @click="handleDownload(scope.row.recordno)"
177
+ @click="handleDownload(scope.row.beid, scope.row.file.name)"
178
+ ></i>
179
+ <i
180
+ v-show="scope.row.beid && scope.row.updateType === 0"
181
+ class="el-icon-view"
182
+ @click="handleDownload(scope.row.beid, scope.row.recordname)"
163
183
  ></i>
164
184
  </template>
165
185
  </el-table-column>
@@ -171,37 +191,37 @@
171
191
 
172
192
  <script>
173
193
  import axios from 'axios'
194
+ import Cookies from 'js-cookie'
174
195
  var CancelToken = axios.CancelToken
196
+ let token = Cookies.get('Admin-Token')
197
+ function randomString(num) {
198
+ num = num || 32
199
+ var t = ''
200
+ t = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
201
+
202
+ const a = t.length
203
+ let n = ''
204
+ for (let i = 0; i < num; i++) n += t.charAt(Math.floor(Math.random() * a))
205
+ return n
206
+ }
175
207
  export default {
176
208
  name: 'NstcElectronicFile',
177
209
  props: {
210
+ value: {
211
+ type: Array,
212
+ default: () => {
213
+ return []
214
+ }
215
+ },
178
216
  paramVal: {
179
217
  default: null,
180
218
  type: Object
181
219
  },
182
- sysno: {
183
- default: '',
184
- type: String
185
- },
186
- appno: {
187
- default: '',
188
- type: String
189
- },
190
- bussValue: {
191
- default: '',
192
- type: String
193
- },
194
- bussId: {
195
- default: '',
196
- type: String
197
- },
198
- cltno: {
199
- default: '',
200
- type: String
201
- },
202
- cltname: {
203
- default: '',
204
- type: String
220
+ viewMode: {
221
+ default() {
222
+ return false
223
+ },
224
+ type: Boolean
205
225
  },
206
226
  propList: {
207
227
  default: null,
@@ -211,7 +231,6 @@ export default {
211
231
  data() {
212
232
  return {
213
233
  VisibleAdd: true,
214
- files: [],
215
234
  eamsAttachfiles: [],
216
235
  eamsBaseRecord: {},
217
236
  attno: '',
@@ -227,18 +246,65 @@ export default {
227
246
  axios: axios
228
247
  }
229
248
  },
230
- watch: {},
249
+ computed: {
250
+ files: {
251
+ get() {
252
+ return this.value
253
+ },
254
+ set(val) {
255
+ this.$emit('input', val)
256
+ }
257
+ }
258
+ },
259
+ watch: {
260
+ 'paramVal.bussId'(val) {
261
+ this.getUploadedFile()
262
+ }
263
+ },
231
264
  created() {
232
265
  this.getUploadDate()
233
266
  axios.defaults.timeout = 60000
234
267
  },
235
268
  mounted: function () {
236
269
  this.getBussTypeSetting()
270
+ this.getUploadedFile()
237
271
  },
238
272
  methods: {
273
+ formatDate(date, fmt) {
274
+ date = new Date(date)
275
+ if (/(y+)/.test(fmt)) {
276
+ fmt = fmt.replace(
277
+ RegExp.$1,
278
+ (date.getFullYear() + '').substr(4 - RegExp.$1.length)
279
+ )
280
+ }
281
+ let o = {
282
+ 'M+': date.getMonth() + 1,
283
+ 'd+': date.getDate(),
284
+ 'h+': date.getHours(),
285
+ 'm+': date.getMinutes(),
286
+ 's+': date.getSeconds()
287
+ }
288
+ for (let k in o) {
289
+ if (new RegExp(`(${k})`).test(fmt)) {
290
+ let str = o[k] + ''
291
+ fmt = fmt.replace(
292
+ RegExp.$1,
293
+ RegExp.$1.length === 1 ? str : this.padLeftZero(str)
294
+ )
295
+ }
296
+ }
297
+ return fmt
298
+ },
239
299
  handleSelectionChange(val) {
240
300
  this.multipleSelection = val
241
301
  },
302
+ format(date, f) {
303
+ if (date == '' || date == undefined) {
304
+ return ''
305
+ }
306
+ return this.formatDate(date, f)
307
+ },
242
308
  getUploadDate() {
243
309
  let date = new Date()
244
310
  this.uploadDate =
@@ -261,6 +327,26 @@ export default {
261
327
  }
262
328
  this.files.push(row)
263
329
  },
330
+ // 获取业务附件数
331
+ getUploadedFile() {
332
+ let params = {
333
+ bussValue: this.paramVal.bussValue,
334
+ bussId: this.paramVal.bussId
335
+ }
336
+ axios
337
+ .post('/api/neams/eamsbaserecord/queryList', params)
338
+ .then((res) => {
339
+ res.data.length &&
340
+ res.data.forEach((file) => {
341
+ file.updateType = 0
342
+ })
343
+ this.files = res.data || []
344
+ console.log(this.files, 'file')
345
+ })
346
+ .catch((error) => {
347
+ console.log(error)
348
+ })
349
+ },
264
350
  batchload() {
265
351
  this.$confirm('确定下载选中的附件?', {
266
352
  confirmButtonText: '确定',
@@ -282,15 +368,34 @@ export default {
282
368
  type: 'warning'
283
369
  }).then(() => {
284
370
  let files = this.files
371
+ let idArr = []
285
372
  while (this.multipleSelection.length > 0) {
286
373
  let pop = this.multipleSelection.pop()
374
+ if (pop.beid) {
375
+ idArr.push(pop.beid)
376
+ }
287
377
  for (let i = 0; i < files.length; i++) {
288
378
  if (files[i] == pop) {
289
379
  files.splice(i, 1)
290
380
  }
291
381
  }
292
382
  }
293
- this.files = files
383
+ if (idArr.length === 0) {
384
+ return
385
+ }
386
+ axios
387
+ .post('/api/neams/eamsbaserecord/delete', idArr)
388
+ .then((res) => {
389
+ if (res.code == '200') {
390
+ this.$message.success('删除成功')
391
+ this.files = files
392
+ } else {
393
+ this.$message.success('删除失败' + res.data.msg)
394
+ }
395
+ })
396
+ .catch(function (error) {
397
+ console.log(error)
398
+ })
294
399
  })
295
400
  },
296
401
  handleDelete(index) {
@@ -301,13 +406,13 @@ export default {
301
406
  this.VisibleAdd = true
302
407
  },
303
408
  getBussTypeSetting() {
304
- this.axios
305
- .get(
306
- '/neams/eamsattachfile/queryByBussValue/' +
307
- this.$props.paramVal.bussValue
308
- )
309
- .then((response) => {
310
- this.eamsAttachfiles = response.data.data
409
+ let params = {
410
+ bussValue: this.$props.paramVal.bussValue
411
+ }
412
+ axios
413
+ .post('/api/neams/eamsattachfile/getByBussValue', params)
414
+ .then((res) => {
415
+ this.eamsAttachfiles = res.data.data
311
416
  })
312
417
  .catch(function (error) {
313
418
  console.log(error)
@@ -411,12 +516,17 @@ export default {
411
516
  formData.append('date', '2021-08-02 12:33:33,2023-08-23 12:33:33')
412
517
  _file.cancel = ''
413
518
  axios({
414
- url: '/neams/eamsbaserecord/batchSavejson',
519
+ url: '/api/neams/eamsbaserecord/batchSavejson',
415
520
  method: 'post',
416
521
  data: formData,
417
522
  contentType: false,
418
523
  headers: {
419
- 'Content-Type': 'multipart/form-data;charset=utf-8'
524
+ charset: 'utf-8',
525
+ Authorization: `Bearer ${token}`,
526
+ 'Content-Type': 'multipart/form-data',
527
+ timestamp: Date.now(),
528
+ requestKey: randomString(16),
529
+ OperationDesc: 'yYarJp'
420
530
  },
421
531
  onUploadProgress(progressEvent) {
422
532
  _file.loadprogress =
@@ -435,11 +545,11 @@ export default {
435
545
  _file.upstatus = 2
436
546
  this.$message.success('上传成功!')
437
547
  let recordno = res.data.data.replace(',', '')
438
- _file.recordno = recordno
439
- if (this.recordarr.indexOf(recordno) === -1) {
440
- this.recordarr.push(recordno)
441
- this.$emit('refreshDataList', this.recordarr)
442
- }
548
+ // _file.recordno = recordno
549
+ // if (this.recordarr.indexOf(recordno) === -1) {
550
+ // this.recordarr.push(recordno)
551
+ // this.$emit('refreshDataList', this.recordarr)
552
+ // }
443
553
  }
444
554
  })
445
555
  .catch((err) => {
@@ -453,11 +563,21 @@ export default {
453
563
  cancelupload(index) {
454
564
  this.files[index].cancel()
455
565
  },
456
- handleDownload(row) {
566
+ handleDownload(beid, name) {
457
567
  this.axios({
458
- method: 'GET',
459
- url: `/neams/eamsbaserecord/download/${row}/${0}`,
460
- responseType: 'blob'
568
+ method: 'POST',
569
+ url: '/api/neams/eamsbaserecord/downloadFile',
570
+ responseType: 'blob',
571
+ headers: {
572
+ charset: 'utf-8',
573
+ Authorization: `Bearer ${token}`,
574
+ 'Content-Type': 'application/json',
575
+ // "Content-Type": "multipart/form-data",
576
+ timestamp: Date.now(),
577
+ OperationDesc: 'yYarJp',
578
+ requestKey: randomString(16)
579
+ },
580
+ data: { beid: beid }
461
581
  })
462
582
  .then((response) => {
463
583
  if (response.data.type === 'application/octet-stream') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "1.3.45",
3
+ "version": "1.3.48",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,6 +1,13 @@
1
1
  // Attached方式签名
2
2
  import { IWSAgent } from './InfosecNetSignCNGAgent.min.js'
3
- const { IWSASetTimeOut, IWSAAttachedSign, IWSAAttachedVerify, IWSASendAvailable, IWSAGetAvailable } = new IWSAgent()
3
+ const {
4
+ IWSASetTimeOut,
5
+ IWSAAttachedSign,
6
+ IWSAAttachedVerify,
7
+ IWSASendAvailable,
8
+ IWSAGetAvailable,
9
+ IWSAGetAllCertsListInfoByCertDN
10
+ } = new IWSAgent()
4
11
  IWSASetTimeOut(6000)
5
12
 
6
13
  let _dn
@@ -52,6 +59,12 @@ export function getSign(plain, dn) {
52
59
  plainText = plain
53
60
  }
54
61
 
62
+ let checkRes
63
+ IWSAGetAllCertsListInfoByCertDN('', 'Sign', parseCA(dn), 0, (dnList) => {
64
+ checkRes = verifyDn(dnList, dn)
65
+ })
66
+ if (checkRes) return ''
67
+
55
68
  let answer = undefined
56
69
  IWSAAttachedSign('1', plainText, '0', 'SHA1', (errorCode, signedData) => {
57
70
  if (errorCode === 0 || errorCode === '0') {
@@ -62,3 +75,34 @@ export function getSign(plain, dn) {
62
75
  })
63
76
  return answer
64
77
  }
78
+
79
+ function parseCA(dn) {
80
+ const mark = /^CN=/
81
+ let cn = ''
82
+ if (dn == null) return cn
83
+
84
+ let booked = dn.split(',')
85
+ let dnC = booked.find((b) => mark.test(b))
86
+ dnC && (cn = dnC.replace(mark, ''))
87
+ return cn
88
+ }
89
+
90
+ function verifyDn(dnList, dn) {
91
+ if (!dnList || dnList.length === 0) return 'dnListEmpty'
92
+
93
+ if (!dn) return 'dnIsEmpty'
94
+
95
+ let checkRes = ''
96
+ let userDnAttrsArr = dn.split(',').map((c) => c.trim())
97
+
98
+ dnList.find((C) => {
99
+ let dnAttrsArr = C.certDN.split(',').map((c) => c.trim())
100
+
101
+ if (!dnAttrsArr.some((dnAttr) => userDnAttrsArr.includes(dnAttr))) {
102
+ checkRes = 'checkRes'
103
+ return true
104
+ }
105
+ })
106
+
107
+ return checkRes
108
+ }