|
@@ -201,6 +201,20 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
+ <template #attachments>
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-upload
|
|
|
+ v-model:fileList="fileList"
|
|
|
+ action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
|
|
|
+ :data="uploadFileData"
|
|
|
+ multiple
|
|
|
+ :before-upload="beforeUpload"
|
|
|
+ :on-success="onSuccessFile"
|
|
|
+ :on-preview="onPreviewFile">
|
|
|
+ <el-button style="background: #20b2aa; color: #fff; border: 1px solid #20b2aa">上传</el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template #template>
|
|
|
<div style="width: 100%">
|
|
|
<el-form-item label="合同模板" prop="contractTemplateId" style="width: 100%; margin-bottom: 18px">
|
|
@@ -239,6 +253,7 @@ const formData = reactive({
|
|
|
receiveGoodsType: 1,
|
|
|
contract: "",
|
|
|
purchaseBomList: [],
|
|
|
+ fileList: [],
|
|
|
},
|
|
|
});
|
|
|
const judgeStatus = () => {
|
|
@@ -335,11 +350,6 @@ const formConfig = computed(() => {
|
|
|
controls: false,
|
|
|
itemWidth: 33,
|
|
|
},
|
|
|
- // {
|
|
|
- // type: "title",
|
|
|
- // title: "附件",
|
|
|
- // label: "",
|
|
|
- // },
|
|
|
{
|
|
|
type: "title",
|
|
|
title: "款项金额",
|
|
@@ -351,6 +361,16 @@ const formConfig = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
type: "title",
|
|
|
+ title: "附件",
|
|
|
+ label: "",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "slot",
|
|
|
+ slotName: "attachments",
|
|
|
+ label: "附件",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: "title",
|
|
|
title: "合同内容",
|
|
|
label: "",
|
|
|
},
|
|
@@ -514,6 +534,23 @@ const handleSubmit = async (flag) => {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (fileList.value && fileList.value.length > 0) {
|
|
|
+ for (let i = 0; i < fileList.value.length; i++) {
|
|
|
+ if (fileList.value[i].raw.uploadState) {
|
|
|
+ ElMessage("文件上传中,请稍后提交");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ formData.data.fileList = fileList.value.map((item) => {
|
|
|
+ return {
|
|
|
+ id: item.raw.id,
|
|
|
+ fileName: item.raw.fileName,
|
|
|
+ fileUrl: item.raw.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ formData.data.fileList = [];
|
|
|
+ }
|
|
|
return true;
|
|
|
} else {
|
|
|
setTimeout(() => {
|
|
@@ -527,6 +564,23 @@ const handleSubmit = async (flag) => {
|
|
|
const getFormData = () => {
|
|
|
return proxy.deepClone(formData.data);
|
|
|
};
|
|
|
+const fileList = ref([]);
|
|
|
+const uploadFileData = ref({});
|
|
|
+const beforeUpload = async (file) => {
|
|
|
+ const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
|
|
|
+ uploadFileData.value = res.uploadBody;
|
|
|
+ file.id = res.id;
|
|
|
+ file.fileName = res.fileName;
|
|
|
+ file.fileUrl = res.fileUrl;
|
|
|
+ file.uploadState = true;
|
|
|
+ return true;
|
|
|
+};
|
|
|
+const onSuccessFile = (any, UploadFile) => {
|
|
|
+ UploadFile.raw.uploadState = false;
|
|
|
+};
|
|
|
+const onPreviewFile = (file) => {
|
|
|
+ window.open(file.raw.fileUrl, "_blank");
|
|
|
+};
|
|
|
watch(
|
|
|
() => props.queryData,
|
|
|
(newValue) => {
|
|
@@ -554,6 +608,21 @@ watch(
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ if (formData.data.id) {
|
|
|
+ proxy.post("/fileInfo/getList", { businessIdList: [formData.data.id] }).then((fileObj) => {
|
|
|
+ if (fileObj[formData.data.id] && fileObj[formData.data.id].length > 0) {
|
|
|
+ fileList.value = fileObj[formData.data.id].map((item) => {
|
|
|
+ return {
|
|
|
+ raw: item,
|
|
|
+ name: item.fileName,
|
|
|
+ url: item.fileUrl,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ fileList.value = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
{
|