Commit 402c2847 by 李金轩

ljx

1 parent f6b11234
.vscode
.idea
\ No newline at end of file
git status
git add *
git commit -m %1%
git pull
git push
git status
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta charset="UTF-8"/>
<!-- import CSS -->
<link rel="stylesheet" href="./css/index.css" />
<link rel="stylesheet" href="./css/index.css"/>
<link rel="stylesheet" href="./css/common.css">
<link rel="stylesheet" href="./css/page.css">
<script src="./js/browser.min.js"></script>
......@@ -18,7 +18,8 @@
v-for="item in dateLevelList"
:key="item.label"
:label="item.label"
>{{ item.name }}</el-radio-button>
>{{ item.name }}
</el-radio-button>
<el-radio-button label="compare" v-if="locationHref">数据比对</el-radio-button>
</el-radio-group>
</div>
......@@ -143,7 +144,8 @@
:indeterminate="isIndeterminateTraffic"
v-model="checkAllTraffic"
@change="handleCheckAllChangeTraffic"
>全选</el-checkbox
>全选
</el-checkbox
>
<el-checkbox-group
v-model="checkedTraffic"
......@@ -153,7 +155,8 @@
v-for="item in checkTraffic"
:label="item.value"
:key="item.value"
>{{item.name}}</el-checkbox
>{{item.name}}
</el-checkbox
>
</el-checkbox-group>
</div>
......@@ -167,7 +170,8 @@
:indeterminate="isIndeterminateFace"
v-model="checkAllFace"
@change="handleCheckAllChangeFace"
>全选</el-checkbox
>全选
</el-checkbox
>
<el-checkbox-group
style="padding-top:3px"
......@@ -178,7 +182,8 @@
v-for="item in checkFace"
:label="item.value"
:key="item.value"
>{{item.name}}</el-checkbox
>{{item.name}}
</el-checkbox
>
</el-checkbox-group>
</div>
......@@ -188,7 +193,8 @@
round
@click="startData()"
class="button-class"
>开始</el-button
>开始
</el-button
>
</div>
<div></div>
......@@ -220,10 +226,12 @@
<div class="level">
<el-radio-group v-model="UrlType" size="small">
<el-radio-button label="trafficRecognition"
>客流数据</el-radio-button
>客流数据
</el-radio-button
>
<el-radio-button label="faceRecognitions"
>人脸数据</el-radio-button
>人脸数据
</el-radio-button
>
</el-radio-group>
</div>
......@@ -385,7 +393,8 @@
type="primary"
:loading="butShow"
@click="getDateCount"
>源数据条数查询</el-button
>源数据条数查询
</el-button
>
<span>数量:</span>
<el-input
......@@ -405,7 +414,8 @@
type="primary"
:loading="startShow"
@click="repairParams('face')"
>开始修补</el-button
>开始修补
</el-button
>
</div>
<div style="width: 100%;padding-top: 20px;">
......@@ -580,13 +590,15 @@
</div>
<div class="data-select" style="margin-top: 0.8%;">
<el-button type="primary" @click="repairPreview"
>效果预览</el-button
>效果预览
</el-button
>
<el-button
type="primary"
:loading="tafficShow"
@click="repairParams"
>开始修补</el-button
>开始修补
</el-button
>
</div>
<div style="width: 100%;padding-top: 20px;">
......@@ -725,7 +737,8 @@
</div>
</div>
<el-button type="primary" @click="compareParams"
>开始比对</el-button
>开始比对
</el-button
>
</div>
</div>
......@@ -819,7 +832,7 @@
</el-select>
</div>
<div class="query-item">
<span v-show="isSendDateParam" class="query-item__title" >日期 : </span>
<span v-show="isSendDateParam" class="query-item__title">日期 : </span>
<el-date-picker
v-show="isSendDateParam"
v-model="query.dateVal"
......@@ -832,7 +845,8 @@
type="primary"
:class="isSendDateParam ? '' : 'query-button'"
@click="onSearchClick"
>开 始</el-button>
>开 始
</el-button>
</div>
</div>
</div>
......@@ -1040,10 +1054,13 @@
</div>
</div>
</div>
<div v-show="dateFormat === 'snapGatherClass'">
12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321 12123321
</div>
<!-- <div class="clear-select">
<el-button size="small" round @click="clearDiv()">清空Div</el-button>
</div> -->
<div class="result-wrapper">
<div v-show="dateFormat !== 'snapGatherClass'" class="result-wrapper">
<div class="result-header">结果展示</div>
<el-scrollbar ref="scrollbarRef" wrap-class="scrollbar-wrapper">
<div id="showDiv" class="result-content" v-show="showDiv">
......
window._serverHost = window.location.hostname === 'localhost' ? 'store.keliuyun.com:9998' : window.location.host
window._baseUrl = `http://${window._serverHost}`
window._CONF_ = {
reportApiUrl: '',
apiUrl: '',
apiUrl: window._baseUrl,
webSockUrl: ''
}
const log = console.log.bind(console)
......@@ -3,13 +3,13 @@ const trafficOptions = [
"floor/countData",
"zone/countData",
"gate/countData"
];
]
const faceOptions = [
"mall/faceSta",
"floor/faceSta",
"zone/faceSta",
"gate/faceSta"
];
]
// const TAB_API = {
// featureRevisit: '',
// featureLibRebuild: [],
......@@ -20,17 +20,18 @@ new Vue({
return {
pickerOpts: {
disabledDate(time) {
return Date.parse(time) > Date.parse(new Date());
return Date.parse(time) > Date.parse(new Date())
}
},
radio: "mall",
dateFormat: "rerun",
dateLevelList: [
{ label: 'rerun', name: '数据重跑' },
{ label: 'repair', name: '数据修补' },
{ label: 'revisitFeature', name: '特征重提' },
{ label: 'rebuildFeatureLib', name: '特征库重建' },
{ label: 'rematchPerson', name: '人员重新比对' }
{label: 'rerun', name: '数据重跑'},
{label: 'repair', name: '数据修补'},
{label: 'revisitFeature', name: '特征重提'},
{label: 'rebuildFeatureLib', name: '特征库重建'},
{label: 'rematchPerson', name: '人员重新比对'},
{label: 'snapGatherClass', name: '抓拍聚类'},
],
UrlType: "trafficRecognition",
compareType: "custom",
......@@ -149,42 +150,50 @@ new Vue({
featureLibRebuildType: 1,
rematchPersonType: 1,
featureRevisitList: [
{ label: '人脸+全身照特征', value: 0 },
{ label: '人脸特征', value: 1 },
{ label: '全身照特征', value: 2 },
{ label: '店员特征', value: 3 }
{label: '人脸+全身照特征', value: 0},
{label: '人脸特征', value: 1},
{label: '全身照特征', value: 2},
{label: '店员特征', value: 3}
],
featureLibRebuildList: [
{ label: '店员库重建', value: 1 },
{ label: '顾客库重建', value: 2 }
{label: '店员库重建', value: 1},
{label: '顾客库重建', value: 2}
],
rematchPersonList: [
{ label: '店员对比', value: 1 },
{ label: '顾客对比', value: 2 }
{label: '店员对比', value: 1},
{label: '顾客对比', value: 2}
],
socket: null,
results: [],
startTiming: 0,
endTiming: 0,
footerText: ''
};
}
},
filters: {
formatTime(val) {
function autoPrefixZero(num) {
return num > 10 ? num : '0' + num
}
const day = parseInt(val / (24 * 60 * 60 * 1000)) + 1
const hour = parseInt(val % (24 * 60 * 60 * 1000) / (60 * 60 * 1000))
const minutes = parseInt(val % (60 * 60 * 1000) / (60 * 1000))
const seconds = parseInt(val % (60 * 1000) / 1000)
if (val < 1000 || val < 60 * 1000) {
if (val < 1000 || val < 60 * 1000)
{
return `${val % (60 * 1000) / 1000} 秒`
} else if (val < 60 * 60 * 1000) {
}
else if (val < 60 * 60 * 1000)
{
return `${autoPrefixZero(minutes)} 分钟 ${autoPrefixZero(seconds)} 秒`
} else if (val < 24 * 60 * 60 * 1000) {
}
else if (val < 24 * 60 * 60 * 1000)
{
return `${autoPrefixZero(hour)} 小时 ${autoPrefixZero(minutes)} 分钟 ${autoPrefixZero(seconds)} 秒`
} else {
}
else
{
return `${autoPrefixZero(day)}${autoPrefixZero(hour)} 小时 ${autoPrefixZero(minutes)} 分钟 ${autoPrefixZero(seconds)} 秒`
}
}
......@@ -202,29 +211,32 @@ new Vue({
) || (
this.dateFormat === 'revisitFeature'
&& this.featureRevisitType === 3)
) {
)
{
return false
}
return true
},
totalTime() {
const { startTiming, endTiming } = this
const {startTiming, endTiming} = this
return endTiming - startTiming
// return this.formatDateToStamp(endTiming) - this.formatDateToStamp(startTiming)
}
},
watch: {
accountVal: {
handler: function (val) {
if(val && val.length) {
handler: function(val) {
if (val && val.length)
{
this.query.accountVal = val
}
},
deep: true
},
mallVal: {
handler: function (val) {
if(val && val.length) {
handler: function(val) {
if (val && val.length)
{
this.query.mallVal = val
}
},
......@@ -256,89 +268,97 @@ new Vue({
},
created: function() {
this.locationHref =
location.href.indexOf("?super") != -1 ? true : false;
this.getAccount();
location.href.indexOf("?super") != -1 ? true : false
this.getAccount()
},
mounted: function() {
this.query.dateVal = this.createDate()
this.startTime = this.createDate();
this.endTime = this.createDate();
this.startTime = this.createDate()
this.endTime = this.createDate()
},
methods: {
createDate() {
var nowDate = new Date();
var day = nowDate.getDate();
var month = nowDate.getMonth() + 1;
var year = nowDate.getFullYear();
if (month >= 1 && month <= 9) {
month = "0" + month;
var nowDate = new Date()
var day = nowDate.getDate()
var month = nowDate.getMonth() + 1
var year = nowDate.getFullYear()
if (month >= 1 && month <= 9)
{
month = "0" + month
}
if (day >= 0 && day <= 9) {
day = "0" + day;
if (day >= 0 && day <= 9)
{
day = "0" + day
}
return year + "-" + month + "-" + day;
return year + "-" + month + "-" + day
},
getProgressName(val) {
return this.progressName[val];
return this.progressName[val]
},
getProgressStyle(stepCount, status, oldStepCount) {
if (stepCount == "stepType") {
if (status == "gatecountData" || status == "gatefaceSta") {
return { "margin-left": "448px", "font-size": "18px" };
} else {
return { "margin-left": "465px", "font-size": "18px" };
if (stepCount == "stepType")
{
if (status == "gatecountData" || status == "gatefaceSta")
{
return {"margin-left": "448px", "font-size": "18px"}
}
else
{
return {"margin-left": "465px", "font-size": "18px"}
}
} else {
}
else
{
return {
width: (stepCount - oldStepCount) * 405 + "px",
"background-color": status ? "#409EFF" : "#f56c6c",
"margin-left": oldStepCount * 405 + 50 + "px"
};
}
}
},
lineOver(tag, dates, mallIds, mallNames) {
let evt = tag || window.event,
_top,
_left;
_top = window.innerHeight - evt.y;
_left = window.innerWidth - evt.x;
_left
_top = window.innerHeight - evt.y
_left = window.innerWidth - evt.x
this.tipStyle = {
top: evt.y - 50 + "px",
left: evt.x + "px"
};
this.lineDate = dates;
this.lineMallId = mallIds.join(",");
this.lineMallName = mallNames;
this.tipShow = true;
}
this.lineDate = dates
this.lineMallId = mallIds.join(",")
this.lineMallName = mallNames
this.tipShow = true
},
lineOut() {
this.tipShow = false;
this.tipShow = false
},
handleCheckAllChangeTraffic(val) {
// console.log('val',val)
this.checkedTraffic = val ? trafficOptions : [];
this.checkedTraffic = val ? trafficOptions : []
// console.log(this.checkedTraffic)
this.isIndeterminateTraffic = false;
this.isIndeterminateTraffic = false
},
handleCheckAllChangeFace(val) {
// console.log('val',val)
this.checkedFace = val ? faceOptions : [];
this.checkedFace = val ? faceOptions : []
// console.log(this.checkedFace)
this.isIndeterminateFace = false;
this.isIndeterminateFace = false
},
handleCheckedCitiesChangeTraffic(value) {
// console.log(this.checkedTraffic)
let checkedCount = value.length;
this.checkAllTraffic = checkedCount === this.checkTraffic.length;
let checkedCount = value.length
this.checkAllTraffic = checkedCount === this.checkTraffic.length
this.isIndeterminateTraffic =
checkedCount > 0 && checkedCount < this.checkTraffic.length;
checkedCount > 0 && checkedCount < this.checkTraffic.length
},
handleCheckedCitiesChangeFace(value) {
// console.log(this.checkedFace)
let checkedCount = value.length;
this.checkAllFace = checkedCount === this.checkFace.length;
let checkedCount = value.length
this.checkAllFace = checkedCount === this.checkFace.length
this.isIndeterminateFace =
checkedCount > 0 && checkedCount < this.checkFace.length;
checkedCount > 0 && checkedCount < this.checkFace.length
},
accountchange(linkGate) {
this.isAccoutSelAll = this.isAccoutSelAll
......@@ -347,9 +367,10 @@ new Vue({
: true
: this.accountVal.length < this.accoutOpts.length
? false
: true;
if (this.accountVal.length > 0) {
this.getMall(linkGate);
: true
if (this.accountVal.length > 0)
{
this.getMall(linkGate)
}
},
mallchange(linkGate) {
......@@ -359,259 +380,295 @@ new Vue({
: true
: this.mallVal.length < this.mallOpts.length
? false
: true;
if (linkGate) {
: true
if (linkGate)
{
this.getGate()
}
},
selAllHandle(level) {
if (level == "accout") {
if (this.isAccoutSelAll) {
this.accountVal = [];
this.isAccoutSelAll = false;
this.getMall();
} else {
this.accountVal = [];
if (level == "accout")
{
if (this.isAccoutSelAll)
{
this.accountVal = []
this.isAccoutSelAll = false
this.getMall()
}
else
{
this.accountVal = []
this.accoutOpts.forEach(item => {
this.accountVal.push(item.id);
});
this.isAccoutSelAll = true;
this.getMall();
}
} else {
if (this.isMallSelAll) {
this.mallVal = [];
this.isMallSelAll = false;
} else {
this.mallVal = [];
this.accountVal.push(item.id)
})
this.isAccoutSelAll = true
this.getMall()
}
}
else
{
if (this.isMallSelAll)
{
this.mallVal = []
this.isMallSelAll = false
}
else
{
this.mallVal = []
this.mallOpts.forEach(item => {
this.mallVal.push(item.id);
});
this.isMallSelAll = true;
this.mallVal.push(item.id)
})
this.isMallSelAll = true
}
}
},
getAccount: function() {
var _this = this;
_this.accoutOpts = [];
var _this = this
_this.accoutOpts = []
log(454, window._CONF_.apiUrl + API.Accounts)
get(window._CONF_.apiUrl + API.Accounts).then(function(data) {
_this.accoutOpts = data;
if (_this.accoutOpts.length > 0) {
_this.accountVal = [_this.accoutOpts[0].id];
_this.accoutOpts = data
if (_this.accoutOpts.length > 0)
{
_this.accountVal = [_this.accoutOpts[0].id]
}
_this.getMall();
_this.getMall()
}).catch(err => {
console.log('err', err)
})
},
getMall: function() {
var _this = this;
_this.mallOpts = [];
var _this = this
_this.mallOpts = []
get(window._CONF_.apiUrl + API.Malls, {
accountIds: _this.accountVal.join(",")
}).then(function(data) {
_this.mallOpts = data;
if (_this.mallOpts.length > 0) {
_this.mallVal = [_this.mallOpts[0].id];
_this.mallOpts = data
if (_this.mallOpts.length > 0)
{
_this.mallVal = [_this.mallOpts[0].id]
}
_this.isMallSelAll =
_this.mallVal.length == _this.mallOpts.length ? true : false;
_this.mallVal.length == _this.mallOpts.length ? true : false
})
},
getGate: function() {
var _this = this;
var _this = this
get(window._CONF_.apiUrl + API.Gates, {
accountIds: _this.accountVal.join(","),
mallIds: _this.mallVal.join(',')
}).then(function(data) {
_this.gateOpt = data;
_this.gateVal = _this.gateOpt[0].id;
_this.gateOpt = data
_this.gateVal = _this.gateOpt[0].id
// _this.getDevice()
_this.getChannel();
_this.getChannel()
})
},
getDevice: function() {
var _this = this;
var _this = this
get(window._CONF_.apiUrl + API.Devices, {
// accountIds: _this.accountVal.join(","),
// mallIds: _this.mallVal.join(','),
gateId: this.gateVal
}).then(function(data) {
_this.deviceOpt = [];
_this.deviceVal = "";
for (var i = 0; i < data.length; i++) {
var temp = {};
temp.name = data[i];
temp.value = data[i];
temp.id = i;
_this.deviceOpt.push(temp);
}
_this.deviceVal = _this.deviceOpt[0].value;
_this.deviceOpt = []
_this.deviceVal = ""
for (var i = 0; i < data.length; i++)
{
var temp = {}
temp.name = data[i]
temp.value = data[i]
temp.id = i
_this.deviceOpt.push(temp)
}
_this.deviceVal = _this.deviceOpt[0].value
})
},
dateLevel: function() {
if (this.dateFormat == "repair") {
this.getGate();
} else {
if (this.dateFormat == "repair")
{
this.getGate()
}
else
{
// this.getMall();
}
},
getLevel: function() {},
getLevel: function() {
},
getNumber() {
this.repairProgList = [];
if (this.UrlType == "trafficRecognition") {
this.repairProgList = []
if (this.UrlType == "trafficRecognition")
{
// this.getChannel()
} else {
}
else
{
// this.getChannel()
// this.getDevice()
}
},
getChannel() {
var _this = this;
var _this = this
get(window._CONF_.apiUrl + API.Channels, {
// accountIds: _this.accountVal.join(","),
// mallIds: _this.mallVal.join(','),
gateId: this.gateVal
}).then(function(data) {
_this.channelOpt = [];
for (var i = 0; i < data.length; i++) {
var temp = {};
temp.name = data[i];
temp.value = data[i];
temp.id = i;
_this.channelOpt.push(temp);
_this.channelOpt = []
for (var i = 0; i < data.length; i++)
{
var temp = {}
temp.name = data[i]
temp.value = data[i]
temp.id = i
_this.channelOpt.push(temp)
}
_this.channelVal =
_this.channelOpt.length > 0 ? _this.channelOpt[0].value : "";
_this.channelOpt.length > 0 ? _this.channelOpt[0].value : ""
})
},
clearDiv() {
$("#showDiv").empty();
$("#showDiv").empty()
},
startData: function() {
this.progressList = [];
if (this.webSocketObj) {
for (var key in this.webSocketObj) {
this.webSocketObj[key].close();
this.progressList = []
if (this.webSocketObj)
{
for (var key in this.webSocketObj)
{
this.webSocketObj[key].close()
}
}
let params = {},
startDate = "",
endDate = "";
endDate = ""
params = {
startDate: this.startTime + " 00:00:00",
endDate: this.endTime + " 00:00:00",
mallIds: this.mallVal,
scheduleType: "",
mark: Date.parse(new Date())
};
}
this.checkedTraffic.forEach((item, index) => {
let _scheduleType = "";
let websocket = item.split("/");
let _scheduleType = ""
let websocket = item.split("/")
websocket.forEach(item1 => {
_scheduleType += item1;
});
params.scheduleType = _scheduleType;
this.openWebSock(_scheduleType, item, params);
});
_scheduleType += item1
})
params.scheduleType = _scheduleType
this.openWebSock(_scheduleType, item, params)
})
this.checkedFace.forEach((item, index) => {
let _scheduleType = "";
let websocket = item.split("/");
let _scheduleType = ""
let websocket = item.split("/")
websocket.forEach(item1 => {
_scheduleType += item1;
});
params.scheduleType = _scheduleType;
this.openWebSock(_scheduleType, item, params);
});
_scheduleType += item1
})
params.scheduleType = _scheduleType
this.openWebSock(_scheduleType, item, params)
})
},
openWebSock(wsUrl, url, params, processKey = 'progressList') {
// browser 兼容
// var wsHost = window.location.host;
var socketUrl = "";
var webSock_Url = window._CONF_.webSockUrl || window.location.host;
var socketUrl = ""
var webSock_Url = window._CONF_.webSockUrl || window.location.host
var obj = {
stepList: []
};
obj.stepType = wsUrl;
obj.mark = params.mark;
if (!webSockUrl) {
webSock = window.location.host;
}
socketUrl = "ws://" + webSock_Url + WSAPI.WSAPI + wsUrl;
this[processKey].push(obj);
var _this = this;
if ("WebSocket" in window) {
_this.webSocketObj[wsUrl] = new WebSocket(socketUrl);
} else if ("MozWebSocket" in window) {
_this.webSocketObj[wsUrl] = new MozWebSocket(socketUrl);
} else {
_this.webSocketObj[wsUrl] = new SockJS(socketUrl);
}
var param = JSON.parse(JSON.stringify(params));
try {
}
obj.stepType = wsUrl
obj.mark = params.mark
if (!webSockUrl)
{
webSock = window.location.host
}
socketUrl = "ws://" + webSock_Url + WSAPI.WSAPI + wsUrl
this[processKey].push(obj)
var _this = this
if ("WebSocket" in window)
{
_this.webSocketObj[wsUrl] = new WebSocket(socketUrl)
}
else if ("MozWebSocket" in window)
{
_this.webSocketObj[wsUrl] = new MozWebSocket(socketUrl)
}
else
{
_this.webSocketObj[wsUrl] = new SockJS(socketUrl)
}
var param = JSON.parse(JSON.stringify(params))
try
{
_this.webSocketObj[wsUrl].onopen = function(event) {
console.log("WebSocket:已连接");
_this.returnData(url, param);
};
console.log("WebSocket:已连接")
_this.returnData(url, param)
}
_this.webSocketObj[wsUrl].onclosed = function() {
console.log("WebSocket关闭");
};
console.log("WebSocket关闭")
}
_this.webSocketObj[wsUrl].onmessage = function(evt) {
var msg = JSON.parse(evt.data);
var msg = JSON.parse(evt.data)
_this[processKey].forEach((item, index) => {
if (
item.stepType == msg.scheduleType &&
item.mark == msg.mark
) {
var stepObj = {};
stepObj.dates = msg.dates;
stepObj.mallIds = msg.mallIds;
stepObj.mallNames = msg.mallNames;
stepObj.status = msg.status;
stepObj.stepCount = msg.stepCount;
item.stepList.push(stepObj);
)
{
var stepObj = {}
stepObj.dates = msg.dates
stepObj.mallIds = msg.mallIds
stepObj.mallNames = msg.mallNames
stepObj.status = msg.status
stepObj.stepCount = msg.stepCount
item.stepList.push(stepObj)
item.precentsucess = msg.stepCount
? Math.floor(msg.stepCount * 100)
: 0;
: 0
}
});
})
// console.log('list',_this[processKey])
};
}
_this.webSocketObj[wsUrl].onerror = function(event) {
console.log("设备WebSocket:发生错误 ");
console.log(event);
};
} catch (error) {}
console.log("设备WebSocket:发生错误 ")
console.log(event)
}
}
catch (error)
{
}
},
returnData: function(urls, params) {
// console.log(urls,params)
var _this = this;
var _this = this
post(window._CONF_.apiUrl + urls, JSON.stringify(params)).then(function(data) {
if (data) {
_this.loading = "";
_this.showDiv = true;
if (data)
{
_this.loading = ""
_this.showDiv = true
_this.renderResultToHtml(data)
}
}).catch(function(err) {
_this.loading = "";
alert("Sorry, The requested property could not be found.");
_this.loading = ""
alert("Sorry, The requested property could not be found.")
})
},
getDateCount: function() {
var _this = this;
this.butShow = true;
var _this = this
this.butShow = true
var params = {
startTime: this.sourceDate + " " + this.sourceStartTime,
endTime: this.sourceDate + " " + this.sourceEndTime,
channelSerialnum: this.channelVal
};
}
get(window._CONF_.apiUrl + API.FaceRecognitionsCount, params).then(function(data) {
_this.butShow = false;
_this.dateCount = data;
_this.butShow = false
_this.dateCount = data
}).catch(function(err) {
_this.butShow = false;
console.log(err);
_this.butShow = false
console.log(err)
})
// $.ajax({
// type: "get",
......@@ -633,18 +690,20 @@ new Vue({
// });
},
repairParams: function(type) {
this.repairProgList = [];
if (this.repairWebSocket) {
this.repairWebSocket.close();
this.repairProgList = []
if (this.repairWebSocket)
{
this.repairWebSocket.close()
}
var url = "",
params = {};
if (type == "face") {
this.startShow = true;
params = {}
if (type == "face")
{
this.startShow = true
setTimeout(() => {
this.startShow = false;
}, 3000);
var url = API.SimulationFaceRecognition;
this.startShow = false
}, 3000)
var url = API.SimulationFaceRecognition
var params = {
sourceStartDate: this.sourceDate + " " + this.sourceStartTime,
sourceEndDate: this.sourceDate + " " + this.sourceEndTime,
......@@ -654,13 +713,15 @@ new Vue({
count: Number(this.count),
scheduleType: "simulationfaceRecognition",
mark: Date.parse(new Date())
};
} else {
this.tafficShow = true;
}
}
else
{
this.tafficShow = true
setTimeout(() => {
this.tafficShow = false;
}, 3000);
url = API.SimulationCountData;
this.tafficShow = false
}, 3000)
url = API.SimulationCountData
params = {
sourceStartDate: this.referenceDate + " " + this.traffStartTime,
sourceEndDate: this.referenceDate + " " + this.traffEndTime,
......@@ -671,9 +732,9 @@ new Vue({
maxFactor: this.endRange,
scheduleType: "simulationcountData",
mark: Date.parse(new Date())
};
}
this.openFaceTraffWebSock(url, params);
}
this.openFaceTraffWebSock(url, params)
},
compareParams: function(type) {
params = {
......@@ -682,70 +743,81 @@ new Vue({
mallIds: this.mallVal,
scheduleType: "",
mark: Date.parse(new Date())
};
var url = API.Mall + this.compareType;
this.returnData(url, params);
}
var url = API.Mall + this.compareType
this.returnData(url, params)
},
openFaceTraffWebSock(url, params) {
// browser 兼容
// var wsHost = window.location.host;
var socketUrl = "";
var webSock_Url = window._CONF_.webSockUrl || window.location.host;
var socketUrl = ""
var webSock_Url = window._CONF_.webSockUrl || window.location.host
var obj = {
stepList: []
};
obj.stepType = params.scheduleType;
obj.mark = params.mark;
}
obj.stepType = params.scheduleType
obj.mark = params.mark
socketUrl =
"ws://" + webSock_Url + WSAPI.RecalSchedule + params.scheduleType;
this.repairProgList.push(obj);
var _this = this;
if ("WebSocket" in window) {
_this.repairWebSocket = new WebSocket(socketUrl);
} else if ("MozWebSocket" in window) {
_this.repairWebSocket = new MozWebSocket(socketUrl);
} else {
_this.repairWebSocket = new SockJS(socketUrl);
}
var param = JSON.parse(JSON.stringify(params));
try {
"ws://" + webSock_Url + WSAPI.RecalSchedule + params.scheduleType
this.repairProgList.push(obj)
var _this = this
if ("WebSocket" in window)
{
_this.repairWebSocket = new WebSocket(socketUrl)
}
else if ("MozWebSocket" in window)
{
_this.repairWebSocket = new MozWebSocket(socketUrl)
}
else
{
_this.repairWebSocket = new SockJS(socketUrl)
}
var param = JSON.parse(JSON.stringify(params))
try
{
_this.repairWebSocket.onopen = function(event) {
console.log("WebSocket:已连接");
_this.repairData(url, params);
};
console.log("WebSocket:已连接")
_this.repairData(url, params)
}
_this.repairWebSocket.onclosed = function() {
console.log("WebSocket关闭");
};
console.log("WebSocket关闭")
}
_this.repairWebSocket.onmessage = function(evt) {
var msg = JSON.parse(evt.data);
var msg = JSON.parse(evt.data)
_this.repairProgList.forEach((item, index) => {
if (
item.stepType == msg.scheduleType &&
item.mark == msg.mark
) {
var stepObj = {};
stepObj.counttime = msg.counttime;
stepObj.serialnum = msg.serialnum;
stepObj.status = msg.status;
stepObj.stepCount = msg.stepCount;
item.stepList.push(stepObj);
)
{
var stepObj = {}
stepObj.counttime = msg.counttime
stepObj.serialnum = msg.serialnum
stepObj.status = msg.status
stepObj.stepCount = msg.stepCount
item.stepList.push(stepObj)
item.precentsucess = msg.stepCount
? Math.floor(msg.stepCount * 100)
: 0;
: 0
}
})
}
});
};
_this.webSocketObj[wsUrl].onerror = function(event) {
console.log("设备WebSocket:发生错误 ");
console.log(event);
};
} catch (error) {}
console.log("设备WebSocket:发生错误 ")
console.log(event)
}
}
catch (error)
{
}
},
repairData(url, params) {
let that = this
post(window._CONF_.apiUrl + url, JSON.stringify(params)).then(function(data) {
if (data) {
if (data)
{
that.renderResultToHtml(data)
}
})
......@@ -761,10 +833,11 @@ new Vue({
maxFactor: this.endRange,
scheduleType: "simulationcountData",
mark: Date.parse(new Date())
};
}
let that = this
post(window._CONF_.apiUrl + API.PreviewCountData, JSON.stringify(params)).then(function(data) {
if (data) {
if (data)
{
that.renderResultToHtml(data, true)
}
})
......@@ -776,20 +849,25 @@ new Vue({
data.success +
" 个,失败 " +
data.failed +
" 个.</br>";
if (data.failedJob && data.failedJob.length > 0) {
text += "-----失败job详情-----</br>";
text += data.failedJob.join("</br>");
if (data.data) {
text += "</br>" + data.data;
}
}
if (data.successJob && data.successJob.length > 0) {
text += "-----成功job详情-----</br>";
text += data.successJob.join("</br>");
if (hasSccessDetail) {
if (data.data) {
console.log(data.data);
" 个.</br>"
if (data.failedJob && data.failedJob.length > 0)
{
text += "-----失败job详情-----</br>"
text += data.failedJob.join("</br>")
if (data.data)
{
text += "</br>" + data.data
}
}
if (data.successJob && data.successJob.length > 0)
{
text += "-----成功job详情-----</br>"
text += data.successJob.join("</br>")
if (hasSccessDetail)
{
if (data.data)
{
console.log(data.data)
data.data.forEach(item => {
text +=
"</br>" +
......@@ -800,16 +878,16 @@ new Vue({
" 进客流: " +
item.innum +
" 出客流: " +
item.outnum;
});
item.outnum
})
}
}
}
text += "</br>-----------------------------------------------";
text += "</br>";
text += "</br>";
text += "</br>";
$("#showDiv").append(text);
text += "</br>-----------------------------------------------"
text += "</br>"
text += "</br>"
text += "</br>"
$("#showDiv").append(text)
},
onSearchClick: function() {
/////////////////////////////特征重提////////////////////////////////////////////////
......@@ -826,7 +904,8 @@ new Vue({
// 参数 mallIds,startDate,endDate,scheduleType
// 店员重新比对 /mall/staff
// 参数 mallIds,startDate,endDate,scheduleType
if (this.socket) {
if (this.socket)
{
this.socket.close()
this.socket = null
}
......@@ -844,7 +923,7 @@ new Vue({
return val === 1 ? API.MallStaff : API.MallCustom
}
}
const { dateFormat, query, isSendDateParam } = this
const {dateFormat, query, isSendDateParam} = this
const {
dateVal, mallVal, type
} = query
......@@ -857,11 +936,13 @@ new Vue({
scheduleType: scheduleType,
// featureType: dateFormat === 'revisitFeature' ? type : null
}
if (isSendDateParam) {
if (isSendDateParam)
{
parameter.startDate = dateVal + ' 00:00:00'
parameter.endDate = dateVal + ' 23:59:59'
}
if (dateFormat === 'revisitFeature') {
if (dateFormat === 'revisitFeature')
{
parameter.featureType = type
}
var socketParameter = {
......@@ -879,40 +960,49 @@ new Vue({
* @param {string} callbackUrlPath
* @param {object} callbackParam
*/
onSocketConnect({ scheduleType, callbackUrlPath, callbackParam }) {
onSocketConnect({scheduleType, callbackUrlPath, callbackParam}) {
var self = this,
wsUrl = window._CONF_.webSockUrl || window.location.host,
socketUrl = "ws://" + wsUrl + WSAPI.RecalSchedule + scheduleType
if ("WebSocket" in window) {
self.socket = new WebSocket(socketUrl);
} else if ("MozWebSocket" in window) {
self.socket = new MozWebSocket(socketUrl);
} else {
self.socket = new SockJS(socketUrl);
}
try {
if ("WebSocket" in window)
{
self.socket = new WebSocket(socketUrl)
}
else if ("MozWebSocket" in window)
{
self.socket = new MozWebSocket(socketUrl)
}
else
{
self.socket = new SockJS(socketUrl)
}
try
{
self.socket.onopen = function(ev) {
self.startTiming = +new Date()
self.fetchApi(callbackUrlPath, callbackParam)
};
}
self.socket.onclosed = function() {
console.log('socket:onclose')
};
}
self.socket.onmessage = function(ev) {
var msg = JSON.parse(ev.data)
console.log('[onmessage]:', msg)
self.dealMessage(msg)
if (msg.stepCount === 1) {
if (msg.stepCount === 1)
{
self.endTiming = +new Date()
self.socket.close()
}
};
}
self.socket.onerror = function(ev) {
console.log("设备WebSocket:发生错误 ");
console.log(ev);
console.log("设备WebSocket:发生错误 ")
console.log(ev)
}
}
} catch (error) {
catch (error)
{
console.log('onSocketConnect:', error)
}
},
......@@ -927,7 +1017,7 @@ new Vue({
},
dealMessage(msg) {
// scheduleType
const { dates, mallIds, mallNames, status, stepCount, scheduleType, counter } = msg
const {dates, mallIds, mallNames, status, stepCount, scheduleType, counter} = msg
var self = this
var resObj = {}
resObj.dates = dates
......@@ -941,7 +1031,8 @@ new Vue({
resObj.curPageSize = 0
resObj.currentPage = 0
resObj.scheduleType = scheduleType
if (counter) {
if (counter)
{
// dataNum dateMallNum step totalData totalDate totalMall totalMallDateProduct allDataCount
resObj.totalNum = counter.allDataCount
resObj.totalPage = counter.totalMallDateProduct
......@@ -949,13 +1040,15 @@ new Vue({
resObj.curPageSize = counter.totalData
resObj.currentPage = counter.dateMallNum
}
if (self.results.length) {
if (self.results.length)
{
const isSameScheduleType = self.results.some(item => item.scheduleType === scheduleType)
isSameScheduleType
? self.results.forEach(item => {
//
item.progress = self.floatToPercent(stepCount)
if (counter) {
if (counter)
{
item.totalNum = counter.allDataCount
item.totalPage = counter.totalMallDateProduct
item.current = counter.dataNum
......@@ -965,7 +1058,9 @@ new Vue({
})
: self.results.push(resObj)
resObj = {}
} else {
}
else
{
self.results.push(resObj)
resObj = {}
}
......@@ -975,19 +1070,26 @@ new Vue({
// })
},
formatDateToStamp(date) {
if (!date) return false
if (!date)
{
return false
}
typeof date === 'string' && (date = new Date(date.replace(/-/g, '/')))
return date.getTime()
},
floatToPercent(floatNum) {
if (!floatNum) return 0
if (!floatNum)
{
return 0
}
var formatNum = Math.floor(floatNum * 100)
return formatNum >= 100 ? 100 : formatNum
},
onClearClick() {
if (this.dateFormat === 'revisitFeature' ||
this.dateFormat === 'rebuildFeatureLib' ||
this.dateFormat === 'rematchPerson') {
this.dateFormat === 'rematchPerson')
{
this.startTiming = 0
this.endTiming = 0
this.results = []
......@@ -997,4 +1099,4 @@ new Vue({
// }
}
}
});
})
......@@ -41,7 +41,7 @@ Axios.interceptors.response.use(
function get(url, params = {}, config = {}) {
params['s'] = +new Date()
return Axios.get(url, { ...config, params })
return Axios.get(url, {...config, params})
}
function post(url, params, config = {}) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!