@lambo-design/workflow-approve 1.0.0-beta.10
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/index.js +9 -0
- package/package.json +31 -0
- package/src/components/assignee-box.vue +353 -0
- package/src/components/history.vue +378 -0
- package/src/components/horizontal/attachment.vue +224 -0
- package/src/components/horizontal/history.vue +464 -0
- package/src/components/horizontal/opinion.vue +263 -0
- package/src/components/opinion.vue +302 -0
- package/src/components/title.vue +24 -0
- package/src/horizontal.vue +1002 -0
- package/src/portrait.vue +1059 -0
- package/src/static/icons/bohui.png +0 -0
- package/src/static/icons/bohui1.png +0 -0
- package/src/static/icons/chehui.png +0 -0
- package/src/static/icons/daiban.png +0 -0
- package/src/static/icons/tongguo.png +0 -0
- package/src/static/icons/tongguo1.png +0 -0
- package/src/styles/css/index.less +220 -0
- package/src/workflow-diagram.vue +332 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
|
|
4
|
+
<Timeline class="portrait-timeline">
|
|
5
|
+
<TimelineItem v-for="(items,index) in itemList" :key="index" class="portrait-timeline-item">
|
|
6
|
+
<template #dot>
|
|
7
|
+
<div v-if="items[0].auditResult === '30' || items[0].auditResult === '80'" class="cicle" style="background-color: #005aff"></div>
|
|
8
|
+
<div v-else-if="items[0].auditResult === '40' || items[0].auditResult === '50'" class="cicle" style="background-color: #ffcc66"></div>
|
|
9
|
+
<div v-else-if="items[0].auditResult === '60'" class="cicle" style="background-color: #ed4014"></div>
|
|
10
|
+
<div v-else class="cicle" style="background-color: #ff9900"></div>
|
|
11
|
+
</template>
|
|
12
|
+
<Collapse v-model="activeName" simple style="margin: -10px 0 0 -2px;border: none">
|
|
13
|
+
<Panel :name="'panel' + index" hide-arrow>
|
|
14
|
+
<span class="history-title"> {{ items[0].taskName }}</span>
|
|
15
|
+
<template #content>
|
|
16
|
+
<div v-for="(item, index) in items" :key="index">
|
|
17
|
+
<div v-for="(itemListItem, itemListIndex) in item.auditName" :key="itemListIndex">
|
|
18
|
+
<Card dis-hover
|
|
19
|
+
class="portrait-card"
|
|
20
|
+
:bordered="false">
|
|
21
|
+
<List item-layout="vertical">
|
|
22
|
+
<ListItem>
|
|
23
|
+
<Row style="display: flex; align-items: center;">
|
|
24
|
+
<!-- 左边:Avatar -->
|
|
25
|
+
<Col>
|
|
26
|
+
<avatar
|
|
27
|
+
:class="portraitWidth >= 600 ? 'portrait-avatar-large' : 'portrait-avatar-small'"
|
|
28
|
+
size="small">
|
|
29
|
+
{{ getFirstName(itemListItem) }}</avatar>
|
|
30
|
+
</Col>
|
|
31
|
+
<!-- 右边:审批信息 -->
|
|
32
|
+
<Col span="17">
|
|
33
|
+
<Row>
|
|
34
|
+
<tooltip>
|
|
35
|
+
<span class="audit-name-style"> {{ itemListItem }}</span>
|
|
36
|
+
<div slot="content" style="white-space: normal"> {{ itemListItem }}</div>
|
|
37
|
+
</tooltip>
|
|
38
|
+
<Divider style="background-color:#808695;height: 1em;margin: 4px 9px 0 6px;"
|
|
39
|
+
type="vertical"/>
|
|
40
|
+
<span v-if="item.auditOrganName"
|
|
41
|
+
class="audit-name-style"> {{ item.auditOrganName[itemListIndex] }}</span>
|
|
42
|
+
<span v-if="portraitWidth === 0 || portraitWidth >= 600" class="audit-date-style">
|
|
43
|
+
{{ item.startDate }}{{ item.auditDate }}
|
|
44
|
+
</span>
|
|
45
|
+
</Row>
|
|
46
|
+
<Row v-if="item.auditComment">
|
|
47
|
+
<span class="audit-name-style">{{ item.auditComment }}</span>
|
|
48
|
+
</Row>
|
|
49
|
+
<Row v-if="portraitWidth < 600" class="portrait-audit-date-style">{{showDate(item)}}{{ item.startDate }}{{ item.auditDate }}</Row>
|
|
50
|
+
<Row style="margin-top: 10px">
|
|
51
|
+
<Col span="12">
|
|
52
|
+
<span style="color: #005aff;; font-size: 13px;"
|
|
53
|
+
v-if="item.auditResult === '30'">通过</span>
|
|
54
|
+
<span style="color: #ed4014; font-size: 13px;"
|
|
55
|
+
v-else-if="item.auditResult === '40'">驳回到上一节点</span>
|
|
56
|
+
<span style="color: #ed4014; font-size: 13px;"
|
|
57
|
+
v-else-if="item.auditResult === '50'">驳回到原点</span>
|
|
58
|
+
<span style="color: #ed4014; font-size: 13px;"
|
|
59
|
+
v-else-if="item.auditResult === '60'">撤回</span>
|
|
60
|
+
<span style="color: #19be6b; font-size: 13px;"
|
|
61
|
+
v-else-if="item.auditResult === '80'">跳转到指定节点</span>
|
|
62
|
+
<span style="color: #19be6b; font-size: 13px;"
|
|
63
|
+
v-else-if="item.auditResult === '90'">驳回到指定节点</span>
|
|
64
|
+
<span style="color: #ff9900; font-size: 13px;" v-else>待审批</span>
|
|
65
|
+
</Col>
|
|
66
|
+
<Col span="12" style="text-align: right">
|
|
67
|
+
<Button v-if="item.fileList && item.fileList.length > 0" size="small" type="primary" ghost class="urging" @click="openModal(item)">查看附件</Button>
|
|
68
|
+
<Button v-if="displayPushButton && item.auditResult !== '30'&&item.auditResult !== '40'&&item.auditResult !== '50'&&item.auditResult !== '60'&&item.auditResult!=='80'&&item.auditResult!=='90'"
|
|
69
|
+
size="small" type="primary" ghost class="urging"
|
|
70
|
+
@click="pushHim(item,itemListItem,itemListIndex)">催一下
|
|
71
|
+
</Button>
|
|
72
|
+
</Col>
|
|
73
|
+
</Row>
|
|
74
|
+
</Col>
|
|
75
|
+
</Row>
|
|
76
|
+
|
|
77
|
+
</ListItem>
|
|
78
|
+
</List>
|
|
79
|
+
</Card>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
</Panel>
|
|
84
|
+
</Collapse>
|
|
85
|
+
</TimelineItem>
|
|
86
|
+
</Timeline>
|
|
87
|
+
|
|
88
|
+
<Modal
|
|
89
|
+
v-model="showModal"
|
|
90
|
+
title="查看附件"
|
|
91
|
+
>
|
|
92
|
+
<Table border
|
|
93
|
+
:columns="attachmentColumn"
|
|
94
|
+
:data="fileList"
|
|
95
|
+
>
|
|
96
|
+
</Table>
|
|
97
|
+
</Modal>
|
|
98
|
+
<div v-if="0 < allGroupKeys.length">
|
|
99
|
+
<div v-show="arrowShow" class="arrow">
|
|
100
|
+
<a @click="arrowClick">
|
|
101
|
+
<Icon type="ios-arrow-down"/>
|
|
102
|
+
展开显示更多
|
|
103
|
+
</a>
|
|
104
|
+
</div>
|
|
105
|
+
<div v-show="!arrowShow" class="arrow">
|
|
106
|
+
<a @click="arrowClick">
|
|
107
|
+
<Icon type="ios-arrow-up"/>
|
|
108
|
+
收缩
|
|
109
|
+
</a>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
<Modal title="查看附件" v-model="modalImg" fullscreen scrollable :mask="false">
|
|
113
|
+
<img :src="image" v-if="modalImg" alt="" style="width: 100%">
|
|
114
|
+
<div slot="footer">
|
|
115
|
+
<Button type="primary" @click="modalImg = false">关闭</Button>
|
|
116
|
+
</div>
|
|
117
|
+
</Modal>
|
|
118
|
+
<Modal title="查看附件" v-model="modalDocx" fullscreen scrollable :mask="false">
|
|
119
|
+
<div ref="file"></div>
|
|
120
|
+
</Modal>
|
|
121
|
+
</div>
|
|
122
|
+
</template>
|
|
123
|
+
|
|
124
|
+
<script>
|
|
125
|
+
import ajax from "@lambo-design/shared/utils/ajax";
|
|
126
|
+
import { operateHref } from '@lambo-design/shared/utils/assist'
|
|
127
|
+
import axios from 'axios';
|
|
128
|
+
// 引入docx-preview插件
|
|
129
|
+
let docx = require('docx-preview');
|
|
130
|
+
export default {
|
|
131
|
+
components: {},
|
|
132
|
+
props: {
|
|
133
|
+
list: {
|
|
134
|
+
type: Array,
|
|
135
|
+
default: () => []
|
|
136
|
+
},
|
|
137
|
+
applyId: {
|
|
138
|
+
type: String,
|
|
139
|
+
default: ""
|
|
140
|
+
},
|
|
141
|
+
donePage: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: false
|
|
144
|
+
},
|
|
145
|
+
//横竖版样式不同
|
|
146
|
+
portraitWidth: {
|
|
147
|
+
type: Number,
|
|
148
|
+
default: 0
|
|
149
|
+
},
|
|
150
|
+
smartFlowServerContext: {
|
|
151
|
+
type: String,
|
|
152
|
+
default: '/api/smart-flow-server',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
data() {
|
|
156
|
+
return {
|
|
157
|
+
allGroupKeys: [],
|
|
158
|
+
displayedList: [],
|
|
159
|
+
arrowShow: true, // 控制加载更多按钮的显示
|
|
160
|
+
activeName: 'panel0',
|
|
161
|
+
modalDocx: false,
|
|
162
|
+
setModals: {
|
|
163
|
+
modals: []
|
|
164
|
+
},
|
|
165
|
+
showModal: false,
|
|
166
|
+
fileList: [],
|
|
167
|
+
modalImg: false,
|
|
168
|
+
image: "",
|
|
169
|
+
itemList: {},
|
|
170
|
+
auditNameList: [],
|
|
171
|
+
displayPushButton: false,
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
computed: {
|
|
175
|
+
attachmentColumn: function () {
|
|
176
|
+
let column = [];
|
|
177
|
+
column.push({title: '序号', type: 'index', width: 70, align: 'center', fixed: 'left'});
|
|
178
|
+
column.push({
|
|
179
|
+
title: '附件名称', key: 'fileName', minWidth: 150, align: 'center', fixed: 'left',
|
|
180
|
+
render(h, {row}) {
|
|
181
|
+
const index = row.fileName.lastIndexOf(".");
|
|
182
|
+
const fileName = row.fileName.substr(0, index)
|
|
183
|
+
return h("span", fileName)
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
column.push({
|
|
188
|
+
title: '附件类型', width: 100, align: 'center', fixed: 'left',
|
|
189
|
+
render: (h, {row}) => {
|
|
190
|
+
const index = row.fileName.lastIndexOf(".");
|
|
191
|
+
const fileType = row.fileName.substr(index + 1)
|
|
192
|
+
return h("span", fileType)
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
column.push({
|
|
197
|
+
title: "操作", width: 160, align: 'center', tooltip: true,
|
|
198
|
+
render: (h, {row}) => {
|
|
199
|
+
const index = row.fileName.lastIndexOf(".");
|
|
200
|
+
const fileType = row.fileName.substr(index + 1).toLowerCase()
|
|
201
|
+
const typeList=['jpg','gif','png','docx']
|
|
202
|
+
if (typeList.indexOf(fileType) !== -1) {
|
|
203
|
+
return h("div", [
|
|
204
|
+
operateHref(this, h, row, "下载", () => {
|
|
205
|
+
this.getAttach(row);
|
|
206
|
+
}, "primary"),
|
|
207
|
+
operateHref(this, h, row, "预览", () => {
|
|
208
|
+
this.preViewAttach(row);
|
|
209
|
+
}, "primary")
|
|
210
|
+
]);
|
|
211
|
+
} else {
|
|
212
|
+
return h("div", [
|
|
213
|
+
operateHref(this, h, row, "下载", () => {
|
|
214
|
+
this.getAttach(row);
|
|
215
|
+
}, "primary")
|
|
216
|
+
]);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
});
|
|
222
|
+
return column;
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
methods: {
|
|
226
|
+
pushHim(item, auditName, index) {
|
|
227
|
+
if (this.isDebouncing) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
this.isDebouncing = true;
|
|
232
|
+
// 设置一个延时,例如 1 秒,之后重置防抖状态
|
|
233
|
+
setTimeout(() => {
|
|
234
|
+
this.isDebouncing = false;
|
|
235
|
+
}, 2000);
|
|
236
|
+
|
|
237
|
+
let self = this;
|
|
238
|
+
let applyUserName = item.applyUser.split(":")[1];
|
|
239
|
+
let params = {
|
|
240
|
+
applyUserName: applyUserName,
|
|
241
|
+
auditName: auditName,
|
|
242
|
+
auditId: item.auditId[index],
|
|
243
|
+
procName: item.procName,
|
|
244
|
+
effectTime: item.startDate,
|
|
245
|
+
expireTime: item.warningDate,
|
|
246
|
+
};
|
|
247
|
+
let url = self.smartFlowServerContext + "/manage/processTodo/sendMessage";
|
|
248
|
+
ajax.post(url, params).then(function (resp) {
|
|
249
|
+
console.log("message ", resp);
|
|
250
|
+
if (resp.data.code == 200) {
|
|
251
|
+
self.$Message.success("催办成功");
|
|
252
|
+
} else {
|
|
253
|
+
self.$Message.error("催办失败");
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
getAttach(row) {
|
|
258
|
+
window.open(this.smartFlowServerContext + "/manage/oss/file/get/" + row.fileId, "_blank");
|
|
259
|
+
},
|
|
260
|
+
preViewAttach(row) {
|
|
261
|
+
let reg = /\.(gif|jpg|jpeg|bmp|png|PNG)$/
|
|
262
|
+
let regs = /\.(pdf)$/
|
|
263
|
+
if (reg.test(row.fileName)) {
|
|
264
|
+
let url = this.smartFlowServerContext + "/manage/oss/file/get/" + row.fileId;
|
|
265
|
+
this.imgPreview(url);
|
|
266
|
+
} else if (regs.test(row.fileName)) {
|
|
267
|
+
window.open(this.smartFlowServerContext + "/manage/oss/file/getFileStream?fileId=" + row.fileId, "_blank");
|
|
268
|
+
} else {
|
|
269
|
+
this.modalDocx = true
|
|
270
|
+
axios({
|
|
271
|
+
method: 'get',
|
|
272
|
+
responseType: 'blob', // 因为是流文件,所以要指定blob类型
|
|
273
|
+
url: this.smartFlowServerContext + "/manage/oss/file/get/" + row.fileId// 一个word下载文件的接口
|
|
274
|
+
}).then(({data}) => {
|
|
275
|
+
docx.renderAsync(data, this.$refs.file, null, {
|
|
276
|
+
className: "docx", //默认和文档样式类的类名/前缀
|
|
277
|
+
inWrapper: true, //启用围绕文档内容呈现包装器
|
|
278
|
+
ignoreWidth: false, //禁用页面的渲染宽度
|
|
279
|
+
ignoreHeight: false, //禁用页面的渲染高度
|
|
280
|
+
ignoreFonts: false, //禁用字体渲染
|
|
281
|
+
breakPages: true, //在分页符上启用分页
|
|
282
|
+
ignoreLastRenderedPageBreak: true, //在lastRenderedPageBreak元素上禁用分页
|
|
283
|
+
experimental: false, //启用实验功能(制表符停止计算)
|
|
284
|
+
trimXmlDeclaration: true, //如果为true,则在解析之前将从xml文档中删除xml声明
|
|
285
|
+
useBase64URL: false, //如果为true,图像、字体等将转换为base 64 URL,否则使用URL.createObjectURL
|
|
286
|
+
useMathMLPolyfill: false, //包括用于铬、边等的MathML多填充。
|
|
287
|
+
showChanges: false, //启用文档更改的实验渲染(插入/删除)
|
|
288
|
+
debug: false, //启用额外的日志记录
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
//查看附件
|
|
295
|
+
imgPreview: function (img) {
|
|
296
|
+
this.modalImg = true
|
|
297
|
+
this.image = img;
|
|
298
|
+
},
|
|
299
|
+
arrowClick() {
|
|
300
|
+
if (this.itemList.length > 0) {
|
|
301
|
+
if (this.arrowShow) {
|
|
302
|
+
// 显示全部
|
|
303
|
+
this.displayedList = this.itemList;
|
|
304
|
+
this.arrowShow = false;
|
|
305
|
+
} else {
|
|
306
|
+
// 只显示两个
|
|
307
|
+
this.displayedList = this.itemList.slice(0, 2);
|
|
308
|
+
this.arrowShow = true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
openModal(item) {
|
|
313
|
+
this.fileList = item.fileList
|
|
314
|
+
this.showModal = true
|
|
315
|
+
},
|
|
316
|
+
getFirstName(item) {
|
|
317
|
+
return item ? item[0] : ''
|
|
318
|
+
},
|
|
319
|
+
showDate(item) {
|
|
320
|
+
if (item.auditResult){
|
|
321
|
+
return '处理时间:'
|
|
322
|
+
}
|
|
323
|
+
return '接收时间:'
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
mounted() {
|
|
327
|
+
this.displayPushButton = this.donePage;
|
|
328
|
+
this.itemList = this.list;
|
|
329
|
+
if (this.itemList.length > 0) {
|
|
330
|
+
this.displayedList = this.itemList.slice(0, 2);
|
|
331
|
+
// 初始化modals
|
|
332
|
+
this.setModals.modals = this.itemList.map(() => ({value: false}));
|
|
333
|
+
this.activeName = 'panel0';
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
watch: {
|
|
337
|
+
list: function (newValue) {
|
|
338
|
+
this.$nextTick(() => {
|
|
339
|
+
this.itemList = newValue;
|
|
340
|
+
if (this.itemList.length > 0) {
|
|
341
|
+
this.displayedList = this.itemList.slice(0, 2);
|
|
342
|
+
this.setModals.modals = this.itemList.map(() => ({value: false}));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
}
|
|
351
|
+
</script>
|
|
352
|
+
|
|
353
|
+
<style scoped>
|
|
354
|
+
@import "../styles/css/index.less";
|
|
355
|
+
/deep/ .docx {
|
|
356
|
+
width: 100% !important;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/deep/ .ivu-timeline-item-tail {
|
|
360
|
+
border-style: solid;
|
|
361
|
+
border-left: none;
|
|
362
|
+
border-color: #005aff;
|
|
363
|
+
border-width: thin;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/deep/ .ivu-list-item {
|
|
367
|
+
padding-bottom: 0 !important;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/deep/ .ivu-collapse-content-box {
|
|
371
|
+
padding: 0 !important;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/deep/ .ivu-card-body {
|
|
375
|
+
padding: 5px !important;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
</style>
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<Row>
|
|
4
|
+
<Row>
|
|
5
|
+
<span v-for="(item, index) in attachmentdata" :key="index" style="font-size: 14px">
|
|
6
|
+
<span v-if="index>0">、</span>
|
|
7
|
+
<span style="color:#2D8cF0 "> {{ item.fileName }}</span>
|
|
8
|
+
<a @click="forRemoveAttachment(index)" style="font-size: 13px;">.删除</a>
|
|
9
|
+
</span>
|
|
10
|
+
<div>
|
|
11
|
+
<div slot="buttons">
|
|
12
|
+
<Upload :action="actionUrl" :on-error="handleError" :before-upload="handleUpload" :show-upload-list="false"
|
|
13
|
+
multiple
|
|
14
|
+
:on-success="handleSuccess" :on-progress="handleProgress"
|
|
15
|
+
:on-format-error="handleFormatError"
|
|
16
|
+
:format="['xlsx', 'xls','txt','rar','zip','doc','docx','jpg','pdf','gif','png']">
|
|
17
|
+
<Button :loading="loading" icon="ios-arrow-round-up" type="primary"
|
|
18
|
+
style="color: #808080;border-color:#e0e0e0;" ghost>添加附件
|
|
19
|
+
</Button>
|
|
20
|
+
</Upload>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</Row>
|
|
24
|
+
<Row style="margin-top: 10px">
|
|
25
|
+
<span style="color: red;font-size: 14px">* 支持扩展名: .rar .zip .doc .docx .pdf .jpg...</span>
|
|
26
|
+
</Row>
|
|
27
|
+
</Row>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: "attachment",
|
|
36
|
+
components: {},
|
|
37
|
+
props: {
|
|
38
|
+
actionUrl: {
|
|
39
|
+
default: "/api/oss-server/file/put",
|
|
40
|
+
},
|
|
41
|
+
attachmentdata: {
|
|
42
|
+
type: Array,
|
|
43
|
+
default: function () {
|
|
44
|
+
return []
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
attachmentColumn: {
|
|
48
|
+
default: function () {
|
|
49
|
+
let column = [
|
|
50
|
+
{title: "序号", type: 'index', width: 80, align: "center"},
|
|
51
|
+
{
|
|
52
|
+
title: "相关附件", key: "fileName", minWidth: 200, align: 'left', tooltip: true,
|
|
53
|
+
render: (h, {row}) => {
|
|
54
|
+
return h("a", {
|
|
55
|
+
on: {
|
|
56
|
+
'click': () => {
|
|
57
|
+
let reg = /\.(gif|jpg|jpeg|bmp|png)$/
|
|
58
|
+
let regs = /\.pdf$/
|
|
59
|
+
if (reg.test(row.fileName)) {
|
|
60
|
+
let imgs = [];
|
|
61
|
+
let url = this.ossServerContext + "/file/get/" + row.fileId;
|
|
62
|
+
this.imgPreview(url);
|
|
63
|
+
} else if (regs.test(row.fileName)) {
|
|
64
|
+
window.open(this.ossServerContext + "/file/getFileStream?fileId=" + row.fileId, "_blank");
|
|
65
|
+
} else {
|
|
66
|
+
window.open(this.ossServerContext + "/file/get/" + row.fileId, "_blank");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, row.fileName);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
title: "操作", width: 80, align: "center",
|
|
75
|
+
render: (h, {index}) => {
|
|
76
|
+
return h('div', [
|
|
77
|
+
h('Button', {
|
|
78
|
+
props: {
|
|
79
|
+
type: 'warning',
|
|
80
|
+
size: 'small',
|
|
81
|
+
ghost: true
|
|
82
|
+
},
|
|
83
|
+
on: {
|
|
84
|
+
click: () => {
|
|
85
|
+
this.forRemoveAttachment(index)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, '删除')
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
return column
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
data() {
|
|
98
|
+
return {
|
|
99
|
+
loading: false,
|
|
100
|
+
modalImg: false,
|
|
101
|
+
image: "",
|
|
102
|
+
tempFileArr: [],
|
|
103
|
+
percentage: null,
|
|
104
|
+
file_name: '',
|
|
105
|
+
fileList: [],
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
methods: {
|
|
109
|
+
openAttachment(item) {
|
|
110
|
+
let reg = /\.(gif|jpg|jpeg|bmp|png)$/;
|
|
111
|
+
let regs = /\.pdf$/;
|
|
112
|
+
|
|
113
|
+
if (reg.test(item.fileName)) {
|
|
114
|
+
let imgs = [];
|
|
115
|
+
let url = this.ossServerContext + "/file/get/" + item.fileId;
|
|
116
|
+
this.imgPreview(url);
|
|
117
|
+
} else if (regs.test(item.fileName)) {
|
|
118
|
+
window.open(this.ossServerContext + "/file/getFileStream?fileId=" + item.fileId, "_blank");
|
|
119
|
+
} else {
|
|
120
|
+
window.open(this.ossServerContext + "/file/get/" + item.fileId, "_blank");
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
handleSuccess: function (response, file, fileList) {
|
|
124
|
+
let self = this;
|
|
125
|
+
let tempArr = JSON.parse(JSON.stringify(this.tempFileArr))
|
|
126
|
+
|
|
127
|
+
tempArr.forEach(function (value, index, array) {
|
|
128
|
+
if (value == file.name) {
|
|
129
|
+
self.tempFileArr.splice(index, 1)
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
if (response.code == 1 && self.tempFileArr && self.tempFileArr.length < 1) {
|
|
134
|
+
self.loading = false;
|
|
135
|
+
self.$Message.success("上传成功");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (response.code == 1) {
|
|
139
|
+
if (response.data != undefined && response.data != null && response.data.length > 0) {
|
|
140
|
+
let tempData = [].concat(response.data);
|
|
141
|
+
this.attachmentdata.push({
|
|
142
|
+
fileName: tempData[0].originalName,
|
|
143
|
+
fileId: tempData[0].fileName,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
this.fileList = fileList
|
|
148
|
+
|
|
149
|
+
} else {
|
|
150
|
+
self.loading = false;
|
|
151
|
+
this.$Message.error({
|
|
152
|
+
content: file.name + '上传失败!',
|
|
153
|
+
});
|
|
154
|
+
//this.$Message.error("上传失败!");
|
|
155
|
+
|
|
156
|
+
let j = 0;
|
|
157
|
+
for (let i = 0; i < fileList.length; i++) {
|
|
158
|
+
if (fileList[i].canceled) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (fileList[i].name === file.name && fileList[i].timestamp === file.timestamp) {
|
|
162
|
+
j = i;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
//console.log(fileList)
|
|
167
|
+
fileList.splice(j, 1);
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
},
|
|
172
|
+
handleError: function (error, file, fileList) {
|
|
173
|
+
this.loading = false
|
|
174
|
+
this.$Message.error({
|
|
175
|
+
content: fileList.name + ' 上传失败!',
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
handleUpload: function (file) {
|
|
179
|
+
if (!file.canceled) {
|
|
180
|
+
this.tempFileArr.push(file.name)
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
forRemoveAttachment: function (index) {
|
|
184
|
+
this.attachmentdata.splice(index, 1);
|
|
185
|
+
this.$refs.attachmentTable.tableRefresh()
|
|
186
|
+
},
|
|
187
|
+
//查看附件
|
|
188
|
+
imgPreview: function (img) {
|
|
189
|
+
this.modalImg = true
|
|
190
|
+
this.image = img;
|
|
191
|
+
},
|
|
192
|
+
//查看附件
|
|
193
|
+
cancelUpload: function (item, fileList) {
|
|
194
|
+
item.showProgress = false;
|
|
195
|
+
item.canceled = true;
|
|
196
|
+
},
|
|
197
|
+
handleProgress(event, file, fileList) {
|
|
198
|
+
this.loading = true
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
},
|
|
202
|
+
handleFormatError(file) {
|
|
203
|
+
this.loading = false
|
|
204
|
+
this.$Notice.warning({
|
|
205
|
+
title: "文件格式不正确",
|
|
206
|
+
desc: "文件 " + file.name + " 格式不支持,请上传其他格式的文件。",
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
<style scoped>
|
|
215
|
+
.demo-spin-icon-load {
|
|
216
|
+
animation: ani-demo-spin 1s linear infinite;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/deep/ .ivu-icon {
|
|
220
|
+
zoom: 130%;
|
|
221
|
+
color: #808080;
|
|
222
|
+
margin-right: -1px;
|
|
223
|
+
}
|
|
224
|
+
</style>
|