服务器管理模块新增批量分组功能;为列表查询新增分组筛选条件,支持按分组过滤数据

1、解决服务器管理模块中,下架设备标签页下列表按钮状态未正确缓存的问题
2、服务器管理模块新增批量分组功能
3、为列表查询新增分组筛选条件,支持按分组过滤数据
This commit is contained in:
康冉冉
2026-04-02 17:55:56 +08:00
parent 1c72ba640e
commit 618b9138ef
3 changed files with 100 additions and 9 deletions
+9
View File
@@ -799,6 +799,15 @@ export function removeServer(query) {
data: query
})
}
// 批量分组
export function bindSwitch(query) {
return request({
url: '/system/registration/bindSwitch',
method: 'post',
data: query
})
}
// 内存详细信息
export function initialMemoryDetails(query) {
return request({
+1 -1
View File
@@ -5,7 +5,7 @@
<template v-if="config && config.tableButton && config.tableButton.top">
<el-col :span="1.5" v-for="item of config.tableButton.top">
<!-- <el-button :type="item.type" plain size="mini" :icon="item.icon" @click="handleClick(item,{})" :hasPermi="[item.hasPermi]">{{item.content}}</el-button>-->
<el-button :ref="`${item.content}`" :type="item.type" plain size="mini" :icon="item.icon" @click="handleClick(item,{})" v-if="checkPermi([item.hasPermi])">{{item.content}}</el-button>
<el-button style="padding: 7px 12px;" :ref="`${item.content}`" :type="item.type" plain size="mini" :icon="item.icon" @click="handleClick(item,{})" v-if="checkPermi([item.hasPermi])">{{item.content}}</el-button>
</el-col>
</template>
<right-toolbar v-if="!(config && config.colTopHiddenIcon)" :modelIdent="this.modelIdent" :showSearch.sync="showSearch" @queryTable="renderList" @columnsChange="columnsChange" :columns="columns"></right-toolbar>
+90 -8
View File
@@ -85,7 +85,21 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="6">
<el-form-item label="分组" title="分组" prop="switchClientId">
<el-select
v-model="queryParams.switchClientId"
placeholder="请选择分组"
clearable>
<el-option
v-for="item in switchGroupList"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item class="lastBtnSty">
<el-button type="primary" size="mini" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -221,14 +235,22 @@
<el-button type="primary" @click="confirmCopy">确定</el-button>
</div>
</el-dialog>
<!-- 分组弹窗 -->
<el-dialog title="分组" :visible.sync="batchGroupOpen" append-to-body width="900px">
<Form ref="batchGroupFormRef" :formList="batchGroupForm" :ruleFormData="batchGroupRuleForm" :config="{labelWidth: '160px', buttonGroup: []}" @fnClick="callback"></Form>
<div style="text-align: right;margin-right: 20px;margin-bottom: 20px;">
<el-button type="primary" style="margin-left: 10px;" @click="submitSwitchGroup">提交</el-button>
<el-button @click="batchGroupOpen = false">取消</el-button>
</div>
</el-dialog>
</div>
</div>
</template>
<script setup name="Register">
import Form from '@/components/form/index.vue';
import {listHandle, networkList, getScriptResultBySn, getLogicalNode, addRemark, updateRemark, repBandwidthSubmit, bindBusPublic, getAlarmFlag,
virNetInterfaceChild, removeAlarmFlag, frpConnectLink, listFrpcConfig, removeServer, getLossList, agentIsNew, updateAgentManage} from '@/api/disRevenue/resource';
import {listHandle, networkList, getScriptResultBySn, getLogicalNode, addRemark, updateRemark, repBandwidthSubmit, bindBusPublic, getAlarmFlag, bindSwitch,
virNetInterfaceChild, removeAlarmFlag, frpConnectLink, listFrpcConfig, removeServer, getLossList, agentIsNew, updateAgentManage, listAllSwitchName} from '@/api/disRevenue/resource';
import {listAllBusinessList} from "@/api/disRevenue/earnManage"
import TableList from '@/components/table/index.vue';
import MonitorStrategy from '../serverMonitorStrat/monitorStrategy';
@@ -328,6 +350,7 @@
{content: '下架', fnCode: 'unShelve', type: 'danger', icon: 'el-icon-bottom', hasPermi: 'resource:serverRegister:unShelve'},
{content: '批量更新agent', fnCode: 'updateAgent', type: 'primary', icon: 'el-icon-refresh-right', hasPermi: 'resource:serverRegister:updateAgent'},
{content: '批量复制', fnCode: 'copyList', type: 'primary', icon: 'el-icon-copy-document', hasPermi: 'resource:serverRegister:copyList'},
{content: '批量分组', fnCode: 'batchGroup', type: 'primary', icon: 'el-icon-coin', hasPermi: 'resource:serverRegister:batchGroup'},
],
line: [
{content: '选择业务IP', fnCode: 'pubilcNet', type: 'primary', icon: 'el-icon-thumb', showName: 'multiPublicIpStatus', showVal: '0', hasPermi: 'resource:serverRegister:pubilcNet'},
@@ -399,22 +422,36 @@
// alarmFlagHight: false,
frpOpen: false,
frpDialogContent: {},
keepAliveFirst: false,
selectedFields: [],
selectedRows: [],
copyDialogVisible: false,
switchGroupList: [], // 分组数据
batchGroupOpen: false, // 分组弹窗
switchIdsMap: {},
batchGroupRuleForm: {},
batchGroupForm: [{
config: {title: '',labelWidth: '140px', colSpan: 'disBlock m0Auto'},
controls: {
id: {label: 'ID',hidden: true},
switchClientId: {label: '交换机', span: 18, type: 'select', options:[], required: true},
deployDevice: {label: '服务器列表', span: 18, type: 'textarea', rows: 15, required: true},
}
}],
}
},
created() {
this.keepAliveFirst = true;
this.getHightLight();
this.fnBusNameList();
this.fnLogicalNode();
this.switchList();
},
activated() {
this.$nextTick(() => {
if (!this.keepAliveFirst) {
if (this.activeName === 'first') {
this.getHightLight();
} else if (this.activeName === 'second') {
this.fnGetLossList();
}
});
},
@@ -463,6 +500,17 @@
});
});
},
// 获取交换机下拉
switchList() {
listAllSwitchName({}).then(val => {
if(val && val.data) {
this.switchGroupList = val && val.data.map(item => {
this.switchIdsMap[item.clientId] = item;
return Object.assign(item, {label: item.switchName, value: item.clientId});
});
}
});
},
// 处理子组件传递的新值
handleValueChange(newValue) {
// 父组件更新自身数据,实现同步
@@ -498,9 +546,7 @@
this.roleList = response.rows;
delete this.queryParams.resetVal;
this.queryParams.total = response.total;
this.keepAliveFirst = false;
}).catch(() => {
this.keepAliveFirst = false;
this.config = {...this.firstConfig};
});
},
@@ -948,6 +994,29 @@
this.selectedFields = ['clientId'];
this.copyDialogVisible = true;
break;
case 'batchGroup':
if (selectList && selectList.length === 0) {
this.$message.warning('请选择数据!');
return;
}
this.batchGroupOpen = true;
this.batchGroupRuleForm = {};
if (this.$refs['batchGroupFormRef']?.$refs.ruleForm) {
this.$refs['batchGroupFormRef'].$refs.ruleForm.resetFields();
}
this.batchGroupForm[0].controls['switchClientId'].options = this.switchGroupList;
if (selectList && selectList.length > 0) {
let groupParams = '';
selectList && selectList.forEach((item, index) => {
if (selectList.length === index + 1) {
groupParams+= item.clientId;
} else {
groupParams+= item.clientId + '\n'
}
});
this.$set(this.batchGroupRuleForm, 'deployDevice', groupParams);
}
break;
case 'export':
let paramsList = Object.assign({}, this.queryParams,rowData);
this.download("system/registration/export", paramsList, `服务器管理_${new Date().getTime()}.xlsx`, null, 'json');
@@ -1025,6 +1094,19 @@
this.getHightLight();
});
},
// 分组
async submitSwitchGroup() {
if (!await this.fnFormValid('batchGroupFormRef', 'batchGroupRuleForm')) return;
let params = JSON.parse(JSON.stringify(this.batchGroupRuleForm));
params['switchName'] = this.switchIdsMap[params.switchClientId].switchName;
bindSwitch(params).then(res => {
this.$refs['tabRef'].selectList = [];
this.$modal.msgSuccess(res.msg);
this.batchGroupOpen = false;
this.batchGroupRuleForm = {};
this.getList();
})
},
// 添加标签
async submitTag() {
if (!await this.fnFormValid('tagFormRef', 'tagRuleForm')) return;