|
@@ -12,8 +12,20 @@
|
|
|
</div>
|
|
</div>
|
|
|
<!-- content list -->
|
|
<!-- content list -->
|
|
|
<div style="width: 93%" class="mt-20">
|
|
<div style="width: 93%" class="mt-20">
|
|
|
- <div class="flex flex-justify-start">
|
|
|
|
|
- <el-button type="primary" icon="el-icon-plus" @click="addYear(1)"
|
|
|
|
|
|
|
+ <div class="flex flex-justify-start ml-20">
|
|
|
|
|
+ <el-select v-model="selectYear">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in years"
|
|
|
|
|
+ :key="item.value"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.value"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
|
+ class="ml-20"
|
|
|
|
|
+ @click="addYear(1)"
|
|
|
>新增年度</el-button
|
|
>新增年度</el-button
|
|
|
>
|
|
>
|
|
|
</div>
|
|
</div>
|
|
@@ -64,8 +76,20 @@
|
|
|
|
|
|
|
|
<!-- 纳统投资 -->
|
|
<!-- 纳统投资 -->
|
|
|
<div style="width: 93%" class="mt-20">
|
|
<div style="width: 93%" class="mt-20">
|
|
|
- <div class="flex flex-justify-start">
|
|
|
|
|
- <el-button type="primary" icon="el-icon-plus" @click="addYear(2)"
|
|
|
|
|
|
|
+ <div class="flex flex-justify-start ml-20">
|
|
|
|
|
+ <el-select v-model="selectYear2">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in years"
|
|
|
|
|
+ :key="item.value"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :value="item.value"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
|
+ class="ml-20"
|
|
|
|
|
+ @click="addYear(2)"
|
|
|
>新增年度</el-button
|
|
>新增年度</el-button
|
|
|
>
|
|
>
|
|
|
</div>
|
|
</div>
|
|
@@ -202,6 +226,7 @@ export default {
|
|
|
if (val.investment && val.investment.data) {
|
|
if (val.investment && val.investment.data) {
|
|
|
this.investment = val.investment.data
|
|
this.investment = val.investment.data
|
|
|
}
|
|
}
|
|
|
|
|
+ this.initYear()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
disabled: {
|
|
disabled: {
|
|
@@ -219,20 +244,38 @@ export default {
|
|
|
amount: [],
|
|
amount: [],
|
|
|
investment: [],
|
|
investment: [],
|
|
|
currentMonth: null,
|
|
currentMonth: null,
|
|
|
- show: false
|
|
|
|
|
|
|
+ show: false,
|
|
|
|
|
+ years: [],
|
|
|
|
|
+ selectYear: '',
|
|
|
|
|
+ selectYear2: ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ initYear() {
|
|
|
|
|
+ if (this.detail && this.detail.investment) {
|
|
|
|
|
+ this.years.length = 0
|
|
|
|
|
+ const localYears = this.detail.investment.data.map(ele => ele.year)
|
|
|
|
|
+ const year = new Date().getFullYear()
|
|
|
|
|
+ for (let i = 2017; i <= year + 1; i++) {
|
|
|
|
|
+ const item = { label: i, value: i }
|
|
|
|
|
+ if (localYears.findIndex(sub => sub === i) === -1) {
|
|
|
|
|
+ this.years.push(item)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ this.years.reverse()
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
/**
|
|
/**
|
|
|
* 新增年度
|
|
* 新增年度
|
|
|
* @param {*} type 1,新增年度投资 2 新增纳统投资
|
|
* @param {*} type 1,新增年度投资 2 新增纳统投资
|
|
|
*/
|
|
*/
|
|
|
addYear(type) {
|
|
addYear(type) {
|
|
|
- let newYear = new Date().getFullYear()
|
|
|
|
|
- if (type === 1 && this.amount.length > 0) {
|
|
|
|
|
- newYear = this.amount[0].year + 1
|
|
|
|
|
- } else if (type === 2 && this.investment.length > 0) {
|
|
|
|
|
- newYear = this.investment[0].year + 1
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ (type === 1 && this.selectYear.length === 0) ||
|
|
|
|
|
+ (type === 2 && this.selectYear2.length === 0)
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.$message.error('请选择新增年度')
|
|
|
|
|
+ return
|
|
|
}
|
|
}
|
|
|
const newMonthData = []
|
|
const newMonthData = []
|
|
|
for (let i = 1; i <= 12; i++) {
|
|
for (let i = 1; i <= 12; i++) {
|
|
@@ -240,12 +283,12 @@ export default {
|
|
|
actualData: 0,
|
|
actualData: 0,
|
|
|
planData: 0,
|
|
planData: 0,
|
|
|
month: i.toString(),
|
|
month: i.toString(),
|
|
|
- year: newYear
|
|
|
|
|
|
|
+ year: type === 1 ? this.selectYear : this.selectYear2
|
|
|
}
|
|
}
|
|
|
newMonthData.push(sub)
|
|
newMonthData.push(sub)
|
|
|
}
|
|
}
|
|
|
const newYearObj = {
|
|
const newYearObj = {
|
|
|
- year: newYear,
|
|
|
|
|
|
|
+ year: type === 1 ? this.selectYear : this.selectYear2,
|
|
|
actualSum: 0,
|
|
actualSum: 0,
|
|
|
planSum: 0,
|
|
planSum: 0,
|
|
|
monthData: newMonthData
|
|
monthData: newMonthData
|