Procházet zdrojové kódy

修改车辆到站

zhangafei před 1 měsícem
rodič
revize
330de6b801
3 změnil soubory, kde provedl 10 přidání a 7 odebrání
  1. 7 6
      src/views/home/CarArrive.vue
  2. 2 0
      src/views/home/types.ts
  3. 1 1
      vite.config.ts

+ 7 - 6
src/views/home/CarArrive.vue

@@ -182,6 +182,7 @@ const vehicleInfo = ref<VehicleInfo>({
   steelReachTime: '',
   positionNum: '',
 })
+const arriveNo = ref('')
 
 // 获取目的地信息
 const getDestinationOptions = computed(() => {
@@ -228,13 +229,12 @@ const handleOpen = () => {
   visible.value = true
 }
 
-const getVehicleInfo = (licensePlate: string, positionNum: string | undefined) => {
+const getVehicleInfo = (licensePlate: string) => {
   loading.value = true
   axios
     .get<VehicleResponse>('/jeecgbootbus/storageBill/queryByLicensePlate', {
       params: {
         licensePlate,
-        positionNum,
       },
     })
     .then((res) => {
@@ -354,13 +354,13 @@ const handleClick = (type: string) => {
       okText: '确认',
       cancelText: '取消',
       onOk: () => {
-        editInfo(vehicleInfo.value, type)
+        editInfo({ ...vehicleInfo.value, arriveNum: Number(arriveNo.value) }, type)
       },
     })
   }
 }
 
-const editInfo = (params: { licensePlate?: string }, type: string) => {
+const editInfo = (params: { licensePlate?: string; arriveNum?: string | number }, type: string) => {
   loading.value = true
   axios
     .post(
@@ -399,14 +399,15 @@ const editInfo = (params: { licensePlate?: string }, type: string) => {
     })
     .finally(() => {
       loading.value = false
-      getVehicleInfo(vehicleInfo.value.licensePlate, vehicleInfo.value.positionNum)
+      getVehicleInfo(vehicleInfo.value.licensePlate)
     })
 }
 
 const onMessage = (msg: Record<string, string>) => {
   const { car, position } = msg
   if (!car) return
-  getVehicleInfo(car, position)
+  arriveNo.value = position
+  getVehicleInfo(car)
 }
 
 onMounted(() => {

+ 2 - 0
src/views/home/types.ts

@@ -19,6 +19,7 @@ export interface VehicleInfo {
   hasDestination: boolean
   steelReachTime?: string
   positionNum?: string
+  arriveNum?: string | number
 }
 
 export interface VehicleResult {
@@ -38,6 +39,7 @@ export interface VehicleResult {
   hasDestination: boolean
   steelReachTime?: string
   positionNum?: string
+  arriveNum?: string | number
 }
 
 // 定义接口返回数据的类型

+ 1 - 1
vite.config.ts

@@ -33,7 +33,7 @@ export default defineConfig({
     open: true,
     proxy: {
       '/jeecgbootbus': {
-        target: 'http://192.168.1.6:9999',
+        target: 'http://192.168.1.8:9999',
         changeOrigin: true,
         ws: true,
         rewrite: (path) => path.replace(/^\/jeecgbootbus/, ''),