|
@@ -21,7 +21,7 @@
|
|
|
<div class="selectLeft">
|
|
|
<div class="inpBlock" style="position: relative;">
|
|
|
<div class="label">所属项目</div>
|
|
|
- <el-select v-model="tableData.pid" style="width: 100%;" placeholder="请选择">
|
|
|
+ <el-select v-model="tableData.pid" @change="checkProjectMoney(tableData.pid,tableData.money)" style="width: 100%;" placeholder="请选择">
|
|
|
<el-option
|
|
|
v-for="item in selectInput.project"
|
|
|
:key="item.courseId"
|
|
@@ -32,7 +32,7 @@
|
|
|
</div>
|
|
|
<div class="inpBlock">
|
|
|
<div class="label">预算经费</div>
|
|
|
- <el-input type="number" v-model.number="tableData.money" placeholder="请输入预算经费"></el-input>
|
|
|
+ <el-input type="number" v-model.number="tableData.money" @blur="checkProjectMoney(tableData.pid,tableData.money)" placeholder="请输入预算经费"></el-input>
|
|
|
<div style="position: absolute;right: -28px;top:8px">(元)</div>
|
|
|
</div>
|
|
|
<div class="inpBlock">
|
|
@@ -337,6 +337,7 @@ export default {
|
|
|
chapters:["","","",""],
|
|
|
reportFile:"",
|
|
|
},
|
|
|
+ oldMoney:0,
|
|
|
selectInput:{
|
|
|
project:[],
|
|
|
class:[]
|
|
@@ -576,7 +577,7 @@ export default {
|
|
|
data.chapters = JSON.parse(data.chapters)
|
|
|
data.reportFile = data.reportFile==''||data.reportFile==null?[]:JSON.parse(data.reportFile)
|
|
|
this.tableData = data;
|
|
|
- console.log(data)
|
|
|
+ this.oldMoney += Number(this.tableData.money)
|
|
|
}).catch(err=>{
|
|
|
this.$message.error(err.message)
|
|
|
})
|
|
@@ -598,6 +599,31 @@ export default {
|
|
|
}).catch(err=>{
|
|
|
this.$message.error(err.message)
|
|
|
})
|
|
|
+ },
|
|
|
+ //检查经费是否超出
|
|
|
+ checkProjectMoney(pid,aMoney){
|
|
|
+ if(aMoney==0){
|
|
|
+ return 1;
|
|
|
+ }else if(/^\s*$/g.test(pid) && aMoney!=0){
|
|
|
+ this.tableData.money = 0;
|
|
|
+ return this.$message.info("请先选择所属项目");
|
|
|
+ } else if(!/^\s*$/g.test(pid) && aMoney!=0){
|
|
|
+ this.ajax.get(this.$store.state.api+"/GetAllActivityMoneyByProjectId",{
|
|
|
+ uid:this.$store.state.userInfo.userid,
|
|
|
+ projectid:pid
|
|
|
+ }).then(res=>{
|
|
|
+ let PMoney = res.data[0][0]['PMoney'];
|
|
|
+ let AMoney = res.data[1][0]["AMoney"];
|
|
|
+ if(PMoney<((AMoney-this.oldMoney)+aMoney)){
|
|
|
+ this.tableData.money = PMoney-AMoney+this.oldMoney;
|
|
|
+ return this.$message.warning(`项目预算不足,项目预算只剩:${PMoney-AMoney+this.oldMoney}`);
|
|
|
+ }else{
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
mounted(){
|