update code

dev_xds
haha 2024-04-24 00:26:19 +08:00
parent 9cf1d824c7
commit 2564638487
4 changed files with 260 additions and 125 deletions

View File

@ -3,49 +3,62 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<span style="color: #409eff;"> <span style="color: #409eff;">
{{ costType==11? '工程进度款支付明细':'支付明细'}} {{ costType == 11 ? '工程进度款支付明细' : '支付明细' }}
</span> </span>
</el-col> </el-col>
<el-col :span="16" style="text-align: right;"> <el-col :span="16" style="text-align: right;">
<el-button type="success" @click="doAdd"></el-button> <el-button type="success" @click="doAdd"></el-button>
</el-col> </el-col>
</el-row> </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"> <div style="padding: 10px; border:solid 1px #ccc;border-radius: 4px;margin-top:4px;max-height: calc(100vh - 360px);overflow-y: auto;"
<el-row v-for="(it, idx) in dataList" :key="idx" :class="'row-'+idx%2+(it.isErr?' is-error':'')"> class="scroll data-list">
<el-col :span="2"> <el-tabs type="border-card" v-model="tabName">
{{ idx + 1 }} <el-tab-pane :label="dept.deptName" :name="'d' + dept.deptId" v-for="(dept, index) in depts"
</el-col> :key="dept.deptId">
<el-col :span="5"> <el-row v-for="(it, idx) in dept['dataList' + costType]" :key="idx" class="datalist-row"
<el-form-item label="申请金额"> :class="'row-' + idx % 2 + (it.isErr ? ' is-error' : '')">
<el-input-number style="width: 130px;" :precision="4" @input="chkRowData(it)" v-model="it.money" :class="it.money>0?'':'txt-error'" placeholder="申请金额"> <el-col :span="2">
</el-input-number> {{ idx + 1 }}
<span class="sp-unit">万元</span> </el-col>
</el-form-item> <el-col :span="5">
</el-col> <el-form-item label="申请金额">
<el-col :span="5"> <el-input-number style="width: 130px;" :precision="4" @input="chkRowData(it)"
<el-form-item label="申请日期"> v-model="it.money" :class="it.money > 0 ? '' : 'txt-error'" placeholder="申请金额">
<el-date-picker style="width: 140px;" v-model="it.date1" type="date" placeholder="申请日期" :class="it.date1?'':' txt-error'"> </el-input-number>
</el-date-picker> <span class="sp-unit">万元</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="支付金额"> <el-form-item label="申请日期">
<el-input-number style="width: 130px;" :precision="4" @input="chkRowData(it)" v-model="it.money2" placeholder="支付金额" > <el-date-picker style="width: 140px;" v-model="it.date1" type="date" placeholder="申请日期"
</el-input-number> :class="it.date1 ? '' : ' txt-error'" @input="chkRowData(it)">
<span class="sp-unit">万元</span> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<el-form-item label="挂账金额" :class="it.money3<0?'txt-error':'is-ok'"> <el-form-item label="支付金额">
<el-input-number style="width: 130px;" :precision="4" v-model="it.money3" disabled placeholder="挂账金额" > <el-input-number style="width: 130px;" :precision="4" @input="chkRowData(it)"
</el-input-number> v-model="it.money2" placeholder="支付金额">
<span class="sp-unit">万元</span> </el-input-number>
</el-form-item> <span class="sp-unit">万元</span>
</el-col> </el-form-item>
<el-col :span="2"> </el-col>
<el-button size="mini" @click="doDelete(it,idx)"></el-button> <el-col :span="5">
</el-col> <el-form-item label="挂账金额" :class="it.money3 < 0 ? 'txt-error' : 'is-ok'">
</el-row> <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 style="margin-left: 12px;" size="mini" @click="doDelete(it, idx,dept)">删除</el-button>
</el-col>
</el-row>
<div>&nbsp;</div>
</el-tab-pane>
</el-tabs>
</div> </div>
</div> </div>
</template> </template>
@ -53,10 +66,12 @@
<script> <script>
export default { export default {
data() { data() {
return { return {
prj:null, prj: null,
costType:11, costType: 11,
dataList: [] dataList: [],
depts: [],
tabName: ""
}; };
}, },
@ -65,84 +80,148 @@ export default {
}, },
methods: { methods: {
doDelete(row,idx){ doDelete(row, idx,dept) {
this.$confirm('确定删除此行数据??', '提示', { type: 'warning' }).then(()=>{ this.$confirm('确定删除此行数据??', '提示', { type: 'warning' }).then(() => {
this.dataList.splice(idx,1); dept['dataList'+this.costType].splice(idx, 1);
}); });
}, },
chkRowData(row){ chkRowData(row) {
row.money3=row.money*1-row.money2*1; row.money3 = row.money * 1 - row.money2 * 1;
row.isErr=(row.money*1+row.money2*1)==0 || !row.date1; row.isErr = (row.money * 1 + row.money2 * 1) == 0 || !row.date1;
this.$emit("change",this.dataList); this.$emit("change", this.depts);
}, },
doAdd() { doAdd() {
this.dataList.push({ let deptId = this.tabName.substr(1);
costType:this.costType, let tmps = this.depts.filter(d => d.deptId == deptId);
money: '', if (tmps.length > 0) {
money2: '', tmps[0]['dataList' + this.costType].push({
money3: '', costType: this.costType,
projectId:this.prj.id, money: '',
date1: undefined, money2: '',
isErr:true money3: '',
}); projectId: this.prj.id,
}, deptId: +deptId,
init(d,prj,costType){ date1: undefined,
this.costType=costType; isErr: true
this.prj=prj;
if(d.length==0){
this.doAdd();
}else{
this.dataList=d.map(it=>{
let obj={...it}
obj.isErr=false;
return obj;
}); });
} }
}, },
checkData(){ init(d, prj, costType, depts) {
let flag1= this.dataList.filter(d=>d.isErr).length==0; this.costType = costType;
if(!flag1){ this.prj = prj;
this.$message.error("请填写数据!"); this.depts = depts.map(it => {
return false; let dataList = d.filter(item => item.deptId == it.deptId).map(item => {
} let obj = { ...item }
flag1=this.dataList.filter(d=>d.money*1<0).length==0; obj.isErr = false;
if(!flag1){ return obj;
this.$message.error("金额不能为负数!"); });
return false; it["dataList" + this.costType] = dataList;
} return it;
flag1=this.dataList.filter(d=>d.money3*1<0).length==0; });
if(!flag1){ if (depts.length > 0) {
this.$message.error("挂账金额不能为负数!"); setTimeout(() => {
return false; this.tabName = "d" + depts[0].deptId;
} }, 400);
return true; }
},
getDataList(){
let tmps=[];
this.depts.forEach(it=>{
let datas=it["dataList"+this.costType];
datas.forEach(item=>{
tmps.push(item);
})
});
return tmps;
},
checkActiveTabData() {
//tab
let deptId = this.tabName.substr(1);
let tmps = this.depts.filter(d => d.deptId == deptId);
if (tmps.length > 0) {
let datas = tmps[0]["dataList" + this.costType];
return this.checkDataList(datas);
}
return true;
},
checkDataList(datas){
let flag1 = datas.filter(d => d.isErr).length == 0;
if (!flag1) {
this.$message.error("请填写数据!");
return false;
}
flag1 = datas.filter(d => d.money * 1 < 0).length == 0;
if (!flag1) {
this.$message.error("金额不能为负数!");
return false;
}
flag1 = datas.filter(d => d.money3 * 1 < 0).length == 0;
if (!flag1) {
this.$message.error("挂账金额不能为负数!");
return false;
}
return true;
},
checkData() {
if (!this.checkActiveTabData()) {
return false;
}
for(let i=0;i<this.depts.length;i++){
let dept=this.depts[i];
if('d'+dept.deptId!=this.tabName){
let datas = dept["dataList" + this.costType];
if(!this.checkDataList(datas)){
this.tabName='d'+dept.deptId;
return false;
}
}
}
return true;
} }
}, },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.cost-contract{ .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;
}
}
}
.data-list {
.datalist-row {
* {
font-size: 12px;
}
}
.el-row {
line-height: 36px;
padding: 0px 10px;
&.row-1 {
background-color: #eeeeee;
}
.el-form-item {
margin-bottom: 2px !important;
margin-top: 2px !important;
.el-input__inner {
height: 28px;
line-height: 28px;
}
}
&.is-error {
.txt-error {
.el-input__inner {
border: solid 1px red;
}
}
}
}
} }
} }
}
</style> </style>

View File

@ -11,7 +11,8 @@
<el-form ref="form" label-width="100px"> <el-form ref="form" label-width="100px">
<el-tabs type="card" v-model="activeName" @tab-click="handleClick"> <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="总投资" name="first"> <el-tab-pane label="总投资" name="first">
<el-form-item label="总投资" class="w400" :class="form.totalInv.money * 1 < 0 ? 'txt-error' : ''"> <el-form-item label="总投资" class="w400"
:class="form.totalInv.money * 1 < 0 ? 'txt-error' : ''">
<el-input-number :precision="4" v-model="form.totalInv.money" placeholder="请输入总投资"> <el-input-number :precision="4" v-model="form.totalInv.money" placeholder="请输入总投资">
</el-input-number> </el-input-number>
<span class="sp-unit">万元</span> <span class="sp-unit">万元</span>
@ -127,6 +128,7 @@ export default {
contract: [],// contract: [],//
safety: [],// safety: [],//
loading: false, loading: false,
depts: [],
}; };
}, },
@ -139,9 +141,12 @@ export default {
costSafetyChange(datas) { costSafetyChange(datas) {
let m2sum = 0; let m2sum = 0;
let m3sum = 0; let m3sum = 0;
datas.forEach(d => { datas.forEach(d => {
m2sum += d.money2; let tmps=d.dataList12;
m3sum += d.money3; tmps.forEach(it=>{
m2sum += it.money2;
m3sum += it.money3;
});
}); });
this.form.safety2.money = m2sum; this.form.safety2.money = m2sum;
this.form.safety3.money = m3sum; this.form.safety3.money = m3sum;
@ -149,21 +154,33 @@ export default {
handleClick(tab, event) { handleClick(tab, event) {
}, },
checkData() { checkData() {
if (!this.$refs.costContract.checkData()) { if(this.activeName == 'third'){
this.activeName = "second"; if (!this.$refs.costSafety.checkData()) {
return false; this.activeName = "third";
} return false;
if (!this.$refs.costSafety.checkData()) { }
this.activeName = "third"; if (!this.$refs.costContract.checkData()) {
return false; this.activeName = "second";
return false;
}
}else{
if (!this.$refs.costContract.checkData()) {
this.activeName = "second";
return false;
}
if (!this.$refs.costSafety.checkData()) {
this.activeName = "third";
return false;
}
} }
return true; return true;
}, },
doSave() { doSave() {
if (!this.checkData()) { if (!this.checkData()) {
return; return;
} }
let objs = this.oldData.filter(d => d.costType != 11 && d.costType != 12).map(it => { let objs = this.oldData.filter(d => d.costType != 11 && d.costType != 12).map(it => {
let obj = { ...it }; let obj = { ...it };
obj.money = obj.money ? obj.money * 10000 : 0; obj.money = obj.money ? obj.money * 10000 : 0;
@ -173,14 +190,14 @@ export default {
this.$message.error("请检查,金额不能为负数!"); this.$message.error("请检查,金额不能为负数!");
return; return;
} }
let contractObjs = this.$refs.costContract.dataList.map(it => { let contractObjs = this.$refs.costContract.getDataList().map(it => {
let obj = { ...it }; let obj = { ...it };
obj.money = obj.money ? obj.money * 10000 : 0; obj.money = obj.money ? obj.money * 10000 : 0;
obj.money2 = obj.money2 ? obj.money2 * 10000 : 0; obj.money2 = obj.money2 ? obj.money2 * 10000 : 0;
obj.date1 = this.$dt(obj.date1).format("YYYY-MM-DD"); obj.date1 = this.$dt(obj.date1).format("YYYY-MM-DD");
return obj; return obj;
}); });
let safetyObjs = this.$refs.costSafety.dataList.map(it => { let safetyObjs = this.$refs.costSafety.getDataList().map(it => {
let obj = { ...it }; let obj = { ...it };
obj.money = obj.money ? obj.money * 10000 : 0; obj.money = obj.money ? obj.money * 10000 : 0;
obj.money2 = obj.money2 ? obj.money2 * 10000 : 0; obj.money2 = obj.money2 ? obj.money2 * 10000 : 0;
@ -214,7 +231,7 @@ export default {
}, },
loadData(init) { loadData(init) {
listByProjectId(this.prj.id).then((d) => { listByProjectId(this.prj.id).then((d) => {
let tmps = (d.data || []).map(it => { let tmps = (d.data || []).map(it => {
it.money = it.money ? it.money / 10000.0 : 0; it.money = it.money ? it.money / 10000.0 : 0;
it.money2 = it.money2 ? it.money2 / 10000.0 : 0; it.money2 = it.money2 ? it.money2 / 10000.0 : 0;
@ -254,8 +271,8 @@ export default {
setTimeout(() => { setTimeout(() => {
this.$refs.costYear.init(this.yearInv, this.prj); this.$refs.costYear.init(this.yearInv, this.prj);
this.$refs.costMonth.init(this.monthInv, this.prj); this.$refs.costMonth.init(this.monthInv, this.prj);
this.$refs.costContract.init(this.contract, this.prj, 11); this.$refs.costContract.init(this.contract, this.prj, 11, this.depts);
this.$refs.costSafety.init(this.safety, this.prj, 12); this.$refs.costSafety.init(this.safety, this.prj, 12, this.depts);
}, 400) }, 400)
}); });
}, },
@ -272,11 +289,26 @@ export default {
tmps.push(obj); tmps.push(obj);
return obj; return obj;
}, },
loadSub(cb) {
this.$api.publics.queryUnitList({
projectId: this.prj.id,
unitTypes: "2".split(","),
}).then((d) => {
this.depts = (d.rows || []).map(it => {
it.dataList11 = [];
it.dataList12 = [];
return it;
});
cb && cb();
});
},
show(prj) { show(prj) {
this.prj = prj; this.prj = prj;
this.title = prj.projectName; this.title = prj.projectName;
this.isOpen = true; this.isOpen = true;
this.loadData(true); this.loadSub(() => {
this.loadData(true);
});
}, },
}, },
}; };

View File

@ -29,6 +29,25 @@ public class SurProjectCostOutput extends BaseEntity
@Excel(name = "金额") @Excel(name = "金额")
private Long money; private Long money;
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
private String deptName;
public Long getDeptId() {
return deptId;
}
public void setDeptId(Long deptId) {
this.deptId = deptId;
}
private Long deptId;
/** 年份 */ /** 年份 */
@Excel(name = "年份") @Excel(name = "年份")
private Long year; private Long year;

View File

@ -20,16 +20,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="money2" column="money2" /> <result property="money2" column="money2" />
<result property="date1" column="date1" /> <result property="date1" column="date1" />
<result property="date2" column="date2" /> <result property="date2" column="date2" />
<result property="deptId" column="deptId"/>
</resultMap> </resultMap>
<sql id="selectSurProjectCostOutputVo"> <sql id="selectSurProjectCostOutputVo">
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 select id, project_id, money, year, month, cost_type, remark, is_del, create_by, create_time, update_by, update_time,money2,date1,date2,deptId from sur_project_cost_output
</sql> </sql>
<select id="selectSurProjectCostOutputList" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult"> <select id="selectSurProjectCostOutputList" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult">
<include refid="selectSurProjectCostOutputVo"/> <include refid="selectSurProjectCostOutputVo"/>
<where> <where>
<if test="projectId != null "> and project_id = #{projectId}</if> <if test="projectId != null "> and project_id = #{projectId}</if>
<if test="deptId != null "> and deptId = #{deptId}</if>
<if test="money != null "> and money = #{money}</if> <if test="money != null "> and money = #{money}</if>
<if test="year != null "> and year = #{year}</if> <if test="year != null "> and year = #{year}</if>
<if test="month != null "> and month = #{month}</if> <if test="month != null "> and month = #{month}</if>
@ -63,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="money2 != null">money2,</if> <if test="money2 != null">money2,</if>
<if test="date1 != null">date1,</if> <if test="date1 != null">date1,</if>
<if test="date2 != null">date2,</if> <if test="date2 != null">date2,</if>
<if test="deptId != null">deptId,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if> <if test="projectId != null">#{projectId},</if>
@ -79,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="money2 != null">#{money2},</if> <if test="money2 != null">#{money2},</if>
<if test="date1 != null">#{date1},</if> <if test="date1 != null">#{date1},</if>
<if test="date2 != null">#{date2},</if> <if test="date2 != null">#{date2},</if>
<if test="deptId != null">#{deptId},</if>
</trim> </trim>
</insert> </insert>
@ -99,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="money2 != null">money2 = #{money2},</if> <if test="money2 != null">money2 = #{money2},</if>
<if test="date1 != null">date1 = #{date1},</if> <if test="date1 != null">date1 = #{date1},</if>
<if test="date2 != null">date2 = #{date2},</if> <if test="date2 != null">date2 = #{date2},</if>
<if test="deptId != null">deptId = #{deptId},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>