Commit 65ead378 by 李君

数据重放

1 parent 4af6d4ad
...@@ -15,7 +15,7 @@ const axiosInstance = axios.create( ...@@ -15,7 +15,7 @@ const axiosInstance = axios.create(
axiosInstance.interceptors.request.use( axiosInstance.interceptors.request.use(
config => { config => {
// Cookies.set('atoken','3f719c88-cfe6-42f6-b2c7-a6b355c46c10') // Cookies.set('atoken','1a1fea7a-7ff1-4055-811d-32603abbba06')
if(!Cookies.get('atoken')){ if(!Cookies.get('atoken')){
ElMessage({ ElMessage({
message: `登录过期,请重新登录`, message: `登录过期,请重新登录`,
......
...@@ -49,6 +49,10 @@ const menuRoute = [ ...@@ -49,6 +49,10 @@ const menuRoute = [
path: 'SystemLog', path: 'SystemLog',
component: () => import("@/views/SystemLog/index.vue"), component: () => import("@/views/SystemLog/index.vue"),
}, },
{
path: 'DataReplay',
component: () => import("@/views/DataReplay/DataReplay.vue"),
},
] ]
}, },
] ]
......
import axiosInstance from "@/Request/PublicAxiosInstance"
import {filterEmptyValueInObject} from "@/PublicUtil/PublicUtil"
class DataReplay {
getRematch(data) {
return axiosInstance.request(
{
method: 'POST',
url: `/rematch`,
data: data
}
)
}
}
const DataReplayApi = new DataReplay()
export default DataReplayApi
<template> <template>
<a-form :model="queryForm" layout="inline" :label-col="{ style: { width: '100px' } }"> <a-form :model="queryForm" layout="inline" :label-col="{ style: { width: '100px' } }">
<a-form-item label="集团:" style="padding: 5px 0"> <a-form-item label="集团:" style="padding: 5px 0">
<a-select v-model:value="queryForm.account_id" <a-select v-model:value="queryForm.accountId" style="width: 280px" @change="onAccountChange"
style="width: 280px" :options="accountList" optionFilterProp="label" show-search>
mode="multiple"
:maxTagCount="1"
@change="onAccountChange"
:options="accountList"
optionFilterProp="label"
show-search
>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="广场:" style="padding: 5px 0"> <a-form-item label="广场:" style="padding: 5px 0">
<a-select v-model:value="queryForm.plaza_id" <a-select v-model:value="queryForm.mallId" style="width: 280px" :options="plazaList"
style="width: 280px" optionFilterProp="label" show-search>
mode="multiple"
:maxTagCount="1"
@change="onPlazaChange"
:options="plazaList"
optionFilterProp="label"
show-search
>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="监控点名称:" style="padding: 5px 0"> <a-form-item label="日期:" style="padding: 5px 0">
<a-select v-model:value="queryForm.gate_id" <a-range-picker v-model:value="queryForm.repairDate" style="width: 280px" />
style="width: 280px"
mode="multiple"
:maxTagCount="1"
@change="onGateChange"
:options="gateList"
optionFilterProp="label"
show-search
>
<template #dropdownRender="{ menuNode: menu }">
<v-nodes :vnodes="menu"/>
<a-divider style="margin: 4px 0"/>
<div
@mousedown="e => e.preventDefault()"
>
<a-button @click="selectAll('监控点名称')" type="link">全选</a-button>
<a-button @click="clearAll('监控点名称')" type="link">清空</a-button>
</div>
</template>
</a-select>
</a-form-item> </a-form-item>
<a-form-item label="设备通道号:" style="padding: 5px 0"> <a-form-item label="是否重提:" style="padding: 5px 0">
<a-select v-model:value="queryForm.channel_id" <a-select v-model:value="queryForm.reExtractFeature" style="width: 280px">
style="width: 280px" <a-select-option value="true"></a-select-option>
mode="multiple" <a-select-option value="false"></a-select-option>
:maxTagCount="1"
:options="channelList"
optionFilterProp="label"
show-search
>
<template #dropdownRender="{ menuNode: menu }">
<v-nodes :vnodes="menu"/>
<a-divider style="margin: 4px 0"/>
<div
@mousedown="e => e.preventDefault()"
>
<a-button @click="selectAll('设备通道号')" type="link">全选</a-button>
<a-button @click="clearAll('设备通道号')" type="link">清空</a-button>
</div>
</template>
</a-select> </a-select>
</a-form-item> </a-form-item>
<a-form-item label="修补日期:" style="padding: 5px 0"> <a-form-item label="是否重读:" style="padding: 5px 0">
<a-date-picker v-model:value="queryForm.repairDate" style="width: 280px"/> <a-select v-model:value="queryForm.reTrack" style="width: 280px">
</a-form-item> <a-select-option value="true"></a-select-option>
<a-form-item label="参考日期:" style="padding: 5px 0"> <a-select-option value="false"></a-select-option>
<a-date-picker v-model:value="queryForm.referenceDate" style="width: 280px"/> </a-select>
</a-form-item>
<a-form-item label="开始时间:" style="padding: 5px 0">
<a-time-picker v-model:value="queryForm.startTime" style="width: 280px"/>
</a-form-item>
<a-form-item label="结束时间:" style="padding: 5px 0">
<a-time-picker v-model:value="queryForm.endTime" style="width: 280px"/>
</a-form-item>
<a-form-item label="数据波动比例:" style="padding: 5px 0">
<a-input v-model:value="queryForm.minFactor" style="width: 129px"/>
<a-input v-model:value="queryForm.maxFactor" style="width: 129px"/>
</a-form-item>
<a-form-item style="padding: 5px 0">
<a-button type="primary" @click="preview" :loading="isLoading">预览</a-button>
</a-form-item> </a-form-item>
<a-form-item style="padding: 5px 0"> <a-form-item style="padding: 5px 0">
<a-button type="primary" @click="repair" :loading="isLoading">修补</a-button> <a-button type="primary" @click="preview" :loading="isLoading">添加</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
<!-- <a-table :dataSource="dataList" v-loading="isLoading" :columns="columns" :pagination="false">
<div style="display:flex; justify-content: flex-end;padding: 3px">
<a-button @click="suspendRepair" type="primary">暂停修复</a-button>
</div>
<a-table :dataSource="dataList" v-loading="isLoading" :columns="columns" :pagination="false">
<template #status="{ text }"> <template #status="{ text }">
<span :class="getClass(text)">{{ text }}</span> <span :class="getClass(text)">{{ text }}</span>
</template> </template>
<template #operation="{ record }"> </a-table> -->
<div>
<a-button @click="deleteRecord(record)" type="primary" danger>删除任务</a-button>
</div>
</template>
</a-table>
</template> </template>
<script> <script>
import {reactive, ref, toRaw} from 'vue' import {
import moment from 'moment' reactive,
import snapshotRecordApi from '@/views/SnapshotCluster/SnapshotRecord/SnapshotRecordApi' ref,
import {isArray} from '@/PublicUtil/Judgment' toRaw
import {filterEmptyValueInObject, formatDate, formatTime} from '@/PublicUtil/PublicUtil' } from 'vue'
import dataRepairApi from '@/views/DataRepair/DataRepairApi' import moment from 'moment'
import {PlusOutlined} from '@ant-design/icons-vue' import snapshotRecordApi from '@/views/SnapshotCluster/SnapshotRecord/SnapshotRecordApi'
import {
const columns = [ isArray
{ } from '@/PublicUtil/Judgment'
import {
filterEmptyValueInObject,
formatDate,
formatTime
} from '@/PublicUtil/PublicUtil'
import dataReplayApi from '@/views/DataReplay/DataReplay.js'
import {
PlusOutlined
} from '@ant-design/icons-vue'
const columns = [{
title: '监控点名称', title: '监控点名称',
dataIndex: 'gatename', dataIndex: 'gatename',
align: 'center', align: 'center',
...@@ -168,12 +108,14 @@ const columns = [ ...@@ -168,12 +108,14 @@ const columns = [
customRender: 'operation', customRender: 'operation',
}, },
}, },
] ]
export default { export default {
components: { components: {
PlusOutlined, PlusOutlined,
VNodes: (_, {attrs}) => { VNodes: (_, {
attrs
}) => {
return attrs.vnodes return attrs.vnodes
}, },
}, },
...@@ -182,68 +124,38 @@ export default { ...@@ -182,68 +124,38 @@ export default {
const isLoading = ref(false) const isLoading = ref(false)
const isSuspended = ref(false) const isSuspended = ref(false)
// sequence // sequence
const resultList = ref([])
const accountList = ref([]) const accountList = ref([])
const plazaList = ref([]) const plazaList = ref([])
const zoneList = ref([])
const gateList = ref([])
const channelList = ref([])
const dataList = ref([]) const dataList = ref([])
const queryForm = reactive( const queryForm = reactive({
{ accountId: '',
account_id: [], mallId: '',
plaza_id: [], repairDate: [moment().format('YYYY-MM-DD'),moment().format('YYYY-MM-DD')],
gate_id: [], reExtractFeature:'true',
channel_id: [], reTrack:'true'
repairDate: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'), })
referenceDate: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
startTime: moment('00:00:00', 'HH:mm:ss'),
endTime: moment('23:59:59', 'HH:mm:ss'),
minFactor: 0.85,
maxFactor: 1.2,
}
)
const onAccountChange = function() { const onAccountChange = function() {
getPlazaList() getPlazaList()
queryForm.gate_id = []
gateList.value = []
queryForm.channel_id = []
channelList.value = []
}
const onPlazaChange = function() {
getGateList()
queryForm.channel_id = []
channelList.value = []
}
const onGateChange = function() {
getChannelList()
} }
const getPlazaList = function() { const getPlazaList = function() {
queryForm.plaza_id = [] queryForm.mallId = ''
plazaList.value = [] plazaList.value = []
snapshotRecordApi.getPlazaList( snapshotRecordApi.getPlazaList({
{ account_id: queryForm.accountId.toString()
account_id: queryForm.account_id.toString() }).then(
}
).then(
(r) => { (r) => {
if (isArray(r)) if (isArray(r)) {
{ for (const item of r) {
for (const item of r) plazaList.value.push({
{
plazaList.value.push(
{
value: item.id, value: item.id,
label: item.name, label: item.name,
})
} }
) if(r&&r.length){
queryForm.mallId=r[0].id
} }
} }
} }
...@@ -251,261 +163,45 @@ export default { ...@@ -251,261 +163,45 @@ export default {
} }
const getAccountList = function() { const getAccountList = function() {
queryForm.account_id = [] queryForm.accountId = ''
accountList.value = [] accountList.value = []
snapshotRecordApi.getAccountList().then( snapshotRecordApi.getAccountList().then(
(r) => { (r) => {
if (isArray(r)) if (isArray(r)) {
{ for (const item of r) {
for (const item of r) accountList.value.push({
{
accountList.value.push(
{
value: item.id, value: item.id,
label: item.name, label: item.name,
})
} }
) if(r&&r.length){
} queryForm.accountId=r[0].id
} getPlazaList()
}
)
}
const getGateList = async function() {
queryForm.gate_id = []
gateList.value = []
let tempList = []
for (const account of queryForm.account_id)
{
for (const plaza of queryForm.plaza_id)
{
const r = await dataRepairApi.getGateList(
{
accountIds: account,
mallIds: plaza,
}
)
if (isArray(r))
{
for (const item of r)
{
tempList.push(
{
value: item.id,
label: item.name,
}
)
}
}
}
} }
gateList.value = [...new Set(tempList)]
} }
const getChannelList = async function() {
queryForm.channel_id = []
channelList.value = []
let tempList = []
for (const gate of queryForm.gate_id)
{
const r = await dataRepairApi.getChannelList(
{
gateId: gate,
}
)
if (isArray(r))
{
for (const item of r)
{
tempList.push(
{
value: item,
label: item,
} }
) )
} }
}
}
channelList.value = tempList
}
const floatToPercent = function(floatNum) {
if (!floatNum)
{
return 0
}
let formatNum = Math.floor(floatNum * 100)
return formatNum >= 100 ? 100 : formatNum
}
const preview = async function() {
isLoading.value = true
isSuspended.value = false
dataList.value = []
const rawData = toRaw(queryForm)
for (const channelId of rawData.channel_id)
{
if (isSuspended.value === true)
{
isLoading.value = false
return
}
const data = filterEmptyValueInObject(
{
channelSerialnum: channelId,
maxFactor: rawData.maxFactor,
minFactor: rawData.minFactor,
targetStartDate: formatDate(rawData.repairDate) + ' ' + formatTime(rawData.startTime),
targetEndDate: formatDate(rawData.repairDate) + ' ' + formatTime(rawData.endTime),
sourceStartDate: formatDate(rawData.referenceDate) + ' ' + formatTime(rawData.startTime),
sourceEndDate: formatDate(rawData.referenceDate) + ' ' + formatTime(rawData.endTime),
}
)
const r = await dataRepairApi.preview(data) const preview = function() {
r.data.status = '未执行'
dataList.value.push(r.data)
}
isLoading.value = false
isSuspended.value = false
}
const repair = async function() {
isLoading.value = true isLoading.value = true
isSuspended.value = false
dataList.value = []
const rawData = toRaw(queryForm) const rawData = toRaw(queryForm)
for (const channelId of rawData.channel_id) console.log(rawData.repairDate)
{ dataReplayApi.getRematch(filterEmptyValueInObject({
if (isSuspended.value === true) accountId: rawData.accountId.toString(),
{ mallId: rawData.mallId.toString(),
isLoading.value = false reExtractFeature: rawData.reExtractFeature,
return reTrack: rawData.reTrack,
} startDate:rawData.repairDate[0],
const data = filterEmptyValueInObject( endDate:rawData.repairDate[1],
{ })).then(
channelSerialnum: channelId, (r) => {
maxFactor: rawData.maxFactor, console.log(r)
minFactor: rawData.minFactor,
targetStartDate: formatDate(rawData.repairDate) + ' ' + formatTime(rawData.startTime),
targetEndDate: formatDate(rawData.repairDate) + ' ' + formatTime(rawData.endTime),
sourceStartDate: formatDate(rawData.referenceDate) + ' ' + formatTime(rawData.startTime),
sourceEndDate: formatDate(rawData.referenceDate) + ' ' + formatTime(rawData.endTime),
}
)
const r = await dataRepairApi.repair(data)
if (r.msg_code === 200)
{
r.data.status = '已修复'
}
else
{
r.data.status = '未执行'
}
dataList.value.push(r.data)
}
isLoading.value = false
isSuspended.value = false
}
const getClass = function(text) {
switch (text)
{
case '已修复':
{
return 'success'
}
case '未执行':
{
return 'failed'
}
default:
{
break
}
}
}
const deleteRecord = function({channelSerialnum}) {
if (channelSerialnum === undefined)
{
return
} }
dataList.value = dataList.value.filter(
item => item.channelSerialnum !== channelSerialnum
) )
queryForm.channel_id = queryForm.channel_id.filter(
item => item !== channelSerialnum
)
}
const suspendRepair = function() {
if (isLoading.value === true)
{
isSuspended.value = true
}
}
const selectAll = function(text) {
switch (text)
{
case '监控点名称':
{
queryForm.gate_id = []
for (const item of gateList.value)
{
queryForm.gate_id.push(item.value)
}
onGateChange()
break
}
case '设备通道号':
{
queryForm.channel_id = []
for (const item of channelList.value)
{
queryForm.channel_id.push(item.value)
}
break
}
default:
{
break
}
}
}
const clearAll = function(text) {
switch (text)
{
case '监控点名称':
{
queryForm.gate_id = []
onGateChange()
break
} }
case '设备通道号':
{
queryForm.channel_id = []
break
}
default:
{
break
}
}
}
const __main = function() { const __main = function() {
getAccountList() getAccountList()
...@@ -519,29 +215,16 @@ export default { ...@@ -519,29 +215,16 @@ export default {
// sequence // sequence
accountList, accountList,
plazaList, plazaList,
zoneList,
gateList,
channelList,
resultList,
dataList, dataList,
queryForm, queryForm,
columns, columns,
// function // function
onAccountChange, onAccountChange,
onPlazaChange,
onGateChange,
preview, preview,
repair,
getClass,
deleteRecord,
suspendRepair,
selectAll,
clearAll,
} }
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import "./DataRepair.less";
</style> </style>
...@@ -85,6 +85,12 @@ ...@@ -85,6 +85,12 @@
<span style="padding: 0 5px">系统日志</span> <span style="padding: 0 5px">系统日志</span>
</div> </div>
</a-menu-item> </a-menu-item>
<a-menu-item :key="'/Main/DataReplay'">
<div class="flex-vertical-center">
<img :src="require('./Icons/2.svg')" style="height: auto;width:20px"/>
<span style="padding: 0 5px">数据重放</span>
</div>
</a-menu-item>
</a-menu> </a-menu>
</el-aside> </el-aside>
<el-main> <el-main>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!