jhprjv2/ruoyi-ui/src/views/project/costOutput/costYear.vue

72 lines
2.4 KiB
Vue

<template>
<div class="cost-year" style="border:solid 1px #409eff;margin: 12px 0px;padding: 12px 12px 0px;position: relative;">
<el-popover placement="top" v-model="showPop2">
<p>选择年份</p>
<div style="margin-bottom: 12px;">
<el-date-picker v-model="selYear" type="year" placeholder="选择年" :picker-options="{disabledDate:doPick}" >
</el-date-picker>
</div>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="showPop2 = false">取消</el-button>
<el-button type="primary" size="mini" @click="doAddYear">确定</el-button>
</div>
<el-button slot="reference" size="mini" type="success" style="margin-right: 12px;" round>增加年份</el-button>
</el-popover>
<el-tabs v-model="activeName">
<el-tab-pane v-for="(it,idx) in yearInv" :label="''+it.year" :name="''+it.year" :key="idx">
<el-form-item label="年度投资" class="w400">
<el-input-number :precision="4" v-model="it.money" placeholder="年度投资">
</el-input-number>
<span class="sp-unit"></span>
</el-form-item>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import {addYearInvestment} from "@/api/project/costOutput.js";
export default {
name: 'RuoyiUiCostYear',
data() {
return {
selYear:'',
activeName:'',
yearInv:[],
showPop2:false,
};
},
mounted() {
},
methods: {
doPick(a,b){
return this.yearInv.filter(d=>d.year==a.getFullYear()).length>0;
},
doAddYear(){
addYearInvestment({year:this.$dt(this.selYear).$y,projectId:this.prj.id,costType:2}).then(d=>{
this.$emit('success');
});
},
init(d,prj){
this.prj=prj;
this.yearInv=d;
if(d.filter(it=>it.year==new Date().getFullYear()).length>0){
this.activeName=""+new Date().getFullYear()
}else{
this.activeName=""+d.year;
}
}
},
};
</script>
<style lang="scss" scoped>
</style>