Browse Source

修改获取目的地

zhangafei 2 weeks ago
parent
commit
d0f6df9301
1 changed files with 7 additions and 5 deletions
  1. 7 5
      src/views/home/HomePage.vue

+ 7 - 5
src/views/home/HomePage.vue

@@ -263,10 +263,11 @@ const selectErrorNum = ref(undefined)
 
 // 获取目的地信息
 const getDestinationOptions = computed(() => {
-  if (!ccmNo || !destinationOptions[String(ccmNo)]) {
+  if (!ccmNo || !destinationOptions[String(ccmNo)] || !vehicleInfo.value.ccmNo) {
     return []
   }
-  return destinationOptions[String(ccmNo)].map((oitem: MConfigProps) => oitem)
+  const ccmNostr = vehicleInfo.value.ccmNo || ccmNo
+  return destinationOptions[String(ccmNostr)].map((oitem: MConfigProps) => oitem)
 })
 
 const carsOptions = ref<{ label: string; value: string }[]>([])
@@ -440,7 +441,7 @@ const handleClick = (type: string) => {
       return
     }
 
-    const curDestination = destinationOptions[Number(ccmNo)].find((item) => {
+    const curDestination = (getDestinationOptions.value || []).find((item) => {
       return item.value === vehicleInfo.value.typeConfigId
     })
 
@@ -536,8 +537,9 @@ const ccmNoChange = (e: string) => {
     class: 'confirm-destination-modal',
     okText: '确认',
     cancelText: '取消',
-    onOk: () => {
-      editInfo({ ccmNo: e, licensePlate: '' }, 'confirmCar')
+    onOk: async () => {
+      await editInfo({ ccmNo: e, licensePlate: '' }, 'confirmCar')
+      getVehicleInfo()
     },
     onCancel: () => {
       selectCcmNo.value = ''