销售合同 附件上传

master
Harry Yang 2022-12-22 17:05:55 +08:00
parent ca0b7680b6
commit ab0e11861f
7 changed files with 50 additions and 20 deletions

View File

@ -1,5 +1,7 @@
package cn.palmte.work.controller.backend;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
@ -130,6 +132,11 @@ public class ProcessController {
return "/admin/business/process-review";
}
@GetMapping("/detail")
public String detail(Model model) {
return "/admin/business/process-detail";
}
@ResponseBody
@GetMapping("/projects")
public List<Map<String, Object>> query(@RequestParam String q) {
@ -203,12 +210,13 @@ public class ProcessController {
@Transactional
public void post(@RequestBody @Valid SaleContractProcessForm form) {
ProjectProcess entity = new ProjectProcess();
BeanUtils.copyProperties(form, entity, "sealTypes", "applyDate", "applyDept");
BeanUtils.copyProperties(form, entity, "sealTypes", "applyDate", "applyDept", "attachmentUri");
entity.setApplyDate(LocalDate.parse(form.getApplyDate(), formatter));
entity.setSealTypes(SealTypeArray.of(form.getSealTypes()));
entity.setApplyDept(String.join(",", form.getApplyDept()));
Admin admin = InterfaceUtil.getAdmin();
entity.setApplyPersonId(admin.getId());
entity.setAttachmentUri(JSON.toJSONString(form.getAttachmentUri()));
if (entity.getStatus() == null) {
entity.setStatus(ProcessStatus.to_be_audit);

View File

@ -92,6 +92,9 @@ public class ProjectProcess {
private String remark;
// 附件 JSON Array
private String attachmentUri;
// 项目类型
// @Enumerated(EnumType.STRING)
// private ProjectType projectType;

View File

@ -76,4 +76,5 @@ public class SaleContractProcessForm {
private String supplierName;
private List<String> attachmentUri;
}

View File

@ -19,6 +19,7 @@ create table project_process
tax_rate varchar(255) null comment '税率',
process_type varchar(255) null comment '流程类型',
remark text null comment '备注',
attachment_uri text null comment '附件 JSON Array',
current_audit varchar(255) null comment '当前审核人',
@ -28,7 +29,7 @@ create table project_process
);
alter table project_process
add apply_person_id int null comment '申请人ID';
add attachment_uri text null comment '附件 JSON Array';
# 采购合同
create table procurement_contract

View File

@ -99,7 +99,7 @@
<el-table-column prop="amount" label="当前审核人" width="100"></el-table-column>
<el-table-column prop="lastUpdateAt" label="最后更新时间" width="170"></el-table-column>
<el-table-column label="操作" fixed="right" width="250">
<el-table-column label="操作" fixed="right" width="230">
<template slot-scope="scope">
<el-button
v-if="scope.row.status==='audit_passed' || scope.row.status==='audit_not_passed' || scope.row.status==='to_be_audit'"

View File

@ -32,6 +32,10 @@
.el-table__empty-block {
height: 60px !important;
}
.el-upload-list__item-name [class^="el-icon"] {
height: unset;
}
</style>
<div class="admin-content" id="app">
@ -210,15 +214,15 @@
</div>
<div>
<el-form-item label="上传附件">
<el-form-item label="上传附件" :rules="[{ required: true, message: '未上传附件'}]">
<el-upload class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
action="${base}/file/upload"
name="files[]"
:on-remove="handleRemove"
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:file-list="fileList">
:on-success="handleFileUploaded"
:limit="10"
:on-exceed="handleExceed">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传PDF、excel、word、图片、压缩包且不超过50MB</div>
</el-upload>
@ -246,7 +250,7 @@
<#-- 销售合同清单明细 -->
<div class="am-u-sm-12 am-u-md-12" v-if="isSaleContractDetailMode">
<el-table border :data="incomeDetails" @row-dblclick="dbclick">
<el-table border :data="incomeDetails">
<el-table-column type="index" :index="1" label="序号" fixed></el-table-column>
<el-table-column prop="name" label="名称" fixed width="120"></el-table-column>
<el-table-column prop="type" label="类别"></el-table-column>
@ -617,6 +621,8 @@
fileList: [],
// 销售合同收入明细
incomeDetails: [],
attachmentUri: [],
attachmentMap: {}
}
}
@ -646,10 +652,6 @@
}
},
dbclick(row, event, column) {
row.input = !row.input
},
render(obj) {
console.log(obj)
},
@ -732,6 +734,12 @@
submit() {
this.$refs["saleContractProcessForm"].validate((valid) => {
if (valid) {
const fileList = this.fileList
console.log(fileList)
if (fileList.length === 0) {
this.$message.error("未上传附件");
return false
}
const loading = this.$loading({
lock: true,
text: '正在提交',
@ -743,6 +751,7 @@
...this.processForm,
processType: 'sale_contract',
projectTitle: this.projectTitle,
attachmentUri: fileList.map(file => (file.response.data.url)),
incomeDetails: this.incomeDetails.map(detail => ({
id: detail.id, expirationDate: detail.expirationDate
}))
@ -780,18 +789,27 @@
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log(file);
this.fileList = fileList
},
handleExceed(files, fileList) {
this.$message.warning("当前限制选择 3 个文件,本次选择了 " + files.length + " 个文件,共选择了 +" + files.length + fileList.length + " 个文件");
this.$message.warning("当前限制选择只能选择10个文件");
this.fileList = fileList
},
beforeRemove(file, fileList) {
return this.$confirm("确定移除 " + file.name + "");
},
handleFileUploaded(response, file, fileList) {
if (response.success) {
this.fileList = fileList
}
else {
this.$message.warning("上传失败");
}
},
indexMethod(index) {
return index * 1;
}

View File

@ -92,7 +92,6 @@
<template slot-scope="scope">
<el-button type="text" @click="showDetail(scope.row, scope)">查看详情</el-button>
<el-button type="text" @click="auditProcess(scope.row, scope)">审核</el-button>
<el-button type="text" @click="revokeProcess(scope.row, scope)">审核</el-button>
</template>
</el-table-column>