Browse Source

完善停车区域

2545307760@qq.com 2 tháng trước cách đây
mục cha
commit
5fb00e9490

+ 1 - 1
server/api/v1/vehicle/shortlist.go

@@ -72,7 +72,7 @@ func (sa *ShortlistApi) UpdateShortlist(c *gin.Context) {
 }
 
 func (sa *ShortlistApi) DeleteShortlist(c *gin.Context) {
-	id, err := strconv.Atoi(c.Param("id"))
+	id, err := strconv.Atoi(c.Query("id"))
 	if err != nil {
 		response.FailWithMessage("参数错误", c)
 		return

+ 1 - 1
web/src/api/vehicle.js

@@ -3,7 +3,7 @@ import service from '@/utils/request'
 // 新增车主
 export const addVehicle = (data) => {
   return service({
-    url: '/owner/create',
+    url: '/vehicle/create',
     method: 'post',
     data
   })

+ 19 - 7
web/src/view/parking/carInfo.vue

@@ -174,6 +174,7 @@
         <el-form-item :label="$t.value.VehicleType">
           <el-select
             v-model="formData.vehicle_type_id"
+
             placeholder=""
             style="width:100%"
           >
@@ -394,9 +395,9 @@ const openDialog = (title, row) => {
   dialogVisible.value = true
   if (!row) {
     Object.assign(formData, {
-      ID: 0, plate_number: '', rfid_tag: '',
-      vehicle_type_id: null, vehicle_brand: '',
-      vehicle_color: '', owner_id: null
+      ID: 0, plate_number: '湘F:8964a', rfid_tag: '',
+      vehicle_type_id: null, vehicle_brand: '宾利',
+      vehicle_color: '白色', owner_id: null
     })
     return
   }
@@ -410,11 +411,22 @@ const submitForm = async() => {
   }
   try {
     if (formData.ID > 0) {
-      await editVehicle(formData)
-      ElMessage.success(t.value.editSuccess)
+      await editVehicle(formData).then(res => {
+        if (res.code === 0) {
+          ElMessage.success(t.value.editSuccess)
+        } else {
+          console.log(res.data)
+        }
+      })
     } else {
-      await addVehicle(formData)
-      ElMessage.success(t.value.addSuccess)
+      console.log('新增', formData)
+      await addVehicle(formData).then(res => {
+        if (res.code === 0) {
+          ElMessage.success(t.value.addSuccess)
+        } else {
+          console.log(res.data)
+        }
+      })
     }
     dialogVisible.value = false
     getVehicleList()