n20-common-lib 2.6.9 → 2.6.10-beta

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.
Files changed (39) hide show
  1. package/package.json +4 -3
  2. package/src/assets/css/cl-file-upload-table.scss +8 -1
  3. package/src/assets/css/cl-layout-header.scss +34 -5
  4. package/src/assets/css/cl-message.scss +55 -1
  5. package/src/components/AdvancedFilter/formItemRender.vue +6 -3
  6. package/src/components/AdvancedFilter/index.vue +34 -13
  7. package/src/components/AdvancedFilter/utils.js +8 -0
  8. package/src/components/Anchor/index.vue +5 -1
  9. package/src/components/ApprovalButtons/showAppOpi.vue +1 -0
  10. package/src/components/DateSelect/index.vue +1 -1
  11. package/src/components/Dialog/index.vue +5 -0
  12. package/src/components/ElectronicArchive/index.vue +884 -0
  13. package/src/components/FileImport/index.vue +6 -0
  14. package/src/components/FileUploadTable/index.vue +1 -1
  15. package/src/components/Filters/index.vue +1 -1
  16. package/src/components/InputNumber/numberRange.vue +2 -0
  17. package/src/components/Layout/HeaderWrap/changePwd.vue +9 -8
  18. package/src/components/Layout/HeaderWrap/index.vue +10 -0
  19. package/src/components/Layout/HeaderWrap/indexN.vue +19 -4
  20. package/src/components/SelectDatePickerPro/index.vue +13 -13
  21. package/src/components/TablePro/filterContent.vue +279 -0
  22. package/src/components/TablePro/filterContent_tree.vue +172 -0
  23. package/src/components/TablePro/index.js +30 -0
  24. package/src/components/TablePro/index.vue +3 -2
  25. package/src/components/Tree/index.vue +6 -1
  26. package/src/components/Upload/index.vue +5 -0
  27. package/src/components/Upload/uploadMsg.vue +7 -5
  28. package/src/components/operatingStatus/index.vue +5 -3
  29. package/src/index.js +6 -1
  30. package/src/utils/amountInWords.js +17 -100
  31. package/style/index.css +1 -1
  32. package/theme/blue.css +1 -1
  33. package/theme/cctcRed.css +1 -1
  34. package/theme/green.css +1 -1
  35. package/theme/lightBlue.css +1 -1
  36. package/theme/orange.css +1 -1
  37. package/theme/purple.css +1 -1
  38. package/theme/red.css +1 -1
  39. package/theme/yellow.css +1 -1
@@ -0,0 +1,884 @@
1
+ <template>
2
+ <div class="n20-ElectronicArchive">
3
+ <div class="flex-box flex-v flex-lr m-b-s">
4
+ <div>
5
+ <slot name="title">{{ '附件信息' | $lc }}</slot>
6
+ </div>
7
+ <div>
8
+ <slot v-if="!readonly" name="add-btn">
9
+ <el-button type="primary" size="mini" @click="addRow">{{ '新增' | $lc }}</el-button>
10
+ </slot>
11
+ <slot name="down-btn">
12
+ <el-button size="mini" plain @click="downRows">{{ '下载' | $lc }}</el-button>
13
+ </slot>
14
+ <slot v-if="!readonly" name="delete-btn">
15
+ <el-button type="danger" plain size="mini" @click="deleteRows">{{ '删除' | $lc }}</el-button>
16
+ </slot>
17
+ </div>
18
+ </div>
19
+ <el-table
20
+ :data="tableDataC"
21
+ :row-key="keys.rowKey"
22
+ border
23
+ @selection-change="(selection) => (selectionList = selection)"
24
+ >
25
+ <slot name="selection-column">
26
+ <el-table-column type="selection" width="50" align="center" />
27
+ </slot>
28
+ <template v-if="dataProp.slotHeader">
29
+ <el-table-column
30
+ v-for="item in dataProp.slotHeader"
31
+ :key="item.prop"
32
+ :label="item.label"
33
+ :prop="item.prop"
34
+ :align="item.align || 'center'"
35
+ :width="item.width || 'auto'"
36
+ :show-overflow-tooltip="item.showOverflowTooltip || item['show-overflow-tooltip']"
37
+ />
38
+ </template>
39
+ <template v-else>
40
+ <el-table-column :label="'业务类型' | $lc" :prop="keys.bussType">
41
+ <template v-slot:header="scope">
42
+ <slot name="bussType-header" :column="scope.column">{{ '业务类型' | $lc }}</slot>
43
+ </template>
44
+ <template v-slot="{ row }">
45
+ <slot name="type" :row="row">
46
+ <span v-if="readonly">{{ row[keys.bussType] | bussTypeFilter(bussTypeOptions) }}</span>
47
+ <el-select
48
+ v-else
49
+ v-model="row[keys.bussType]"
50
+ :disabled="row._bussTypeDisabled || row.readonly"
51
+ :placeholder="'请选择' | $lc"
52
+ @change="(val) => bussTypeChange(val, row)"
53
+ style="width: 100%"
54
+ >
55
+ <el-option
56
+ v-for="item in bussTypeOptions"
57
+ :key="item.bussValue"
58
+ :disabled="item.disabled"
59
+ :value="item.bussValue"
60
+ :label="item.bussName"
61
+ />
62
+ </el-select>
63
+ </slot>
64
+ </template>
65
+ </el-table-column>
66
+ <el-table-column :label="'附件类型' | $lc" :prop="keys.type">
67
+ <template v-slot:header="scope">
68
+ <slot name="type-header" :column="scope.column">{{ '附件类型' | $lc }}</slot>
69
+ </template>
70
+ <template v-slot="{ row }">
71
+ <slot name="type" :row="row">
72
+ <span v-if="readonly">{{ row[keys.type] | typeFilter(typeOptions) }}</span>
73
+ <el-select
74
+ v-else
75
+ v-model="row[keys.type]"
76
+ :disabled="row._typeDisabled || row.readonly"
77
+ :placeholder="'请选择' | $lc"
78
+ style="width: 100%"
79
+ @change="(val) => handleTypeChange(val, row)"
80
+ >
81
+ <el-option
82
+ v-for="item in typeOptions"
83
+ :key="item.attno"
84
+ :disabled="item.disabled"
85
+ :value="item.attno"
86
+ :label="item.attname"
87
+ />
88
+ </el-select>
89
+ </slot>
90
+ </template>
91
+ </el-table-column>
92
+ <el-table-column :label="'附件名称' | $lc" :prop="keys.name">
93
+ <template v-slot:header="scope">
94
+ <slot name="name-header" :column="scope.column">{{ '附件名称' | $lc }}</slot>
95
+ </template>
96
+ <template v-slot="{ row }">
97
+ <slot name="name" :row="row">
98
+ <span v-if="readonly">{{ row[keys.name] ? row[keys.name].replace(/\.[A-z0-9]+$/, '') : '' }}</span>
99
+ <el-input
100
+ v-else
101
+ :value="row[keys.name] ? row[keys.name].replace(/\.[A-z0-9]+$/, '') : ''"
102
+ disabled
103
+ :placeholder="'请输入' | $lc"
104
+ />
105
+ </slot>
106
+ </template>
107
+ </el-table-column>
108
+ <el-table-column v-if="readonly" :label="'附件上传' | $lc" :prop="keys.name">
109
+ <template v-slot:header="scope">
110
+ <slot name="upload-header" :column="scope.column">{{ '附件上传' | $lc }} </slot>
111
+ </template>
112
+ <template v-slot="{ row }">
113
+ <slot name="upload" :row="row">
114
+ {{ $options.filters.fileName(row, keys.url) || row[keys.name] }}
115
+ </slot>
116
+ </template>
117
+ </el-table-column>
118
+ <el-table-column v-if="!readonly" :label="'附件上传' | $lc">
119
+ <template v-slot:header="scope">
120
+ <slot name="upload-header" :column="scope.column">{{ '附件上传' | $lc }} </slot>
121
+ </template>
122
+ <template v-slot="{ row, $index }">
123
+ <slot name="upload" :row="row" :[indexKey]="$index">
124
+ <el-input
125
+ :value="row._name"
126
+ :placeholder="'上传附件' | $lc"
127
+ readonly
128
+ :disabled="!row[keys.type] || row._name"
129
+ v-if="row.isBaseFile"
130
+ @click.native="handleClick(row, $index)"
131
+ >
132
+ <template slot="suffix">
133
+ <i class="el-input__icon n20-icon-shangchuan"></i>
134
+ </template>
135
+ </el-input>
136
+ <Upload
137
+ v-else
138
+ :ref="'upload' + $index"
139
+ class="n20-upload-table-up"
140
+ :file-name="row | fileName(keys.url)"
141
+ :data="row['_fileData'] || fileData"
142
+ :msg-type="null"
143
+ :show-clear="false"
144
+ :action="action"
145
+ :multiple="multiple"
146
+ :headers="dataProp.headers"
147
+ :disabled="!row[keys.type] || row._typeDisabled || row.readonly"
148
+ :accept="row[keys.type] | acceptFilter(typeOptions, fileAccept)"
149
+ :size="row[keys.type] | sizeFilter(typeOptions, fileSize)"
150
+ :http-request="(options) => httpRequest(options, row)"
151
+ :before-upload="(file) => beforeUploadFn(file, row)"
152
+ :on-progress="(event) => onProgressFn(event, row)"
153
+ :on-success="(response, file, fileList) => onSuccessFn(response, file, fileList, row)"
154
+ :on-error="(err, file, fileList) => errorFn(err, file, fileList, row, $index)"
155
+ />
156
+ </slot>
157
+ </template>
158
+ </el-table-column>
159
+ <slot name="slotCol"></slot>
160
+ <el-table-column :label="'上传时间' | $lc" :prop="keys.time" sortable width="170" align="left">
161
+ <template v-slot:header="scope">
162
+ <slot name="time-header" :column="scope.column">{{ '上传时间' | $lc }}</slot>
163
+ </template>
164
+ <template v-slot="{ row }">
165
+ <slot name="time" :row="row">{{ row[keys.time] | formatDate }}</slot>
166
+ </template>
167
+ </el-table-column>
168
+ <el-table-column v-if="!hideUser" :label="'上传人' | $lc" :prop="keys.user" width="100">
169
+ <template v-slot:header="scope">
170
+ <slot name="user-header" :column="scope.column">{{ '上传人' | $lc }}</slot>
171
+ </template>
172
+ <template v-slot="{ row }">
173
+ <slot name="user" :row="row">{{ row[keys.user] }}</slot>
174
+ </template>
175
+ </el-table-column>
176
+ </template>
177
+ <el-table-column v-if="!readonly" :label="'上传进度' | $lc" width="220">
178
+ <template v-slot:header="scope">
179
+ <slot name="percent-header" :column="scope.column">{{ '上传进度' | $lc }}</slot>
180
+ </template>
181
+ <template v-slot="{ row, $index }">
182
+ <slot name="percent" :row="row" :[indexKey]="$index">
183
+ <div v-if="row['_percent'] >= 0 && !row._typeDisabled" class="flex-box flex-v">
184
+ <el-progress
185
+ class="n20-upload-table-progress"
186
+ :percentage="row['_percent']"
187
+ :status="row._status"
188
+ text-color=""
189
+ style="width: 140px"
190
+ />
191
+ <el-button
192
+ v-if="row['_status'] === 'exception'"
193
+ type="text"
194
+ size="mini"
195
+ style="width: 60px"
196
+ @click="anewSubmitFn(row, $index)"
197
+ >{{ '重新上传' | $lc }}
198
+ </el-button>
199
+ <el-button
200
+ v-else-if="row['_percent'] >= 0 && row['_percent'] < 100"
201
+ type="text"
202
+ size="mini"
203
+ style="width: 60px"
204
+ @click="abortFn(row, $index)"
205
+ >{{ '取消' | $lc }}
206
+ </el-button>
207
+ </div>
208
+ </slot>
209
+ </template>
210
+ </el-table-column>
211
+ <el-table-column :label="'操作' | $lc" align="center" width="90" fixed="right">
212
+ <template v-slot:header="scope">
213
+ <slot name="handle-header" :column="scope.column">{{ '操作' | $lc }}</slot>
214
+ </template>
215
+ <template v-slot="{ row }">
216
+ <slot name="handle" :row="row">
217
+ <el-button type="text" icon="el-icon-view" :disabled="!row[keys.url]" @click="seeFile(row)" />
218
+ <el-button
219
+ v-if="readonly"
220
+ type="text"
221
+ icon="el-icon-download"
222
+ :disabled="!row[keys.url]"
223
+ @click="downFile(row)"
224
+ />
225
+ </slot>
226
+ </template>
227
+ </el-table-column>
228
+ </el-table>
229
+
230
+ <Dialog width="432px" title="" :visible.sync="chooseVisible">
231
+ <div class="flex-box flex-c flex-v">
232
+ <Upload
233
+ ref="baseUpload"
234
+ class="n20-upload-table-up"
235
+ :file-name="this.row | fileName(keys.url)"
236
+ :data="this.row['_fileData'] || fileData"
237
+ :msg-type="null"
238
+ :show-clear="false"
239
+ :action="action"
240
+ :multiple="multiple"
241
+ :headers="dataProp.headers"
242
+ :disabled="!this.row[keys.type] || this.row._typeDisabled || this.row.readonly"
243
+ :accept="this.row[keys.type] | acceptFilter(typeOptions, fileAccept)"
244
+ :size="this.row[keys.type] | sizeFilter(typeOptions, fileSize)"
245
+ :http-request="(options) => httpRequest(options, this.row)"
246
+ :before-upload="(file) => beforeUploadFn(file, this.row)"
247
+ :on-progress="(event) => onProgressFn(event, this.row)"
248
+ :on-success="(response, file, fileList) => onSuccessFn(response, file, fileList, this.row)"
249
+ :on-error="(err, file, fileList) => errorFn(err, file, fileList, this.row, $index)"
250
+ >
251
+ <template slot="trigger">
252
+ <el-button size="small" type="primary">上传附件</el-button>
253
+ </template>
254
+ </Upload>
255
+ <el-button size="small" type="primary" class="m-l-s" @click="baseVisible = true">选择基础附件</el-button>
256
+ </div>
257
+ </Dialog>
258
+
259
+ <Dialog title="基础附件选择" :visible.sync="baseVisible">
260
+ <el-table :data="baseAttnoData" border>
261
+ <el-table-column label="选择" align="center" width="65">
262
+ <template scope="scope">
263
+ <el-radio :label="scope.$index" v-model="radio" @change.native="getCurrentRow(scope.row)">{{
264
+ ''
265
+ }}</el-radio>
266
+ </template>
267
+ </el-table-column>
268
+ <el-table-column prop="recordname" width="140px" show-overflow-tooltip label="文件名称" />
269
+ <el-table-column prop="cltName" width="140px" show-overflow-tooltip label="所属单位" />
270
+ <el-table-column prop="fileVersion" align="center" label="版本号" />
271
+ <el-table-column prop="startValidTime" width="120px" label="起始有效时间" align="center" />
272
+ <el-table-column prop="endValidTime" width="120px" label="截至有效时间" align="center"> </el-table-column>
273
+ <el-table-column prop="uploadTime" label="更新时间" width="160px" align="center">
274
+ <template v-slot="{ row }">
275
+ {{ dayjs(row.uploadTime).format('YYYY-MM-DD HH:mm:ss') }}
276
+ </template>
277
+ </el-table-column>
278
+ <el-table-column prop="isEnable" label="状态" align="center">
279
+ <template v-slot="{ row }">
280
+ <span>{{ row.isEnable === '1' ? '启用' : '禁用' }}</span>
281
+ </template>
282
+ </el-table-column>
283
+ </el-table>
284
+ </Dialog>
285
+
286
+ <Dialog
287
+ v-drag
288
+ class="p-a-0"
289
+ :title="'附件预览' | $lc"
290
+ :visible.sync="visibleP"
291
+ top="2vh"
292
+ width="96%"
293
+ :close-on-click-modal="false"
294
+ @close="closeSee"
295
+ >
296
+ <span class="file-upload-table_preview-pn">
297
+ <el-button round onlyicon plain size="mini" icon="el-icon-back" @click="preSee" />
298
+ <el-button round onlyicon plain size="mini" icon="el-icon-right" @click="nextSee" />
299
+ </span>
300
+
301
+ <div v-if="visiblePv" class="p-a" style="height: 82vh">
302
+ <ViewerImg v-if="imgType.test(previewName)" :options="viewerOptions" style="height: 100%">
303
+ <img :src="previewUrl" :alt="previewName" style="display: none" />
304
+ </ViewerImg>
305
+ <component
306
+ :is="previewSameOrg ? 'object' : 'div'"
307
+ v-else
308
+ :key="previewUrl"
309
+ :data="previewUrl"
310
+ style="width: 100%; height: 100%"
311
+ >
312
+ <div class="flex-column flex-c flex-v" style="height: 100%">
313
+ <i class="el-icon-s-release" style="font-size: 60px; color: #999"></i>
314
+ <span style="margin-top: 16px">
315
+ {{ '不支持在线预览,请' | $lc
316
+ }}<el-link type="primary" class="color-primary" @click="downFile(seeRow)">{{ '下载' | $lc }}</el-link
317
+ >{{ '到本地查看' | $lc }}
318
+ </span>
319
+ </div>
320
+ </component>
321
+ </div>
322
+ </Dialog>
323
+ </div>
324
+ </template>
325
+
326
+ <script>
327
+ import _axios from 'axios'
328
+ import auth from '../../utils/auth.js'
329
+ import Upload from '../Upload/index.vue'
330
+ import { $lc } from '../../utils/i18n/index.js'
331
+ import axios from '../../utils/axios.js'
332
+ import { msgboxPor } from '../../utils/msgboxPor'
333
+ import dayjs from 'dayjs'
334
+ import Dialog from '../Dialog/index.vue'
335
+ import 'viewerjs/dist/viewer.css'
336
+ import importG from '../../utils/importGlobal.js'
337
+ import downloadBlob from '../../utils/downloadBlob.js'
338
+
339
+ const ViewerImg = async function () {
340
+ let { component } = await importG('v-viewer', () => import(/*webpackChunkName: "v-viewer"*/ 'v-viewer'))
341
+ return component
342
+ }
343
+
344
+ const keysDefault = {
345
+ rowKey: 'id',
346
+ bussType: 'bussValue',
347
+ type: 'attno',
348
+ name: 'name',
349
+ url: 'url',
350
+ time: 'time',
351
+ user: 'user'
352
+ }
353
+
354
+ export default {
355
+ name: 'ElectronicArchive',
356
+ components: { Dialog, Upload, ViewerImg },
357
+ props: {
358
+ readonly: {
359
+ type: Boolean,
360
+ default: false
361
+ },
362
+ requestPrefix: {
363
+ type: String,
364
+ default: null
365
+ },
366
+ showClear: {
367
+ type: Boolean,
368
+ default: true
369
+ },
370
+ dataProp: {
371
+ type: Object,
372
+ required: true,
373
+ default: () => ({})
374
+ },
375
+ uploadHttpRequest: {
376
+ type: Function,
377
+ default: undefined
378
+ },
379
+ hideUser: {
380
+ type: Boolean,
381
+ default: false
382
+ },
383
+ placeholder: {
384
+ type: String,
385
+ default: $lc('请上传附件')
386
+ },
387
+ getFileMethod: {
388
+ type: Function,
389
+ default: undefined
390
+ },
391
+ callBackFileData: {
392
+ type: Function,
393
+ default: () => {}
394
+ },
395
+ tableData: {
396
+ type: Array,
397
+ default: () => []
398
+ }
399
+ },
400
+ data() {
401
+ this.viewerOptions = {
402
+ debug: true,
403
+ inline: true,
404
+ scalable: false, // 不显示水平(垂直)翻转
405
+ navbar: false,
406
+ button: false,
407
+ title: true,
408
+ toolbar: {
409
+ zoomIn: true,
410
+ zoomOut: true,
411
+ oneToOne: true,
412
+ reset: true,
413
+ rotateLeft: true,
414
+ rotateRight: true,
415
+ flipHorizontal: true,
416
+ flipVertical: true,
417
+ prev: false,
418
+ play: false,
419
+ next: false
420
+ }
421
+ }
422
+ return {
423
+ dayjs,
424
+ multiple: false,
425
+ radio: '',
426
+ action: this.requestPrefix ? this.requestPrefix + '/neams/eamsbaserecord/save' : '/neams/eamsbaserecord/save',
427
+ indexKey: '$index',
428
+ visibleP: false,
429
+ baseVisible: false,
430
+ baseAttnoData: [],
431
+ userInfo: JSON.parse(sessionStorage.getItem('userInfo')),
432
+ row: {},
433
+ imgType: /\.(jpg|png|gif|svg)$/i,
434
+ visiblePv: false,
435
+ seeRow: {},
436
+ isBaseFile: false,
437
+ tableDataC: [],
438
+ previewUrl: '',
439
+ previewName: '',
440
+ bussType: {},
441
+ bussTypeOptions: [],
442
+ filesList: [],
443
+ tempIndex: 1,
444
+ chooseVisible: false,
445
+ typeOptions: [],
446
+ previewSameOrg: false,
447
+ selectionList: []
448
+ }
449
+ },
450
+ watch: {
451
+ tableData: {
452
+ handler(data) {
453
+ if (data.length > 0) {
454
+ this.tableDataC = data
455
+ .map((res, i) => {
456
+ if (res.bussValue !== this.dataProp.bussValue) {
457
+ res.readonly = true
458
+ }
459
+ res.sort = i + 1
460
+ res._name = res.recordname
461
+ return res
462
+ })
463
+ .sort((a, b) => b.sort - a.sort)
464
+ }
465
+ }
466
+ }
467
+ },
468
+ computed: {
469
+ keys() {
470
+ return this.dataProp?.keys || keysDefault
471
+ },
472
+ fileAccept() {
473
+ return this.dataPorp?.fileAccept || undefined
474
+ },
475
+ fileSize() {
476
+ return this.dataPorp?.fileSize || undefined
477
+ },
478
+ fileData() {
479
+ return this.dataPorp?.fileData
480
+ }
481
+ },
482
+ filters: {
483
+ formatDate(date) {
484
+ if (!date) return
485
+ return dayjs(date).format('YYYY-MM-DD HH:mm:ss')
486
+ },
487
+ bussTypeFilter(type, bussTypeOptions) {
488
+ return bussTypeOptions.find((c) => c.bussValue === type)?.bussName || ''
489
+ },
490
+ typeFilter(type, typeOptions) {
491
+ return typeOptions.find((c) => c.attno === type)?.attname || ''
492
+ },
493
+ acceptFilter(type, typeOptions, fileAccept) {
494
+ return typeOptions.find((c) => c.type === type)?.accept || fileAccept
495
+ },
496
+ sizeFilter(type, typeOptions, fileSize) {
497
+ return typeOptions.find((c) => c.type === type)?.size || fileSize
498
+ },
499
+ fileName(row, urlK) {
500
+ if (row['_name']) {
501
+ return row['_name']
502
+ } else if (row[urlK]) {
503
+ let urlArr = row[urlK].split('/')
504
+ let _n = urlArr[urlArr.length - 1]
505
+ return _n ? decodeURI(_n) : undefined
506
+ }
507
+ return undefined
508
+ }
509
+ },
510
+ mounted() {
511
+ this.getBussTypeList()
512
+ this.getAttachList()
513
+ if (this.dataProp.bussId && this.dataProp.bussValue) {
514
+ this.getFileList()
515
+ }
516
+ },
517
+ methods: {
518
+ handleClick(row, index) {
519
+ this.row = row
520
+ this.chooseVisible = true
521
+ this.getBaseData(row)
522
+ },
523
+ getCurrentRow(row) {
524
+ axios.post(
525
+ this.requestPrefix
526
+ ? `${this.requestPrefix}/neams/eamsbaserecord/fileBind/bussId/beid/bussValue`
527
+ : `/neams/eamsbaserecord/fileBind/bussId/beid/bussValue`,
528
+ {
529
+ beid: row.beid,
530
+ beids: [row.beid],
531
+ bussId: this.dataProp.bussId || this.row.bussId,
532
+ bussValue: this.dataProp.bussValue
533
+ }
534
+ )
535
+ this.$set(this.row, 'beid', row.beid)
536
+ this.$set(this.row, [this.keys.name], row.recordname)
537
+ this.$set(this.row, '_typeDisabled', true)
538
+ this.$set(this.row, '_bussTypeDisabled', true)
539
+ this.$set(this.row, '_name', row.recordname)
540
+ this.baseVisible = false
541
+ this.chooseVisible = false
542
+
543
+ this.getFileList(this.row)
544
+ },
545
+ async getFileList(row) {
546
+ const { code, data } = await axios.post(
547
+ this.requestPrefix
548
+ ? `${this.requestPrefix}/neams/eamsbaserecord/queryList?t=${Date.now()}`
549
+ : `/neams/eamsbaserecord/queryList?t=${Date.now()}`,
550
+ {
551
+ bussValue: this.dataProp.bussValue,
552
+ bussId: this.dataProp.bussId || row.bussId
553
+ }
554
+ )
555
+ if (code === 200) {
556
+ if (data.length > 0) {
557
+ this.callBackFileData(this.tableData)
558
+ }
559
+ }
560
+ },
561
+ async getBaseData(row) {
562
+ const { data } = await axios.post(
563
+ this.requestPrefix
564
+ ? `${this.requestPrefix}/neams/eamsBaseFile/qureyPageBaseFile`
565
+ : `/neams/eamsBaseFile/qureyPageBaseFile`,
566
+ {
567
+ current: 1,
568
+ attno: row[this.keys.type],
569
+ pageSize: 200
570
+ }
571
+ )
572
+ this.baseAttnoData = data.records || []
573
+ },
574
+ handleUpload(i) {
575
+ this.$refs['upload' + i].$refs['upload'].$refs['upload-inner'].handleClick()
576
+ },
577
+ httpRequest(options, row) {
578
+ if (this.uploadHttpRequest) {
579
+ return this.uploadHttpRequest(options, row)
580
+ }
581
+ return this.defindHttpRequest(options, row)
582
+ },
583
+ defindHttpRequest(options, row) {
584
+ const formData = new FormData()
585
+ formData.append(options.filename, options.file)
586
+ const data = options.data || [
587
+ {
588
+ syscode: row.syscode, // 系统
589
+ appno: row.appno, // 模块名
590
+ bussValue: row.bussValue, // 业务品种
591
+ attno: row[this.keys.type], // 附件类型
592
+ bussId: row.bussId, // 业务ID
593
+ cltno: this.userInfo.cltno,
594
+ deptno: this.userInfo.cltno,
595
+ memo: options.file.name,
596
+ recordname: options.file.name,
597
+ fileSize: options.file.size
598
+ }
599
+ ]
600
+ formData.append('data', JSON.stringify(data))
601
+ formData.append('date', dayjs().format('YYYY-MM-DD HH:mm:ss') + ',2099-12-31 23:59:59')
602
+ let abort
603
+ let Pro = axios.post(options.action + '?r=' + Math.random(), formData, {
604
+ headers: Object.assign(auth.setHeaders(this.dataProp.headers), {
605
+ 'Content-Type': 'multipart/form-data'
606
+ }),
607
+ loading: false,
608
+ onUploadProgress: (arg) => {
609
+ if (options.onProgress) {
610
+ arg.percent = arg.progress * 100
611
+ options.onProgress(arg)
612
+ }
613
+ },
614
+ cancelToken: new _axios.CancelToken((cancel) => {
615
+ abort = cancel
616
+ })
617
+ })
618
+ Pro.abort = abort
619
+ return Pro
620
+ },
621
+ handleTypeChange(val, row) {
622
+ const { isBaseFile } = this.typeOptions.find((item) => item.attno === val)
623
+ if (isBaseFile === '1') {
624
+ this.$set(row, 'isBaseFile', true)
625
+ } else {
626
+ this.$set(row, 'isBaseFile', false)
627
+ }
628
+ },
629
+ /**
630
+ * 获取业务类型列表
631
+ * @returns {Promise<void>}
632
+ */
633
+ async getBussTypeList() {
634
+ let dto = {
635
+ appno: this.dataProp.appno,
636
+ // bussValue:this.dataProp.bussValue,
637
+ bussValeList: this.dataProp.bussValues
638
+ }
639
+ const { code, data } = await axios.post(
640
+ this.requestPrefix
641
+ ? `${this.requestPrefix}/neams/eamsbusstype/getListByGradeAndBussValue`
642
+ : `/neams/eamsbusstype/getListByGradeAndBussValue`,
643
+ dto
644
+ )
645
+ if (code === 200) {
646
+ this.bussTypeOptions = data || []
647
+ }
648
+ },
649
+ /**
650
+ * 获取附件列表
651
+ * @returns {Promise<void>}
652
+ */
653
+ async getAttachList() {
654
+ const { data, code } = await axios.post(
655
+ this.requestPrefix
656
+ ? `${this.requestPrefix}/neams/eamsattachfile/getByBussValues`
657
+ : `/neams/eamsattachfile/getByBussValues`,
658
+ this.dataProp.bussValues
659
+ )
660
+ if (code === 200) {
661
+ this.typeOptions = data || []
662
+ }
663
+ },
664
+ bussTypeChange(val, row) {
665
+ let bussId = this.bussTypeOptions.find((item) => item.bussValue === val)?.bussId || ''
666
+ this.$set(row, 'bussId', bussId)
667
+ },
668
+ /**
669
+ * 新增
670
+ */
671
+ addRow() {
672
+ this.tableDataC.push({
673
+ [this.keys.rowKey]: 'id' + Date.now(),
674
+ [this.keys.type]: '',
675
+ [this.keys.bussType]: this.bussTypeOptions.length === 1 ? this.bussTypeOptions[0].bussValue : '',
676
+ [this.keys.name]: '',
677
+ [this.keys.url]: '',
678
+ [this.keys.time]: '',
679
+ [this.keys.user]: this.userInfo.uname,
680
+ syscode: this.dataProp.syscode,
681
+ appno: this.dataProp.appno,
682
+ bussId: this.bussTypeOptions.length === 1 ? this.bussTypeOptions[0].bussId : '',
683
+ _bussTypeDisabled: this.bussTypeOptions.length === 1
684
+ })
685
+ this.bussType = this.bussTypeOptions.length === 1 && this.bussTypeOptions[0]
686
+ this.$emit('add-row')
687
+ },
688
+ /**
689
+ * 下载
690
+ */
691
+ downRows() {
692
+ if (!this.selectionList.length) {
693
+ return this.$message({
694
+ message: $lc(`请先勾选要下载的数据!`),
695
+ type: 'warning',
696
+ showClose: true
697
+ })
698
+ }
699
+ // 自行下载
700
+ let filesId = this.selectionList.map((item) => item.beid)
701
+ if (filesId.length === 0) {
702
+ return this.$message.warning('请勾选附件')
703
+ }
704
+ let data = filesId.map((item) => {
705
+ return {
706
+ beid: item
707
+ }
708
+ })
709
+ axios
710
+ .post(
711
+ this.requestPrefix
712
+ ? `${this.requestPrefix}/neams/eamsbaserecord/batchDownloadFiles`
713
+ : `/neams/eamsbaserecord/batchDownloadFiles`,
714
+ data,
715
+ {
716
+ responseType: 'blob'
717
+ }
718
+ )
719
+ .then((res) => {
720
+ if (res) {
721
+ downloadBlob(res, '附件压缩包.zip')
722
+ }
723
+ })
724
+ },
725
+ deleteRows() {
726
+ this.deleteRowsFn(this.selectionList)
727
+ },
728
+ /**
729
+ * 删除
730
+ */
731
+ async deleteRowsFn(rows, update) {
732
+ if (rows.length === 0) {
733
+ this.$message({
734
+ message: '请勾选所需要删除的附件',
735
+ type: 'warning'
736
+ })
737
+ return
738
+ }
739
+ let filesId = []
740
+ rows.forEach((item) => {
741
+ if (item.beid) {
742
+ filesId.push(item.beid)
743
+ }
744
+ })
745
+ // 调接口删除
746
+ if (filesId.length > 0) {
747
+ const res = await axios.post(
748
+ this.requestPrefix ? `${this.requestPrefix}/neams/eamsbaserecord/delete` : `/neams/eamsbaserecord/delete`,
749
+ filesId
750
+ )
751
+ if (res.code === 200) {
752
+ if (!update) {
753
+ this.tableData = this.tableData.filter((item) => filesId.indexOf(item.beid) === -1)
754
+ this.$message.success('删除成功')
755
+ this.callBackFileData(this.tableData)
756
+ }
757
+ }
758
+ }
759
+ // 不调接口删除
760
+ let ids = rows.map((item) => item.id)
761
+ this.tableData = this.tableData.filter((item) => ids.indexOf(item.id) === -1 || item.beid)
762
+ this.callBackFileData(this.tableData)
763
+ },
764
+ beforeUploadFn(file, row) {
765
+ this.$set(row, '_percent', 0)
766
+ this.$set(row, '_status', undefined)
767
+
768
+ let bu = this.$listeners['before-upload'] || this.$listeners['beforeUpload']
769
+ if (bu) return bu(file, row)
770
+ },
771
+ async onSuccessFn(response, file, fileList, row) {
772
+ const { data } = response
773
+ if (row.beid) {
774
+ await this.deleteRows([{ beid: row.beid }], 'update')
775
+ }
776
+ let obj
777
+ let _obj = data[0]
778
+ for (let k in _obj) {
779
+ obj = JSON.parse(_obj[k])
780
+ }
781
+ this.$set(row, '_name', file.name)
782
+
783
+ this.$set(row, '_percent', 100)
784
+ row[this.keys.time] = dayjs().format('YYYY-MM-DD HH:mm:ss')
785
+
786
+ row[this.keys.url] = response.data
787
+ this.$set(row, this.keys.name, file.name)
788
+ this.$set(row, '_status', 'success')
789
+ this.$set(row, '_fileData', obj)
790
+ this.$set(row, 'beid', obj.beid)
791
+ this.$set(row, 'attno', obj.attno)
792
+ this.$set(row, 'recordname', obj.recordname)
793
+ this.$set(row, 'filepath', obj.filepath)
794
+ this.$set(row, 'archiveId', obj.beid)
795
+ this.$set(row, 'creator', obj.creator)
796
+ this.$set(row, '_typeDisabled', true)
797
+ this.chooseVisible = false
798
+ this.callBackFileData(this.tableData)
799
+ },
800
+ closeSee() {
801
+ this.previewUrl && URL.revokeObjectURL(this.previewUrl)
802
+ this.previewUrl = undefined
803
+ this.visiblePvT = setTimeout(() => {
804
+ this.visiblePv = false
805
+ }, 300)
806
+ },
807
+ preSee() {
808
+ let i = this.tableData.findIndex((row) => row === this.seeRow)
809
+ let row = this.tableData[i - 1] || this.tableData[this.tableData.length - 1]
810
+ this.seeFile(row)
811
+ },
812
+ nextSee() {
813
+ let i = this.tableData.findIndex((row) => row === this.seeRow)
814
+ let row = this.tableData[i + 1] || this.tableData[0]
815
+ this.seeFile(row)
816
+ },
817
+ onProgressFn({ percent }, row) {
818
+ this.$set(row, '_percent', percent <= 99 ? Math.round(percent) : 99)
819
+ },
820
+ errorFn(err, file, fileList, row, $index) {
821
+ this.$set(row, '_status', 'exception')
822
+
823
+ let clUpload = this.$refs['upload' + $index]
824
+ /* 重置文件状态,并加入文件队列 */
825
+ file.status = 'ready'
826
+ clUpload.fileList = [file]
827
+
828
+ this.$emit('on-error', file, row)
829
+ },
830
+ abortFn(row, $index) {
831
+ this.$set(row, '_status', 'exception')
832
+
833
+ let clUpload = this.$refs['upload' + $index]
834
+ let elUpload = clUpload.$refs['upload']
835
+
836
+ elUpload.abort()
837
+ },
838
+ anewSubmitFn(row, $index) {
839
+ this.$set(row, '_status', undefined)
840
+ this.$refs['upload' + $index]?.$refs['upload']?.submit()
841
+ },
842
+ seeFile(row) {
843
+ if (this.getFileMethod) {
844
+ this.getFileMethod(row, 'preview')
845
+ return
846
+ }
847
+ this.previewUrl = `/onlinePreview?beid=${row.beid}`
848
+ this.previewName = row.name
849
+ this.previewSameOrg = true
850
+ this.visibleP = true
851
+ clearTimeout(this.visiblePvT)
852
+ this.visiblePv = true
853
+ this.seeRow = row
854
+ },
855
+ async downFile(row) {
856
+ if (this.getFileMethod) {
857
+ this.getFileMethod(row, 'download')
858
+ return
859
+ }
860
+ // 下载
861
+ let blob = await axios.get(
862
+ this.requestPrefix
863
+ ? `${this.requestPrefix}/neams/eamsbaserecord/download/${row.beid}`
864
+ : `/neams/eamsbaserecord/download/${row.beid}`,
865
+ null,
866
+ {
867
+ responseType: 'blob'
868
+ }
869
+ )
870
+ let url = URL.createObjectURL(blob)
871
+ if (url) {
872
+ let aDom = document.createElement('a')
873
+ aDom.href = url
874
+ aDom.download = row.name || blob.name
875
+ aDom.click()
876
+ this.$nextTick(() => {
877
+ aDom = undefined
878
+ row && URL.revokeObjectURL(url)
879
+ })
880
+ }
881
+ }
882
+ }
883
+ }
884
+ </script>