doway-coms 2.11.11 → 2.11.13

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 (91) hide show
  1. package/.browserslistrc +2 -2
  2. package/README.md +28 -28
  3. package/dist/css/chunk-vendors.7f83d8f9.css +8 -0
  4. package/dist/css/index.7946d50b.css +1 -0
  5. package/dist/favicon.ico +0 -0
  6. package/dist/js/chunk-vendors.28fda91d.js +340 -0
  7. package/dist/js/index.49bc6add.js +2 -0
  8. package/lib/doway-coms.common.js +120397 -0
  9. package/lib/doway-coms.css +1 -0
  10. package/lib/doway-coms.umd.js +120407 -0
  11. package/lib/doway-coms.umd.min.js +328 -0
  12. package/package.json +62 -62
  13. package/packages/AuditsList/index.js +7 -7
  14. package/packages/AuditsList/src/index.vue +314 -314
  15. package/packages/BaseButton/index.js +7 -7
  16. package/packages/BaseButton/src/index.vue +242 -242
  17. package/packages/BaseCheckbox/index.js +7 -7
  18. package/packages/BaseCheckbox/src/index.vue +134 -134
  19. package/packages/BaseDate/index.js +7 -7
  20. package/packages/BaseDate/src/index.vue +197 -197
  21. package/packages/BaseDateWeek/index.js +7 -7
  22. package/packages/BaseDateWeek/src/index.vue +163 -163
  23. package/packages/BaseDatetime/index.js +7 -7
  24. package/packages/BaseDatetime/src/index.vue +196 -196
  25. package/packages/BaseFileGroup/index.js +7 -7
  26. package/packages/BaseFileGroup/src/index.vue +724 -724
  27. package/packages/BaseForm/index.js +7 -7
  28. package/packages/BaseForm/src/index.vue +895 -895
  29. package/packages/BaseGantt/index.js +9 -9
  30. package/packages/BaseGantt/src/index.vue +617 -617
  31. package/packages/BaseGrid/index.js +9 -9
  32. package/packages/BaseGrid/src/exportCmp.vue +105 -105
  33. package/packages/BaseGrid/src/gridApi.js +32 -32
  34. package/packages/BaseGrid/src/index.vue +4242 -4230
  35. package/packages/BaseGridAdjust/index.js +9 -9
  36. package/packages/BaseGridAdjust/src/index.vue +482 -482
  37. package/packages/BaseInput/index.js +7 -7
  38. package/packages/BaseInput/src/index.vue +195 -195
  39. package/packages/BaseIntervalInput/index.js +7 -7
  40. package/packages/BaseIntervalInput/src/index.vue +310 -310
  41. package/packages/BaseKanbanEmpty/index.js +7 -7
  42. package/packages/BaseKanbanEmpty/src/index.vue +176 -176
  43. package/packages/BaseNumberInput/index.js +7 -7
  44. package/packages/BaseNumberInput/src/index.vue +291 -291
  45. package/packages/BasePagination/index.js +7 -7
  46. package/packages/BasePagination/src/index.vue +91 -91
  47. package/packages/BasePictureCard/index.js +7 -7
  48. package/packages/BasePictureCard/src/index.vue +671 -671
  49. package/packages/BasePrintPreview/index.js +7 -7
  50. package/packages/BasePrintPreview/src/index.vue +150 -150
  51. package/packages/BasePulldown/index.js +7 -7
  52. package/packages/BasePulldown/src/index.vue +1395 -1395
  53. package/packages/BaseSearch/index.js +7 -7
  54. package/packages/BaseSearch/src/index.vue +935 -935
  55. package/packages/BaseSelect/index.js +7 -7
  56. package/packages/BaseSelect/src/index.vue +155 -155
  57. package/packages/BaseSelectMulti/index.js +7 -7
  58. package/packages/BaseSelectMulti/src/index.vue +148 -148
  59. package/packages/BaseTextArea/index.js +7 -7
  60. package/packages/BaseTextArea/src/index.vue +187 -187
  61. package/packages/BaseTime/index.js +7 -7
  62. package/packages/BaseTime/src/index.vue +166 -166
  63. package/packages/BaseTool/index.js +7 -7
  64. package/packages/BaseTool/src/index.vue +353 -353
  65. package/packages/BaseToolStatus/index.js +7 -7
  66. package/packages/BaseToolStatus/src/ApprovalPersonsGroup.vue +41 -41
  67. package/packages/BaseToolStatus/src/index.vue +439 -439
  68. package/packages/BaseTreeSelect/index.js +8 -8
  69. package/packages/BaseTreeSelect/src/index.vue +437 -437
  70. package/packages/HistoryModal/index.js +8 -8
  71. package/packages/HistoryModal/src/index.vue +144 -144
  72. package/packages/LeaveAMessage/index.js +7 -7
  73. package/packages/LeaveAMessage/src/index.vue +601 -601
  74. package/packages/directive/clickoutside.js +44 -44
  75. package/packages/index.js +197 -197
  76. package/packages/styles/default.css +78 -78
  77. package/packages/styles/default.less +91 -91
  78. package/packages/utils/api.js +122 -122
  79. package/packages/utils/auth.js +38 -38
  80. package/packages/utils/common.js +703 -703
  81. package/packages/utils/dom.js +181 -181
  82. package/packages/utils/enum.js +86 -86
  83. package/packages/utils/filters.js +495 -485
  84. package/packages/utils/gridFormat.js +66 -66
  85. package/packages/utils/msg.js +103 -103
  86. package/packages/utils/patchFiles.js +44 -44
  87. package/packages/utils/request.js +181 -181
  88. package/packages/utils/store.js +372 -372
  89. package/packages/utils/tscPrinter.js +101 -101
  90. package/sync.bash +6 -6
  91. package/vue.config.js +59 -59
@@ -1,724 +1,724 @@
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
- attachType: '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.clone(XEUtils.union(tempRemoveRows, tempAddRows, tempUpdateRows),true)
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>
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
+ attachType: '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.clone(XEUtils.union(tempRemoveRows, tempAddRows, tempUpdateRows),true)
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>