Parcourir la source

区域内容修改 ShouldBindQuery换为ShouldBindJSON,等一些问题修改

xu il y a 3 mois
Parent
commit
bd5249fcb7
36 fichiers modifiés avec 865 ajouts et 310 suppressions
  1. 1 1
      server/api/v1/owner/owner.go
  2. 9 1
      server/api/v1/parking/booth.go
  3. 10 1
      server/api/v1/parking/channel.go
  4. 10 1
      server/api/v1/parking/parking_lot.go
  5. 1 1
      server/api/v1/system/sys_dictionary.go
  6. 2 2
      server/api/v1/system/sys_dictionary_detail.go
  7. 2 2
      server/api/v1/system/sys_operation_record.go
  8. 13 4
      server/api/v1/uhf/reader.go
  9. 1 1
      server/api/v1/vehicle/fee_config.go
  10. 5 3
      server/api/v1/vehicle/shortlist.go
  11. 1 1
      server/api/v1/vehicle/vehicle.go
  12. 7 5
      server/dao/booth.go
  13. 5 0
      server/dao/channel.go
  14. 1 1
      server/dao/parking_lot.go
  15. 26 12
      server/dao/shortlist.go
  16. 13 5
      server/dao/uhf_reader.go
  17. 11 11
      server/dao/vehicle.go
  18. 2 1
      server/dao/vehicle_record.go
  19. 1 0
      server/initialize/gorm.go
  20. 2 2
      server/model/parking/request/channel.go
  21. 1 0
      server/model/parking/request/parking_lot.go
  22. 23 21
      server/model/uhf/request/reader.go
  23. 9 0
      server/model/vehicle/request/shortlist.go
  24. 2 0
      server/model/vehicle/request/vehicle.go
  25. 1 0
      server/model/vehicle/response/shortlist.go
  26. 5 1
      server/router/parking/parking.go
  27. 2 2
      server/router/vehicle/shortlist.go
  28. 25 6
      server/service/parking/booth.go
  29. 15 0
      server/service/parking/channel.go
  30. 16 1
      server/service/parking/parking_lot.go
  31. 163 13
      server/service/uhf/reader.go
  32. 20 0
      server/service/uhf/tcp_reader.go
  33. 41 30
      server/service/uhf/uhf_service.go
  34. 4 4
      server/service/vehicle/shortlist.go
  35. 10 8
      server/service/vehicle/vehicle.go
  36. 405 169
      web/src/view/parking/parkingInfo.vue

+ 1 - 1
server/api/v1/owner/owner.go

@@ -82,7 +82,7 @@ func GetOwnerByPhone(c *gin.Context) {
 // ListOwners 获取车主列表
 // ListOwners 获取车主列表
 func ListOwners(c *gin.Context) {
 func ListOwners(c *gin.Context) {
 	var req request.OwnerQuery
 	var req request.OwnerQuery
-	if err := c.ShouldBindQuery(&req); err != nil {
+	if err := c.ShouldBindJSON(&req); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}

+ 9 - 1
server/api/v1/parking/booth.go

@@ -75,9 +75,17 @@ func GetBoothByCode(c *gin.Context) {
 	response.OkWithData(booth, c)
 	response.OkWithData(booth, c)
 }
 }
 
 
+func QueryAllBooths(c *gin.Context) {
+	booths, err := BoothService.QueryAllBooths()
+	if err != nil {
+		response.FailWithMessage("THE QUERY FAILED", c)
+	}
+	response.OkWithData(booths, c)
+}
+
 func ListBooths(c *gin.Context) {
 func ListBooths(c *gin.Context) {
 	var req request.BoothQuery
 	var req request.BoothQuery
-	if err := c.ShouldBindQuery(&req); err != nil {
+	if err := c.ShouldBindJSON(&req); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}

+ 10 - 1
server/api/v1/parking/channel.go

@@ -75,9 +75,18 @@ func GetChannelByCode(c *gin.Context) {
 	response.OkWithData(channel, c)
 	response.OkWithData(channel, c)
 }
 }
 
 
+func QueryAllChannels(c *gin.Context) {
+	channels, err := ChannelService.QueryAllChannels()
+	if err != nil {
+		response.FailWithMessage(err.Error(), c)
+		return
+	}
+	response.OkWithData(channels, c)
+}
+
 func ListChannels(c *gin.Context) {
 func ListChannels(c *gin.Context) {
 	var req request.ChannelQuery
 	var req request.ChannelQuery
-	if err := c.ShouldBindQuery(&req); err != nil {
+	if err := c.ShouldBindJSON(&req); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}

+ 10 - 1
server/api/v1/parking/parking_lot.go

@@ -75,9 +75,18 @@ func GetParkingLotByCode(c *gin.Context) {
 	response.OkWithData(lot, c)
 	response.OkWithData(lot, c)
 }
 }
 
 
+func QueryAllParkingLots(c *gin.Context) {
+	lots, err := ParkingLotService.QueryAllParkingLots()
+	if err != nil {
+		response.FailWithMessage("THE QUERY FAILED", c)
+		return
+	}
+	response.OkWithData(lots, c)
+}
+
 func ListParkingLots(c *gin.Context) {
 func ListParkingLots(c *gin.Context) {
 	var req request.ParkingLotQuery
 	var req request.ParkingLotQuery
-	if err := c.ShouldBindQuery(&req); err != nil {
+	if err := c.ShouldBindJSON(&req); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}

+ 1 - 1
server/api/v1/system/sys_dictionary.go

@@ -96,7 +96,7 @@ func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) {
 // @Router    /sysDictionary/findSysDictionary [get]
 // @Router    /sysDictionary/findSysDictionary [get]
 func (s *DictionaryApi) FindSysDictionary(c *gin.Context) {
 func (s *DictionaryApi) FindSysDictionary(c *gin.Context) {
 	var dictionary dao.SysDictionary
 	var dictionary dao.SysDictionary
-	err := c.ShouldBindQuery(&dictionary)
+	err := c.ShouldBindJSON(&dictionary)
 	if err != nil {
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return

+ 2 - 2
server/api/v1/system/sys_dictionary_detail.go

@@ -98,7 +98,7 @@ func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) {
 // @Router    /sysDictionaryDetail/findSysDictionaryDetail [get]
 // @Router    /sysDictionaryDetail/findSysDictionaryDetail [get]
 func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) {
 func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) {
 	var detail dao.SysDictionaryDetail
 	var detail dao.SysDictionaryDetail
-	err := c.ShouldBindQuery(&detail)
+	err := c.ShouldBindJSON(&detail)
 	if err != nil {
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
@@ -128,7 +128,7 @@ func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) {
 // @Router    /sysDictionaryDetail/getSysDictionaryDetailList [get]
 // @Router    /sysDictionaryDetail/getSysDictionaryDetailList [get]
 func (s *DictionaryDetailApi) GetSysDictionaryDetailList(c *gin.Context) {
 func (s *DictionaryDetailApi) GetSysDictionaryDetailList(c *gin.Context) {
 	var pageInfo request.SysDictionaryDetailSearch
 	var pageInfo request.SysDictionaryDetailSearch
-	err := c.ShouldBindQuery(&pageInfo)
+	err := c.ShouldBindJSON(&pageInfo)
 	if err != nil {
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return

+ 2 - 2
server/api/v1/system/sys_operation_record.go

@@ -99,7 +99,7 @@ func (s *OperationRecordApi) DeleteSysOperationRecordByIds(c *gin.Context) {
 // @Router    /sysOperationRecord/findSysOperationRecord [get]
 // @Router    /sysOperationRecord/findSysOperationRecord [get]
 func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) {
 func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) {
 	var sysOperationRecord dao.SysOperationRecord
 	var sysOperationRecord dao.SysOperationRecord
-	err := c.ShouldBindQuery(&sysOperationRecord)
+	err := c.ShouldBindJSON(&sysOperationRecord)
 	if err != nil {
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
@@ -129,7 +129,7 @@ func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) {
 // @Router    /sysOperationRecord/getSysOperationRecordList [get]
 // @Router    /sysOperationRecord/getSysOperationRecordList [get]
 func (s *OperationRecordApi) GetSysOperationRecordList(c *gin.Context) {
 func (s *OperationRecordApi) GetSysOperationRecordList(c *gin.Context) {
 	var pageInfo systemReq.SysOperationRecordSearch
 	var pageInfo systemReq.SysOperationRecordSearch
-	err := c.ShouldBindQuery(&pageInfo)
+	err := c.ShouldBindJSON(&pageInfo)
 	if err != nil {
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return

+ 13 - 4
server/api/v1/uhf/reader.go

@@ -42,7 +42,7 @@ func UpdateReader(c *gin.Context) {
 	response.OkWithMessage("更新成功", c)
 	response.OkWithMessage("更新成功", c)
 }
 }
 
 
-func GetReaderByID(c *gin.Context) {
+func ConnectedDevice(c *gin.Context) {
 	id := c.Query("id")
 	id := c.Query("id")
 	uintID := uint(0)
 	uintID := uint(0)
 	_, err := fmt.Sscanf(id, "%d", &uintID)
 	_, err := fmt.Sscanf(id, "%d", &uintID)
@@ -51,13 +51,13 @@ func GetReaderByID(c *gin.Context) {
 		return
 		return
 	}
 	}
 
 
-	reader, err := uhf.UHFService.GetReaderByID(uintID)
+	err = uhf.UHFService.ConnectedDevice(uintID)
 	if err != nil {
 	if err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}
 
 
-	response.OkWithData(reader, c)
+	response.Ok(c)
 }
 }
 
 
 func GetReaderByCode(c *gin.Context) {
 func GetReaderByCode(c *gin.Context) {
@@ -76,9 +76,18 @@ func GetReaderByCode(c *gin.Context) {
 	response.OkWithData(reader, c)
 	response.OkWithData(reader, c)
 }
 }
 
 
+func QueryAllReaders(c *gin.Context) {
+	readers, err := uhf.UHFService.QueryAllReaders()
+	if err != nil {
+		response.FailWithMessage(err.Error(), c)
+		return
+	}
+	response.OkWithData(readers, c)
+}
+
 func ListReaders(c *gin.Context) {
 func ListReaders(c *gin.Context) {
 	var req request.UHFReaderQuery
 	var req request.UHFReaderQuery
-	if err := c.ShouldBindQuery(&req); err != nil {
+	if err := c.ShouldBindJSON(&req); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}

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

@@ -64,7 +64,7 @@ func GetFeeConfigByID(c *gin.Context) {
 // ListFeeConfigs 获取收费配置列表
 // ListFeeConfigs 获取收费配置列表
 func ListFeeConfigs(c *gin.Context) {
 func ListFeeConfigs(c *gin.Context) {
 	var req request.FeeConfigQuery
 	var req request.FeeConfigQuery
-	if err := c.ShouldBindQuery(&req); err != nil {
+	if err := c.ShouldBindJSON(&req); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}

+ 5 - 3
server/api/v1/vehicle/shortlist.go

@@ -1,10 +1,11 @@
 package vehicle
 package vehicle
 
 
 import (
 import (
+	"fmt"
 	"github.com/gin-gonic/gin"
 	"github.com/gin-gonic/gin"
 	"server/dao"
 	"server/dao"
-	"server/model/common/request"
 	"server/model/common/response"
 	"server/model/common/response"
+	"server/model/vehicle/request"
 	"strconv"
 	"strconv"
 )
 )
 
 
@@ -20,12 +21,13 @@ func (sa *ShortlistApi) QueryAllShortlists(c *gin.Context) {
 }
 }
 
 
 func (sa *ShortlistApi) QueryShortlistList(c *gin.Context) {
 func (sa *ShortlistApi) QueryShortlistList(c *gin.Context) {
-	var info request.PageInfo
+	var info request.ShortlistRequest
 	err := c.ShouldBindJSON(&info)
 	err := c.ShouldBindJSON(&info)
 	if err != nil {
 	if err != nil {
-		response.FailWithMessage("参数错误", c)
+		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}
+	fmt.Println(info)
 	list, total, err := shortlistService.QueryShortlistList(info)
 	list, total, err := shortlistService.QueryShortlistList(info)
 	if err != nil {
 	if err != nil {
 		response.FailWithMessage("查询失败", c)
 		response.FailWithMessage("查询失败", c)

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

@@ -80,7 +80,7 @@ func GetVehicleByPlateNumber(c *gin.Context) {
 // ListVehicles 获取车辆列表
 // ListVehicles 获取车辆列表
 func ListVehicles(c *gin.Context) {
 func ListVehicles(c *gin.Context) {
 	var req request.VehicleQuery
 	var req request.VehicleQuery
-	if err := c.ShouldBindQuery(&req); err != nil {
+	if err := c.ShouldBindJSON(&req); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		response.FailWithMessage(err.Error(), c)
 		return
 		return
 	}
 	}

+ 7 - 5
server/dao/booth.go

@@ -5,11 +5,13 @@ import "server/global"
 // Booth 岗亭模型
 // Booth 岗亭模型
 type Booth struct {
 type Booth struct {
 	global.GVA_MODEL
 	global.GVA_MODEL
-	BoothCode    string `gorm:"size:50;not null;uniqueIndex" json:"booth_code"` // 岗亭编码
-	BoothName    string `gorm:"size:100;not null" json:"booth_name"`            // 岗亭名称
-	IPAddress    string `gorm:"size:50" json:"ip_address"`                      // IP地址
-	Description  string `gorm:"size:200" json:"description"`                    // 备注
-	ParkingLotID uint   `json:"parking_lot_id"`                                 // 所属区域ID
+	BoothCode    string      `gorm:"size:50;not null;uniqueIndex" json:"booth_code"` // 岗亭编码
+	BoothName    string      `gorm:"size:100;not null" json:"booth_name"`            // 岗亭名称
+	IPAddress    string      `gorm:"size:50" json:"ip_address"`                      // IP地址
+	Description  string      `gorm:"size:200" json:"description"`                    // 备注
+	ParkingLotID uint        `gorm:"index;comment:所属区域ID" json:"parking_lot_id"`     // 所属区域ID
+	ParkingLot   *ParkingLot `gorm:"foreignkey:parking_lot_id" json:"parking_lot"`
+	Channels     []Channel   `gorm:"foreignKey:BoothID" json:"channels"`
 }
 }
 
 
 func (Booth) TableName() string {
 func (Booth) TableName() string {

+ 5 - 0
server/dao/channel.go

@@ -11,6 +11,11 @@ type Channel struct {
 	AllowTemporary bool   `gorm:"not null" json:"allow_temporary"`                  // 是否允许临时车进出
 	AllowTemporary bool   `gorm:"not null" json:"allow_temporary"`                  // 是否允许临时车进出
 	Description    string `gorm:"size:200" json:"description"`                      // 备注
 	Description    string `gorm:"size:200" json:"description"`                      // 备注
 	ParkingLotID   uint   `json:"parking_lot_id"`                                   // 所属区域ID
 	ParkingLotID   uint   `json:"parking_lot_id"`                                   // 所属区域ID
+
+	BoothID uint   `gorm:"index;comment:所属岗亭ID" json:"booth_id"`
+	Booth   *Booth `gorm:"foreignKey:BoothID;references:ID" json:"booth"`
+
+	UHFReaders []UHFReader `gorm:"foreignKey:ChannelID" json:"uhf_reader"`
 }
 }
 
 
 func (Channel) TableName() string {
 func (Channel) TableName() string {

+ 1 - 1
server/dao/parking_lot.go

@@ -2,7 +2,7 @@ package dao
 
 
 import "server/global"
 import "server/global"
 
 
-// ParkingLot 停车区域模型
+// ParkingLot 停车区域
 type ParkingLot struct {
 type ParkingLot struct {
 	global.GVA_MODEL
 	global.GVA_MODEL
 	LotCode     string      `gorm:"size:50;not null;uniqueIndex" json:"lot_code"` // 区域编码
 	LotCode     string      `gorm:"size:50;not null;uniqueIndex" json:"lot_code"` // 区域编码

+ 26 - 12
server/dao/shortlist.go

@@ -7,28 +7,42 @@ import (
 
 
 type Shortlist struct {
 type Shortlist struct {
 	global.GVA_MODEL
 	global.GVA_MODEL
-	ListType       string    `json:"list_type" gorm:"comment:名单类型"`
-	VehicleId      int       `json:"vehicle_id" gorm:"comment:车辆ID"`
-	Vehicle        Vehicle   `json:"vehicle" gorm:"foreignKey:VehicleId"`
-	ExpirationTime time.Time `json:"expiration_time" gorm:"comment:过期时间;default:null"`
+	ListType       string     `json:"list_type" gorm:"comment:名单类型"`
+	VehicleId      int        `json:"vehicle_id" gorm:"comment:车辆ID"`
+	Vehicle        *Vehicle   `json:"vehicle" gorm:"foreignKey:VehicleId"`
+	ExpirationTime *time.Time `json:"expiration_time" gorm:"comment:过期时间;default:null"`
 }
 }
 
 
 func (Shortlist) TableName() string {
 func (Shortlist) TableName() string {
 	return "shortlist"
 	return "shortlist"
 }
 }
 
 
-func QueryShortlistList(limit, offset int) (list []Shortlist, total int64, err error) {
-	db := global.GVA_DB.Model(&Shortlist{})
+func QueryShortlistList(limit, offset int, listType, plateNumber, rfidTag string) (list []Shortlist, total int64, err error) {
+	db := global.GVA_DB.Debug().Model(&Shortlist{}).Preload("Vehicle") // 预加载车辆信息
 
 
-	err = db.Count(&total).Error
+	// 1. 按名单类型筛选:black / white
+	if listType != "" {
+		db = db.Where("list_type = ?", listType)
+	}
 
 
-	if err != nil {
-		return list, total, err
+	// 2. 车牌号模糊查询
+	if plateNumber != "" {
+		db = db.Joins("Vehicle").Where("Vehicle.plate_number LIKE ?", "%"+plateNumber+"%")
+	}
+
+	// 3. RFID标签精确查询
+	if rfidTag != "" {
+		db = db.Joins("Vehicle").Where("Vehicle.rfid_tag = ?", rfidTag)
 	}
 	}
 
 
-	db = db.Limit(limit).Offset(offset)
+	// 查询总数
+	err = db.Count(&total).Error
+	if err != nil {
+		return nil, 0, err
+	}
 
 
-	err = db.Find(&list).Error
+	// 查询列表
+	err = db.Limit(limit).Offset(offset).Find(&list).Error
 	return list, total, err
 	return list, total, err
 }
 }
 
 
@@ -42,7 +56,7 @@ func CreateShortlist(shortlist Shortlist) error {
 	return global.GVA_DB.Create(&shortlist).Error
 	return global.GVA_DB.Create(&shortlist).Error
 }
 }
 
 
-func UpdateShortlist(shortlist *Shortlist) error {
+func UpdateShortlist(shortlist Shortlist) error {
 	return global.GVA_DB.Where("id = ?", shortlist.ID).Updates(shortlist).Error
 	return global.GVA_DB.Where("id = ?", shortlist.ID).Updates(shortlist).Error
 }
 }
 
 

+ 13 - 5
server/dao/uhf_reader.go

@@ -1,12 +1,16 @@
 package dao
 package dao
 
 
-import "server/global"
+import (
+	"server/global"
+	"time"
+)
 
 
 type UHFReader struct {
 type UHFReader struct {
 	global.GVA_MODEL
 	global.GVA_MODEL
 
 
 	DeviceCode string `gorm:"size:50;not null;uniqueIndex" json:"device_code"`
 	DeviceCode string `gorm:"size:50;not null;uniqueIndex" json:"device_code"`
 	DeviceName string `gorm:"size:100;not null" json:"device_name"`
 	DeviceName string `gorm:"size:100;not null" json:"device_name"`
+	DeviceType string `gorm:"size:100;not null" json:"device_type"`
 
 
 	// ========== 连接方式配置 ==========
 	// ========== 连接方式配置 ==========
 	ConnectType string `gorm:"size:20;not null;default:'tcp'" json:"connect_type"` // tcp / serial
 	ConnectType string `gorm:"size:20;not null;default:'tcp'" json:"connect_type"` // tcp / serial
@@ -19,10 +23,14 @@ type UHFReader struct {
 	COMPort  string `gorm:"size:50" json:"com_port"`       // COM3 /dev/ttyUSB0
 	COMPort  string `gorm:"size:50" json:"com_port"`       // COM3 /dev/ttyUSB0
 	BaudRate int    `gorm:"default:9600" json:"baud_rate"` // 波特率
 	BaudRate int    `gorm:"default:9600" json:"baud_rate"` // 波特率
 
 
-	Status       string `gorm:"size:20;default:'offline'" json:"status"`
-	IsActive     bool   `gorm:"default:true" json:"is_active"`
-	Description  string `gorm:"size:200" json:"description"`
-	ParkingLotID uint   `json:"parking_lot_id"`
+	Status         string    `gorm:"size:20;default:'offline'" json:"status"`
+	IsActive       bool      `gorm:"default:true" json:"is_active"`
+	Description    string    `gorm:"size:200" json:"description"`
+	ParkingLotID   uint      `json:"parking_lot_id"`
+	LastOnlineTime time.Time `json:"last_online_time" gorm:"comment:最后上线时间"`
+
+	ChannelID uint     `gorm:"comment:绑定通道ID" json:"channel_id"`
+	Channel   *Channel `gorm:"foreignKey:ChannelID;references:ID" json:"channel"`
 }
 }
 
 
 func (UHFReader) TableName() string {
 func (UHFReader) TableName() string {

+ 11 - 11
server/dao/vehicle.go

@@ -7,17 +7,17 @@ import (
 
 
 type Vehicle struct {
 type Vehicle struct {
 	global.GVA_MODEL
 	global.GVA_MODEL
-	PlateNumber   string    `gorm:"size:20;not null;uniqueIndex" json:"plate_number"` // 车牌号
-	RFIDTag       string    `gorm:"size:20;" json:"rfid_tag"`                         // 电子标签
-	VehicleType   string    `gorm:"size:20;not null" json:"vehicle_type"`             // 车辆类型
-	VehicleBrand  string    `gorm:"size:50" json:"vehicle_brand"`                     // 车辆品牌
-	VehicleColor  string    `gorm:"size:20" json:"vehicle_color"`                     // 车辆颜色
-	OwnerId       *uint     `json:"owner_id"`                                         // 车主id,可为空(临时车辆)
-	Owner         *Owner    `gorm:"foreignKey:OwnerId" json:"owner"`
-	LastEntryTime time.Time `json:"last_entry_time" gorm:"default:null"` // 最近入场时间
-	LastExitTime  time.Time `json:"last_exit_time"  gorm:"default:null"` // 最近出场时间
-	TotalStayTime int64     `json:"total_stay_time" gorm:"default:null"` // 总停留时间
-	TotalFee      float64   `json:"total_fee"`                           // 总费用
+	PlateNumber   string     `gorm:"size:20;not null;uniqueIndex" json:"plate_number"` // 车牌号
+	RFIDTag       string     `gorm:"size:20;" json:"rfid_tag"`                         // 电子标签
+	VehicleType   string     `gorm:"size:20;not null" json:"vehicle_type"`             // 车辆类型
+	VehicleBrand  string     `gorm:"size:50" json:"vehicle_brand"`                     // 车辆品牌
+	VehicleColor  string     `gorm:"size:20" json:"vehicle_color"`                     // 车辆颜色
+	OwnerId       *uint      `json:"owner_id"`                                         // 车主id,可为空(临时车辆)
+	Owner         *Owner     `gorm:"foreignKey:OwnerId" json:"owner"`
+	LastEntryTime *time.Time `json:"last_entry_time" gorm:"default:null"` // 最近入场时间
+	LastExitTime  *time.Time `json:"last_exit_time"  gorm:"default:null"` // 最近出场时间
+	TotalStayTime int64      `json:"total_stay_time" gorm:"default:null"` // 总停留时间
+	TotalFee      float64    `json:"total_fee"`                           // 总费用
 }
 }
 
 
 func (Vehicle) TableName() string {
 func (Vehicle) TableName() string {

+ 2 - 1
server/dao/vehicle_record.go

@@ -7,7 +7,8 @@ import (
 
 
 type VehicleRecord struct {
 type VehicleRecord struct {
 	global.GVA_MODEL
 	global.GVA_MODEL
-	PlateNumber    string    `gorm:"size:20;not null;index" json:"plate_number"`     // 车牌号
+	PlateNumber    string    `gorm:"size:20;" json:"plate_number"`                   // 车牌号
+	RFIDTag        string    `gorm:"size:20;column:rfid_tag" json:"rfid_tag"`        // 标签
 	EntryTime      time.Time `json:"entry_time" gorm:"default:null"`                 // 入场时间
 	EntryTime      time.Time `json:"entry_time" gorm:"default:null"`                 // 入场时间
 	ExitTime       time.Time `json:"exit_time" gorm:"default:null"`                  // 出场时间
 	ExitTime       time.Time `json:"exit_time" gorm:"default:null"`                  // 出场时间
 	StayTime       int64     `json:"stay_time"`                                      // 停留时间(分钟)
 	StayTime       int64     `json:"stay_time"`                                      // 停留时间(分钟)

+ 1 - 0
server/initialize/gorm.go

@@ -56,6 +56,7 @@ func RegisterTables() {
 		dao.VehicleRecord{},
 		dao.VehicleRecord{},
 		dao.UHFReader{},
 		dao.UHFReader{},
 		dao.Camera{},
 		dao.Camera{},
+		dao.Shortlist{},
 	)
 	)
 	if err != nil {
 	if err != nil {
 		global.GVA_LOG.Error("register table failed", zap.Error(err))
 		global.GVA_LOG.Error("register table failed", zap.Error(err))

+ 2 - 2
server/model/parking/request/channel.go

@@ -7,7 +7,7 @@ type ChannelCreate struct {
 	Direction      string `json:"direction"`       // 进出方向 in/out/inout
 	Direction      string `json:"direction"`       // 进出方向 in/out/inout
 	AllowTemporary bool   `json:"allow_temporary"` // 是否允许临时车进出
 	AllowTemporary bool   `json:"allow_temporary"` // 是否允许临时车进出
 	Description    string `json:"description"`     // 备注
 	Description    string `json:"description"`     // 备注
-	ParkingLotID   uint   `json:"parking_lot_id"`  // 所属区域ID
+	BoothId        uint   `json:"booth_id"`        //岗亭id
 }
 }
 
 
 // ChannelUpdate 通道更新请求
 // ChannelUpdate 通道更新请求
@@ -18,7 +18,7 @@ type ChannelUpdate struct {
 	Direction      string `json:"direction"`       // 进出方向 in/out/inout
 	Direction      string `json:"direction"`       // 进出方向 in/out/inout
 	AllowTemporary bool   `json:"allow_temporary"` // 是否允许临时车进出
 	AllowTemporary bool   `json:"allow_temporary"` // 是否允许临时车进出
 	Description    string `json:"description"`     // 备注
 	Description    string `json:"description"`     // 备注
-	ParkingLotID   uint   `json:"parking_lot_id"`  // 所属区域ID
+	BoothId        uint   `json:"booth_id"`        //岗亭id
 }
 }
 
 
 // ChannelQuery 通道查询请求
 // ChannelQuery 通道查询请求

+ 1 - 0
server/model/parking/request/parking_lot.go

@@ -21,6 +21,7 @@ type ParkingLotUpdate struct {
 type ParkingLotQuery struct {
 type ParkingLotQuery struct {
 	LotCode  string `form:"lot_code"`             // 区域编码
 	LotCode  string `form:"lot_code"`             // 区域编码
 	LotName  string `form:"lot_name"`             // 区域名称
 	LotName  string `form:"lot_name"`             // 区域名称
+	LotId    int    `form:"lot_id"`               // 区域id
 	Page     int    `form:"page,default=1"`       // 页码
 	Page     int    `form:"page,default=1"`       // 页码
 	PageSize int    `form:"page_size,default=10"` // 每页数量
 	PageSize int    `form:"page_size,default=10"` // 每页数量
 }
 }

+ 23 - 21
server/model/uhf/request/reader.go

@@ -2,31 +2,33 @@ package request
 
 
 // UHFReaderCreate UHF读写器创建请求
 // UHFReaderCreate UHF读写器创建请求
 type UHFReaderCreate struct {
 type UHFReaderCreate struct {
-	DeviceCode   string `json:"device_code"`    // 设备编码
-	DeviceName   string `json:"device_name"`    // 设备名称
-	ConnectType  string `json:"connect_type"`   // 连接类型 tcp/serial
-	IPAddress    string `json:"ip_address"`     // IP地址
-	Port         int    `json:"port"`           // 端口
-	COMPort      string `json:"com_port"`       // 串口名称
-	BaudRate     int    `json:"baud_rate"`      // 串口波特率
-	IsActive     bool   `json:"is_active"`      // 是否启用
-	Description  string `json:"description"`    // 备注
-	ParkingLotID uint   `json:"parking_lot_id"` // 所属区域ID
+	DeviceCode  string `json:"device_code"`  // 设备编码
+	DeviceName  string `json:"device_name"`  // 设备名称
+	DeviceType  string `json:"device_type"`  // 设备类型
+	ConnectType string `json:"connect_type"` // 连接类型 tcp/serial
+	IPAddress   string `json:"ip_address"`   // IP地址
+	Port        int    `json:"port"`         // 端口
+	COMPort     string `json:"com_port"`     // 串口名称
+	BaudRate    int    `json:"baud_rate"`    // 串口波特率
+	IsActive    bool   `json:"is_active"`    // 是否启用
+	Description string `json:"description"`  // 备注
+	ChannelId   int    `json:"channel_id"`   // 通道id
 }
 }
 
 
 // UHFReaderUpdate UHF读写器更新请求
 // UHFReaderUpdate UHF读写器更新请求
 type UHFReaderUpdate struct {
 type UHFReaderUpdate struct {
-	ID           uint   `json:"id"`             // 设备ID
-	DeviceCode   string `json:"device_code"`    // 设备编码
-	DeviceName   string `json:"device_name"`    // 设备名称
-	ConnectType  string `json:"connect_type"`   // 连接类型 tcp/serial
-	IPAddress    string `json:"ip_address"`     // IP地址
-	Port         int    `json:"port"`           // 端口
-	COMPort      string `json:"com_port"`       // 串口名称
-	BaudRate     int    `json:"baud_rate"`      // 串口波特率
-	IsActive     bool   `json:"is_active"`      // 是否启用
-	Description  string `json:"description"`    // 备注
-	ParkingLotID uint   `json:"parking_lot_id"` // 所属区域ID
+	ID          uint   `json:"id"`           // 设备ID
+	DeviceCode  string `json:"device_code"`  // 设备编码
+	DeviceName  string `json:"device_name"`  // 设备名称
+	DeviceType  string `json:"device_type"`  // 设备类型
+	ConnectType string `json:"connect_type"` // 连接类型 tcp/serial
+	IPAddress   string `json:"ip_address"`   // IP地址
+	Port        int    `json:"port"`         // 端口
+	COMPort     string `json:"com_port"`     // 串口名称
+	BaudRate    int    `json:"baud_rate"`    // 串口波特率
+	IsActive    bool   `json:"is_active"`    // 是否启用
+	Description string `json:"description"`  // 备注
+	ChannelId   int    `json:"channel_id"`   // 通道id
 }
 }
 
 
 // UHFReaderQuery UHF读写器查询请求
 // UHFReaderQuery UHF读写器查询请求

+ 9 - 0
server/model/vehicle/request/shortlist.go

@@ -0,0 +1,9 @@
+package request
+
+type ShortlistRequest struct {
+	ListType    string `form:"list_type" json:"list_type"`
+	PlateNumber string `form:"plate_number" json:"plate_number"`
+	RFIDTag     string `form:"rfid_tag" json:"rfid_tag"`
+	Page        int    `form:"page" json:"page"`
+	PageSize    int    `form:"pageSize" json:"pageSize"`
+}

+ 2 - 0
server/model/vehicle/request/vehicle.go

@@ -5,6 +5,7 @@ type VehicleCreate struct {
 	VehicleType  string `json:"vehicle_type"`
 	VehicleType  string `json:"vehicle_type"`
 	VehicleBrand string `json:"vehicle_brand"`
 	VehicleBrand string `json:"vehicle_brand"`
 	VehicleColor string `json:"vehicle_color"`
 	VehicleColor string `json:"vehicle_color"`
+	RFIDTag      string `json:"rfid_tag"`
 	OwnerId      uint   `json:"owner_id"`
 	OwnerId      uint   `json:"owner_id"`
 }
 }
 
 
@@ -14,6 +15,7 @@ type VehicleUpdate struct {
 	VehicleType  string `json:"vehicle_type"`
 	VehicleType  string `json:"vehicle_type"`
 	VehicleBrand string `json:"vehicle_brand"`
 	VehicleBrand string `json:"vehicle_brand"`
 	VehicleColor string `json:"vehicle_color"`
 	VehicleColor string `json:"vehicle_color"`
+	RFIDTag      string `json:"rfid_tag"`
 	OwnerId      uint   `json:"owner_id"`
 	OwnerId      uint   `json:"owner_id"`
 }
 }
 
 

+ 1 - 0
server/model/vehicle/response/shortlist.go

@@ -0,0 +1 @@
+package response

+ 5 - 1
server/router/parking/parking.go

@@ -17,6 +17,7 @@ func SetupParkingRouter(router *gin.RouterGroup) {
 			lotGroup.GET("/get", parking.GetParkingLotByID)
 			lotGroup.GET("/get", parking.GetParkingLotByID)
 			lotGroup.GET("/get-by-code", parking.GetParkingLotByCode)
 			lotGroup.GET("/get-by-code", parking.GetParkingLotByCode)
 			lotGroup.GET("/list", parking.ListParkingLots)
 			lotGroup.GET("/list", parking.ListParkingLots)
+			lotGroup.GET("/all", parking.QueryAllParkingLots)
 			lotGroup.DELETE("/delete", parking.DeleteParkingLot)
 			lotGroup.DELETE("/delete", parking.DeleteParkingLot)
 		}
 		}
 
 
@@ -26,6 +27,7 @@ func SetupParkingRouter(router *gin.RouterGroup) {
 			boothGroup.PUT("/update", parking.UpdateBooth)
 			boothGroup.PUT("/update", parking.UpdateBooth)
 			boothGroup.GET("/get", parking.GetBoothByID)
 			boothGroup.GET("/get", parking.GetBoothByID)
 			boothGroup.GET("/get-by-code", parking.GetBoothByCode)
 			boothGroup.GET("/get-by-code", parking.GetBoothByCode)
+			boothGroup.GET("/all", parking.QueryAllBooths)
 			boothGroup.GET("/list", parking.ListBooths)
 			boothGroup.GET("/list", parking.ListBooths)
 			boothGroup.DELETE("/delete", parking.DeleteBooth)
 			boothGroup.DELETE("/delete", parking.DeleteBooth)
 		}
 		}
@@ -36,6 +38,7 @@ func SetupParkingRouter(router *gin.RouterGroup) {
 			channelGroup.PUT("/update", parking.UpdateChannel)
 			channelGroup.PUT("/update", parking.UpdateChannel)
 			channelGroup.GET("/get", parking.GetChannelByID)
 			channelGroup.GET("/get", parking.GetChannelByID)
 			channelGroup.GET("/get-by-code", parking.GetChannelByCode)
 			channelGroup.GET("/get-by-code", parking.GetChannelByCode)
+			channelGroup.GET("/all", parking.QueryAllChannels)
 			channelGroup.GET("/list", parking.ListChannels)
 			channelGroup.GET("/list", parking.ListChannels)
 			channelGroup.DELETE("/delete", parking.DeleteChannel)
 			channelGroup.DELETE("/delete", parking.DeleteChannel)
 		}
 		}
@@ -44,9 +47,10 @@ func SetupParkingRouter(router *gin.RouterGroup) {
 		{
 		{
 			uhfGroup.POST("/create", uhf.CreateReader)
 			uhfGroup.POST("/create", uhf.CreateReader)
 			uhfGroup.PUT("/update", uhf.UpdateReader)
 			uhfGroup.PUT("/update", uhf.UpdateReader)
-			uhfGroup.GET("/get", uhf.GetReaderByID)
+			uhfGroup.GET("/connectedDevice", uhf.ConnectedDevice)
 			uhfGroup.GET("/get-by-code", uhf.GetReaderByCode)
 			uhfGroup.GET("/get-by-code", uhf.GetReaderByCode)
 			uhfGroup.GET("/list", uhf.ListReaders)
 			uhfGroup.GET("/list", uhf.ListReaders)
+			uhfGroup.GET("/all", uhf.QueryAllReaders)
 			uhfGroup.DELETE("/delete", uhf.DeleteReader)
 			uhfGroup.DELETE("/delete", uhf.DeleteReader)
 		}
 		}
 	}
 	}

+ 2 - 2
server/router/vehicle/shortlist.go

@@ -19,7 +19,7 @@ func (s *ShortlistRouter) InitShortlistRouter(Router *gin.RouterGroup) {
 		shortlistRouter.PUT("updateShortlist", shortlistRouterShortlist.UpdateShortlist)    // 更新shortlist
 		shortlistRouter.PUT("updateShortlist", shortlistRouterShortlist.UpdateShortlist)    // 更新shortlist
 	}
 	}
 	{
 	{
-		shortlistRouterWithoutRecord.POST("queryAllShortlists", shortlistRouterShortlist.QueryAllShortlists) // 获取所有shortlist
-		shortlistRouterWithoutRecord.POST("queryShortlistList", shortlistRouterShortlist.QueryShortlistList) // 获取shortlist列表
+		shortlistRouterWithoutRecord.GET("queryAllShortlists", shortlistRouterShortlist.QueryAllShortlists) // 获取所有shortlist
+		shortlistRouterWithoutRecord.GET("queryShortlistList", shortlistRouterShortlist.QueryShortlistList) // 获取shortlist列表
 	}
 	}
 }
 }

+ 25 - 6
server/service/parking/booth.go

@@ -23,10 +23,11 @@ func (s *boothService) CreateBooth(req request.BoothCreate) error {
 	}
 	}
 
 
 	booth := dao.Booth{
 	booth := dao.Booth{
-		BoothCode:   req.BoothCode,
-		BoothName:   req.BoothName,
-		IPAddress:   req.IPAddress,
-		Description: req.Description,
+		BoothCode:    req.BoothCode,
+		BoothName:    req.BoothName,
+		IPAddress:    req.IPAddress,
+		Description:  req.Description,
+		ParkingLotID: req.ParkingLotID,
 	}
 	}
 
 
 	return global.GVA_DB.Create(&booth).Error
 	return global.GVA_DB.Create(&booth).Error
@@ -35,7 +36,7 @@ func (s *boothService) CreateBooth(req request.BoothCreate) error {
 // UpdateBooth 更新岗亭
 // UpdateBooth 更新岗亭
 func (s *boothService) UpdateBooth(req request.BoothUpdate) error {
 func (s *boothService) UpdateBooth(req request.BoothUpdate) error {
 	var booth dao.Booth
 	var booth dao.Booth
-	result := global.GVA_DB.First(&booth, req.ID)
+	result := global.GVA_DB.Preload("Channels").Preload("Channels.UHFReaders").First(&booth, req.ID)
 	if result.RowsAffected == 0 {
 	if result.RowsAffected == 0 {
 		return errors.New("岗亭不存在")
 		return errors.New("岗亭不存在")
 	}
 	}
@@ -51,6 +52,15 @@ func (s *boothService) UpdateBooth(req request.BoothUpdate) error {
 	booth.BoothName = req.BoothName
 	booth.BoothName = req.BoothName
 	booth.IPAddress = req.IPAddress
 	booth.IPAddress = req.IPAddress
 	booth.Description = req.Description
 	booth.Description = req.Description
+	booth.ParkingLotID = req.ParkingLotID
+
+	// 修改岗亭的区域id,那么它下面的子级关系的区域id都要改
+	for _, channel := range booth.Channels {
+		global.GVA_DB.Model(&channel).Where("id = ?", channel.ID).Update("parking_lot_id", req.ParkingLotID)
+		for _, reader := range channel.UHFReaders {
+			global.GVA_DB.Model(&reader).Where("id = ?", channel.ID).Update("parking_lot_id", req.ParkingLotID)
+		}
+	}
 
 
 	return global.GVA_DB.Save(&booth).Error
 	return global.GVA_DB.Save(&booth).Error
 }
 }
@@ -75,6 +85,15 @@ func (s *boothService) GetBoothByCode(code string) (dao.Booth, error) {
 	return booth, nil
 	return booth, nil
 }
 }
 
 
+func (s *boothService) QueryAllBooths() ([]dao.Booth, error) {
+	var booths []dao.Booth
+	err := global.GVA_DB.Find(&booths).Error
+	if err != nil {
+		return []dao.Booth{}, err
+	}
+	return booths, nil
+}
+
 // ListBooths 获取岗亭列表
 // ListBooths 获取岗亭列表
 func (s *boothService) ListBooths(req request.BoothQuery) (int64, []dao.Booth, error) {
 func (s *boothService) ListBooths(req request.BoothQuery) (int64, []dao.Booth, error) {
 	var booths []dao.Booth
 	var booths []dao.Booth
@@ -95,7 +114,7 @@ func (s *boothService) ListBooths(req request.BoothQuery) (int64, []dao.Booth, e
 
 
 	// 分页查询
 	// 分页查询
 	offset := (req.Page - 1) * req.PageSize
 	offset := (req.Page - 1) * req.PageSize
-	result := query.Offset(offset).Limit(req.PageSize).Find(&booths)
+	result := query.Offset(offset).Limit(req.PageSize).Preload("ParkingLot").Find(&booths)
 	if result.Error != nil {
 	if result.Error != nil {
 		return 0, nil, result.Error
 		return 0, nil, result.Error
 	}
 	}

+ 15 - 0
server/service/parking/channel.go

@@ -22,12 +22,17 @@ func (s *channelService) CreateChannel(req request.ChannelCreate) error {
 		return errors.New("通道编码已存在")
 		return errors.New("通道编码已存在")
 	}
 	}
 
 
+	var booth dao.Booth
+	global.GVA_DB.Model(&booth).Where("id = ?", req.BoothId).First(&booth)
+
 	channel := dao.Channel{
 	channel := dao.Channel{
 		ChannelCode:    req.ChannelCode,
 		ChannelCode:    req.ChannelCode,
 		ChannelName:    req.ChannelName,
 		ChannelName:    req.ChannelName,
 		Direction:      req.Direction,
 		Direction:      req.Direction,
 		AllowTemporary: req.AllowTemporary,
 		AllowTemporary: req.AllowTemporary,
 		Description:    req.Description,
 		Description:    req.Description,
+		BoothID:        req.BoothId,
+		ParkingLotID:   booth.ParkingLotID,
 	}
 	}
 
 
 	return global.GVA_DB.Create(&channel).Error
 	return global.GVA_DB.Create(&channel).Error
@@ -53,6 +58,7 @@ func (s *channelService) UpdateChannel(req request.ChannelUpdate) error {
 	channel.Direction = req.Direction
 	channel.Direction = req.Direction
 	channel.AllowTemporary = req.AllowTemporary
 	channel.AllowTemporary = req.AllowTemporary
 	channel.Description = req.Description
 	channel.Description = req.Description
+	channel.BoothID = req.BoothId
 
 
 	return global.GVA_DB.Save(&channel).Error
 	return global.GVA_DB.Save(&channel).Error
 }
 }
@@ -77,6 +83,15 @@ func (s *channelService) GetChannelByCode(code string) (dao.Channel, error) {
 	return channel, nil
 	return channel, nil
 }
 }
 
 
+func (s *channelService) QueryAllChannels() ([]dao.Channel, error) {
+	var channels []dao.Channel
+	err := global.GVA_DB.Find(&channels).Error
+	if err != nil {
+		return channels, err
+	}
+	return channels, nil
+}
+
 // ListChannels 获取通道列表
 // ListChannels 获取通道列表
 func (s *channelService) ListChannels(req request.ChannelQuery) (int64, []dao.Channel, error) {
 func (s *channelService) ListChannels(req request.ChannelQuery) (int64, []dao.Channel, error) {
 	var channels []dao.Channel
 	var channels []dao.Channel

+ 16 - 1
server/service/parking/parking_lot.go

@@ -82,6 +82,17 @@ func (s *parkingLotService) GetParkingLotByCode(code string) (dao.ParkingLot, er
 	return lot, nil
 	return lot, nil
 }
 }
 
 
+func (s *parkingLotService) QueryAllParkingLots() ([]dao.ParkingLot, error) {
+	var parkingLots []dao.ParkingLot
+	err := global.GVA_DB.Find(&parkingLots).Error
+
+	if err != nil {
+		return parkingLots, err
+	}
+
+	return parkingLots, nil
+}
+
 // ListParkingLots 获取停车区域列表
 // ListParkingLots 获取停车区域列表
 func (s *parkingLotService) ListParkingLots(req request.ParkingLotQuery) (int64, []dao.ParkingLot, error) {
 func (s *parkingLotService) ListParkingLots(req request.ParkingLotQuery) (int64, []dao.ParkingLot, error) {
 	var lots []dao.ParkingLot
 	var lots []dao.ParkingLot
@@ -93,6 +104,10 @@ func (s *parkingLotService) ListParkingLots(req request.ParkingLotQuery) (int64,
 		query = query.Where("lot_code LIKE ?", "%"+req.LotCode+"%")
 		query = query.Where("lot_code LIKE ?", "%"+req.LotCode+"%")
 	}
 	}
 
 
+	if req.LotCode != "" {
+		query = query.Where("id = ?", req.LotId)
+	}
+
 	if req.LotName != "" {
 	if req.LotName != "" {
 		query = query.Where("lot_name LIKE ?", "%"+req.LotName+"%")
 		query = query.Where("lot_name LIKE ?", "%"+req.LotName+"%")
 	}
 	}
@@ -102,7 +117,7 @@ func (s *parkingLotService) ListParkingLots(req request.ParkingLotQuery) (int64,
 
 
 	// 分页查询
 	// 分页查询
 	offset := (req.Page - 1) * req.PageSize
 	offset := (req.Page - 1) * req.PageSize
-	result := query.Offset(offset).Limit(req.PageSize).Find(&lots)
+	result := query.Offset(offset).Limit(req.PageSize).Preload("Booths").Preload("Channels").Preload("UHFReaders").Find(&lots)
 	if result.Error != nil {
 	if result.Error != nil {
 		return 0, nil, result.Error
 		return 0, nil, result.Error
 	}
 	}

+ 163 - 13
server/service/uhf/reader.go

@@ -8,6 +8,8 @@ import (
 	"fmt"
 	"fmt"
 	"server/dao"
 	"server/dao"
 	"server/global"
 	"server/global"
+	"server/model/vehicle/request"
+	"server/service"
 	"sync"
 	"sync"
 	"time"
 	"time"
 )
 )
@@ -19,6 +21,12 @@ type Reader interface {
 	SendData([]byte) error
 	SendData([]byte) error
 	ReadData() ([]byte, error)
 	ReadData() ([]byte, error)
 	IsConnected() bool
 	IsConnected() bool
+
+	// ===================== 加入继电器接口 =====================
+	CloseRelay1(validTime byte) error
+	ReleaseRelay1() error
+	CloseRelay2(validTime byte) error
+	ReleaseRelay2() error
 }
 }
 
 
 // 上报数据模型
 // 上报数据模型
@@ -169,7 +177,7 @@ func StartDeviceHandler(device *dao.UHFReader) error {
 		}
 		}
 	}()
 	}()
 
 
-	// 6. 启动业务处理协程(你后续在这里写业务逻辑)
+	// 6. 启动业务处理协程
 	go func() {
 	go func() {
 		for {
 		for {
 			select {
 			select {
@@ -179,10 +187,6 @@ func StartDeviceHandler(device *dao.UHFReader) error {
 				if !ok {
 				if !ok {
 					return
 					return
 				}
 				}
-				// 这里写你的业务逻辑,比如:
-				// 1. 去重过滤标签
-				// 2. 写入数据库
-				// 3. 推送到前端websocket
 				handleReportData(report)
 				handleReportData(report)
 			}
 			}
 		}
 		}
@@ -193,13 +197,12 @@ func StartDeviceHandler(device *dao.UHFReader) error {
 	return nil
 	return nil
 }
 }
 
 
-// parseReportData 解析上报数据(把你之前的逻辑搬过来)
+// parseReportData 解析上报数据
 func parseReportData(deviceCode string, buf []byte) (*ReportData, error) {
 func parseReportData(deviceCode string, buf []byte) (*ReportData, error) {
 	if len(buf) < 25 || buf[0] != 0xCF {
 	if len(buf) < 25 || buf[0] != 0xCF {
 		return nil, errors.New("无效帧")
 		return nil, errors.New("无效帧")
 	}
 	}
 
 
-	// CRC校验(复用你之前的函数)
 	dataWithoutCRC := buf[:len(buf)-2]
 	dataWithoutCRC := buf[:len(buf)-2]
 	recvCRC := binary.LittleEndian.Uint16(buf[len(buf)-2:])
 	recvCRC := binary.LittleEndian.Uint16(buf[len(buf)-2:])
 	calcCRC := uiCrc16Cal(dataWithoutCRC, uint8(len(dataWithoutCRC)))
 	calcCRC := uiCrc16Cal(dataWithoutCRC, uint8(len(dataWithoutCRC)))
@@ -207,10 +210,9 @@ func parseReportData(deviceCode string, buf []byte) (*ReportData, error) {
 		return nil, errors.New("CRC校验失败")
 		return nil, errors.New("CRC校验失败")
 	}
 	}
 
 
-	// 解析字段
 	rssi := int(buf[6])
 	rssi := int(buf[6])
 	antenna := int(buf[22])
 	antenna := int(buf[22])
-	epc := hex.EncodeToString(buf[9:21])
+	epc := hex.EncodeToString(buf[11:21])
 
 
 	return &ReportData{
 	return &ReportData{
 		DeviceCode: deviceCode,
 		DeviceCode: deviceCode,
@@ -222,9 +224,157 @@ func parseReportData(deviceCode string, buf []byte) (*ReportData, error) {
 	}, nil
 	}, nil
 }
 }
 
 
-// handleReportData
+var (
+	epcStatus      = make(map[string]bool)
+	epcLastTime    = make(map[string]int64)
+	epcMutex       sync.RWMutex
+	debounceSecond = int64(3)
+)
+
+// ===================== 核心:自动开闸 + 自动关闸 + 临时车权限判断 =====================
 func handleReportData(report *ReportData) {
 func handleReportData(report *ReportData) {
-	// 示例:打印上报数据
-	fmt.Printf("[业务处理] 设备:%s EPC:%s RSSI:%d 天线:%d\n",
-		report.DeviceCode, report.Epcs[0], report.RSSI, report.Antenna)
+	if len(report.Epcs) == 0 {
+		return
+	}
+	epc := report.Epcs[0]
+	now := time.Now().Unix()
+
+	epcMutex.Lock()
+	defer epcMutex.Unlock()
+
+	// 3秒防抖
+	if lastTime, ok := epcLastTime[epc]; ok && now-lastTime < debounceSecond {
+		return
+	}
+
+	// 获取设备处理器
+	handler, exists := DeviceManager.Get(report.DeviceCode)
+	if !exists {
+		return
+	}
+
+	// ===================== 查询设备 + 通道(包含是否允许临时车)=====================
+	var device dao.UHFReader
+	err := global.GVA_DB.Preload("Channel").First(&device, "device_code = ?", report.DeviceCode).Error
+	if err != nil {
+		return
+	}
+	channel := device.Channel
+	direction := channel.Direction
+	allowTemporary := channel.AllowTemporary // ✅ 是否允许临时车
+
+	vehicleService := service.ServiceGroupApp.VehicleServiceGroup.VehicleService
+
+	// ===================== 根据EPC查询车辆信息 =====================
+	vehicle, err := vehicleService.GetVehicleByPlateNumber("", epc)
+	isTempVehicle := false
+	if err != nil || vehicle.ID == 0 {
+		// 查不到 = 临时车
+		isTempVehicle = true
+	} else {
+		// 根据车辆类型判断
+		isTempVehicle = (vehicle.VehicleType == "临时车")
+	}
+
+	// ===================== 禁止不允许的临时车 =====================
+	if isTempVehicle && !allowTemporary {
+		fmt.Printf("🚫 禁止通行 | 临时车不允许此通道 | 设备:%s EPC:%s\n", report.DeviceCode, epc)
+		epcLastTime[epc] = now
+		return
+	}
+
+	// ===================== 入口 =====================
+	if direction == "in" {
+		if !epcStatus[epc] {
+			fmt.Printf("🟢 入口开闸 | 设备:%s EPC:%s 临时车:%v\n", report.DeviceCode, epc, isTempVehicle)
+
+			// 开闸
+			handler.reader.CloseRelay1(2)
+
+			// 记录入场
+			var vehicleEntry request.VehicleEntry
+			vehicleEntry.RFIDTag = epc
+			vehicleService.VehicleEntry(vehicleEntry)
+
+			epcStatus[epc] = true
+		} else {
+			fmt.Printf("✅ 已在场 | 设备:%s EPC:%s\n", report.DeviceCode, epc)
+		}
+	}
+
+	// ===================== 出口 =====================
+	if direction == "out" {
+		fmt.Printf("🔴 出口开闸(放行)| 设备:%s EPC:%s 临时车:%v\n", report.DeviceCode, epc, isTempVehicle)
+
+		// 出口开闸放行
+		handler.reader.CloseRelay1(2)
+
+		// 记录出场
+		var vehicleExit request.VehicleExit
+		vehicleExit.RFIDTag = epc
+		vehicleService.VehicleExit(vehicleExit)
+
+		epcStatus[epc] = false
+	}
+
+	epcLastTime[epc] = now
+}
+
+// ===================== 手动重置离场 =====================
+func SetEpcExit(epc string) {
+	epcMutex.Lock()
+	defer epcMutex.Unlock()
+	epcStatus[epc] = false
+	fmt.Printf("🚙 手动重置离场 | EPC: %s\n", epc)
+}
+
+// ==============================
+// 继电器控制(完整支持 Relay1 & Relay2)
+// ==============================
+const (
+	RELAY_OP_RELEASE = 0x01
+	RELAY_OP_CLOSE   = 0x02
+)
+
+// CloseRelay1 开闸
+func (s *SerialReader) CloseRelay1(validTime byte) error {
+	frame := buildRelayFrame(0x0077, 1, RELAY_OP_CLOSE, validTime)
+	_, err := s.SendAndRecv(frame)
+	return err
+}
+
+// ReleaseRelay1
+func (s *SerialReader) ReleaseRelay1() error {
+	frame := buildRelayFrame(0x0077, 1, RELAY_OP_RELEASE, 0)
+	_, err := s.SendAndRecv(frame)
+	return err
+}
+
+// CloseRelay2 关闸
+func (s *SerialReader) CloseRelay2(validTime byte) error {
+	frame := buildRelayFrame(0x0078, 2, RELAY_OP_CLOSE, validTime)
+	_, err := s.SendAndRecv(frame)
+	return err
+}
+
+// ReleaseRelay2
+func (s *SerialReader) ReleaseRelay2() error {
+	frame := buildRelayFrame(0x0078, 2, RELAY_OP_RELEASE, 0)
+	_, err := s.SendAndRecv(frame)
+	return err
+}
+
+// buildRelayFrame 构建指令
+func buildRelayFrame(cmd uint16, relayNum byte, option byte, validTime byte) []byte {
+	frame := []byte{
+		0xCF, 0xFF,
+		byte(cmd >> 8), byte(cmd & 0xFF),
+		0x03,     // len
+		relayNum, // 1=继电器1  2=继电器2
+		option,
+		validTime,
+	}
+	crc := uiCrc16Cal(frame, uint8(len(frame)))
+	frame = append(frame, byte(crc&0xFF), byte(crc>>8))
+	return frame
 }
 }

+ 20 - 0
server/service/uhf/tcp_reader.go

@@ -14,6 +14,26 @@ type TCPReader struct {
 	readBufSize int // 读取缓冲区大小
 	readBufSize int // 读取缓冲区大小
 }
 }
 
 
+func (t *TCPReader) CloseRelay1(validTime byte) error {
+	//TODO implement me
+	panic("implement me")
+}
+
+func (t *TCPReader) ReleaseRelay1() error {
+	//TODO implement me
+	panic("implement me")
+}
+
+func (t *TCPReader) CloseRelay2(validTime byte) error {
+	//TODO implement me
+	panic("implement me")
+}
+
+func (t *TCPReader) ReleaseRelay2() error {
+	//TODO implement me
+	panic("implement me")
+}
+
 // 初始化时设置默认缓冲区
 // 初始化时设置默认缓冲区
 func NewTCPReader(ip string, port int) *TCPReader {
 func NewTCPReader(ip string, port int) *TCPReader {
 	return &TCPReader{
 	return &TCPReader{

+ 41 - 30
server/service/uhf/uhf_service.go

@@ -2,6 +2,7 @@ package uhf
 
 
 import (
 import (
 	"fmt"
 	"fmt"
+	"go.uber.org/zap"
 	"server/dao"
 	"server/dao"
 	"server/global"
 	"server/global"
 	"server/model/uhf/request"
 	"server/model/uhf/request"
@@ -20,9 +21,16 @@ func (s *uhfService) CreateReader(req request.UHFReaderCreate) error {
 		return fmt.Errorf("设备编码已存在")
 		return fmt.Errorf("设备编码已存在")
 	}
 	}
 
 
+	var channel dao.Channel
+	global.GVA_DB.Model(&channel).Where("id = ?", req.ChannelId).First(&channel)
+
+	var booth dao.Booth
+	global.GVA_DB.Model(&booth).Where("id = ?", channel.BoothID).First(&booth)
+
 	reader = dao.UHFReader{
 	reader = dao.UHFReader{
 		DeviceCode:   req.DeviceCode,
 		DeviceCode:   req.DeviceCode,
 		DeviceName:   req.DeviceName,
 		DeviceName:   req.DeviceName,
+		DeviceType:   req.DeviceType,
 		ConnectType:  req.ConnectType,
 		ConnectType:  req.ConnectType,
 		IPAddress:    req.IPAddress,
 		IPAddress:    req.IPAddress,
 		Port:         req.Port,
 		Port:         req.Port,
@@ -30,10 +38,18 @@ func (s *uhfService) CreateReader(req request.UHFReaderCreate) error {
 		BaudRate:     req.BaudRate,
 		BaudRate:     req.BaudRate,
 		IsActive:     req.IsActive,
 		IsActive:     req.IsActive,
 		Description:  req.Description,
 		Description:  req.Description,
-		ParkingLotID: req.ParkingLotID,
+		ParkingLotID: booth.ParkingLotID,
 	}
 	}
 
 
-	return global.GVA_DB.Create(&reader).Error
+	err := global.GVA_DB.Create(&reader).Error
+
+	if req.IsActive {
+		if err := StartDeviceHandler(&reader); err != nil {
+			global.GVA_LOG.Error("启动设备失败", zap.String("code", reader.DeviceCode), zap.Error(err))
+		}
+	}
+
+	return err
 }
 }
 
 
 // UpdateReader 更新UHF读写器
 // UpdateReader 更新UHF读写器
@@ -45,44 +61,30 @@ func (s *uhfService) UpdateReader(req request.UHFReaderUpdate) error {
 	}
 	}
 
 
 	updateData := map[string]interface{}{
 	updateData := map[string]interface{}{
-		"device_name":    req.DeviceName,
-		"connect_type":   req.ConnectType,
-		"ip_address":     req.IPAddress,
-		"port":           req.Port,
-		"com_port":       req.COMPort,
-		"baud_rate":      req.BaudRate,
-		"is_active":      req.IsActive,
-		"description":    req.Description,
-		"parking_lot_id": req.ParkingLotID,
+		"device_name":  req.DeviceName,
+		"device_type":  req.DeviceType,
+		"connect_type": req.ConnectType,
+		"ip_address":   req.IPAddress,
+		"port":         req.Port,
+		"com_port":     req.COMPort,
+		"baud_rate":    req.BaudRate,
+		"is_active":    req.IsActive,
+		"description":  req.Description,
+		"channel_id":   req.ChannelId,
 	}
 	}
 
 
 	return global.GVA_DB.Model(&reader).Updates(updateData).Error
 	return global.GVA_DB.Model(&reader).Updates(updateData).Error
 }
 }
 
 
-// GetReaderByID 根据ID获取设备
-func (s *uhfService) GetReaderByID(id uint) (response.UHFReaderResponse, error) {
+// ConnectedDevice 连接设备
+func (s *uhfService) ConnectedDevice(id uint) error {
 	var reader dao.UHFReader
 	var reader dao.UHFReader
 	result := global.GVA_DB.Where("id = ?", id).First(&reader)
 	result := global.GVA_DB.Where("id = ?", id).First(&reader)
 	if result.RowsAffected == 0 {
 	if result.RowsAffected == 0 {
-		return response.UHFReaderResponse{}, fmt.Errorf("设备不存在")
+		return fmt.Errorf("设备不存在")
 	}
 	}
 
 
-	return response.UHFReaderResponse{
-		ID:           reader.ID,
-		DeviceCode:   reader.DeviceCode,
-		DeviceName:   reader.DeviceName,
-		ConnectType:  reader.ConnectType,
-		IPAddress:    reader.IPAddress,
-		Port:         reader.Port,
-		COMPort:      reader.COMPort,
-		BaudRate:     reader.BaudRate,
-		Status:       reader.Status,
-		IsActive:     reader.IsActive,
-		Description:  reader.Description,
-		ParkingLotID: reader.ParkingLotID,
-		CreatedAt:    reader.CreatedAt,
-		UpdatedAt:    reader.UpdatedAt,
-	}, nil
+	return StartDeviceHandler(&reader)
 }
 }
 
 
 // GetReaderByCode 根据设备编码获取设备
 // GetReaderByCode 根据设备编码获取设备
@@ -111,6 +113,15 @@ func (s *uhfService) GetReaderByCode(code string) (response.UHFReaderResponse, e
 	}, nil
 	}, nil
 }
 }
 
 
+func (s *uhfService) QueryAllReaders() ([]dao.UHFReader, error) {
+	var readers []dao.UHFReader
+	err := global.GVA_DB.Find(&readers).Error
+	if err != nil {
+		return readers, err
+	}
+	return readers, nil
+}
+
 // ListReaders 分页查询设备列表
 // ListReaders 分页查询设备列表
 func (s *uhfService) ListReaders(req request.UHFReaderQuery) ([]response.UHFReaderResponse, int64, error) {
 func (s *uhfService) ListReaders(req request.UHFReaderQuery) ([]response.UHFReaderResponse, int64, error) {
 	var readers []dao.UHFReader
 	var readers []dao.UHFReader

+ 4 - 4
server/service/vehicle/shortlist.go

@@ -2,16 +2,16 @@ package vehicle
 
 
 import (
 import (
 	"server/dao"
 	"server/dao"
-	"server/model/common/request"
+	"server/model/vehicle/request"
 )
 )
 
 
 type ShortlistService struct{}
 type ShortlistService struct{}
 
 
-func (shortlistService *ShortlistService) QueryShortlistList(info request.PageInfo) (list interface{}, total int64, err error) {
+func (shortlistService *ShortlistService) QueryShortlistList(info request.ShortlistRequest) (list interface{}, total int64, err error) {
 	limit := info.PageSize
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
 	offset := info.PageSize * (info.Page - 1)
 
 
-	shortlistList, t, err := dao.QueryShortlistList(limit, offset)
+	shortlistList, t, err := dao.QueryShortlistList(limit, offset, info.ListType, info.PlateNumber, info.RFIDTag)
 	if err != nil {
 	if err != nil {
 		return nil, 0, err
 		return nil, 0, err
 	}
 	}
@@ -27,7 +27,7 @@ func (shortlistService *ShortlistService) CreateShortlist(shortlist dao.Shortlis
 }
 }
 
 
 func (shortlistService *ShortlistService) UpdateShortlist(shortlist dao.Shortlist) error {
 func (shortlistService *ShortlistService) UpdateShortlist(shortlist dao.Shortlist) error {
-	return dao.CreateShortlist(shortlist)
+	return dao.UpdateShortlist(shortlist)
 }
 }
 
 
 func (shortlistService *ShortlistService) DeleteShortlist(id int) error {
 func (shortlistService *ShortlistService) DeleteShortlist(id int) error {

+ 10 - 8
server/service/vehicle/vehicle.go

@@ -15,7 +15,7 @@ type VehicleService struct{}
 func (s *VehicleService) CreateVehicle(req request.VehicleCreate) error {
 func (s *VehicleService) CreateVehicle(req request.VehicleCreate) error {
 	// 检查车牌号是否已存在
 	// 检查车牌号是否已存在
 	var existingVehicle dao.Vehicle
 	var existingVehicle dao.Vehicle
-	result := global.GVA_DB.Where("plate_number = ?", req.PlateNumber).First(&existingVehicle)
+	result := global.GVA_DB.Where("plate_number = ? OR rfid_tag = ?", req.PlateNumber, req.RFIDTag).First(&existingVehicle)
 	if result.RowsAffected > 0 {
 	if result.RowsAffected > 0 {
 		return errors.New("车牌号已存在")
 		return errors.New("车牌号已存在")
 	}
 	}
@@ -45,7 +45,7 @@ func (s *VehicleService) UpdateVehicle(req request.VehicleUpdate) error {
 
 
 	// 检查车牌号是否被其他车辆使用
 	// 检查车牌号是否被其他车辆使用
 	var existingVehicle dao.Vehicle
 	var existingVehicle dao.Vehicle
-	result = global.GVA_DB.Where("plate_number = ? AND id != ?", req.PlateNumber, req.ID).First(&existingVehicle)
+	result = global.GVA_DB.Where("(plate_number = ? OR rfid_tag = ?) AND id != ?", req.PlateNumber, req.RFIDTag, req.ID).First(&existingVehicle)
 	fmt.Println("result", result.RowsAffected)
 	fmt.Println("result", result.RowsAffected)
 	if result.RowsAffected > 0 {
 	if result.RowsAffected > 0 {
 		return errors.New("车牌号已被其他车辆使用")
 		return errors.New("车牌号已被其他车辆使用")
@@ -60,6 +60,7 @@ func (s *VehicleService) UpdateVehicle(req request.VehicleUpdate) error {
 	}
 	}
 	err := global.GVA_DB.Model(&vehicle).Updates(map[string]interface{}{
 	err := global.GVA_DB.Model(&vehicle).Updates(map[string]interface{}{
 		"plate_number":  req.PlateNumber,
 		"plate_number":  req.PlateNumber,
+		"rfid_tag":      req.RFIDTag,
 		"vehicle_type":  req.VehicleType,
 		"vehicle_type":  req.VehicleType,
 		"vehicle_brand": req.VehicleBrand,
 		"vehicle_brand": req.VehicleBrand,
 		"vehicle_color": req.VehicleColor,
 		"vehicle_color": req.VehicleColor,
@@ -138,8 +139,8 @@ func (s *VehicleService) VehicleEntry(req request.VehicleEntry) (request.Vehicle
 		// 如果车辆不存在,创建新车辆
 		// 如果车辆不存在,创建新车辆
 		createReq := request.VehicleCreate{
 		createReq := request.VehicleCreate{
 			PlateNumber: req.PlateNumber,
 			PlateNumber: req.PlateNumber,
-			VehicleType: "普通车辆", // 默认类型
-			OwnerId:     0,      // 默认无车主
+			VehicleType: "临时车", // 默认类型
+			OwnerId:     0,     // 默认无车主
 		}
 		}
 		err = s.CreateVehicle(createReq)
 		err = s.CreateVehicle(createReq)
 		if err != nil {
 		if err != nil {
@@ -150,7 +151,7 @@ func (s *VehicleService) VehicleEntry(req request.VehicleEntry) (request.Vehicle
 
 
 	// 检查是否有未出场的记录
 	// 检查是否有未出场的记录
 	var existingRecord dao.VehicleRecord
 	var existingRecord dao.VehicleRecord
-	result := global.GVA_DB.Where("plate_number = ? AND exit_time IS NULL", req.PlateNumber).First(&existingRecord)
+	result := global.GVA_DB.Where("(plate_number = ? OR rfid_tag = ?) AND exit_time IS NULL", req.PlateNumber, req.RFIDTag).First(&existingRecord)
 	if result.RowsAffected > 0 {
 	if result.RowsAffected > 0 {
 		return request.VehicleEntryResponse{}, errors.New("车辆已入场,未出场")
 		return request.VehicleEntryResponse{}, errors.New("车辆已入场,未出场")
 	}
 	}
@@ -159,6 +160,7 @@ func (s *VehicleService) VehicleEntry(req request.VehicleEntry) (request.Vehicle
 	entryTime := time.Now()
 	entryTime := time.Now()
 	record := dao.VehicleRecord{
 	record := dao.VehicleRecord{
 		PlateNumber:    req.PlateNumber,
 		PlateNumber:    req.PlateNumber,
+		RFIDTag:        req.RFIDTag,
 		EntryTime:      entryTime,
 		EntryTime:      entryTime,
 		ParkingLotID:   req.ParkingLotID,
 		ParkingLotID:   req.ParkingLotID,
 		ParkingSpaceID: req.ParkingSpaceID,
 		ParkingSpaceID: req.ParkingSpaceID,
@@ -172,7 +174,7 @@ func (s *VehicleService) VehicleEntry(req request.VehicleEntry) (request.Vehicle
 	}
 	}
 
 
 	// 更新车辆最近入场时间
 	// 更新车辆最近入场时间
-	vehicle.LastEntryTime = entryTime
+	vehicle.LastEntryTime = &entryTime
 	global.GVA_DB.Save(&vehicle)
 	global.GVA_DB.Save(&vehicle)
 
 
 	response := request.VehicleEntryResponse{
 	response := request.VehicleEntryResponse{
@@ -191,7 +193,7 @@ func (s *VehicleService) VehicleEntry(req request.VehicleEntry) (request.Vehicle
 func (s *VehicleService) VehicleExit(req request.VehicleExit) (request.VehicleExitResponse, error) {
 func (s *VehicleService) VehicleExit(req request.VehicleExit) (request.VehicleExitResponse, error) {
 	// 检查是否有未出场的记录
 	// 检查是否有未出场的记录
 	var record dao.VehicleRecord
 	var record dao.VehicleRecord
-	result := global.GVA_DB.Where("plate_number = ? AND exit_time IS NULL", req.PlateNumber).First(&record)
+	result := global.GVA_DB.Where("(plate_number = ? OR rfid_tag = ?) AND exit_time IS NULL", req.PlateNumber, req.RFIDTag).First(&record)
 	if result.RowsAffected == 0 {
 	if result.RowsAffected == 0 {
 		return request.VehicleExitResponse{}, errors.New("车辆未入场")
 		return request.VehicleExitResponse{}, errors.New("车辆未入场")
 	}
 	}
@@ -220,7 +222,7 @@ func (s *VehicleService) VehicleExit(req request.VehicleExit) (request.VehicleEx
 	}
 	}
 
 
 	// 更新车辆信息
 	// 更新车辆信息
-	vehicle.LastExitTime = exitTime
+	vehicle.LastExitTime = &exitTime
 	vehicle.TotalStayTime += stayTime
 	vehicle.TotalStayTime += stayTime
 	vehicle.TotalFee += fee
 	vehicle.TotalFee += fee
 	global.GVA_DB.Save(&vehicle)
 	global.GVA_DB.Save(&vehicle)

+ 405 - 169
web/src/view/parking/parkingInfo.vue

@@ -7,65 +7,113 @@
             <el-text style="font-weight: 550">停车区域</el-text>
             <el-text style="font-weight: 550">停车区域</el-text>
           </div>
           </div>
           <div class="regionTitle-icon">
           <div class="regionTitle-icon">
-            <el-icon size="large" color="#008000">
-              <Plus/>
+            <el-icon
+              size="large"
+              color="#008000"
+            >
+              <Plus />
             </el-icon>
             </el-icon>
-            <el-icon style="padding-left: 5px" size="large" color="#4682b4">
-              <Refresh/>
+            <el-icon
+              style="padding-left: 5px"
+              size="large"
+              color="#4682b4"
+            >
+              <Refresh />
             </el-icon>
             </el-icon>
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
     </el-col>
     </el-col>
-    <el-col :span="19" style="margin-left: 40px">
+    <el-col
+      :span="19"
+      style="margin-left: 40px"
+    >
       <el-tabs
       <el-tabs
-          v-model="activeName"
-          class="demo-tabs"
-          @tab-click="handleClick"
+        v-model="activeName"
+        class="demo-tabs"
+        @tab-click="handleClick"
       >
       >
         <el-tab-pane
         <el-tab-pane
-            label="岗亭"
-            name="detail"
+          label="岗亭"
+          name="detail"
         >
         >
           <el-form inline>
           <el-form inline>
             <el-form-item>
             <el-form-item>
               <el-button
               <el-button
-                  icon="Plus"
-                  text
-                  type="success"
-                  @click="openPosition('岗亭新增','')">
+                icon="Plus"
+                text
+                type="success"
+                @click="openPosition('岗亭新增','')"
+              >
                 新增
                 新增
               </el-button>
               </el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Edit" text type="warning">编辑</el-button>
+              <el-button
+                icon="Edit"
+                text
+                type="warning"
+              >编辑</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Delete" text type="danger">删除</el-button>
+              <el-button
+                icon="Delete"
+                text
+                type="danger"
+              >删除</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Refresh" text type="primary">刷新</el-button>
+              <el-button
+                icon="Refresh"
+                text
+                type="primary"
+              >刷新</el-button>
             </el-form-item>
             </el-form-item>
           </el-form>
           </el-form>
-          <el-table size="small" :data="positionList" height="605">
-            <el-table-column label="编码" align="center" width="100" prop="booth_code"></el-table-column>
-            <el-table-column label="名称" align="center" width="250" prop="booth_name"></el-table-column>
-            <el-table-column label="IP地址" align="center" width="250" prop="ip_address"></el-table-column>
-            <el-table-column label="备注" align="center" prop="description"></el-table-column>
+          <el-table
+            size="small"
+            :data="positionList"
+            height="605"
+          >
+            <el-table-column
+              label="编码"
+              align="center"
+              width="100"
+              prop="booth_code"
+            />
+            <el-table-column
+              label="名称"
+              align="center"
+              width="250"
+              prop="booth_name"
+            />
+            <el-table-column
+              label="IP地址"
+              align="center"
+              width="250"
+              prop="ip_address"
+            />
+            <el-table-column
+              label="备注"
+              align="center"
+              prop="description"
+            />
             <el-table-column label="操作">
             <el-table-column label="操作">
               <template #default="scope">
               <template #default="scope">
                 <el-button
                 <el-button
-                    text
-                    type="primary"
-                    icon="edit"
-                    @click="openPosition('岗亭编辑', scope.row)">
+                  text
+                  type="primary"
+                  icon="edit"
+                  @click="openPosition('岗亭编辑', scope.row)"
+                >
                   编辑
                   编辑
                 </el-button>
                 </el-button>
                 <el-button
                 <el-button
-                    text
-                    type="primary"
-                    icon="delete"
-                    @click="delPosition(scope.row.ID)">
+                  text
+                  type="primary"
+                  icon="delete"
+                  @click="delPosition(scope.row.ID)"
+                >
                   删除
                   删除
                 </el-button>
                 </el-button>
               </template>
               </template>
@@ -73,89 +121,211 @@
           </el-table>
           </el-table>
           <div style="width: 100%;display: flex;justify-content: end">
           <div style="width: 100%;display: flex;justify-content: end">
             <el-pagination
             <el-pagination
-                :current-page="searchGuardBooth.page"
-                :page-size="searchGuardBooth.page_size"
-                :page-sizes="[10, 30, 50, 100]"
-                :total="guardTotal"
-                layout="total, sizes, prev, pager, next, jumper"
-                @current-change="handleCurrentChange"
-                @size-change="handleSizeChange"
-                style="padding-right: 10px"
+              :current-page="searchGuardBooth.page"
+              :page-size="searchGuardBooth.page_size"
+              :page-sizes="[10, 30, 50, 100]"
+              :total="guardTotal"
+              layout="total, sizes, prev, pager, next, jumper"
+              style="padding-right: 10px"
+              @current-change="handleCurrentChange"
+              @size-change="handleSizeChange"
             />
             />
           </div>
           </div>
         </el-tab-pane>
         </el-tab-pane>
         <el-tab-pane
         <el-tab-pane
-            label="通道"
-            name="people"
+          label="通道"
+          name="people"
         >
         >
           <el-form inline>
           <el-form inline>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Plus" text type="success" @click="openChannel('通道新增','')">新增</el-button>
+              <el-button
+                icon="Plus"
+                text
+                type="success"
+                @click="openChannel('通道新增','')"
+              >新增</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Edit" text type="warning">编辑</el-button>
+              <el-button
+                icon="Edit"
+                text
+                type="warning"
+              >编辑</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Delete" text type="danger">删除</el-button>
+              <el-button
+                icon="Delete"
+                text
+                type="danger"
+              >删除</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Refresh" text type="primary">刷新</el-button>
+              <el-button
+                icon="Refresh"
+                text
+                type="primary"
+              >刷新</el-button>
             </el-form-item>
             </el-form-item>
           </el-form>
           </el-form>
-          <el-table size="small" :data="channelList" height="605">
-            <el-table-column label="编码" align="center" width="100"></el-table-column>
-            <el-table-column label="名称" align="center" width="250"></el-table-column>
-            <el-table-column label="进出方向" align="center" width="150"></el-table-column>
-            <el-table-column label="是否允许临时车进出" align="center" width="200"></el-table-column>
-            <el-table-column label="备注" align="center"></el-table-column>
-            <el-table-column label="操作" align="center" #default="scope">
-              <el-button type="primary" icon="edit" text @click="openChannel('通道编辑', scope.row)">编辑</el-button>
-              <el-button type="primary" icon="delete" text>删除</el-button>
+          <el-table
+            size="small"
+            :data="channelList"
+            height="605"
+          >
+            <el-table-column
+              label="编码"
+              align="center"
+              width="100"
+              prop="ID"
+            />
+            <el-table-column
+              label="名称"
+              align="center"
+              width="250"
+              prop="channel_code"
+            />
+            <el-table-column
+              label="进出方向"
+              align="center"
+              width="150"
+              prop="direction"
+            />
+            <el-table-column
+              label="是否允许临时车进出"
+              align="center"
+              width="200"
+              prop="allow_temporary"
+            />
+            <el-table-column
+              label="备注"
+              align="center"
+              prop="description"
+            />
+            <el-table-column
+              v-slot="scope"
+              label="操作"
+              align="center"
+            >
+              <el-button
+                type="primary"
+                icon="edit"
+                text
+                @click="openChannel('通道编辑', scope.row)"
+              >编辑</el-button>
+              <el-button
+                type="primary"
+                icon="delete"
+                text
+              >删除</el-button>
             </el-table-column>
             </el-table-column>
           </el-table>
           </el-table>
           <div style="width: 100%;display: flex;justify-content: end">
           <div style="width: 100%;display: flex;justify-content: end">
             <el-pagination
             <el-pagination
-                :current-page="queryChannelData.page"
-                :page-size="queryChannelData.page_size"
-                :page-sizes="[10, 30, 50, 100]"
-                :total="guardTotal"
-                layout="total, sizes, prev, pager, next, jumper"
-                @current-change="handleCurrentChannel"
-                @size-change="handleSizeChannel"
-                style="padding-right: 10px"
+              :current-page="queryChannelData.page"
+              :page-size="queryChannelData.page_size"
+              :page-sizes="[10, 30, 50, 100]"
+              :total="guardTotal"
+              layout="total, sizes, prev, pager, next, jumper"
+              style="padding-right: 10px"
+              @current-change="handleCurrentChannel"
+              @size-change="handleSizeChannel"
             />
             />
           </div>
           </div>
         </el-tab-pane>
         </el-tab-pane>
         <el-tab-pane
         <el-tab-pane
-            label="设备"
-            name="department"
+          label="设备"
+          name="department"
         >
         >
           <el-form inline>
           <el-form inline>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Plus" text type="success" @click="deviceTypeShow = true">新增</el-button>
+              <el-button
+                icon="Plus"
+                text
+                type="success"
+                @click="deviceTypeShow = true"
+              >新增</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Edit" text type="warning">编辑</el-button>
+              <el-button
+                icon="Edit"
+                text
+                type="warning"
+              >编辑</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Delete" text type="danger">删除</el-button>
+              <el-button
+                icon="Delete"
+                text
+                type="danger"
+              >删除</el-button>
             </el-form-item>
             </el-form-item>
             <el-form-item>
             <el-form-item>
-              <el-button icon="Refresh" text type="primary">刷新</el-button>
+              <el-button
+                icon="Refresh"
+                text
+                type="primary"
+              >刷新</el-button>
             </el-form-item>
             </el-form-item>
           </el-form>
           </el-form>
-          <el-table size="small" :data="deviceList" height="605">
-            <el-table-column label="编码" align="center" width="100" prop="device_code"></el-table-column>
-            <el-table-column label="名称" align="center" width="250" prop="device_name"></el-table-column>
-            <el-table-column label="类别" align="center" width="150" prop="device_type"></el-table-column>
-            <el-table-column label="IP地址" align="center" width="200" prop="ip_address"></el-table-column>
-            <el-table-column label="端口" align="center" width="150"></el-table-column>
-            <el-table-column label="在线状态" align="center" width="150"></el-table-column>
-            <el-table-column label="操作" align="center">
+          <el-table
+            size="small"
+            :data="deviceList"
+            height="605"
+          >
+            <el-table-column
+              label="编码"
+              align="center"
+              width="100"
+              prop="device_code"
+            />
+            <el-table-column
+              label="名称"
+              align="center"
+              width="250"
+              prop="device_name"
+            />
+            <el-table-column
+              label="类别"
+              align="center"
+              width="150"
+              prop="device_type"
+            />
+            <el-table-column
+              label="IP地址"
+              align="center"
+              width="200"
+              prop="ip_address"
+            />
+            <el-table-column
+              label="端口"
+              align="center"
+              width="150"
+            />
+            <el-table-column
+              label="在线状态"
+              align="center"
+              width="150"
+            />
+            <el-table-column
+              label="操作"
+              align="center"
+            >
               <template #default="scope">
               <template #default="scope">
-                <el-button type="primary" icon="edit" text>备注</el-button>
-                <el-button type="primary" icon="edit" text>编辑</el-button>
-                <el-button type="primary" icon="delete" text>删除</el-button>
+                <el-button
+                  type="primary"
+                  icon="edit"
+                  text
+                >备注</el-button>
+                <el-button
+                  type="primary"
+                  icon="edit"
+                  text
+                >编辑</el-button>
+                <el-button
+                  type="primary"
+                  icon="delete"
+                  text
+                >删除</el-button>
               </template>
               </template>
             </el-table-column>
             </el-table-column>
           </el-table>
           </el-table>
@@ -163,99 +333,165 @@
       </el-tabs>
       </el-tabs>
     </el-col>
     </el-col>
     <el-dialog
     <el-dialog
-        v-model="positionShow"
-        :title="positionTitle"
-        width="500"
+      v-model="positionShow"
+      :title="positionTitle"
+      width="500"
     >
     >
       <el-form label-width="90">
       <el-form label-width="90">
         <el-form-item label="岗亭编码:">
         <el-form-item label="岗亭编码:">
-          <el-input v-model="positionData.booth_code"></el-input>
+          <el-input v-model="positionData.booth_code" />
         </el-form-item>
         </el-form-item>
         <el-form-item label="岗亭名称:">
         <el-form-item label="岗亭名称:">
-          <el-input v-model="positionData.booth_name"></el-input>
+          <el-input v-model="positionData.booth_name" />
         </el-form-item>
         </el-form-item>
         <el-form-item label="IP地址:">
         <el-form-item label="IP地址:">
-          <el-input v-model="positionData.ip_address"></el-input>
+          <el-input v-model="positionData.ip_address" />
         </el-form-item>
         </el-form-item>
         <el-form-item label="备注:">
         <el-form-item label="备注:">
-          <el-input type="textarea" v-model="positionData.description"></el-input>
+          <el-input
+            v-model="positionData.description"
+            type="textarea"
+          />
         </el-form-item>
         </el-form-item>
       </el-form>
       </el-form>
       <template #footer>
       <template #footer>
         <div class="dialog-footer">
         <div class="dialog-footer">
           <el-button @click="positionShow = false">取消</el-button>
           <el-button @click="positionShow = false">取消</el-button>
-          <el-button type="primary" @click="addPosition">
+          <el-button
+            type="primary"
+            @click="addPosition"
+          >
             确认
             确认
           </el-button>
           </el-button>
         </div>
         </div>
       </template>
       </template>
     </el-dialog>
     </el-dialog>
-    <el-dialog v-model="channelShow" :title="channelTitle" width="500">
+    <el-dialog
+      v-model="channelShow"
+      :title="channelTitle"
+      width="500"
+    >
       <el-form>
       <el-form>
         <el-form-item label="通道编码:">
         <el-form-item label="通道编码:">
-          <el-input v-model="channelData.channel_code"></el-input>
+          <el-input v-model="channelData.channel_code" />
         </el-form-item>
         </el-form-item>
         <el-form-item label="通道名称:">
         <el-form-item label="通道名称:">
-          <el-input v-model="channelData.channel_name"></el-input>
+          <el-input v-model="channelData.channel_name" />
         </el-form-item>
         </el-form-item>
         <el-form-item label="进出方向:">
         <el-form-item label="进出方向:">
-          <el-radio-group v-model="channelData.direction" size="large" fill="#409eff">
-            <el-radio-button label="进" :value="false" />
-            <el-radio-button label="出" :value="true" />
+          <el-radio-group
+            v-model="channelData.direction"
+            size="large"
+            fill="#409eff"
+          >
+            <el-radio-button
+              label="进"
+              :value="false"
+            />
+            <el-radio-button
+              label="出"
+              :value="true"
+            />
           </el-radio-group>
           </el-radio-group>
         </el-form-item>
         </el-form-item>
         <el-form-item label="是否允许临时车进出:">
         <el-form-item label="是否允许临时车进出:">
-          <el-radio-group v-model="channelData.allow_temporary" size="large" fill="#409eff">
-            <el-radio-button label="否" :value="false" />
-            <el-radio-button label="是" :value="true" />
+          <el-radio-group
+            v-model="channelData.allow_temporary"
+            size="large"
+            fill="#409eff"
+          >
+            <el-radio-button
+              label="否"
+              :value="false"
+            />
+            <el-radio-button
+              label="是"
+              :value="true"
+            />
           </el-radio-group>
           </el-radio-group>
         </el-form-item>
         </el-form-item>
         <el-form-item label="备注:">
         <el-form-item label="备注:">
-          <el-input type="textarea" v-model="channelData.description"></el-input>
+          <el-input
+            v-model="channelData.description"
+            type="textarea"
+          />
         </el-form-item>
         </el-form-item>
       </el-form>
       </el-form>
       <template #footer>
       <template #footer>
         <div class="dialog-footer">
         <div class="dialog-footer">
           <el-button @click="channelShow = false">取消</el-button>
           <el-button @click="channelShow = false">取消</el-button>
-          <el-button type="primary" @click="channelOperation">
+          <el-button
+            type="primary"
+            @click="channelOperation"
+          >
             确认
             确认
           </el-button>
           </el-button>
         </div>
         </div>
       </template>
       </template>
     </el-dialog>
     </el-dialog>
-    <el-dialog v-model="deviceShow" title="设备添加" width="500">
+    <el-dialog
+      v-model="deviceShow"
+      title="设备添加"
+      width="500"
+    >
       <el-form label-width="80">
       <el-form label-width="80">
         <el-form-item label="IP地址:">
         <el-form-item label="IP地址:">
-          <el-input v-model="deviceData.ip_address"></el-input>
+          <el-input v-model="deviceData.ip_address" />
         </el-form-item>
         </el-form-item>
         <el-form-item label="名称:">
         <el-form-item label="名称:">
-          <el-input v-model="deviceData.device_name"></el-input>
+          <el-input v-model="deviceData.device_name" />
         </el-form-item>
         </el-form-item>
         <el-form-item label="编码:">
         <el-form-item label="编码:">
-          <el-input v-model="deviceData.device_code"></el-input>
+          <el-input v-model="deviceData.device_code" />
         </el-form-item>
         </el-form-item>
         <el-form-item label="备注:">
         <el-form-item label="备注:">
-          <el-input type="textarea" v-model="deviceData.description"></el-input>
+          <el-input
+            v-model="deviceData.description"
+            type="textarea"
+          />
         </el-form-item>
         </el-form-item>
       </el-form>
       </el-form>
       <template #footer>
       <template #footer>
         <div class="dialog-footer">
         <div class="dialog-footer">
           <el-button @click="deviceShow = false">取消</el-button>
           <el-button @click="deviceShow = false">取消</el-button>
-          <el-button type="primary" @click="deviceVlprAdd">
+          <el-button
+            type="primary"
+            @click="deviceVlprAdd"
+          >
             确认
             确认
           </el-button>
           </el-button>
         </div>
         </div>
       </template>
       </template>
     </el-dialog>
     </el-dialog>
-    <el-dialog v-model="deviceTypeShow" title="设备类型" width="500">
-      <el-select v-model="deviceData.device_type" placeholder="请选择设备类型" style="width: 240px">
-        <el-option label="VLPR" value="VLPR" />
-        <el-option label="ASeries" value="ASeries" />
-        <el-option label="ASeries-G" value="ASeries-G" />
+    <el-dialog
+      v-model="deviceTypeShow"
+      title="设备类型"
+      width="500"
+    >
+      <el-select
+        v-model="deviceData.device_type"
+        placeholder="请选择设备类型"
+        style="width: 240px"
+      >
+        <el-option
+          label="VLPR"
+          value="VLPR"
+        />
+        <el-option
+          label="ASeries"
+          value="ASeries"
+        />
+        <el-option
+          label="ASeries-G"
+          value="ASeries-G"
+        />
       </el-select>
       </el-select>
       <template #footer>
       <template #footer>
         <el-button @click="deviceTypeShow = false">取消</el-button>
         <el-button @click="deviceTypeShow = false">取消</el-button>
-        <el-button type="primary" @click="confirmType">确定</el-button>
+        <el-button
+          type="primary"
+          @click="confirmType"
+        >确定</el-button>
       </template>
       </template>
     </el-dialog>
     </el-dialog>
   </el-row>
   </el-row>
@@ -276,7 +512,7 @@ import {
   obtainChannelList,
   obtainChannelList,
   deleteChannel
   deleteChannel
 } from '@/api/channel'
 } from '@/api/channel'
-import {addDevice,obtainDeviceList} from '@/api/device'
+import { addDevice, obtainDeviceList } from '@/api/device'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { ElMessage, ElMessageBox } from 'element-plus'
 
 
 const activeName = ref('detail')
 const activeName = ref('detail')
@@ -287,11 +523,11 @@ const positionOperation = ref(0)
 const positionTitle = ref('岗亭新增')
 const positionTitle = ref('岗亭新增')
 // 岗亭数据.......................................
 // 岗亭数据.......................................
 const positionData = reactive({
 const positionData = reactive({
-  id:'',
-  booth_code:'',
-  booth_name:'',
-  ip_address:'',
-  description:''
+  id: '',
+  booth_code: '',
+  booth_name: '',
+  ip_address: '',
+  description: ''
 })
 })
 const guardTotal = ref(0)
 const guardTotal = ref(0)
 
 
@@ -316,7 +552,7 @@ const addPosition = () => {
   }
   }
 }
 }
 
 
-const openPosition = (head,data) => {
+const openPosition = (head, data) => {
   positionTitle.value = head
   positionTitle.value = head
   positionShow.value = true
   positionShow.value = true
   if (head === '岗亭编辑') {
   if (head === '岗亭编辑') {
@@ -359,55 +595,55 @@ const getGuardBoothList = () => {
 
 
 const delPosition = (id) => {
 const delPosition = (id) => {
   ElMessageBox.confirm(
   ElMessageBox.confirm(
-      '确定要删除该岗亭吗?',
-      '提示',
-      {
-        confirmButtonText: '确认',
-        cancelButtonText: '取消',
-        type: 'warning',
-      }
+    '确定要删除该岗亭吗?',
+    '提示',
+    {
+      confirmButtonText: '确认',
+      cancelButtonText: '取消',
+      type: 'warning',
+    }
   )
   )
-      .then(() => {
-        deleteGuardBooth(id).then(res => {
-          if (res.code === 0) {
-            ElMessage({
-              type: 'success',
-              message: '删除成功',
-            })
-            getGuardBoothList()
-          } else {
-            ElMessage({
-              type: 'error',
-              message: '删除失败',
-            })
-          }
-        })
+    .then(() => {
+      deleteGuardBooth(id).then(res => {
+        if (res.code === 0) {
+          ElMessage({
+            type: 'success',
+            message: '删除成功',
+          })
+          getGuardBoothList()
+        } else {
+          ElMessage({
+            type: 'error',
+            message: '删除失败',
+          })
+        }
       })
       })
-      .catch(() => {
-        ElMessage({
-          type: 'info',
-          message: '取消删除',
-        })
+    })
+    .catch(() => {
+      ElMessage({
+        type: 'info',
+        message: '取消删除',
       })
       })
+    })
 }
 }
 
 
 // 通道管理...................................................
 // 通道管理...................................................
-//通道数据
+// 通道数据
 const channelShow = ref(false)
 const channelShow = ref(false)
 const queryChannelData = reactive({
 const queryChannelData = reactive({
-  channel_code:'',
-  channel_name:'',
-  direction:'',
+  channel_code: '',
+  channel_name: '',
+  direction: '',
   page: 1,
   page: 1,
   page_size: 10,
   page_size: 10,
-  allow_temporary:false
+  allow_temporary: false
 })
 })
 
 
 const channelData = reactive({
 const channelData = reactive({
-  channel_code:'',
-  channel_name:'',
+  channel_code: '',
+  channel_name: '',
   direction: false,
   direction: false,
-  allow_temporary:'',
+  allow_temporary: '',
   description: false
   description: false
 })
 })
 
 
@@ -415,8 +651,7 @@ const channelTitle = ref('通道新增')
 
 
 const channelList = reactive([])
 const channelList = reactive([])
 
 
-
-const openChannel = (head,data) => {
+const openChannel = (head, data) => {
   channelTitle.value = head
   channelTitle.value = head
   channelShow.value = true
   channelShow.value = true
   if (head === '通道编辑') {
   if (head === '通道编辑') {
@@ -467,24 +702,25 @@ const getChannelList = () => {
   obtainChannelList(queryChannelData).then(res => {
   obtainChannelList(queryChannelData).then(res => {
     if (res.code === 0) {
     if (res.code === 0) {
       channelList.length = 0
       channelList.length = 0
+      console.log(res.data.list)
       channelList.push(...res.data.list)
       channelList.push(...res.data.list)
     }
     }
   })
   })
 }
 }
 
 
-//设备管理...............................................
+// 设备管理...............................................
 const deviceData = reactive({
 const deviceData = reactive({
-  device_code:'',
-  device_name:'',
-  device_type:'VLPR',
-  ip_address:'',
-  port:0,
-  description:''
+  device_code: '',
+  device_name: '',
+  device_type: 'VLPR',
+  ip_address: '',
+  port: 0,
+  description: ''
 })
 })
 
 
 const deviceShow = ref(false)
 const deviceShow = ref(false)
 
 
-const deviceVlprAdd = async () => {
+const deviceVlprAdd = async() => {
   await addDevice(deviceData).then(res => {
   await addDevice(deviceData).then(res => {
     if (res.code === 0) {
     if (res.code === 0) {
       ElMessage.success('添加成功')
       ElMessage.success('添加成功')
@@ -515,14 +751,14 @@ const searchDeviceData = reactive({
   page: 1,
   page: 1,
   page_size: 10
   page_size: 10
 })
 })
-const getDeviceList = async () => {
-  // await obtainDeviceList(searchDeviceData).then(res => {
-  //   if (res.code === 0) {
-  //     console.log('设备列表', res.data.list)
-  //     deviceList.length = 0
-  //     deviceList.push(...res.data.list)
-  //   }
-  // })
+const getDeviceList = async() => {
+  await obtainDeviceList(searchDeviceData).then(res => {
+    if (res.code === 0) {
+      console.log('设备列表', res.data.list)
+      deviceList.length = 0
+      deviceList.push(...res.data.list)
+    }
+  })
 }
 }
 
 
 onMounted(() => {
 onMounted(() => {