renmy 5 月之前
父节点
当前提交
ac517328d3

+ 8 - 0
common/http.js

@@ -217,4 +217,12 @@ export function editBattery(data) {
 //云端连接状态
 export function getSwapcloudConnState() {
 	return request.post("/swap/cloudConnState")
+}
+//绑定frid
+export function vehicleBind(data) {
+	return request.post("/vehicle/bind", data)
+}
+//读取frid
+export function getEpc() {
+	return request.post("/vehicle/getEpc")
 }

+ 5 - 1
components/PannelTitle/PannelTitle.vue

@@ -11,6 +11,7 @@
 		</view>
 		<view v-if="words=='车牌号'" @click="refresh" class="submit">刷新</view>
 		<view v-if="words=='在线车辆'" @click="handleCarShow" class="submit">查看</view>
+		<view v-if="words=='车辆识别'" @click="handleStatusShow" class="submit">查看</view>
 		<view class="btnBox">
 			<view class="submit" v-if="words=='解锁状态'" @click="HandlerDownLock">解锁</view>
 			<view class="submit unlock" v-if="words=='解锁状态'" @click="HandleOnLock">上锁</view>
@@ -32,7 +33,10 @@
 			ShowEditCar(plate) {
 				this.$emit('ShowCarline',plate)
 			},
-			//车牌号刷新
+			handleStatusShow() {
+				this.$emit('handleStatusShow')
+			},
+ 			//车牌号刷新
 			refresh(){
 				let that=this
 				uni.showModal({

+ 2 - 0
components/PublicDrawer/PublicDrawer.vue

@@ -32,6 +32,8 @@
 					this.$emit('AddCarinfo')
 				}else if(this.title=='编辑车辆'){
 					this.$emit('EditCarInfo')
+				}else if(this.title=='绑定FRID'){
+					this.$emit('BindFRIDHandle')
 				}
 				else if(this.title == '编辑车牌'){
 					//修改车牌号

+ 2 - 2
config.js

@@ -2,7 +2,7 @@ export default {
 	web_name: "智小狸",
 	// uni_app_web_api_url: "http://10.12.31.76:8080/api", //后端统一接口路径
 	// web_socket_url:'ws://10.12.31.76:8080/ws/',
-	uni_app_web_api_url: "http://192.168.3.177:8080/api",
-	web_socket_url:'ws://192.168.3.177:8080/ws/',
+	uni_app_web_api_url: "http://192.168.0.50:8080/api",
+	web_socket_url:'ws://192.168.0.50:8080/ws/',
 	debug: true
 }

+ 26 - 0
pages/basic-data/BasicDrawer.vue

@@ -10,6 +10,14 @@
 			<uni-forms-item label="电池距离:" name="CarDistance" label-align="right" label-width="120px">
 				<uni-easyinput type="text" v-model.trim="basicFrom.CarDistance" :clear="false" />
 			</uni-forms-item>
+			<uni-forms-item label="FRID:" name="rfidEpc" label-align="right" label-width="120px">
+				<uni-easyinput type="text" v-model.trim="basicFrom.rfidEpc" :clear="false" />
+				<uni-button style="margin-top: 10px;" @click="redHandle">读取</uni-button>
+			</uni-forms-item>
+			<uni-forms-item label="FRID:" name="epcFour" label-align="right" label-width="120px">
+				<uni-easyinput type="text" v-model.trim="basicFrom.epcFour" placeholder="请输入FRID后四位再次验证" :clear="false" />
+			</uni-forms-item>
+			
 			<!-- <uni-forms-item label="状态:" name="state" label-align="right" label-width="120px">
 				<uni-data-select v-model.trim="basicFrom.state" :localdata="range"
 					 :clear="false"></uni-data-select>
@@ -26,12 +34,26 @@
 		data() {
 			return {
 				// getbasicFrom:{}
+				dataForm: {}
+			}
+		},
+		watch: {
+			basicFrom: {
+				deep: true,
+				handler(val) {
+					console.log(val, 'val')
+					this.dataForm = val
+				}
 			}
 		},
 		methods:{
 			changeId(e) {
 				
 			},
+			//读取frid
+			redHandle() {
+				this.$emit('redHandle')
+			}
 		}
 	}
 </script>
@@ -53,4 +75,8 @@
 	::v-deep .uni-icons{
 		display: none;
 	}
+	.button {
+		width: 40px;
+		
+	}
 </style>

+ 82 - 0
pages/basic-data/BindDrawer.vue

@@ -0,0 +1,82 @@
+<template>
+	<view>
+		<uni-forms :modelValue="basicFrom">
+			<uni-forms-item label="车牌号:" name="CarPlate" label-align="right" label-width="120px">
+				<uni-easyinput type="text" v-model.trim="basicFrom.CarPlate" :disabled="true" :clear="false"/>
+			</uni-forms-item>
+			<uni-forms-item label="车辆识别码:" name="CarVin" label-align="right" label-width="120px">
+				<uni-easyinput type="text" v-model.trim="basicFrom.CarVin" :disabled="true" />
+			</uni-forms-item>
+			<uni-forms-item label="电池距离:" name="CarDistance" label-align="right" label-width="120px">
+				<uni-easyinput type="text" v-model.trim="basicFrom.CarDistance" :disabled="true" :clear="false" />
+			</uni-forms-item>
+			<uni-forms-item label="FRID:" name="frid" label-align="right" label-width="120px">
+				<uni-easyinput type="text" v-model.trim="basicFrom.frid" placeholder="点击下方按钮读取FRID卡号" :clear="false" />
+				<uni-button style="margin-top: 10px;" @click="redHandle">读取</uni-button>
+			</uni-forms-item>
+			<uni-forms-item label="FRID:" name="epcFour" label-align="right" label-width="120px">
+				<uni-easyinput type="text" v-model.trim="value" @input="inputHandle" placeholder="请输入FRID后四位再次验证" :clear="false" />
+			</uni-forms-item>
+		</uni-forms>
+	</view>
+	<!-- 剩个已充时长和落座信号没有对字段 -->
+</template>
+
+<script>
+	export default {
+		name: 'BasicDrawer',
+		props: ['basicFrom','range'],
+		data() {
+			return {
+				// getbasicFrom:{}
+				dataForm: {},
+				value: null,
+			}
+		},
+		watch: {
+			basicFrom: {
+				deep: true,
+				handler(val) {
+					this.dataForm = val
+				}
+			}
+		},
+		methods:{
+			changeId(e) {
+				
+			},
+			inputHandle(e) {
+				this.$emit('inputHandle', e)
+				// console.log(e, '111')
+				// this.basicFrom.epcFour = e.toUpperCase();
+			},
+			//读取frid
+			redHandle() {
+				this.$emit('redHandle')
+			}
+		}
+	}
+</script>
+<style lang="scss" scoped>
+	::v-deep .uni-forms-item__content {
+		background: rgba(255, 255, 255, 0);
+		// border-radius: 2px 2px 2px 2px;
+		// border: 1px solid #263042;
+
+		.uni-easyinput__content {
+			background: none !important;
+			border: none !important;
+			color: #fff;
+		}
+	}
+	::v-deep .uni-forms-item {
+		width: 100% !important;
+	}
+	::v-deep .uni-icons{
+		display: none;
+	}
+	.button {
+		width: 40px;
+		
+	}
+</style>

+ 9 - 0
pages/basic-data/baseData-table/baseDateTable.vue

@@ -58,6 +58,7 @@
 									<view @click="DelCangData(content)" v-if="isEdit===1">删除</view>
 									<view @click="EditBatteryData(content)" v-if="isEdit===2">编辑</view>
 									<view @click="DelBatteryData(content)" v-if="isEdit===2">删除</view>
+									<view @click="bindHandle(content)" v-if="isBind">绑定FRID</view>
 								</view>
 								<text v-else>{{content[header.key]||emptyString}}</text>
 							</template>
@@ -126,6 +127,10 @@
 				type: Boolean,
 				default: false
 			},
+			isBind: {
+				type: Boolean,
+				default: false
+			},
 			//固定首列 ver1.3.3弃用
 			/*firstColumnFixed: {
 			    type: Boolean,
@@ -292,6 +297,10 @@
 			DelBatteryData(row) {
 				this.$emit('DelBatteryData', row.id)
 			},
+			//绑定frid
+			bindHandle(row) {
+				this.$emit('bindHandle', row)
+			},
 			//点击排序表头时存储上次排序列名,并循环切换排序方式
 			doSort(item) {
 

+ 99 - 7
pages/basic-data/index.vue

@@ -32,7 +32,7 @@
 			</view>
 			<view class="basic-table">
 				<!-- <view class="search-btn marginZero" @click="OpenAddDrawer">新增</view> -->
-				<baseDateTable @DelCarData="DelCarData" @EditCarData="EditCarData" :headerFixed="true"
+				<baseDateTable @DelCarData="DelCarData" @EditCarData="EditCarData" @bindHandle="bindHandle" :isBind="true" :headerFixed="true"
 					:showLoadMore="showLoadMore" :loadMore="loadMore" :columnFixed=1 :contents="datalist" :headers="carheaders"
 					@onPullup="pullup">
 				</baseDateTable>
@@ -93,7 +93,7 @@
 					@AddCarinfo="AddCarinfo" @EditCarInfo="EditCarInfo">
 					<view class="drawer_main">
 						<view>
-							<BasicDrawer :basicFrom="basicFrom" :range="range"></BasicDrawer>
+							<BasicDrawer :basicFrom="basicFrom" :range="range" @redHandle="redHandle"></BasicDrawer>
 						</view>
 					</view>
 				</PublicDrawer>
@@ -119,6 +119,17 @@
 				</PublicDrawer>
 			</scroll-view>
 		</uni-drawer>
+		<uni-drawer ref="BindDrawer" mode="right" :width="400" :mask-click="true">
+			<scroll-view style="height: 100%;" scroll-y="true" v-if="isSelect===0">
+				<PublicDrawer :flag="false" :title="'绑定FRID'" @closeDrawer="closeDrawer" @BindFRIDHandle="BindFRIDHandle">
+					<view class="drawer_main">
+						<view>
+							<BindDrawer :basicFrom="basicFrom" :range="range" @redHandle="redHandle" @inputHandle="inputHandle"></BindDrawer>
+						</view>
+					</view>
+				</PublicDrawer>
+			</scroll-view>
+		</uni-drawer>
 		<!-- 右侧抽屉结束 -->
 		<!-- 顶部公共提示信息 -->
 		<uni-popup ref="Exchangepopup" type="message">
@@ -132,6 +143,7 @@
 	import baseDateTable from './baseData-table/baseDateTable'
 	import cangDateTable from './baseData-table/cangDateTable'
 	import BasicDrawer from './BasicDrawer'
+	import BindDrawer from './BindDrawer'
 	import ChargeDrawer from './ChargeDrawer'
 	import BatteryDrawer from './BatteryDrawer'
 	export default {
@@ -141,7 +153,8 @@
 			cangDateTable,
 			BasicDrawer,
 			ChargeDrawer,
-			BatteryDrawer
+			BatteryDrawer,
+			BindDrawer
 		},
 		data() {
 			return {
@@ -171,6 +184,9 @@
 					CarPlate: undefined,
 					CarVin: undefined,
 					state: undefined,
+					rfidEpc: undefined,
+					epcFour: undefined,
+					frid: undefined,
 				},
 				//充电机仓位抽屉
 				setForm:{
@@ -444,11 +460,15 @@
 				carheaders: [{
 					label: '车牌号',
 					key: 'vehiclePlate',
-					widtd: 210
+					widtd: 130
 				}, {
 					label: '车辆识别码(VIN码)',
 					key: 'vehicleVin',
-					widtd: 315
+					widtd: 225
+				}, {
+					label: 'FRID',
+					key: 'rfidEpc',
+					widtd: 255,
 				}, {
 					label: '前端电池距离(mm)',
 					key: 'modelDistance',
@@ -489,7 +509,6 @@
 			regTemp(e){
 				const reg=/^\d*$/
 				if(!reg.test(e.detail.value) || e.detail.value==0){
-					console.log(121212)
 					this.queryParamsSet.temp=90
 				}
 			},
@@ -545,6 +564,23 @@
 					}
 				});
 			},
+			//读取frid
+			redHandle() {
+				this.$http.getEpc().then((res) => {
+					if(res.code===0){
+						let frid = res.data
+						this.basicFrom.frid=frid.replace(/.{4}$/, '****')
+						this.basicFrom.rfidEpc=frid
+					} else {
+						return this.ExchangeMessage('warn', '未获取FRID卡号')
+					}
+				});
+			},
+			inputHandle(data) {
+				console.log(data.toUpperCase(), '000')
+				this.basicFrom.epcFour = data.toUpperCase()
+				console.log(this.basicFrom, '333')
+			},
 			//保存站控配置
 			handleSave(){
 				const reg=/^\d*$/
@@ -853,7 +889,6 @@
 			},
 			//打开编辑车辆抽屉
 			EditCarData(row) {
-				console.log(row)
 				this.dialogType = 'edit'
 				this.$refs.BasicDrawer.open();
 				this.basicFrom.CarDistance = row.modelDistance
@@ -862,6 +897,62 @@
 				this.basicFrom.state = row.state
 				this.basicFrom.id = row.id
 			},
+			//打开绑定frid
+			bindHandle(row) {
+				let _that = this
+				if(row.rfidEpc) {
+					uni.showModal({
+						title:`该车已经绑定FRID,是否继续绑定?`,
+						content:'',
+						success: function(res) {
+							if (res.confirm) {
+								_that.$refs.BindDrawer.open();
+								_that.basicFrom.CarDistance = row.modelDistance
+								_that.basicFrom.CarPlate = row.vehiclePlate
+								_that.basicFrom.CarVin = row.vehicleVin
+								_that.basicFrom.state = row.state
+								_that.basicFrom.id = row.id
+								_that.basicFrom.rfidEpc = row.rfidEpc
+								_that.basicFrom.frid = row.rfidEpc.replace(/.{4}$/, '****')
+							} else if (res.cancel) {
+								return false
+								//用户点击取消按钮触发
+							}
+						}
+					})
+				} else {
+					_that.$refs.BindDrawer.open();
+					_that.basicFrom.CarDistance = row.modelDistance
+					_that.basicFrom.CarPlate = row.vehiclePlate
+					_that.basicFrom.CarVin = row.vehicleVin
+					_that.basicFrom.state = row.state
+					_that.basicFrom.id = row.id
+					_that.basicFrom.rfidEpc = row.rfidEpc
+					_that.basicFrom.frid = row.rfidEpc.replace(/.{4}$/, '****')
+				}
+			},
+			//绑定建权
+			BindFRIDHandle() {
+				if (!this.basicFrom.rfidEpc || !this.basicFrom.epcFour) {
+					this.ExchangeMessage('warn', '请填写完整!')
+				} else {
+					const params = {
+						id: this.basicFrom.id,
+						rfidEpc: this.basicFrom.rfidEpc,
+						epcFour: this.basicFrom.epcFour
+					}
+					this.$http.vehicleBind(params)
+						.then(res => {
+							this.closeDrawer()
+							this.ExchangeMessage(res.code === 0 ? 'success' : 'error', res.msg)
+							if (res.code === 0) {
+								this.vehicleList()
+							}
+						}).catch(err => {
+							console.error(err)
+						})
+				}
+			},
 			//编辑车辆请求接口
 			EditCarInfo() {
 				if (!this.basicFrom.CarDistance || !this.basicFrom.CarPlate || !this.basicFrom.CarVin) {
@@ -982,6 +1073,7 @@
 			//关闭抽屉
 			closeDrawer() {
 				this.$refs.BasicDrawer.close();
+				this.$refs.BindDrawer.close();
 			},
 			//车辆触底加载数据
 			pullup() {

+ 61 - 4
pages/power-changer/index.vue

@@ -50,8 +50,8 @@
 								:flag="vehicleInfo.plateComState" />
 						</view>
 						<view class="carRight">
-							<PannelTitle words="车牌识别" :value="vehicleInfo.plateState ? '成功' : '未识别'"
-								:flag="vehicleInfo.plateComState" />
+							<PannelTitle words="车辆识别" :value="vehicleInfo.plateState == 1 ? '成功' : '未识别'"
+								:flag="vehicleInfo.plateState" @handleStatusShow="handleStatusShow"/>
 						</view>
 
 					</view>
@@ -234,6 +234,24 @@
 		<!-- 顶部公共提示信息 -->
 		<uni-popup ref="Exchangepopup" type="message">
 			<uni-popup-message :type="popupType" :message="popupMessage" :duration="2000"></uni-popup-message>
+		</uni-popup>
+		<uni-popup ref="popup" :mask-click="false">
+			<view class="popup-container">
+				<view class="popup-title">
+					<view class="title-text">
+						车辆识别设备网络
+					</view>
+					<view class="title-close" @click="closePopup">
+						关闭
+					</view>
+				</view>
+				<view class="popup-content">
+					<PannelTitle words="车牌识别器" :value="vehicleInfo.plateComState == 1 ? '已连接' : '未连接'" :flag="vehicleInfo.plateComState"/>
+				</view>
+				<view class="popup-content">
+					<PannelTitle words="FRID识别器" :value="vehicleInfo.rfidConnState ? '已连接' : '未连接'" :flag="vehicleInfo.rfidConnState"/>
+				</view>
+			</view>
 		</uni-popup>
 		<!-- 顶部提示信息结束-->
 		<!--在线、编辑车辆抽屉 -->
@@ -436,7 +454,12 @@
 			},
 		},
 		methods: {
-
+			handleStatusShow() {
+				this.$refs.popup.open('center');
+			},
+			closePopup() {
+				this.$refs.popup.close();
+			},
 			//修改车牌号提交
 			HandleEditPlate(plate) {
 				let that = this
@@ -898,7 +921,41 @@
 </script>
 <style lang="scss" scoped>
 	@import './index.scss';
-
+	.popup-container {
+		width: 300px;
+		height: 200px;
+		background: #263042;
+		.popup-title {
+			height: 60px;
+			display: flex;
+			padding: 0 15px;
+			border-bottom: 1px solid #C7D2DF;
+			position: relative;
+			.title-text {
+				text-align: left;
+				background: #263042;
+				font-weight: 500;
+				color: #FFFFFF;
+				font-size: 20px;
+				line-height: 60px;
+				width: 200px;
+			}
+			.title-close {
+				text-align: right;
+				background: #263042;
+				font-weight: 500;
+				color: #FFFFFF;
+				font-size: 20px;
+				line-height: 60px;
+				width: 60px;
+			}
+		}
+		.popup-content {
+			display: flex;
+			margin-top: 20px;
+			padding: 0 20px 0 10px;
+		}
+	}
 	.carPosition {
 		// margin-top: 76px;