Commit 326e96bc by 李金轩

ljx

1 parent b6694db2
import {axiosInstance} from "@/Request/PublicAxiosInstance"
import {} from "@/PublicUtil/PublicUtil"
import imagePackageApi from '@/views/DataLabel/ImagePackage/ImagePackageApi'
export const getUserNameIdMap = function(targetData) {
axiosInstance.request(
{
method: 'GET',
url: `/users`,
}
).then(
(r) => {
const list = r.data
for (const item of list)
{
targetData[item.name] = item.id
}
}
)
}
export const getCompanyMap = function(targetData) {
axiosInstance.request(
{
method: 'GET',
url: `/accounts`,
}
).then(
(r) => {
const list = r.data
for (const item of list)
{
targetData[item.id] = item.name
}
}
)
}
export const getImagePackageMap = function(targetData) {
imagePackageApi.getImagePackageList().then(
(r) => {
const list = r.data
for (const item of list)
{
targetData[item.name] = item.id
}
}
)
}
export const getCanCreateUsernameIdMap = function() {
const currentUserType = localStorage.getItem('currentUserType')
switch (currentUserType)
{
case '0': // 超级管理员
{
return {
"超级管理员": 0,
"项目经理": 1,
"内部质检员": 2,
"外部管理员": 3,
"外部质检员": 4,
"外部标注员": 5,
"兼职标注员": 6,
"数据清洗员": 7,
}
}
case '1': // 项目经理
{
return {
"内部质检员": 2,
"外部管理员": 3,
"外部质检员": 4,
"外部标注员": 5,
"兼职标注员": 6,
}
}
case '3': // 外部管理员
{
return {
"外部质检员": 4,
"外部标注员": 5,
"兼职标注员": 6,
}
}
default:
{
return {}
}
}
}
......@@ -15,7 +15,7 @@ axiosInstance.interceptors.request.use(
config => {
if (window.location.hostname === 'localhost')
{
config.headers.Authorization = 'c3b85226-4301-45fb-a087-4caf3194fc90'
config.headers.Authorization = '967c22ec-4257-40c8-9385-5c0f068afaa7'
}
else
{
......
<template>
<a-form :model="querySnapshotRecordForm" layout="inline">
<a-form-item label="集团:">
<a-select v-model:value="querySnapshotRecordForm.account_id"
style="width: 200px"
mode="multiple"
:maxTagCount="1"
@change="onAccountChange"
>
<a-select-option
v-for="item in accountList"
:value="item.id"
>
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="广场:">
<a-select v-model:value="querySnapshotRecordForm.plaza_id"
style="width: 200px"
mode="multiple"
:maxTagCount="1"
>
<a-select-option
v-for="item in plazaList"
:value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="特征重提类型:">
<a-select v-model:value="querySnapshotRecordForm.featureRevisitType" style="width: 200px">
<a-select-option :value="1">店员库重建</a-select-option>
<a-select-option :value="2">顾客库重建</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="选择日期:" v-if="querySnapshotRecordForm.featureRevisitType === 2">
<a-date-picker v-model:value="querySnapshotRecordForm.date"/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="initializeWebSocket">查询</a-button>
</a-form-item>
</a-form>
<div class="result-header">结果展示</div>
<el-progress v-for="item in resultList" :text-inside="true" :stroke-width="26" :percentage="item?.progress"/>
</template>
<script>
import featureLibraryRebuildApi from '@/views/FeatureLibraryRebuild/FeatureLibraryRebuildApi'
import {reactive, ref, toRaw} from 'vue'
import moment from 'moment'
import snapshotRecordApi from '@/views/SnapshotCluster/SnapshotRecord/SnapshotRecordApi'
import {isArray} from '@/PublicUtil/Judgment'
import {formatDate, formatTime} from '@/PublicUtil/PublicUtil'
export default {
name: "FeatureLibraryRebuild"
setup() {
let webSocket = undefined
const resultList = ref([])
// sequence
const dataList = ref([])
const accountList = ref([])
const plazaList = ref([])
const zoneList = ref([])
const gateList = ref([])
const querySnapshotRecordForm = reactive(
{
account_id: [],
plaza_id: [],
featureRevisitType: 1,
date: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
}
)
const onAccountChange = function() {
getPlazaList()
}
const getPlazaList = function() {
querySnapshotRecordForm.plaza_id = []
plazaList.value = []
snapshotRecordApi.getPlazaList(
{
account_id: querySnapshotRecordForm.account_id.toString()
}
).then(
(r) => {
if (isArray(r))
{
plazaList.value = r
}
}
)
}
const getAccountList = function() {
querySnapshotRecordForm.account_id = []
accountList.value = []
snapshotRecordApi.getAccountList().then(
(r) => {
if (isArray(r))
{
accountList.value = r
}
}
)
}
const floatToPercent = function(floatNum) {
if (!floatNum)
{
return 0
}
let formatNum = Math.floor(floatNum * 100)
return formatNum >= 100 ? 100 : formatNum
}
const dealMessage = function(message) {
// scheduleType
const {dates, mallIds, mallNames, status, stepCount, scheduleType, counter} = message
let resObj = {}
resObj.dates = dates
resObj.mallIds = mallIds
resObj.mallNames = mallNames
resObj.status = status
resObj.progress = floatToPercent(stepCount)
resObj.totalNum = 0
resObj.totalPage = 0
resObj.current = 0
resObj.curPageSize = 0
resObj.currentPage = 0
resObj.scheduleType = scheduleType
if (counter)
{
// dataNum dateMallNum step totalData totalDate totalMall totalMallDateProduct allDataCount
resObj.totalNum = counter.allDataCount
resObj.totalPage = counter.totalMallDateProduct
resObj.current = counter.dataNum
resObj.curPageSize = counter.totalData
resObj.currentPage = counter.dateMallNum
}
if (resultList.value.length)
{
const isSameScheduleType = resultList.value.some(item => item.scheduleType === scheduleType)
isSameScheduleType
? resultList.value.forEach(item => {
//
item.progress = floatToPercent(stepCount)
if (counter)
{
item.totalNum = counter.allDataCount
item.totalPage = counter.totalMallDateProduct
item.current = counter.dataNum
item.curPageSize = counter.totalData
item.currentPage = counter.dateMallNum
}
})
: resultList.value.push(resObj)
resObj = {}
}
else
{
resultList.value.push(resObj)
resObj = {}
}
}
const initializeWebSocket = function() {
if (webSocket !== undefined)
{
webSocket.close()
}
resultList.value = []
webSocket = new WebSocket(`ws://store.keliuyun.com:9998/recal/schedule/rebuildFeatureLib${querySnapshotRecordForm.featureRevisitType}`)
webSocket.onopen = queryData
webSocket.onmessage = function(event) {
let message = JSON.parse(event.data)
log('[onmessage]:', message)
dealMessage(message)
if (message.stepCount === 1)
{
webSocket.close()
}
}
}
const queryData = function() {
const rawData = toRaw(querySnapshotRecordForm)
switch (rawData.featureRevisitType)
{
case 1:
{
const data = {
mallIds: rawData.plaza_id,
scheduleType: `rebuildFeatureLib${rawData.featureRevisitType}`,
}
featureLibraryRebuildApi.getStaffResult(data)
break
}
case 2:
{
const data = {
mallIds: rawData.plaza_id,
scheduleType: `rebuildFeatureLib${rawData.featureRevisitType}`,
startDate: formatDate(rawData.date) + ' ' + '00:00:00',
endDate: formatDate(rawData.date) + ' ' + '23:59:59',
}
featureLibraryRebuildApi.getCustomResult(data)
break
}
}
}
const __main = function() {
getAccountList()
}
__main()
return {
// sequence
accountList,
plazaList,
zoneList,
gateList,
resultList,
querySnapshotRecordForm,
onAccountChange,
initializeWebSocket,
}
}
}
</script>
......
import axiosInstance from "@/Request/PublicAxiosInstance"
import {filterEmptyValueInObject} from "@/PublicUtil/PublicUtil"
class FeatureLibraryRebuildApi {
getStaffResult(data) {
return axiosInstance.request(
{
method: 'POST',
url: `/mall/staffPool`,
data: data
}
)
}
getCustomResult(data) {
return axiosInstance.request(
{
method: 'POST',
url: `/mall/customPool`,
data: data
}
)
}
}
const featureLibraryRebuildApi = new FeatureLibraryRebuildApi()
export default featureLibraryRebuildApi
<template>
<a-form :model="querySnapshotRecordForm" layout="inline">
<a-form-item label="集团:">
<a-select v-model:value="querySnapshotRecordForm.account_id"
style="width: 200px"
mode="multiple"
:maxTagCount="1"
@change="onAccountChange"
>
<a-select-option
v-for="item in accountList"
:value="item.id"
>
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="广场:">
<a-select v-model:value="querySnapshotRecordForm.plaza_id"
style="width: 200px"
mode="multiple"
:maxTagCount="1"
>
<a-select-option
v-for="item in plazaList"
:value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="特征重提类型:">
<a-select v-model:value="querySnapshotRecordForm.featureRevisitType" style="width: 200px">
<a-select-option :value="0">人脸+全身照特征</a-select-option>
<a-select-option :value="1">人脸特征</a-select-option>
<a-select-option :value="2">全身照特征</a-select-option>
<a-select-option :value="3">店员特征</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="选择日期:" v-if="querySnapshotRecordForm.featureRevisitType !== 3">
<a-date-picker v-model:value="querySnapshotRecordForm.date"/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="initializeWebSocket">查询</a-button>
</a-form-item>
</a-form>
<div class="result-header">结果展示</div>
<el-progress v-for="item in resultList" :text-inside="true" :stroke-width="26" :percentage="item?.progress"/>
</template>
<script>
import featureLibraryRebuildApi from '@/views/FeatureLibraryRebuild/FeatureLibraryRebuildApi'
import {reactive, ref, toRaw} from 'vue'
import moment from 'moment'
import snapshotRecordApi from '@/views/SnapshotCluster/SnapshotRecord/SnapshotRecordApi'
import {isArray} from '@/PublicUtil/Judgment'
import {formatDate, formatTime} from '@/PublicUtil/PublicUtil'
import featureReExtractApi from '@/views/FeatureReExtract/FeatureReExtractApi'
export default {
name: "FeatureRe-extract"
setup() {
let webSocket = undefined
const resultList = ref([])
// sequence
const dataList = ref([])
const accountList = ref([])
const plazaList = ref([])
const zoneList = ref([])
const gateList = ref([])
const querySnapshotRecordForm = reactive(
{
account_id: [],
plaza_id: [],
featureRevisitType: 1,
date: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
}
)
const onAccountChange = function() {
getPlazaList()
}
const getPlazaList = function() {
querySnapshotRecordForm.plaza_id = []
plazaList.value = []
snapshotRecordApi.getPlazaList(
{
account_id: querySnapshotRecordForm.account_id.toString()
}
).then(
(r) => {
if (isArray(r))
{
plazaList.value = r
}
}
)
}
const getAccountList = function() {
querySnapshotRecordForm.account_id = []
accountList.value = []
snapshotRecordApi.getAccountList().then(
(r) => {
if (isArray(r))
{
accountList.value = r
}
}
)
}
const floatToPercent = function(floatNum) {
if (!floatNum)
{
return 0
}
let formatNum = Math.floor(floatNum * 100)
return formatNum >= 100 ? 100 : formatNum
}
const dealMessage = function(message) {
// scheduleType
const {dates, mallIds, mallNames, status, stepCount, scheduleType, counter} = message
let resObj = {}
resObj.dates = dates
resObj.mallIds = mallIds
resObj.mallNames = mallNames
resObj.status = status
resObj.progress = floatToPercent(stepCount)
resObj.totalNum = 0
resObj.totalPage = 0
resObj.current = 0
resObj.curPageSize = 0
resObj.currentPage = 0
resObj.scheduleType = scheduleType
if (counter)
{
// dataNum dateMallNum step totalData totalDate totalMall totalMallDateProduct allDataCount
resObj.totalNum = counter.allDataCount
resObj.totalPage = counter.totalMallDateProduct
resObj.current = counter.dataNum
resObj.curPageSize = counter.totalData
resObj.currentPage = counter.dateMallNum
}
if (resultList.value.length)
{
const isSameScheduleType = resultList.value.some(item => item.scheduleType === scheduleType)
isSameScheduleType
? resultList.value.forEach(item => {
//
item.progress = floatToPercent(stepCount)
if (counter)
{
item.totalNum = counter.allDataCount
item.totalPage = counter.totalMallDateProduct
item.current = counter.dataNum
item.curPageSize = counter.totalData
item.currentPage = counter.dateMallNum
}
})
: resultList.value.push(resObj)
resObj = {}
}
else
{
resultList.value.push(resObj)
resObj = {}
}
}
const initializeWebSocket = function() {
if (webSocket !== undefined)
{
webSocket.close()
}
resultList.value = []
webSocket = new WebSocket(`ws://store.keliuyun.com:9998/recal/schedule/revisitFeature${querySnapshotRecordForm.featureRevisitType}`)
webSocket.onopen = queryData
webSocket.onmessage = function(event) {
let message = JSON.parse(event.data)
dealMessage(message)
if (message.stepCount === 1)
{
webSocket.close()
}
}
}
const queryData = function() {
const rawData = toRaw(querySnapshotRecordForm)
if ([0, 1, 2].includes(rawData.featureRevisitType))
{
const data = {
mallIds: rawData.plaza_id,
featureType: rawData.featureRevisitType,
scheduleType: `revisitFeature${rawData.featureRevisitType}`,
startDate: formatDate(rawData.date) + ' ' + '00:00:00',
endDate: formatDate(rawData.date) + ' ' + '23:59:59',
}
featureReExtractApi.getFeatureResult(data)
}
else
{
const data = {
mallIds: rawData.plaza_id,
featureType: rawData.featureRevisitType,
scheduleType: `revisitFeature${rawData.featureRevisitType}`,
}
featureReExtractApi.getStaffFeatureResult(data)
}
}
const __main = function() {
getAccountList()
}
__main()
return {
// sequence
accountList,
plazaList,
zoneList,
gateList,
resultList,
querySnapshotRecordForm,
onAccountChange,
initializeWebSocket,
}
}
}
</script>
......
import axiosInstance from "@/Request/PublicAxiosInstance"
import {filterEmptyValueInObject} from "@/PublicUtil/PublicUtil"
class FeatureReExtractApi {
getFeatureResult(data) {
return axiosInstance.request(
{
method: 'POST',
url: `/mall/feature`,
data: data
}
)
}
getStaffFeatureResult(data) {
return axiosInstance.request(
{
method: 'POST',
url: `/mall/staffFeature`,
data: data
}
)
}
}
const featureReExtractApi = new FeatureReExtractApi()
export default featureReExtractApi
......@@ -54,11 +54,11 @@ export default defineComponent({
)
}
const initialize = function() {
const __main = function() {
// log(accessedMenu)
}
initialize()
__main()
return {
// scalar
......
<template>
<a-form :model="querySnapshotRecordForm" layout="inline">
<a-form-item label="集团:">
<a-select v-model:value="querySnapshotRecordForm.account_id"
style="width: 200px"
mode="multiple"
:maxTagCount="1"
@change="onAccountChange"
>
<a-select-option
v-for="item in accountList"
:value="item.id"
>
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="广场:">
<a-select v-model:value="querySnapshotRecordForm.plaza_id"
style="width: 200px"
mode="multiple"
:maxTagCount="1"
>
<a-select-option
v-for="item in plazaList"
:value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="特征重提类型:">
<a-select v-model:value="querySnapshotRecordForm.featureRevisitType" style="width: 200px">
<a-select-option :value="1">店员库重建</a-select-option>
<a-select-option :value="2">顾客库重建</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="选择日期:" v-if="querySnapshotRecordForm.featureRevisitType === 2">
<a-date-picker v-model:value="querySnapshotRecordForm.date"/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="initializeWebSocket">查询</a-button>
</a-form-item>
</a-form>
<div class="result-header">结果展示</div>
<el-progress v-for="item in resultList" :text-inside="true" :stroke-width="26" :percentage="item?.progress"/>
</template>
<script>
import featureLibraryRebuildApi from '@/views/FeatureLibraryRebuild/FeatureLibraryRebuildApi'
import {reactive, ref, toRaw} from 'vue'
import moment from 'moment'
import snapshotRecordApi from '@/views/SnapshotCluster/SnapshotRecord/SnapshotRecordApi'
import {isArray} from '@/PublicUtil/Judgment'
import {formatDate, formatTime} from '@/PublicUtil/PublicUtil'
export default {
name: "PeopleReContrast"
setup() {
let webSocket = undefined
const resultList = ref([])
// sequence
const accountList = ref([])
const plazaList = ref([])
const zoneList = ref([])
const gateList = ref([])
const querySnapshotRecordForm = reactive(
{
account_id: [],
plaza_id: [],
featureRevisitType: 1,
date: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
}
)
const onAccountChange = function() {
getPlazaList()
}
const getPlazaList = function() {
querySnapshotRecordForm.plaza_id = []
plazaList.value = []
snapshotRecordApi.getPlazaList(
{
account_id: querySnapshotRecordForm.account_id.toString()
}
).then(
(r) => {
if (isArray(r))
{
plazaList.value = r
}
}
)
}
const getAccountList = function() {
querySnapshotRecordForm.account_id = []
accountList.value = []
snapshotRecordApi.getAccountList().then(
(r) => {
if (isArray(r))
{
accountList.value = r
}
}
)
}
const floatToPercent = function(floatNum) {
if (!floatNum)
{
return 0
}
let formatNum = Math.floor(floatNum * 100)
return formatNum >= 100 ? 100 : formatNum
}
const dealMessage = function(message) {
// scheduleType
const {dates, mallIds, mallNames, status, stepCount, scheduleType, counter} = message
let resObj = {}
resObj.dates = dates
resObj.mallIds = mallIds
resObj.mallNames = mallNames
resObj.status = status
resObj.progress = floatToPercent(stepCount)
resObj.totalNum = 0
resObj.totalPage = 0
resObj.current = 0
resObj.curPageSize = 0
resObj.currentPage = 0
resObj.scheduleType = scheduleType
if (counter)
{
// dataNum dateMallNum step totalData totalDate totalMall totalMallDateProduct allDataCount
resObj.totalNum = counter.allDataCount
resObj.totalPage = counter.totalMallDateProduct
resObj.current = counter.dataNum
resObj.curPageSize = counter.totalData
resObj.currentPage = counter.dateMallNum
}
if (resultList.value.length)
{
const isSameScheduleType = resultList.value.some(item => item.scheduleType === scheduleType)
isSameScheduleType
? resultList.value.forEach(item => {
//
item.progress = floatToPercent(stepCount)
if (counter)
{
item.totalNum = counter.allDataCount
item.totalPage = counter.totalMallDateProduct
item.current = counter.dataNum
item.curPageSize = counter.totalData
item.currentPage = counter.dateMallNum
}
})
: resultList.value.push(resObj)
resObj = {}
}
else
{
resultList.value.push(resObj)
resObj = {}
}
}
const initializeWebSocket = function() {
if (webSocket !== undefined)
{
webSocket.close()
}
resultList.value = []
webSocket = new WebSocket(`ws://store.keliuyun.com:9998/recal/schedule/rebuildFeatureLib${querySnapshotRecordForm.featureRevisitType}`)
webSocket.onopen = queryData
webSocket.onmessage = function(event) {
let message = JSON.parse(event.data)
log('[onmessage]:', message)
dealMessage(message)
if (message.stepCount === 1)
{
webSocket.close()
}
}
}
const queryData = function() {
const rawData = toRaw(querySnapshotRecordForm)
switch (rawData.featureRevisitType)
{
case 1:
{
const data = {
mallIds: rawData.plaza_id,
scheduleType: `rebuildFeatureLib${rawData.featureRevisitType}`,
}
featureLibraryRebuildApi.getStaffResult(data)
break
}
case 2:
{
const data = {
mallIds: rawData.plaza_id,
scheduleType: `rebuildFeatureLib${rawData.featureRevisitType}`,
startDate: formatDate(rawData.date) + ' ' + '00:00:00',
endDate: formatDate(rawData.date) + ' ' + '23:59:59',
}
featureLibraryRebuildApi.getCustomResult(data)
break
}
}
}
const __main = function() {
getAccountList()
}
__main()
return {
// sequence
accountList,
plazaList,
zoneList,
gateList,
resultList,
querySnapshotRecordForm,
onAccountChange,
initializeWebSocket,
}
}
}
</script>
......
......@@ -355,11 +355,11 @@ export default {
window.open(url)
}
const initialize = function() {
const __main = function() {
getAccountList()
}
initialize()
__main()
return {
// scalar
......
......@@ -335,11 +335,11 @@ export default {
window.open(url)
}
const initialize = function() {
const __main = function() {
getAccountList()
}
initialize()
__main()
return {
// scalar
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!