diff --git a/src/main/resources/templates/admin/business/process-edit.ftl b/src/main/resources/templates/admin/business/process-edit.ftl index 82e4011..d204022 100644 --- a/src/main/resources/templates/admin/business/process-edit.ftl +++ b/src/main/resources/templates/admin/business/process-edit.ftl @@ -302,20 +302,19 @@ :before-remove="(file, fileList) => beforeSupplierMaterialRemove(scope, file, fileList)" :on-success="(response, file, fileList) => handleSupplierMaterialFileUploaded(scope, response, file, fileList)" :on-exceed="(files, fileList) => handleSupplierMaterialExceed(scope, files, fileList)"> - 上传附件 - - + 上传附件 <#--展示已经上传的文件--> -
- 只能上传PDF、excel、word、图片、压缩包,且不超过50MB
+
+ - {{attachment.name}} + {{attachment.name|ellipsis}}
- 暂未上传 + 暂未上传
@@ -723,9 +722,7 @@ const mapAttachment = attachment => { if (hasText(attachment)) { try { - return JSON.parse(attachment).map(item => ({ - name: item.name, url: item.uri - })) + return JSON.parse(attachment) } catch (e) { return [] } @@ -1042,16 +1039,22 @@ }, handleSupplierMaterialRemove(scope, fileList) { - scope.row['attachment'] = fileList + scope.row['attachment'] = fileList.map(file => ({ + uri: file.response.data.url, + name: file.name + })) }, removeSupplierMaterialAttachment(scope, attachmentToRemove) { - scope.row['attachment'] = scope.row['attachment'].filter(item => item === attachmentToRemove) + scope.row['attachment'] = scope.row['attachment'].filter(item => item !== attachmentToRemove) }, handleSupplierMaterialExceed(scope, files, fileList) { this.$message.warning("当前限制选择只能选择10个文件"); - scope.row['attachment'] = fileList + scope.row['attachment'] = fileList.map(file => ({ + uri: file.response.data.url, + name: file.name + })) }, beforeSupplierMaterialRemove(scope, file, fileList) { @@ -1064,18 +1067,16 @@ handleSupplierMaterialFileUploaded(scope, response, file, fileList) { if (response.success) { - let attachments = scope.row['attachment'] + let attachments = scope.row.attachment if (isEmpty(attachments)) { attachments = [] - scope.row['attachment'] = attachments } attachments.push({ uri: response.data.url, name: file.name }) - console.log(attachments) - console.log(scope.row['attachment']) + scope.row.attachment = attachments this.$message.success("上传成功"); } else { @@ -1090,6 +1091,7 @@ addSupplierRow() { this.supplierMaterialsForm.push({ rowKey: this.rowKeyCounter++, + attachment: [] }) }, @@ -1224,6 +1226,16 @@ this.loadProject(processId) this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}') }, + + filters: { + ellipsis(value, limit = 40) { + if (!value) return '' + if (value.length > limit) { + return value.slice(0, limit) + '...' + } + return value + } + } }) diff --git a/src/main/resources/templates/admin/business/process-new.ftl b/src/main/resources/templates/admin/business/process-new.ftl index 8f0e773..54aef32 100644 --- a/src/main/resources/templates/admin/business/process-new.ftl +++ b/src/main/resources/templates/admin/business/process-new.ftl @@ -367,7 +367,7 @@
- + @@ -399,10 +399,6 @@ @@ -416,18 +412,19 @@ :before-remove="(file, fileList) => beforeSupplierMaterialRemove(scope, file, fileList)" :on-success="(response, file, fileList) => handleSupplierMaterialFileUploaded(scope, response, file, fileList)" :on-exceed="(files, fileList) => handleSupplierMaterialExceed(scope, files, fileList)"> - + 上传附件 <#--展示已经上传的文件--> -
+
只能上传PDF、excel、word、图片、压缩包,且不超过50MB
+ - 暂未上传 + 暂未上传 @@ -1220,16 +1217,22 @@ }, handleSupplierMaterialRemove(scope, fileList) { - scope.row['attachment'] = fileList + scope.row['attachment'] = fileList.map(file => ({ + uri: file.response.data.url, + name: file.name + })) }, removeSupplierMaterialAttachment(scope, attachmentToRemove) { - scope.row['attachment'] = scope.row['attachment'].filter(item => item === attachmentToRemove) + scope.row['attachment'] = scope.row['attachment'].filter(item => item !== attachmentToRemove) }, handleSupplierMaterialExceed(scope, files, fileList) { this.$message.warning("当前限制选择只能选择10个文件"); - scope.row['attachment'] = fileList + scope.row['attachment'] = fileList.map(file => ({ + uri: file.response.data.url, + name: file.name + })) }, beforeSupplierMaterialRemove(scope, file, fileList) { @@ -1242,19 +1245,16 @@ handleSupplierMaterialFileUploaded(scope, response, file, fileList) { if (response.success) { - let attachments = scope.row['attachment'] + let attachments = scope.row.attachment if (isEmpty(attachments)) { attachments = [] - scope.row['attachment'] = attachments } attachments.push({ uri: response.data.url, name: file.name }) - console.log(attachments) - console.log(scope.row['attachment']) - + scope.row.attachment = attachments this.$message.success("上传成功"); } else { @@ -1269,6 +1269,7 @@ addSupplierRow() { this.supplierMaterialsForm.push({ rowKey: this.rowKeyCounter++, + attachment: [] }) }, @@ -1402,6 +1403,15 @@ // this.handleSelectProject({ id: 135 }) this.applyDeptSectorOptions = JSON.parse('${applyDeptSectorOptions}') }, + filters: { + ellipsis(value, limit = 40) { + if (!value) return '' + if (value.length > limit) { + return value.slice(0, limit) + '...' + } + return value + } + } }) diff --git a/src/main/resources/templates/admin/business/process-review.ftl b/src/main/resources/templates/admin/business/process-review.ftl index dc871d4..73708ba 100644 --- a/src/main/resources/templates/admin/business/process-review.ftl +++ b/src/main/resources/templates/admin/business/process-review.ftl @@ -222,29 +222,25 @@ 'Content-Type': 'application/json', }, body: JSON.stringify(form), - }).then(response => { - if (response.ok) { - // 关闭对话框 - this.auditFormVisible = false - this.queryTable() - this.$message({ - showClose: true, - message: '撤销成功', - type: 'success' - }) - } - else { - return Promise.reject(response) - } - + }).then(checkStatus).then(parseJSON).then(data => { + // 关闭对话框 + this.auditFormVisible = false + this.queryTable() this.$message({ showClose: true, message: '审核成功', type: 'success' }) - - }).catch(err => { - this.$message.error("审核失败"); + }).catch(({ response }) => { + if (response) { + parseJSON(response) + .then(json => { + this.$message.error(json.message || "审核失败") + }) + } + else { + this.$message.error("审核失败") + } }).finally(() => loading.close()) } else {