|
|
@ -31,7 +31,7 @@ import request from '@/common/request' |
|
|
|
data(){ |
|
|
|
return{ |
|
|
|
fields:{ |
|
|
|
plantBaseInfoId:{label:"基地名称",type:"select",columns:[[]],value:[],disabled:this.$store.getters['userInfo'].roleCode=="base_admin"}, |
|
|
|
plantBaseInfoName:{label:"基地名称",disabled:true}, |
|
|
|
plotName:{label:"地块名称"}, |
|
|
|
plotNumber:{label:"地块编号"}, |
|
|
|
drawArea:{label:"勾画面积(亩)",disabled:true,type:'digit'}, |
|
|
@ -56,7 +56,7 @@ import request from '@/common/request' |
|
|
|
address:"", |
|
|
|
}, |
|
|
|
rules:{ |
|
|
|
plantBaseInfoId:{required:true, message:"基地名称必填!", trigger:"change"}, |
|
|
|
// plantBaseInfoId:{required:true, message:"基地名称必填!", trigger:"change"}, |
|
|
|
// plotNumber:{required:false, message:"地块编号必填!", trigger:"blur"}, |
|
|
|
plotName:{required:true, message:"地块名称必填!", trigger:"blur"}, |
|
|
|
// drawArea:{required:true, type:'number', message:"!", trigger:"blur"}, |
|
|
@ -75,33 +75,15 @@ import request from '@/common/request' |
|
|
|
} |
|
|
|
}, |
|
|
|
async onLoad(options){ |
|
|
|
await this.init() |
|
|
|
if(options.id){ |
|
|
|
this.getDetail(options.id) |
|
|
|
}else if(this.$store.getters['userInfo'].roleCode=="base_admin"){ |
|
|
|
var baseVal=this.fields.plantBaseInfoId.columns[0].find(v=>v.value==this.$store.state.baseInfo.id) |
|
|
|
if(baseVal){ |
|
|
|
this.formData.plantBaseInfoId=baseVal.value |
|
|
|
this.fields.plantBaseInfoId.value=[baseVal.value] |
|
|
|
} |
|
|
|
}else{ |
|
|
|
this.formData.plantBaseInfoId=this.$store.state.baseInfo.id |
|
|
|
this.formData.plantBaseInfoName=this.$store.state.baseInfo.name |
|
|
|
} |
|
|
|
this.eventChannel=this.getOpenerEventChannel() |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
async init(){ |
|
|
|
var res=await request("/api/plantPlot/getAllPlantBaseInfo",{ |
|
|
|
params:{companyId:this.$store.getters.userInfo.companyId} |
|
|
|
}) |
|
|
|
if(res.statu){ |
|
|
|
this.fields.plantBaseInfoId.columns = [res.data.map(v=>({label:v.baseName,value:v.id}))] |
|
|
|
}else{ |
|
|
|
uni.showModal({ |
|
|
|
title:"提示", |
|
|
|
content:res.msg||"获取基地名称下拉选项失败!", |
|
|
|
showCancel:false, |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
selectDate(e){ |
|
|
|
switch(e.type){ |
|
|
|
case "start":this.fields.date.value[0]=e.value;break; |
|
|
|