批量添加付款计划

master
xy 2 years ago
parent b2335771a7
commit ed5f152af2

@ -46,7 +46,7 @@
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>合同金额
</div>
<div class="xy-table-item-content xy-table-item-price">
<el-input placeholder="请填写合同金额" v-model="form.money" style="width: 300px;" />
<el-input placeholder="请填写合同金额" v-model="form.money" style="width: 300px;" @change="planMonthLists"/>
</div>
</div>
</template>
@ -57,7 +57,7 @@
</div>
<div class="xy-table-item-content">
<el-date-picker style="width: 300px;" value-format="yyyy-MM-dd" v-model="form.time" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期">
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="dateRangePick">
</el-date-picker>
</div>
</div>
@ -142,6 +142,7 @@
<div class="base-info add-plan" style="margin-top: 20px;margin-bottom: 20px">
<div class="base-info-title">付款计划</div>
<Button type="primary" style="margin-left: 50px;" @click="isShowAddPlan = true">新增计划</Button>
<Button type="primary" style="margin-left: 20px;" @click="isShowAddManyPlan = true">批量添加</Button>
</div>
<xy-table :list="signList" :table-item="signTable" :show-index="false" :height="240"
@ -200,6 +201,44 @@
</template>
</xy-dialog>
<Modal
v-model="isShowAddManyPlan"
title="计划任务">
<div class="many-plan">
<div class="many-plan-item">
<p>合同总金额</p>
<div>{{ form.money }}</div>
</div>
<div class="many-plan-item">
<p>开始日期</p>
<el-date-picker v-model="manySetting.startMonth" size="mini" value-format="yyyy-MM-dd" @change="planMonthLists"></el-date-picker>
</div>
<div class="many-plan-item">
<p>付款月份数</p>
<el-input-number v-model="manySetting.lastMonth" :controls="false" size="mini" :precision="0" :min="1" :max="12" @change="planMonthLists"></el-input-number>
</div>
<div class="many-plan-item">
<p>付款日期</p>
<el-input-number v-model="manySetting.day" :controls="false" size="mini" :precision="0" :min="1" :max="31" @change="planMonthLists"></el-input-number>
</div>
<div class="many-plan-item">
<p>生成付款日期</p>
<div>
<div style="display: none;">{{ planMonthLists }}</div>
<xy-table :list="manyForm" :height="300" :table-item="manyTable">
<template #btns></template>
</xy-table>
</div>
</div>
</div>
</Modal>
<detailContractSign ref="detailContractSign" @editorSuccess="getContractSignList"></detailContractSign>
</div>
</template>
@ -235,6 +274,51 @@
},
data() {
return {
isShowAddManyPlan: false,
manySetting: {
day: 1,
lastMonth: 1,
startMonth: ''
},
manyForm: [],
manyTable: [
{
prop: "date",
label: "付款日期",
width: 160,
customFn:row => {
return (
<el-date-picker style="width: 130px;" vModel={row.date} size="mini" value-format="yyyy-MM-dd"></el-date-picker>
)
}
},
{
prop: "money",
label: "金额",
width: 180,
customFn:row => {
return (
<el-input-number size="mini" vModel={row.money} precision={2} controls={false}></el-input-number>
)
}
},
{
prop: "operate",
label: "操作",
customFn:(row,{ $index }) => {
return (
<Button type="error"
size="small"
on={{
['click']:_ => {
this.manyForm.splice($index, 1)
}
}}>移除</Button>
)
}
}
],
form: {
number: '',
supply: '',
@ -357,6 +441,18 @@
}
},
methods: {
dateRangePick (e) {
if (e[0] && e[1]) {
this.manySetting.startMonth = e[0] ? e[0] : '';
this.manySetting.lastMonth = this.$moment(e[1]).diff(this.$moment(e[0]),'months')
} else {
this.manySetting.startMonth = '';
this.manySetting.lastMonth = 1;
}
this.planMonthLists();
},
//
sign() {
if (this.signList.length == 0) {
@ -367,6 +463,15 @@
return false;
}
const signMoneyTotal = this.signList.reduce((pre, cur) => (pre + Number(cur.money || 0)),0)
if (signMoneyTotal !== this.form.money) {
Message({
type: 'warning',
message: '付款计划总金额与合同总金额不相等~'
})
return
}
editorContract({
id: this.contractId,
number: this.form.number,
@ -479,8 +584,38 @@
}
},
planMonthLists () {
const [startDate,endDate] = this.form.time;
const actStartDate = this.manySetting.startMonth;
const actStartYear = new Date(actStartDate).getFullYear();
const actStartMonth = new Date(actStartDate).getMonth();
let dates = [];
if (actStartDate && this.manySetting.day) {
let index = 0;
let nowDate = this.$moment(new Date(actStartYear,actStartMonth,this.manySetting.day)).add(index,'months')
while ((nowDate.valueOf() <= this.$moment(endDate).valueOf())) {
if (nowDate.valueOf() >= this.$moment(actStartDate).valueOf()) {
dates.push(nowDate.format('YYYY-MM-DD'));
}
index++;
nowDate = this.$moment(new Date(actStartYear,actStartMonth,this.manySetting.day)).add(index,'months');
}
let returnRes = dates.slice(0,this.manySetting.lastMonth)
this.manyForm = returnRes.map(i => ({
money: (Number(this.form.money || 0) / returnRes.length).toFixed(2),
date: i,
content: ""
}))
}
}
},
computed: {
},
watch: {
async contractId() {
await this.getContractSignList()
@ -492,6 +627,17 @@
</script>
<style scoped lang="scss">
.many-plan {
&-item {
display: flex;
margin-bottom: 20px;
& > p {
flex-basis: 30%;
flex-shrink: 0;
}
}
}
.base-info {
&-title {

@ -239,6 +239,39 @@ export default {
);
},
},
{
prop: "",
label: "评审项目情况简介",
width: 180,
sortable: false,
customFn: row => {
return (
<el-input size="mini" placeholder="评审项目情况简介" clearable={true}></el-input>
)
}
},
{
prop: "",
label: "总投资金额",
width: 180,
sortable: false,
customFn: row => {
return (
<el-input-number precision={2} controls={false} size="mini" placeholder="总投资金额" clearable={true}></el-input-number>
)
}
},
{
prop: "",
label: "评审金额",
width: 180,
sortable: false,
customFn: row => {
return (
<el-input-number precision={2} controls={false} size="mini" placeholder="评审金额" clearable={true}></el-input-number>
)
}
},
{
prop: "plan_date",
label: "计划评审时间",

Loading…
Cancel
Save