n20-common-lib 2.3.6 → 2.3.7

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.3.6",
3
+ "version": "2.3.7",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -81,6 +81,19 @@
81
81
  />
82
82
  </template>
83
83
  </div>
84
+ <el-form-item v-if="fileKit || fileKitT" label="附加上传">
85
+ <cl-upload
86
+ class="upload-224"
87
+ :file-name.sync="fileName"
88
+ multiple
89
+ :data="fileData"
90
+ :file-url.sync="fileUrl"
91
+ :on-success="onSuccess"
92
+ :on-remove="onRemove"
93
+ action="/api/neams/eamsbaserecord/batchSavejson"
94
+ msg-type="message"
95
+ />
96
+ </el-form-item>
84
97
  </el-form>
85
98
 
86
99
  <div class="text-c">
@@ -183,6 +196,27 @@ export default {
183
196
  return ['reject', 'rejectPre', 'approval', 'discard']
184
197
  }
185
198
  },
199
+ fileData: {
200
+ type: Object,
201
+ default: () => {
202
+ return {
203
+ data: JSON.stringify({
204
+ syscode: '010000000',
205
+ appno: 'abcd',
206
+ bussValue: '006001001',
207
+ cltno: '001',
208
+ creator: 'jz'
209
+ })
210
+ }
211
+ }
212
+ },
213
+ /**
214
+ * 是否上传审批附件
215
+ */
216
+ fileKit: {
217
+ type: Boolean,
218
+ default: false
219
+ },
186
220
  beforeRatify: {
187
221
  type: Function,
188
222
  default: undefined
@@ -221,7 +255,10 @@ export default {
221
255
  approvalToV: false,
222
256
  showApprovalTo: false,
223
257
  opiAndUser: false,
224
- otherAtt: {}
258
+ otherAtt: {},
259
+ fileDtos: [],
260
+ fileName: '',
261
+ fileUrl: ''
225
262
  }
226
263
  },
227
264
  computed: {
@@ -236,6 +273,11 @@ export default {
236
273
  this.messageIn = val
237
274
  }
238
275
  }
276
+ },
277
+ fileKitT: {
278
+ get() {
279
+ return window.fileKit
280
+ }
239
281
  }
240
282
  },
241
283
  created() {
@@ -335,6 +377,7 @@ export default {
335
377
  formData: JSON.stringify(this.formData),
336
378
  signText: this.signText,
337
379
  isAgentcy: isAgentcy,
380
+ fileDtos: this.fileDtos,
338
381
  carbonCopyUserDtoList: this.carbonCopyList.map((c) => ({ userNo: c.uno, userName: c.uname })),
339
382
  addTaskList: this.addTaskList.map((c) => ({ userNo: c.uno, userName: c.uname })),
340
383
  addTaskType: this.addTaskType,
@@ -481,6 +524,20 @@ export default {
481
524
  }
482
525
 
483
526
  this.setAddtaskV = false
527
+ },
528
+ getFileDtos(fileList) {
529
+ return fileList.map((file) => {
530
+ return {
531
+ fileName: file.name,
532
+ beid: file.response?.data
533
+ }
534
+ })
535
+ },
536
+ onRemove(file, fileList) {
537
+ this.fileDtos = this.getFileDtos(fileList)
538
+ },
539
+ onSuccess(file, row, fileList) {
540
+ this.fileDtos = this.getFileDtos(fileList)
484
541
  }
485
542
  }
486
543
  }
@@ -59,6 +59,51 @@
59
59
  <span v-if="item.result !== status.waiting">{{ '审批意见:' | $lc }}</span>
60
60
  <span>{{ item.suggestion }}</span>
61
61
  </div>
62
+ <div v-if="item.flowHisFileList" class="n20-description-c n20-description-bgc m-t p-a-s">
63
+ <span>{{ '附件信息' | $lc }}:</span>
64
+ <div class="flex-box">
65
+ <div
66
+ v-for="(res, i) in item.flowHisFileList"
67
+ :key="i"
68
+ class="m-a-ss color-primary pointer"
69
+ @click="preview(res)"
70
+ >
71
+ {{ res.fileName }}
72
+ </div>
73
+ </div>
74
+ <Dialog
75
+ v-drag
76
+ class="p-a-0"
77
+ :title="'附件预览' | $lc"
78
+ :visible.sync="visibleP"
79
+ top="2vh"
80
+ width="96%"
81
+ :close-on-click-modal="false"
82
+ @close="closeSee"
83
+ >
84
+ <div v-if="visibleP" class="p-a" style="height: 82vh">
85
+ <ViewerImg v-if="imgType.test(previewName)" :options="viewerOptions" style="height: 100%">
86
+ <img :src="previewUrl" :alt="previewName" style="display: none" />
87
+ </ViewerImg>
88
+ <component
89
+ :is="previewSameOrg ? 'object' : 'div'"
90
+ v-else
91
+ :key="previewUrl"
92
+ :data="previewUrl"
93
+ style="width: 100%; height: 100%"
94
+ >
95
+ <div class="flex-column flex-c flex-v" style="height: 100%">
96
+ <i class="el-icon-s-release" style="font-size: 60px; color: #999"></i>
97
+ <span style="margin-top: 16px">
98
+ {{ '不支持在线预览,请' | $lc
99
+ }}<el-link type="primary" @click="downFile(seeRow)">{{ '下载' | $lc }}</el-link
100
+ >{{ '到本地查看' | $lc }}
101
+ </span>
102
+ </div>
103
+ </component>
104
+ </div>
105
+ </Dialog>
106
+ </div>
62
107
  </template>
63
108
  </div>
64
109
  </el-timeline-item>
@@ -69,10 +114,22 @@
69
114
  <script>
70
115
  import { $lc } from '../../utils/i18n/index'
71
116
  import axios from '../../utils/axios'
117
+ import Dialog from '../Dialog/index.vue'
118
+ import 'viewerjs/dist/viewer.css'
119
+ import importG from '../../utils/importGlobal.js'
120
+
121
+ const ViewerImg = async function () {
122
+ let { component } = await importG('v-viewer', () => import(/*webpackChunkName: "v-viewer"*/ 'v-viewer'))
123
+ return component
124
+ }
72
125
  if (!window._approvalExtend) window._approvalExtend = {}
73
126
 
74
127
  export default {
75
128
  name: 'ApprovalCard',
129
+ components: {
130
+ Dialog,
131
+ ViewerImg
132
+ },
76
133
  filters: {
77
134
  typeF(item, status, prefix = '') {
78
135
  let result = item.result
@@ -132,9 +189,37 @@ export default {
132
189
  }
133
190
  },
134
191
  data() {
192
+ this.viewerOptions = {
193
+ debug: true,
194
+ inline: true,
195
+ scalable: false, // 不显示水平(垂直)翻转
196
+ navbar: false,
197
+ button: false,
198
+ title: true,
199
+ toolbar: {
200
+ zoomIn: true,
201
+ zoomOut: true,
202
+ oneToOne: true,
203
+ reset: true,
204
+ rotateLeft: true,
205
+ rotateRight: true,
206
+ flipHorizontal: true,
207
+ flipVertical: true,
208
+ prev: false,
209
+ play: false,
210
+ next: false
211
+ }
212
+ }
135
213
  return {
136
214
  // 显示撤回意见,默认不显示
137
- showCtdMsg: window._approvalExtend['card.countermand.suggestion'] === true
215
+ showCtdMsg: window._approvalExtend['card.countermand.suggestion'] === true,
216
+ visibleP: false,
217
+ previewUrl: '',
218
+ imgType: /\.(jpg|png|gif|svg)$/i,
219
+ previewName: '',
220
+ previewSameOrg: false,
221
+ seeTypes: /\.(jpg|png|gif|svg|pdf|swf|xlsx|xls|docx|doc)$/i,
222
+ seeRow: {}
138
223
  }
139
224
  },
140
225
  created() {
@@ -155,6 +240,7 @@ export default {
155
240
  assignee: item.assignee,
156
241
  suggestion: item.suggestion,
157
242
  roleName: item.roleName,
243
+ flowHisFileList: item.flowHisFileList || null, //附件信息
158
244
  ccUserName: item.ccUserName, // 抄送人
159
245
  addTaskName: item.addTaskName, // 加签审批人
160
246
  memberName: item.memberName // 审批人单位
@@ -187,6 +273,39 @@ export default {
187
273
  console.log(this.approvalData)
188
274
  })
189
275
  }
276
+ },
277
+ methods: {
278
+ async preview(row) {
279
+ this.visibleP = true
280
+ this.seeRow = row
281
+ const blob = await axios.get(`/api/onlinePreview?beid=${row.beid}`, {}, { responseType: 'blob' })
282
+ let url = URL.createObjectURL(blob)
283
+ this.previewUrl = url
284
+ this.previewName = row.fileName
285
+ this.previewSameOrg = this.seeTypes.test(row.fileName)
286
+ },
287
+ closeSee() {
288
+ this.previewUrl && URL.revokeObjectURL(this.previewUrl)
289
+ this.previewUrl = undefined
290
+ this.visibleP = false
291
+ },
292
+ async downFile(row) {
293
+ const blob = await axios.get(`/api/neams/eamsbaserecord/download/${row.beid}`, null, {
294
+ responseType: 'blob'
295
+ })
296
+ let url = URL.createObjectURL(blob)
297
+ if (url) {
298
+ let aDom = document.createElement('a')
299
+ aDom.href = url
300
+ aDom.download = row.fileName
301
+ aDom.click()
302
+
303
+ this.$nextTick(() => {
304
+ aDom = undefined
305
+ url && URL.revokeObjectURL(url)
306
+ })
307
+ }
308
+ }
190
309
  }
191
310
  }
192
311
  </script>