|
|
@@ -114,7 +114,7 @@
|
|
|
</div>
|
|
|
<div class='mt-20 full-width flex flex-justify-between'>
|
|
|
<span class="red">* 请按月份进行填报,单位:万元</span>
|
|
|
- <base-button class="mr-20" title="保存" @click="update"/>
|
|
|
+ <base-button class="mr-20" title="保存" icon='el-icon-check' @click="update"/>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
@@ -125,7 +125,7 @@ import baseButton from '@/components/base-button.vue'
|
|
|
|
|
|
export default {
|
|
|
name: 'params3',
|
|
|
- components: {baseButton},
|
|
|
+ components: { baseButton },
|
|
|
props: {
|
|
|
info: {
|
|
|
type: Object,
|
|
|
@@ -138,7 +138,7 @@ export default {
|
|
|
},
|
|
|
watch: {
|
|
|
detail: {
|
|
|
- handler(val) {
|
|
|
+ handler (val) {
|
|
|
if (Object.keys(val).length > 1) {
|
|
|
this.init(val)
|
|
|
}
|
|
|
@@ -146,7 +146,7 @@ export default {
|
|
|
immediate: true
|
|
|
},
|
|
|
disabled: {
|
|
|
- handler(val) {
|
|
|
+ handler (val) {
|
|
|
if (val) {
|
|
|
this.update(val !== true)
|
|
|
}
|
|
|
@@ -154,7 +154,7 @@ export default {
|
|
|
immediate: false
|
|
|
}
|
|
|
},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
show: false,
|
|
|
disabled: true,
|
|
|
@@ -171,7 +171,7 @@ export default {
|
|
|
*
|
|
|
* @param type 1计划投资 2 纳统投资
|
|
|
*/
|
|
|
- addYear(type) {
|
|
|
+ addYear (type) {
|
|
|
this.disabled = false
|
|
|
if (type === 1) {
|
|
|
if (this.form.month_complete_amount.length === 0) {
|
|
|
@@ -196,18 +196,18 @@ export default {
|
|
|
}
|
|
|
console.log(this.form)
|
|
|
},
|
|
|
- nextYear(year) {
|
|
|
+ nextYear (year) {
|
|
|
const tmp2 = {}
|
|
|
tmp2.year = (year + 1).toString()
|
|
|
tmp2.sum = ''
|
|
|
tmp2.monthlyData = []
|
|
|
for (let i = 1; i <= 12; i++) {
|
|
|
- const item2 = {year: tmp2.year, data: '', month: i.toString()}
|
|
|
+ const item2 = { year: tmp2.year, data: '', month: i.toString() }
|
|
|
tmp2.monthlyData.push(item2)
|
|
|
}
|
|
|
return tmp2
|
|
|
},
|
|
|
- init(res) {
|
|
|
+ init (res) {
|
|
|
if (!Object.keys(res).includes('month_plan_investment')) {
|
|
|
res.month_plan_investment = []
|
|
|
}
|
|
|
@@ -269,11 +269,11 @@ export default {
|
|
|
}
|
|
|
this.form = res
|
|
|
},
|
|
|
- change(item) {
|
|
|
+ change (item) {
|
|
|
this.form[item.code] = item.value
|
|
|
this.form[item.code2] = item.value2
|
|
|
},
|
|
|
- update(show = Boolean) {
|
|
|
+ update (show = Boolean) {
|
|
|
this.$nextTick(() => {
|
|
|
this.form.projectId = this.form.id
|
|
|
if (this.form.month_plan_complete_amount.length > 0) {
|
|
|
@@ -288,6 +288,11 @@ export default {
|
|
|
if (this.form.month_investment_amount.length > 0) {
|
|
|
this.form.month_investment_amount[this.current.index].sum = this.getSum(this.form.month_investment_amount[this.current.index].monthlyData)
|
|
|
}
|
|
|
+ // 生成年月字段
|
|
|
+ this.initYearMonth(this.form.month_plan_complete_amount, '_month_plan_complete_amount')
|
|
|
+ this.initYearMonth(this.form.month_complete_amount, '_month_complete_amount')
|
|
|
+ this.initYearMonth(this.form.month_plan_investment, '_month_plan_investment')
|
|
|
+ this.initYearMonth(this.form.month_investment_amount, '_month_investment_amount')
|
|
|
delete this.form._id
|
|
|
this.$api.project.proUpdate(this.detail).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
@@ -301,15 +306,39 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 组合字段
|
|
|
+ * @param list
|
|
|
+ * @param key
|
|
|
+ */
|
|
|
+ initYearMonth (list, key) {
|
|
|
+ if (list.length > 0) {
|
|
|
+ list.forEach(sub => {
|
|
|
+ let tmp = this.kv(sub.year + 'yearly' + key, sub.sum)
|
|
|
+ sub.monthlyData.forEach(res => {
|
|
|
+ const month = this.kv(res.year + '_' + res.month + key, res.data)
|
|
|
+ tmp = Object.assign(tmp, month)
|
|
|
+ })
|
|
|
+ this.form = Object.assign(this.form, tmp)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ kv (key, value) {
|
|
|
+ const keyValue = {}
|
|
|
+ keyValue[key] = value
|
|
|
+ return keyValue
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* @param year
|
|
|
* @param type 1 年度投资 2 纳统投资
|
|
|
* @param index 索引
|
|
|
*/
|
|
|
- showMonth(year, type, index) {
|
|
|
+ showMonth (year, type, index) {
|
|
|
this.$nextTick(() => {
|
|
|
- const item = {editType: type, year, 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
|
|
|
@@ -321,12 +350,12 @@ export default {
|
|
|
for (let i = 1; i <= 11; i++) {
|
|
|
const index = this.current.months.findIndex(sub => sub.month === i.toString())
|
|
|
if (index === -1 && this.current.months.length < 11) {
|
|
|
- const ele = {month: i.toString(), data: '', year: ''}
|
|
|
+ const ele = { month: i.toString(), data: '', year: '' }
|
|
|
this.current.months.push(ele)
|
|
|
}
|
|
|
const planIndex = this.current.planMonths.findIndex(sub => sub.month === i.toString())
|
|
|
if (planIndex === -1 && this.current.planMonths.length < 11) {
|
|
|
- const sub = {month: i.toString(), data: '', year: ''}
|
|
|
+ const sub = { month: i.toString(), data: '', year: '' }
|
|
|
this.current.planMonths.push(sub)
|
|
|
}
|
|
|
}
|
|
|
@@ -339,7 +368,7 @@ export default {
|
|
|
* @param type 1 计划 2 累计
|
|
|
* current 1 年度投资 2 纳统投资
|
|
|
*/
|
|
|
- changeMonth(res, type, index) {
|
|
|
+ changeMonth (res, type, index) {
|
|
|
setTimeout(() => {
|
|
|
if (this.current.editType === 1) {
|
|
|
if (type === 1) {
|
|
|
@@ -356,7 +385,7 @@ export default {
|
|
|
}
|
|
|
}, 1000)
|
|
|
},
|
|
|
- getSum(list) {
|
|
|
+ getSum (list) {
|
|
|
let sum = 0
|
|
|
list.forEach(sub => {
|
|
|
if (sub.data.length > 0) {
|