Commit d68650f4 by 周志凯

calc count time

1 parent 5c754c7e
Showing 1 changed file with 19 additions and 115 deletions
......@@ -1130,7 +1130,9 @@
},
computed: {
totalTime() {
return this.formatDateToStamp(this.endTiming) - this.formatDateToStamp(this.startTiming)
const { startTiming, endTiming } = this
return Math.floor((endTiming - startTiming) / 1000)
// return this.formatDateToStamp(endTiming) - this.formatDateToStamp(startTiming)
}
},
watch: {
......@@ -1840,8 +1842,21 @@
}
});
},
/////////////////////////////特征重提////////////////////////////////////////////////
onSearchClick: function() {
/////////////////////////////特征重提////////////////////////////////////////////////
// '/mall/feature'
// startDate,endDate,mallIds,scheduleType,featureType
// featureType==0 提取人体+人脸;featureType==1 提取人脸特征;featureType==2提取人体特征
/////////////////////////////特征库重建////////////////////////////////////////////////
// 重新建立顾客池 /mall/customPool
// 参数 mallIds,startDate,endDate,scheduleType
// 重建建立店员特征池 /mall/staffPool
// 参数 mallIds,scheduleType
/////////////////////////////人员重新对比////////////////////////////////////////////////
// 重新匹配顾客 /mall/custom
// 参数 mallIds,startDate,endDate,scheduleType
// 店员重新比对 /mall/staff
// 参数 mallIds,startDate,endDate,scheduleType
this.socket && this.socket.close()
this.results = []
this.startTiming = 0
......@@ -1877,91 +1892,6 @@
}
this.onSocketConnect(socketParameter)
},
onFeatureRevisitClick() {
console.log('[onFeatureRevisitClick]:', this.query)
// '/mall/feature'
// startDate,endDate,mallIds,scheduleType,featureType
// featureType==0 提取人体+人脸;featureType==1 提取人脸特征;featureType==2提取人体特征
// var socketUrl =
this.results = []
!this.startTiming && (this.startTiming = new Date())
const {
dateVal, mallVal, type
} = this.query
var scheduleType = 'featureRevisit' + this.query.type
var parameter = {
startDate: dateVal + ' 00:00:00',
endDate: dateVal + ' 23:59:59',
mallIds: mallVal || null,
scheduleType: scheduleType,
featureType: type
}
// this.openWebSock(scheduleType, '/mall/feature', parameter);
var socketParameter = {
scheduleType: scheduleType,
callback: this.fetchApi,
callbackUrlPath: '/mall/feature',
callbackParam: parameter
}
this.onSocketConnect(socketParameter)
},
/////////////////////////////特征库重建////////////////////////////////////////////////
onFeatureLibRebuildClick: function() {
console.log('[onFeatureLibRebuildClick]:', this.query)
// 重新建立顾客池 /mall/customPool
// 参数 mallIds,startDate,endDate,scheduleType
// 重建建立店员特征池 /mall/staffPool
// 参数 mallIds,scheduleType
this.results = []
!this.startTiming && (this.startTiming = new Date())
const {
dateVal, mallVal, type
} = this.query
var scheduleType = 'rematchPerson' + type
var parameter = {
startDate: dateVal + ' 00:00:00',
endDate: dateVal + ' 23:59:59',
mallIds: mallVal || null,
scheduleType: scheduleType
}
// this.openWebSock(scheduleType, '/mall/feature', parameter);
var socketParameter = {
scheduleType: scheduleType,
callback: this.fetchApi,
callbackUrlPath: type === 1 ? '/mall/staffPool' : '/mall/customPool',
callbackParam: parameter
}
this.onSocketConnect(socketParameter)
},
/////////////////////////////人员重新对比////////////////////////////////////////////////
onRematchPersonClick: function() {
console.log('[onRematchPersonClick]:', this.query)
//重新匹配顾客 /mall/custom
// 参数 mallIds,startDate,endDate,scheduleType
// 店员重新比对 /mall/staff
// 参数 mallIds,startDate,endDate,scheduleType
this.results = []
!this.startTiming && (this.startTiming = new Date())
const {
dateVal, mallVal, type
} = this.query
var scheduleType = 'rematchPerson' + type
var parameter = {
startDate: dateVal + ' 00:00:00',
endDate: dateVal + ' 23:59:59',
mallIds: mallVal || null,
scheduleType: scheduleType,
featureType: type
}
// this.openWebSock(scheduleType, '/mall/feature', parameter);
var socketParameter = {
scheduleType: scheduleType,
callback: this.fetchApi,
callbackUrlPath: type === 1 ? '/mall/staff' : '/mall/custom',
callbackParam: parameter
}
this.onSocketConnect(socketParameter)
},
/**
* websocket 连接
* @param {string} scheduleType
......@@ -1981,7 +1911,7 @@
}
self.socket.onopen = function(ev) {
console.log('socket:onopen', ev)
self.startTiming = new Date()
self.startTiming = +new Date()
callback && callback(callbackUrlPath, callbackParam)
}
self.socket.onclose = function(ev) {
......@@ -1994,7 +1924,7 @@
console.log('[onmessage]:', msg)
self.dealMessage(msg)
if (msg.stepCount === 1) {
this.endTiming = new Date()
self.endTiming = +new Date()
self.socket.close()
}
}
......@@ -2019,32 +1949,6 @@
}
})
},
fetchFeatureRevisit() {
const {
dateVal, mallVal, type
} = this.query
var self = this
$.ajax({
type: "post",
dataType: "json",
async: true,
url: apiUrl + '/mall/feature',
contentType: "application/json; charset=utf-8",
data: JSON.stringify({
startDate: dateVal + ' 00:00:00',
endDate: dateVal + ' 23:59:59',
mallIds: mallVal || null,
scheduleType: null,
featureType: type
}),
success: function(res) {
console.log(res)
},
error: function(err) {
console.log(err)
}
})
},
dealMessage(msg) {
// scheduleType
const { dates, mallIds, mallNames, status, stepCount, scheduleType, counter } = msg
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!