|
@@ -17,18 +17,27 @@
|
|
|
label-position="left"
|
|
label-position="left"
|
|
|
class='form-content flex flex-col'
|
|
class='form-content flex flex-col'
|
|
|
>
|
|
>
|
|
|
- <el-form-item v-for='item in list1' :key='item' label-width='0'>
|
|
|
|
|
|
|
+ <el-form-item v-for='(item,index) in completeCount' :key='item' label-width='0'>
|
|
|
<div class='flex flex-col flex-center full-width'>
|
|
<div class='flex flex-col flex-center full-width'>
|
|
|
<div class='flex flex-center flex-justify-between full-width'>
|
|
<div class='flex flex-center flex-justify-between full-width'>
|
|
|
<div class='flex-child-average full-width flex flex-center'>
|
|
<div class='flex-child-average full-width flex flex-center'>
|
|
|
- <span style='width: 320px'>{{ item.year }}年度计划投资(万元)</span>
|
|
|
|
|
- <el-input v-model='item.value' @change='change(item)'></el-input>
|
|
|
|
|
|
|
+ <span style='width: 320px'>{{
|
|
|
|
|
+ form.month_plan_complete_amount[index] ? form.month_plan_complete_amount[index].year : ''
|
|
|
|
|
+ }}年度计划投资(万元)</span>
|
|
|
|
|
+ <div class='disable-input' @change='change(item)'>
|
|
|
|
|
+ {{ form.month_complete_amount[index] ? form.month_complete_amount[index].sum : '' }}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
<div style='width: 20px'></div>
|
|
<div style='width: 20px'></div>
|
|
|
<div class='flex-child-average full-width flex flex-center'>
|
|
<div class='flex-child-average full-width flex flex-center'>
|
|
|
- <span style='width: 380px'>{{ item.year }}年度累计投资(万元)</span>
|
|
|
|
|
- <div class='disable-input' @change='change(item)'>{{ item.value2 }}</div>
|
|
|
|
|
- <div class='btnSub pointer' @click='showMonth(item,2)'>月填报</div>
|
|
|
|
|
|
|
+ <span style='width: 380px'>{{
|
|
|
|
|
+ form.month_plan_complete_amount[index] ? form.month_plan_complete_amount[index].year : ''
|
|
|
|
|
+ }}年度累计投资(万元)</span>
|
|
|
|
|
+ <div class='disable-input' @change='change(item)'>
|
|
|
|
|
+ {{ form.month_complete_amount[index] ? form.month_complete_amount[index].sum : '' }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class='btnSub pointer' @click='showMonth(form.month_plan_complete_amount[index].year ,1,index)'>月填报
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -46,18 +55,19 @@
|
|
|
label-position="left"
|
|
label-position="left"
|
|
|
class='form-content flex flex-col'
|
|
class='form-content flex flex-col'
|
|
|
>
|
|
>
|
|
|
- <el-form-item v-for='item in list2' :key='item' label-width='0'>
|
|
|
|
|
|
|
+ <el-form-item v-for='(item,index) in investmentCount' :key='item' label-width='0'>
|
|
|
<div class='flex flex-col flex-center full-width'>
|
|
<div class='flex flex-col flex-center full-width'>
|
|
|
<div class='flex flex-center flex-justify-between full-width'>
|
|
<div class='flex flex-center flex-justify-between full-width'>
|
|
|
<div class='flex-child-average full-width flex flex-center'>
|
|
<div class='flex-child-average full-width flex flex-center'>
|
|
|
- <span style='width: 400px'>{{ item.year }}年度计划纳统投资(万元)</span>
|
|
|
|
|
- <el-input v-model='item.value' @change='change(item)'></el-input>
|
|
|
|
|
|
|
+ <span style='width: 400px'>{{ form.month_plan_investment[index].year }}年度计划纳统投资(万元)</span>
|
|
|
|
|
+ <el-input v-model='form.month_plan_investment[index].data' @change='change(item)'></el-input>
|
|
|
</div>
|
|
</div>
|
|
|
<div style='width: 20px'></div>
|
|
<div style='width: 20px'></div>
|
|
|
<div class='flex-child-average full-width flex flex-center'>
|
|
<div class='flex-child-average full-width flex flex-center'>
|
|
|
- <span style='width: 440px'>{{ item.year }}年度累计纳统投资(万元)</span>
|
|
|
|
|
- <div class='disable-input' @change='change(item)'>{{ item.value2 }}</div>
|
|
|
|
|
- <div class='btnSub pointer' @click='showMonth(item)'>月填报</div>
|
|
|
|
|
|
|
+ <span style='width: 440px'>{{ form.month_plan_investment[index].year }}年度累计纳统投资(万元)</span>
|
|
|
|
|
+ <div class='disable-input' @change='change(item)'>{{ form.month_investment_amount.data }}</div>
|
|
|
|
|
+ <div class='btnSub pointer' @click='showMonth(form.month_plan_investment[index].year,2,index)'>月填报
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -65,7 +75,7 @@
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <el-dialog v-model='show' :title='current ? current.year + "年度" : ""' width='1260px'>
|
|
|
|
|
|
|
+ <el-dialog v-model='show' :title='current ? current.year + "年度" + current.index : ""' width='1260px'>
|
|
|
<div class='flex flex-center flex-align-start'>
|
|
<div class='flex flex-center flex-align-start'>
|
|
|
<div>
|
|
<div>
|
|
|
<div class='padding-top'></div>
|
|
<div class='padding-top'></div>
|
|
@@ -74,19 +84,19 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div>
|
|
<div>
|
|
|
<div class='mr-5 flex flex-center '>
|
|
<div class='mr-5 flex flex-center '>
|
|
|
- <div v-for='item in current.months' :key='item.name' class='title'>
|
|
|
|
|
- {{ item.name }}月
|
|
|
|
|
|
|
+ <div v-for='item in 12' :key='item' class='title'>
|
|
|
|
|
+ {{ item }}月
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class='mr-5 flex flex-center'>
|
|
<div class='mr-5 flex flex-center'>
|
|
|
- <div v-for='item in current.planMonths' :key='item.name'>
|
|
|
|
|
- <input class='input' v-model="item.value" @change='changeMonth(item,1)'>
|
|
|
|
|
|
|
+ <div v-for='(item,index) in current.planMonths' :key='item'>
|
|
|
|
|
+ <input class='input' v-model="item.data" @change='changeMonth(item,1,index)'>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class='mr-5 flex flex-center'>
|
|
<div class='mr-5 flex flex-center'>
|
|
|
<div v-for='item in current.months' :key='item.name'>
|
|
<div v-for='item in current.months' :key='item.name'>
|
|
|
- <input class='input' v-model="item.value" @change='changeMonth(item,2)'>
|
|
|
|
|
|
|
+ <input class='input' v-model="item.data" @change='changeMonth(item,2)'>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -115,8 +125,7 @@ export default {
|
|
|
watch: {
|
|
watch: {
|
|
|
detail: {
|
|
detail: {
|
|
|
handler (val) {
|
|
handler (val) {
|
|
|
- if (val) {
|
|
|
|
|
- this.form = this.detail
|
|
|
|
|
|
|
+ if (Object.keys(val).length > 1) {
|
|
|
this.init(val)
|
|
this.init(val)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -127,6 +136,8 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
show: false,
|
|
show: false,
|
|
|
disabled: true,
|
|
disabled: true,
|
|
|
|
|
+ investmentCount: 0,
|
|
|
|
|
+ completeCount: 0,
|
|
|
list1: [],
|
|
list1: [],
|
|
|
list2: [],
|
|
list2: [],
|
|
|
form: {},
|
|
form: {},
|
|
@@ -183,55 +194,46 @@ export default {
|
|
|
this.list2.push(item)
|
|
this.list2.push(item)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- init () {
|
|
|
|
|
- const keys = Object.keys(this.detail).filter(sub => sub.indexOf('_plan_complete_amount') > -1)
|
|
|
|
|
- if (keys.length > 0) {
|
|
|
|
|
- keys.forEach(sub => {
|
|
|
|
|
- const tmp = Number.parseInt(sub.substring(0, 4))
|
|
|
|
|
- const months = []
|
|
|
|
|
- const planMonths = []
|
|
|
|
|
- for (let i = 1; i <= 12; i++) {
|
|
|
|
|
- months.push({ index: i, name: i, value: this.form[tmp + '_' + i + '_month_complete_amount'] })
|
|
|
|
|
- planMonths.push({ index: i, name: i, value: this.form[tmp + '_' + i + '_plan_month_complete_amount'] })
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ init (res) {
|
|
|
|
|
+ console.log('fuck' + new Date().getTime())
|
|
|
|
|
+ this.investmentCount = Math.max(res.month_plan_investment.length, res.month_investment_amount.length)
|
|
|
|
|
+ // const dd = res.month_plan_investment.filter((sub) => {
|
|
|
|
|
+ // return res.month_investment_amount.findIndex(ele => sub.year === ele.year) === -1
|
|
|
|
|
+ // }).map(sub => { // data -》 ''
|
|
|
|
|
+ // sub.monthlyData.map(ele => {
|
|
|
|
|
+ // ele.data = ''
|
|
|
|
|
+ // return ele
|
|
|
|
|
+ // })
|
|
|
|
|
+ // })
|
|
|
|
|
+ // // 复制差集
|
|
|
|
|
+ // if (res.month_plan_investment.length === this.completeCount) {
|
|
|
|
|
+ // res.month_investment_amount.push(dd)
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // res.month_plan_investment.push(dd)
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
- const item = {
|
|
|
|
|
- type: 1,
|
|
|
|
|
- code: sub,
|
|
|
|
|
- code2: tmp + '_total_complete_amount',
|
|
|
|
|
- year: tmp,
|
|
|
|
|
- value: this.detail[tmp + '_plan_complete_amount'],
|
|
|
|
|
- value2: this.detail[tmp + '_total_complete_amount'],
|
|
|
|
|
- planMonths,
|
|
|
|
|
- months
|
|
|
|
|
- }
|
|
|
|
|
- this.list1.push(item)
|
|
|
|
|
|
|
+ this.completeCount = Math.max(res.month_complete_amount.length, res.month_plan_complete_amount.length)
|
|
|
|
|
+ // 求出差集
|
|
|
|
|
+ const d = res.month_complete_amount.filter((sub) => {
|
|
|
|
|
+ return res.month_plan_complete_amount.findIndex(ele => sub.year !== ele.year) !== -1
|
|
|
|
|
+ }).map(sub => { // data -》 ''
|
|
|
|
|
+ sub.monthlyData.map(ele => {
|
|
|
|
|
+ ele.data = ele.data ? ele.data : ''
|
|
|
|
|
+ return ele
|
|
|
})
|
|
})
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const keysInvestment = Object.keys(this.detail).filter(sub => sub.indexOf('_plan_investment_amount') > -1)
|
|
|
|
|
- if (keysInvestment.length > 0) {
|
|
|
|
|
- keysInvestment.forEach(sub => {
|
|
|
|
|
- const tmp = Number.parseInt(sub.substring(0, 4))
|
|
|
|
|
- const months = []
|
|
|
|
|
- const planMonths = []
|
|
|
|
|
- for (let i = 1; i <= 12; i++) {
|
|
|
|
|
- months.push({ index: i, name: i, value: this.form[tmp + '_' + i + '_month_investment_amount'] })
|
|
|
|
|
- planMonths.push({ index: i, name: i, value: this.form[tmp + '_' + i + '_plan_month_investment_amount'] })
|
|
|
|
|
- }
|
|
|
|
|
- const item = {
|
|
|
|
|
- type: 2,
|
|
|
|
|
- code: sub,
|
|
|
|
|
- code2: tmp + '_total_investment_amount',
|
|
|
|
|
- year: tmp,
|
|
|
|
|
- value: this.detail[tmp + '_plan_investment_amount'],
|
|
|
|
|
- value2: this.detail[tmp + '_total_investment_amount'],
|
|
|
|
|
- planMonths,
|
|
|
|
|
- months
|
|
|
|
|
- }
|
|
|
|
|
- this.list2.push(item)
|
|
|
|
|
|
|
+ return sub
|
|
|
|
|
+ })
|
|
|
|
|
+ // 复制差集
|
|
|
|
|
+ if (res.month_complete_amount.length === this.completeCount) {
|
|
|
|
|
+ d.forEach(sub => {
|
|
|
|
|
+ res.month_plan_complete_amount.push(sub)
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ d.forEach(sub => {
|
|
|
|
|
+ res.month_complete_amount.push(sub)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ this.form = res
|
|
|
},
|
|
},
|
|
|
change (item) {
|
|
change (item) {
|
|
|
this.form[item.code] = item.value
|
|
this.form[item.code] = item.value
|
|
@@ -251,35 +253,73 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- showMonth (item) {
|
|
|
|
|
- this.current = item
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param year
|
|
|
|
|
+ * @param type 1 年度投资 2 纳统投资
|
|
|
|
|
+ * @param index 索引
|
|
|
|
|
+ */
|
|
|
|
|
+ showMonth (year, type, index) {
|
|
|
|
|
+ const item = { editType: type, year, index }
|
|
|
|
|
+ if (type === 1) {
|
|
|
|
|
+ item.planMonths = this.form.month_plan_complete_amount.find(sub => sub.year === year).monthlyData
|
|
|
|
|
+ item.months = this.form.month_complete_amount.find(sub => sub.year === year).monthlyData
|
|
|
|
|
+ } else if (type === 2) {
|
|
|
|
|
+ item.planMonths = this.form.month_plan_investment.find(sub => sub.year === year).monthlyData
|
|
|
|
|
+ item.months = this.form.month_investment_amount.find(sub => sub.year === year).monthlyData
|
|
|
|
|
+ }
|
|
|
|
|
+ this.current = Object.assign({}, item)
|
|
|
|
|
+ for (let i = 1; i <= 12; i++) {
|
|
|
|
|
+ const index = this.current.months.findIndex(sub => sub.month === i.toString())
|
|
|
|
|
+ if (index === -1 && this.current.months.length < 12) {
|
|
|
|
|
+ const item = { month: i.toString(), data: '', year: '' }
|
|
|
|
|
+ this.current.months.push(item)
|
|
|
|
|
+ }
|
|
|
|
|
+ const planIndex = this.current.planMonths.findIndex(sub => sub.month === i.toString())
|
|
|
|
|
+ if (planIndex === -1 && this.current.planMonths.length < 12) {
|
|
|
|
|
+ const item = { month: i.toString(), data: '', year: '' }
|
|
|
|
|
+ this.current.planMonths.push(item)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
this.show = !this.show
|
|
this.show = !this.show
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
|
* @param res
|
|
* @param res
|
|
|
* @param type 1 计划 2 累计
|
|
* @param type 1 计划 2 累计
|
|
|
|
|
+ * current 1 年度投资 2 纳统投资
|
|
|
*/
|
|
*/
|
|
|
- changeMonth (res, type) {
|
|
|
|
|
|
|
+ changeMonth (res, type, index) {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
- let code = this.current.year + '_' + res.name + (this.current.type === 1 ? '_month_complete_amount' : '_month_investment_amount')
|
|
|
|
|
- if (type === 1) {
|
|
|
|
|
- code = this.current.year + '_' + res.name + (this.current.type === 1 ? '_plan_month_complete_amount' : '_plan_month_investment_amount')
|
|
|
|
|
- }
|
|
|
|
|
- this.form[code] = res.value
|
|
|
|
|
- const tmp = this.current.months.map(sub => Number.parseInt(sub.value))
|
|
|
|
|
- const sum = tmp.reduce((accumulator, value) => {
|
|
|
|
|
- return accumulator + (value || 0)
|
|
|
|
|
- }, 0)
|
|
|
|
|
- let codeParent = this.current.year + (this.current.type === 1 ? '_total_complete_amount' : '_total_investment_amount')
|
|
|
|
|
- if (type === 1) {
|
|
|
|
|
- codeParent = this.current.year + (this.current.type === 1 ? '_plan_total_complete_amount' : '_plan_total_investment_amount')
|
|
|
|
|
|
|
+ if (this.current.editType === 1) {
|
|
|
|
|
+ if (type === 1) {
|
|
|
|
|
+ this.form.month_plan_complete_amount[this.current.index].monthlyData[index] = res
|
|
|
|
|
+ this.form.month_plan_complete_amount[this.current.index].sum = this.getSum(this.form.month_plan_complete_amount[this.current.index].monthlyData)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.form.month_complete_amount[this.current.index].monthlyData[index] = res
|
|
|
|
|
+ this.form.month_complete_amount[this.current.index].sum = this.getSum(this.form.month_complete_amount[this.current.index].monthlyData)
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (this.current.editType === 2) {
|
|
|
|
|
+ if (type === 1) {
|
|
|
|
|
+ this.form.month_plan_investment[this.current.index].monthlyData[index] = res
|
|
|
|
|
+ this.form.month_plan_investment[this.current.index].sum = this.getSum(this.form.month_plan_investment[this.current.index].monthlyData)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.form.month_investment_amount[this.current.index].monthlyData[index] = res
|
|
|
|
|
+ this.form.month_investment_amount[this.current.index].sum = this.getSum(this.form.month_investment_amount[this.current.index].monthlyData)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- this.form[codeParent] = sum
|
|
|
|
|
- this.current.value2 = sum
|
|
|
|
|
console.log(this.form)
|
|
console.log(this.form)
|
|
|
- this.update(false)
|
|
|
|
|
|
|
+ // this.update(false)
|
|
|
}, 500)
|
|
}, 500)
|
|
|
|
|
+ },
|
|
|
|
|
+ getSum (list) {
|
|
|
|
|
+ let sum = 0
|
|
|
|
|
+ list.forEach(sub => {
|
|
|
|
|
+ if (sub.data.length > 0) {
|
|
|
|
|
+ sum = sum + Number.parseInt(sub.data)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ return sum
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|