mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-02-25 06:09:11 +08:00
优化代码
This commit is contained in:
parent
5db9aeb481
commit
c7a5cbbac2
8
app.js
8
app.js
@ -40,6 +40,14 @@ app.use('/ws', createProxyMiddleware({
|
||||
ws: true
|
||||
}));
|
||||
|
||||
// app.use('/callComponent', proxy('http://ynwyht.dk55.com:8008', opts));
|
||||
// app.use('/app', proxy('http://ynwyht.dk55.com:8008', opts));
|
||||
// app.use('/ws', createProxyMiddleware({
|
||||
// target: 'http://ynwyht.dk55.com:8008',
|
||||
// changeOrigin: true,
|
||||
// ws: true
|
||||
// }));
|
||||
|
||||
// app.use('/callComponent', proxy('http://127.0.0.1:8008', opts));
|
||||
// app.use('/app', proxy('http://127.0.0.1:8008', opts));
|
||||
// app.use('/ws',proxy('http://127.0.0.1:8008',opts));
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<div class="row">
|
||||
<div class="col-md-1 ">
|
||||
<div class="vc-line-y"></div>
|
||||
<!-- <div class="vc-line-y-primary"></div> -->
|
||||
</div>
|
||||
<div class="col-md-11">
|
||||
|
||||
<div >
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<h3><span>
|
||||
<vc:i18n name="收费信息" namespace="parkingAreaControlFee"></vc:i18n>
|
||||
@ -15,8 +15,7 @@
|
||||
<vc:i18n name="收费车辆" namespace="parkingAreaControlFee"></vc:i18n>
|
||||
</span></label>
|
||||
<div class="">
|
||||
<input v-model="parkingAreaControlFeeInfo.feeCarNum" disabled="disabled" type="text"
|
||||
:placeholder="vc.i18n('车牌号','parkingAreaControlFee')" class="form-control">
|
||||
<input v-model="parkingAreaControlFeeInfo.feeCarNum" disabled="disabled" type="text" :placeholder="vc.i18n('车牌号','parkingAreaControlFee')" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group margin-bottom-xs">
|
||||
@ -24,8 +23,7 @@
|
||||
<vc:i18n name="停车时间" namespace="parkingAreaControlFee"></vc:i18n>
|
||||
</span></label>
|
||||
<div class="">
|
||||
<input v-model="parkingAreaControlFeeInfo.costMin" disabled="disabled" type="text"
|
||||
:placeholder="vc.i18n('停车时间','parkingAreaControlFee')" class="form-control">
|
||||
<input v-model="parkingAreaControlFeeInfo.costMin" disabled="disabled" type="text" :placeholder="vc.i18n('停车时间','parkingAreaControlFee')" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group margin-bottom-xs">
|
||||
@ -33,8 +31,7 @@
|
||||
<vc:i18n name="应收" namespace="parkingAreaControlFee"></vc:i18n>
|
||||
</span></label>
|
||||
<div class="">
|
||||
<input v-model="parkingAreaControlFeeInfo.payCharge" type="text" disabled="disabled"
|
||||
:placeholder="vc.i18n('应收','parkingAreaControlFee')" class="form-control">
|
||||
<input v-model="parkingAreaControlFeeInfo.payCharge" type="text" disabled="disabled" :placeholder="vc.i18n('应收','parkingAreaControlFee')" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -42,29 +39,31 @@
|
||||
<button class="btn btn-white" type="button" v-on:click="_showInParkingAreaQrCode()"><span>
|
||||
<vc:i18n name="场内二维码" namespace="parkingAreaControlFee"></vc:i18n>
|
||||
</span></button>
|
||||
<button class="btn btn-primary" type="button" :disabled="parkingAreaControlFeeInfo.pay==0"
|
||||
v-on:click="saveTempFeeInfo()"><span>
|
||||
<button class="btn btn-primary" type="button" :disabled="parkingAreaControlFeeInfo.pay==0" v-on:click="saveTempFeeInfo()"><span>
|
||||
<vc:i18n name="临时车收费" namespace="parkingAreaControlFee"></vc:i18n>
|
||||
</span></button>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 30px;">
|
||||
<div style="margin-top: 30px;min-height: 300px;">
|
||||
<div>
|
||||
<h3><span>
|
||||
<vc:i18n name="开门信息" namespace="parkingAreaControlFee"></vc:i18n>
|
||||
</span></h3>
|
||||
</div>
|
||||
<div class="form-group margin-top " style="font-size: 14px;" v-if="parkingAreaControlFeeInfo.carInoutInfos.length>0">
|
||||
<div v-for="(item,index) in parkingAreaControlFeeInfo.carInoutInfos" class="margin-bottom-xs">
|
||||
<div class="form-group margin-top " style="font-size: 16px;" v-if="parkingAreaControlFeeInfo.carInoutInfos.length>0">
|
||||
<div v-for="(item,index) in parkingAreaControlFeeInfo.carInoutInfos" class="margin-bottom-sm border-bottom padding-bottom-xs">
|
||||
<span>{{item.inOutTime}}</span>
|
||||
<span>{{item.carNum}}</span>
|
||||
<span v-if="item.inoutType == '1001'">进场</span>
|
||||
<span v-else>出场</span>
|
||||
<span>{{item.open}};</span>
|
||||
<span>{{item.openMsg}}</span>
|
||||
<span v-if="item.payCharge>0 && item.inoutType == '2002'">
|
||||
(<a href="javascript:void(0)" @click="_parkingAreaControlFeeArrayCarOut(item)">出场</a>)
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group margin-top margin-bottom-xs" style="font-size: 14px;" v-else>
|
||||
<div class="form-group margin-top margin-bottom-xs" style="font-size: 16px;" v-else>
|
||||
<div>
|
||||
<span>没有进出场车辆</span>
|
||||
</div>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
boxId: '',
|
||||
feeCarNum: '',
|
||||
costMin: '',
|
||||
carInoutInfos:[]
|
||||
carInoutInfos: []
|
||||
}
|
||||
},
|
||||
_initMethod: function() {
|
||||
@ -32,37 +32,39 @@
|
||||
let _machineId = $that.parkingAreaControlFeeInfo.outMachineId;
|
||||
//进场覆盖问题
|
||||
let _oldPayCharge = $that.parkingAreaControlFeeInfo.payCharge;
|
||||
vc.copyObject(_data, $that.parkingAreaControlFeeInfo);
|
||||
//vc.copyObject(_data, $that.parkingAreaControlFeeInfo);
|
||||
$that.parkingAreaControlFeeInfo.openMsg = _data.remark;
|
||||
|
||||
//出场摄像头
|
||||
let _inoutType = "2002";
|
||||
if (_machineId == _data.extMachineId) {
|
||||
vc.emit('parkingAreaControlVideo', 'carOut',$that.parkingAreaControlFeeInfo);
|
||||
vc.emit('parkingAreaControlVideo', 'carOut', _data);
|
||||
$that.parkingAreaControlFeeInfo.feeCarNum = _data.carNum;
|
||||
$that.parkingAreaControlFeeInfo.costMin = _data.hours + "小时" + _data.min + "分钟"
|
||||
$that.parkingAreaControlFeeInfo.pay = _data.payCharge;
|
||||
$that.parkingAreaControlFeeInfo.payCharge = _data.payCharge;
|
||||
$that.parkingAreaControlFeeInfo.remark = '';
|
||||
} else {
|
||||
vc.emit('parkingAreaControlVideo', 'carIn',$that.parkingAreaControlFeeInfo);
|
||||
vc.emit('parkingAreaControlVideo', 'carIn', _data);
|
||||
$that.parkingAreaControlFeeInfo.payCharge = _oldPayCharge;
|
||||
_inoutType = "1001";
|
||||
}
|
||||
|
||||
$that.parkingAreaControlFeeInfo.carInoutInfos.unshift({
|
||||
carNum:_data.carNum,
|
||||
inOutTime:_data.inOutTime,
|
||||
open:_data.open,
|
||||
openMsg:_data.remark,
|
||||
inoutType:_inoutType
|
||||
let _carInoutInfos = $that.parkingAreaControlFeeInfo.carInoutInfos.reverse();
|
||||
|
||||
_carInoutInfos.push({
|
||||
carNum: _data.carNum,
|
||||
inOutTime: _data.inOutTime,
|
||||
open: _data.open,
|
||||
openMsg: _data.remark,
|
||||
inoutType: _inoutType,
|
||||
payCharge: _data.payCharge
|
||||
});
|
||||
|
||||
if($that.parkingAreaControlFeeInfo.carInoutInfos.length > 10){
|
||||
$that.parkingAreaControlFeeInfo.carInoutInfos.pop();
|
||||
_carInoutInfos = _carInoutInfos.reverse();
|
||||
if (_carInoutInfos.length > 10) {
|
||||
_carInoutInfos.pop();
|
||||
}
|
||||
|
||||
|
||||
$that.parkingAreaControlFeeInfo.carInoutInfos = _carInoutInfos;
|
||||
|
||||
});
|
||||
vc.on('parkingAreaControlFee', 'changeMachine', function(_data) {
|
||||
@ -85,9 +87,20 @@
|
||||
boxId: $that.parkingAreaControlFeeInfo.boxId,
|
||||
})
|
||||
},
|
||||
|
||||
_parkingAreaControlFeeArrayCarOut: function(item) {
|
||||
vc.emit('parkingAreaControlCustomCarInout', 'open', {
|
||||
type: "1102", //1101 手动入场 1102 手动出场
|
||||
carNum: item.carNum,
|
||||
machineId: $that.parkingAreaControlFeeInfo.outMachineId,
|
||||
boxId: $that.parkingAreaControlFeeInfo.boxId,
|
||||
})
|
||||
},
|
||||
|
||||
clearParkingAreaControlFeeInfo: function() {
|
||||
let _machineId = $that.parkingAreaControlFeeInfo.outMachineId;
|
||||
let _boxId = $that.parkingAreaControlFeeInfo.boxId;
|
||||
let _carInoutInfos = $that.parkingAreaControlFeeInfo.carInoutInfos;
|
||||
|
||||
$that.parkingAreaControlFeeInfo = {
|
||||
carNum: "",
|
||||
@ -100,7 +113,8 @@
|
||||
outMachineId: _machineId,
|
||||
boxId: _boxId,
|
||||
feeCarNum: '',
|
||||
costMin: ''
|
||||
costMin: '',
|
||||
carInoutInfos: _carInoutInfos
|
||||
}
|
||||
},
|
||||
_showInParkingAreaQrCode: function() {
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
<option :value="item.machineId"
|
||||
v-for="(item,index) in parkingAreaControlVideoInfo.outMachines">{{item.machineName}}
|
||||
</option>
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group row">
|
||||
@ -66,12 +66,12 @@
|
||||
<div id="receiver1Div" style="border: 1px solid #dee2e6;">
|
||||
<img width="100%" src="../../../img/init.jpg" height="300px" id="receiver1" style="border: 1;" />
|
||||
</div>
|
||||
<div class="margin-top-sm margin-left-sm" style="font-size: 14px;" v-if="parkingAreaControlVideoInfo.inMachineInfo.carNum">
|
||||
<div class="margin-top-sm margin-left-sm" style="font-size: 14px;" v-if="parkingAreaControlVideoInfo.inMachineCarNum">
|
||||
<span class="fa fa-bell" style="color: #007bff;"></span>
|
||||
<span>{{parkingAreaControlVideoInfo.inMachineInfo.inOutTime}}</span>
|
||||
<span>{{parkingAreaControlVideoInfo.inMachineInfo.carNum}}</span>
|
||||
<span>{{parkingAreaControlVideoInfo.inMachineInfo.open}};</span>
|
||||
<span>{{parkingAreaControlVideoInfo.inMachineInfo.openMsg}}</span>
|
||||
<span>{{parkingAreaControlVideoInfo.inMachineInOutTime}}</span>
|
||||
<!-- <span>{{parkingAreaControlVideoInfo.inMachineCarNum}}</span> -->
|
||||
<span>{{parkingAreaControlVideoInfo.inMachineOpen}};</span>
|
||||
<span>{{parkingAreaControlVideoInfo.inMachineOpenMsg}}</span>
|
||||
</div>
|
||||
<div class="margin-top-sm margin-left-sm" style="font-size: 14px;" v-else>
|
||||
<span class="fa fa-bell" style="color: #007bff;"></span>
|
||||
@ -82,12 +82,12 @@
|
||||
<div id="receiver2Div" style="border: 1px solid #dee2e6;">
|
||||
<img width="100%" src="../../../img/init.jpg" height="300px" id="receiver2" />
|
||||
</div>
|
||||
<div class="margin-top-sm margin-left-sm" style="font-size: 14px;" v-if="parkingAreaControlVideoInfo.outMachineInfo.carNum">
|
||||
<div class="margin-top-sm margin-left-sm" style="font-size: 14px;" v-if="parkingAreaControlVideoInfo.outMachineCarNum">
|
||||
<span class="fa fa-bell" style="color: #007bff;"></span>
|
||||
<span>{{parkingAreaControlVideoInfo.outMachineInfo.inOutTime}}</span>
|
||||
<span>{{parkingAreaControlVideoInfo.outMachineInfo.carNum}}</span>
|
||||
<span>{{parkingAreaControlVideoInfo.outMachineInfo.open}};</span>
|
||||
<span>{{parkingAreaControlVideoInfo.outMachineInfo.openMsg}}</span>
|
||||
<span>{{parkingAreaControlVideoInfo.outMachineInOutTime}}</span>
|
||||
<!-- <span>{{parkingAreaControlVideoInfo.outMachineCarNum}}</span> -->
|
||||
<span>{{parkingAreaControlVideoInfo.outMachineOpen}};</span>
|
||||
<span>{{parkingAreaControlVideoInfo.outMachineOpenMsg}}</span>
|
||||
</div>
|
||||
<div class="margin-top-sm margin-left-sm" style="font-size: 14px;" v-else>
|
||||
<span class="fa fa-bell" style="color: #007bff;"></span>
|
||||
|
||||
@ -10,18 +10,16 @@
|
||||
outMachineId: '',
|
||||
inMachines: [],
|
||||
outMachines: [],
|
||||
inMachineInfo:{
|
||||
carNum:'',
|
||||
inOutTime:'',
|
||||
open:'',
|
||||
openMsg:''
|
||||
},
|
||||
outMachineInfo:{
|
||||
carNum:'',
|
||||
inOutTime:'',
|
||||
open:'',
|
||||
openMsg:''
|
||||
}
|
||||
|
||||
inMachineCarNum: '',
|
||||
inMachineInOutTime: '',
|
||||
inMachineOpen: '',
|
||||
inMachineOpenMsg: '',
|
||||
outMachineCarNum: '',
|
||||
outMachineInOutTime: '',
|
||||
outMachineOpen: '',
|
||||
outMachineOpenMsg: ''
|
||||
|
||||
}
|
||||
},
|
||||
_initMethod: function() {
|
||||
@ -36,11 +34,17 @@
|
||||
});
|
||||
|
||||
vc.on('parkingAreaControlVideo', 'carIn', function(param) {
|
||||
vc.copyObject(param,$that.parkingAreaControlVideoInfo.inMachineInfo);
|
||||
$that.parkingAreaControlVideoInfo.inMachineCarNum = param.carNum;
|
||||
$that.parkingAreaControlVideoInfo.inMachineInOutTime = param.inOutTime;
|
||||
$that.parkingAreaControlVideoInfo.inMachineOpen = param.open;
|
||||
$that.parkingAreaControlVideoInfo.inMachineOpenMsg = param.remark;
|
||||
});
|
||||
|
||||
vc.on('parkingAreaControlVideo', 'carOut', function(param) {
|
||||
vc.copyObject(param,$that.parkingAreaControlVideoInfo.outMachineInfo);
|
||||
$that.parkingAreaControlVideoInfo.outMachineCarNum = param.carNum;
|
||||
$that.parkingAreaControlVideoInfo.outMachineInOutTime = param.inOutTime;
|
||||
$that.parkingAreaControlVideoInfo.outMachineOpen = param.open;
|
||||
$that.parkingAreaControlVideoInfo.outMachineOpenMsg = param.remark;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
@ -151,7 +155,7 @@
|
||||
boxId: $that.parkingAreaControlVideoInfo.boxId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
let paId = "";
|
||||
$that.parkingAreaControlVideoInfo.outMachines.forEach((item) => {
|
||||
|
||||
@ -2167,6 +2167,12 @@ table.table-mail tr td {
|
||||
background: -webkit-linear-gradient(left, #fff -4%, #007bff 50%, #fff 100%);
|
||||
}
|
||||
|
||||
.vc-line-y-primary {
|
||||
width: 2px;
|
||||
height: 100%;
|
||||
background: -webkit-linear-gradient(top, #fff -4%, #007bff 50%, #fff 100%);
|
||||
}
|
||||
|
||||
.vc-table-border {
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/**
|
||||
入驻小区
|
||||
**/
|
||||
(function (vc) {
|
||||
(function(vc) {
|
||||
vc.extends({
|
||||
data: {
|
||||
parkingAreaControlInfo: {
|
||||
@ -11,38 +11,38 @@
|
||||
outMachineId: ''
|
||||
}
|
||||
},
|
||||
_initMethod: function () {
|
||||
_initMethod: function() {
|
||||
$that.parkingAreaControlInfo.boxId = vc.getParam('boxId');
|
||||
$that._initParkingAreaWs();
|
||||
vc.emit('parkingAreaControlVideo', 'notify', {
|
||||
boxId: $that.parkingAreaControlInfo.boxId
|
||||
});
|
||||
},
|
||||
_initEvent: function () {
|
||||
vc.on('parkingAreaControl', 'notify', function (_param) {
|
||||
_initEvent: function() {
|
||||
vc.on('parkingAreaControl', 'notify', function(_param) {
|
||||
vc.copyObject(_param, $that.parkingAreaControlInfo);
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
changeTab: function (_tab) {
|
||||
changeTab: function(_tab) {
|
||||
$that.parkingAreaControlInfo._currentTab = _tab;
|
||||
vc.emit(_tab, 'switch', {
|
||||
boxId: $that.parkingAreaControlInfo.boxId
|
||||
})
|
||||
},
|
||||
_initParkingAreaWs: function () {
|
||||
_initParkingAreaWs: function() {
|
||||
let clientId = vc.uuid();
|
||||
let heartCheck = {
|
||||
timeout: 30000, // 9分钟发一次心跳,比server端设置的连接时间稍微小一点,在接近断开的情况下以通信的方式去重置连接时间。
|
||||
serverTimeoutObj: null,
|
||||
pingTime: new Date().getTime(),
|
||||
reset: function () {
|
||||
reset: function() {
|
||||
clearTimeout(this.serverTimeoutObj);
|
||||
return this;
|
||||
},
|
||||
start: function () {
|
||||
start: function() {
|
||||
let self = this;
|
||||
this.serverTimeoutObj = setInterval(function () {
|
||||
this.serverTimeoutObj = setInterval(function() {
|
||||
if (websocket.readyState == 1) {
|
||||
console.log("连接状态,发送消息保持连接");
|
||||
let _pingTime = new Date().getTime();
|
||||
@ -72,7 +72,7 @@
|
||||
"ws://" + window.location.host + "/ws/parkingArea/" +
|
||||
$that.parkingAreaControlInfo.boxId + "/" + clientId;
|
||||
// url =
|
||||
// "ws://demo.homecommunity.cn:9011/ws/parkingArea/" +
|
||||
// "ws://demo.homecommunity.cn:8008/ws/parkingArea/" +
|
||||
// $that.parkingAreaControlInfo.boxId + "/" + clientId;
|
||||
}
|
||||
if ("WebSocket" in window) {
|
||||
@ -83,7 +83,7 @@
|
||||
websocket = new SockJS(url);
|
||||
}
|
||||
//连接发生错误的回调方法
|
||||
websocket.onerror = function (_err) {
|
||||
websocket.onerror = function(_err) {
|
||||
console.log("初始化失败", _err);
|
||||
this.$notify.error({
|
||||
title: "错误",
|
||||
@ -91,12 +91,12 @@
|
||||
});
|
||||
};
|
||||
//连接成功建立的回调方法
|
||||
websocket.onopen = function () {
|
||||
websocket.onopen = function() {
|
||||
heartCheck.reset().start();
|
||||
console.log("ws初始化成功");
|
||||
};
|
||||
//接收到消息的回调方法
|
||||
websocket.onmessage = function (event) {
|
||||
websocket.onmessage = function(event) {
|
||||
heartCheck.reset().start();
|
||||
console.log("event", event);
|
||||
let _data = event.data;
|
||||
@ -112,7 +112,7 @@
|
||||
vc.emit('parkingAreaControlFee', 'notify', _data);
|
||||
};
|
||||
//连接关闭的回调方法
|
||||
websocket.onclose = function () {
|
||||
websocket.onclose = function() {
|
||||
console.log("初始化失败");
|
||||
//$that._initParkingAreaWs();
|
||||
this.$notify.error({
|
||||
@ -121,7 +121,7 @@
|
||||
});
|
||||
};
|
||||
//监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。
|
||||
window.onbeforeunload = function () {
|
||||
window.onbeforeunload = function() {
|
||||
websocket.close();
|
||||
};
|
||||
}
|
||||
|
||||
@ -1399,6 +1399,18 @@
|
||||
}
|
||||
};
|
||||
|
||||
vcFramework.copyArray = function(org) {
|
||||
let res = []
|
||||
if (!org) {
|
||||
return res;
|
||||
}
|
||||
|
||||
for (let i = 0; i < org.length; i++) {
|
||||
res.push(org[i])
|
||||
}
|
||||
return res
|
||||
};
|
||||
|
||||
vcFramework.resetObject = function(org) {
|
||||
if (!org) {
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user