联调服务器脚本策略剩余功能、脚本执行结果、AGENT更新模块

This commit is contained in:
康冉冉
2025-09-26 19:39:36 +08:00
parent 9f24b9f588
commit 3729bdda81
14 changed files with 527 additions and 301 deletions

View File

@@ -336,3 +336,67 @@ export function delPolicy(Ids) {
method: 'delete'
})
}
/** ----------------脚本执行结果------------ */
export function getScriptResultBySn(data) {
return request({
url: '/rocketmq/remote/getScriptResultBySn',
method: 'post',
data: data
})
}
// 获取资源分组列表
export function getResGroupList() {
return request({
url: '/system/resourceMonitor/resourceGroupList',
method: 'get'
})
}
// 传参 分页参数和 资源组id
export function listRegisterList(data) {
return request({
url: '/system/resourceMonitor/getRegisterListByGroupId',
method: 'post',
data: data
})
}
/** ----------------AGENT更新------------ */
// 查询列表
export function listAgentManage(query) {
return request({
url: '/rocketmq/agentManagement/list',
method: 'post',
data: query
})
}
// 查询详细
export function getAgentManage(Id) {
return request({
url: '/rocketmq/agentManagement/' + Id,
method: 'get'
})
}
// 新增
export function addAgentManage(data) {
return request({
url: '/rocketmq/agentManagement',
method: 'post',
data: data
})
}
// 修改
export function updateAgentManage(data) {
return request({
url: '/rocketmq/agentManagement',
method: 'put',
data: data
})
}
// 删除
export function delAgentManage(Ids) {
return request({
url: '/rocketmq/agentManagement/' + Ids,
method: 'delete'
})
}

View File

@@ -145,9 +145,9 @@ aside {
//main-container全局样式
.app-container {
//height: calc(100vh - 132px);
height: calc(100vh - 85px);
padding: 8px 20px 20px;
//overflow: scroll;
overflow: auto;
}
.app-viewContent {
height: calc(100vh - 85px);

View File

@@ -1,89 +1,89 @@
<template>
<div>
<template v-for="(item, index) in options">
<template v-if="values.includes(item.value)">
<span
v-if="(item.raw.listClass == 'default' || item.raw.listClass == '') && (item.raw.cssClass == '' || item.raw.cssClass == null)"
:key="item.value"
:index="index"
:class="item.raw.cssClass"
>{{ item.label + ' ' }}</span
>
<el-tag
v-else
:disable-transitions="true"
:key="item.value"
:index="index"
:type="item.raw.listClass == 'primary' ? '' : item.raw.listClass"
:class="item.raw.cssClass"
>
{{ item.label + ' ' }}
</el-tag>
</template>
</template>
<template v-if="unmatch && showValue">
{{ unmatchArray | handleArray }}
</template>
</div>
</template>
<script>
export default {
name: "DictTag",
props: {
options: {
type: Array,
default: null,
},
value: [Number, String, Array],
// 当未找到匹配的数据时显示value
showValue: {
type: Boolean,
default: true,
},
separator: {
type: String,
default: ","
}
},
data() {
return {
unmatchArray: [], // 记录未匹配的项
}
},
computed: {
values() {
if (this.value === null || typeof this.value === 'undefined' || this.value === '') return []
return Array.isArray(this.value) ? this.value.map(item => '' + item) : String(this.value).split(this.separator)
},
unmatch() {
this.unmatchArray = []
// 没有value不显示
if (this.value === null || typeof this.value === 'undefined' || this.value === '' || this.options.length === 0) return false
// 传入值为数组
let unmatch = false // 添加一个标志来判断是否有未匹配项
this.values.forEach(item => {
if (!this.options.some(v => v.value === item)) {
this.unmatchArray.push(item)
unmatch = true // 如果有未匹配项将标志设置为true
}
})
return unmatch // 返回标志的值
},
},
filters: {
handleArray(array) {
if (array.length === 0) return ''
return array.reduce((pre, cur) => {
return pre + ' ' + cur
})
},
}
}
</script>
<style scoped>
.el-tag + .el-tag {
margin-left: 10px;
}
</style>
<template>
<div>
<template v-for="(item, index) in options">
<template v-if="values.includes(item.value)">
<span
v-if="(item.raw.listClass == 'default' || item.raw.listClass == '') && (item.raw.cssClass == '' || item.raw.cssClass == null)"
:key="item.value"
:index="index"
:class="item.raw.cssClass"
>{{ item.label + ' ' }}</span
>
<el-tag
v-else
:disable-transitions="true"
:key="item.value"
:index="index"
:type="item.raw.listClass == 'primary' ? '' : item.raw.listClass"
:class="item.raw.cssClass"
>
{{ item.label + ' ' }}
</el-tag>
</template>
</template>
<template v-if="unmatch && showValue">
{{ unmatchArray | handleArray }}
</template>
</div>
</template>
<script>
export default {
name: "DictTag",
props: {
options: {
type: Array,
default: null,
},
value: [Number, String, Array],
// 当未找到匹配的数据时显示value
showValue: {
type: Boolean,
default: true,
},
separator: {
type: String,
default: ","
}
},
data() {
return {
unmatchArray: [], // 记录未匹配的项
}
},
computed: {
values() {
if (this.value === null || typeof this.value === 'undefined' || this.value === '') return []
return Array.isArray(this.value) ? this.value.map(item => '' + item) : String(this.value).split(this.separator)
},
unmatch() {
this.unmatchArray = []
// 没有value不显示
if (this.value === null || typeof this.value === 'undefined' || this.value === '' || this.options.length === 0) return false
// 传入值为数组
let unmatch = false // 添加一个标志来判断是否有未匹配项
this.values.forEach(item => {
if (!this.options.some(v => v.value === item)) {
this.unmatchArray.push(item)
unmatch = true // 如果有未匹配项将标志设置为true
}
})
return unmatch // 返回标志的值
},
},
filters: {
handleArray(array) {
if (array.length === 0) return ''
return array.reduce((pre, cur) => {
return pre + ' ' + cur
})
},
}
}
</script>
<style scoped>
.el-tag + .el-tag {
margin-left: 10px;
}
</style>

View File

@@ -1,6 +1,5 @@
<template>
<div>
{{config && config.key}}
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" :label-width="config && config.labelWidth || '130px'" :key="config && config.key" class="demo-ruleForm">
<template v-for="(formItem,index) of formList">
<h4 v-if="formItem && formItem.config && formItem.config.title" class="form-header h4">{{formItem.config.title}}</h4>
@@ -84,7 +83,7 @@
<template v-else-if="formVal.type === 'date'">
<el-date-picker
v-model="ruleForm[key]"
:type="formVal.type || 'date'"
type="date"
:disabled="toBoolean(formVal.disabled || formItem.config.readonly)"
:placeholder="toBoolean(formVal.disabled || formItem.config.readonly) ? null : formVal.placeholder || `请输入${formVal.label}`"
:format="formVal.format || 'yyyy-MM-dd'"
@@ -92,10 +91,22 @@
></el-date-picker>
</template>
<template v-else-if="formVal.type === 'datetime'">
<el-date-picker
v-model="ruleForm[key]"
type="datetime"
:disabled="toBoolean(formVal.disabled || formItem.config.readonly)"
:placeholder="toBoolean(formVal.disabled || formItem.config.readonly) ? null : formVal.placeholder || `请输入${formVal.label}`"
:format="formVal.format || 'yyyy-MM-dd HH:mm:ss'"
:value-format="formVal.valueFormat || 'yyyy-MM-dd HH:mm:ss'"
@[formVal.eventName]="(val) => handleChange(key,val,formVal)"
></el-date-picker>
</template>
<template v-else-if="formVal.type === 'month'">
<el-date-picker
v-model="ruleForm[key]"
:type="formVal.type || 'date'"
type="month"
:disabled="toBoolean(formVal.disabled || formItem.config.readonly)"
:format="formVal.format || 'yyyy-MM'"
:value-format="formVal.valueFormat || 'yyyy-MM'"
@@ -106,7 +117,7 @@
<template v-else-if="formVal.type === 'daterange'">
<el-date-picker
v-model="ruleForm[key]"
:type="formVal.type || 'date'"
type="daterange"
:disabled="toBoolean(formVal.disabled || formItem.config.readonly)"
:format="formVal.format || 'yyyy-MM-dd'"
:value-format="formVal.valueFormat || 'yyyy-MM-dd'"
@@ -119,7 +130,7 @@
<template v-else-if="formVal.type === 'monthrange'">
<el-date-picker v-model="ruleForm[key]"
:type="formVal.type || 'date'"
type="monthrange"
:disabled="toBoolean(formVal.disabled || formItem.config.readonly)"
:format="formVal.format || 'yyyy-MM'"
:value-format="formVal.valueFormat || 'yyyy-MM'"

View File

@@ -1,7 +1,7 @@
<template>
<div class="w100 h100">
<!-- 表格头部按钮 -->
<el-row :gutter="10" class="mb8">
<el-row :gutter="10" style="margin: 0 0 8px 0;">
<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>

View File

@@ -513,7 +513,7 @@ export const dynamicRoutes = [
path: ':id?',
component: () => import('@/views/disRevenue/resource/agentUpdate/agentUpdateView'),
name: 'agentUpdateView',
meta: { title: '文件管理信息', activeMenu: '/disRevenue/resource/agentUpdate' }
meta: { title: 'AGENT更新信息', activeMenu: '/disRevenue/resource/agentUpdate' }
}
]
},

View File

@@ -2,9 +2,9 @@
<div class="app-container pageTopForm">
<el-form :model="queryParams" ref="queryRef" size="small" v-show="showSearch" label-width="auto">
<el-col :span="8">
<el-form-item label="搜索" prop="switchName">
<el-form-item label="资源名称" prop="queryName">
<el-input
v-model="queryParams.switchName"
v-model="queryParams.queryName"
placeholder="请输入资源名称/内网IP地址"
clearable
@keyup.enter="handleQuery"
@@ -12,13 +12,13 @@
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="更新结果" prop="bandwidthType">
<el-form-item label="更新结果" prop="lastUpdateResult">
<el-select
v-model="queryParams.bandwidthType"
v-model="queryParams.lastUpdateResult"
placeholder="请选择更新结果"
clearable>
<el-option
v-for="dict in dict.type.eps_bandwidth_type"
v-for="dict in dict.type.agent_update_result"
:key="dict.value"
:label="dict.label"
:value="dict.value"/>
@@ -33,8 +33,11 @@
</el-col>
</el-form>
<TableList :columns="columns" :config="config" :queryParams="queryParams" :tableList="tableList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange">
<template #tempType="{ row, column }">
<dict-tag :options="dict.type.rm_topology_type" :value="row.connectedDeviceType"/>
<template #tempStatus="{ row, column }">
<dict-tag :options="dict.type.rm_register_online_state" :value="row.status"/>
</template>
<template #tempResult="{ row, column }">
<dict-tag :options="dict.type.agent_update_result" :value="row.lastUpdateResult"/>
</template>
</TableList>
</div>
@@ -42,11 +45,11 @@
<script setup>
import TableList from "@/components/table/index.vue"
import {listMonitorTemp, delMonitorTemp} from "@/api/disRevenue/resource"
import {listAgentManage, delAgentManage} from "@/api/disRevenue/resource"
export default {
name: 'AgentUpdate',
components: {TableList},
dicts: ['rm_topology_type','eps_bandwidth_type'],
dicts: ['rm_register_online_state','eps_bandwidth_type', 'agent_update_result'],
data() {
return {
loading: true,
@@ -55,26 +58,26 @@
queryParams: {
total: 0,
pageNum: 1,
pageSize: 10
pageSize: 10,
queryName: '',
lastUpdateResult: ''
},
// 列显隐信息
columns: {
id: { label: `ID`,width: '50'},
sn: { label: `硬件SN`, minWidth: '150'},
switchName: { label: `资源名称`, minWidth: '250', visible: true },
switchSn: { label: `内网IP`,minWidth: '100'},
interfaceName: { label: `AGENT版本`,minWidth: '150', visible: true },
type: { label: `状态`, minWidth: '100' },
serverName: { label: `定义更新频率`,minWidth: '200'},
connectedDeviceType: { label: `定义更新时间`,minWidth: '150', visible: true },
connected: { label: `文件目录`,minWidth: '200'},
conType: { label: `最后一次更新结果`,minWidth: '160', visible: true},
createTime: { label: `最后一次更新时间`,minWidth: '160', visible: true},
hardwareSn: { label: `硬件SN`, minWidth: '150'},
resourceName: { label: `资源名称`, minWidth: '250', visible: true },
internalIp: { label: `内网IP`,minWidth: '100', visible: true},
agentVersion: { label: `AGENT版本`,minWidth: '150', visible: true },
status: { label: `状态`, minWidth: '100', slotName: 'tempStatus'},
method: { label: `更新方式`,minWidth: '200'},
scheduledUpdateTime: { label: `更新时间`,minWidth: '150', visible: true },
fileUrlType: { label: `文件地址格式`,minWidth: '200'},
fileUrl: { label: `文件地址`,minWidth: '200'},
lastUpdateResult: { label: `最后一次更新结果`,minWidth: '160', slotName: 'tempResult', visible: true},
lastUpdateTime: { label: `最后一次更新时间`,minWidth: '160', visible: true},
},
config: {
searcherForm: [
{label: '模版名称', prop: 'roleName', type: 'selset', options: []}
],
tableButton: {
top: [
{content: '配置更新策略', fnCode: 'add', type: 'primary', icon: 'el-icon-plus', hasPermi: 'disRevenue:resource:agentUpdate:add'},
@@ -82,8 +85,8 @@
line: [
{content: '详情', fnCode: 'details', type: 'text', icon: 'el-icon-view', hasPermi: 'disRevenue:resource:agentUpdate:details'},
{content: '修改更新策略', fnCode: 'edit', type: 'text', icon: 'el-icon-edit', hasPermi: 'disRevenue:resource:agentUpdate:edit'},
{content: '手动更新', fnCode: 'update', type: 'text', icon: 'el-icon-refresh-right', hasPermi: 'disRevenue:resource:agentUpdate:update'},
{},{}
// {content: '手动更新', fnCode: 'update', type: 'text', icon: 'el-icon-refresh-right', hasPermi: 'disRevenue:resource:agentUpdate:update'},
{}
]
}
}
@@ -92,11 +95,16 @@
created() {
this.getList();
},
activated() {
this.$nextTick(() => {
this.getList();
});
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
listMonitorTemp(this.queryParams).then(response => {
listAgentManage(this.queryParams).then(response => {
this.tableList = response.rows;
this.queryParams.total = response.total;
this.loading = false;
@@ -146,7 +154,7 @@
break;
case 'delete':
this.$modal.confirm('是否确认删除数据项?').then(function() {
return delMonitorTemp(selectChange)
return delAgentManage(selectChange)
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功")
@@ -161,7 +169,7 @@
// });
// this.download("/system/alarmManage/export", {properties: dataList,}, `拓扑管理_${new Date().getTime()}.xlsx`);
let paramsList = Object.assign({}, this.queryParams,rowData);
this.download("system/alarmManage/export", paramsList, `资源监控策略_${new Date().getTime()}.xlsx`, null, 'json');
this.download("system/agentManagement/export", paramsList, `AGENT更新_${new Date().getTime()}.xlsx`, null, 'json');
break;
default:
}

View File

@@ -6,30 +6,33 @@
<script setup name="Handle">
import Form from '@/components/form/index.vue';
import {addGroup, getGroup, updateGroup, resNameList} from "@/api/disRevenue/resource"
import {addAgentManage, getAgentManage, updateAgentManage, resNameList} from "@/api/disRevenue/resource"
export default {
name: 'AgentUpdateView',
components: {Form},
dicts: ['policy_method', 'rm_register_online_state', 'agent_update_result'],
data() {
return {
ruleForm: {},
ruleForm: {fileUrlType: '1'},
formList: [],
paramsData: {},
config: {}
config: {},
includeList: {}
}
},
created() {
this.paramsData = this.$route && this.$route.query;
if (this.paramsData && this.paramsData.id) {
this.getFormDataList(this.paramsData.id);
} else {
this.fnFormList();
this.getResNameList();
}
if (this.paramsData && this.paramsData.readonly) {
this.config = {
buttonGroup: [{title: '返回', fnCode: 'goBack'}]
};
}
this.fnFormList();
this.getResNameList();
},
methods: {
// formList集合
@@ -38,29 +41,28 @@
config: {title: '配置更新策略', colSpan: 'disBlock', readonly: this.paramsData.readonly},
controls: {
id: {label: 'ID',hidden: true},
sn: {label: '硬件SN', span: 12, type: 'input', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
name: {label: '资源名称', span: 12, type: 'input', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
ip: {label: '内网IP', span: 12, type: 'input', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
type: {label: '状态', span: 12, type: 'select', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
agent: {label: 'AGENT版本', span: 12, type: 'input', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
groupName: {label: '定义更新频率', span: 12, type: 'select', required: true},
date: {label: '定义更新时间', span: 12, type: 'date', required: true},
fileType: {label: '文件格式', span: 12, type: 'radio', required: true,options: [{label:'平台文件地址', value: '1'}, {label: '外网HTTP(S)',value: '2'}],
hidden: this.paramsData && this.paramsData.id ? true : false, warningTitle: '注意当文件大小超过100M时请选择【外网HTTP(S)】地址格式'},
address: {label: '文件目录', span: 12, type: 'select', required: true, warningTitle: '您选择的文件已经超过100M请更改文件地址格式选择'},
includedDevices: {label: '生效服务器', span: 24,required: true, type: 'transfer',options: [],hidden: this.paramsData && this.paramsData.id ? true : false},
lastResult: {label: '最后一次更新结果', span: 12, type: 'select', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
lastTime: {label: '最后一次更新时间', span: 12, type: 'datetimme', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
hardwareSn: {label: '硬件SN', span: 12, type: 'input', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
resourceName: {label: '资源名称', span: 12, type: 'input', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
internalIp: {label: '内网IP', span: 12, type: 'input', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
status: {label: '状态', span: 12, type: 'select', options: this.dict.type.rm_register_online_state, disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
agentVersion: {label: 'AGENT版本', span: 12, type: 'input', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
method: {label: '更新方式', span: 12, type: 'select', options: this.dict.type.policy_method, eventName: 'change', required: true},
scheduledUpdateTime: {label: '更新时间', span: 12, type: 'datetime', required: true, hidden: objVal && objVal.method === '1' ? false: true},
fileUrlType: {label: '文件格式', span: 12, type: 'radio', required: true,options: [{label: '外网HTTP(S)',value: '1'}], warningTitle: '注意当文件大小超过100M时请选择【外网HTTP(S)】地址格式'},
fileUrl: {label: '文件地址', span: 12, type: 'input', required: true, placeholder: '请输入外网地址'},
includeIds: {label: '生效服务器', span: 24,required: true, type: 'transfer',options: [],hidden: this.paramsData && this.paramsData.id ? true : false},
lastUpdateResult: {label: '最后一次更新结果', span: 12, type: 'select', options: this.dict.type.agent_update_result, disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
lastUpdateTime: {label: '最后一次更新时间', span: 12, type: 'datetime', disabled: true, hidden: this.paramsData && this.paramsData.id ? false : true},
}
}];
},
// 获取详情
getFormDataList(id) {
getGroup(id).then(val => {
getAgentManage(id).then(val => {
if (val && val.data) {
if (val.data && val.data['includedDevices']) {
val.data['includedDevices'] = val.data['includedDevices'].split(',');
}
val.data['method'] = val.data['method'].toString();
val.data['fileUrlType'] = val.data['fileUrlType'].toString();
this.fnFormList(val.data);
this.ruleForm = val.data;
}
}).catch(() => {
@@ -70,8 +72,9 @@
// 包含设备
getResNameList() {
resNameList().then(val => {
this.formList[0].controls['includedDevices']['options']= val && val.map(item => {
return Object.assign({label: item.resourceName, key: item.resourceName});
this.formList[0].controls['includeIds']['options']= val && val.map(item => {
this.includeList[item.id] = item;
return Object.assign({label: item.resourceName, key: item.id});
});
}).catch(() => {
this.$modal.msgError("操作失败")
@@ -81,11 +84,22 @@
callback(result, dataVal, formVal) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'method':
if (dataVal === '1') {
this.formList[0].controls.scheduledUpdateTime['hidden'] = false;
} else {
this.formList[0].controls.scheduledUpdateTime['hidden'] = true;
}
break;
case 'submit':
dataVal['includedDevices'] = dataVal['includedDevices'].join();
let fnType = addGroup;
if (dataVal && !dataVal.id) {
dataVal['includeNames'] = dataVal && dataVal['includeIds'].map(id => this.includeList[id].resourceName);
dataVal['includeIds'] = dataVal['includeIds'].join();
dataVal['includeNames'] = dataVal['includeNames'].join();
}
let fnType = addAgentManage;
if (dataVal && dataVal.id) {
fnType = updateGroup;
fnType = updateAgentManage;
}
fnType(dataVal).then(response => {
this.$modal.msgSuccess(response.msg);

View File

@@ -3,37 +3,38 @@
<el-row :gutter="20">
<splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
<!--部门数据-->
<pane size="16">
<pane size="23">
<el-col>
<div class="head-container">
<el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
<span class="mb10 disInlineBlock">资源分组</span>
<!-- <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />-->
</div>
<div class="head-container">
<el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" />
<el-tree :data="deptOptions" :props="defaultProps" :current-node-key="currentNodeKey" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" />
</div>
</el-col>
</pane>
<!--用户数据-->
<pane size="84">
<pane size="77">
<el-form :model="queryParams" ref="queryRef" v-show="showSearch" size="small" label-width="80px">
<el-col :span="7">
<el-form-item label="名称" prop="switchName">
<el-col :span="9">
<el-form-item label="资源名称" prop="queryName">
<el-input
v-model="queryParams.switchName"
placeholder="请输入名称"
v-model="queryParams.queryName"
placeholder="请输入资源名称/硬件SN"
clearable
@keyup.enter="handleQuery"
@keyup.enter.native="handleQuery(1)"
/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="类型" prop="bandwidthType">
<el-col :span="9">
<el-form-item label="资源类型" prop="resourceType">
<el-select
v-model="queryParams.bandwidthType"
placeholder="请选择类型"
v-model="queryParams.resourceType"
placeholder="请选择资源类型"
clearable>
<el-option
v-for="dict in dict.type.rm_topology_type"
v-for="dict in dict.type.rm_register_resource_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"/>
@@ -49,28 +50,27 @@
</el-form>
<input type="file" ref="fileInput" @change="handleFileChange" style="display: none;">
<TableList :columns="columns" :config="config" :queryParams="queryParams" :tableList="roleList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange">
<template v-slot:tableExpand="slotProps">
<div v-for="(val, key) of expandList" style="padding: 5px 0 5px 70px;">
<div style="width: 150px;" class="ml10 disInlineBlock">{{val}}</div>
<div class="ml10 disInlineBlock">{{slotProps.row[key]}}</div>
</div>
<!-- <template v-slot:tableExpand="slotProps">-->
<!-- <div v-for="(val, key) of expandList" style="padding: 5px 0 5px 70px;">-->
<!-- <div style="width: 150px;" class="ml10 disInlineBlock">{{val}}</div>-->
<!-- <div class="ml10 disInlineBlock">{{slotProps.row[key]}}</div>-->
<!-- </div>-->
<!-- </template>-->
<!-- 资源类型 -->
<template #tempResType="{ row, column }">
<dict-tag :options="dict.type.rm_register_resource_type" :value="row.resourceType"/>
</template>
<!-- 在线状态 -->
<template #tempOnlineStatus="{ row, column }">
<dict-tag :options="dict.type.rm_register_online_state" :value="row.onlineStatus"/>
</template>
</TableList>
<!-- 新建文件夹 -->
<el-dialog title="命令执行结果" :visible.sync="open" width="600px" append-to-body>
<el-dialog title="命令执行结果" :visible.sync="open" width="800px" append-to-body>
<div class="block">
<el-timeline>
<el-timeline-item timestamp="2018/4/12" placement="top">
<h4>更新 Github 模板</h4>
<p>王小虎 提交于 2018/4/12 20:46</p>
</el-timeline-item>
<el-timeline-item timestamp="2018/4/3" placement="top">
<h4>更新 Github 模板</h4>
<p>王小虎 提交于 2018/4/3 20:46</p>
</el-timeline-item>
<el-timeline-item timestamp="2018/4/2" placement="top">
<h4>更新 Github 模板</h4>
<p>王小虎 提交于 2018/4/2 20:46</p>
<el-timeline reverse="true">
<el-timeline-item v-for="item of timelineList" :timestamp="item.createTime" placement="top">
<pre>{{item.content}}</pre>
</el-timeline-item>
</el-timeline>
</div>
@@ -84,8 +84,7 @@
<script setup>
import TableList from "@/components/table/index.vue"
import EchartsPie from "@/components/echartsList/pie.vue"
import {listTopology, delTopology} from "@/api/disRevenue/resource"
import {deptTreeSelect } from "@/api/system/user"
import {listRegisterList, delTopology, getResGroupList, getScriptResultBySn} from "@/api/disRevenue/resource"
import { Splitpanes, Pane } from "splitpanes"
import Treeselect from "@riophae/vue-treeselect"
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
@@ -93,7 +92,7 @@
export default {
name: 'RemoteManage',
components: {TableList,EchartsPie, Splitpanes, Pane, Treeselect},
dicts: ['rm_topology_type'],
dicts: ['rm_register_online_state', 'rm_register_resource_type'],
data() {
return {
loading: true,
@@ -106,35 +105,34 @@
label: "label",
disabled: true
},
currentNodeKey: 0, // 默认选中
showSearch: true,
roleList: [],
queryParams: {
total: 0,
pageNum: 1,
pageSize: 10
pageSize: 10,
queryName: '',
resourceType: ''
},
// 列显隐信息
columns: {
id: { label: `ID`, width: '50', visible: false },
switchName: { label: `名称`, minWidth: '250', visible: true },
switchSn: { label: `类型`, minWidth: '200', visible: true},
interfaceName: { label: `大小(KB)`, minWidth: '100', visible: true },
connectedDeviceType: { label: `路径`, minWidth: '200', visible: true },
serverName: { label: `描述`, minWidth: '200', visible: true},
md5: { label: `md5值`, minWidth: '160', visible: true},
createBy: { label: `创建人`, minWidth: '160', visible: true},
createTime: { label: `创建时间`, minWidth: '160', visible: true},
serverPort: { label: `修改时间`,minWidth: '160', visible: true }
resourceName: { label: `资源名称`, minWidth: '250', visible: true },
hardwareSn: { label: `硬件SN`, minWidth: '200'},
description: { label: `描述`, minWidth: '200'},
resourceType: { label: `资源类型`, minWidth: '100', slotName: 'tempResType'},
inIp: { label: `内网IP`, minWidth: '160', visible: true},
ipAddress: { label: `公网IP`, minWidth: '200', visible: true },
resourcePort: { label: `管理端口`, minWidth: '160', visible: true},
onlineStatus: { label: `在线状态`, minWidth: '160', slotName: 'tempOnlineStatus'},
},
config: {
expand: true,
searcherForm: [
{label: '交换机名称', prop: 'roleName', type: 'selset', options: []}
],
// expand: true, // 表格下拉
tableButton: {
line: [
{content: '详情', fnCode: 'details', type: 'text', icon: 'el-icon-view', hasPermi: 'disRevenue:resource:fileManage:details'},
{content: '修改', fnCode: 'edit', type: 'text', icon: 'el-icon-edit', hasPermi: 'disRevenue:resource:fileManage:edit'},
// {content: '修改', fnCode: 'edit', type: 'text', icon: 'el-icon-edit', hasPermi: 'disRevenue:resource:fileManage:edit'},
{content: '查看脚本执行结果', fnCode: 'result', type: 'text', icon: 'el-icon-s-check', hasPermi: 'disRevenue:resource:fileManage:result'},
{}
]
@@ -147,6 +145,11 @@
serverName: 'IPv4地址',
},
timelineList: [
{content: '【服务器节点名称1】执行脚本命令', time: '2025-12-12 12:12:12'},
{content: '【服务器节点名称1】执行脚本命令', time: '2025-12-11 12:12:12'},
{content: '【服务器节点名称1】执行脚本命令', time: '2025-12-10 12:12:12'}
],
open: false,
title: '',
moveList: [],
@@ -164,7 +167,6 @@
}
},
created() {
this.getList();
this.getDeptTree();
},
methods: {
@@ -183,8 +185,16 @@
},
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then(response => {
this.deptOptions = response.data;
getResGroupList().then(res => {
if (res && res.data) {
let treeList = [{id: 0, label: '所有资源', disabled: false}];
res.data && res.data.forEach(item => {
treeList.push({id: item.id, label: item.groupName, disabled: false});
});
this.deptOptions = treeList;
this.$refs.tree.setCurrentKey(0);
this.getList();
}
})
},
// 筛选节点
@@ -194,13 +204,17 @@
},
// 节点单击事件
handleNodeClick(data) {
this.queryParams.deptId = data.id;
if (data.id === 0) {
delete this.queryParams.id;
} else {
this.queryParams.id = data.id;
}
this.handleQuery();
},
/** 查询列表 */
getList() {
this.loading = true;
listTopology(this.addDateRange(this.queryParams)).then(response => {
listRegisterList(this.queryParams).then(response => {
this.roleList = response.rows;
this.queryParams.total = response.total;
this.loading = false;
@@ -215,7 +229,8 @@
/** 搜索按钮操作 */
handleQuery(val) {
if (val && val === 1) {
delete this.queryParams.deptId;
delete this.queryParams.id;
this.$refs.tree.setCurrentKey(0);
}
this.queryParams.pageNum = 1;
this.getList();
@@ -224,7 +239,7 @@
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryRef");
this.handleQuery();
this.handleQuery(1);
},
submitForm(num){
@@ -257,13 +272,19 @@
this.$router.push({
path:'/disRevenue/resource/remoteManage/view',
query:{
id: rowData.id,
hardwareSn: rowData.hardwareSn,
readonly: true
}
});
break;
case 'result':
this.open = true;
// 获取详情
getScriptResultBySn({hardwareSn: rowData.hardwareSn}).then(val => {
this.timelineList = val && val.data && val.data.scriptResult || [];
}).catch(() => {
this.$modal.msgError("操作失败")
});
break;
case 'delete':
this.$modal.confirm('是否确认删除数据项?').then(function() {
@@ -290,4 +311,9 @@
::v-deep .el-timeline .el-timeline-item:last-child .el-timeline-item__tail {
display: block!important;
}
::v-deep .el-tree-node__label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>

View File

@@ -2,24 +2,31 @@
<div class="app-container mt20">
<Form :formList="formList" :ruleFormData="ruleForm" :config="paramsData && paramsData.readonly === 'true' ? {buttonGroup: []} : {}" @fnClick="callback"></Form>
<div v-if="paramsData && paramsData.readonly === 'true'" class="w100 mt50">
<p style="font-size: 1.2rem;font-weight: 500;border-bottom: 1px solid #e7e7e7;">{{netWorkCard.title}}</p>
<div v-for="item of netWorkCard.list" class="mt50">
<div v-for="(val,index) of item.data" style="width: 80%;margin: auto;" :class="index + 1 === item.data.length ? 'border' : 'borderType'">
<div style="width: 20%;border-right: 1px solid #e7e7e7;" class="ml10 disInlineBlock"><p>{{val.name}}</p></div>
<p style="width: 75%" class="ml10 disInlineBlock">{{val.content}}</p>
</div>
</div>
<!-- <p style="font-size: 1.2rem;font-weight: 500;border-bottom: 1px solid #e7e7e7;">{{netWorkCard.title}}</p>-->
<!-- <div v-for="item of netWorkCard.list" class="mt50">-->
<!-- <div v-for="(val,index) of item.data" style="width: 80%;margin: auto;" :class="index + 1 === item.data.length ? 'border' : 'borderType'">-->
<!-- <div style="width: 20%;border-right: 1px solid #e7e7e7;" class="ml10 disInlineBlock"><p>{{val.name}}</p></div>-->
<!-- <p style="width: 75%" class="ml10 disInlineBlock">{{val.content}}</p>-->
<!-- </div>-->
<!-- </div>-->
<p style="font-size: 1.2rem;font-weight: 500;border-bottom: 1px solid #e7e7e7;">命令执行结果</p>
<el-timeline reverse="true">
<el-timeline-item v-for="item of timelineList" :timestamp="item.createTime" placement="top">
<pre>{{item.content}}</pre>
</el-timeline-item>
</el-timeline>
</div>
<el-button v-if="paramsData && paramsData.readonly === 'true'" class="mb20 mt20" style="float: right;" @click="callback({fnCode: 'cancle'})">返回</el-button>
<el-button v-if="paramsData && paramsData.readonly === 'true'" type="primary" class="mb20 mt20" style="float: right;" @click="callback({fnCode: 'cancle'})">返回</el-button>
</div>
</template>
<script setup name="Handle">
import Form from '@/components/form/index.vue';
import {addGroup, getGroup, updateGroup, resNameList} from "@/api/disRevenue/resource"
import {addGroup, getScriptResultBySn, updateGroup, resNameList} from "@/api/disRevenue/resource"
export default {
name: 'RemoteManageView',
components: {Form},
dicts: ['rm_register_online_state', 'rm_register_resource_type'],
data() {
return {
ruleForm: {},
@@ -45,16 +52,20 @@
]
},
]
}
},
timelineList: [
{content: '【服务器节点名称1】执行脚本命令', time: '2025-12-12 12:12:12'},
{content: '【服务器节点名称1】执行脚本命令', time: '2025-12-11 12:12:12'},
{content: '【服务器节点名称1】执行脚本命令', time: '2025-12-10 12:12:12'}
],
}
},
created() {
this.paramsData = this.$route && this.$route.query;
if (this.paramsData && this.paramsData.id) {
this.getFormDataList(this.paramsData.id);
if (this.paramsData && this.paramsData.hardwareSn) {
this.getFormDataList(this.paramsData.hardwareSn);
}
this.fnFormList();
this.getResNameList();
},
methods: {
// formList集合
@@ -63,34 +74,26 @@
config: {title: '', colSpan: 'disBlock', readonly: this.paramsData.readonly},
controls: {
id: {label: 'ID',hidden: true},
groupName: {label: '硬件SN', span: 12, type: 'input', disabled: true},
type: {label: '资源类型', span: 12, type: 'input', disabled: true},
name: {label: '资源名称', span: 12, type: 'input', disabled: true},
hardwareSn: {label: '硬件SN', span: 12, type: 'input', disabled: true},
resourceType: {label: '资源类型', span: 12, type: 'select', options: this.dict.type.rm_register_resource_type, disabled: false},
resourceName: {label: '资源名称', span: 12, type: 'input', disabled: true},
description: {label: '描述', span: 12, type: 'textarea'},
createTime: {label: '内网IP', span: 12, type: 'input'},
includedDevices: {label: '外网IP', span: 12, type: 'input'},
manage: {label: '管理端口', span: 12, type: 'input'},
num: {label: '在线状态', span: 12, type: 'select', disabled: true},
inIp: {label: '内网IP', span: 12, type: 'input'},
ipAddress: {label: '外网IP', span: 12, type: 'input'},
resourcePort: {label: '管理端口', span: 12, type: 'input'},
onlineStatus: {label: '在线状态', span: 12, type: 'select', options: this.dict.type.rm_register_online_state, disabled: true},
md5: {label: '连接方式', span: 12, type: 'select'},
}
}];
},
// 获取详情
getFormDataList(id) {
getGroup(id).then(val => {
if (val && val.data) {
this.ruleForm = val.data;
getScriptResultBySn({hardwareSn: id}).then(val => {
if (val && val.data && val.data.resourceMsg) {
// val.data.resourceMsg.resourceType = Number(val.data.resourceMsg.resourceType);
this.ruleForm = val.data.resourceMsg;
}
}).catch(() => {
this.$modal.msgError("操作失败")
});
},
// 包含设备
getResNameList() {
resNameList().then(val => {
this.formList[0].controls['includedDevices']['options']= val && val.map(item => {
return Object.assign({label: item.resourceName, key: item.resourceName});
});
this.timelineList = val && val.data && val.data.scriptResult || [];
}).catch(() => {
this.$modal.msgError("操作失败")
});
@@ -99,20 +102,20 @@
callback(result, dataVal, formVal) {
if (result && result.fnCode) {
switch (result.fnCode) {
case 'submit':
let fnType = addGroup;
if (dataVal && dataVal.id) {
fnType = updateGroup;
}
fnType(dataVal).then(response => {
this.$modal.msgSuccess(response.msg);
this.$router.push("/resource/fileManage")
}).catch(() => {
this.$modal.msgError("操作失败")
});
break;
// case 'submit':
// let fnType = addGroup;
// if (dataVal && dataVal.id) {
// fnType = updateGroup;
// }
// fnType(dataVal).then(response => {
// this.$modal.msgSuccess(response.msg);
// this.$router.push("/resource/fileManage")
// }).catch(() => {
// this.$modal.msgError("操作失败")
// });
// break;
case 'cancle':
this.$router.push("/resource/fileManage");
this.$router.push("/resource/remoteManage");
break;
default:
}
@@ -130,4 +133,7 @@
.border {
border: 1px solid #e7e7e7;
}
::v-deep .el-timeline .el-timeline-item:last-child .el-timeline-item__tail {
display: block!important;
}
</style>

View File

@@ -1,6 +1,28 @@
<template>
<div>
<el-form :model="form" ref="form" label-width="130px" class="dynamic-form">
<template v-if="showTactics">
<el-col :span="24">
<el-form-item label="策略名称" prop="policyName">
<el-input v-model="form.policyName" :disabled="readonly" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="描述" prop="description">
<el-input v-model="form.description" type="textarea" :disabled="readonly" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="关联资源组" prop="resourceGroupName">
<el-input v-model="form.resourceGroupName" :disabled="readonly" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="包含设备" prop="includedDevicesName">
<el-input v-model="form.includedDevicesName" :disabled="readonly" clearable></el-input>
</el-form-item>
</el-col>
</template>
<!-- 动态源文件部分 循环多个源文件地址 -->
<div v-for="(source, index) in form.sources" :key="index" class="source-item">
<!-- 源文件地址格式 -->
@@ -10,7 +32,7 @@
<!-- <el-radio label="platform">平台文件地址</el-radio>-->
<el-radio label="1">外网HTTP(S)</el-radio>
</el-radio-group>
<div class="tip">注意当文件大小超过100M时请选择外网HTTP(S)地址格式</div>
<div v-if="!readonly" class="tip">注意当文件大小超过100M时请选择外网HTTP(S)地址格式</div>
<!-- <div class="error-tip" v-if="source.sizeError">您选择的文件已经超过100M请更改文件地址格式选择</div>-->
</el-form-item>
</el-col>
@@ -62,6 +84,22 @@
<el-form-item label="定时时间" v-if="form.executionMethod === '1'" prop="scheduledTime" :rules="[{ required: true, message: '请选择定时时间', trigger: 'change' }]">
<el-date-picker v-model="form.scheduledTime" :disabled="readonly" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间" style="width: 100%;"></el-date-picker>
</el-form-item>
<template v-if="showView">
<el-form-item label="策略状态" prop="policyStatus">
<el-select v-model="form.policyStatus" placeholder="请选择执行方式" :disabled="readonly" clearable>
<el-option v-for="dict in dict.type.policy_status" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="下发策略时间" prop="deployTime">
<el-date-picker v-model="form.deployTime" :disabled="readonly" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 100%;"></el-date-picker>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="form.createTime" :disabled="readonly" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 100%;"></el-date-picker>
</el-form-item>
<el-form-item label="修改时间" prop="updateTime">
<el-date-picker v-model="form.updateTime" :disabled="readonly" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" style="width: 100%;"></el-date-picker>
</el-form-item>
</template>
</el-form>
</div>
</template>
@@ -69,7 +107,7 @@
<script>
export default {
name: 'DynamicForm',
dicts: ['policy_method'],
dicts: ['policy_method', 'policy_status'],
props: {
formData: {
type: Object,
@@ -78,9 +116,20 @@
commands: [{commandContent: ''}], // 命令内容数组
})
},
// 是否只读
readonly: {
type: Boolean,
default: false
},
// 是否展示第一级的策略信息
showTactics: {
type: Boolean,
default: false
},
// 详情
showView: {
type: Boolean,
default: false
}
},
watch: {
@@ -89,16 +138,16 @@
immediate: true, // 初始化时立即执行一次
handler(newVal) {
if (newVal && typeof newVal === 'object' && Object.keys(newVal).length === 0) {
this.form = {sources: [{sourceFilePathType: '1', sourceFilePath: ''}], commands: [{commandContent: ''}]};
this.form = JSON.parse(JSON.stringify({sources: [{sourceFilePathType: '1', sourceFilePath: ''}], commands: [{commandContent: ''}]}));
} else {
this.form = newVal;
this.form = JSON.parse(JSON.stringify(newVal));
}
},
},
},
data() {
return {
form: this.formData
form: {}
};
},
methods: {
@@ -127,7 +176,6 @@
submitForm() {
return new Promise((resolve, reject) => {
this.$refs.form.validate((valid) => {
console.log('valid===',valid);
if (valid) {
resolve(this.form);
// // 在这里可以添加自定义验证逻辑,例如检查大文件是否使用了正确的地址格式

View File

@@ -33,6 +33,12 @@
</el-col>
</el-form>
<TableList :columns="columns" :config="config" :queryParams="queryParams" :tableList="tableList" @fnClick="callback" @fnRenderList="getList" @value-change="handleValueChange">
<template #tempMethod="{ row, column }">
<dict-tag :options="dict.type.policy_method" :value="row.executionMethod"/>
</template>
<template #tempResGroup="{ row, column }">
{{resourceGroupIdList[row.resourceGroupId]}}
</template>
<template #tempType="{ row, column }">
<dict-tag :options="dict.type.policy_status" :value="row.policyStatus"/>
</template>
@@ -42,11 +48,11 @@
<script setup>
import TableList from "@/components/table/index.vue"
import {listPolicy, delPolicy} from "@/api/disRevenue/resource"
import {listPolicy, delPolicy, getResMonitorGroup, getPolicyList} from "@/api/disRevenue/resource"
export default {
name: 'ServerScript',
components: {TableList},
dicts: ['policy_status'],
dicts: ['policy_status', 'policy_method'],
data() {
return {
loading: true,
@@ -55,16 +61,18 @@
queryParams: {
total: 0,
pageNum: 1,
pageSize: 10
pageSize: 10,
policyName: '',
policyStatus: ''
},
// 列显隐信息
columns: {
id: { label: `ID`,width: '50'},
policyName: { label: `策略名称`, minWidth: '250', visible: true },
executionMethod: { label: `执行方式`,minWidth: '200',visible: true},
resourceGroupId: { label: `关联资源组`,minWidth: '150', visible: true },
executionMethod: { label: `执行方式`,minWidth: '80', slotName: 'tempMethod', visible: true},
resourceGroupId: { label: `关联资源组`,minWidth: '150', slotName: 'tempResGroup', visible: true },
includedDevicesName: { label: `包含设备`,minWidth: '200', visible: true},
policyStatus: { label: `策略状态`, minWidth: '100', slotName: 'tempType', visible: true },
policyStatus: { label: `策略状态`, minWidth: '80', slotName: 'tempType', visible: true },
sourceFilePath: { label: `源文件路径`,minWidth: '150'},
targetDirectory: { label: `目标目录`,minWidth: '200'},
commandContent: { label: `命令内容`,minWidth: '200'},
@@ -88,16 +96,24 @@
{content: '修改', fnCode: 'edit', type: 'text', icon: 'el-icon-edit', hasPermi: 'disRevenue:resource:monitorStategy:edit'},
{content: '详情', fnCode: 'details', type: 'text', icon: 'el-icon-view', hasPermi: 'disRevenue:resource:monitorStategy:details'},
// {content: '复制', fnCode: 'copy', type: 'text', icon: 'el-icon-document-copy', hasPermi: 'disRevenue:resource:monitorStategy:copy'},
{content: '下发策略', fnCode: 'strategy', type: 'text', icon: 'el-icon-sort-down', hasPermi: 'disRevenue:resource:monitorStategy:strategy'},
{content: '下发策略', fnCode: 'strategy', type: 'text', showName: 'policyStatus', showVal: '0', icon: 'el-icon-sort-down', hasPermi: 'disRevenue:resource:monitorStategy:strategy'},
{content: '删除', fnCode: 'delete', type: 'text', icon: 'el-icon-delete', hasPermi: 'disRevenue:resource:monitorStategy:detele'},
]
}
}
},
resourceGroupIdList: {},
}
},
created() {
this.fnResMonitorGroup();
this.getList();
},
activated() {
this.$nextTick(() => {
this.fnResMonitorGroup();
this.getList();
});
},
methods: {
/** 查询列表 */
getList() {
@@ -108,6 +124,16 @@
this.loading = false;
})
},
// 资源组
fnResMonitorGroup(){
getResMonitorGroup().then(res => {
if (res && res.data) {
res && res.data.forEach(item => {
this.resourceGroupIdList[item.id] = item.groupName;
});
}
});
},
// 处理子组件传递的新值
handleValueChange(newValue) {
// 父组件更新自身数据,实现同步
@@ -143,7 +169,7 @@
break;
case 'details':
this.$router.push({
path:'/disRevenue/resource/serverScript/view',
path:'/disRevenue/resource/serverScript/details',
query:{
id: rowData.id,
readonly: true
@@ -164,6 +190,18 @@
this.$modal.msgSuccess("删除成功")
}).catch(() => {});
break;
case 'strategy':
this.$modal.confirm('是否确认下发策略?').then(() => {
this.$modal.loading();
getPolicyList(rowData.id).then(res => {
this.getList();
this.$modal.msgSuccess(res.msg);
this.$modal.closeLoading();
}).catch(error => {
this.$modal.closeLoading();
});
}).catch(() => {});
break;
case 'export':
// let dataList = [];
// Object.keys(this.columns).forEach(item => {

View File

@@ -1,6 +1,10 @@
<template>
<div class="app-container">
<div>
<div v-if="paramsData && paramsData.readonly">
<DynamicForm :formData="ruleFormDataTow" :showTactics="true" :readonly="true" :showView="true"></DynamicForm>
<el-button type="primary" style="float: right;margin-top: 12px;" class="mb10" @click="goBack">返回</el-button>
</div>
<div v-else>
<el-steps :active="active" finish-status="success">
<el-step title="基本信息"></el-step>
<el-step title="脚本策略"></el-step>
@@ -9,23 +13,23 @@
<!-- 内容区 -->
<div style="margin-top: 30px;">
<!-- active:0 -->
<div v-show="active === 0">
<div v-if="active === 0">
<Form ref="formRef" style="text-align: center;" :formList="formList" :ruleFormData="ruleFormData" :config="config" @fnClick="callback"></Form>
</div>
<!-- active:2 -->
<div v-show="active === 1">
<div v-if="active === 1">
<DynamicForm ref="dyncForm" :formData="ruleFormDataTow"></DynamicForm>
</div>
<!-- active:3 -->
<div v-show="active === 2">
<DynamicForm :formData="ruleFormDataTow" :readonly="true"></DynamicForm>
<div v-if="active === 2">
<DynamicForm :formData="ruleFormDataTow" :showTactics="true" :readonly="true"></DynamicForm>
</div>
</div>
<el-button type="primary" v-show="active > 1" style="float: right;margin-top: 12px;margin-left: 10px;" @click="submit">提交</el-button>
<el-button type="primary" v-show="active < 2" style="float: right;margin-top: 12px;" @click="next('1')">下一步</el-button>
<el-button type="primary" v-show="active > 0" style="float: right;margin-top: 12px;" @click="next('-1')">上一步</el-button>
<el-button type="primary" style="float: right;margin-top: 12px;" @click="goBack">返回</el-button>
</div>
<el-button type="primary" v-show="active > 1" style="float: right;margin-top: 12px;margin-left: 10px;" @click="submit">提交</el-button>
<el-button type="primary" v-show="active < 2" style="float: right;margin-top: 12px;" @click="next('1')">下一步</el-button>
<el-button type="primary" v-show="active > 0" style="float: right;margin-top: 12px;" @click="next('-1')">上一步</el-button>
<el-button type="primary" style="float: right;margin-top: 12px;" @click="goBack">返回</el-button>
</div>
</template>
@@ -42,9 +46,7 @@
active: 0,
synthesisList: {},
// 第一节点
ruleFormData: {
monitorTemp: 1,
},
ruleFormData: {},
config: {
buttonGroup: []
},
@@ -52,7 +54,8 @@
// 第二节点 1栏
ruleFormDataTow: {},
groupFormList: {},
includedDevicesList: {}
includedDevicesList: {},
resourceGroupIdList: {},
}
},
created() {
@@ -74,7 +77,7 @@
policyName: {label: '策略名称', span: 12, type: 'input', rules: [{required: true, message: '请输入模版名称', trigger: 'blur'}]},
description: {label: '描述', span: 12, type: 'textarea'},
resourceGroupId: {label: '关联资源组', span: 12, type: 'select', options:[]},
includedDevicesId: {label: '包含设备', span: 12, type: 'select', options:[], multiple: true}
includedDevicesDataList: {label: '包含设备', span: 12, type: 'select', options:[], multiple: true}
}
}];
},
@@ -83,6 +86,7 @@
getResMonitorGroup().then(res => {
if (res && res.data) {
this.formList[0].controls['resourceGroupId']['options']= res && res.data.map(item => {
this.resourceGroupIdList[item.id] = item;
return Object.assign({label: item.groupName, value: item.id});
});
}
@@ -91,7 +95,7 @@
getResNameList() {
resNameList().then(val => {
if (val) {
this.formList[0].controls['includedDevicesId']['options']= val && val.map(item => {
this.formList[0].controls['includedDevicesDataList']['options']= val && val.map(item => {
this.includedDevicesList[item.id] = item;
return Object.assign({label: item.resourceName, value: item.id});
});
@@ -103,14 +107,19 @@
// 获取详情
getFormDataList(id) {
getPolicy(id).then(val => {
// console.log('val==',val);
if (val && val.data) {
val.data.includedDevicesId = val.data.includedDevicesId.split(',').map(id => Number(id));
this.ruleFormData = val.data;
let firstForm = {};
Object.keys(this.formList[0].controls).forEach(item => {
firstForm[item] = val.data[item];
});
firstForm.includedDevicesDataList = val.data && val.data.includedDevicesId && val.data.includedDevicesId.split(',').map(id => Number(id));
firstForm['resourceGroupName'] = firstForm && firstForm.resourceGroupId ? this.resourceGroupIdList[val.data.resourceGroupId].groupName : '';
val.data['resourceGroupName'] = firstForm && firstForm.resourceGroupId ? this.resourceGroupIdList[val.data.resourceGroupId].groupName : '';
this.ruleFormData = {...firstForm};
// 第二节点
val.data['sources'] = [];
val.data['commands'] = [];
val.data.executionMethod = val.data.executionMethod && val.data.executionMethod.toString();
val.data.executionMethod = val.data.executionMethod.toString();
val.data.commandContent = val.data && val.data.commandContent.split(',');
val.data.sourceFilePath = val.data && val.data.sourceFilePath.split(',');
if (val.data.commandContent && val.data.commandContent.length > 0) {
@@ -123,7 +132,6 @@
val.data['sources'].push({sourceFilePathType: '1', sourceFilePath: item});
});
}
console.log('bbbb===',val.data);
this.ruleFormDataTow = val.data;
}
}).catch(() => {
@@ -154,13 +162,16 @@
// 3. 操作form如验证
formValid.validate((valid) => {
if (valid) {
// 资源组
formValid.model.resourceGroupName = formValid.model && formValid.model.resourceGroupId ? this.resourceGroupIdList[formValid.model.resourceGroupId].groupName: '';
// 包含设备
formValid.model['includedDevicesName'] = [];
if (formValid.model && formValid.model.includedDevicesId && formValid.model.includedDevicesId.length > 0) {
formValid.model.includedDevicesId.forEach(item => {
if (formValid.model && formValid.model.includedDevicesDataList && formValid.model.includedDevicesDataList.length > 0) {
formValid.model.includedDevicesDataList.forEach(item => {
formValid.model['includedDevicesName'].push(this.includedDevicesList[item].resourceName);
});
}
formValid.model['includedDevicesId'] = formValid.model['includedDevicesId'].join();
formValid.model['includedDevicesId'] = formValid.model['includedDevicesDataList'].join();
formValid.model['includedDevicesName'] = formValid.model['includedDevicesName'].join();
this.ruleFormData = formValid.model;
resolve(true);
@@ -174,7 +185,7 @@
formDataTow() {
let newFormVal = {commandContent: [], sourceFilePath: [], sourceFilePathType: []};
this.$refs.dyncForm.submitForm().then(formData => {
this.ruleFormDataTow = formData;
this.ruleFormDataTow = Object.assign({}, formData, this.ruleFormData);
if (formData && formData.commands && formData.commands.length > 0) {
formData.commands.forEach(item => {
newFormVal['commandContent'].push(item.commandContent);
@@ -198,7 +209,7 @@
},
// 提交
submit() {
let params = Object.assign({}, this.ruleFormData, this.groupFormList);
let params = Object.assign({}, this.groupFormList, this.ruleFormData);
// console.log('params==',params);
// return;
let fnType = addPolicy;

View File

@@ -28,20 +28,20 @@
<!-- footer -->
<div class="w100" style="height: 44%;margin: 1% 0 0;">
<div class="disInlineBlock h100 p10" style="width: 49.5%;border: 1px solid #d8dce6;border-radius: 10px;margin-right: 1%;vertical-align: middle;">
<div style="font-size: 14px;height: 10%">
<div style="font-size: 14px;height: 7%">
<span>服务器带宽收益</span>
<span @click="routerLine(1)" style="float: right;font-size: 12px; color: #0d52d9;cursor: pointer;">更多 >></span>
</div>
<div style="height: 90%;overflow: scroll;" class="newSty">
<div style="height: 93%;overflow: scroll;" class="newSty">
<TableList style="height: 95%" class="w100" :config="{colHiddenCheck: true, colTopHiddenIcon: true}" :columns="serverColumns" :queryParams="serQueryParams" :tableList="serTableList" @fnRenderList="serverTableList"></TableList>
</div>
</div>
<div class="disInlineBlock h100 p10" style="width: 49.5%;border: 1px solid #d8dce6;border-radius: 10px;vertical-align: middle;">
<div style="font-size: 14px;height: 10%">
<div style="font-size: 14px;height: 7%">
<span>资源监控</span>
<span @click="routerLine(2)" style="float: right;font-size: 12px; color: #0d52d9;cursor: pointer;">更多 >></span>
</div>
<div style="height: 90%;overflow: scroll;" class="newSty">
<div style="height: 93%;overflow: scroll;" class="newSty">
<TableList style="height: 95%" class="w100" :config="{colHiddenCheck: true, colTopHiddenIcon: true}" :columns="resMonitorColumns" :queryParams="resQueryParams" :tableList="resTableList" @fnRenderList="resMonitorTableList"></TableList>
</div>
</div>