Browse Source

type:refactor

commit:界面逻辑
master
孙家正 2 years ago
parent
commit
4e6ad64f34
  1. 18
      pages/massif/info.vue
  2. 6
      pages/massif/plant_plan.vue
  3. 2
      pages/warehouse/info.vue

18
pages/massif/info.vue

@ -32,9 +32,9 @@ import request from '@/common/request'
return{
fields:{
plantBaseInfoId:{label:"基地名称",type:"select",columns:[[]],value:[],disabled:this.$store.getters['userInfo'].roleCode=="base_admin"},
plotNumber:{label:"地块编号"},
plotName:{label:"地块名称"},
drawArea:{label:"地块面积(亩)",type:'digit'},
plotNumber:{label:"地块编号"},
drawArea:{label:"勾画面积(亩)",disabled:true,type:'digit'},
realityArea:{label:"实际面积",type:'digit'},
image:{label:"地块图片",type:"upImg",num:3,value:''},
date:{label:"使用日期",type:"dateRange",value:[]},
@ -57,19 +57,19 @@ import request from '@/common/request'
},
rules:{
plantBaseInfoId:{required:true, message:"基地名称必填!", trigger:"change"},
plotNumber:{required:true, message:"地块编号必填!", trigger:"blur"},
// plotNumber:{required:false, message:"", trigger:"blur"},
plotName:{required:true, message:"地块名称必填!", trigger:"blur"},
drawArea:{required:true, type:'number', message:"地块面积必填!", trigger:"blur"},
// drawArea:{required:true, type:'number', message:"", trigger:"blur"},
realityArea:{required:true, type:'number', message:"实际面积必填!", trigger:"blur"},
image:{required:true, type:"array", min:1, validator:(rule,val,call)=>{
if(this.fields.image.value.length<=0)call(new Error('地块图片必选!'));
else call()
}, trigger:"change"},
date:{required:true,validator:(rule,val,call)=>{
if(!this.fields.date.value[0])call(new Error('请选择开始时间!'));
else if(!this.fields.date.value[1])call(new Error('请选择结束时间!'));
else call()
}, trigger:"change"}
// date:{required:true,validator:(rule,val,call)=>{
// if(!this.fields.date.value[0])call(new Error(''));
// else if(!this.fields.date.value[1])call(new Error(''));
// else call()
// }, trigger:"change"}
},
eventChannel:null,
}

6
pages/massif/plant_plan.vue

@ -18,7 +18,7 @@
:key="k"
v-bind="v"
:field="k"
:required="!!rules[k]"
:required="!!rules[k]&&rules[k].required"
:value="/^select$/.test(v.type)?fields[k].value:formData[k]"
@select="fields[k].value=$event.map(v=>v.value);formData[k]=fields[k].value.at(-1)"
@input="formData[k]=$event"
@ -76,8 +76,8 @@ export default {
plantStandard: {required:true, message:"种植标准必填!", trigger:"blur"},
plantBatch: {required:true, message:"种植批次号必填!", trigger:"blur"},
principal: {required:true, message:"负责人必填!", trigger:"blur"},
principalId: {required:true, validator(rule,val,call){
if(!val)call(new Error("负责人身份证必填!"));
principalId: {required:false, validator(rule,val,call){
if(!val)call();
else if(!/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(val))call(new Error("请输入正确身份证格式!"));
else call();
}, trigger:"blur"},

2
pages/warehouse/info.vue

@ -51,7 +51,7 @@ import request from '@/common/request.js'
},
rules:{
warehouseName:{required:true, message:"仓库名称必填!", trigger:["blur","change"]},
warehouseNo: {required:true, message:"种植编号必填!", trigger:"blur"},
// warehouseNo: {required:true, message:"", trigger:"blur"},
warehouseAddress:{required:true, message:"仓库位置必填!", trigger:["blur","change"]},
warehouseVolume:{required:true, message:"仓库容量必填!", type:"number", trigger:["blur","change"]},
goodsType:{required:true, message:"存储物品类型必填!", trigger:["blur","change"]},

Loading…
Cancel
Save