fix:修改详情页面报错的问题

This commit is contained in:
zhangyu
2022-03-07 09:37:27 +08:00
parent 367a95b78b
commit 24ed289135
37 changed files with 135 additions and 136 deletions

View File

@@ -58,7 +58,7 @@
<script>
import bus from '@/libs/bus'
import lodash from 'lodash'
import chartHeaderMixin from "@/components/chart/chartHeaderMixin";
import chartHeaderMixin from '@/components/chart/chartHeaderMixin'
export default {
name: 'ChartScreenHeader',
mixins: [chartHeaderMixin],

View File

@@ -261,7 +261,7 @@ export default {
} else {
return getOption(this.chartInfo.type)
}
},
}
},
methods: {
isTimeSeries,

View File

@@ -157,7 +157,7 @@ export default {
try {
this.isStack = this.chartInfo.param.stack
} catch (e) {}
this.chartInfo.loaded && this.initChart(this.chartOption)
this.chartInfo.loaded && this.initChart(this.chartOption)
}
}
</script>

View File

@@ -42,7 +42,7 @@ export default {
data () {
return {
stackTotalColor: null,
isStack: false,
isStack: false
}
},
computed: {
@@ -108,7 +108,7 @@ export default {
let seriesIndex = 0
originalDatas.forEach((originalData, expressionIndex) => {
originalData.forEach((data, dataIndex) => {
if (seriesIndex >= this.series.length) {// 只取跟series 一样长度作比较
if (seriesIndex >= this.series.length) { // 只取跟series 一样长度作比较
return
}
seriesIndex++

View File

@@ -6,20 +6,20 @@
<style>
</style>
<script>
export default {
name: "TestElement",
props: {
text : {
type: String,
default: "x",
},
},
data: function() {
return {
}
},
mounted: function() {
console.log("### " + this.text + " ready!");
},
export default {
name: 'TestElement',
props: {
text: {
type: String,
default: 'x'
}
</script>
},
data: function () {
return {
}
},
mounted: function () {
console.log('### ' + this.text + ' ready!')
}
}
</script>

View File

@@ -15,97 +15,97 @@
* });
* ```
*/
import extend from "../utils/extend.js";
import { addEdges } from "../utils/rect.js";
import Modification from "./Modification.js";
import { makeModifier } from "./base.js";
import extend from '../utils/extend.js'
import { addEdges } from '../utils/rect.js'
import Modification from './Modification.js'
import { makeModifier } from './base.js'
const aspectRatio = {
start(arg) {
start (arg) {
const {
state,
rect,
edges: originalEdges,
pageCoords: coords
} = arg;
} = arg
let {
ratio
} = state.options;
} = state.options
const {
equalDelta,
modifiers
} = state.options;
} = state.options
if (ratio === 'preserve') {
ratio = rect.width / rect.height;
ratio = rect.width / rect.height
}
state.startCoords = extend({}, coords);
state.startRect = extend({}, rect);
state.ratio = ratio;
state.equalDelta = equalDelta;
state.startCoords = extend({}, coords)
state.startRect = extend({}, rect)
state.ratio = ratio
state.equalDelta = equalDelta
const linkedEdges = state.linkedEdges = {
top: originalEdges.top || originalEdges.left && !originalEdges.bottom,
left: originalEdges.left || originalEdges.top && !originalEdges.right,
bottom: originalEdges.bottom || originalEdges.right && !originalEdges.top,
right: originalEdges.right || originalEdges.bottom && !originalEdges.left
};
state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right);
}
state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right)
if (state.equalDelta) {
state.edgeSign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1);
state.edgeSign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1)
} else {
const negativeSecondaryEdge = state.xIsPrimaryAxis ? linkedEdges.top : linkedEdges.left;
state.edgeSign = negativeSecondaryEdge ? -1 : 1;
const negativeSecondaryEdge = state.xIsPrimaryAxis ? linkedEdges.top : linkedEdges.left
state.edgeSign = negativeSecondaryEdge ? -1 : 1
}
extend(arg.edges, linkedEdges);
if (!modifiers || !modifiers.length) return;
const subModification = new Modification(arg.interaction);
subModification.copyFrom(arg.interaction.modification);
subModification.prepareStates(modifiers);
state.subModification = subModification;
subModification.startAll({ ...arg
});
extend(arg.edges, linkedEdges)
if (!modifiers || !modifiers.length) return
const subModification = new Modification(arg.interaction)
subModification.copyFrom(arg.interaction.modification)
subModification.prepareStates(modifiers)
state.subModification = subModification
subModification.startAll({ ...arg })
},
set(arg) {
set (arg) {
const {
state,
rect,
coords
} = arg;
const initialCoords = extend({}, coords);
const aspectMethod = state.equalDelta ? setEqualDelta : setRatio;
aspectMethod(state, state.xIsPrimaryAxis, coords, rect);
} = arg
const initialCoords = extend({}, coords)
const aspectMethod = state.equalDelta ? setEqualDelta : setRatio
aspectMethod(state, state.xIsPrimaryAxis, coords, rect)
if (!state.subModification) {
return null;
return null
}
const correctedRect = extend({}, rect);
const correctedRect = extend({}, rect)
addEdges(state.linkedEdges, correctedRect, {
x: coords.x - initialCoords.x,
y: coords.y - initialCoords.y
});
const result = state.subModification.setAll({ ...arg,
})
const result = state.subModification.setAll({
...arg,
rect: correctedRect,
edges: state.linkedEdges,
pageCoords: coords,
prevCoords: coords,
prevRect: correctedRect
});
})
const {
delta
} = result;
} = result
if (result.changed) {
const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y); // do aspect modification again with critical edge axis as primary
const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y) // do aspect modification again with critical edge axis as primary
aspectMethod(state, xIsCriticalAxis, result.coords, result.rect);
extend(coords, result.coords);
aspectMethod(state, xIsCriticalAxis, result.coords, result.rect)
extend(coords, result.coords)
}
return result.eventProps;
return result.eventProps
},
defaults: {
@@ -114,34 +114,34 @@ const aspectRatio = {
modifiers: [],
enabled: false
}
};
}
function setEqualDelta({
function setEqualDelta ({
startCoords,
edgeSign
}, xIsPrimaryAxis, coords) {
if (xIsPrimaryAxis) {
coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign;
coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign
} else {
coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign;
coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign
}
}
function setRatio({
function setRatio ({
startRect,
startCoords,
ratio,
edgeSign
}, xIsPrimaryAxis, coords, rect) {
if (xIsPrimaryAxis) {
const newHeight = rect.width / ratio;
coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign;
const newHeight = rect.width / ratio
coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign
} else {
const newWidth = rect.height * ratio;
coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign;
const newWidth = rect.height * ratio
coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign
}
}
export default makeModifier(aspectRatio, 'aspectRatio');
export { aspectRatio };
//# sourceMappingURL=aspectRatio.js.map
export default makeModifier(aspectRatio, 'aspectRatio')
export { aspectRatio }
// # sourceMappingURL=aspectRatio.js.map

View File

@@ -19,7 +19,7 @@ const chartTreemapOption = {
return [
'<div class="tooltip-title">' +
formatUtil.encodeHTML(treePath.join('/')) +
'</div>',
'</div>'
].join('')
}
},

View File

@@ -512,7 +512,7 @@ export default {
// this.getChartData(item, index, this.filter)
this.setChartSize(item, index)
const chartBox = document.getElementById('chart-' + item.id)// this.$refs['editChart'+item.id][0];
this.handleElementInViewport(chartBox, this.childrenScrollTop, item, index, true)
this.handleElementInViewport(chartBox, this.childrenScrollTop, item, index, true)
})
},
loadChartData (scrollTop) {

View File

@@ -318,7 +318,7 @@ export default {
return {
alertLabelData: null,
loading: true,
heightList: 0,
heightList: 0
}
},
watch: {

View File

@@ -81,4 +81,3 @@ export default {
}
}
</script>

View File

@@ -406,7 +406,7 @@ export default {
this.$nextTick(() => {
this.searchTime = [bus.computeTimezoneTime(new Date().getTime() - 1 * 60 * 60 * 1000), bus.computeTimezoneTime(new Date().getTime())]
this.$store.dispatch('dispatchPanelTime', {
time: this.searchTime ,
time: this.searchTime,
nowTimeType: {
id: 4,
text: this.$t('dashboard.panel.lastOneHour'),

View File

@@ -106,7 +106,7 @@ export default {
this.nowTime = this.utcTimeToTimezoneStr(response.time)
if (response.code === 200) {
this.tableData = response.data
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -238,7 +238,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -246,9 +246,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -267,7 +267,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -153,9 +153,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -174,7 +174,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -128,7 +128,7 @@ export default {
dropdownShow: false,
timeout: null,
formatTime: '',
hideSameLabels: true,
hideSameLabels: true
}
},
methods: {

View File

@@ -176,7 +176,7 @@ export default {
plTableSHow: true,
scrollTop: 0,
scrollbarWrap: null,
minusTime: 0,
minusTime: 0
}
},
methods: {

View File

@@ -143,9 +143,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -165,7 +165,7 @@ export default {
this.tableData = response.data.list
this.nowTime = this.utcTimeToTimezoneStr(response.time)
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -142,7 +142,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -146,7 +146,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -118,7 +118,7 @@ export default {
this.metaList.push(meta)
this.$emit('metaList')
} else {
let self = this
const self = this
const newCondition = Object.assign({}, self.meta)
newCondition.nameIsEditing = true
this.metaList.push(newCondition)

View File

@@ -552,7 +552,7 @@ export default {
arr.unshift(obj)
}
return arr
},
}
}
}
</script>

View File

@@ -170,9 +170,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },

View File

@@ -176,9 +176,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },

View File

@@ -422,11 +422,11 @@ export default {
enableChange (type) {
switch (type) {
case 'valueMapping':
break;
break
case 'legend':
break;
break
case '':
break;
break
}
this.change()
}

View File

@@ -144,7 +144,7 @@ import chartDataFormat from '../../../charts/chartDataFormat'
import alertRuleInfo from '../../alert/alertRuleInfo'
import alertLabel from '../../alert/alertLabel'
import { calcDurationByStringTimeB } from '../../js/tools'
import {alertMessage as alertMessageConstant} from "@/components/common/js/constants";
import { alertMessage as alertMessageConstant } from '@/components/common/js/constants'
export default {
name: 'alertMessageTable',
components: {
@@ -222,7 +222,7 @@ export default {
label: this.$t('alert.list.state'),
prop: 'state',
show: true,
width: 100,
width: 100
// sortable: 'custom'
}, {
label: this.$t('alert.startAt'),

View File

@@ -464,12 +464,12 @@ export default {
/* if (refresh) {
this.getData(this.filter)
} */
},
}
},
computed: {
chartRightBoxShow () {
return this.$store.getters.getShowRightBox
},
}
},
created () {
// this.getPanelData()

View File

@@ -251,7 +251,7 @@ export default {
},
searchTime: bus.getTimezontDateRange(),
needAlertDaysData: true,
trendKey: 'ruleId',
trendKey: 'ruleId'
}
},
methods: {
@@ -290,9 +290,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -320,7 +320,7 @@ export default {
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -192,7 +192,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -210,7 +210,7 @@ export default {
this.tableData = response.data.list
this.pageObj.total = response.data.total
this.nowTime = this.utcTimeToTimezoneStr(response.time)
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -132,7 +132,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -118,7 +118,7 @@ export const parentTableCommon = {
if (response.code === 200) {
this.tableData = []
this.tableData = response.data.list
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -107,7 +107,7 @@ import chartTmplTable from '@/components/common/table/settings/chartTmplTable'
import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions'
import routerPathParams from '@/components/common/mixin/routerPathParams'
import chartRightBox from '@/components/common/rightBox/chart/chartRightBox'
import {randomcolor} from "@/components/common/js/radomcolor/randomcolor";
import { randomcolor } from '@/components/common/js/radomcolor/randomcolor'
export default {
name: 'chartTemp',
@@ -294,7 +294,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -197,7 +197,7 @@ export default {
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -629,9 +629,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -659,7 +659,7 @@ export default {
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -412,9 +412,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -442,7 +442,7 @@ export default {
this.detailViewRightObj = detailViewRightObj
this.pageObj.total = response.data.total
this.pageObj.pages = response.data.pages
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)

View File

@@ -150,9 +150,9 @@ export default {
if (this.needAlertDaysData) {
response.data.list.forEach(item => {
item.trendLoading = true
item.left= 0
item.top= 0
item.alertNumtooltipShow= false
item.left = 0
item.top = 0
item.alertNumtooltipShow = false
item.alertDaysData = [
{
metric: { priority: 'P1' },
@@ -174,7 +174,7 @@ export default {
}
this.tableData = response.data.list
this.pageObj.total = response.data.total
if (!this.scrollbarWrap) {
if (!this.scrollbarWrap && this.$refs.dataTable && this.$refs.dataTable.$refs.dataTable) {
this.$nextTick(() => {
this.scrollbarWrap = this.$refs.dataTable.$refs.dataTable.bodyWrapper
this.toTopBtnHandler(this.scrollbarWrap)