story#6071,编辑车辆页面选择服务逻辑修改

This commit is contained in:
2025-01-17 10:32:01 +08:00
parent e4a893815d
commit 5ed64b07e3

View File

@ -74,9 +74,9 @@
<img class="startImg" src="@/assets/start.png" /> <img class="startImg" src="@/assets/start.png" />
<span>车辆类型</span> <span>车辆类型</span>
</div> </div>
<select id="mySelect" class="mySelect" v-model="selectedOption" multiple <select id="mySelect" class="mySelect" v-model="selectedOption" multiple @change="setChange"
:multiple-limit="isMultiple ? 2 : 1"> >
<option v-for="(item,index) in computedTypeList" :key="index" :value="index" :disabled="!item.disabled ? false : true">{{item.name}}</option> <option v-for="item in computedTypeList" :key="item.name" :value="item.name" :label="item.name" :disabled="item.disabled">{{item.name}}</option>
</select> </select>
</div> </div>
<div class="lineBot"></div> <div class="lineBot"></div>
@ -175,6 +175,7 @@ export default {
computed: { computed: {
computedTypeList() { computedTypeList() {
return this.typeList.map((item, index) => { return this.typeList.map((item, index) => {
console.log("item, index",item, index)
if (this.isMultiple) { if (this.isMultiple) {
if ([2, 5, 6, 7, 8, 9].includes(index)) { if ([2, 5, 6, 7, 8, 9].includes(index)) {
return { ...item, disabled: true }; return { ...item, disabled: true };
@ -186,10 +187,11 @@ export default {
}); });
}, },
}, },
watch: { /* watch: {
typeList: { typeList: {
handler(newVal) { handler(newVal) {
if (newVal.length === 4) { // 假设你想判断数组长度是否为 4 console.log("newVal",newVal)
if (newVal.length === 2) { // 假设你想判断数组长度是否为 4
this.isMultiple = true; this.isMultiple = true;
} else { } else {
this.isMultiple = false; this.isMultiple = false;
@ -197,12 +199,13 @@ export default {
}, },
deep: true, 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');
selectElement.addEventListener('change', function() { selectElement.addEventListener('change', function() {
this.selectedOption=selectElement.value; this.selectedOption=selectElement.value;
console.log(" this.selectedOption", this.selectedOption)
}); });
await this.getTypeList(); await this.getTypeList();
if( this.id){ if( this.id){
@ -211,6 +214,9 @@ export default {
await this.getSupplierServiceTree(); await this.getSupplierServiceTree();
}, },
methods:{ methods:{
setChange(){
console.log("===========",this.selectedOption)
},
async vehicleLicenseFrontHandler(file) { // 上传 行驶证首页 async vehicleLicenseFrontHandler(file) { // 上传 行驶证首页
const formData = new FormData(); const formData = new FormData();
formData.append("file" , file.file); formData.append("file" , file.file);