fix: policy接口参数变更

This commit is contained in:
chenjinsong
2023-12-08 16:23:06 +08:00
parent 51d6c1d4be
commit 535d2646b2
3 changed files with 44 additions and 4 deletions

View File

@@ -24,9 +24,9 @@
<script>
import ServiceName from '@/views/charts2/charts/entityDetail/lines/ServiceName'
import App from '@/views/charts2/charts/entityDetail/lines/App'
import {useRoute} from 'vue-router'
import {ref} from 'vue'
import {overwriteUrl, urlParamsHandler} from '@/utils/tools'
import { useRoute } from 'vue-router'
import { ref } from 'vue'
import { overwriteUrl, urlParamsHandler } from '@/utils/tools'
export default {
name: 'EntityDetailLine',

View File

@@ -91,6 +91,7 @@ import dataListMixin from '@/mixins/data-list'
import DetectionDrawer from '@/views/detections/detectionPolicies/PolicyDrawer'
import axios from 'axios'
import { useRoute } from 'vue-router'
import _ from 'lodash'
export default {
name: 'Index',
@@ -131,6 +132,45 @@ export default {
}
},
methods: {
getTableData (params, isAll, isClearType) {
if (isAll) {
this.searchLabel = null
} else if (isClearType) {
this.searchLabel.type = ''// 换新接口需要修改的属性名称
}
this.searchLabel = { ...this.searchLabel, ...this.pageObj }
if (params) {
this.searchLabel = { ...this.searchLabel, ...params }
}
this.searchLabel.isBuiltIn = 0
this.isNoData = false
this.toggleLoading(true)
delete this.searchLabel.total
let listUrl = this.url
if (this.listUrl) {
listUrl = this.listUrl
}
axios.get(listUrl, { params: this.searchLabel }).then(response => {
if (response.status === 200) {
this.tableData = _.get(response, 'data.data.list', [])
this.pageObj.total = _.get(response, 'data.data.total', 0)
this.isNoData = !this.tableData || this.tableData.length === 0
} else {
console.error(response)
this.isNoData = true
if (response.data.message) {
this.$message.error(response.data.message)
} else {
this.$message.error(this.$t('tip.somethingWentWrong'))
}
}
}).catch(() => {
this.isNoData = true
}).finally(() => {
this.toggleLoading(false)
this.loading = false
})
},
getPolicyDetail (id) {
if (id) {
axios.get(`${api.detection.detail}/${id}`).then(res => {

View File

@@ -65,7 +65,7 @@ export default {
},
methods: {
getFilterData () {
axios.get(api.detection.statistics).then(response => {
axios.get(api.detection.statistics, { params: { isBuiltIn: 0 } }).then(response => {
if (response.status === 200) {
const data = response.data.data
if (data.statusList) {