update code

dev_xds
haha 2024-04-18 23:28:34 +08:00
parent 470b29b69d
commit 11fac30ca2
11 changed files with 747 additions and 155 deletions

View File

@ -0,0 +1,132 @@
<template>
<div class="cost-contract" style="margin-top:4px;">
<el-row>
<el-col :span="8">
<span style="color: #409eff;">
{{ costType==11? '工程进度款支付明细':'支付明细'}}
</span>
</el-col>
<el-col :span="16" style="text-align: right;">
<el-button type="success" @click="doAdd"></el-button>
</el-col>
</el-row>
<div style="padding: 0px; border:solid 1px #ccc;border-radius: 4px;margin-top:4px;max-height: calc(100vh - 360px);overflow-y: auto;" class="scroll data-list">
<el-row v-for="(it, idx) in dataList" :key="idx" :class="'row-'+idx%2+(it.isErr?' is-error':'')">
<el-col :span="2">
{{ idx + 1 }}
</el-col>
<el-col :span="5">
<el-form-item label="申请金额">
<el-input-number style="width: 130px;" :precision="4" @input="chkRowData(it)" v-model="it.money" :class="it.money>0?'':'txt-error'" placeholder="申请金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="申请日期">
<el-date-picker style="width: 140px;" v-model="it.date1" type="date" placeholder="申请日期" :class="it.date1?'':' txt-error'">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="支付金额">
<el-input-number style="width: 130px;" :precision="4" @input="chkRowData(it)" v-model="it.money2" placeholder="支付金额" >
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="挂账金额">
<el-input-number style="width: 130px;" :precision="4" v-model="it.money3" disabled placeholder="挂账金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button size="mini" @click="doDelete(it,idx)"></el-button>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
export default {
data() {
return {
prj:null,
costType:11,
dataList: []
};
},
mounted() {
},
methods: {
doDelete(row,idx){
this.$confirm('确定删除此行数据??', '提示', { type: 'warning' }).then(()=>{
this.dataList.splice(idx,1);
});
},
chkRowData(row){
row.money3=row.money*1-row.money2*1;
row.isErr=(row.money*1+row.money2*1)==0 || !row.date1;
this.$emit("change",this.dataList);
},
doAdd() {
this.dataList.push({
costType:this.costType,
money: '',
money2: '',
money3: '',
projectId:this.prj.id,
date1: undefined,
isErr:true
});
},
init(d,prj,costType){
this.costType=costType;
this.prj=prj;
if(d.length==0){
this.doAdd();
}else{
this.dataList=d.map(it=>{
let obj={...it}
obj.isErr=false;
return obj;
});
}
},
checkData(){
return this.dataList.filter(d=>d.isErr).length==0;
}
},
};
</script>
<style lang="scss">
.cost-contract{
.data-list{
.el-row{
line-height: 36px;
padding:0px 10px;
&.row-1{
background-color: #eeeeee;
}
.el-form-item {
margin-bottom: 2px !important;
margin-top:2px !important;
}
&.is-error{
.txt-error{
.el-input__inner{
border:solid 1px red;
}
}
}
}
}
}
</style>

View File

@ -11,8 +11,8 @@
<el-button type="primary" size="mini" @click="doAddYear"></el-button>
</div>
<el-button slot="reference" size="mini" type="success" style="margin-right: 12px;" round>增加年份</el-button>
</el-popover>
<el-tabs v-model="activeName">
</el-popover>
<el-tabs v-model="activeName" >
<el-tab-pane v-for="(it,idx) in monthInv" :label="''+it.year" :name="''+it.year" :key="idx">
<el-col v-for="(item,idxx) in it.value" :key="idxx" :span="12">
<el-form-item :label="names[item.month]" class="w200" >
@ -32,7 +32,8 @@ export default {
name: 'RuoyiUiCostMonth',
data() {
return {
return {
prj:null,
selYear:'',
names:['','一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
activeName:'',
@ -57,11 +58,13 @@ export default {
},
init(d,prj){
this.monthInv=d;
this.prj=prj;
this.prj=prj;
if(d.filter(it=>it.year==new Date().getFullYear()).length>0){
this.activeName=""+new Date().getFullYear()
}else{
this.activeName=""+d.year;
if(d.length>0){
this.activeName=""+d[0].year;
}
}
}
},

View File

@ -0,0 +1,251 @@
<template>
<div class="project-cost-outpu-drawer" v-if="isOpen">
<el-drawer v-if="isOpen" :visible.sync="isOpen" direction="rtl" size="50%" style="padding-left: 20px">
<template slot="title">
<div>{{ (title) + " 【项目成本产值管理】" }}</div>
<right-toolbar @queryTable="loadData" :search="false">
</right-toolbar>
</template>
<div style="margin-top:12px;" v-if="form.totalInv">
<el-form ref="form" label-width="160px">
<el-form-item label="总投资" class="w400">
<el-input-number :precision="4" v-model="form.totalInv.money" placeholder="请输入总投资">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
<div class="div-title fblue" style="color: #409eff;">年度投资</div>
<costYear ref="costYear" @success="doAddYearSuccess">
</costYear>
<div class="div-title fblue" style="color: #409eff;border-bottom: solid 1px #409eff;line-height: 40px;">合同金额</div>
<el-row style="margin-top:12px;">
<el-col :span="8">
<el-form-item label="合同金额" class="w200">
<el-input-number :precision="4" v-model="form.contract1.money" placeholder="请输入合同金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="合同支付金额" class="w200">
<el-input-number :precision="4" v-model="form.contract2.money" placeholder="请输入合同支付金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="合同挂账金额" class="w200">
<el-input-number :precision="4" v-model="form.contract3.money" placeholder="请输入合同挂账金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
</el-row>
<div class="div-title fblue" style="color: #409eff;border-bottom: solid 1px #409eff;line-height: 40px;">安措费</div>
<el-row style="margin-top:12px;">
<el-col :span="8">
<el-form-item label="安措费金额" class="w200">
<el-input-number :precision="4" v-model="form.safety1.money" placeholder="请输入安措费金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="安措支付金额" class="w200">
<el-input-number :precision="4" v-model="form.safety2.money" placeholder="请输入安措支付金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="安措挂账金额" class="w200">
<el-input-number :precision="4" v-model="form.safety3.money" placeholder="请输入安措挂账金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
</el-row>
<div class="div-title fblue" style="color: #409eff;">月度产值</div>
<costMonth ref="costMonth" @success="doAddYearSuccess"></costMonth>
</el-form>
<div style="text-align: center;margin-top: 24px;">
<el-button type="success" @click="doSave"></el-button>
</div>
</div>
</el-drawer>
</div>
</template>
<script>
import { listByProjectId,batchUpdate } from "@/api/project/costOutput.js";
import costYear from './costYear.vue'
import costMonth from './costMonth.vue'
export default {
components: {
costYear,costMonth
},
data() {
return {
title:'',
isOpen: false,
prj: null,
form:{
totalInv:null,//
contract1:null,//
contract2:null,//
contract3:null,//
safety1:null,//
safety2:null,//
safety3:null,//
},
yearInv:[],//
monthInv:[],//
oldData:[]
};
},
mounted() { },
methods: {
doSave(){
let objs=this.oldData.map(it=>{
let obj={...it};
obj.money=obj.money?obj.money*10000:0;
return obj;
});
batchUpdate(objs).then(d=>{
if(d.code!=200){
this.loadData();
}else{
this.$modal.msgSuccess("保存成功");
}
});
},
doAddYearSuccess(){
this.loadData();
},
resetData(tmps){
if(this.oldData.length==0){
return;
}
tmps.forEach(it=>{
let objs=this.oldData.filter(d=>d.id==it.id);
if(objs.length>0){
it.money=objs[0].money;
}
});
},
loadData(init) {
listByProjectId(this.prj.id).then((d) => {
let tmps=(d.data||[]).map(it=>{
it.money=it.money?it.money/10000.0:0;
return it;
});
this.resetData(tmps);
this.oldData=tmps;
this.form.totalInv=this.getValue(tmps,1);
this.yearInv=tmps.filter(it=>it.costType==2);
this.form.contract1=this.getValue(tmps,3);
this.form.contract2=this.getValue(tmps,4);
this.form.contract3=this.getValue(tmps,5);
this.form.safety1=this.getValue(tmps,6);
this.form.safety2=this.getValue(tmps,7);
this.form.safety3=this.getValue(tmps,8);
let objs=tmps.filter(it=>it.costType==9);
let obj={};
this.monthInv=[];
objs.forEach(it=>{
if(!obj[it.year]){
obj[it.year]=[];
}
obj[it.year].push(it);
});
for(let k in obj){
this.monthInv.push({
year:k,
value:obj[k]
})
}
setTimeout(()=>{
this.$refs.costYear.init(this.yearInv,this.prj);
this.$refs.costMonth.init(this.monthInv,this.prj);
},400)
});
},
getValue(tmps,type){
let objs=tmps.filter(d=>d.costType==type);
return objs.length>0?objs[0]:{};
},
show(prj) {
this.prj = prj;
this.title = prj.projectName;
this.isOpen = true;
this.loadData(true);
},
},
};
</script>
<style lang="scss" scoped>
.project-cost-outpu-drawer {
::v-deep .el-drawer {
min-width: 1400px;
}
::v-deep .el-drawer__header {
margin-bottom: 0px;
}
::v-deep .el-drawer__body {
padding: 0px 24px;
.el-popover__reference-wrapper{
position: absolute;
right: 0px;
z-index: 999;
}
.el-form {
overflow: hidden;
.el-form-item {
margin-bottom: 8px !important;
&.w400{
.el-input-number{
width:400px;
}
}
.el-input-number{
.el-input-number__decrease{
display: none;
}
.el-input-number__increase{
display: none;
}
.el-input__inner{
padding: 0px 12px;
text-align: right;
}
}
.sp-unit{
margin-left:12px;
}
}
.div-title{
}
}
.lvl-3 {
.lbl-title {
font-size: 12px;
}
}
}
}
</style>

View File

@ -3,185 +3,266 @@
<el-drawer v-if="isOpen" :visible.sync="isOpen" direction="rtl" size="50%" style="padding-left: 20px">
<template slot="title">
<div>{{ (title) + " 【项目成本产值管理】" }}</div>
<right-toolbar @queryTable="loadData" :search="false">
<right-toolbar @queryTable="doQuery" :search="false">
</right-toolbar>
</template>
<div style="margin-top:12px;" v-if="form.totalInv">
<el-form ref="form" label-width="160px">
<el-form-item label="总投资" class="w400">
<el-input-number :precision="4" v-model="form.totalInv.money" placeholder="请输入总投资">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
<div class="div-title fblue" style="color: #409eff;">年度投资</div>
<costYear ref="costYear" @success="doAddYearSuccess">
<el-form ref="form" label-width="100px">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="总投资" name="first">
<el-form-item label="总投资" class="w400">
<el-input-number :precision="4" v-model="form.totalInv.money" placeholder="请输入总投资">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
<div class="div-title fblue" style="color: #409eff;">年度投资</div>
<costYear ref="costYear" @success="doAddYearSuccess">
</costYear>
</costYear>
<div class="div-title fblue" style="color: #409eff;border-bottom: solid 1px #409eff;line-height: 40px;">合同金额</div>
<el-row style="margin-top:12px;">
<el-col :span="8">
<el-form-item label="合同金额" class="w200">
<el-input-number :precision="4" v-model="form.contract1.money" placeholder="请输入合同金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="合同支付金额" class="w200">
<el-input-number :precision="4" v-model="form.contract2.money" placeholder="请输入合同支付金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="合同挂账金额" class="w200">
<el-input-number :precision="4" v-model="form.contract3.money" placeholder="请输入合同挂账金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="合同金额" name="second">
<el-row style="margin-top:12px;">
<el-col :span="8">
<el-form-item label="合同金额" class="w200">
<el-input-number :precision="4" v-model="form.contract1.money"
placeholder="请输入合同金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="建安费金额" class="w200">
<el-input-number :precision="4" v-model="form.contract2.money"
placeholder="建安费金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
</el-row>
<costContract ref="costContract" ></costContract>
<div class="div-title fblue" style="color: #409eff;border-bottom: solid 1px #409eff;line-height: 40px;">安措费</div>
<el-row style="margin-top:12px;">
<el-col :span="8">
<el-form-item label="安措费金额" class="w200">
<el-input-number :precision="4" v-model="form.safety1.money" placeholder="请输入安措费金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="安措支付金额" class="w200">
<el-input-number :precision="4" v-model="form.safety2.money" placeholder="请输入安措支付金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="安措挂账金额" class="w200">
<el-input-number :precision="4" v-model="form.safety3.money" placeholder="请输入安措挂账金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="安措费" name="third">
<el-row style="margin-top:12px;">
<el-col :span="8">
<el-form-item label="安措费金额" class="w200">
<el-input-number :precision="4" v-model="form.safety1.money"
placeholder="请输入安措费金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="安措支付金额" class="w200">
<el-input-number :precision="4" disabled v-model="form.safety2.money"
placeholder="请输入安措支付金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="安措挂账金额" class="w200">
<el-input-number :precision="4" disabled v-model="form.safety3.money"
placeholder="请输入安措挂账金额">
</el-input-number>
<span class="sp-unit">万元</span>
</el-form-item>
</el-col>
</el-row>
<costContract ref="costSafety" @change="costSafetyChange"></costContract>
</el-tab-pane>
<el-tab-pane label="月度产值" name="fourth">
<div class="div-title fblue" style="color: #409eff;">月度产值</div>
<costMonth ref="costMonth" @success="doAddYearSuccess"></costMonth>
<div class="div-title fblue" style="color: #409eff;">月度产值</div>
<costMonth ref="costMonth" @success="doAddYearSuccess"></costMonth>
</el-form>
<div style="text-align: center;margin-top: 24px;">
<el-button type="success" @click="doSave"></el-button>
</div>
</el-tab-pane>
</el-tabs>
</el-form>
<div style="text-align: center;margin-top: 24px;">
<el-button type="success" :loading="loading" @click="doSave"></el-button>
</div>
</div>
</el-drawer>
</div>
</template>
<script>
import { listByProjectId,batchUpdate } from "@/api/project/costOutput.js";
import { listByProjectId, batchUpdate } from "@/api/project/costOutput.js";
import costYear from './costYear.vue'
import costMonth from './costMonth.vue'
import costContract from './costContract.vue'
export default {
components: {
costYear,costMonth
costYear, costMonth,costContract
},
data() {
return {
title:'',
activeName: 'first',
title: '',
isOpen: false,
prj: null,
form:{
totalInv:null,//
contract1:null,//
contract2:null,//
contract3:null,//
safety1:null,//
safety2:null,//
safety3:null,//
form: {
totalInv: null,//
contract1: null,//
contract2: null,//
safety1: null,//
safety2: null,//
safety3: null,//
},
yearInv:[],//
monthInv:[],//
oldData:[]
yearInv: [],//
monthInv: [],//
oldData: [],
contract:[],//
safety:[],//
loading:false,
};
},
mounted() { },
methods: {
doSave(){
let objs=this.oldData.map(it=>{
let obj={...it};
obj.money=obj.money?obj.money*10000:0;
methods: {
doQuery(){
this.$confirm('确定刷新数据?', '提示', { type: 'warning' }).then(()=>{
this.loadData();
});
},
costSafetyChange(datas){
let m2sum=0;
let m3sum=0;
datas.forEach(d=>{
m2sum+=d.money2;
m3sum+=d.money3;
});
this.form.safety2.money=m2sum;
this.form.safety3.money=m3sum;
},
handleClick(tab, event) {
},
checkData(){
if(!this.$refs.costContract.checkData()){
this.activeName="second";
return false;
}
if(!this.$refs.costSafety.checkData()){
this.activeName="third";
return false;
}
return true;
},
doSave() {
if(!this.checkData()){
this.$message.error("请填写数据!");
return;
}
let objs = this.oldData.filter(d=>d.costType!=11 && d.costType!=12).map(it => {
let obj = { ...it };
obj.money = obj.money ? obj.money * 10000 : 0;
return obj;
});
batchUpdate(objs).then(d=>{
if(d.code!=200){
this.loadData();
}else{
this.$modal.msgSuccess("保存成功");
}
let contractObjs=this.$refs.costContract.dataList.map(it=>{
let obj={...it};
obj.money = obj.money ? obj.money * 10000 : 0;
obj.money2=obj.money2?obj.money2*10000:0;
obj.date1=this.$dt(obj.date1).format("YYYY-MM-DD");
return obj;
});
let safetyObjs=this.$refs.costSafety.dataList.map(it=>{
let obj={...it};
obj.money = obj.money ? obj.money * 10000 : 0;
obj.money2=obj.money2?obj.money2*10000:0;
obj.date1=this.$dt(obj.date1).format("YYYY-MM-DD");
return obj;
});
this.loading=true;
batchUpdate([...objs,...contractObjs,...safetyObjs]).then(d => {
this.loading=false;
if (d.code != 200) {
this.loadData();
} else {
this.$modal.msgSuccess("保存成功");
this.loadData();
}
});
},
doAddYearSuccess(){
doAddYearSuccess() {
this.loadData();
},
resetData(tmps){
if(this.oldData.length==0){
resetData(tmps) {
if (this.oldData.length == 0) {
return;
}
tmps.forEach(it=>{
let objs=this.oldData.filter(d=>d.id==it.id);
if(objs.length>0){
it.money=objs[0].money;
tmps.forEach(it => {
let objs = this.oldData.filter(d => d.id == it.id);
if (objs.length > 0) {
it.money = objs[0].money;
}
});
},
loadData(init) {
listByProjectId(this.prj.id).then((d) => {
let tmps=(d.data||[]).map(it=>{
it.money=it.money?it.money/10000.0:0;
listByProjectId(this.prj.id).then((d) => {
let tmps = (d.data || []).map(it => {
it.money = it.money ? it.money / 10000.0 : 0;
it.money2 = it.money2 ? it.money2 / 10000.0 : 0;
it.money3=it.money-it.money2;
it.isErr=false;
it.date1=this.$dt(it.date1)
return it;
});
this.resetData(tmps);
this.oldData=tmps;
this.form.totalInv=this.getValue(tmps,1);
this.yearInv=tmps.filter(it=>it.costType==2);
this.form.contract1=this.getValue(tmps,3);
this.form.contract2=this.getValue(tmps,4);
this.form.contract3=this.getValue(tmps,5);
this.form.safety1=this.getValue(tmps,6);
this.form.safety2=this.getValue(tmps,7);
this.form.safety3=this.getValue(tmps,8);
let objs=tmps.filter(it=>it.costType==9);
let obj={};
this.monthInv=[];
objs.forEach(it=>{
if(!obj[it.year]){
obj[it.year]=[];
this.oldData = tmps;
this.form.totalInv = this.getValue(tmps, 1);
this.yearInv = tmps.filter(it => it.costType == 2);
this.contract=tmps.filter(it=>it.costType==11);
this.safety=tmps.filter(it=>it.costType==12);
this.form.contract1 = this.getValue(tmps, 3);
this.form.contract2 = this.getValue(tmps, 10);
this.form.safety1 = this.getValue(tmps, 6);
this.form.safety2 = this.getValue(tmps, 7);
this.form.safety3 = this.getValue(tmps, 8);
let objs = tmps.filter(it => it.costType == 9);
let obj = {};
this.monthInv = [];
objs.forEach(it => {
if (!obj[it.year]) {
obj[it.year] = [];
}
obj[it.year].push(it);
});
for(let k in obj){
for (let k in obj) {
this.monthInv.push({
year:k,
value:obj[k]
year: k,
value: obj[k]
})
}
setTimeout(()=>{
this.$refs.costYear.init(this.yearInv,this.prj);
this.$refs.costMonth.init(this.monthInv,this.prj);
},400)
setTimeout(() => {
this.$refs.costYear.init(this.yearInv, this.prj);
this.$refs.costMonth.init(this.monthInv, this.prj);
this.$refs.costContract.init(this.contract,this.prj,11);
this.$refs.costSafety.init(this.safety,this.prj,12);
}, 400)
});
},
getValue(tmps,type){
let objs=tmps.filter(d=>d.costType==type);
return objs.length>0?objs[0]:{};
getValue(tmps, type) {
let objs = tmps.filter(d => d.costType == type);
if(objs.length>0){
return objs[0];
}
let obj={
money:0,
costType:type,
projectId:this.prj.id
};
tmps.push(obj);
return obj;
},
show(prj) {
this.prj = prj;
@ -192,7 +273,7 @@ export default {
},
};
</script>
<style lang="scss" scoped>
.project-cost-outpu-drawer {
::v-deep .el-drawer {
@ -205,40 +286,45 @@ export default {
::v-deep .el-drawer__body {
padding: 0px 24px;
.el-popover__reference-wrapper{
.el-popover__reference-wrapper {
position: absolute;
right: 0px;
z-index: 999;
}
.el-form {
overflow: hidden;
.el-form-item {
margin-bottom: 8px !important;
&.w400{
.el-input-number{
width:400px;
}
&.w400 {
.el-input-number {
width: 400px;
}
}
.el-input-number{
.el-input-number__decrease{
.el-input-number {
.el-input-number__decrease {
display: none;
}
.el-input-number__increase{
.el-input-number__increase {
display: none;
}
.el-input__inner{
.el-input__inner {
padding: 0px 12px;
text-align: right;
}
}
.sp-unit{
margin-left:12px;
.sp-unit {
margin-left: 12px;
}
}
.div-title{
}
.div-title {}
}
.lvl-3 {

View File

@ -60,7 +60,9 @@ export default {
if(d.filter(it=>it.year==new Date().getFullYear()).length>0){
this.activeName=""+new Date().getFullYear()
}else{
this.activeName=""+d.year;
if(d.length>0){
this.activeName=""+d[0].year;
}
}
}
},

View File

@ -0,0 +1,13 @@
sur_project_cost_output
增加字段
money2
date1
date2
数据
项目成本产值类型
project_cost_output_type
建安费金额 10
工程进度款支付 11
安措费支付明细 12

View File

@ -156,9 +156,7 @@ public class SurProjectCostOutputController extends BaseController
@PostMapping("/batchUpdate")
public AjaxResult batchUpdate(@RequestBody List<SurProjectCostOutput> list){
try {
for (SurProjectCostOutput it : list) {
surProjectCostOutputService.updateSurProjectCostOutput(it);
}
surProjectCostOutputService.batchUpdate(list);
return AjaxResult.success("保存成功!");
}catch (Exception ex){
return AjaxResult.error(ex.getMessage());

View File

@ -1,10 +1,13 @@
package com.yanzhu.jh.project.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
* sur_project_cost_output
*
@ -42,6 +45,20 @@ public class SurProjectCostOutput extends BaseEntity
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
private Long isDel;
/** 金额2 */
@Excel(name = "金额2")
private Long money2;
/** 日期1 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "日期1", width = 30, dateFormat = "yyyy-MM-dd")
private Date date1;
/** 日期2 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "日期2", width = 30, dateFormat = "yyyy-MM-dd")
private Date date2;
public void setId(Long id)
{
this.id = id;
@ -105,6 +122,33 @@ public class SurProjectCostOutput extends BaseEntity
{
return isDel;
}
public void setMoney2(Long money2)
{
this.money2 = money2;
}
public Long getMoney2()
{
return money2;
}
public void setDate1(Date date1)
{
this.date1 = date1;
}
public Date getDate1()
{
return date1;
}
public void setDate2(Date date2)
{
this.date2 = date2;
}
public Date getDate2()
{
return date2;
}
@Override
public String toString() {
@ -121,6 +165,9 @@ public class SurProjectCostOutput extends BaseEntity
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("money2", getMoney2())
.append("date1", getDate1())
.append("date2", getDate2())
.toString();
}
}

View File

@ -73,4 +73,11 @@ public interface ISurProjectCostOutputService
public List<SurProjectCostOutput> selectYearAndMonth(SurProjectCostOutput where);
public List<SurProjectCostOutput> sumByDeptId(SurProjectCostOutput where);
/**
*
* @param list
* @return
*/
public int batchUpdate(List<SurProjectCostOutput> list);
}

View File

@ -1,5 +1,6 @@
package com.yanzhu.jh.project.service.impl;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -127,6 +128,8 @@ public class SurProjectCostOutputServiceImpl implements ISurProjectCostOutputSer
insertSurProjectCostOutput(it);
it.setCostType(8l);//安措挂账金额
insertSurProjectCostOutput(it);
it.setCostType(10l);//建安费金额
insertSurProjectCostOutput(it);
it.setCostType(9l);//月度投资
it.setYear(year*1l);
for(int i=1;i<=12;i++){
@ -166,5 +169,40 @@ public class SurProjectCostOutputServiceImpl implements ISurProjectCostOutputSer
public List<SurProjectCostOutput> sumByDeptId(SurProjectCostOutput where) {
return surProjectCostOutputMapper.sumByDeptId(where);
}
@Override
public int batchUpdate(List<SurProjectCostOutput> list) {
SurProjectCostOutput where=new SurProjectCostOutput();
where.setCostType(11l);//工程进度款支付
List<SurProjectCostOutput> contractList=selectSurProjectCostOutputList(where);
where.setCostType(12l);//安措费支付明细
List<SurProjectCostOutput> safetyList=selectSurProjectCostOutputList(where);
List<Long> contractIds=new ArrayList<>();
List<Long> safetyIds=new ArrayList<>();
for(SurProjectCostOutput it:list){
if(it.getId()!=null){
updateSurProjectCostOutput(it);
if(it.getCostType().equals(11l)){
contractIds.add(it.getId());
}
if(it.getCostType().equals(12l)){
safetyIds.add(it.getId());
}
}else{
insertSurProjectCostOutput(it);
}
}
for(SurProjectCostOutput it :contractList){
if(!contractIds.contains(it.getId())){
deleteSurProjectCostOutputById(it.getId());
}
}
for(SurProjectCostOutput it :safetyList){
if(!safetyIds.contains(it.getId())){
deleteSurProjectCostOutputById(it.getId());
}
}
return list.size();
}
}

View File

@ -17,10 +17,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="money2" column="money2" />
<result property="date1" column="date1" />
<result property="date2" column="date2" />
</resultMap>
<sql id="selectSurProjectCostOutputVo">
select id, project_id, money, year, month, cost_type, remark, is_del, create_by, create_time, update_by, update_time from sur_project_cost_output
select id, project_id, money, year, month, cost_type, remark, is_del, create_by, create_time, update_by, update_time,money2,date1,date2 from sur_project_cost_output
</sql>
<select id="selectSurProjectCostOutputList" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult">
@ -32,6 +35,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="month != null "> and month = #{month}</if>
<if test="costType != null "> and cost_type = #{costType}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="money2 != null "> and money2 = #{money2}</if>
<if test="date1 != null "> and date1 = #{date1}</if>
<if test="date2 != null "> and date2 = #{date2}</if>
</where>
</select>
@ -54,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="money2 != null">money2,</if>
<if test="date1 != null">date1,</if>
<if test="date2 != null">date2,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
@ -67,6 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="money2 != null">#{money2},</if>
<if test="date1 != null">#{date1},</if>
<if test="date2 != null">#{date2},</if>
</trim>
</insert>
@ -84,6 +96,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="money2 != null">money2 = #{money2},</if>
<if test="date1 != null">date1 = #{date1},</if>
<if test="date2 != null">date2 = #{date2},</if>
</trim>
where id = #{id}
</update>