Merge branch 'dev-2.0' of https://git.mesalab.cn/nezha/nezha-fronted into dev-2.0

# Conflicts:
#	nezha-fronted/src/components/page/dashboard/chartBox.vue
This commit is contained in:
zhangyu
2021-07-05 15:13:51 +08:00
30 changed files with 160 additions and 8 deletions

View File

@@ -210,9 +210,6 @@ export default {
this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo) this.$set(this.searchLabel, 'pageNo', this.pageObj.pageNo)
this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize) this.$set(this.searchLabel, 'pageSize', this.pageObj.pageSize)
this.tools.loading = true this.tools.loading = true
if (this.obj) {
this.$set(this.searchLabel, 'modelIds', this.obj.id)
}
this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => { this.$get(this.url, { ...this.searchLabel, ...this.searchCheckBox }).then(response => {
this.tools.loading = false this.tools.loading = false
if (response.code === 200) { if (response.code === 200) {

View File

@@ -0,0 +1,17 @@
export default {
data () {
return {
isEdit: false
}
},
mounted () {
if( this.isEdit ) {
window.onbeforeunload = () => {
return window.confirm("确认操作吗?")
}
}
},
destroyed () {
window.onbeforeunload = null
}
}

View File

@@ -100,6 +100,8 @@
<script> <script>
import { asset as assetConstants} from '@/components/common/js/constants' import { asset as assetConstants} from '@/components/common/js/constants'
import selectWalk from '../../popBox/selectWalk' import selectWalk from '../../popBox/selectWalk'
import editRigthBox from '../../mixin/editRigthBox'
export default { export default {
name: 'assetTypeBox', name: 'assetTypeBox',
components: { components: {
@@ -117,6 +119,7 @@ export default {
} }
} }
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
assetConstants, assetConstants,
@@ -148,6 +151,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
this.editAssetType = JSON.parse(JSON.stringify(n)) this.editAssetType = JSON.parse(JSON.stringify(n))
} }
} }

View File

@@ -60,6 +60,8 @@
<script> <script>
// import { host, port } from '@/components/common/js/validate' // import { host, port } from '@/components/common/js/validate'
import selectWalk from '../../popBox/selectWalk' import selectWalk from '../../popBox/selectWalk'
import editRigthBox from '../../mixin/editRigthBox'
export default { export default {
name: 'modelBox', name: 'modelBox',
components: { components: {
@@ -77,6 +79,7 @@ export default {
} }
} }
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
language: localStorage.getItem('nz-language'), language: localStorage.getItem('nz-language'),
@@ -109,6 +112,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
this.editModel = JSON.parse(JSON.stringify(n)) this.editModel = JSON.parse(JSON.stringify(n))
} }
} }

View File

@@ -48,6 +48,7 @@
</template> </template>
<script> <script>
import editRigthBox from '../../mixin/editRigthBox'
export default { export default {
name: 'roleBox', name: 'roleBox',
components: { components: {
@@ -58,6 +59,7 @@ export default {
}, },
detail: Boolean detail: Boolean
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
editRole: {}, editRole: {},
@@ -79,6 +81,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
this.editRole = JSON.parse(JSON.stringify(n)) this.editRole = JSON.parse(JSON.stringify(n))
if (this.editRole.roles && this.editRole.roles.length > 0) { if (this.editRole.roles && this.editRole.roles.length > 0) {
this.editRole.roleIds = this.editRole.roles.map(t => t.id) this.editRole.roleIds = this.editRole.roles.map(t => t.id)

View File

@@ -82,6 +82,7 @@
<script> <script>
// import { host, port } from '@/components/common/js/validate' // import { host, port } from '@/components/common/js/validate'
import editRigthBox from '../../mixin/editRigthBox'
export default { export default {
name: 'userBox', name: 'userBox',
@@ -92,6 +93,7 @@ export default {
type: Object type: Object
} }
}, },
mixins: [editRigthBox],
computed: { computed: {
isCurrentUser () { isCurrentUser () {
return function (username) { return function (username) {
@@ -157,6 +159,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit =true
}
this.editUser = JSON.parse(JSON.stringify(n)) this.editUser = JSON.parse(JSON.stringify(n))
// if (this.editUser.roles && this.editUser.roles.length > 0) { // if (this.editUser.roles && this.editUser.roles.length > 0) {
// this.editUser.roleIds = this.editUser.roles.map(t => t.id) // this.editUser.roleIds = this.editUser.roles.map(t => t.id)

View File

@@ -74,11 +74,13 @@
<script> <script>
import { host, port } from '../../common/js/validate' import { host, port } from '../../common/js/validate'
import { agent2 } from '@/components/common/js/constants' import { agent2 } from '@/components/common/js/constants'
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'agentBox', name: 'agentBox',
props: { props: {
agent: Object agent: Object
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
agent2: agent2, agent2: agent2,
@@ -188,6 +190,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
this.editPromServer = JSON.parse(JSON.stringify(n)) this.editPromServer = JSON.parse(JSON.stringify(n))
} }
}, },

View File

@@ -124,6 +124,7 @@
import chartDataFormat from '../../charts/chartDataFormat' import chartDataFormat from '../../charts/chartDataFormat'
import promqlInput from '../../page/dashboard/explore/promqlInput' import promqlInput from '../../page/dashboard/explore/promqlInput'
import { nzNumber } from '../js/validate' import { nzNumber } from '../js/validate'
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'alertRuleBox', name: 'alertRuleBox',
props: { props: {
@@ -132,6 +133,7 @@ export default {
components: { components: {
'promql-input': promqlInput 'promql-input': promqlInput
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
promqlCount: 1, promqlCount: 1,
@@ -318,6 +320,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editAlertRule = JSON.parse(JSON.stringify(n)) this.editAlertRule = JSON.parse(JSON.stringify(n))
if (this.editAlertRule.id) { if (this.editAlertRule.id) {
this.expressions = [this.editAlertRule.expr] this.expressions = [this.editAlertRule.expr]

View File

@@ -125,12 +125,13 @@
import bus from '@/libs/bus' import bus from '@/libs/bus'
import { sameLabels } from '@/components/common/js/constants' import { sameLabels } from '@/components/common/js/constants'
// import selectAlertSilence from '../alert/selectAlertSilence' // import selectAlertSilence from '../alert/selectAlertSilence'
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'alertSilenceBox', name: 'alertSilenceBox',
components: { components: {
// selectAlertSilence // selectAlertSilence
}, },
mixins: [editRigthBox],
props: { props: {
alertSilence: Object alertSilence: Object
}, },
@@ -139,6 +140,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
const obj = JSON.parse(JSON.stringify(n)) const obj = JSON.parse(JSON.stringify(n))
if (obj.ruleId == -1) { if (obj.ruleId == -1) {
obj.ruleId = null obj.ruleId = null

View File

@@ -221,6 +221,7 @@
<script> <script>
import nzTransfer from '@/components/common/nzTransfer' import nzTransfer from '@/components/common/nzTransfer'
import { asset as assetConstants } from '@/components/common/js/constants' import { asset as assetConstants } from '@/components/common/js/constants'
import editRigthBox from '../../mixin/editRigthBox'
export default { export default {
name: 'assetBatchEditBox', name: 'assetBatchEditBox',
components: { components: {
@@ -237,6 +238,7 @@ export default {
type: Array type: Array
} }
}, },
mixins: [editRigthBox],
data () { data () {
const vm = this const vm = this
return { return {
@@ -467,6 +469,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
if (n !== assetConstants.editTypeData.account) { if (n !== assetConstants.editTypeData.account) {
this.editData.authProtocol = 0 this.editData.authProtocol = 0
} else { } else {

View File

@@ -242,6 +242,8 @@ import { host, port } from '@/components/common/js/validate'
import { asset as assetConstants } from '@/components/common/js/constants' import { asset as assetConstants } from '@/components/common/js/constants'
import selectAssetType from '@/components/common/popBox/selectAssetType' import selectAssetType from '@/components/common/popBox/selectAssetType'
import locationCascader from '@/components/common/rightBox/locationCascader' import locationCascader from '@/components/common/rightBox/locationCascader'
import editRigthBox from '../../mixin/editRigthBox'
export default { export default {
name: 'assetBox', name: 'assetBox',
components: { components: {
@@ -253,6 +255,7 @@ export default {
type: Object type: Object
} }
}, },
mixins: [editRigthBox],
data () { data () {
const vm = this const vm = this
return { return {
@@ -347,6 +350,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
this.editAsset = JSON.parse(JSON.stringify(n)) this.editAsset = JSON.parse(JSON.stringify(n))
this.editAsset.brandAndModel = [this.editAsset.brand.id, this.editAsset.model.id] this.editAsset.brandAndModel = [this.editAsset.brand.id, this.editAsset.model.id]
this.editAsset.stateId = n.state ? n.state.id : '' this.editAsset.stateId = n.state ? n.state.id : ''

View File

@@ -142,12 +142,14 @@
<script> <script>
import assetTagEx from '../../page/asset/components/assetTagEx' import assetTagEx from '../../page/asset/components/assetTagEx'
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'assetLabelBox', name: 'assetLabelBox',
props: { props: {
obj: { type: Object } obj: { type: Object }
}, },
components: { assetTagEx }, components: { assetTagEx },
mixins: [editRigthBox],
data () { data () {
return { return {
ready: false, ready: false,
@@ -233,6 +235,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
this.editAssetMeta = { this.editAssetMeta = {
...n, ...n,
groupId: n.groupId ? Number(n.groupId) : '', groupId: n.groupId ? Number(n.groupId) : '',

View File

@@ -41,12 +41,14 @@
</template> </template>
<script> <script>
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'assetMetaGroup', name: 'assetMetaGroup',
props: { props: {
metaGroup: {} metaGroup: {}
}, },
components: {}, components: {},
mixins: [editRigthBox],
data () { data () {
return { return {
editMetaGroup: { editMetaGroup: {
@@ -63,6 +65,9 @@ export default {
metaGroup: { metaGroup: {
immediate: true, immediate: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
this.editMetaGroup = { ...n } this.editMetaGroup = { ...n }
} }
} }

View File

@@ -62,12 +62,14 @@
</div> </div>
</template> </template>
<script> <script>
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'asset-state-right-box', name: 'asset-state-right-box',
props: { props: {
assetState: Object, assetState: Object,
assetStateData: Array // 所有数据,用于选择下拉框显示内容 assetStateData: Array // 所有数据,用于选择下拉框显示内容
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
rules: { // 表单校验规则 rules: { // 表单校验规则
@@ -138,6 +140,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
if (n) { if (n) {
this.editAssetState = JSON.parse(JSON.stringify(n)) this.editAssetState = JSON.parse(JSON.stringify(n))
} }

View File

@@ -52,6 +52,7 @@
</template> </template>
<script> <script>
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'cabinetBox', name: 'cabinetBox',
props: { props: {
@@ -62,6 +63,7 @@ export default {
default: true default: true
} }
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
editCabinet: {}, editCabinet: {},
@@ -156,6 +158,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler: function (n, o) { handler: function (n, o) {
if (n.id) {
this.isEdit = true
}
if (n) { if (n) {
this.editCabinet = JSON.parse(JSON.stringify(n)) this.editCabinet = JSON.parse(JSON.stringify(n))
} }

View File

@@ -74,6 +74,8 @@
<script> <script>
import nzTransfer from '@/components/common/nzTransfer' import nzTransfer from '@/components/common/nzTransfer'
import { fromRoute } from '@/components/common/js/constants' import { fromRoute } from '@/components/common/js/constants'
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'chartTempBox', name: 'chartTempBox',
components: { components: {
@@ -85,6 +87,7 @@ export default {
}, },
from: String from: String
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
fromRoute, fromRoute,
@@ -176,6 +179,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = false
}
this.editChartTemp = JSON.parse(JSON.stringify(n)) this.editChartTemp = JSON.parse(JSON.stringify(n))
} }
} }

View File

@@ -64,6 +64,8 @@
<script> <script>
import latlngPicker from '../latlngPicker' import latlngPicker from '../latlngPicker'
import editRigthBox from '../mixin/editRigthBox'
const regNum = /^[0-9]+.?[0-9]*/ const regNum = /^[0-9]+.?[0-9]*/
export default { export default {
@@ -75,6 +77,7 @@ export default {
}, },
userData: Array userData: Array
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
editDc: {}, editDc: {},
@@ -201,6 +204,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editDc = JSON.parse(JSON.stringify(n)) this.editDc = JSON.parse(JSON.stringify(n))
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.latlngPicker.setLnglat(this.editDc.latitude, this.editDc.longitude) this.$refs.latlngPicker.setLnglat(this.editDc.latitude, this.editDc.longitude)

View File

@@ -264,6 +264,7 @@
<script> <script>
import { noSpecialChar, port, nzNumber } from '../js/validate' import { noSpecialChar, port, nzNumber } from '../js/validate'
import selectWalk from '../popBox/selectWalk' import selectWalk from '../popBox/selectWalk'
import editRigthBox from '../mixin/editRigthBox'
import VueTagsInput from '@johmun/vue-tags-input' import VueTagsInput from '@johmun/vue-tags-input'
export default { export default {
@@ -288,6 +289,7 @@ export default {
'select-walk': selectWalk, 'select-walk': selectWalk,
VueTagsInput VueTagsInput
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
walkData: [], walkData: [],
@@ -678,6 +680,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editEndpoint = JSON.parse(JSON.stringify(n)) this.editEndpoint = JSON.parse(JSON.stringify(n))
this.activeName = 'Basic' this.activeName = 'Basic'
this.changeProject() this.changeProject()

View File

@@ -72,6 +72,8 @@
<script> <script>
import promqlInput from '../../page/dashboard/explore/promqlInput' import promqlInput from '../../page/dashboard/explore/promqlInput'
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'exprTempBox', name: 'exprTempBox',
components: { components: {
@@ -80,11 +82,15 @@ export default {
props: { props: {
exprTemp: Object exprTemp: Object
}, },
mixins: [editRigthBox],
watch: { watch: {
exprTemp: { exprTemp: {
deep: true, deep: true,
immediate: true, immediate: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
const obj = { ...n } const obj = { ...n }
obj.expression = [obj.expression] obj.expression = [obj.expression]
this.editExprTemp = Object.assign(this.editExprTemp, obj) this.editExprTemp = Object.assign(this.editExprTemp, obj)

View File

@@ -47,6 +47,7 @@
</template> </template>
<script> <script>
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'locationCascader', name: 'locationCascader',
components: { components: {
@@ -62,6 +63,7 @@ export default {
disabled: { type: Boolean }, disabled: { type: Boolean },
dcOption: { type: Array } dcOption: { type: Array }
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
initData: null, initData: null,
@@ -387,6 +389,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.$emit('change', n) this.$emit('change', n)
} }
}, },

View File

@@ -83,6 +83,8 @@
<script> <script>
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'menuBox', name: 'menuBox',
components: { components: {
@@ -106,6 +108,7 @@ export default {
return enabled.length === 0 return enabled.length === 0
} }
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
rules: { // 表单校验规则 rules: { // 表单校验规则
@@ -237,6 +240,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n) { handler (n) {
if (n.id) {
this.isEdit = true
}
this.editMenu = JSON.parse(JSON.stringify(n)) this.editMenu = JSON.parse(JSON.stringify(n))
if (this.editMenu.perms && this.editMenu.perms != '') { if (this.editMenu.perms && this.editMenu.perms != '') {
this.$set(this.editMenu, 'permissions', this.editMenu.perms.split(',').map(t => { return { value: t } })) this.$set(this.editMenu, 'permissions', this.editMenu.perms.split(',').map(t => { return { value: t } }))

View File

@@ -55,11 +55,14 @@
</template> </template>
<script> <script>
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'modelBox', name: 'modelBox',
props: { props: {
mib: Object mib: Object
}, },
mixins: [editRigthBox],
data () { data () {
const $temp = this const $temp = this
return { return {
@@ -228,6 +231,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editMib = JSON.parse(JSON.stringify(n)) this.editMib = JSON.parse(JSON.stringify(n))
if (this.editMib.models) { if (this.editMib.models) {
this.selectedModels = this.editMib.models.split(',') this.selectedModels = this.editMib.models.split(',')

View File

@@ -259,6 +259,7 @@
<script> <script>
import { noSpecialChar, port, nzNumber } from '../js/validate' import { noSpecialChar, port, nzNumber } from '../js/validate'
import selectWalk from '../popBox/selectWalk' import selectWalk from '../popBox/selectWalk'
import editRigthBox from '../mixin/editRigthBox'
import VueTagsInput from '@johmun/vue-tags-input' import VueTagsInput from '@johmun/vue-tags-input'
export default { export default {
@@ -271,6 +272,7 @@ export default {
'select-walk': selectWalk, 'select-walk': selectWalk,
VueTagsInput VueTagsInput
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
walkData: [], walkData: [],
@@ -674,6 +676,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editModule = JSON.parse(JSON.stringify(n)) this.editModule = JSON.parse(JSON.stringify(n))
this.activeName = 'Basic' this.activeName = 'Basic'

View File

@@ -31,6 +31,7 @@
</template> </template>
<script> <script>
import editRigthBox from '../mixin/editRigthBox'
export default { export default {
name: 'panelBox', name: 'panelBox',
props: { props: {
@@ -38,6 +39,7 @@ export default {
type: Object type: Object
} }
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
url: 'visual/panel', url: 'visual/panel',
@@ -122,6 +124,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editPanel = JSON.parse(JSON.stringify(n)) this.editPanel = JSON.parse(JSON.stringify(n))
} }
} }

View File

@@ -34,12 +34,14 @@
</div> </div>
</template> </template>
<script> <script>
import editRigthBox from '../mixin/editRigthBox'
import { noSpecialChar } from '../../common/js/validate' import { noSpecialChar } from '../../common/js/validate'
export default { export default {
name: 'projectBox', name: 'projectBox',
props: { props: {
project: Object project: Object
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
editProject: {}, editProject: {},
@@ -119,6 +121,9 @@ export default {
project: { project: {
immediate: true, immediate: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editProject = JSON.parse(JSON.stringify(n)) this.editProject = JSON.parse(JSON.stringify(n))
} }
} }

View File

@@ -36,12 +36,14 @@
</template> </template>
<script> <script>
import editRigthBox from '../../mixin/editRigthBox'
export default { export default {
name: 'cabinetBox', name: 'cabinetBox',
props: { props: {
obj: { type: Object }, obj: { type: Object },
currentDc: { type: Object } currentDc: { type: Object }
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
editCabinet: {}, editCabinet: {},
@@ -124,6 +126,9 @@ export default {
deep: true, deep: true,
immediate: true, immediate: true,
handler: function (n, o) { handler: function (n, o) {
if (n.id) {
this.isEdit = true
}
if (n) { if (n) {
this.editCabinet = JSON.parse(JSON.stringify(n)) this.editCabinet = JSON.parse(JSON.stringify(n))
} }

View File

@@ -84,7 +84,7 @@
</template> </template>
<script> <script>
import editRigthBox from '../mixin/editRigthBox'
import { port } from '../js/validate' import { port } from '../js/validate'
export default { export default {
@@ -93,6 +93,7 @@ export default {
props: { props: {
credential: Object credential: Object
}, },
mixins: [editRigthBox],
data () { data () {
return { return {
editCredential: {}, editCredential: {},
@@ -219,6 +220,9 @@ export default {
immediate: true, immediate: true,
deep: true, deep: true,
handler (n, o) { handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editCredential = JSON.parse(JSON.stringify(n)) this.editCredential = JSON.parse(JSON.stringify(n))
if (this.editCredential.config && typeof this.editCredential.config === 'string') { if (this.editCredential.config && typeof this.editCredential.config === 'string') {
this.editCredential.config = JSON.parse(this.editCredential.config) this.editCredential.config = JSON.parse(this.editCredential.config)

View File

@@ -21,8 +21,10 @@
</template> </template>
<script> <script>
import editRigthBox from '../../mixin/editRigthBox'
export default { export default {
name: 'subBox', name: 'subBox',
mixins: [editRigthBox],
data () { data () {
return { return {
editTagsBox: { show: false, top: 0, left: 0 }, editTagsBox: { show: false, top: 0, left: 0 },

View File

@@ -28,6 +28,7 @@
<script> <script>
import trafficSettingTab from './trafficSettingTab' import trafficSettingTab from './trafficSettingTab'
import editRigthBox from '../../mixin/editRigthBox'
import { getUUID } from '../../js/common' import { getUUID } from '../../js/common'
export default { export default {
@@ -41,6 +42,7 @@ export default {
required: true required: true
} }
}, },
mixins: [editRigthBox],
mounted () { mounted () {
this.queryTrafficSettings() this.queryTrafficSettings()
}, },
@@ -316,7 +318,10 @@ export default {
dc: { dc: {
immediate: true, immediate: true,
deep: true, deep: true,
handler () { handler (n) {
if (n.id) {
this.isEdit = true
}
this.queryAssetList() this.queryAssetList()
} }
} }

View File

@@ -499,7 +499,7 @@ import nezhaColor from '../../common/nezhaColor'
import i18n from '../../common/i18n' import i18n from '../../common/i18n'
import { fromRoute } from '@/components/common/js/constants' import { fromRoute } from '@/components/common/js/constants'
import diagram from '@/components/common/ChartDiagram/diagram' import diagram from '@/components/common/ChartDiagram/diagram'
import rightBoxMain from '@/components/common/mixin/rightBox' import editRigthBox from '../../common/mixin/editRigthBox'
const rz = { const rz = {
methods: { methods: {
rz (e) { rz (e) {
@@ -520,7 +520,7 @@ export default {
default: false default: false
} }
}, },
mixins: [rz, rightBoxMain], mixins: [rz,editRigthBox],
data () { data () {
return { return {
fromRoute, fromRoute,