doway-coms 2.5.1 → 2.5.3

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 (85) hide show
  1. package/.browserslistrc +2 -2
  2. package/README.md +28 -28
  3. package/package.json +54 -54
  4. package/packages/AuditsList/index.js +7 -7
  5. package/packages/AuditsList/src/index.vue +266 -266
  6. package/packages/BaseButton/index.js +7 -7
  7. package/packages/BaseButton/src/index.vue +241 -241
  8. package/packages/BaseCheckbox/index.js +7 -7
  9. package/packages/BaseCheckbox/src/index.vue +134 -134
  10. package/packages/BaseDate/index.js +7 -7
  11. package/packages/BaseDate/src/index.vue +197 -197
  12. package/packages/BaseDateWeek/index.js +7 -7
  13. package/packages/BaseDateWeek/src/index.vue +163 -163
  14. package/packages/BaseDatetime/index.js +7 -7
  15. package/packages/BaseDatetime/src/index.vue +196 -196
  16. package/packages/BaseFileGroup/index.js +7 -7
  17. package/packages/BaseFileGroup/src/index.vue +724 -775
  18. package/packages/BaseForm/index.js +7 -7
  19. package/packages/BaseForm/src/index.vue +752 -730
  20. package/packages/BaseGantt/index.js +9 -9
  21. package/packages/BaseGantt/src/index.vue +617 -617
  22. package/packages/BaseGrid/index.js +9 -9
  23. package/packages/BaseGrid/src/SeqSetting.vue +278 -278
  24. package/packages/BaseGrid/src/index.vue +3704 -3704
  25. package/packages/BaseGridAdjust/index.js +9 -9
  26. package/packages/BaseGridAdjust/src/index.vue +482 -482
  27. package/packages/BaseInput/index.js +7 -7
  28. package/packages/BaseInput/src/index.vue +164 -164
  29. package/packages/BaseIntervalInput/index.js +7 -7
  30. package/packages/BaseIntervalInput/src/index.vue +310 -310
  31. package/packages/BaseKanbanEmpty/index.js +7 -7
  32. package/packages/BaseKanbanEmpty/src/index.vue +176 -176
  33. package/packages/BaseNumberInput/index.js +7 -7
  34. package/packages/BaseNumberInput/src/index.vue +290 -290
  35. package/packages/BasePagination/index.js +7 -7
  36. package/packages/BasePagination/src/index.vue +91 -91
  37. package/packages/BasePictureCard/index.js +7 -7
  38. package/packages/BasePictureCard/src/index.vue +580 -580
  39. package/packages/BasePrintPreview/index.js +7 -7
  40. package/packages/BasePrintPreview/src/index.vue +129 -129
  41. package/packages/BasePulldown/index.js +7 -7
  42. package/packages/BasePulldown/src/index.vue +1331 -1330
  43. package/packages/BaseSearch/index.js +7 -7
  44. package/packages/BaseSearch/src/index.vue +935 -935
  45. package/packages/BaseSelect/index.js +7 -7
  46. package/packages/BaseSelect/src/index.vue +155 -155
  47. package/packages/BaseSelectMulti/index.js +7 -7
  48. package/packages/BaseSelectMulti/src/index.vue +148 -148
  49. package/packages/BaseTextArea/index.js +7 -7
  50. package/packages/BaseTextArea/src/index.vue +178 -178
  51. package/packages/BaseTime/index.js +7 -7
  52. package/packages/BaseTime/src/index.vue +166 -166
  53. package/packages/BaseTool/index.js +7 -7
  54. package/packages/BaseTool/src/index.vue +349 -349
  55. package/packages/BaseToolStatus/index.js +7 -7
  56. package/packages/BaseToolStatus/src/ApprovalPersonsGroup.vue +41 -41
  57. package/packages/BaseToolStatus/src/index.vue +439 -439
  58. package/packages/BaseTreeSelect/index.js +8 -8
  59. package/packages/BaseTreeSelect/src/index.vue +437 -437
  60. package/packages/LeaveAMessage/index.js +7 -7
  61. package/packages/LeaveAMessage/src/index.vue +601 -601
  62. package/packages/index.js +194 -194
  63. package/packages/styles/default.css +78 -78
  64. package/packages/styles/default.less +84 -84
  65. package/packages/utils/api.js +107 -107
  66. package/packages/utils/auth.js +38 -38
  67. package/packages/utils/common.js +610 -610
  68. package/packages/utils/dom.js +181 -181
  69. package/packages/utils/enum.js +86 -86
  70. package/packages/utils/filters.js +476 -476
  71. package/packages/utils/gridFormat.js +66 -66
  72. package/packages/utils/msg.js +84 -84
  73. package/packages/utils/patchFiles.js +44 -44
  74. package/packages/utils/request.js +178 -178
  75. package/packages/utils/store.js +309 -309
  76. package/vue.config.js +59 -59
  77. package/dist/css/chunk-vendors.7f83d8f9.css +0 -8
  78. package/dist/css/index.7946d50b.css +0 -1
  79. package/dist/favicon.ico +0 -0
  80. package/dist/js/chunk-vendors.28fda91d.js +0 -340
  81. package/dist/js/index.49bc6add.js +0 -2
  82. package/lib/doway-coms.common.js +0 -120397
  83. package/lib/doway-coms.css +0 -1
  84. package/lib/doway-coms.umd.js +0 -120407
  85. package/lib/doway-coms.umd.min.js +0 -328
@@ -1,775 +1,724 @@
1
- <template>
2
- <div style="height:300px">
3
- <splitpanes class="default-theme">
4
- <pane size="20">
5
- <vxe-table :size="'mini'" :height="'100%'" show-overflow highlight-current-row highlight-hover-row
6
- ref="eisTreeView" row-id="id" row-key @current-change="eisCurrentChange" border="inner" :show-header="false"
7
- :data="fileGroupData" :tree-config="{
8
- transform: true,
9
- line: true,
10
- rowField: 'id',
11
- parentField: 'parentId',
12
- expandRowKeys: ['sys_top_folder']
13
- }">
14
- <vxe-column title="菜单权限" tree-node>
15
- <template #default="{ row }">
16
- <span>
17
- <a-icon type="folder-open" v-if="$refs.eisTreeView.isTreeExpandByRow(row)" />
18
- <a-icon v-else type="folder" />
19
- <span>{{ row.name }}</span>
20
- </span>
21
- </template>
22
- </vxe-column>
23
- <vxe-column width="80px">
24
- <template #default="{ row }">
25
- <span>
26
- <span class="button" @click="handleAddSubFolder(row)" v-if="edit === true"><a-icon type="file-add" /></span>
27
- {{ ' ' }}
28
- <span class="button1" @click="handleEditSubFolder(row)"
29
- v-if="edit === true && row.id !== 'sys_top_folder'"><a-icon type="edit" /></span>
30
- </span>
31
- </template>
32
- </vxe-column>
33
- </vxe-table>
34
- <!-- <a-tree :tree-data="fileGroupData" :selectedKeys="currentSelectKey" :replaceFields="{title:'name',key:'id'}" show-icon default-expand-all @select="handleFileGroupSelect">
35
- <a-icon slot="fileGroup" type="folder" />
36
- <template #title="{ name,id }">
37
- <div>
38
- <span>{{ name }}</span>
39
- <span @click="handleAddSubFolder(id)" v-if="edit===true">添加</span>
40
- <span @click="handleEditSubFolder(id,name)" v-if="edit===true && id!=='sys_top_folder'">编辑</span>
41
- </div>
42
- </template>
43
- </a-tree> -->
44
- </pane>
45
- <pane>
46
- <div class="card-view-items">
47
- <div class="card-view-item" :style="{ width: itemWidth + 'px' }" v-for="loopFileData in currentFolderData"
48
- @dblclick="panelFolderDblClick(loopFileData)" :key="loopFileData.id">
49
- {{ loopFileData.name }}
50
- <!-- <button style="position: absolute; padding: 1px 2px; right:2px;bottom:2px"> -->
51
- <div style="position: absolute; padding: 1px 2px; right:2px;bottom:2px" @click="removeAttach(loopFileData)" v-if="edit === true"><a-icon type="delete" /></div>
52
- <!-- </button> -->
53
- <div @click="downloadAttach(loopFileData)" v-if="loopFileData.attachType === 'file' && allowDownload === true">下载
54
- </div>
55
- </div>
56
-
57
- <div class="card-view-item" :style="{ width: itemWidth + 'px' }"
58
- v-if="edit === true && currentSelectKey.length > 0">
59
- <a-upload class="avatar-uploader" :headers="uploadHeaders" :action="uploadData.picAction" :multiple="true"
60
- :data="uploadData" @change="handleAvatarSuccess" :showUploadList="false"
61
- :before-upload="beforeAvatarUpload">
62
- <div style="border: 1px solid #d9d9d9; border-radius: 6px"
63
- :style="{ width: width, height: height, lineHeight: height }">
64
- <a-icon type="plus" class="avatar-uploader-icon" style="text-align: center"
65
- :style="{ width: width, height: height, lineHeight: height }" />
66
- </div>
67
- </a-upload>
68
- </div>
69
- <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
70
- <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
71
- <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
72
- <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
73
- <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
74
- <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
75
- </div>
76
- </pane>
77
- </splitpanes>
78
- <VxeModal v-model="showEditFolder" transfer :height="200" :width="400" destroy-on-close :z-index="999" show-footer>
79
- <template #title>
80
- <span>添加文件夹名称</span>
81
- </template>
82
- <template #default>
83
- <a-input v-model="currentEditFolderValue"></a-input>
84
- </template>
85
- <template #footer>
86
- <vxe-button @click="showEditFolder = false">取消</vxe-button>
87
- <vxe-button status="primary" @click="confirmEditFolder">确定</vxe-button>
88
- </template>
89
- </VxeModal>
90
- </div>
91
- </template>
92
-
93
- <script>
94
- import { notification, Upload, Tree, Icon, Popconfirm, Input } from "ant-design-vue";
95
- import { Checkbox, Modal } from "vxe-table";
96
- import { attachGetAttachUrlApi, attachSearchApi } from "../../utils/api";
97
- import XEUtils from 'xe-utils'
98
- import { Splitpanes, Pane } from 'splitpanes'
99
- import 'splitpanes/dist/splitpanes.css'
100
-
101
- export default {
102
- name: "BaseFileGroup",
103
- components: {
104
- VxeCheckbox: Checkbox,
105
- "a-upload": Upload,
106
- VxeModal: Modal,
107
- Splitpanes, Pane,
108
- 'a-tree': Tree,
109
- 'a-icon': Icon,
110
- 'a-popconfirm': Popconfirm,
111
- 'a-input': Input
112
- },
113
- data() {
114
- return {
115
- showEditFolder: false,
116
- currentEditInfo: {},
117
- currentEditFolderValue: '',
118
- currentSelectKey: [],
119
- fileGroupData: [],
120
- internalRows: [],
121
- itemWidth: 200,
122
- uploadData: {
123
- picType: "",
124
- picAction: "",
125
- resId: "",
126
- },
127
- uploadHeaders: {
128
- Authorization: null,
129
- },
130
- };
131
- },
132
- computed: {
133
- currentFolderData() {
134
- if (this.currentSelectKey.length === 0) {
135
- return []
136
- }
137
- return this.internalRows.filter(p => p.parentId == this.currentSelectKey[0] && p.sysRowState !== 'delete')
138
- }
139
- },
140
- props: {
141
- isStyle: {
142
- type: Boolean,
143
- default: false,
144
- },
145
- showEmptyText: {
146
- type: Boolean,
147
- default: true,
148
- },
149
- picType: {
150
- type: String,
151
- default: "cust",
152
- },
153
- value: {
154
- type: String,
155
- },
156
- resId: {
157
- type: String,
158
- },
159
- dataName: {
160
- type: String,
161
- },
162
- edit: {
163
- // 列信息
164
- type: Boolean,
165
- },
166
- allowDownload: {
167
- // 列信息
168
- type: Boolean,
169
- },
170
- limitSize: {
171
- // 限制上传大小
172
- type: Number,
173
- default: 5,
174
- },
175
- limitType: {
176
- // 限制上传类型
177
- type: Array,
178
- default: () => {
179
- return [];
180
- },
181
- },
182
- formRow: {
183
- type: Object,
184
- default: () => {
185
- return {};
186
- },
187
- },
188
- width: {
189
- type: String,
190
- default: "100px",
191
- },
192
- height: {
193
- type: String,
194
- default: "100px",
195
- },
196
- rows: {
197
- // 表格数据
198
- type: Array,
199
- default: function () {
200
- return [];
201
- },
202
- },
203
- cols: {
204
- // 表格列信息
205
- type: Array,
206
- default: function () {
207
- return [];
208
- },
209
- },
210
- formState: {
211
- // 表格列信息
212
- type: String,
213
- default: "",
214
- },
215
- },
216
- watch: {
217
- rows: {
218
- handler: function (newVal) {
219
- //构造树型结构
220
- this.buildTreeData(newVal)
221
- },
222
- deep: true,
223
- },
224
- resId: {
225
- handler: function (newVal) {
226
- this.uploadData.resId = newVal;
227
- },
228
- },
229
- },
230
- created() {
231
- },
232
- mounted() {
233
- // 请求头加入token
234
- this.uploadHeaders.Authorization = `Bearer ${this.$store.getters.token}`;
235
-
236
- this.internalServiceUrl = attachGetAttachUrlApi();
237
- this.uploadData.picType = this.picType;
238
- this.uploadData.resId = this.resId;
239
- this.uploadData.picAction = this.internalServiceUrl + "/UploadAttach";
240
-
241
- this.buildTreeData(this.rows);
242
- },
243
- methods: {
244
- buildTreeData(tempRows) {
245
- this.internalRows = JSON.parse(JSON.stringify(tempRows))
246
- let tempTopFolder = {
247
- sysRowState: 'view',
248
- parentId: null,
249
- sort: 0,
250
- attachType: 'folder',
251
- name: '文件',
252
- id: 'sys_top_folder',
253
- }
254
- this.internalRows.push(tempTopFolder)
255
- XEUtils.arrayEach(this.internalRows, p => {
256
- if (p.parentId || p.id === 'sys_top_folder') {
257
- return
258
- }
259
- p.parentId = 'sys_top_folder'
260
- })
261
-
262
- //
263
- this.fileGroupData = XEUtils.orderBy(XEUtils.filter(this.internalRows, p => p.attachType === 'folder'), p => p.sort)
264
- console.debug('davistest', this.fileGroupData)
265
- if (this.currentSelectKey.length === 0) {
266
- this.$refs.eisTreeView.setCurrentRow(tempTopFolder)
267
- this.currentSelectKey = [tempTopFolder.id]
268
- }
269
- // this.fileGroupData = XEUtils.toArrayTree(tempFoldRows,{strict:true,sortKey:'sort'})
270
-
271
- // // this.internalRows.push(tempTopFolder)
272
- // this.fileGroupData = [tempTopFolder]
273
- // this.fileGroupData[0].children = XEUtils.toArrayTree(tempFoldRows,{strict:true,sortKey:'sort'})
274
- //构造顶级虚拟父节点
275
-
276
- // this.fileData = XEUtils.filter(tempRows,p=>p.attachType==='file')
277
- },
278
- handleAddSubFolder(rowInfo) {
279
- //添加子项文件夹
280
- this.currentEditInfo = XEUtils.find(this.internalRows, p => p.id === rowInfo.id)
281
- this.currentEditInfo['operation'] = 'add'
282
- this.showEditFolder = true
283
- },
284
- handleEditSubFolder(rowInfo) {
285
- this.currentEditFolderValue = rowInfo.name
286
- //添加子项文件夹
287
- this.currentEditInfo = XEUtils.find(this.internalRows, p => p.id === rowInfo.id)
288
- this.currentEditInfo['operation'] = 'edit'
289
- this.showEditFolder = true
290
- },
291
- eisCurrentChange(scope) {
292
- this.currentSelectKey = [scope.row.id]
293
-
294
- },
295
- confirmEditFolder() {
296
-
297
- let tempRowInfo = this.$refs.eisTreeView.getRowById(this.currentEditInfo.id)
298
- if (this.currentEditInfo.operation === 'add') {
299
- //新增文件夹
300
- let tempAddRowInfo = {
301
- sysRowState: 'add',
302
- parentId: this.currentEditInfo.id,
303
- sort: tempRowInfo.children.length + 1,
304
- attachType: 'folder',
305
- children: [],
306
- name: this.currentEditFolderValue,
307
- id: this.$store.getters.newId() + "",
308
- }
309
- this.internalRows.push(tempAddRowInfo)
310
- this.$refs.eisTreeView.insertAt(tempAddRowInfo, -1)
311
- } else {
312
- let tempInternalRowInfo = XEUtils.find(this.internalRows, p => p.id === this.currentEditInfo.id)
313
- if (tempInternalRowInfo.sysRowState !== 'add') {
314
- tempInternalRowInfo.sysRowState = 'update'
315
- }
316
- tempInternalRowInfo.name = this.currentEditFolderValue
317
- //修改树节点名称
318
- tempRowInfo.name = tempInternalRowInfo.name
319
- }
320
- this.showEditFolder = false
321
- this.currentEditFolderValue = null
322
- },
323
- panelFolderDblClick(loopFileData) {
324
- if (loopFileData.attachType === 'file') {
325
- return
326
- }
327
-
328
- let tempParentRowInfo = this.$refs.eisTreeView.getRowById(loopFileData.parentId)
329
- let tempExpandRows = []
330
- if (tempParentRowInfo) {
331
- tempExpandRows.push(tempParentRowInfo)
332
- }
333
- let tempRowInfo = this.$refs.eisTreeView.getRowById(loopFileData.id)
334
- this.$refs.eisTreeView.setCurrentRow(tempRowInfo)
335
-
336
- tempExpandRows.push(tempRowInfo)
337
- this.$refs.eisTreeView.setTreeExpand(tempExpandRows, true)
338
- this.currentSelectKey = [loopFileData.id]
339
- },
340
- handleFileGroupSelect(selectedKeys) {
341
- if (selectedKeys.length === 0) {
342
- return
343
- }
344
- this.currentSelectKey = selectedKeys
345
- },
346
- getCurrentToken() {
347
- return this.$store.getters.token;
348
- },
349
- /**
350
- * 获取附件信息
351
- */
352
- getAttachInfo(newRows) {
353
- let attachIds = [];
354
- for (let i = 0; i < newRows.length; i++) {
355
- if (newRows[i].attach) {
356
- continue;
357
- }
358
- attachIds.push(newRows[i].attachId);
359
- newRows[i].attach = {
360
- fileName: "",
361
- contentType: "",
362
- content: "",
363
- name: "",
364
- id: newRows[i].attachId,
365
- };
366
- }
367
- if (attachIds.length == 0) {
368
- this.internalRows = newRows;
369
- return;
370
- }
371
- let postData = {
372
- fields: "id,fileName,contentType,name,content,isDefault",
373
- begin: 1,
374
- size: 0,
375
- exp: "id in (",
376
- };
377
- for (let i = 0; i < attachIds.length; i++) {
378
- postData.exp = postData.exp + attachIds[i] + ",";
379
- }
380
- let vm = this;
381
- postData.exp = postData.exp.substr(0, postData.exp.length - 1) + ")";
382
- attachSearchApi(postData)
383
- .then((responseData) => {
384
- for (let i = 0; i < responseData.content.length; i++) {
385
- for (let x = 0; x < newRows.length; x++) {
386
- if (responseData.content[i].id === newRows[x].attachId) {
387
- newRows[x].attach.fileName = responseData.content[i].fileName;
388
- newRows[x].attach.name = responseData.content[i].name;
389
- newRows[x].attach.content = responseData.content[i].content;
390
- newRows[x].attach.contentType =
391
- responseData.content[i].contentType;
392
- // newRows[x].attach.isDefault = false
393
- break;
394
- }
395
- }
396
- }
397
- vm.internalRows = newRows;
398
- })
399
- .catch(() => { });
400
- },
401
- attachFileClick(attachFile) { },
402
- handleAvatarSuccess(info) {
403
- if (info.file.status == "done") {
404
- if (info.file.response.code !== 200) {
405
- alert(info.file.response.msg)
406
- return
407
- }
408
- //添加文件数据
409
- let addRow = {
410
- attachId: info.file.response.content.id,
411
- sysRowState: 'add',
412
- parentId: this.currentSelectKey[0],
413
- fileType: info.file.response.content.fileType,
414
- sort: this.internalRows.length + 1,
415
- attachType: 'file',
416
- name: info.file.response.content.name,
417
- id: this.$store.getters.newId() + "",
418
- }
419
- this.internalRows.push(addRow);
420
- let tempField;
421
- for (let i = 0; i < this.cols.length; i++) {
422
- // 赋值关联字段数据
423
- let tempValue = addRow;
424
- tempField = this.cols[i].field;
425
- if (this.cols[i].isAuto) {
426
- tempValue[tempField] = this.$store.getters.newId() + "";
427
- continue;
428
- }
429
- if (
430
- this.cols[i].controlType === "text" &&
431
- this.cols[i].linkValueField !== null &&
432
- this.cols[i].linkValueField !== "" &&
433
- this.cols[i].linkValueField !== undefined
434
- ) {
435
- tempValue[tempField] = this.formRow[this.cols[i].linkValueField];
436
- }
437
- }
438
- //通知父组件
439
- this.$emit(
440
- "add",
441
- this.dataName,
442
- info.file.response.content
443
- );
444
- console.debug(this.internalRows)
445
- }
446
- },
447
- beforeAvatarUpload(file) {
448
- // const isPic = file.type === 'image/jpeg' || file.type === 'image/png'
449
- if (file.size / 1024 / 1024 > this.limitSize) {
450
- notification.error({
451
- message: "错误",
452
- description: "上传图片大小不能超过 " + this.limitSize + "MB!",
453
- });
454
- }
455
- if (this.limitType.length > 0 && !this.limitType[file.type]) {
456
- notification.error({
457
- message: "错误",
458
- description: "上传附件格式错误!",
459
- });
460
- }
461
- return true;
462
- },
463
- handleRemove(file, fileList) {
464
- // this.dialogVisible = !this.dialogVisible
465
- // alert(this.dialogVisible)
466
- this.internalUrls = fileList;
467
- this.$emit("remove", this.dataName, file.response.data);
468
- // this.$emit('remove', this.dataName, file.response.data)
469
- },
470
- circleAttach(attachFile, internalRow) {
471
- let vm = this;
472
- // if(internalRow.isDefault == true){
473
- this.internalRows.forEach((element) => {
474
- if (element.id !== internalRow.id) {
475
- element.isDefault = false;
476
- }
477
- });
478
- // }
479
- },
480
- removeAttach(attachFile) {
481
- //检查是否存在子项文件夹或者文件需要删除
482
- let tempChild = XEUtils.find(this.internalRows, p => p.parentId == attachFile.id && p.sysRowState !== 'delete')
483
- if (tempChild) {
484
- notification.error({
485
- message: "错误",
486
- description: "存在子项文件夹或者文件,请先删除子项文件夹或者文件!",
487
- });
488
- return
489
- }
490
- // console.debug(attachFile)
491
- for (let i = 0; i < this.internalRows.length; i++) {
492
- if (this.internalRows[i].id === attachFile.id) {
493
- if (this.internalRows[i].sysRowState === 'add') {
494
- this.internalRows.splice(i, 1);
495
- } else {
496
- this.$set(this.internalRows[i], "sysRowState", 'delete');
497
- }
498
- break;
499
- }
500
- }
501
- this.$emit("remove", attachFile.id);
502
- },
503
- downloadAttach(attachFile) {
504
- window.open(
505
- this.internalServiceUrl +
506
- "/DownAttachFile/" +
507
- attachFile.attachId +
508
- `?accessToken=${this.$store.getters.token}`
509
- );
510
- },
511
- getUpdateRows() {
512
- //先获取删除数据,因为前台删除一个明细后又添加相同的明细后台会
513
- //报唯一索引错误,因为后台也是先添加然后再是删除的会照成问题
514
- //所有就要把删除的放在数组的第一个传递过去,这样后台就先删除然后再新增了
515
- let tempRemoveRows = XEUtils.filter(this.internalRows, p => p.sysRowState === 'delete' && p.id !== 'sys_top_folder')
516
- let tempAddRows = XEUtils.filter(this.internalRows, p => p.sysRowState === 'add' && p.id !== 'sys_top_folder')
517
- let tempUpdateRows = XEUtils.filter(this.internalRows, p => p.sysRowState === 'update' && p.id !== 'sys_top_folder')
518
- let tempRows = XEUtils.union(tempRemoveRows, tempAddRows, tempUpdateRows)
519
- XEUtils.arrayEach(tempRows, p => {
520
- if (p.parentId === 'sys_top_folder') {
521
- p.parentId = null
522
- }
523
- })
524
- return tempRows
525
- },
526
- /**
527
- * 查看附件
528
- */
529
- viewAttach(attachFile) {
530
- if (attachFile.contentType === "application/pdf") {
531
- this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
532
- this.dialogViewType = attachFile.contentType;
533
- this.dialogVisible = true;
534
- } else if (attachFile.content === "image") {
535
- this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
536
- this.dialogViewType = attachFile.contentType;
537
- this.dialogVisible = true;
538
- }
539
- this.currentFileTitle = attachFile.name
540
- },
541
- closePdf() {
542
- this.isShowPdf = false;
543
- },
544
- },
545
- };
546
- </script>
547
-
548
- <style lang="scss" scoped>
549
-
550
- .button {
551
- display: inline-block;
552
- padding: 1px 6px;
553
- background-color: #4CAF50;
554
- color: white;
555
- border: none;
556
- border-radius: 4px;
557
- cursor: pointer;
558
- transition: background-color 0.3s ease;
559
- }
560
-
561
- .button:hover {
562
- background-color: #45a049;
563
- }
564
-
565
- .button:active {
566
- background-color: #408E43;
567
- transform: translateY(2px);
568
- }
569
-
570
- .button1 {
571
- display: inline-block;
572
- padding: 1px 6px;
573
- background-color: #3a61b6;
574
- color: white;
575
- border: none;
576
- border-radius: 4px;
577
- cursor: pointer;
578
- transition: background-color 0.3s ease;
579
- }
580
-
581
- .button1:hover {
582
- background-color: #3a61b6;
583
- }
584
-
585
- .button1:active {
586
- background-color: #3a61b6;
587
- transform: translateY(2px);
588
- }
589
-
590
- .file-card {
591
- display: flex;
592
- flex-flow: row wrap;
593
- margin: 0 0 5px 5px;
594
-
595
- .attach-wrapper {
596
- .attach {
597
- position: relative;
598
- margin-right: 5px;
599
-
600
- .attach-delete {
601
- position: absolute;
602
- top: -2px;
603
- right: -4px;
604
- opacity: 0;
605
- font-size: 20px;
606
- background-color: red;
607
- }
608
-
609
- .attach-delete:hover {
610
- cursor: pointer;
611
- }
612
-
613
- .attach-download {
614
- position: absolute;
615
- bottom: 10px;
616
- left: 4px;
617
- opacity: 0;
618
- font-size: 18px;
619
- font-weight: bolder;
620
- border: 1px solid #ccc;
621
- border-radius: 50%;
622
- border-color: transparent;
623
- //background-color: rgb(255, 1, 1);
624
- color: #000;
625
- }
626
-
627
- .attach-download:hover {
628
- cursor: pointer;
629
- color: rgb(189, 8, 8);
630
- }
631
-
632
- .attach-view {
633
- position: absolute;
634
- bottom: 10px;
635
- right: 4px;
636
- opacity: 0;
637
- font-size: 18px;
638
- font-weight: bolder;
639
- border: 1px solid #ccc;
640
- border-radius: 50%;
641
- border-color: transparent;
642
- //background-color: #666;
643
- color: #000;
644
- }
645
-
646
- .attach-circle {
647
- position: absolute;
648
- // bottom: 10px;
649
- top: 2px;
650
- left: 4px;
651
- opacity: 0;
652
- }
653
-
654
- .attach-view:hover {
655
- cursor: pointer;
656
- color: rgb(189, 8, 8);
657
- }
658
- }
659
-
660
- .attach:hover>.attach-delete {
661
- opacity: 0.8;
662
- }
663
-
664
- .attach:hover>.attach-download {
665
- opacity: 0.7;
666
- }
667
-
668
- .attach:hover>.attach-view {
669
- opacity: 0.7;
670
- }
671
-
672
- .attach:hover>.attach-circle {
673
- opacity: 0.9;
674
- }
675
- }
676
- }
677
-
678
- .tree-node-icon {
679
- width: 16px;
680
- text-align: center;
681
- }
682
-
683
- .avatar-uploader .el-upload {
684
- border: 1px solid #d9d9d9;
685
-
686
- border-radius: 6px;
687
- cursor: pointer;
688
- position: relative;
689
- overflow: hidden;
690
- }
691
-
692
- .avatar-uploader .el-upload:hover {
693
- border-color: #409eff;
694
- }
695
-
696
- .avatar-uploader-icon {
697
- font-size: 28px;
698
- color: #8c939d;
699
- // width: 178px;
700
- // height: 178px;
701
- line-height: 178px;
702
- text-align: center;
703
- }
704
-
705
- .avatar {
706
- // width: 178px;
707
- // height: 178px;
708
- display: block;
709
- }
710
-
711
- .el-upload-list__item is-success {
712
- float: left;
713
- }
714
-
715
- .currentHeight {
716
- display: flex;
717
- align-items: center;
718
- }
719
-
720
- .card-view-items {
721
- // margin-top: 100px;
722
- // margin-left: 100px;
723
- // margin-right: 100px;
724
- display: flex;
725
- flex-flow: row wrap;
726
- justify-content: flex-start;
727
- padding: 8px 8px 8px 8px;
728
- overflow-y: auto;
729
-
730
- .card-view-item-ghost {
731
- visibility: hidden;
732
- height: 0px !important;
733
- min-height: 0px !important;
734
- margin-top: 0px;
735
- margin-bottom: 0px;
736
- padding: 0px 0px 0px 0px;
737
- }
738
-
739
- .card-view-item {
740
- cursor: pointer;
741
- // height: 100px;
742
- // margin-top: 4px;
743
- // margin-right: 8px;
744
- // margin-bottom: 4px;
745
- // margin-left: 8px;
746
- flex-grow: 1;
747
- flex-shrink: 1;
748
- flex-basis: auto;
749
- border: 1px solid #9ad4dc;
750
- margin-top: 4px;
751
- margin-right: 8px;
752
- margin-bottom: 4px;
753
- margin-left: 8px;
754
- padding: 8px 8px 8px 8px;
755
- //border-color: #9ad4dc;
756
- min-width: 150px;
757
- border-radius: 6px;
758
- position: relative;
759
-
760
- .card-view-icon {
761
- float: left;
762
- width: 64px;
763
- height: 64px;
764
- }
765
-
766
- // .card-view-desc {
767
- // padding-left: 85px;
768
- // }
769
- }
770
-
771
- .card-view-item:hover {
772
- border: 1px solid #1269db;
773
- }
774
- }
775
- </style>
1
+ <template>
2
+ <div style="height:300px">
3
+ <splitpanes class="default-theme">
4
+ <pane>
5
+ <vxe-table :size="'mini'" :height="'100%'" show-overflow highlight-current-row highlight-hover-row
6
+ ref="eisTreeView" row-id="id" row-key @current-change="eisCurrentChange" border="inner" :show-header="false"
7
+ :data="fileGroupData" :tree-config="{
8
+ transform: true,
9
+ line: true,
10
+ rowField: 'id',
11
+ parentField: 'parentId',
12
+ expandRowKeys: ['sys_top_folder']
13
+ }">
14
+ <vxe-column title="菜单权限" tree-node>
15
+ <template #default="{ row }">
16
+ <span>
17
+ <a-icon type="folder-open" v-if="$refs.eisTreeView.isTreeExpandByRow(row)" />
18
+ <a-icon v-else type="folder" />
19
+ <span>{{ row.name }}</span>
20
+ <span @click="handleAddSubFolder(row)" v-if="edit === true">添加</span>
21
+ <span @click="handleEditSubFolder(row)" v-if="edit === true && row.id !== 'sys_top_folder'">编辑</span>
22
+ </span>
23
+ </template>
24
+ </vxe-column>
25
+ </vxe-table>
26
+ <!-- <a-tree :tree-data="fileGroupData" :selectedKeys="currentSelectKey" :replaceFields="{title:'name',key:'id'}" show-icon default-expand-all @select="handleFileGroupSelect">
27
+ <a-icon slot="fileGroup" type="folder" />
28
+ <template #title="{ name,id }">
29
+ <div>
30
+ <span>{{ name }}</span>
31
+ <span @click="handleAddSubFolder(id)" v-if="edit===true">添加</span>
32
+ <span @click="handleEditSubFolder(id,name)" v-if="edit===true && id!=='sys_top_folder'">编辑</span>
33
+ </div>
34
+ </template>
35
+ </a-tree> -->
36
+ </pane>
37
+ <pane>
38
+ <div class="card-view-items">
39
+ <div class="card-view-item" :style="{ width: itemWidth + 'px' }" v-for="loopFileData in currentFolderData"
40
+ @dblclick="panelFolderDblClick(loopFileData)" :key="loopFileData.id">
41
+ {{ loopFileData.name }}
42
+ <div @click="removeAttach(loopFileData)" v-if="edit === true">删除</div>
43
+ <div @click="downloadAttach(loopFileData)"
44
+ v-if="loopFileData.attachType === 'file' && allowDownload === true">下载
45
+ </div>
46
+ </div>
47
+
48
+ <div class="card-view-item" :style="{ width: itemWidth + 'px' }"
49
+ v-if="edit === true && currentSelectKey.length > 0">
50
+ <a-upload class="avatar-uploader" :headers="uploadHeaders" :action="uploadData.picAction" :multiple="true"
51
+ :data="uploadData" @change="handleAvatarSuccess" :showUploadList="false"
52
+ :before-upload="beforeAvatarUpload">
53
+ <div style="border: 1px solid #d9d9d9; border-radius: 6px"
54
+ :style="{ width: width, height: height, lineHeight: height }">
55
+ <a-icon type="plus" class="avatar-uploader-icon" style="text-align: center"
56
+ :style="{ width: width, height: height, lineHeight: height }" />
57
+ </div>
58
+ </a-upload>
59
+ </div>
60
+ <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
61
+ <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
62
+ <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
63
+ <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
64
+ <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
65
+ <div class="card-view-item card-view-item-ghost" :style="{ width: itemWidth + 'px' }"></div>
66
+ </div>
67
+ </pane>
68
+ </splitpanes>
69
+ <VxeModal v-model="showEditFolder" transfer :height="200" :width="400" destroy-on-close :z-index="999" show-footer>
70
+ <template #title>
71
+ <span>文件夹修改</span>
72
+ </template>
73
+ <template #default>
74
+ <a-input v-model="currentEditFolderValue"></a-input>
75
+ </template>
76
+ <template #footer>
77
+ <vxe-button @click="showEditFolder = false">取消</vxe-button>
78
+ <vxe-button status="primary" @click="confirmEditFolder">确定</vxe-button>
79
+ </template>
80
+ </VxeModal>
81
+ </div>
82
+ </template>
83
+
84
+ <script>
85
+ import { notification, Upload, Tree, Icon, Popconfirm, Input } from "ant-design-vue";
86
+ import { Checkbox, Modal } from "vxe-table";
87
+ import { attachGetAttachUrlApi, attachSearchApi } from "../../utils/api";
88
+ import XEUtils from 'xe-utils'
89
+ import { Splitpanes, Pane } from 'splitpanes'
90
+ import 'splitpanes/dist/splitpanes.css'
91
+
92
+ export default {
93
+ name: "BaseFileGroup",
94
+ components: {
95
+ VxeCheckbox: Checkbox,
96
+ "a-upload": Upload,
97
+ VxeModal: Modal,
98
+ Splitpanes, Pane,
99
+ 'a-tree': Tree,
100
+ 'a-icon': Icon,
101
+ 'a-popconfirm': Popconfirm,
102
+ 'a-input': Input
103
+ },
104
+ data() {
105
+ return {
106
+ showEditFolder: false,
107
+ currentEditInfo: {},
108
+ currentEditFolderValue: '',
109
+ currentSelectKey: [],
110
+ fileGroupData: [],
111
+ internalRows: [],
112
+ itemWidth: 200,
113
+ uploadData: {
114
+ picType: "",
115
+ picAction: "",
116
+ resId: "",
117
+ },
118
+ uploadHeaders: {
119
+ Authorization: null,
120
+ },
121
+ };
122
+ },
123
+ computed: {
124
+ currentFolderData() {
125
+ if (this.currentSelectKey.length === 0) {
126
+ return []
127
+ }
128
+ return this.internalRows.filter(p => p.parentId == this.currentSelectKey[0] && p.sysRowState !== 'delete')
129
+ }
130
+ },
131
+ props: {
132
+ isStyle: {
133
+ type: Boolean,
134
+ default: false,
135
+ },
136
+ showEmptyText: {
137
+ type: Boolean,
138
+ default: true,
139
+ },
140
+ picType: {
141
+ type: String,
142
+ default: "cust",
143
+ },
144
+ value: {
145
+ type: String,
146
+ },
147
+ resId: {
148
+ type: String,
149
+ },
150
+ dataName: {
151
+ type: String,
152
+ },
153
+ edit: {
154
+ // 列信息
155
+ type: Boolean,
156
+ },
157
+ allowDownload: {
158
+ // 列信息
159
+ type: Boolean,
160
+ },
161
+ limitSize: {
162
+ // 限制上传大小
163
+ type: Number,
164
+ default: 5,
165
+ },
166
+ limitType: {
167
+ // 限制上传类型
168
+ type: Array,
169
+ default: () => {
170
+ return [];
171
+ },
172
+ },
173
+ formRow: {
174
+ type: Object,
175
+ default: () => {
176
+ return {};
177
+ },
178
+ },
179
+ width: {
180
+ type: String,
181
+ default: "100px",
182
+ },
183
+ height: {
184
+ type: String,
185
+ default: "100px",
186
+ },
187
+ rows: {
188
+ // 表格数据
189
+ type: Array,
190
+ default: function () {
191
+ return [];
192
+ },
193
+ },
194
+ cols: {
195
+ // 表格列信息
196
+ type: Array,
197
+ default: function () {
198
+ return [];
199
+ },
200
+ },
201
+ formState: {
202
+ // 表格列信息
203
+ type: String,
204
+ default: "",
205
+ },
206
+ },
207
+ watch: {
208
+ rows: {
209
+ handler: function (newVal) {
210
+ //构造树型结构
211
+ this.buildTreeData(newVal)
212
+ },
213
+ deep: true,
214
+ },
215
+ resId: {
216
+ handler: function (newVal) {
217
+ this.uploadData.resId = newVal;
218
+ },
219
+ },
220
+ },
221
+ created() {
222
+ },
223
+ mounted() {
224
+ // 请求头加入token
225
+ this.uploadHeaders.Authorization = `Bearer ${this.$store.getters.token}`;
226
+
227
+ this.internalServiceUrl = attachGetAttachUrlApi();
228
+ this.uploadData.picType = this.picType;
229
+ this.uploadData.resId = this.resId;
230
+ this.uploadData.picAction = this.internalServiceUrl + "/UploadAttach";
231
+
232
+ this.buildTreeData(this.rows);
233
+ },
234
+ methods: {
235
+ buildTreeData(tempRows) {
236
+ this.internalRows = JSON.parse(JSON.stringify(tempRows))
237
+ let tempTopFolder = {
238
+ sysRowState: 'view',
239
+ parentId: null,
240
+ sort: 0,
241
+ attachType: 'folder',
242
+ name: '文件',
243
+ id: 'sys_top_folder',
244
+ }
245
+ this.internalRows.push(tempTopFolder)
246
+ XEUtils.arrayEach(this.internalRows, p => {
247
+ if (p.parentId || p.id === 'sys_top_folder') {
248
+ return
249
+ }
250
+ p.parentId = 'sys_top_folder'
251
+ })
252
+
253
+ //
254
+ this.fileGroupData = XEUtils.orderBy(XEUtils.filter(this.internalRows, p => p.attachType === 'folder'), p => p.sort)
255
+ console.debug('davistest', this.fileGroupData)
256
+ if (this.currentSelectKey.length === 0) {
257
+ this.$refs.eisTreeView.setCurrentRow(tempTopFolder)
258
+ this.currentSelectKey = [tempTopFolder.id]
259
+ }
260
+ // this.fileGroupData = XEUtils.toArrayTree(tempFoldRows,{strict:true,sortKey:'sort'})
261
+
262
+ // // this.internalRows.push(tempTopFolder)
263
+ // this.fileGroupData = [tempTopFolder]
264
+ // this.fileGroupData[0].children = XEUtils.toArrayTree(tempFoldRows,{strict:true,sortKey:'sort'})
265
+ //构造顶级虚拟父节点
266
+
267
+ // this.fileData = XEUtils.filter(tempRows,p=>p.attachType==='file')
268
+ },
269
+ handleAddSubFolder(rowInfo) {
270
+ //添加子项文件夹
271
+ this.currentEditInfo = XEUtils.find(this.internalRows, p => p.id === rowInfo.id)
272
+ this.currentEditInfo['operation'] = 'add'
273
+ this.showEditFolder = true
274
+ },
275
+ handleEditSubFolder(rowInfo) {
276
+ this.currentEditFolderValue = rowInfo.name
277
+ //添加子项文件夹
278
+ this.currentEditInfo = XEUtils.find(this.internalRows, p => p.id === rowInfo.id)
279
+ this.currentEditInfo['operation'] = 'edit'
280
+ this.showEditFolder = true
281
+ },
282
+ eisCurrentChange(scope) {
283
+ this.currentSelectKey = [scope.row.id]
284
+
285
+ },
286
+ confirmEditFolder() {
287
+
288
+ let tempRowInfo = this.$refs.eisTreeView.getRowById(this.currentEditInfo.id)
289
+ if (this.currentEditInfo.operation === 'add') {
290
+ //新增文件夹
291
+ let tempAddRowInfo = {
292
+ sysRowState: 'add',
293
+ parentId: this.currentEditInfo.id,
294
+ sort: tempRowInfo.children.length + 1,
295
+ attachType: 'folder',
296
+ children: [],
297
+ name: this.currentEditFolderValue,
298
+ id: this.$store.getters.newId() + "",
299
+ }
300
+ this.internalRows.push(tempAddRowInfo)
301
+ this.$refs.eisTreeView.insertAt(tempAddRowInfo, -1)
302
+ } else {
303
+ let tempInternalRowInfo = XEUtils.find(this.internalRows, p => p.id === this.currentEditInfo.id)
304
+ if (tempInternalRowInfo.sysRowState !== 'add') {
305
+ tempInternalRowInfo.sysRowState = 'update'
306
+ }
307
+ tempInternalRowInfo.name = this.currentEditFolderValue
308
+ //修改树节点名称
309
+ tempRowInfo.name = tempInternalRowInfo.name
310
+ }
311
+ this.showEditFolder = false
312
+ this.currentEditFolderValue = null
313
+ },
314
+ panelFolderDblClick(loopFileData) {
315
+ if (loopFileData.attachType === 'file') {
316
+ return
317
+ }
318
+
319
+ let tempParentRowInfo = this.$refs.eisTreeView.getRowById(loopFileData.parentId)
320
+ let tempExpandRows = []
321
+ if (tempParentRowInfo) {
322
+ tempExpandRows.push(tempParentRowInfo)
323
+ }
324
+ let tempRowInfo = this.$refs.eisTreeView.getRowById(loopFileData.id)
325
+ this.$refs.eisTreeView.setCurrentRow(tempRowInfo)
326
+
327
+ tempExpandRows.push(tempRowInfo)
328
+ this.$refs.eisTreeView.setTreeExpand(tempExpandRows, true)
329
+ this.currentSelectKey = [loopFileData.id]
330
+ },
331
+ handleFileGroupSelect(selectedKeys) {
332
+ if (selectedKeys.length === 0) {
333
+ return
334
+ }
335
+ this.currentSelectKey = selectedKeys
336
+ },
337
+ getCurrentToken() {
338
+ return this.$store.getters.token;
339
+ },
340
+ /**
341
+ * 获取附件信息
342
+ */
343
+ getAttachInfo(newRows) {
344
+ let attachIds = [];
345
+ for (let i = 0; i < newRows.length; i++) {
346
+ if (newRows[i].attach) {
347
+ continue;
348
+ }
349
+ attachIds.push(newRows[i].attachId);
350
+ newRows[i].attach = {
351
+ fileName: "",
352
+ contentType: "",
353
+ content: "",
354
+ name: "",
355
+ id: newRows[i].attachId,
356
+ };
357
+ }
358
+ if (attachIds.length == 0) {
359
+ this.internalRows = newRows;
360
+ return;
361
+ }
362
+ let postData = {
363
+ fields: "id,fileName,contentType,name,content,isDefault",
364
+ begin: 1,
365
+ size: 0,
366
+ exp: "id in (",
367
+ };
368
+ for (let i = 0; i < attachIds.length; i++) {
369
+ postData.exp = postData.exp + attachIds[i] + ",";
370
+ }
371
+ let vm = this;
372
+ postData.exp = postData.exp.substr(0, postData.exp.length - 1) + ")";
373
+ attachSearchApi(postData)
374
+ .then((responseData) => {
375
+ for (let i = 0; i < responseData.content.length; i++) {
376
+ for (let x = 0; x < newRows.length; x++) {
377
+ if (responseData.content[i].id === newRows[x].attachId) {
378
+ newRows[x].attach.fileName = responseData.content[i].fileName;
379
+ newRows[x].attach.name = responseData.content[i].name;
380
+ newRows[x].attach.content = responseData.content[i].content;
381
+ newRows[x].attach.contentType =
382
+ responseData.content[i].contentType;
383
+ // newRows[x].attach.isDefault = false
384
+ break;
385
+ }
386
+ }
387
+ }
388
+ vm.internalRows = newRows;
389
+ })
390
+ .catch(() => { });
391
+ },
392
+ attachFileClick(attachFile) { },
393
+ handleAvatarSuccess(info) {
394
+ if (info.file.status == "done") {
395
+ if (info.file.response.code !== 200) {
396
+ alert(info.file.response.msg)
397
+ return
398
+ }
399
+ //添加文件数据
400
+ let addRow = {
401
+ attachId: info.file.response.content.id,
402
+ sysRowState: 'add',
403
+ parentId: this.currentSelectKey[0],
404
+ fileType: info.file.response.content.fileType,
405
+ sort: this.internalRows.length + 1,
406
+ attachFile: 'file',
407
+ name: info.file.response.content.name,
408
+ id: this.$store.getters.newId() + "",
409
+ }
410
+ this.internalRows.push(addRow);
411
+ let tempField;
412
+ for (let i = 0; i < this.cols.length; i++) {
413
+ // 赋值关联字段数据
414
+ let tempValue = addRow;
415
+ tempField = this.cols[i].field;
416
+ if (this.cols[i].isAuto) {
417
+ tempValue[tempField] = this.$store.getters.newId() + "";
418
+ continue;
419
+ }
420
+ if (
421
+ this.cols[i].controlType === "text" &&
422
+ this.cols[i].linkValueField !== null &&
423
+ this.cols[i].linkValueField !== "" &&
424
+ this.cols[i].linkValueField !== undefined
425
+ ) {
426
+ tempValue[tempField] = this.formRow[this.cols[i].linkValueField];
427
+ }
428
+ }
429
+ //通知父组件
430
+ this.$emit(
431
+ "add",
432
+ this.dataName,
433
+ info.file.response.content
434
+ );
435
+ console.debug(this.internalRows)
436
+ }
437
+ },
438
+ beforeAvatarUpload(file) {
439
+ // const isPic = file.type === 'image/jpeg' || file.type === 'image/png'
440
+ if (file.size / 1024 / 1024 > this.limitSize) {
441
+ notification.error({
442
+ message: "错误",
443
+ description: "上传图片大小不能超过 " + this.limitSize + "MB!",
444
+ });
445
+ }
446
+ if (this.limitType.length > 0 && !this.limitType[file.type]) {
447
+ notification.error({
448
+ message: "错误",
449
+ description: "上传附件格式错误!",
450
+ });
451
+ }
452
+ return true;
453
+ },
454
+ handleRemove(file, fileList) {
455
+ // this.dialogVisible = !this.dialogVisible
456
+ // alert(this.dialogVisible)
457
+ this.internalUrls = fileList;
458
+ this.$emit("remove", this.dataName, file.response.data);
459
+ // this.$emit('remove', this.dataName, file.response.data)
460
+ },
461
+ circleAttach(attachFile, internalRow) {
462
+ let vm = this;
463
+ // if(internalRow.isDefault == true){
464
+ this.internalRows.forEach((element) => {
465
+ if (element.id !== internalRow.id) {
466
+ element.isDefault = false;
467
+ }
468
+ });
469
+ // }
470
+ },
471
+ removeAttach(attachFile) {
472
+ //检查是否存在子项文件夹或者文件需要删除
473
+ let tempChild = XEUtils.find(this.internalRows, p => p.parentId == attachFile.id && p.sysRowState !== 'delete')
474
+ if (tempChild) {
475
+ notification.error({
476
+ message: "错误",
477
+ description: "存在子项文件夹或者文件,请先删除子项文件夹或者文件!",
478
+ });
479
+ return
480
+ }
481
+ // console.debug(attachFile)
482
+ for (let i = 0; i < this.internalRows.length; i++) {
483
+ if (this.internalRows[i].id === attachFile.id) {
484
+ if (this.internalRows[i].sysRowState === 'add') {
485
+ this.internalRows.splice(i, 1);
486
+ } else {
487
+ this.$set(this.internalRows[i], "sysRowState", 'delete');
488
+ }
489
+ break;
490
+ }
491
+ }
492
+ this.$emit("remove", attachFile.id);
493
+ },
494
+ downloadAttach(attachFile) {
495
+ window.open(
496
+ this.internalServiceUrl +
497
+ "/DownAttachFile/" +
498
+ attachFile.attachId +
499
+ `?accessToken=${this.$store.getters.token}`
500
+ );
501
+ },
502
+ getUpdateRows() {
503
+ //先获取删除数据,因为前台删除一个明细后又添加相同的明细后台会
504
+ //报唯一索引错误,因为后台也是先添加然后再是删除的会照成问题
505
+ //所有就要把删除的放在数组的第一个传递过去,这样后台就先删除然后再新增了
506
+ let tempRemoveRows = XEUtils.filter(this.internalRows, p => p.sysRowState === 'delete' && p.id !== 'sys_top_folder')
507
+ let tempAddRows = XEUtils.filter(this.internalRows, p => p.sysRowState === 'add' && p.id !== 'sys_top_folder')
508
+ let tempUpdateRows = XEUtils.filter(this.internalRows, p => p.sysRowState === 'update' && p.id !== 'sys_top_folder')
509
+ let tempRows = XEUtils.union(tempRemoveRows, tempAddRows, tempUpdateRows)
510
+ XEUtils.arrayEach(tempRows, p => {
511
+ if (p.parentId === 'sys_top_folder') {
512
+ p.parentId = null
513
+ }
514
+ })
515
+ return tempRows
516
+ },
517
+ /**
518
+ * 查看附件
519
+ */
520
+ viewAttach(attachFile) {
521
+ if (attachFile.contentType === "application/pdf") {
522
+ this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
523
+ this.dialogViewType = attachFile.contentType;
524
+ this.dialogVisible = true;
525
+ } else if (attachFile.content === "image") {
526
+ this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
527
+ this.dialogViewType = attachFile.contentType;
528
+ this.dialogVisible = true;
529
+ }
530
+ this.currentFileTitle = attachFile.name
531
+ },
532
+ closePdf() {
533
+ this.isShowPdf = false;
534
+ },
535
+ },
536
+ };
537
+ </script>
538
+
539
+ <style lang="scss" scoped>
540
+ .file-card {
541
+ display: flex;
542
+ flex-flow: row wrap;
543
+ margin: 0 0 5px 5px;
544
+
545
+ .attach-wrapper {
546
+ .attach {
547
+ position: relative;
548
+ margin-right: 5px;
549
+
550
+ .attach-delete {
551
+ position: absolute;
552
+ top: -2px;
553
+ right: -4px;
554
+ opacity: 0;
555
+ font-size: 20px;
556
+ background-color: red;
557
+ }
558
+
559
+ .attach-delete:hover {
560
+ cursor: pointer;
561
+ }
562
+
563
+ .attach-download {
564
+ position: absolute;
565
+ bottom: 10px;
566
+ left: 4px;
567
+ opacity: 0;
568
+ font-size: 18px;
569
+ font-weight: bolder;
570
+ border: 1px solid #ccc;
571
+ border-radius: 50%;
572
+ border-color: transparent;
573
+ //background-color: rgb(255, 1, 1);
574
+ color: #000;
575
+ }
576
+
577
+ .attach-download:hover {
578
+ cursor: pointer;
579
+ color: rgb(189, 8, 8);
580
+ }
581
+
582
+ .attach-view {
583
+ position: absolute;
584
+ bottom: 10px;
585
+ right: 4px;
586
+ opacity: 0;
587
+ font-size: 18px;
588
+ font-weight: bolder;
589
+ border: 1px solid #ccc;
590
+ border-radius: 50%;
591
+ border-color: transparent;
592
+ //background-color: #666;
593
+ color: #000;
594
+ }
595
+
596
+ .attach-circle {
597
+ position: absolute;
598
+ // bottom: 10px;
599
+ top: 2px;
600
+ left: 4px;
601
+ opacity: 0;
602
+ }
603
+
604
+ .attach-view:hover {
605
+ cursor: pointer;
606
+ color: rgb(189, 8, 8);
607
+ }
608
+ }
609
+
610
+ .attach:hover>.attach-delete {
611
+ opacity: 0.8;
612
+ }
613
+
614
+ .attach:hover>.attach-download {
615
+ opacity: 0.7;
616
+ }
617
+
618
+ .attach:hover>.attach-view {
619
+ opacity: 0.7;
620
+ }
621
+
622
+ .attach:hover>.attach-circle {
623
+ opacity: 0.9;
624
+ }
625
+ }
626
+ }
627
+
628
+ .tree-node-icon {
629
+ width: 16px;
630
+ text-align: center;
631
+ }
632
+
633
+ .avatar-uploader .el-upload {
634
+ border: 1px solid #d9d9d9;
635
+
636
+ border-radius: 6px;
637
+ cursor: pointer;
638
+ position: relative;
639
+ overflow: hidden;
640
+ }
641
+
642
+ .avatar-uploader .el-upload:hover {
643
+ border-color: #409eff;
644
+ }
645
+
646
+ .avatar-uploader-icon {
647
+ font-size: 28px;
648
+ color: #8c939d;
649
+ // width: 178px;
650
+ // height: 178px;
651
+ line-height: 178px;
652
+ text-align: center;
653
+ }
654
+
655
+ .avatar {
656
+ // width: 178px;
657
+ // height: 178px;
658
+ display: block;
659
+ }
660
+
661
+ .el-upload-list__item is-success {
662
+ float: left;
663
+ }
664
+
665
+ .currentHeight {
666
+ display: flex;
667
+ align-items: center;
668
+ }
669
+
670
+ .card-view-items {
671
+ // margin-top: 100px;
672
+ // margin-left: 100px;
673
+ // margin-right: 100px;
674
+ display: flex;
675
+ flex-flow: row wrap;
676
+ justify-content: flex-start;
677
+ padding: 8px 8px 8px 8px;
678
+ overflow-y: auto;
679
+
680
+ .card-view-item-ghost {
681
+ visibility: hidden;
682
+ height: 0px !important;
683
+ min-height: 0px !important;
684
+ margin-top: 0px;
685
+ margin-bottom: 0px;
686
+ padding: 0px 0px 0px 0px;
687
+ }
688
+
689
+ .card-view-item {
690
+ cursor: pointer;
691
+ // height: 100px;
692
+ // margin-top: 4px;
693
+ // margin-right: 8px;
694
+ // margin-bottom: 4px;
695
+ // margin-left: 8px;
696
+ flex-grow: 1;
697
+ flex-shrink: 1;
698
+ flex-basis: auto;
699
+ border: 1px solid #9ad4dc;
700
+ margin-top: 4px;
701
+ margin-right: 8px;
702
+ margin-bottom: 4px;
703
+ margin-left: 8px;
704
+ padding: 8px 8px 8px 8px;
705
+ //border-color: #9ad4dc;
706
+ min-width: 150px;
707
+ border-radius: 6px;
708
+
709
+ .card-view-icon {
710
+ float: left;
711
+ width: 64px;
712
+ height: 64px;
713
+ }
714
+
715
+ // .card-view-desc {
716
+ // padding-left: 85px;
717
+ // }
718
+ }
719
+
720
+ .card-view-item:hover {
721
+ border: 1px solid #1269db;
722
+ }
723
+ }
724
+ </style>