doway-coms 2.11.95 → 2.11.97

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