story#6071,编辑车辆页面选择服务逻辑修改
This commit is contained in:
@ -76,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<select id="mySelect" class="mySelect" v-model="selectedOption" multiple
|
<select id="mySelect" class="mySelect" v-model="selectedOption" multiple
|
||||||
:multiple-limit="isMultiple ? 2 : 1">
|
:multiple-limit="isMultiple ? 2 : 1">
|
||||||
<option v-for="(item,index) in typeList" :key="index" :value="index" :disabled="!item.disabled ? false : true">{{item.name}}</option>
|
<option v-for="(item,index) in computedTypeList" :key="index" :value="index" :disabled="!item.disabled ? false : true">{{item.name}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="lineBot"></div>
|
<div class="lineBot"></div>
|
||||||
@ -153,7 +153,7 @@ export default {
|
|||||||
checked: true,
|
checked: true,
|
||||||
carNum:"",//车牌号
|
carNum:"",//车牌号
|
||||||
typeList:[],//车辆类型列表
|
typeList:[],//车辆类型列表
|
||||||
selectedOption:'1',//车辆类型
|
selectedOption:[],//车辆类型
|
||||||
id:'',//车辆Id
|
id:'',//车辆Id
|
||||||
serviceIds:[],//车辆服务种类,
|
serviceIds:[],//车辆服务种类,
|
||||||
supplierServiceList:[],
|
supplierServiceList:[],
|
||||||
@ -172,29 +172,32 @@ export default {
|
|||||||
isMultiple: false, // 是否支持多选
|
isMultiple: false, // 是否支持多选
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
computed: {
|
||||||
typeList(newVal){
|
computedTypeList() {
|
||||||
console.log("1111",newVal)
|
return this.typeList.map((item, index) => {
|
||||||
if(newVal == 4){
|
if (this.isMultiple) {
|
||||||
this.isMultiple = true
|
if ([2, 5, 6, 7, 8, 9].includes(index)) {
|
||||||
this.typeList[2].disabled=true
|
return { ...item, disabled: true };
|
||||||
this.typeList[5].disabled=true
|
}
|
||||||
this.typeList[6].disabled=true
|
} else {
|
||||||
this.typeList[7].disabled=true
|
return { ...item, disabled: false };
|
||||||
this.typeList[8].disabled=true
|
}
|
||||||
this.typeList[9].disabled=true
|
return item;
|
||||||
}else{
|
});
|
||||||
this.isMultiple = false
|
},
|
||||||
this.typeList[2].disabled=false
|
},
|
||||||
this.typeList[5].disabled=false
|
watch: {
|
||||||
this.typeList[6].disabled=false
|
typeList: {
|
||||||
this.typeList[7].disabled=false
|
handler(newVal) {
|
||||||
this.typeList[8].disabled=false
|
if (newVal.length === 4) { // 假设你想判断数组长度是否为 4
|
||||||
this.typeList[9].disabled=false
|
this.isMultiple = true;
|
||||||
}
|
} else {
|
||||||
|
this.isMultiple = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.id=this.$route.params?.id
|
this.id=this.$route.params?.id
|
||||||
const selectElement = document.getElementById('mySelect');
|
const selectElement = document.getElementById('mySelect');
|
||||||
|
Reference in New Issue
Block a user