养殖类型由输入修改为选择

This commit is contained in:
weipengfei 2023-10-19 14:40:42 +08:00
parent 5b18e4c495
commit 04d00264ae

View File

@ -31,9 +31,16 @@
<u--textarea :disabled="readonly" v-model="formData.notes" autoHeight placeholder="请输入备注" border="surround"
count></u--textarea>
</u-form-item>
<u-form-item labelWidth="auto" label="养殖类型" required prop="breeding_type" borderBottom>
<!-- <u-form-item labelWidth="auto" label="养殖类型" required prop="breeding_type" borderBottom>
<u--input :readonly="readonly" v-model="formData.breeding_type" placeholder="请输入养殖类型"></u--input>
</u-form-item>
</u-form-item> -->
<picker :range="breedingTypeList" range-key="name" :disabled="readonly" mode="selector" @change="changeBreeding">
<u-form-item labelWidth="auto" label="养殖类型" required prop="planning" borderBottom>
<u--input :value="breedingName" style="pointer-events: none;" placeholder="请选择养殖类型" disabled
disabledColor="#fff"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
</picker>
<picker mode="date" @change="changeDate" :disabled="readonly" :data-value="'breeding_time'">
<u-form-item labelWidth="auto" label="养殖开始时间" required prop="breeding_time" borderBottom>
<u--input :value="formData.breeding_time" style="pointer-events: none;" placeholder="请选择养殖开始时间" disabled disabledColor="#fff"></u--input>
@ -121,13 +128,8 @@
border="surround" count></u--textarea>
</u-form-item>
</u--form>
</view>
</view>
</template>
<script>
@ -149,6 +151,11 @@
data() {
return {
landPlanList: ['自己养', '出租', '代养', '租更多地扩大养殖'],
breedingTypeList: [
{ id: 1, name: "水产"},
{ id: 2, name: "禽类" },
{ id: 3, name: "大型动物" },
],
formData: {
// "breeding_training": 1, //
// "breeding_company": 0, //
@ -223,6 +230,11 @@
}
}
},
computed:{
breedingName(){
return this.breedingTypeList.find((item)=>item.id==this.formData.breeding_type)?.name;
}
},
methods: {
//
initRules() {
@ -245,10 +257,10 @@
async validate() {
return await this.$refs.breedingForm.validate();
},
//
changeLanPlan(e) {
let index = e.currentTarget.dataset.index;
this.formData.planning = e.detail.value;
//
changeBreeding(e) {
// let index = e.currentTarget.dataset.index;
this.formData.breeding_type = this.breedingTypeList[e.detail.value].id;
},
//
changeDate(e) {