ocpview-plus 1.2.6 → 1.2.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.
@@ -0,0 +1,633 @@
1
+ <template>
2
+ <Card :bordered="false" :padding="0" dis-hover>
3
+ <p v-if="showTitle" @click="toggle" style="cursor:pointer;">
4
+ <Row type="flex" justify="start" align="middle" style="margin-top:14px;margin-bottom:14px">
5
+ <Icon custom='iconfont icon-custom-pack' color="#f3b352" v-show="showGrid" size="14"/>
6
+ <Icon v-show="!showGrid" color="#f3b352" custom='iconfont icon-custom-spread' size="14"/>
7
+ <span style="margin-left:10px;font-size: 14px;font-weight:bold" v-text="myConfig.title"/>
8
+ </Row>
9
+ </p>
10
+ <div style="padding-left:24px">
11
+ <Divider v-if="showTitle" style="margin-top:0px;margin-bottom:10px;"/>
12
+ <!-- <Row v-show="showGrid" type="flex" justify="start" align="middle" :gutter="0" style="margin-bottom:10px;">-->
13
+ <!-- <Button v-if="loadFlag" customIcon="iconfont icon-custom-fileupload" :disabled="btnReadOnly"-->
14
+ <!-- @click="editGrid">上传-->
15
+ <!-- </Button>-->
16
+ <!-- <Button v-else :loading="true">{{ loadingtext }}</Button>-->
17
+ <!-- </Row>-->
18
+ <Upload v-show="false" id="billiviewUp"
19
+ multiple
20
+ ref="billupload"
21
+ :accept="FileAccept"
22
+ :format="FileFormat"
23
+ :data="headers"
24
+ :show-upload-list="false"
25
+ :on-success="handleSuccess"
26
+ :on-exceeded-size="handleMaxSize"
27
+ :before-upload="handleBeforeUpload"
28
+ :on-format-error="handleFormatError"
29
+ :max-size="fileSize"
30
+ :action="uploadfile">
31
+ <a>上传</a>
32
+ </Upload>
33
+ <div v-show="showGrid">
34
+ <EditGridCardS ref="grid" :config="myConfig" :dictData="dictData"></EditGridCardS>
35
+ </div>
36
+ </div>
37
+ <div ref="photo" v-show="false">
38
+ <li><img :src="imgUrl" :data-original="`${imgUrl}`" style="width: 100%; height: 100%;"/></li>
39
+ </div>
40
+ <Modal :styles="{top:'20px', width:'80%'}" title="文本" v-model="txtPanelFlag" :footer-hide="true">
41
+ <div v-html="textStr"/>
42
+ </Modal>
43
+ <Modal :styles="{top:'20px', width:'80%'}" title="PDF" v-model="pdfFlag" :footer-hide="true">
44
+ <div ref="pdf" style="height:630px"/>
45
+ </Modal>
46
+ </Card>
47
+ </template>
48
+ <script>
49
+ import load from '@/components/base/load';
50
+ import EditGridCardS from './editgridcard2.vue';
51
+ import {embed} from 'pdfobject';
52
+ import $ from 'jquery';
53
+ import Viewer from 'viewerjs';
54
+ import Cookies from 'js-cookie';
55
+ import {resolveComponent} from 'vue';
56
+
57
+ export default {
58
+ name: 'mappendix',
59
+ components: {EditGridCardS},
60
+ mixins: [load],
61
+ data () {
62
+ return {
63
+ myConfig: {
64
+ headStyle: '',
65
+ readOnly: false,
66
+ downfile: '',
67
+ delfile: '',
68
+ pdffile: '/mss-sysconf-boot/downloadPdf?filekey=',
69
+ notdelfile: false,
70
+ showfilemode: false,
71
+ filemodedata: [],
72
+ showPage: false,
73
+ fileSize: 20,
74
+ fileNum: 10,
75
+ title: '附件',
76
+ dynamicHeight: true,
77
+ showTitle: true,
78
+ scenetype: '3',
79
+ height: 840,
80
+ items: [{
81
+ label: '操作状态',
82
+ name: 'modflag',
83
+ type: 'ComboBox',
84
+ data: [{code: 'N', name: '初始'}, {code: 'M', name: '待删除'},
85
+ {code: 'I', name: '新增'}, {code: 'D', name: '删除'}],
86
+ visible: false,
87
+ width: 100,
88
+ }, {
89
+ label: '附件类型',
90
+ name: 'filememo',
91
+ type: 'ComboBox',
92
+ dictkey: 'CUSTFILETYPE',
93
+ codeWithName: false,
94
+ width: 300,
95
+ }, {
96
+ label: '文件名称',
97
+ name: 'filename',
98
+ type: 'TextBox'
99
+ }, {
100
+ label: '文件大小',
101
+ name: 'filesize',
102
+ render: this.sizeActionRender,
103
+ width: 120
104
+ }, {
105
+ label: '上传日期',
106
+ name: 'ph_timestamp',
107
+ type: 'DateBox',
108
+ vtype: 'datetime',
109
+ width: 200
110
+ }, {
111
+ label: '操作',
112
+ key: 'action',
113
+ align: 'center',
114
+ render: this.actionRender,
115
+ minWidth: 100
116
+ }]
117
+ },
118
+ loadFlag: false,
119
+ billno: '',
120
+ filememo: '',
121
+ modulecode: '',
122
+ idkey: '',
123
+ showGrid: true,
124
+ uploadfile: '',
125
+ textStr: '',
126
+ imgUrl: '',
127
+ txtPanelFlag: false,
128
+ pdfFlag: false,
129
+ btnReadOnly: false,
130
+ loading: true,
131
+ fileSize: 0,
132
+ initData: [],
133
+ rowBtnData: [
134
+ {
135
+ icon: 'custom-fileupload',
136
+ name: 'upFile',
137
+ text: '上传'
138
+ },
139
+ {
140
+ icon: 'custom-filedel',
141
+ name: 'delFile',
142
+ text: '删除'
143
+ },
144
+ {
145
+ icon: 'custom-filedown',
146
+ name: 'downFile',
147
+ text: '下载'
148
+ },
149
+ {
150
+ icon: 'custom-filesearch',
151
+ name: 'searchFile',
152
+ text: '查看'
153
+ },
154
+ {
155
+ icon: 'custom-filerecall',
156
+ name: 'recall',
157
+ text: '撤回'
158
+ }
159
+ ]
160
+ };
161
+ },
162
+ created () {
163
+ this.myConfig = Object.assign({}, this.myConfig, this.config);
164
+
165
+ if (this.myConfig.showTitle !== undefined) {
166
+ this.showTitle = this.myConfig.showTitle;
167
+ }
168
+
169
+ if (!this.myConfig.downfile) {
170
+ this.myConfig.downfile = this.OmdUrl.downfile;
171
+ }
172
+ if (!this.myConfig.delfile) {
173
+ this.myConfig.delfile = this.OmdUrl.delfile;
174
+ }
175
+ if (!this.myConfig.uploadfile) {
176
+ this.myConfig.uploadfile = this.OmdUrl.uploadfile;
177
+ }
178
+ if (!this.myConfig.pdffile) {
179
+ this.myConfig.pdffile = this.OmdUrl.pdffile;
180
+ }
181
+ this.myConfig.showAddBtn = false;
182
+ this.myConfig.showDelBatchBtn = false;
183
+ this.myConfig.generalOrientation = true;
184
+ if (this.myConfig.fileSize !== undefined) {
185
+ this.fileSize = Number(this.myConfig.fileSize) * 1024;
186
+ }
187
+ if (this.myConfig.notdelfile) {
188
+ this.myConfig.items[0].visible = true;
189
+ } else {
190
+ this.myConfig.items[0].visible = false;
191
+ }
192
+
193
+ if (this.myConfig.uploadfile.indexOf('?') != -1) {
194
+ this.uploadfile = this.myConfig.uploadfile + '&token=' + this.getToken();
195
+ } else {
196
+ this.uploadfile = this.myConfig.uploadfile + '?token=' + this.getToken();
197
+ }
198
+ },
199
+ computed: {
200
+ headers () {
201
+ let obj = {};
202
+ if (this.modulecode) {
203
+ obj.billmoduleid = this.modulecode;
204
+ }
205
+ obj.billno = this.billno;
206
+ obj.scenetype = this.myConfig.scenetype;
207
+ obj.usercode = this.getUserCode()
208
+ obj.username = this.getUserName();
209
+ if (this.myConfig.notdelfile) {
210
+ obj.modflag = 'I';
211
+ }
212
+ if (obj.scenetype === '4') {
213
+ obj.idkey = this.idkey;
214
+ }
215
+ if (this.filememo) {
216
+ obj.filememo = this.filememo;
217
+ }
218
+ return obj;
219
+ },
220
+ FileFormat () {
221
+ if (this.myConfig.fileType) {
222
+ return this.myConfig.fileType;
223
+ } else {
224
+ return [];
225
+ }
226
+ },
227
+ FileAccept () {
228
+ if (this.myConfig.fileType) {
229
+ let str = '';
230
+ this.myConfig.fileType.forEach(e => {
231
+ str = str + '.' + e + ',';
232
+ });
233
+ return str;
234
+ } else {
235
+ return '';
236
+ }
237
+ }
238
+ },
239
+ props: {
240
+ config: {
241
+ type: Object,
242
+ default: null
243
+ },
244
+ dictData: {
245
+ type: Object,
246
+ default:null
247
+ }
248
+ },
249
+ methods: {
250
+ handleFormatError (file) {
251
+ let type = this.myConfig.fileType.join(',');
252
+ this.alert('文件[' + file.name + ']的格式不正确,请上传格式为(' + type + ')的文件');
253
+ this.loadFlag = true;
254
+ },
255
+ toggle () {
256
+ this.showGrid = !this.showGrid;
257
+ },
258
+ setShowGrid (value) {
259
+ this.showGrid = value;
260
+ },
261
+ actionRender (h, params) {
262
+ let btnConfig = {};
263
+ btnConfig.showNum = 4;
264
+ btnConfig.fontStyle = '';
265
+ btnConfig.items = [];
266
+ if (params.row.filekey) {
267
+ let del = this.$Method.copy(this.rowBtnData[1]);
268
+ if (this.myConfig.readOnly) {
269
+ del.readOnly = true;
270
+ }
271
+ btnConfig.items.push(del);
272
+ } else {
273
+ let up = this.$Method.copy(this.rowBtnData[0]);
274
+ if (this.myConfig.readOnly) {
275
+ up.readOnly = true;
276
+ }
277
+ btnConfig.items.push(up);
278
+ }
279
+ btnConfig.items.push(this.$Method.copy(this.rowBtnData[2]));
280
+ if (this.isType(params.row.filetype) !== '0') {
281
+ btnConfig.items.push(this.$Method.copy(this.rowBtnData[3]));
282
+ }
283
+ let recall = this.$Method.copy(this.rowBtnData[4]);
284
+ if (this.myConfig.readOnly) {
285
+ recall.readOnly = true;
286
+ }
287
+ if (this.myConfig.notdelfile) {
288
+ if (params.row.modflag === 'N') {
289
+ btnConfig.items.push(recall);
290
+ }
291
+ }
292
+ return h('div', [
293
+ h(resolveComponent('RowBtnToolbar'), {
294
+ config: btnConfig,
295
+ onDoAction: (val) => {
296
+ if (val.name === 'upFile') {
297
+ this.editGrid(params);
298
+ }
299
+ if (val.name === 'delFile') {
300
+ this.delFile(params);
301
+ }
302
+ if (val.name === 'downFile') {
303
+ this.downFile(params);
304
+ }
305
+ if (val.name === 'searchFile') {
306
+ this.searchFile(params);
307
+ }
308
+ if (val.name === 'recall') {
309
+ this.recall(params);
310
+ }
311
+ }
312
+ })
313
+ ]);
314
+ },
315
+ sizeActionRender (h, params) {
316
+ let fize = Number(params.row.filesize);
317
+ let str = '';
318
+ if (fize < 1024) {
319
+ str = fize + 'B';
320
+ }
321
+ if (fize > 1024 && fize < 1048576) {
322
+ str = parseFloat(fize / 1024).toFixed(2) + 'K';
323
+ }
324
+ if (fize > 1048576 && fize < 1073741824) {
325
+ str = parseFloat(fize / 1048576).toFixed(2) + 'M';
326
+ }
327
+ if (fize > 1073741824) {
328
+ str = parseFloat(fize / 1073741824).toFixed(2) + 'G';
329
+ }
330
+ return h('span', str);
331
+ },
332
+ downFile (params) {
333
+ let downUrl = this.myConfig.downfile + params.row.filekey + "&ent_id=" + this.getEnt_id() + "&token=" + this.getToken();
334
+ window.open(downUrl);
335
+ },
336
+ delCommon (filekey, notdelfile) {
337
+ let delUrl = this.myConfig.delfile + filekey + "&ent_id=" + this.getEnt_id() + "&notdelfile=" + notdelfile + "&token=" + this.getToken();
338
+ $.ajax({
339
+ type: 'GET',
340
+ url: encodeURI(delUrl),
341
+ async: true,
342
+ dataType: 'json'
343
+ });
344
+ },
345
+ delFile (params) {
346
+ if (!this.checkIsEdit()) {
347
+ return;
348
+ }
349
+ if (!this.myConfig.notdelfile) {
350
+ this.delCommon(params.row.filekey, 'N');
351
+ let row = this.$Method.copy(params.row);
352
+ row.filekey = '';
353
+ row.filename = '';
354
+ row.filetype = '';
355
+ row.filesize = '';
356
+ row.inputer = '';
357
+ row.inputer_name = '';
358
+ row.lastmoddate = '';
359
+ row.ph_timestamp = '';
360
+ this.$refs.grid.updateRow(params.index, row);
361
+ // this.$refs.grid.delRow(params.index);
362
+ } else {
363
+ if (params.row.modflag === 'M') {
364
+ this.alert('当前状态不允许删除');
365
+ return;
366
+ }
367
+ if (params.row.modflag === 'I') {
368
+ this.delCommon(params.row.filekey, 'Y');
369
+ this.$refs.grid.delRow(params.index);
370
+ }
371
+ if (params.row.modflag === 'N') {
372
+ let row = this.$Method.copy(params.row);
373
+ row.modflag = 'M';
374
+ this.$refs.grid.updateRow(params.index, row);
375
+ }
376
+ }
377
+ if (this.myConfig.readOnly) {
378
+ this.setReadOnly(false);
379
+ }
380
+ },
381
+ recall (params) {
382
+ if (params.row.modflag !== 'M') {
383
+ this.alert('当前状态不用撤回');
384
+ return;
385
+ }
386
+ let row = this.$Method.copy(params.row);
387
+ row.modflag = 'N';
388
+ this.$refs.grid.updateRow(params.index, row);
389
+ },
390
+ searchFile (params) {
391
+ if (this.isType(params.row.filetype) === '1') {
392
+ this.showTxt(params);
393
+ }
394
+ if (this.isType(params.row.filetype) === '2') {
395
+ this.showPhoto(params);
396
+ }
397
+ if (this.isType(params.row.filetype) === '3') {
398
+ this.showPdf(params);
399
+ }
400
+ },
401
+ handleSuccess (res) {
402
+ this.getFilesInfo(this.billno, this.modulecode, this.myConfig.notdelfile, this.myConfig.scenetype, this.doInitData);
403
+ this.flag = false;
404
+ if (this.myConfig.scenetype === '4') {
405
+ this.loadFlag = true;
406
+ } else {
407
+ this.hideLoading();
408
+ }
409
+ },
410
+ handleMaxSize (file) {
411
+ this.alert('文件[' + file.name + ']的文件大小不允许超过' + this.myConfig.fileSize + 'M');
412
+ if (this.myConfig.scenetype === '4') {
413
+ this.loadFlag = true;
414
+ } else {
415
+ this.hideLoading();
416
+ }
417
+ },
418
+ isType (filetype) {
419
+ var type = '';
420
+ if (!filetype) {
421
+ filetype = '';
422
+ }
423
+ filetype = filetype.toLowerCase();
424
+ if (filetype === 'log' || filetype === 'xml' || filetype === 'txt') {
425
+ type = '1';
426
+ } else if (filetype === 'bmp' || filetype === 'jpg' || filetype === 'png'
427
+ || filetype === 'gif' || filetype === 'jpeg' || filetype === 'apng'
428
+ || filetype === 'svg') {
429
+ type = '2';
430
+ } else if (filetype === 'pdf') {
431
+ type = '3';
432
+ } else {
433
+ type = '0';
434
+ }
435
+ return type;
436
+ },
437
+ setPro (obj) {
438
+ if (obj) {
439
+ this.myConfig = Object.assign({}, this.myConfig, obj);
440
+ }
441
+ },
442
+ setReadOnly (value) {
443
+ let obj = {};
444
+ obj.readOnly = value;
445
+ this.setPro(obj);
446
+ this.$refs.grid.setReadOnly(true);
447
+ this.setBtnReadOnly(value);
448
+ },
449
+ showTxt (params) {
450
+ let downUrl = this.myConfig.downfile + params.row.filekey + '&token=' + this.getToken();
451
+ let htmlObj = $.ajax({
452
+ url: encodeURI(downUrl),
453
+ async: false
454
+ });
455
+ let str = htmlObj.responseText;
456
+ str = str.replace(/\r\n/ig, '<br/>');
457
+ this.textStr = str;
458
+ this.txtPanelFlag = true;
459
+ },
460
+ showPhoto (params) {
461
+ let downUrl = this.myConfig.downfile + params.row.filekey + '&token=' + this.getToken();
462
+ this.imgUrl = downUrl;
463
+ this.$nextTick(() => {
464
+ if (this.viewer == undefined) {
465
+ this.viewer = new Viewer(this.$refs.photo, {
466
+ url: "data-original",
467
+ show: function () {
468
+ this.viewer.update();
469
+ },
470
+ });
471
+ }
472
+ this.viewer.show();
473
+ })
474
+
475
+ },
476
+ showPdf (params) {
477
+ let pdfUrl = this.myConfig.pdffile + params.row.filekey + '&token=' + this.getToken();
478
+ //this.pdfSrc = pdfUrl;
479
+ embed(encodeURI(pdfUrl), this.$refs.pdf);
480
+ //pdfObject.embed(encodeURI(pdfUrl), this.$refs.pdf);
481
+ this.pdfFlag = true;
482
+ },
483
+ getChangeData () {
484
+ return this.$refs.grid.getChangeData();
485
+ },
486
+ setData (key, billmoduleid, idkey) {
487
+ if (key) {
488
+ this.billno = key;
489
+ this.modulecode = billmoduleid;
490
+ this.idkey = idkey;
491
+ if (this.myConfig.scenetype === '4') {
492
+ this.getFilesInfoByIdkey(this.idkey, this.doInitData);
493
+ } else {
494
+ this.getFilesInfo(key, this.modulecode, this.myConfig.notdelfile, '3', this.doInitData);
495
+ }
496
+ this.btnReadOnly = false;
497
+ } else {
498
+ this.btnReadOnly = true;
499
+ this.billno = '';
500
+ this.modulecode = '';
501
+ this.idkey = '';
502
+ this.$refs.grid.setData([]);
503
+ }
504
+ },
505
+ setBillno (value) {
506
+ this.billno = value;
507
+ if (this.billno) {
508
+ this.btnReadOnly = true;
509
+ }
510
+ },
511
+ doInitData (data) {
512
+ this.$refs.grid.setData(data);
513
+ },
514
+ clearData () {
515
+ this.billno = '';
516
+ this.$refs.grid.clearData();
517
+ },
518
+ getData () {
519
+ return this.$refs.grid.getData();
520
+ },
521
+ doCommonAllfile (flag) {
522
+ let data = this.$refs.grid.getData();
523
+ if (data.length === 0) {
524
+ return;
525
+ }
526
+ let usercode = Cookies.get('user_code') ? Cookies.get('user_code') : 0;
527
+ let username = Cookies.get('user_name') ? Cookies.get('user_name') : 0;
528
+ let filekey = '';
529
+ data.forEach(el => {
530
+ if (flag) {
531
+ filekey = filekey + el.filekey + ",";
532
+ } else {
533
+ if (el.modflag === 'M') {
534
+ filekey = filekey + el.filekey + ",";
535
+ }
536
+ }
537
+ });
538
+ if (filekey) {
539
+ filekey = filekey.substring(0, filekey.length - 1);
540
+ } else {
541
+ return;
542
+ }
543
+ let delUrl = this.myConfig.delfile + filekey + "&ent_id=" + this.getEnt_id();
544
+ let token = this.getToken();
545
+ if (token) {
546
+ delUrl = delUrl + '&token=' + token;
547
+ }
548
+ delUrl = delUrl + '&billno=' + this.billno;
549
+ delUrl = delUrl + '&billmoduleid=' + this.modulecode;
550
+ data.forEach(el => {
551
+ delUrl = delUrl + '&filememo=' + el.filememo;
552
+ });
553
+
554
+ let notdelfile = 'N';
555
+ if (this.myConfig.notdelfile) {
556
+ notdelfile = 'Y';
557
+ }
558
+ delUrl = delUrl + '&usercode=' + usercode + '&username=' + username + '&notdelfile=' + notdelfile;
559
+ $.ajax({
560
+ type: 'GET',
561
+ url: encodeURI(delUrl),
562
+ async: true,
563
+ dataType: 'json'
564
+ });
565
+ },
566
+ dellAllfile () {
567
+ this.doCommonAllfile(true);
568
+ },
569
+ updateAllfile () {
570
+ this.doCommonAllfile(false);
571
+ },
572
+ handleBeforeUpload () {
573
+ let check = true;
574
+ if (this.$refs.billupload && this.$refs.billupload.fileList) {
575
+ check = this.$refs.billupload.fileList.length < this.myConfig.fileNum;
576
+ if (!check) {
577
+ this.alert('上传的文件数量过多(一次最多允许上传' + this.myConfig.fileNum + '个文件)');
578
+ }
579
+ }
580
+ if (!this.flag) {
581
+ this.flag = true;
582
+ this.loadingtext = '上传中';
583
+ if (this.myConfig.scenetype === '4') {
584
+ this.loadFlag = false;
585
+ } else {
586
+ this.showLoading();
587
+ }
588
+
589
+ }
590
+ return check;
591
+ },
592
+ editGrid (params) {
593
+ // if (this.myConfig.beforeUpload) {
594
+ // this.myConfig.beforeUpload();
595
+ // }
596
+ if (!this.billno) {
597
+ this.alert('单据主健信息为空,不允许上传');
598
+ return;
599
+ }
600
+ if (this.checkIsEdit()) {
601
+ this.$nextTick(() => {
602
+ this.$refs.billupload.clearFiles();
603
+ });
604
+ if (this.myConfig.readOnly) {
605
+ this.setReadOnly(false);
606
+ }
607
+ this.filememo = params.row.filememo;
608
+ document.querySelector('#billiviewUp input').click();
609
+ }
610
+ },
611
+ isChange () {
612
+ return this.$refs.grid.isChange();
613
+ },
614
+ checkIsEdit () {
615
+ let flag = true;
616
+ if (this.myConfig.editObjectBefore) {
617
+ flag = this.myConfig.editObjectBefore(this.myConfig.name);
618
+ }
619
+ return flag;
620
+ },
621
+ setBtnReadOnly (value) {
622
+ if (!value) {
623
+ if (this.billno) {
624
+ this.btnReadOnly = value;
625
+ }
626
+ } else {
627
+ this.btnReadOnly = value;
628
+ }
629
+ }
630
+
631
+ }
632
+ };
633
+ </script>
@@ -23,6 +23,7 @@ import mBillImport from "./billimport.vue";
23
23
  import mBillListDetails from "./RewriteBillListDetails/index.vue";
24
24
  import mListDetailsV2 from "./RewriteListdetails/indexV2.vue";
25
25
  import mListDetailsV3 from "./RewriteListdetails/indexV3.vue";
26
+ import mAppendixBoxs2 from "./contractappendix.vue";
26
27
  export {
27
28
  RowBtnToolbar,
28
29
  PageCustom,
@@ -48,5 +49,6 @@ export {
48
49
  mBillAsyncImport,
49
50
  mBillListDetails,
50
51
  mListDetailsV2,
51
- mListDetailsV3
52
+ mListDetailsV3,
53
+ mAppendixBoxs2
52
54
  };