From 017a241821f3b94a7c29f857f248c96008bfce77 Mon Sep 17 00:00:00 2001 From: ddisfriend Date: Fri, 17 Oct 2025 17:01:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E6=8E=A7=E6=98=BE=E7=A4=BA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HttpRequestCenter/ApiList.swift | 2 + .../HttpRequestCenter/ParametersList.swift | 7 ++ .../HttpRequestCenter/RequestList.swift | 4 + .../HttpResponseModel/ResponseModel.swift | 16 ++-- .../Rescue/View/AcceptOrderView.swift | 1 - .../VehicleMonitoringController.swift | 88 +++++++++++-------- 6 files changed, 73 insertions(+), 45 deletions(-) diff --git a/OrderScheduling/HttpRequestCenter/ApiList.swift b/OrderScheduling/HttpRequestCenter/ApiList.swift index 33c0bf9..9829aa3 100644 --- a/OrderScheduling/HttpRequestCenter/ApiList.swift +++ b/OrderScheduling/HttpRequestCenter/ApiList.swift @@ -85,4 +85,6 @@ open class ApiList { public let onlineReminder = "/supplierAppV2/dispatchApp/alarm/onlineReminder" public let onlineReminderRead = "/supplierAppV2/dispatchApp/alarm/onlineReminderRead" + + public let vehicleMonitorInfo = "/supplierAppV2/dispatchApp/order/vehicleMonitorInfo" } diff --git a/OrderScheduling/HttpRequestCenter/ParametersList.swift b/OrderScheduling/HttpRequestCenter/ParametersList.swift index b02a631..d9f0621 100644 --- a/OrderScheduling/HttpRequestCenter/ParametersList.swift +++ b/OrderScheduling/HttpRequestCenter/ParametersList.swift @@ -275,3 +275,10 @@ public struct OnlineReminderParameters : Encodable { public struct OnlineReminderReadParameters : Encodable { var id : Int? } + +public struct VehicleMonitorInfoParameters : Encodable { + var vehicleId : Int? + var lon : String? + var lat : String? + var code : String? +} diff --git a/OrderScheduling/HttpRequestCenter/RequestList.swift b/OrderScheduling/HttpRequestCenter/RequestList.swift index 671a51b..8ef4e9e 100644 --- a/OrderScheduling/HttpRequestCenter/RequestList.swift +++ b/OrderScheduling/HttpRequestCenter/RequestList.swift @@ -176,4 +176,8 @@ open class RequestList { func onlineReminderRead(parameters:P) -> Single?> { return DDAF.get(urlString: HOST+API.onlineReminderRead,parameters: parameters,encoding: URLEncodedFormParameterEncoder.default,headers: [tokenHeader()],responseType: ResponseModel.self) } + + func vehicleMonitorInfo(parameters:P) -> Single?> { + return DDAF.post(urlString: HOST+API.vehicleMonitorInfo,parameters: parameters,encoding: JSONParameterEncoder.default,headers: [tokenHeader()],responseType: ResponseModel.self) + } } diff --git a/OrderScheduling/HttpResponseModel/ResponseModel.swift b/OrderScheduling/HttpResponseModel/ResponseModel.swift index 377aff3..7371c3b 100644 --- a/OrderScheduling/HttpResponseModel/ResponseModel.swift +++ b/OrderScheduling/HttpResponseModel/ResponseModel.swift @@ -232,11 +232,9 @@ public class VehicleMonitorListDataModel : Decodable { var destinationLongitude : Double? var destinationLatitude : Double? var destinationAddress : String? - var leftTimeB : Double? - var leftTimeC : Double? - var distance : Double? - var mileageBc : Double? - var contractName : String? } + var lat : String? + var lon : String? + } } public class OrderPhotoListDataModel : Decodable { @@ -414,3 +412,11 @@ public class GetAppealDataModel : Decodable { public class SaveAppealModel : Decodable { } + +public class VehicleMonitorInfoDataModel : Decodable { + var leftTimeB : Double? + var leftTimeC : Double? + var distance : Double? + var mileageBc : Double? + var contractName : String? +} diff --git a/OrderScheduling/Rescue/View/AcceptOrderView.swift b/OrderScheduling/Rescue/View/AcceptOrderView.swift index 376eba3..bfad9d6 100644 --- a/OrderScheduling/Rescue/View/AcceptOrderView.swift +++ b/OrderScheduling/Rescue/View/AcceptOrderView.swift @@ -43,7 +43,6 @@ open class AcceptOrderView : DDView { horizontalLine.backgroundColor = .hex("979797").alpha(0.35) radiusView.addSubview(horizontalLine) verticalLine.backgroundColor = .hex("979797").alpha(0.35) - verticalLine.isHidden = true radiusView.addSubview(verticalLine) readButton.titleLabel?.font = .mediumFont(auto(14)) readButton.backgroundColor = .white diff --git a/OrderScheduling/VehicleMonitoring/ViewController/VehicleMonitoringController.swift b/OrderScheduling/VehicleMonitoring/ViewController/VehicleMonitoringController.swift index 00f23fb..7a5f4cd 100644 --- a/OrderScheduling/VehicleMonitoring/ViewController/VehicleMonitoringController.swift +++ b/OrderScheduling/VehicleMonitoring/ViewController/VehicleMonitoringController.swift @@ -1633,6 +1633,7 @@ class VMLDContainerView : DDView , JXCategoryListContentViewDelegate { var distanceFromPointLabel : DDLabel var remainTimeLabel : DDLabel var distanceLabel : DDLabel + var disposeBag : DisposeBag override init(frame: CGRect) { orderNumButton = UIButton() orderNumButton.setTitleColor(.hex("0E76F4"), for: .normal) @@ -1650,6 +1651,7 @@ class VMLDContainerView : DDView , JXCategoryListContentViewDelegate { distanceFromPointLabel = DDLabel() remainTimeLabel = DDLabel() distanceLabel = DDLabel() + disposeBag = DisposeBag() super.init(frame: frame) addSubview(orderNumButton) @@ -1772,45 +1774,53 @@ class VMLDContainerView : DDView , JXCategoryListContentViewDelegate { stateLabel.text = taskModel.taskStatusString incidentLabel.text = taskModel.vehiclePointAddress destLabel.text = taskModel.destinationAddress - if let contractName = taskModel.contractName { - contractContent.text = contractName - contractTitle.text = "合同:" - contractImageView.image = UIImage(named: "vehichleMonitoring_contract_16") - }else{ - contractContent.text = nil - contractTitle.text = nil - contractImageView.image = nil - } - var point = "" - var leftTime : Int? = nil - if let leftTimeB = taskModel.leftTimeB { - point = "B" - leftTime = Int(leftTimeB) - }else if let leftTimeC = taskModel.leftTimeC { - point = "C" - leftTime = Int(leftTimeC) - } - let distanceFromPointAttributeString = NSMutableAttributedString(string: "距离\(point)点: ",attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)]) - if let distance = taskModel.distance { - distanceFromPointAttributeString.append(NSMutableAttributedString(string: "\(distance)", attributes: [.foregroundColor : UIColor.hex("F93D3D"),.font : UIFont.regularFont(12)])) - distanceFromPointAttributeString.append(NSMutableAttributedString(string: "km", attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)])) - distanceFromPointLabel.attributedText = distanceFromPointAttributeString - } - - let leftTimeAttributeString = NSMutableAttributedString(string: "剩余时间: ",attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)]) - if let leftTime { - leftTimeAttributeString.append(NSMutableAttributedString(string: "\(leftTime)", attributes: [.foregroundColor : UIColor.hex("F93D3D"),.font : UIFont.regularFont(12)])) - leftTimeAttributeString.append(NSMutableAttributedString(string: "分", attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)])) - remainTimeLabel.attributedText = leftTimeAttributeString - } - - let bcAttributeString = NSMutableAttributedString(string: "BC: ",attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)]) - if let mileageBc = taskModel.mileageBc { - bcAttributeString.append(NSMutableAttributedString(string: "\(mileageBc)", attributes: [.foregroundColor : UIColor.hex("F93D3D"),.font : UIFont.regularFont(12)])) - bcAttributeString.append(NSMutableAttributedString(string: "km", attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)])) - distanceLabel.attributedText = bcAttributeString - } - + RQ.vehicleMonitorInfo(parameters: VehicleMonitorInfoParameters(vehicleId: taskModel.taskVehicleId,lon: taskModel.lon,lat: taskModel.lat,code: taskModel.orderCode)) + .observe(on: MainScheduler.instance) + .subscribe(onSuccess: {[weak self] response in + guard let self = self else { return } + if let contractName = response?.data?.contractName { + self.contractContent.text = contractName + self.contractTitle.text = "合同:" + self.contractImageView.image = UIImage(named: "vehichleMonitoring_contract_16") + }else{ + self.contractContent.text = nil + self.contractTitle.text = nil + self.contractImageView.image = nil + } + var point : String? = nil + var leftTime : Int? = nil + if let leftTimeB = response?.data?.leftTimeB,leftTimeB > 0 { + point = "B" + leftTime = Int(leftTimeB) + }else if let leftTimeC = response?.data?.leftTimeC,leftTimeC > 0 { + point = "C" + leftTime = Int(leftTimeC) + } + + if let point, let distance = response?.data?.distance { + let distanceFromPointAttributeString = NSMutableAttributedString(string: "距离\(point)点: ",attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)]) + distanceFromPointAttributeString.append(NSMutableAttributedString(string: "\(distance)", attributes: [.foregroundColor : UIColor.hex("F93D3D"),.font : UIFont.regularFont(12)])) + distanceFromPointAttributeString.append(NSMutableAttributedString(string: "km", attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)])) + self.distanceFromPointLabel.attributedText = distanceFromPointAttributeString + } + + let leftTimeAttributeString = NSMutableAttributedString(string: "剩余时间: ",attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)]) + if let _ = point, let leftTime { + leftTimeAttributeString.append(NSMutableAttributedString(string: "\(leftTime)", attributes: [.foregroundColor : UIColor.hex("F93D3D"),.font : UIFont.regularFont(12)])) + leftTimeAttributeString.append(NSMutableAttributedString(string: "分", attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)])) + self.remainTimeLabel.attributedText = leftTimeAttributeString + } + + let bcAttributeString = NSMutableAttributedString(string: "BC: ",attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)]) + if let mileageBc = response?.data?.mileageBc { + bcAttributeString.append(NSMutableAttributedString(string: "\(mileageBc)", attributes: [.foregroundColor : UIColor.hex("F93D3D"),.font : UIFont.regularFont(12)])) + bcAttributeString.append(NSMutableAttributedString(string: "km", attributes: [.foregroundColor : UIColor.hex("11142F"),.font : UIFont.regularFont(12)])) + self.distanceLabel.attributedText = bcAttributeString + } + + }) + .disposed(by: disposeBag) + } func listView() -> UIView! {