You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.7 KiB

2 years ago
<style lang="scss" scoped>
2 years ago
.container{
2 years ago
background:#F6F6F6;
2 years ago
padding:14px 0;
min-height:100%;
&>.u-button{
margin:38px auto 0px;
width:80%;
}
2 years ago
}
</style>
<template>
2 years ago
<view class="container">
2 years ago
<u-form class="card inline" :model="formData" ref="form" :rules="rules" labelWidth="auto">
<d-form
v-for="(v,k) in fields"
:key="k"
v-bind="v"
:required="!!rules[k]"
:field="k"
2 years ago
:value="({text:formData[k],upImg:formData[k],textarea:formData[k]})[v.type||'text']"
@input="formData[k]=$event"
2 years ago
@selectDate="selectDate"/>
</u-form>
2 years ago
<u-button shape="circle" color="#10C176">保存</u-button>
2 years ago
</view>
</template>
<script>
import dForm from '@/components/form.vue'
export default{
components:{dForm},
data(){
return{
fields:{
2 years ago
plantBaseName:{label:"基地名称"},
plotNumber:{label:"地块编号"},
plotName:{label:"地块名称"},
2 years ago
area:{label:"地块面积(亩)"},
2 years ago
drawArea:{label:"实际面积"},
image:{label:"地块图片",type:"upImg",num:3},
2 years ago
date:{label:"使用日期",type:"dateRange",value:[]},
jw:{label:"经/纬度"},
2 years ago
address:{label:"详细地址",type:"textarea"},
2 years ago
},
formData:{
2 years ago
plantBaseName:"",
plotNumber:"",
plotName:"",
drawArea:0,
image:[],
beginTime:"",
endTime:"",
longitude:"",
latitude:"",
address:"",
2 years ago
},
rules:{
date:{required:true, message:"日期必填!", trigger:"blue"}
},
}
},
methods:{
selectDate(e){
console.log(e,'-----e---------')
switch(e.type){
case "start":this.fields.date.value[0]=e.value;break;
case 'end':this.fields.date.value[1]=e.value;break;
}
}
},
}
</script>