Commit 91a221d4 authored by 刘怀志's avatar 刘怀志

将取值为null或者undefined的字段剔除不传到后台

parent 6cffda67
...@@ -47,6 +47,12 @@ service.interceptors.request.use(config => { ...@@ -47,6 +47,12 @@ service.interceptors.request.use(config => {
var resultEncryptFlag = secret.checkResultEncryptAble() var resultEncryptFlag = secret.checkResultEncryptAble()
// get请求映射params参数 // get请求映射params参数
if (config.method === 'get' && config.params) { if (config.method === 'get' && config.params) {
// 将取值为null或者undefined的字段剔除不传到后台
for(let key in config.params) {
if (config.params[key] == undefined || config.params[key] == null){
delete config.params[key]
}
}
console.log('加密前参数get', config.params) console.log('加密前参数get', config.params)
if (paramEncryptFlag && config.params) { if (paramEncryptFlag && config.params) {
config.headers['Product'] = 'Advanced' config.headers['Product'] = 'Advanced'
...@@ -89,8 +95,14 @@ service.interceptors.request.use(config => { ...@@ -89,8 +95,14 @@ service.interceptors.request.use(config => {
} }
} }
console.log('加密前参数post', config.data)
if (paramEncryptFlag && config.data) { if (paramEncryptFlag && config.data) {
// 将取值为null或者undefined的字段剔除不传到后台
for(let key in config.params) {
if (config.params[key] == undefined || config.params[key] == null){
delete config.params[key]
}
}
console.log('加密前参数post', config.data)
config.data = secret.encrypt(config.data) config.data = secret.encrypt(config.data)
} }
return config return config
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="88px"> <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="88px">
<el-form-item label="链路带宽" prop="linkBandwidth"> <el-form-item label="链路带宽" prop="linkBandwidthParam">
<el-select <el-select
v-model="queryParams.linkBandwidth" v-model="queryParams.linkBandwidthParam"
clearable clearable
placeholder="请选链路带宽" placeholder="请选链路带宽"
style="width: 100%" style="width: 100%"
...@@ -133,15 +133,8 @@ export default { ...@@ -133,15 +133,8 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
userId: null, linkBandwidthParam: '',
deviceId: null, bandwidthUtilizationString: ''
deviceName: null,
leftIp: null,
rightIp: null,
linkBandwidth: null,
bandwidthUtilizationString: null,
packetLossRate: null,
linkType: null
}, },
// 表单参数 // 表单参数
form: {}, form: {},
...@@ -164,9 +157,11 @@ export default { ...@@ -164,9 +157,11 @@ export default {
getList() { getList() {
this.loading = true this.loading = true
const temp = { const temp = {
...this.queryParams, ...this.queryParams
maxBandwidthUtil: this.queryParams.bandwidthUtilizationString ? this.queryParams.bandwidthUtilizationString.split(',')[1] : null, }
minBandwidthUtil: this.queryParams.bandwidthUtilizationString ? this.queryParams.bandwidthUtilizationString.split(',')[0] : null if (this.queryParams.bandwidthUtilizationString) {
temp['maxBandwidthUtil'] = this.queryParams.bandwidthUtilizationString.split(',')[1]
temp['minBandwidthUtil'] = this.queryParams.bandwidthUtilizationString.split(',')[0]
} }
listTopology(temp).then(response => { listTopology(temp).then(response => {
this.topologyList = response.rows this.topologyList = response.rows
...@@ -188,9 +183,8 @@ export default { ...@@ -188,9 +183,8 @@ export default {
deviceName: null, deviceName: null,
leftIp: null, leftIp: null,
rightIp: null, rightIp: null,
linkBandwidth: null, linkBandwidthParam: null,
bandwidthUtilizationString: null, bandwidthUtilizationString: null,
packetLossRate: null,
linkType: null, linkType: null,
createBy: null, createBy: null,
createTime: null, createTime: null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment