parent
9d88c5f93d
commit
6880fda27d
@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div>
|
||||
<Modal v-model="isShow" title="流程附件" footer-hide>
|
||||
<div
|
||||
class="item"
|
||||
v-for="item in files"
|
||||
v-if="item.flow && item.flow_detail"
|
||||
>
|
||||
<div class="item__title">
|
||||
{{ itemTitle(item) }}
|
||||
</div>
|
||||
<div class="item__file" v-for="file in item.file_list">
|
||||
<a :href="file.myurl" target="_blank" :download="file.name">{{
|
||||
file.name
|
||||
}}</a>
|
||||
|
||||
<el-button
|
||||
icon="el-icon-download"
|
||||
circle
|
||||
size="mini"
|
||||
@click="down(file.myurl, file.name)"
|
||||
></el-button>
|
||||
<el-button
|
||||
icon="el-icon-search"
|
||||
circle
|
||||
size="mini"
|
||||
@click="open(file.myurl)"
|
||||
></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
:width="76"
|
||||
transfer
|
||||
v-model="showModal"
|
||||
:footer-hide="true"
|
||||
title="预览"
|
||||
>
|
||||
<template>
|
||||
<iframe
|
||||
style="width: 100%; height: 57vh"
|
||||
:src="codeUri"
|
||||
border="0"
|
||||
></iframe>
|
||||
</template>
|
||||
</Modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { httpCurl } from "@/api/out";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
showModal: false,
|
||||
codeUri: "",
|
||||
id: "",
|
||||
isShow: false,
|
||||
|
||||
files: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
setId(id) {
|
||||
this.id = id;
|
||||
},
|
||||
show() {
|
||||
this.isShow = true;
|
||||
},
|
||||
hide() {
|
||||
this.isShow = false;
|
||||
},
|
||||
|
||||
async getDetail() {
|
||||
let promiseAll = [
|
||||
httpCurl({ tbname: "hetong", out_contract_id: this.id }),
|
||||
httpCurl({ tbname: "caigou", out_caigou_id: this.id }),
|
||||
httpCurl({ tbname: "pay", out_pay_id: this.id }),
|
||||
];
|
||||
const res = await Promise.all(promiseAll);
|
||||
this.files = res;
|
||||
console.log(res);
|
||||
},
|
||||
|
||||
open(url) {
|
||||
this.codeUri = `http://view.ali251.langye.net:8012/onlinePreview?url=${encodeURIComponent(
|
||||
new Buffer(url).toString("base64")
|
||||
)}`;
|
||||
|
||||
this.showModal = true;
|
||||
},
|
||||
|
||||
down(url, name) {
|
||||
let a = document.createElement("a");
|
||||
a.setAttribute("href", url);
|
||||
a.setAttribute("download", name);
|
||||
a.setAttribute("target", "_blank");
|
||||
a.click();
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
itemTitle() {
|
||||
return function (item) {
|
||||
if (item.flow_detail.hasOwnProperty("out_caigou_id")) {
|
||||
return "采购业务审批流程文件";
|
||||
}
|
||||
if (item.flow_detail.hasOwnProperty("out_contract_id")) {
|
||||
return "合同会签流程文件";
|
||||
}
|
||||
if (item.flow_detail.hasOwnProperty("out_pay_id")) {
|
||||
return "招标审核流程文件";
|
||||
}
|
||||
};
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
isShow(newVal) {
|
||||
if (newVal) {
|
||||
this.getDetail();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
a:hover {
|
||||
color: $primaryColor;
|
||||
text-decoration: underline;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.item {
|
||||
|
||||
&__title {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
zoom: 1.1;
|
||||
|
||||
padding: 10px 0;
|
||||
}
|
||||
&__file {
|
||||
display: flex;
|
||||
|
||||
& > a {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue