OTA车辆动力类型联动修改

This commit is contained in:
zyx.net
2023-04-07 10:40:19 +08:00
parent c1be8a6ea8
commit eaeea1771c
2 changed files with 108 additions and 57 deletions
@@ -124,23 +124,33 @@
<a-form-model-item class="itemModel " >
<div style="display:flex;flex-wrap: nowrap;width: 100%;">
<div style="width: 90%;margin-right: 20px;">
<a-select class="box-input" v-model="form.dllx1" disabled :placeholder="$t('PleaseSelect')"
@change="changeSelect($event, target)"
style="width: 100%;"
>
<a-select-option v-for="(item, key) in projectNameList1" :key="key" :value="item">
{{ item }}
</a-select-option>
</a-select>
<!-- <a-select class="box-input" v-model="form.dllx1" disabled :placeholder="$t('PleaseSelect')"-->
<!-- @change="changeSelect($event, target)"-->
<!-- style="width: 100%;"-->
<!-- >-->
<!-- <a-select-option v-for="(item, key) in projectNameList1" :key="key" :value="item">-->
<!-- {{ item }}-->
<!-- </a-select-option>-->
<!-- </a-select>-->
<j-dict-select-tag class="box-input"
:disabled="disabled"
:dictCode="'vehicle_dynamic_type'"
:placeholder="$t('PleaseSelect')"
:type="'select'"
@input="changeSelect(form.dllx1)"
:triggerChange="false"
v-model="form.dllx1"/>
</div>
<div style="width: 100%;">
<a-select v-model="form.dllx2" class="box-input" disabled :placeholder="$t('PleaseSelect')"
@change="update2"
style="width: 100%;"
>
<a-select-option v-for="(item, key) in projectNameList2" :key="key" :value="item">
{{ item }}
</a-select-option>
<a-select-option v-for="(item, key) in projectNameList2"
:key="item.value"
:value="item.value">
{{ item.text }}
</a-select-option>
</a-select>
</div>
</div>
@@ -342,15 +352,20 @@ export default {
},
changeSelect(target) {
this.form.dllx2 = undefined
if (target == '传统动力汽车') {
this.projectNameList2 = ['汽油', '柴油']
} else if (target == '节能汽车') {
this.projectNameList2 = ['混合动力', '天然气', '甲醇', '其他']
} else if (target == '新能源汽车') {
this.projectNameList2 = ['纯电动', '插电式混合动力', '燃料电池']
} else {
this.projectNameList2 = ['其他']
}
let list = []
getAction('sys/dict/getDictItems/vehicle_dynamic_type1', { }).then((res) => {
if (res.success) {
res.result.forEach((item,index) => {
let w = item.value
let a = w.indexOf("-")
let l = w.substring(0,a)
if(target == l){
list.push(item)
}
})
this.projectNameList2 = list
}
})
},
changeId(value, option) {
@@ -158,25 +158,38 @@
<a-form-model-item class="itemModel">
<div style="display:flex;flex-wrap: nowrap;width: 100%;">
<div style="width: 90%;margin-right: 20px;">
<a-select class="box-input" style="width: 100%;" v-model="form.dllx1" allowClear :disabled="disabled" :placeholder="$t('PleaseSelect')" @change="changeSelect($event,target)">
<a-select-option v-for="(item, key) in projectNameList1"
:key="key"
:value="item">
{{ item }}
</a-select-option>
</a-select>
<!-- <a-select class="box-input" style="width: 100%;" v-model="form.dllx1" allowClear :disabled="disabled" :placeholder="$t('PleaseSelect')" @change="changeSelect($event,target)">-->
<!-- <a-select-option v-for="(item, key) in projectNameList1"-->
<!-- :key="key"-->
<!-- :value="item">-->
<!-- {{ item }}-->
<!-- </a-select-option>-->
<!-- </a-select>-->
<j-dict-select-tag class="box-input"
:disabled="disabled"
:dictCode="'vehicle_dynamic_type'"
:placeholder="$t('PleaseSelect')"
:type="'select'"
@input="changeSelect(form.dllx1)"
:triggerChange="false"
v-model="form.dllx1"/>
</div>
<div style="width: 100%;">
<a-select v-model="form.dllx2" class="box-input" allowClear :disabled="disabled" :placeholder="$t('PleaseSelect')" @change="update">
<a-select-option v-for="(item, key) in projectNameList2"
:key="key"
:value="item">
{{ item }}
<!-- <span style="display: inline-block;width: 100%" :title=" item.projectName ">
{{ item.projectName}}
</span> -->
:key="item.value"
:value="item.value">
{{ item.text }}
</a-select-option>
</a-select>
<!-- <j-dict-select-tag class="box-input"-->
<!-- :disabled="disabled"-->
<!-- :dictCode="dictCodedllx"-->
<!-- :placeholder="$t('PleaseSelect')"-->
<!-- :type="'select'"-->
<!-- :triggerChange="false"-->
<!-- v-model="form.dllx2"/>-->
</div>
</div>
</a-form-model-item>
@@ -242,6 +255,7 @@ import { message } from 'ant-design-vue'
projectNameList:[],
formRules:[],
flag:'',
dictCodedllx:'',
url: {
exportData: '/ota/otaBaCxJbxx/exportData',
importZipUrl: '/ota/otaBaCxJbxx/importData?otaId=' + localStorage.getItem('otaId'),//导入
@@ -405,32 +419,54 @@ import { message } from 'ant-design-vue'
},
changeSelect(target){
this.form.dllx2=undefined
if(target =='传统动力汽车'){
this. projectNameList2=['汽油','柴油']
}else if (target =='节能汽车'){
this. projectNameList2=['混合动力','天然气','甲醇','其他']
}else if (target =='新能源汽车'){
this. projectNameList2=['纯电动','插电式混合动力','燃料电池']
}else{
this. projectNameList2=['其他']
}
let list = []
getAction('sys/dict/getDictItems/vehicle_dynamic_type1', { }).then((res) => {
if (res.success) {
res.result.forEach((item,index) => {
let w = item.value
let a = w.indexOf("-")
let l = w.substring(0,a)
if(target == l){
list.push(item)
}
})
this.projectNameList2 = list
}
})
},
getDllx2(){
if(this.form.dllx1==undefined){
this.projectNameList=[]
}
if(this.form.dllx1=='传统动力汽车'){
this. projectNameList2=['汽油','柴油']
}
if(this.form.dllx1=='节能汽车'){
this. projectNameList2=['混合动力','天然气','甲醇','其他']
}
if(this.form.dllx1=='新能源汽车'){
this. projectNameList2=['纯电动','插电式混合动力','燃料电池']
}
if(this.form.dllx1=='其他'){
this. projectNameList2=['其他']
}
let list = []
getAction('sys/dict/getDictItems/vehicle_dynamic_type1', { }).then((res) => {
if (res.success) {
res.result.forEach((item,index) => {
let w = item.value
let a = w.indexOf("-")
let l = w.substring(0,a)
if(this.form.dllx1==undefined){
this.projectNameList=[]
}
if(this.form.dllx1 == l){
list.push(item)
}
})
this.projectNameList2 = list
}
})
// if(this.form.dllx1==undefined){
// this.projectNameList=[]
// }
// if(this.form.dllx1=='传统动力汽车'){
// this. projectNameList2=['汽油','柴油']
// }
// if(this.form.dllx1=='节能汽车'){
// this. projectNameList2=['混合动力','天然气','甲醇','其他']
// }
// if(this.form.dllx1=='新能源汽车'){
// this. projectNameList2=['纯电动','插电式混合动力','燃料电池']
// }
// if(this.form.dllx1=='其他'){
// this. projectNameList2=['其他']
// }
},