销售合同 附件上传

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

View File

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

View File

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

View File

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

View File

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