diff --git a/src/main/resources/templates/admin/business/process-edit.ftl b/src/main/resources/templates/admin/business/process-edit.ftl
index ee007bd..dcb7fb1 100644
--- a/src/main/resources/templates/admin/business/process-edit.ftl
+++ b/src/main/resources/templates/admin/business/process-edit.ftl
@@ -297,11 +297,26 @@
上传附件
+
+
+ 上传附件
+ <#--展示已经上传的文件-->
+
+ 暂未上传
+
@@ -551,6 +566,7 @@
}
const methods = {
+ isNotEmpty,
changeMode(mode) {
this.mode = mode
},
@@ -918,13 +934,6 @@
return ret
}
- const mapAttachment = attachments => {
- return attachments && JSON.stringify(attachments.map(file => ({
- uri: file.response.data.url,
- name: file.response.data.originName
- })))
- }
-
const form = {
...processForm,
processType,
@@ -947,7 +956,7 @@
details: computePurchaseAmountDetail(detail.budgetCostId)
})),
supplierMaterials: supplierMaterialsForm.filter(hasProperties).map(item => ({
- ...item, attachment: mapAttachment(item.attachment)
+ ...item, attachment: JSON.stringify(item.attachment)
})),
}
@@ -1036,6 +1045,10 @@
scope.row['attachment'] = fileList
},
+ removeSupplierMaterialAttachment(scope, attachmentToRemove) {
+ scope.row['attachment'] = scope.row['attachment'].filter(item => item === attachmentToRemove)
+ },
+
handleSupplierMaterialExceed(scope, files, fileList) {
this.$message.warning("当前限制选择只能选择10个文件");
scope.row['attachment'] = fileList
@@ -1051,7 +1064,17 @@
handleSupplierMaterialFileUploaded(scope, response, file, fileList) {
if (response.success) {
- scope.row['attachment'] = fileList
+ let attachments = scope.row['attachment']
+ if (isEmpty(attachments)) {
+ attachments = []
+ scope.row['attachment'] = attachments
+ }
+ attachments.push({
+ uri: response.data.url,
+ name: file.name
+ })
+
+ this.$message.success("上传成功");
}
else {
this.$message.warning("上传失败");
diff --git a/src/main/resources/templates/admin/business/process-new.ftl b/src/main/resources/templates/admin/business/process-new.ftl
index 9103450..ec70c0f 100644
--- a/src/main/resources/templates/admin/business/process-new.ftl
+++ b/src/main/resources/templates/admin/business/process-new.ftl
@@ -409,19 +409,27 @@
-
-
- {{scope.row.attachment.name}}
-
-
-
- 上传附件
+ :on-exceed="(files, fileList) => handleSupplierMaterialExceed(scope, files, fileList)">
+
+ 上传附件
+ <#--展示已经上传的文件-->
+
+ 暂未上传
+
+
@@ -680,6 +688,7 @@
isEmpty,
isBlank,
hasText,
+ isNotEmpty,
changeMode(mode) {
this.mode = mode
},
@@ -1094,12 +1103,6 @@
return ret
}
- const mapAttachment = attachments => {
- return attachments && JSON.stringify(attachments.map(file => ({
- uri: file.response.data.url,
- name: file.response.data.originName
- })))
- }
const form = {
...processForm,
processType,
@@ -1120,7 +1123,7 @@
})),
// 剔除空行
supplierMaterials: supplierMaterialsForm.filter(hasProperties).map(item => ({
- ...item, attachment: mapAttachment(item.attachment)
+ ...item, attachment: JSON.stringify(item.attachment) // 转化为 字符串
})),
}
const loading = this.$loading({
@@ -1217,12 +1220,16 @@
},
handleSupplierMaterialRemove(scope, fileList) {
- scope.row['fileList'] = fileList
+ scope.row['attachment'] = fileList
+ },
+
+ removeSupplierMaterialAttachment(scope, attachmentToRemove) {
+ scope.row['attachment'] = scope.row['attachment'].filter(item => item === attachmentToRemove)
},
handleSupplierMaterialExceed(scope, files, fileList) {
this.$message.warning("当前限制选择只能选择10个文件");
- scope.row['fileList'] = fileList
+ scope.row['attachment'] = fileList
},
beforeSupplierMaterialRemove(scope, file, fileList) {
@@ -1235,9 +1242,18 @@
handleSupplierMaterialFileUploaded(scope, response, file, fileList) {
if (response.success) {
- scope.row['fileList'] = fileList
+ console.log(fileList)
+ let attachments = scope.row['attachment']
+ if (isEmpty(attachments)) {
+ attachments = []
+ scope.row['attachment'] = attachments
+ }
+ attachments.push({
+ uri: response.data.url,
+ name: file.name
+ })
- this.fileListSupplierMaterial = fileList
+ this.$message.success("上传成功");
}
else {
this.$message.warning("上传失败");