diff --git a/src/components/form/index.vue b/src/components/form/index.vue index 8489879..cce7ecd 100644 --- a/src/components/form/index.vue +++ b/src/components/form/index.vue @@ -93,6 +93,7 @@ :label="option.label" :value="option.value"> + {{formVal.warningTitle}} @@ -393,6 +394,8 @@ } else if (item.controls[val] && item.controls[val].required) { let msgType = item.controls[val].type === 'input' ? '请输入' : '请选择'; this.rules[val] = [{required: true,message: `${msgType}${item.controls[val].label}`}]; + } else { + delete this.rules[val]; } }); }); diff --git a/src/views/resource/serverRegister/PPPoEConfig.vue b/src/views/resource/serverRegister/PPPoEConfig.vue index 6ddc18e..0eea5aa 100644 --- a/src/views/resource/serverRegister/PPPoEConfig.vue +++ b/src/views/resource/serverRegister/PPPoEConfig.vue @@ -5,28 +5,36 @@ - - 导入 - - - 模板下载 + + + 导入 + + 模板下载 + - - + + - + + + 未连通 + 已连通 + + @@ -61,7 +69,9 @@ item['showNum'] = '1'; } }); - this.roleList = newModel[0].subList; + this.readonly = true; + this.roleList = JSON.parse(JSON.stringify(newModel[0].subList)); + this.fnFormList(this.readonly); this.poeInterfaceList(); } }, @@ -77,21 +87,12 @@ contentList: [{oneNum: '',ipv4Addr: '', ipv4Num: '', ipv4Graw: ''}], roleList: [], columns: {}, - config: { - colHiddenCheck: true, colTopHiddenIcon: true, - tableButton: { - line: [ - {content: '新增', fnCode: 'add', type: 'text'}, - {content: '删除', fnCode: 'delete', type: 'text', showName: 'showNum', showVal: '1'}, - ] - } - }, + config: {}, ipList: [], loadingBool: false, } }, created() { - this.fnFormList(this.readonly); }, methods: { // formList集合 @@ -101,9 +102,9 @@ controls: { id: {label: 'ID', hidden: true}, clientId: {label: 'clientId', hidden: true}, - pppoeEnabled: {label: '启用PPPoE', span: readonly ? 12 : 24, type: 'radio', options: this.dict.type.pppoe_enabled, required: readonly ? false : true}, - pppoeConfigMode: {label: 'PPPoE配置方式', span: readonly ? 10 : 24, type: 'select', options: this.dict.type.pppoe_config_mode, warningTitle: '使用multi_wan_conntrack.sh', required: readonly ? false : true}, - pppoeInterface: {label: 'PPPoE网卡', span: readonly ? 12 : 24, type: 'select', options: this.ipList || [], required: readonly ? false : true}, + pppoeEnabled: {label: '启用PPPoE', span: readonly ? 12 : 24, type: 'radio', options: this.dict.type.pppoe_enabled, required: true}, + pppoeConfigMode: {label: 'PPPoE配置方式', span: readonly ? 10 : 24, type: 'select', eventName: 'change', options: this.dict.type.pppoe_config_mode, warningTitle: '使用multi_wan_conntrack.sh', required: true}, + pppoeInterface: {label: 'PPPoE网卡', span: readonly ? 12 : 24, type: 'select', options: this.ipList || [], required: true, hidden: this.ruleForm.pppoeConfigMode === '1' ? false: true,}, subList: {label: 'PPPoE配置规则', span: 24, slotName: 'tempPoeConfigRules'}, } }]; @@ -114,10 +115,23 @@ ipv4Address: { label: `IPv4地址`, minWidth: '100',visible: true, placeholder: '如1.1.1.1', slotName: readonly ? null : 'tempEditModel'}, ipv4MaskBits: { label: `IPv4掩码位数`, minWidth: '100',visible: true, type: 'number', min: 1, max: 32, placeholder: '请输入1-32', slotName: readonly ? null : 'tempEditModel'}, ipv4Gateway:{ label: `IPv4网关`,minWidth: '100',visible: true, placeholder: '如1.1.1.1', slotName: readonly ? null : 'tempEditModel'}, - bandwidthResult: { label: `虚拟网卡上报带宽(Mbps)`, minWidth: '140', visible: true, placeholder: '请输入', slotName: readonly ? null : 'tempEditModel'}, + bandwidthResult: { label: `虚拟网卡上报带宽(Mbps)`, minWidth: '140', visible: true, editShow: '2', placeholder: '请输入', slotName: readonly ? null : 'tempEditModel'}, macAddress: { label: `MAC地址`, minWidth: '120', visible: readonly}, - status: { label: `连通状态`, minWidth: '100', visible: readonly}, + status: { label: `连通状态`, minWidth: '100', slotName: 'tempStatus', visible: readonly}, }; + if (!readonly && this.ruleForm.pppoeConfigMode === '1') { + this.config = { + colHiddenCheck: true, colTopHiddenIcon: true, + tableButton: { + line: [ + {content: '新增', fnCode: 'add', type: 'text'}, + {content: '删除', fnCode: 'delete', type: 'text', showName: 'showNum', showVal: '1'}, + ] + } + }; + } else { + this.config = {colHiddenCheck: true, colTopHiddenIcon: true} + } }, poeInterfaceList() { if (this.loadingBool) return; @@ -134,13 +148,8 @@ // 切换编辑和保存 formSubmit(num) { if (num === '-1') { - // this.readonly = true; - // this.fnFormList(this.readonly); - // this.ruleForm = Object.assign({}, this.modelVal[0], {typeName: 111}); - // 1. 获取表单引用 const formRef = this.$refs.formRef; - // console.log('gggg===', formRef.$refs.ruleForm); // 2. 先清除所有表单校验 if (formRef && formRef.$refs.ruleForm) { formRef.$refs.ruleForm.clearValidate(); // 清除校验提示 @@ -208,6 +217,8 @@ if (!await this.fnFormValid()) { formValidateBool = false; } + } else { + this.$refs.formRef.$refs.ruleForm.clearValidate(); // 清除校验提示 } if (!formValidateBool) return; let params = { @@ -244,9 +255,10 @@ return; } addPoeConfigMain(params).then(res => { - this.ruleForm = Object.assign(this.ruleForm, this.$refs.formRef.$refs.ruleForm.model, {typeName: 222}); - this.readonly = true; - this.fnFormList(this.readonly); + this.$emit('poeDataChange'); + // this.ruleForm = Object.assign(this.ruleForm, this.$refs.formRef.$refs.ruleForm.model, {typeName: 222}); + // this.readonly = true; + // this.fnFormList(this.readonly); }); }, // 监听事件 @@ -259,20 +271,42 @@ case 'delete': this.roleList.splice(this.roleList.findIndex(item => item.targetIndexNum === dataVal.targetIndexNum), 1); break; - case 'submit': - // console.log('contentList===',this.contentList, 'dataVal===',dataVal); - // this.$emit("dialogResult", {open: false}); - break; - case 'cancel': - this.$emit("dialogResult", {open: false}); + case 'pppoeConfigMode': + if (dataVal === '1') { + this.formList[0].controls.pppoeInterface['hidden'] = false; + this.config = { + colHiddenCheck: true, colTopHiddenIcon: true, + tableButton: { + line: [ + {content: '新增', fnCode: 'add', type: 'text'}, + {content: '删除', fnCode: 'delete', type: 'text', showName: 'showNum', showVal: '1'}, + ] + } + }; + } else if (dataVal === '2') { + if (this.modelVal[0].pppoeConfigMode.toString() === '2') { + let newModel = JSON.parse(JSON.stringify(this.modelVal)); + newModel[0].subList.map((item,index) => { + item['targetIndexNum'] = index + 1; + if (index !== 0) { + item['showNum'] = '1'; + } + }); + this.roleList = newModel[0].subList; + } else { + this.roleList = []; + } + this.formList[0].controls.pppoeInterface['hidden'] = true; + this.config = { + colHiddenCheck: true, colTopHiddenIcon: true, + }; + } break; default: } } }, downloadTemp() { - // this.download('http://172.16.15.51:9300/statics/csvfile/macvlan_vlan.csv', { - // }, `template_${new Date().getTime()}.xlsx`) const link = document.createElement('a'); link.href = 'http://172.16.15.51:9300/statics/csvfile/macvlan_vlan.csv'; link.download = 'macvlan_vlan.csv'; @@ -283,13 +317,10 @@ handleFileUpload(file) { // 如果是使用 Element UI 的 el-upload 组件,文件对象是 file.raw const actualFile = file.raw || file; // 兼容两种获取方式[1,3](@ref) - if (!actualFile) { return; } - const fileReader = new FileReader(); - fileReader.onload = (e) => { try { // 1. 获取读取结果,并将其转换为 Uint8Array @@ -322,7 +353,6 @@ fileReader.onerror = (error) => { this.$message.error('读取文件失败,请重试。'); }; - // 开始以 ArrayBuffer 格式读取文件 fileReader.readAsArrayBuffer(actualFile); }, diff --git a/src/views/resource/serverRegister/details.vue b/src/views/resource/serverRegister/details.vue index a124a08..8154ccd 100644 --- a/src/views/resource/serverRegister/details.vue +++ b/src/views/resource/serverRegister/details.vue @@ -7,7 +7,7 @@ {{item.name}} {{item.num}}{{item.unit}} - 没有监控策略,暂无数据! + 暂无数据 @@ -85,7 +85,7 @@ - + @@ -119,7 +119,7 @@ systemModel: {}, headerList: [ {name: 'CPU使用率(%)', num: 0, imgUrl: cpuUseImg}, - {name: '带宽', num: 0, imgUrl: bandWImg}, + {name: '带宽', num: 0, unit: 'Mbps', imgUrl: bandWImg}, {name: 'CPU', num: 0, unit: '核', imgUrl: cpuImg}, {name: '内存', num: 0, unit: 'G', imgUrl: memoryImg}, ], @@ -281,10 +281,10 @@ }, // 顶部四块信息 headerFourData(data) { + this.headerList[1].num = data.reportedBandwidth; trafficSerDetails({clientId: data.clientId, name: data.ip1InterfaceName}).then(res => { if (res && res.data) { this.headerList[0].num = res.data.cpuUti; - this.headerList[1].num = res.data.speed; this.headerList[2].num = res.data.cpuCores; this.headerList[3].num = res.data.memTotalSize; } @@ -312,7 +312,8 @@ async upMaxVersion(model) { let agentType = await this.fnAgentIsNew(model); if (agentType && agentType.newFlag) { - updateAgentManage(agentType).then(res => { + let params = {deployDevice: model.clientId, method: '0', fileUrl: agentType.fileUrl, fileMd5: agentType.fileMd5}; + updateAgentManage(params).then(res => { console.log('res===',res); }); } else { @@ -407,6 +408,10 @@ } }); }, + // pppoe回调 + fnPoeDataChange() { + this.fnPppoeConfig('PPPoE配置'); + }, // PPPoE配置 fnPppoeConfig(keyName) { getPppoeConfig({clientId: this.paramsData.clientId}).then(res => { diff --git a/src/views/resource/serverRegister/index.vue b/src/views/resource/serverRegister/index.vue index 5e7e6be..6997956 100644 --- a/src/views/resource/serverRegister/index.vue +++ b/src/views/resource/serverRegister/index.vue @@ -299,7 +299,7 @@ ], line: [ {content: '选择业务IP', fnCode: 'pubilcNet', type: 'primary', icon: 'el-icon-thumb', showName: 'multiPublicIpStatus', showVal: '0', hasPermi: 'resource:serverRegister:pubilcNet'}, - {content: '图形监控', fnCode: 'echartView', type: 'primary', icon: 'el-icon-data-analysis', hasPermi: 'resource:serverRegister:echartView'},// rocketmq:traffic + // {content: '图形监控', fnCode: 'echartView', type: 'primary', icon: 'el-icon-data-analysis', hasPermi: 'resource:serverRegister:echartView'},// rocketmq:traffic {content: '详情', fnCode: 'details', type: 'primary', icon: 'el-icon-view', hasPermi: 'rocketmq:traffic'}, // resource:serverRegister:details {title: '更多', hasPermi: ['system:businessDeploy', 'rocketmq:policy', 'rocketmq:monitorPolicy', 'rocketmq:remote', 'resource:serverRegister:tagRemarkEdit', 'resource:serverRegister:mtrChartVew', 'resource:serverRegister:cancelFlash', 'resource:serverRegister:createFrpAddr', 'resource:serverRegister:showFrpAddr'], more: [ {content: '下发业务', fnCode: 'issueBusiness', type: 'text', icon: 'el-icon-circle-check', hasPermi: 'system:businessDeploy'},