销售合同清单明细 功能
在修改了数据库: alter table project_budget_income_detail add column expiration_date varchar(32) NULL comment '质保期'; alter table project_budget_income_detail_temp add column expiration_date varchar(32) NULL comment '质保期';master
parent
b115b252ee
commit
65d853fc7b
|
@ -1,14 +1,19 @@
|
||||||
package cn.palmte.work.controller.backend;
|
package cn.palmte.work.controller.backend;
|
||||||
|
|
||||||
|
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -39,10 +44,13 @@ public class ProcessController {
|
||||||
private final ProjectRepository projectRepository;
|
private final ProjectRepository projectRepository;
|
||||||
private final ProjectBudgetService projectBudgetService;
|
private final ProjectBudgetService projectBudgetService;
|
||||||
|
|
||||||
public ProcessController(ProjectRepository projectRepository, DeptRepository deptRepository, ProjectBudgetService projectBudgetService) {
|
private final JdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
|
public ProcessController(ProjectRepository projectRepository, DeptRepository deptRepository, ProjectBudgetService projectBudgetService, JdbcTemplate jdbcTemplate) {
|
||||||
this.projectRepository = projectRepository;
|
this.projectRepository = projectRepository;
|
||||||
this.deptRepository = deptRepository;
|
this.deptRepository = deptRepository;
|
||||||
this.projectBudgetService = projectBudgetService;
|
this.projectBudgetService = projectBudgetService;
|
||||||
|
this.jdbcTemplate = jdbcTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class FormMetadata {
|
static class FormMetadata {
|
||||||
|
@ -191,7 +199,7 @@ public class ProcessController {
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public void post(SaleContractForm form) {
|
public void post(@RequestBody SaleContractForm form) {
|
||||||
System.out.println(form);
|
System.out.println(form);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -216,9 +224,21 @@ public class ProcessController {
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping("/sale-contract-details")
|
@PostMapping("/sale-contract-details")
|
||||||
public void saleContractDetails(SaleContractDetailForm form) {
|
public void saleContractDetails(@RequestBody List<SaleContractDetailForm> form) {
|
||||||
|
jdbcTemplate.batchUpdate("update project_budget_income_detail set expiration_date =? where id =? ",
|
||||||
|
new BatchPreparedStatementSetter() {
|
||||||
|
@Override
|
||||||
|
public void setValues(PreparedStatement ps, int i) throws SQLException {
|
||||||
|
SaleContractDetailForm detailForm = form.get(i);
|
||||||
|
ps.setString(1, detailForm.expirationDate);
|
||||||
|
ps.setInt(2, detailForm.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatchSize() {
|
||||||
|
return form.size();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,10 @@ public class ProjectBudgetIncomeDetailBase {
|
||||||
@Column(name = "tax_rate")
|
@Column(name = "tax_rate")
|
||||||
private BigDecimal taxRate;
|
private BigDecimal taxRate;
|
||||||
|
|
||||||
|
// 质保期 5 个字符
|
||||||
|
@Column(name = "expiration_date")
|
||||||
|
public String expirationDate;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -117,6 +121,14 @@ public class ProjectBudgetIncomeDetailBase {
|
||||||
this.taxRate = taxRate;
|
this.taxRate = taxRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getExpirationDate() {
|
||||||
|
return expirationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpirationDate(String expirationDate) {
|
||||||
|
this.expirationDate = expirationDate;
|
||||||
|
}
|
||||||
|
|
||||||
public BigDecimal getTotalTaxInclude(){
|
public BigDecimal getTotalTaxInclude(){
|
||||||
if(null == price){
|
if(null == price){
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
.admin-content-body {
|
.admin-content-body {
|
||||||
margin-bottom: 100px;
|
margin-bottom: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-table__empty-block {
|
||||||
|
height: 60px !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="admin-content" id="app">
|
<div class="admin-content" id="app">
|
||||||
|
@ -227,21 +231,27 @@
|
||||||
<#-- 销售合同清单明细 -->
|
<#-- 销售合同清单明细 -->
|
||||||
|
|
||||||
<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="businessPurchaseDetails">
|
<el-table border :data="saleContractDetails" @row-dblclick="dbclick">
|
||||||
<el-table-column type="index" :index="1" label="序号"></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="type" label="类别"></el-table-column>
|
<el-table-column prop="type" label="类别"></el-table-column>
|
||||||
<el-table-column prop="name" label="名称"></el-table-column>
|
|
||||||
<el-table-column prop="spec" label="规格型号"></el-table-column>
|
<el-table-column prop="spec" label="规格型号"></el-table-column>
|
||||||
<el-table-column prop="param" label="参数"></el-table-column>
|
<el-table-column prop="param" label="参数"></el-table-column>
|
||||||
<el-table-column prop="unit" label="单位"></el-table-column>
|
<el-table-column prop="unit" label="单位"></el-table-column>
|
||||||
<el-table-column prop="amount" label="数量"></el-table-column>
|
<el-table-column prop="amount" label="数量"></el-table-column>
|
||||||
<el-table-column prop="price" label="单价"></el-table-column>
|
<el-table-column prop="price" label="单价" width="100"></el-table-column>
|
||||||
<el-table-column prop="taxRate" label="税率"></el-table-column>
|
<el-table-column prop="taxRate" label="税率"></el-table-column>
|
||||||
<el-table-column prop="totalTaxInclude" label="含税金额"></el-table-column>
|
<el-table-column prop="totalTaxInclude" label="含税金额" width="100"></el-table-column>
|
||||||
<el-table-column prop="totalTaxExclude" label="不含税金额"></el-table-column>
|
<el-table-column prop="totalTaxExclude" label="不含税金额" width="100"></el-table-column>
|
||||||
<el-table-column prop="totalTax" label="含税总金额"></el-table-column>
|
<el-table-column prop="totalTax" label="含税总金额" width="100"></el-table-column>
|
||||||
<el-table-column prop="fee" label="税金"></el-table-column>
|
<el-table-column prop="fee" label="税金"></el-table-column>
|
||||||
<el-table-column prop="expirationDate" label="质保期"></el-table-column>
|
|
||||||
|
<el-table-column prop="expirationDate" label="质保期" fixed="right" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input maxlength="5" size="mini" placeholder="请输入质保期"
|
||||||
|
v-model="scope.row.expirationDate"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
|
@ -592,8 +602,6 @@
|
||||||
],
|
],
|
||||||
fileList: [],
|
fileList: [],
|
||||||
saleContractDetails: [],
|
saleContractDetails: [],
|
||||||
businessPurchaseDetails: [],
|
|
||||||
showBusinessPurchaseDetails: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,6 +622,8 @@
|
||||||
this.changeMode(saleContractProcess)
|
this.changeMode(saleContractProcess)
|
||||||
},
|
},
|
||||||
goToSaleContractDetail() {
|
goToSaleContractDetail() {
|
||||||
|
const { id } = this.processForm
|
||||||
|
if (id) {
|
||||||
this.changeMode(saleContractDetail)
|
this.changeMode(saleContractDetail)
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
|
@ -621,16 +631,27 @@
|
||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
})
|
})
|
||||||
|
fetch("${base}/process/sale-contract-details/" + id)
|
||||||
fetch("${base}/process/sale-contract-details/" + this.processForm.id)
|
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.businessPurchaseDetails = data
|
this.saleContractDetails = data
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.$message.error("销售合同清单明细加载失败");
|
this.$message.error("销售合同清单明细加载失败");
|
||||||
})
|
})
|
||||||
.finally(() => loading.close())
|
.finally(() => loading.close())
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$message.warning("项目还未选择")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
dbclick(row, event, column) {
|
||||||
|
row.input = !row.input
|
||||||
|
},
|
||||||
|
|
||||||
|
render(obj) {
|
||||||
|
console.log(obj)
|
||||||
},
|
},
|
||||||
|
|
||||||
queryProject(q, callback) {
|
queryProject(q, callback) {
|
||||||
|
@ -654,7 +675,7 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleSelectProject(selected) {
|
handleSelectProject(selected) {
|
||||||
const {id, name} = selected
|
const { id, name } = selected
|
||||||
if (!id) {
|
if (!id) {
|
||||||
this.processForm = {}
|
this.processForm = {}
|
||||||
return
|
return
|
||||||
|
@ -707,7 +728,11 @@
|
||||||
},
|
},
|
||||||
body: JSON.stringify(processForm),
|
body: JSON.stringify(processForm),
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
|
this.$message({
|
||||||
|
showClose: true,
|
||||||
|
message: '提交成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.$message.error("项目提交失败");
|
this.$message.error("项目提交失败");
|
||||||
}).finally(() => loading.close())
|
}).finally(() => loading.close())
|
||||||
|
@ -726,21 +751,25 @@
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
})
|
})
|
||||||
|
|
||||||
const processForm = this.processForm
|
const form = this.saleContractDetails.map(detail => ({
|
||||||
|
id: detail.id, expirationDate: detail.expirationDate
|
||||||
|
}))
|
||||||
fetch("${base}/process/sale-contract-details", {
|
fetch("${base}/process/sale-contract-details", {
|
||||||
method: 'POST', // or 'PUT'
|
method: 'POST', // or 'PUT'
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify(processForm),
|
body: JSON.stringify(form),
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
|
this.$message({
|
||||||
|
showClose: true,
|
||||||
|
message: '提交成功',
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
this.goToSaleContractProcess()
|
this.goToSaleContractProcess()
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.$message.error("项目提交失败");
|
this.$message.error("项目提交失败");
|
||||||
}).finally(() => loading.close())
|
}).finally(() => loading.close())
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
handleRemove(file, fileList) {
|
handleRemove(file, fileList) {
|
||||||
|
@ -766,7 +795,7 @@
|
||||||
data,
|
data,
|
||||||
computed: {
|
computed: {
|
||||||
projectTitle() {
|
projectTitle() {
|
||||||
const {projectNo, name, applyPerson, applyDate} = this.processForm
|
const { projectNo, name, applyPerson, applyDate } = this.processForm
|
||||||
if (projectNo && name) {
|
if (projectNo && name) {
|
||||||
return projectNo.trim() + "-" + name.trim() + "-" + applyPerson + "-" + applyDate
|
return projectNo.trim() + "-" + name.trim() + "-" + applyPerson + "-" + applyDate
|
||||||
}
|
}
|
||||||
|
@ -799,6 +828,23 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods,
|
methods,
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
fetch("${base}/process/projects/135")
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
this.processForm = {
|
||||||
|
sealType: [],
|
||||||
|
projectId: 135,
|
||||||
|
applyDate: new Date().toLocaleDateString(),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
this.projectSelected = true
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
this.$message.error("测试项目'加载失败");
|
||||||
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue