doway-coms 2.2.20 → 2.2.21
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.
- package/.browserslistrc +2 -2
- package/README.md +28 -28
- package/package.json +53 -53
- package/packages/AuditsList/index.js +7 -7
- package/packages/AuditsList/src/index.vue +262 -262
- package/packages/BaseButton/index.js +7 -7
- package/packages/BaseButton/src/index.vue +241 -241
- package/packages/BaseCheckbox/index.js +7 -7
- package/packages/BaseCheckbox/src/index.vue +134 -134
- package/packages/BaseDate/index.js +7 -7
- package/packages/BaseDate/src/index.vue +197 -197
- package/packages/BaseDateWeek/index.js +7 -7
- package/packages/BaseDateWeek/src/index.vue +163 -163
- package/packages/BaseDatetime/index.js +7 -7
- package/packages/BaseDatetime/src/index.vue +196 -196
- package/packages/BaseForm/index.js +7 -7
- package/packages/BaseForm/src/index.vue +728 -728
- package/packages/BaseGantt/index.js +9 -9
- package/packages/BaseGantt/src/index.vue +608 -608
- package/packages/BaseGrid/index.js +9 -9
- package/packages/BaseGrid/src/SeqSetting.vue +278 -278
- package/packages/BaseGrid/src/index.vue +3580 -3580
- package/packages/BaseGridAdjust/index.js +9 -9
- package/packages/BaseGridAdjust/src/index.vue +482 -482
- package/packages/BaseInput/index.js +7 -7
- package/packages/BaseInput/src/index.vue +164 -164
- package/packages/BaseIntervalInput/index.js +7 -7
- package/packages/BaseIntervalInput/src/index.vue +310 -310
- package/packages/BaseKanbanEmpty/index.js +7 -7
- package/packages/BaseKanbanEmpty/src/index.vue +176 -176
- package/packages/BaseNumberInput/index.js +7 -7
- package/packages/BaseNumberInput/src/index.vue +293 -293
- package/packages/BasePagination/index.js +7 -7
- package/packages/BasePagination/src/index.vue +91 -91
- package/packages/BasePictureCard/index.js +7 -7
- package/packages/BasePictureCard/src/index.vue +580 -580
- package/packages/BasePrintPreview/index.js +7 -7
- package/packages/BasePrintPreview/src/index.vue +129 -129
- package/packages/BasePulldown/index.js +7 -7
- package/packages/BasePulldown/src/index.vue +1265 -1265
- package/packages/BaseSearch/index.js +7 -7
- package/packages/BaseSearch/src/index.vue +935 -935
- package/packages/BaseSelect/index.js +7 -7
- package/packages/BaseSelect/src/index.vue +155 -155
- package/packages/BaseSelectMulti/index.js +7 -7
- package/packages/BaseSelectMulti/src/index.vue +148 -148
- package/packages/BaseTextArea/index.js +7 -7
- package/packages/BaseTextArea/src/index.vue +178 -178
- package/packages/BaseTime/index.js +7 -7
- package/packages/BaseTime/src/index.vue +166 -166
- package/packages/BaseTool/index.js +7 -7
- package/packages/BaseTool/src/index.vue +349 -349
- package/packages/BaseToolStatus/index.js +7 -7
- package/packages/BaseToolStatus/src/index.vue +388 -388
- package/packages/BaseTreeSelect/index.js +8 -8
- package/packages/BaseTreeSelect/src/index.vue +437 -437
- package/packages/LeaveAMessage/index.js +7 -7
- package/packages/LeaveAMessage/src/index.vue +597 -597
- package/packages/index.js +191 -191
- package/packages/styles/default.css +78 -78
- package/packages/styles/default.less +84 -84
- package/packages/utils/api.js +107 -107
- package/packages/utils/auth.js +38 -38
- package/packages/utils/common.js +610 -610
- package/packages/utils/dom.js +181 -181
- package/packages/utils/enum.js +86 -86
- package/packages/utils/filters.js +472 -472
- package/packages/utils/gridFormat.js +66 -66
- package/packages/utils/msg.js +84 -84
- package/packages/utils/patchFiles.js +44 -44
- package/packages/utils/request.js +178 -178
- package/packages/utils/store.js +305 -303
- package/vue.config.js +59 -59
- package/dist/css/chunk-vendors.7f83d8f9.css +0 -8
- package/dist/css/index.7946d50b.css +0 -1
- package/dist/favicon.ico +0 -0
- package/dist/js/chunk-vendors.28fda91d.js +0 -340
- package/dist/js/index.49bc6add.js +0 -2
- package/lib/doway-coms.common.js +0 -120397
- package/lib/doway-coms.css +0 -1
- package/lib/doway-coms.umd.js +0 -120407
- package/lib/doway-coms.umd.min.js +0 -328
|
@@ -1,580 +1,580 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div style="display: inline-block">
|
|
3
|
-
<div class="file-card" :class="isStyle? 'currentHeight' : ''">
|
|
4
|
-
<div
|
|
5
|
-
class="attach-wrapper"
|
|
6
|
-
v-for="internalRow in internalRows.filter(
|
|
7
|
-
(x) => x.sysRowState != 'delete'
|
|
8
|
-
)"
|
|
9
|
-
:key="internalRow.attach.fileName"
|
|
10
|
-
>
|
|
11
|
-
<template v-if="internalRow.sysRowState !== sysRowState.delete">
|
|
12
|
-
<slot name='header' :row="internalRow"></slot>
|
|
13
|
-
<div class="attach" v-if="internalRow.attach.content === 'image'">
|
|
14
|
-
<img
|
|
15
|
-
@click="attachFileClick(internalRow.attach)"
|
|
16
|
-
:style="{ height: height, lineHeight: height, width: width }"
|
|
17
|
-
style="
|
|
18
|
-
border: 1px solid #ccc;
|
|
19
|
-
border-radius: 6px;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
margin: 0;
|
|
22
|
-
padding: 0;
|
|
23
|
-
"
|
|
24
|
-
:src="`${internalServiceUrl}/GetAttachFile/${internalRow.attach.id}?accessToken=${$store.getters.token}`"
|
|
25
|
-
/>
|
|
26
|
-
<a-icon
|
|
27
|
-
class="attach-delete"
|
|
28
|
-
type="close-circle"
|
|
29
|
-
@click="removeAttach(internalRow.attach)"
|
|
30
|
-
v-if="edit === true"
|
|
31
|
-
/>
|
|
32
|
-
<a-icon
|
|
33
|
-
class="attach-download"
|
|
34
|
-
type="download"
|
|
35
|
-
@click="downloadAttach(internalRow.attach)"
|
|
36
|
-
/>
|
|
37
|
-
<a-icon
|
|
38
|
-
class="attach-view"
|
|
39
|
-
type="eye"
|
|
40
|
-
@click="viewAttach(internalRow.attach)"
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
<div class="attach" v-else-if="internalRow.attach.contentType == 'application/pdf'">
|
|
44
|
-
<img
|
|
45
|
-
@click="attachFileClick(internalRow.attach)"
|
|
46
|
-
:style="{ height: height, lineHeight: height, width: width }"
|
|
47
|
-
src="../../styles/icon/pdf_file.svg"
|
|
48
|
-
/>
|
|
49
|
-
<a-icon
|
|
50
|
-
class="attach-delete"
|
|
51
|
-
type="close-circle"
|
|
52
|
-
v-if="edit === true"
|
|
53
|
-
@click="removeAttach(internalRow.attach)"
|
|
54
|
-
/>
|
|
55
|
-
<a-icon
|
|
56
|
-
class="attach-download"
|
|
57
|
-
type="download"
|
|
58
|
-
@click="downloadAttach(internalRow.attach)"
|
|
59
|
-
/>
|
|
60
|
-
<a-icon
|
|
61
|
-
class="attach-view"
|
|
62
|
-
type="eye"
|
|
63
|
-
@click="viewAttach(internalRow.attach)"
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
<div class="attach" v-else>
|
|
67
|
-
<img
|
|
68
|
-
@click="attachFileClick(internalRow.attach)"
|
|
69
|
-
:style="{ height: height, lineHeight: height, width: width }"
|
|
70
|
-
src="../../styles/icon/uploaded_file.svg"
|
|
71
|
-
:data-mimetype="internalRow.attach.contentType"
|
|
72
|
-
/>
|
|
73
|
-
<a-icon
|
|
74
|
-
class="attach-delete"
|
|
75
|
-
type="close-circle"
|
|
76
|
-
@click="removeAttach(internalRow.attach)"
|
|
77
|
-
v-if="edit === true"
|
|
78
|
-
/>
|
|
79
|
-
<a-icon
|
|
80
|
-
class="attach-download"
|
|
81
|
-
type="download"
|
|
82
|
-
@click="downloadAttach(internalRow.attach)"
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
<div
|
|
86
|
-
:style="{ width: width }"
|
|
87
|
-
:title="internalRow.attach.name"
|
|
88
|
-
style="
|
|
89
|
-
overflow: hidden;
|
|
90
|
-
text-overflow: ellipsis;
|
|
91
|
-
white-space: nowrap;
|
|
92
|
-
"
|
|
93
|
-
>
|
|
94
|
-
{{ internalRow.attach.name }}
|
|
95
|
-
</div>
|
|
96
|
-
</template>
|
|
97
|
-
</div>
|
|
98
|
-
<a-upload
|
|
99
|
-
class="avatar-uploader"
|
|
100
|
-
:headers="uploadHeaders"
|
|
101
|
-
:action="uploadData.picAction"
|
|
102
|
-
:data="uploadData"
|
|
103
|
-
v-if="edit === true"
|
|
104
|
-
@change="handleAvatarSuccess"
|
|
105
|
-
:showUploadList="false"
|
|
106
|
-
:before-upload="beforeAvatarUpload"
|
|
107
|
-
>
|
|
108
|
-
<div
|
|
109
|
-
style="border: 1px solid #d9d9d9; border-radius: 6px"
|
|
110
|
-
:style="{ width: width, height: height, lineHeight: height }"
|
|
111
|
-
>
|
|
112
|
-
<a-icon
|
|
113
|
-
type="plus"
|
|
114
|
-
class="avatar-uploader-icon"
|
|
115
|
-
style="text-align: center"
|
|
116
|
-
:style="{ width: width, height: height, lineHeight: height }"
|
|
117
|
-
/>
|
|
118
|
-
</div>
|
|
119
|
-
</a-upload>
|
|
120
|
-
<div v-if="edit !== true && showEmptyText && internalRows.length === 0">
|
|
121
|
-
没有附件信息哦,请编辑添加附件信息
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
<VxeModal
|
|
125
|
-
v-model="dialogVisible"
|
|
126
|
-
show-zoom
|
|
127
|
-
transfer
|
|
128
|
-
resize
|
|
129
|
-
:height="550"
|
|
130
|
-
:width="800"
|
|
131
|
-
destroy-on-close
|
|
132
|
-
:fullscreen="dialogViewType == 'application/pdf'"
|
|
133
|
-
:z-index="999"
|
|
134
|
-
>
|
|
135
|
-
<template #title>
|
|
136
|
-
<span>{{ currentFileTitle }}</span>
|
|
137
|
-
</template>
|
|
138
|
-
<!-- pdf -->
|
|
139
|
-
<embed
|
|
140
|
-
v-if="dialogViewType == 'application/pdf'"
|
|
141
|
-
:src="dialogImageUrl"
|
|
142
|
-
:type="dialogViewType"
|
|
143
|
-
width="100%"
|
|
144
|
-
height="100%"
|
|
145
|
-
/>
|
|
146
|
-
<!-- 普通图片 -->
|
|
147
|
-
<img width="90%" height="auto" :src="dialogImageUrl" v-else />
|
|
148
|
-
</VxeModal>
|
|
149
|
-
</div>
|
|
150
|
-
</template>
|
|
151
|
-
|
|
152
|
-
<script>
|
|
153
|
-
import { notification, Upload } from "ant-design-vue";
|
|
154
|
-
import { sysRowState } from "../../utils/enum";
|
|
155
|
-
import { Checkbox, Modal } from "vxe-table";
|
|
156
|
-
import { attachGetAttachUrlApi, attachSearchApi } from "../../utils/api";
|
|
157
|
-
|
|
158
|
-
export default {
|
|
159
|
-
name: "BasePictureCard",
|
|
160
|
-
components: {
|
|
161
|
-
VxeCheckbox: Checkbox,
|
|
162
|
-
"a-upload": Upload,
|
|
163
|
-
VxeModal: Modal,
|
|
164
|
-
},
|
|
165
|
-
data() {
|
|
166
|
-
return {
|
|
167
|
-
demo1: "",
|
|
168
|
-
demo2: "",
|
|
169
|
-
internalServiceUrl: "",
|
|
170
|
-
downFilePath: "",
|
|
171
|
-
downFileName: "",
|
|
172
|
-
isShowPdf: false,
|
|
173
|
-
pdfData: null,
|
|
174
|
-
internalUrls: [],
|
|
175
|
-
internalRows: [],
|
|
176
|
-
picName: [],
|
|
177
|
-
dialogImageUrl: "",
|
|
178
|
-
dialogViewType: "",
|
|
179
|
-
sysRowState: sysRowState,
|
|
180
|
-
dialogVisible: false,
|
|
181
|
-
uploadData: {
|
|
182
|
-
picType: "",
|
|
183
|
-
picAction: "",
|
|
184
|
-
resId: "",
|
|
185
|
-
},
|
|
186
|
-
uploadHeaders: {
|
|
187
|
-
Authorization: null,
|
|
188
|
-
},
|
|
189
|
-
currentFileTitle: ''
|
|
190
|
-
};
|
|
191
|
-
},
|
|
192
|
-
props: {
|
|
193
|
-
isStyle: {
|
|
194
|
-
type: Boolean,
|
|
195
|
-
default: false,
|
|
196
|
-
},
|
|
197
|
-
showEmptyText: {
|
|
198
|
-
type: Boolean,
|
|
199
|
-
default: true,
|
|
200
|
-
},
|
|
201
|
-
picType: {
|
|
202
|
-
type: String,
|
|
203
|
-
default: "cust",
|
|
204
|
-
},
|
|
205
|
-
value: {
|
|
206
|
-
type: String,
|
|
207
|
-
},
|
|
208
|
-
resId: {
|
|
209
|
-
type: String,
|
|
210
|
-
},
|
|
211
|
-
dataName: {
|
|
212
|
-
type: String,
|
|
213
|
-
},
|
|
214
|
-
edit: {
|
|
215
|
-
// 列信息
|
|
216
|
-
type: Boolean,
|
|
217
|
-
},
|
|
218
|
-
limitSize: {
|
|
219
|
-
// 限制上传大小
|
|
220
|
-
type: Number,
|
|
221
|
-
default: 5,
|
|
222
|
-
},
|
|
223
|
-
limitType: {
|
|
224
|
-
// 限制上传类型
|
|
225
|
-
type: Array,
|
|
226
|
-
default: () => {
|
|
227
|
-
return [];
|
|
228
|
-
},
|
|
229
|
-
},
|
|
230
|
-
formRow: {
|
|
231
|
-
type: Object,
|
|
232
|
-
default: () => {
|
|
233
|
-
return {};
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
width: {
|
|
237
|
-
type: String,
|
|
238
|
-
default: "100px",
|
|
239
|
-
},
|
|
240
|
-
height: {
|
|
241
|
-
type: String,
|
|
242
|
-
default: "100px",
|
|
243
|
-
},
|
|
244
|
-
rows: {
|
|
245
|
-
// 表格数据
|
|
246
|
-
type: Array,
|
|
247
|
-
default: function () {
|
|
248
|
-
return [];
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
cols: {
|
|
252
|
-
// 表格列信息
|
|
253
|
-
type: Array,
|
|
254
|
-
default: function () {
|
|
255
|
-
return [];
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
formState: {
|
|
259
|
-
// 表格列信息
|
|
260
|
-
type: String,
|
|
261
|
-
default: "",
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
watch: {
|
|
265
|
-
rows: {
|
|
266
|
-
handler: function (newVal) {
|
|
267
|
-
this.getAttachInfo(newVal);
|
|
268
|
-
},
|
|
269
|
-
deep: true,
|
|
270
|
-
},
|
|
271
|
-
resId: {
|
|
272
|
-
handler: function (newVal) {
|
|
273
|
-
this.uploadData.resId = newVal;
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
},
|
|
277
|
-
created() {
|
|
278
|
-
},
|
|
279
|
-
mounted() {
|
|
280
|
-
// 请求头加入token
|
|
281
|
-
this.uploadHeaders.Authorization = `Bearer ${this.$store.getters.token}`;
|
|
282
|
-
|
|
283
|
-
this.internalServiceUrl = attachGetAttachUrlApi();
|
|
284
|
-
this.uploadData.picType = this.picType;
|
|
285
|
-
this.uploadData.resId = this.resId;
|
|
286
|
-
this.uploadData.picAction = this.internalServiceUrl + "/UploadAttach";
|
|
287
|
-
this.getAttachInfo(this.rows);
|
|
288
|
-
},
|
|
289
|
-
methods: {
|
|
290
|
-
getCurrentToken() {
|
|
291
|
-
return this.$store.getters.token;
|
|
292
|
-
},
|
|
293
|
-
/**
|
|
294
|
-
* 获取附件信息
|
|
295
|
-
*/
|
|
296
|
-
getAttachInfo(newRows) {
|
|
297
|
-
let attachIds = [];
|
|
298
|
-
for (let i = 0; i < newRows.length; i++) {
|
|
299
|
-
if (newRows[i].attach) {
|
|
300
|
-
continue;
|
|
301
|
-
}
|
|
302
|
-
attachIds.push(newRows[i].attachId);
|
|
303
|
-
newRows[i].attach = {
|
|
304
|
-
fileName: "",
|
|
305
|
-
contentType: "",
|
|
306
|
-
content: "",
|
|
307
|
-
name: "",
|
|
308
|
-
id: newRows[i].attachId,
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
if (attachIds.length == 0) {
|
|
312
|
-
this.internalRows = newRows;
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
let postData = {
|
|
316
|
-
fields: "id,fileName,contentType,name,content,isDefault",
|
|
317
|
-
begin: 1,
|
|
318
|
-
size: 0,
|
|
319
|
-
exp: "id in (",
|
|
320
|
-
};
|
|
321
|
-
for (let i = 0; i < attachIds.length; i++) {
|
|
322
|
-
postData.exp = postData.exp + attachIds[i] + ",";
|
|
323
|
-
}
|
|
324
|
-
let vm = this;
|
|
325
|
-
postData.exp = postData.exp.substr(0, postData.exp.length - 1) + ")";
|
|
326
|
-
attachSearchApi(postData)
|
|
327
|
-
.then((responseData) => {
|
|
328
|
-
for (let i = 0; i < responseData.content.length; i++) {
|
|
329
|
-
for (let x = 0; x < newRows.length; x++) {
|
|
330
|
-
if (responseData.content[i].id === newRows[x].attachId) {
|
|
331
|
-
newRows[x].attach.fileName = responseData.content[i].fileName;
|
|
332
|
-
newRows[x].attach.name = responseData.content[i].name;
|
|
333
|
-
newRows[x].attach.content = responseData.content[i].content;
|
|
334
|
-
newRows[x].attach.contentType =
|
|
335
|
-
responseData.content[i].contentType;
|
|
336
|
-
// newRows[x].attach.isDefault = false
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
vm.internalRows = newRows;
|
|
342
|
-
})
|
|
343
|
-
.catch(() => {});
|
|
344
|
-
},
|
|
345
|
-
attachFileClick(attachFile) {},
|
|
346
|
-
handleAvatarSuccess(info) {
|
|
347
|
-
if (info.file.status == "done") {
|
|
348
|
-
let addRow = {
|
|
349
|
-
attachId: info.file.response.content.id,
|
|
350
|
-
sysRowState: sysRowState.add,
|
|
351
|
-
attach: info.file.response.content,
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
this.internalRows.push(addRow);
|
|
355
|
-
let tempField;
|
|
356
|
-
for (let i = 0; i < this.cols.length; i++) {
|
|
357
|
-
// 赋值关联字段数据
|
|
358
|
-
let tempValue = addRow;
|
|
359
|
-
tempField = this.cols[i].field;
|
|
360
|
-
if (this.cols[i].isAuto) {
|
|
361
|
-
tempValue[tempField] = this.$store.getters.newId() + "";
|
|
362
|
-
continue;
|
|
363
|
-
}
|
|
364
|
-
if (
|
|
365
|
-
this.cols[i].controlType === "text" &&
|
|
366
|
-
this.cols[i].linkValueField !== null &&
|
|
367
|
-
this.cols[i].linkValueField !== "" &&
|
|
368
|
-
this.cols[i].linkValueField !== undefined
|
|
369
|
-
) {
|
|
370
|
-
tempValue[tempField] = this.formRow[this.cols[i].linkValueField];
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
this.$emit(
|
|
374
|
-
"add",
|
|
375
|
-
this.dataName,
|
|
376
|
-
info.file.response.content
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
},
|
|
380
|
-
beforeAvatarUpload(file) {
|
|
381
|
-
// const isPic = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
382
|
-
if (file.size / 1024 / 1024 > this.limitSize) {
|
|
383
|
-
notification.error({
|
|
384
|
-
message: "错误",
|
|
385
|
-
description: "上传图片大小不能超过 " + this.limitSize + "MB!",
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
if (this.limitType.length > 0 && !this.limitType[file.type]) {
|
|
389
|
-
notification.error({
|
|
390
|
-
message: "错误",
|
|
391
|
-
description: "上传附件格式错误!",
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
return true;
|
|
395
|
-
},
|
|
396
|
-
handleRemove(file, fileList) {
|
|
397
|
-
// this.dialogVisible = !this.dialogVisible
|
|
398
|
-
// alert(this.dialogVisible)
|
|
399
|
-
this.internalUrls = fileList;
|
|
400
|
-
this.$emit("remove", this.dataName, file.response.data);
|
|
401
|
-
// this.$emit('remove', this.dataName, file.response.data)
|
|
402
|
-
},
|
|
403
|
-
circleAttach(attachFile, internalRow) {
|
|
404
|
-
let vm = this;
|
|
405
|
-
// if(internalRow.isDefault == true){
|
|
406
|
-
this.internalRows.forEach((element) => {
|
|
407
|
-
if (element.id !== internalRow.id) {
|
|
408
|
-
element.isDefault = false;
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
// }
|
|
412
|
-
},
|
|
413
|
-
removeAttach(attachFile) {
|
|
414
|
-
for (let i = 0; i < this.internalRows.length; i++) {
|
|
415
|
-
if (this.internalRows[i].attachId === attachFile.id) {
|
|
416
|
-
if (this.internalRows[i].sysRowState === sysRowState.add) {
|
|
417
|
-
this.internalRows.splice(i, 1);
|
|
418
|
-
} else {
|
|
419
|
-
this.$set(this.internalRows[i], "sysRowState", sysRowState.delete);
|
|
420
|
-
}
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
this.$emit("remove", attachFile.id);
|
|
425
|
-
},
|
|
426
|
-
downloadAttach(attachFile) {
|
|
427
|
-
window.open(
|
|
428
|
-
this.internalServiceUrl +
|
|
429
|
-
"/DownAttachFile/" +
|
|
430
|
-
attachFile.id +
|
|
431
|
-
`?accessToken=${this.$store.getters.token}`
|
|
432
|
-
);
|
|
433
|
-
},
|
|
434
|
-
/**
|
|
435
|
-
* 查看附件
|
|
436
|
-
*/
|
|
437
|
-
viewAttach(attachFile) {
|
|
438
|
-
if (attachFile.contentType === "application/pdf") {
|
|
439
|
-
this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
|
|
440
|
-
this.dialogViewType = attachFile.contentType;
|
|
441
|
-
this.dialogVisible = true;
|
|
442
|
-
} else if (attachFile.content === "image") {
|
|
443
|
-
this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
|
|
444
|
-
this.dialogViewType = attachFile.contentType;
|
|
445
|
-
this.dialogVisible = true;
|
|
446
|
-
}
|
|
447
|
-
this.currentFileTitle = attachFile.name
|
|
448
|
-
},
|
|
449
|
-
closePdf() {
|
|
450
|
-
this.isShowPdf = false;
|
|
451
|
-
},
|
|
452
|
-
},
|
|
453
|
-
};
|
|
454
|
-
</script>
|
|
455
|
-
|
|
456
|
-
<style lang="scss" scoped>
|
|
457
|
-
.file-card {
|
|
458
|
-
display: flex;
|
|
459
|
-
flex-flow: row wrap;
|
|
460
|
-
margin: 0 0 5px 5px;
|
|
461
|
-
|
|
462
|
-
.attach-wrapper {
|
|
463
|
-
.attach {
|
|
464
|
-
position: relative;
|
|
465
|
-
margin-right: 5px;
|
|
466
|
-
|
|
467
|
-
.attach-delete {
|
|
468
|
-
position: absolute;
|
|
469
|
-
top: -2px;
|
|
470
|
-
right: -4px;
|
|
471
|
-
opacity: 0;
|
|
472
|
-
font-size: 20px;
|
|
473
|
-
background-color: red;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
.attach-delete:hover {
|
|
477
|
-
cursor: pointer;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
.attach-download {
|
|
481
|
-
position: absolute;
|
|
482
|
-
bottom: 10px;
|
|
483
|
-
left: 4px;
|
|
484
|
-
opacity: 0;
|
|
485
|
-
font-size: 18px;
|
|
486
|
-
font-weight: bolder;
|
|
487
|
-
border: 1px solid #ccc;
|
|
488
|
-
border-radius: 50%;
|
|
489
|
-
border-color: transparent;
|
|
490
|
-
//background-color: rgb(255, 1, 1);
|
|
491
|
-
color: #000;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
.attach-download:hover {
|
|
495
|
-
cursor: pointer;
|
|
496
|
-
color: rgb(189, 8, 8);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
.attach-view {
|
|
500
|
-
position: absolute;
|
|
501
|
-
bottom: 10px;
|
|
502
|
-
right: 4px;
|
|
503
|
-
opacity: 0;
|
|
504
|
-
font-size: 18px;
|
|
505
|
-
font-weight: bolder;
|
|
506
|
-
border: 1px solid #ccc;
|
|
507
|
-
border-radius: 50%;
|
|
508
|
-
border-color: transparent;
|
|
509
|
-
//background-color: #666;
|
|
510
|
-
color: #000;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
.attach-circle {
|
|
514
|
-
position: absolute;
|
|
515
|
-
// bottom: 10px;
|
|
516
|
-
top: 2px;
|
|
517
|
-
left: 4px;
|
|
518
|
-
opacity: 0;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
.attach-view:hover {
|
|
522
|
-
cursor: pointer;
|
|
523
|
-
color: rgb(189, 8, 8);
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.attach:hover > .attach-delete {
|
|
528
|
-
opacity: 0.8;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
.attach:hover > .attach-download {
|
|
532
|
-
opacity: 0.7;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
.attach:hover > .attach-view {
|
|
536
|
-
opacity: 0.7;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
.attach:hover > .attach-circle {
|
|
540
|
-
opacity: 0.9;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
.avatar-uploader .el-upload {
|
|
546
|
-
border: 1px solid #d9d9d9;
|
|
547
|
-
|
|
548
|
-
border-radius: 6px;
|
|
549
|
-
cursor: pointer;
|
|
550
|
-
position: relative;
|
|
551
|
-
overflow: hidden;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
.avatar-uploader .el-upload:hover {
|
|
555
|
-
border-color: #409eff;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
.avatar-uploader-icon {
|
|
559
|
-
font-size: 28px;
|
|
560
|
-
color: #8c939d;
|
|
561
|
-
// width: 178px;
|
|
562
|
-
// height: 178px;
|
|
563
|
-
line-height: 178px;
|
|
564
|
-
text-align: center;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
.avatar {
|
|
568
|
-
// width: 178px;
|
|
569
|
-
// height: 178px;
|
|
570
|
-
display: block;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
.el-upload-list__item is-success {
|
|
574
|
-
float: left;
|
|
575
|
-
}
|
|
576
|
-
.currentHeight {
|
|
577
|
-
display: flex;
|
|
578
|
-
align-items: center;
|
|
579
|
-
}
|
|
580
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div style="display: inline-block">
|
|
3
|
+
<div class="file-card" :class="isStyle? 'currentHeight' : ''">
|
|
4
|
+
<div
|
|
5
|
+
class="attach-wrapper"
|
|
6
|
+
v-for="internalRow in internalRows.filter(
|
|
7
|
+
(x) => x.sysRowState != 'delete'
|
|
8
|
+
)"
|
|
9
|
+
:key="internalRow.attach.fileName"
|
|
10
|
+
>
|
|
11
|
+
<template v-if="internalRow.sysRowState !== sysRowState.delete">
|
|
12
|
+
<slot name='header' :row="internalRow"></slot>
|
|
13
|
+
<div class="attach" v-if="internalRow.attach.content === 'image'">
|
|
14
|
+
<img
|
|
15
|
+
@click="attachFileClick(internalRow.attach)"
|
|
16
|
+
:style="{ height: height, lineHeight: height, width: width }"
|
|
17
|
+
style="
|
|
18
|
+
border: 1px solid #ccc;
|
|
19
|
+
border-radius: 6px;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
"
|
|
24
|
+
:src="`${internalServiceUrl}/GetAttachFile/${internalRow.attach.id}?accessToken=${$store.getters.token}`"
|
|
25
|
+
/>
|
|
26
|
+
<a-icon
|
|
27
|
+
class="attach-delete"
|
|
28
|
+
type="close-circle"
|
|
29
|
+
@click="removeAttach(internalRow.attach)"
|
|
30
|
+
v-if="edit === true"
|
|
31
|
+
/>
|
|
32
|
+
<a-icon
|
|
33
|
+
class="attach-download"
|
|
34
|
+
type="download"
|
|
35
|
+
@click="downloadAttach(internalRow.attach)"
|
|
36
|
+
/>
|
|
37
|
+
<a-icon
|
|
38
|
+
class="attach-view"
|
|
39
|
+
type="eye"
|
|
40
|
+
@click="viewAttach(internalRow.attach)"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="attach" v-else-if="internalRow.attach.contentType == 'application/pdf'">
|
|
44
|
+
<img
|
|
45
|
+
@click="attachFileClick(internalRow.attach)"
|
|
46
|
+
:style="{ height: height, lineHeight: height, width: width }"
|
|
47
|
+
src="../../styles/icon/pdf_file.svg"
|
|
48
|
+
/>
|
|
49
|
+
<a-icon
|
|
50
|
+
class="attach-delete"
|
|
51
|
+
type="close-circle"
|
|
52
|
+
v-if="edit === true"
|
|
53
|
+
@click="removeAttach(internalRow.attach)"
|
|
54
|
+
/>
|
|
55
|
+
<a-icon
|
|
56
|
+
class="attach-download"
|
|
57
|
+
type="download"
|
|
58
|
+
@click="downloadAttach(internalRow.attach)"
|
|
59
|
+
/>
|
|
60
|
+
<a-icon
|
|
61
|
+
class="attach-view"
|
|
62
|
+
type="eye"
|
|
63
|
+
@click="viewAttach(internalRow.attach)"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="attach" v-else>
|
|
67
|
+
<img
|
|
68
|
+
@click="attachFileClick(internalRow.attach)"
|
|
69
|
+
:style="{ height: height, lineHeight: height, width: width }"
|
|
70
|
+
src="../../styles/icon/uploaded_file.svg"
|
|
71
|
+
:data-mimetype="internalRow.attach.contentType"
|
|
72
|
+
/>
|
|
73
|
+
<a-icon
|
|
74
|
+
class="attach-delete"
|
|
75
|
+
type="close-circle"
|
|
76
|
+
@click="removeAttach(internalRow.attach)"
|
|
77
|
+
v-if="edit === true"
|
|
78
|
+
/>
|
|
79
|
+
<a-icon
|
|
80
|
+
class="attach-download"
|
|
81
|
+
type="download"
|
|
82
|
+
@click="downloadAttach(internalRow.attach)"
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<div
|
|
86
|
+
:style="{ width: width }"
|
|
87
|
+
:title="internalRow.attach.name"
|
|
88
|
+
style="
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
"
|
|
93
|
+
>
|
|
94
|
+
{{ internalRow.attach.name }}
|
|
95
|
+
</div>
|
|
96
|
+
</template>
|
|
97
|
+
</div>
|
|
98
|
+
<a-upload
|
|
99
|
+
class="avatar-uploader"
|
|
100
|
+
:headers="uploadHeaders"
|
|
101
|
+
:action="uploadData.picAction"
|
|
102
|
+
:data="uploadData"
|
|
103
|
+
v-if="edit === true"
|
|
104
|
+
@change="handleAvatarSuccess"
|
|
105
|
+
:showUploadList="false"
|
|
106
|
+
:before-upload="beforeAvatarUpload"
|
|
107
|
+
>
|
|
108
|
+
<div
|
|
109
|
+
style="border: 1px solid #d9d9d9; border-radius: 6px"
|
|
110
|
+
:style="{ width: width, height: height, lineHeight: height }"
|
|
111
|
+
>
|
|
112
|
+
<a-icon
|
|
113
|
+
type="plus"
|
|
114
|
+
class="avatar-uploader-icon"
|
|
115
|
+
style="text-align: center"
|
|
116
|
+
:style="{ width: width, height: height, lineHeight: height }"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
</a-upload>
|
|
120
|
+
<div v-if="edit !== true && showEmptyText && internalRows.length === 0">
|
|
121
|
+
没有附件信息哦,请编辑添加附件信息
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
<VxeModal
|
|
125
|
+
v-model="dialogVisible"
|
|
126
|
+
show-zoom
|
|
127
|
+
transfer
|
|
128
|
+
resize
|
|
129
|
+
:height="550"
|
|
130
|
+
:width="800"
|
|
131
|
+
destroy-on-close
|
|
132
|
+
:fullscreen="dialogViewType == 'application/pdf'"
|
|
133
|
+
:z-index="999"
|
|
134
|
+
>
|
|
135
|
+
<template #title>
|
|
136
|
+
<span>{{ currentFileTitle }}</span>
|
|
137
|
+
</template>
|
|
138
|
+
<!-- pdf -->
|
|
139
|
+
<embed
|
|
140
|
+
v-if="dialogViewType == 'application/pdf'"
|
|
141
|
+
:src="dialogImageUrl"
|
|
142
|
+
:type="dialogViewType"
|
|
143
|
+
width="100%"
|
|
144
|
+
height="100%"
|
|
145
|
+
/>
|
|
146
|
+
<!-- 普通图片 -->
|
|
147
|
+
<img width="90%" height="auto" :src="dialogImageUrl" v-else />
|
|
148
|
+
</VxeModal>
|
|
149
|
+
</div>
|
|
150
|
+
</template>
|
|
151
|
+
|
|
152
|
+
<script>
|
|
153
|
+
import { notification, Upload } from "ant-design-vue";
|
|
154
|
+
import { sysRowState } from "../../utils/enum";
|
|
155
|
+
import { Checkbox, Modal } from "vxe-table";
|
|
156
|
+
import { attachGetAttachUrlApi, attachSearchApi } from "../../utils/api";
|
|
157
|
+
|
|
158
|
+
export default {
|
|
159
|
+
name: "BasePictureCard",
|
|
160
|
+
components: {
|
|
161
|
+
VxeCheckbox: Checkbox,
|
|
162
|
+
"a-upload": Upload,
|
|
163
|
+
VxeModal: Modal,
|
|
164
|
+
},
|
|
165
|
+
data() {
|
|
166
|
+
return {
|
|
167
|
+
demo1: "",
|
|
168
|
+
demo2: "",
|
|
169
|
+
internalServiceUrl: "",
|
|
170
|
+
downFilePath: "",
|
|
171
|
+
downFileName: "",
|
|
172
|
+
isShowPdf: false,
|
|
173
|
+
pdfData: null,
|
|
174
|
+
internalUrls: [],
|
|
175
|
+
internalRows: [],
|
|
176
|
+
picName: [],
|
|
177
|
+
dialogImageUrl: "",
|
|
178
|
+
dialogViewType: "",
|
|
179
|
+
sysRowState: sysRowState,
|
|
180
|
+
dialogVisible: false,
|
|
181
|
+
uploadData: {
|
|
182
|
+
picType: "",
|
|
183
|
+
picAction: "",
|
|
184
|
+
resId: "",
|
|
185
|
+
},
|
|
186
|
+
uploadHeaders: {
|
|
187
|
+
Authorization: null,
|
|
188
|
+
},
|
|
189
|
+
currentFileTitle: ''
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
props: {
|
|
193
|
+
isStyle: {
|
|
194
|
+
type: Boolean,
|
|
195
|
+
default: false,
|
|
196
|
+
},
|
|
197
|
+
showEmptyText: {
|
|
198
|
+
type: Boolean,
|
|
199
|
+
default: true,
|
|
200
|
+
},
|
|
201
|
+
picType: {
|
|
202
|
+
type: String,
|
|
203
|
+
default: "cust",
|
|
204
|
+
},
|
|
205
|
+
value: {
|
|
206
|
+
type: String,
|
|
207
|
+
},
|
|
208
|
+
resId: {
|
|
209
|
+
type: String,
|
|
210
|
+
},
|
|
211
|
+
dataName: {
|
|
212
|
+
type: String,
|
|
213
|
+
},
|
|
214
|
+
edit: {
|
|
215
|
+
// 列信息
|
|
216
|
+
type: Boolean,
|
|
217
|
+
},
|
|
218
|
+
limitSize: {
|
|
219
|
+
// 限制上传大小
|
|
220
|
+
type: Number,
|
|
221
|
+
default: 5,
|
|
222
|
+
},
|
|
223
|
+
limitType: {
|
|
224
|
+
// 限制上传类型
|
|
225
|
+
type: Array,
|
|
226
|
+
default: () => {
|
|
227
|
+
return [];
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
formRow: {
|
|
231
|
+
type: Object,
|
|
232
|
+
default: () => {
|
|
233
|
+
return {};
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
width: {
|
|
237
|
+
type: String,
|
|
238
|
+
default: "100px",
|
|
239
|
+
},
|
|
240
|
+
height: {
|
|
241
|
+
type: String,
|
|
242
|
+
default: "100px",
|
|
243
|
+
},
|
|
244
|
+
rows: {
|
|
245
|
+
// 表格数据
|
|
246
|
+
type: Array,
|
|
247
|
+
default: function () {
|
|
248
|
+
return [];
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
cols: {
|
|
252
|
+
// 表格列信息
|
|
253
|
+
type: Array,
|
|
254
|
+
default: function () {
|
|
255
|
+
return [];
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
formState: {
|
|
259
|
+
// 表格列信息
|
|
260
|
+
type: String,
|
|
261
|
+
default: "",
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
watch: {
|
|
265
|
+
rows: {
|
|
266
|
+
handler: function (newVal) {
|
|
267
|
+
this.getAttachInfo(newVal);
|
|
268
|
+
},
|
|
269
|
+
deep: true,
|
|
270
|
+
},
|
|
271
|
+
resId: {
|
|
272
|
+
handler: function (newVal) {
|
|
273
|
+
this.uploadData.resId = newVal;
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
created() {
|
|
278
|
+
},
|
|
279
|
+
mounted() {
|
|
280
|
+
// 请求头加入token
|
|
281
|
+
this.uploadHeaders.Authorization = `Bearer ${this.$store.getters.token}`;
|
|
282
|
+
|
|
283
|
+
this.internalServiceUrl = attachGetAttachUrlApi();
|
|
284
|
+
this.uploadData.picType = this.picType;
|
|
285
|
+
this.uploadData.resId = this.resId;
|
|
286
|
+
this.uploadData.picAction = this.internalServiceUrl + "/UploadAttach";
|
|
287
|
+
this.getAttachInfo(this.rows);
|
|
288
|
+
},
|
|
289
|
+
methods: {
|
|
290
|
+
getCurrentToken() {
|
|
291
|
+
return this.$store.getters.token;
|
|
292
|
+
},
|
|
293
|
+
/**
|
|
294
|
+
* 获取附件信息
|
|
295
|
+
*/
|
|
296
|
+
getAttachInfo(newRows) {
|
|
297
|
+
let attachIds = [];
|
|
298
|
+
for (let i = 0; i < newRows.length; i++) {
|
|
299
|
+
if (newRows[i].attach) {
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
attachIds.push(newRows[i].attachId);
|
|
303
|
+
newRows[i].attach = {
|
|
304
|
+
fileName: "",
|
|
305
|
+
contentType: "",
|
|
306
|
+
content: "",
|
|
307
|
+
name: "",
|
|
308
|
+
id: newRows[i].attachId,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
if (attachIds.length == 0) {
|
|
312
|
+
this.internalRows = newRows;
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
let postData = {
|
|
316
|
+
fields: "id,fileName,contentType,name,content,isDefault",
|
|
317
|
+
begin: 1,
|
|
318
|
+
size: 0,
|
|
319
|
+
exp: "id in (",
|
|
320
|
+
};
|
|
321
|
+
for (let i = 0; i < attachIds.length; i++) {
|
|
322
|
+
postData.exp = postData.exp + attachIds[i] + ",";
|
|
323
|
+
}
|
|
324
|
+
let vm = this;
|
|
325
|
+
postData.exp = postData.exp.substr(0, postData.exp.length - 1) + ")";
|
|
326
|
+
attachSearchApi(postData)
|
|
327
|
+
.then((responseData) => {
|
|
328
|
+
for (let i = 0; i < responseData.content.length; i++) {
|
|
329
|
+
for (let x = 0; x < newRows.length; x++) {
|
|
330
|
+
if (responseData.content[i].id === newRows[x].attachId) {
|
|
331
|
+
newRows[x].attach.fileName = responseData.content[i].fileName;
|
|
332
|
+
newRows[x].attach.name = responseData.content[i].name;
|
|
333
|
+
newRows[x].attach.content = responseData.content[i].content;
|
|
334
|
+
newRows[x].attach.contentType =
|
|
335
|
+
responseData.content[i].contentType;
|
|
336
|
+
// newRows[x].attach.isDefault = false
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
vm.internalRows = newRows;
|
|
342
|
+
})
|
|
343
|
+
.catch(() => {});
|
|
344
|
+
},
|
|
345
|
+
attachFileClick(attachFile) {},
|
|
346
|
+
handleAvatarSuccess(info) {
|
|
347
|
+
if (info.file.status == "done") {
|
|
348
|
+
let addRow = {
|
|
349
|
+
attachId: info.file.response.content.id,
|
|
350
|
+
sysRowState: sysRowState.add,
|
|
351
|
+
attach: info.file.response.content,
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
this.internalRows.push(addRow);
|
|
355
|
+
let tempField;
|
|
356
|
+
for (let i = 0; i < this.cols.length; i++) {
|
|
357
|
+
// 赋值关联字段数据
|
|
358
|
+
let tempValue = addRow;
|
|
359
|
+
tempField = this.cols[i].field;
|
|
360
|
+
if (this.cols[i].isAuto) {
|
|
361
|
+
tempValue[tempField] = this.$store.getters.newId() + "";
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (
|
|
365
|
+
this.cols[i].controlType === "text" &&
|
|
366
|
+
this.cols[i].linkValueField !== null &&
|
|
367
|
+
this.cols[i].linkValueField !== "" &&
|
|
368
|
+
this.cols[i].linkValueField !== undefined
|
|
369
|
+
) {
|
|
370
|
+
tempValue[tempField] = this.formRow[this.cols[i].linkValueField];
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
this.$emit(
|
|
374
|
+
"add",
|
|
375
|
+
this.dataName,
|
|
376
|
+
info.file.response.content
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
beforeAvatarUpload(file) {
|
|
381
|
+
// const isPic = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
382
|
+
if (file.size / 1024 / 1024 > this.limitSize) {
|
|
383
|
+
notification.error({
|
|
384
|
+
message: "错误",
|
|
385
|
+
description: "上传图片大小不能超过 " + this.limitSize + "MB!",
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
if (this.limitType.length > 0 && !this.limitType[file.type]) {
|
|
389
|
+
notification.error({
|
|
390
|
+
message: "错误",
|
|
391
|
+
description: "上传附件格式错误!",
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
return true;
|
|
395
|
+
},
|
|
396
|
+
handleRemove(file, fileList) {
|
|
397
|
+
// this.dialogVisible = !this.dialogVisible
|
|
398
|
+
// alert(this.dialogVisible)
|
|
399
|
+
this.internalUrls = fileList;
|
|
400
|
+
this.$emit("remove", this.dataName, file.response.data);
|
|
401
|
+
// this.$emit('remove', this.dataName, file.response.data)
|
|
402
|
+
},
|
|
403
|
+
circleAttach(attachFile, internalRow) {
|
|
404
|
+
let vm = this;
|
|
405
|
+
// if(internalRow.isDefault == true){
|
|
406
|
+
this.internalRows.forEach((element) => {
|
|
407
|
+
if (element.id !== internalRow.id) {
|
|
408
|
+
element.isDefault = false;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
// }
|
|
412
|
+
},
|
|
413
|
+
removeAttach(attachFile) {
|
|
414
|
+
for (let i = 0; i < this.internalRows.length; i++) {
|
|
415
|
+
if (this.internalRows[i].attachId === attachFile.id) {
|
|
416
|
+
if (this.internalRows[i].sysRowState === sysRowState.add) {
|
|
417
|
+
this.internalRows.splice(i, 1);
|
|
418
|
+
} else {
|
|
419
|
+
this.$set(this.internalRows[i], "sysRowState", sysRowState.delete);
|
|
420
|
+
}
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
this.$emit("remove", attachFile.id);
|
|
425
|
+
},
|
|
426
|
+
downloadAttach(attachFile) {
|
|
427
|
+
window.open(
|
|
428
|
+
this.internalServiceUrl +
|
|
429
|
+
"/DownAttachFile/" +
|
|
430
|
+
attachFile.id +
|
|
431
|
+
`?accessToken=${this.$store.getters.token}`
|
|
432
|
+
);
|
|
433
|
+
},
|
|
434
|
+
/**
|
|
435
|
+
* 查看附件
|
|
436
|
+
*/
|
|
437
|
+
viewAttach(attachFile) {
|
|
438
|
+
if (attachFile.contentType === "application/pdf") {
|
|
439
|
+
this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
|
|
440
|
+
this.dialogViewType = attachFile.contentType;
|
|
441
|
+
this.dialogVisible = true;
|
|
442
|
+
} else if (attachFile.content === "image") {
|
|
443
|
+
this.dialogImageUrl = `${this.internalServiceUrl}/GetAttachFile/${attachFile.id}?accessToken=${this.$store.getters.token}`;
|
|
444
|
+
this.dialogViewType = attachFile.contentType;
|
|
445
|
+
this.dialogVisible = true;
|
|
446
|
+
}
|
|
447
|
+
this.currentFileTitle = attachFile.name
|
|
448
|
+
},
|
|
449
|
+
closePdf() {
|
|
450
|
+
this.isShowPdf = false;
|
|
451
|
+
},
|
|
452
|
+
},
|
|
453
|
+
};
|
|
454
|
+
</script>
|
|
455
|
+
|
|
456
|
+
<style lang="scss" scoped>
|
|
457
|
+
.file-card {
|
|
458
|
+
display: flex;
|
|
459
|
+
flex-flow: row wrap;
|
|
460
|
+
margin: 0 0 5px 5px;
|
|
461
|
+
|
|
462
|
+
.attach-wrapper {
|
|
463
|
+
.attach {
|
|
464
|
+
position: relative;
|
|
465
|
+
margin-right: 5px;
|
|
466
|
+
|
|
467
|
+
.attach-delete {
|
|
468
|
+
position: absolute;
|
|
469
|
+
top: -2px;
|
|
470
|
+
right: -4px;
|
|
471
|
+
opacity: 0;
|
|
472
|
+
font-size: 20px;
|
|
473
|
+
background-color: red;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.attach-delete:hover {
|
|
477
|
+
cursor: pointer;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.attach-download {
|
|
481
|
+
position: absolute;
|
|
482
|
+
bottom: 10px;
|
|
483
|
+
left: 4px;
|
|
484
|
+
opacity: 0;
|
|
485
|
+
font-size: 18px;
|
|
486
|
+
font-weight: bolder;
|
|
487
|
+
border: 1px solid #ccc;
|
|
488
|
+
border-radius: 50%;
|
|
489
|
+
border-color: transparent;
|
|
490
|
+
//background-color: rgb(255, 1, 1);
|
|
491
|
+
color: #000;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.attach-download:hover {
|
|
495
|
+
cursor: pointer;
|
|
496
|
+
color: rgb(189, 8, 8);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.attach-view {
|
|
500
|
+
position: absolute;
|
|
501
|
+
bottom: 10px;
|
|
502
|
+
right: 4px;
|
|
503
|
+
opacity: 0;
|
|
504
|
+
font-size: 18px;
|
|
505
|
+
font-weight: bolder;
|
|
506
|
+
border: 1px solid #ccc;
|
|
507
|
+
border-radius: 50%;
|
|
508
|
+
border-color: transparent;
|
|
509
|
+
//background-color: #666;
|
|
510
|
+
color: #000;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.attach-circle {
|
|
514
|
+
position: absolute;
|
|
515
|
+
// bottom: 10px;
|
|
516
|
+
top: 2px;
|
|
517
|
+
left: 4px;
|
|
518
|
+
opacity: 0;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.attach-view:hover {
|
|
522
|
+
cursor: pointer;
|
|
523
|
+
color: rgb(189, 8, 8);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.attach:hover > .attach-delete {
|
|
528
|
+
opacity: 0.8;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.attach:hover > .attach-download {
|
|
532
|
+
opacity: 0.7;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.attach:hover > .attach-view {
|
|
536
|
+
opacity: 0.7;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
.attach:hover > .attach-circle {
|
|
540
|
+
opacity: 0.9;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.avatar-uploader .el-upload {
|
|
546
|
+
border: 1px solid #d9d9d9;
|
|
547
|
+
|
|
548
|
+
border-radius: 6px;
|
|
549
|
+
cursor: pointer;
|
|
550
|
+
position: relative;
|
|
551
|
+
overflow: hidden;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.avatar-uploader .el-upload:hover {
|
|
555
|
+
border-color: #409eff;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.avatar-uploader-icon {
|
|
559
|
+
font-size: 28px;
|
|
560
|
+
color: #8c939d;
|
|
561
|
+
// width: 178px;
|
|
562
|
+
// height: 178px;
|
|
563
|
+
line-height: 178px;
|
|
564
|
+
text-align: center;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.avatar {
|
|
568
|
+
// width: 178px;
|
|
569
|
+
// height: 178px;
|
|
570
|
+
display: block;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.el-upload-list__item is-success {
|
|
574
|
+
float: left;
|
|
575
|
+
}
|
|
576
|
+
.currentHeight {
|
|
577
|
+
display: flex;
|
|
578
|
+
align-items: center;
|
|
579
|
+
}
|
|
580
|
+
</style>
|