修改补召
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="default-main online">
|
||||
|
||||
|
||||
<div class="online_header">
|
||||
<TableHeader date-picker ref="tableHeaderRef">
|
||||
<template #select>
|
||||
@@ -56,15 +56,16 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="通讯状态">
|
||||
<el-select v-model="tableStore.table.params.comFlagStatus" clearable placeholder="请选择通讯状态"
|
||||
style="width: 100%" >
|
||||
<el-option label="正常" value="1" />
|
||||
<el-option label="中断" value="0" />
|
||||
|
||||
<el-select v-model="tableStore.table.params.comFlagStatus" clearable placeholder="请选择通讯状态"
|
||||
style="width: 100%">
|
||||
<el-option label="正常" value="1" />
|
||||
<el-option label="中断" value="0" />
|
||||
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="筛选数据">
|
||||
<el-input v-model="tableStore.table.params.searchValue" clearable placeholder="请输入关键字"></el-input>
|
||||
<el-input v-model="tableStore.table.params.searchValue" clearable
|
||||
placeholder="请输入关键字"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<template #operation>
|
||||
@@ -86,9 +87,10 @@
|
||||
</div>
|
||||
<el-dialog v-model="timePopUp" draggable title="补招" width="500">
|
||||
补招时间:
|
||||
<el-date-picker v-model="timeData" type="datetimerange" format="YYYY-MM-DD HH:mm:00"
|
||||
value-format="YYYY-MM-DD HH:mm:00" range-separator="至" date-format="YYYY-MM-DD" time-format="HH:mm:00"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" style="width: 400px" :disabledDate="disabledDate" />
|
||||
<el-date-picker v-model="timeData" type="datetimerange" format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss" range-separator="至" date-format="YYYY-MM-DD" time-format="HH:mm:ss"
|
||||
start-placeholder="开始日期" end-placeholder="结束日期" style="width: 400px" :disabledDate="disabledDate"
|
||||
:default-time="defaultTimeRange" />
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="timePopUp = false">取消</el-button>
|
||||
@@ -148,6 +150,10 @@ const classificationData = dictData.getBasicData('Statistical_Type', ['Report_Ty
|
||||
const treeData = ref([])
|
||||
const idArr = ref([])
|
||||
const timeData = ref([])
|
||||
const defaultTimeRange: [Date, Date] = [
|
||||
new Date(2000, 0, 1, 0, 0, 0),
|
||||
new Date(2000, 0, 1, 23, 59, 59)
|
||||
]
|
||||
const logList: any = ref([])
|
||||
const activeName = ref(0)
|
||||
const getTreeData = async () => {
|
||||
@@ -207,7 +213,7 @@ const tableStore = new TableStore({
|
||||
{
|
||||
title: '网络参数',
|
||||
field: 'ip',
|
||||
align: 'center',width:'120px',
|
||||
align: 'center', width: '120px',
|
||||
formatter: function (row) {
|
||||
return row.cellValue ? row.cellValue : '/'
|
||||
}
|
||||
@@ -297,7 +303,7 @@ const tableStore = new TableStore({
|
||||
// tableStore.table.params.searchEndTime = tableHeaderRef.value.datePickerRef.timeValue[1]
|
||||
},
|
||||
loadCallback: () => {
|
||||
tableStore.table.data = tree2List(filterTreeByKeyword( tableStore.table.data,tableStore.table.params.searchValue), Math.random() * 1000)
|
||||
tableStore.table.data = tree2List(filterTreeByKeyword(tableStore.table.data, tableStore.table.params.searchValue), Math.random() * 1000)
|
||||
tableStore.table.column[0].title = formData.value.statisticalType.name
|
||||
|
||||
chartsRef.value && chartsRef.value.getTableStoreParams(tableStore.table.params)
|
||||
@@ -322,7 +328,7 @@ tableStore.table.params.statisticalType = []
|
||||
tableStore.table.params.scale = []
|
||||
tableStore.table.params.manufacturer = []
|
||||
tableStore.table.params.loadType = []
|
||||
tableStore.table.params.comFlagStatus=''
|
||||
tableStore.table.params.comFlagStatus = ''
|
||||
provide('tableStore', tableStore)
|
||||
const tree2List = (list: any, id?: string) => {
|
||||
//存储结果的数组
|
||||
@@ -363,65 +369,65 @@ const tree2List = (list: any, id?: string) => {
|
||||
* @returns {Array} 筛选后的嵌套树形数据,保持原层级
|
||||
*/
|
||||
function filterTreeByKeyword(treeData, keyword) {
|
||||
// 关键词为空,直接返回原树(深拷贝,避免修改原数据)
|
||||
if (!keyword || keyword.trim() === '') {
|
||||
return JSON.parse(JSON.stringify(treeData));
|
||||
}
|
||||
const targetKey = keyword.trim();
|
||||
// 存储需要保留的节点ID(匹配节点+所有上级+所有下级)
|
||||
const keepIdSet = new Set();
|
||||
// 关键词为空,直接返回原树(深拷贝,避免修改原数据)
|
||||
if (!keyword || keyword.trim() === '') {
|
||||
return JSON.parse(JSON.stringify(treeData));
|
||||
}
|
||||
const targetKey = keyword.trim();
|
||||
// 存储需要保留的节点ID(匹配节点+所有上级+所有下级)
|
||||
const keepIdSet = new Set();
|
||||
|
||||
// 第一步:递归遍历树形,标记所有需要保留的节点ID
|
||||
const markKeepNodes = (node, parentNodes = []) => {
|
||||
// 1. 若当前节点名称包含关键词,标记自身+所有上级+所有下级
|
||||
const isMatch = node.name && node.name.includes(targetKey);
|
||||
if (isMatch) {
|
||||
// 标记自身
|
||||
keepIdSet.add(node.id);
|
||||
// 标记所有上级父节点
|
||||
parentNodes.forEach(pNode => keepIdSet.add(pNode.id));
|
||||
// 标记所有下级子节点(递归)
|
||||
const markChildren = (childNode) => {
|
||||
keepIdSet.add(childNode.id);
|
||||
if (childNode.children && childNode.children.length) {
|
||||
childNode.children.forEach(markChildren);
|
||||
// 第一步:递归遍历树形,标记所有需要保留的节点ID
|
||||
const markKeepNodes = (node, parentNodes = []) => {
|
||||
// 1. 若当前节点名称包含关键词,标记自身+所有上级+所有下级
|
||||
const isMatch = node.name && node.name.includes(targetKey);
|
||||
if (isMatch) {
|
||||
// 标记自身
|
||||
keepIdSet.add(node.id);
|
||||
// 标记所有上级父节点
|
||||
parentNodes.forEach(pNode => keepIdSet.add(pNode.id));
|
||||
// 标记所有下级子节点(递归)
|
||||
const markChildren = (childNode) => {
|
||||
keepIdSet.add(childNode.id);
|
||||
if (childNode.children && childNode.children.length) {
|
||||
childNode.children.forEach(markChildren);
|
||||
}
|
||||
};
|
||||
if (node.children && node.children.length) {
|
||||
node.children.forEach(markChildren);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (node.children && node.children.length) {
|
||||
node.children.forEach(markChildren);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 递归遍历子节点,传递当前节点的上级链(parentNodes + 当前节点)
|
||||
if (node.children && node.children.length) {
|
||||
node.children.forEach(child => markKeepNodes(child, [...parentNodes, node]));
|
||||
}
|
||||
};
|
||||
// 2. 递归遍历子节点,传递当前节点的上级链(parentNodes + 当前节点)
|
||||
if (node.children && node.children.length) {
|
||||
node.children.forEach(child => markKeepNodes(child, [...parentNodes, node]));
|
||||
}
|
||||
};
|
||||
|
||||
// 遍历根节点,开始标记
|
||||
treeData.forEach(rootNode => markKeepNodes(rootNode));
|
||||
// 遍历根节点,开始标记
|
||||
treeData.forEach(rootNode => markKeepNodes(rootNode));
|
||||
|
||||
// 第二步:递归重构树形,只保留标记过的节点,保持层级
|
||||
const rebuildTree = (node) => {
|
||||
// 若当前节点无需保留,直接返回null
|
||||
if (!keepIdSet.has(node.id)) {
|
||||
return null;
|
||||
}
|
||||
// 深拷贝当前节点,避免修改原数据
|
||||
const newNode = { ...node };
|
||||
// 递归处理子节点,过滤掉无需保留的,只保留有效子节点
|
||||
if (newNode.children && newNode.children.length) {
|
||||
const newChildren = newNode.children.map(child => rebuildTree(child)).filter(Boolean);
|
||||
newNode.children = newChildren;
|
||||
} else {
|
||||
newNode.children = [];
|
||||
}
|
||||
return newNode;
|
||||
};
|
||||
// 第二步:递归重构树形,只保留标记过的节点,保持层级
|
||||
const rebuildTree = (node) => {
|
||||
// 若当前节点无需保留,直接返回null
|
||||
if (!keepIdSet.has(node.id)) {
|
||||
return null;
|
||||
}
|
||||
// 深拷贝当前节点,避免修改原数据
|
||||
const newNode = { ...node };
|
||||
// 递归处理子节点,过滤掉无需保留的,只保留有效子节点
|
||||
if (newNode.children && newNode.children.length) {
|
||||
const newChildren = newNode.children.map(child => rebuildTree(child)).filter(Boolean);
|
||||
newNode.children = newChildren;
|
||||
} else {
|
||||
newNode.children = [];
|
||||
}
|
||||
return newNode;
|
||||
};
|
||||
|
||||
// 重构根节点,过滤掉null的根节点
|
||||
const filteredTree = treeData.map(rootNode => rebuildTree(rootNode)).filter(Boolean);
|
||||
return filteredTree;
|
||||
// 重构根节点,过滤掉null的根节点
|
||||
const filteredTree = treeData.map(rootNode => rebuildTree(rootNode)).filter(Boolean);
|
||||
return filteredTree;
|
||||
}
|
||||
|
||||
|
||||
@@ -439,7 +445,7 @@ const makeUp = () => {
|
||||
.getCheckboxRecords()
|
||||
.filter((item: any) => item.level == '6') || []
|
||||
|
||||
|
||||
|
||||
|
||||
if (list.length == 0) {
|
||||
return ElMessage({
|
||||
@@ -478,24 +484,29 @@ const makeUpSubmit = () => {
|
||||
reCallStartTime: timeData.value[0]
|
||||
}
|
||||
|
||||
socket(form)
|
||||
timePopUp.value = false
|
||||
logPopUp.value = true
|
||||
setTimeout(() => {
|
||||
socket(form)
|
||||
timePopUp.value = false
|
||||
logPopUp.value = true
|
||||
}, 500)
|
||||
}
|
||||
const socket = async (form: any) => {
|
||||
const url = (localStorage.getItem('WebSocketUrl2') || 'null')//'ws://192.168.1.67:10405/api/recell/')
|
||||
const url = (localStorage.getItem('WebSocketUrl2') || 'null')//'ws://192.168.1.68:10405/api/recell/'
|
||||
logList.value = []
|
||||
await dataSocket.socketServe.connect(`${url}${adminInfo.id}`)
|
||||
await dataSocket.socketServe.send(form)
|
||||
setTimeout(() => {
|
||||
dataSocket.socketServe.send(form)
|
||||
}, 500)
|
||||
logList.value.push({
|
||||
type: '',
|
||||
time: formatDate(new Date(), 'YYYY-MM-DD HH:mm:ss'),
|
||||
time: formatDate(new Date(), 'YYYY-MM-DD HH:mm:ss'),
|
||||
name: '开始补召,请稍等...',
|
||||
})
|
||||
await dataSocket.socketServe.registerCallBack('message', (res: any) => {
|
||||
if (res.code == undefined) return
|
||||
logList.value.push({
|
||||
type: res.code == 500 ? 'error' : '',
|
||||
time: formatDate(new Date(), 'YYYY-MM-DD HH:mm:ss'),
|
||||
time: formatDate(new Date(), 'YYYY-MM-DD HH:mm:ss'),
|
||||
name: res.message
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user