NEZ-835 fix: 新增页面添加标签页关闭提示功能

This commit is contained in:
@changcode
2021-07-15 11:56:25 +08:00
parent da04ea8875
commit 4191c8113f
30 changed files with 40 additions and 91 deletions

View File

@@ -5,9 +5,9 @@ export default {
}
},
mounted () {
if( this.isEdit ) {
if (this.isEdit) {
window.onbeforeunload = () => {
return "确认离开当前页面吗?未保存的数据将会丢失"
return '确认离开当前页面吗?未保存的数据将会丢失'
}
}
},

View File

@@ -205,11 +205,13 @@
<script>
import editEndpointBoxNew from './editEndpointBoxNew'
import editRigthBox from '../mixin/editRigthBox'
export default {
name: 'addEndpointBox',
components: {
'edit-endpoint-box-new': editEndpointBoxNew
},
mixins: [editRigthBox],
data () {
return {
rules: {
@@ -434,7 +436,7 @@ export default {
disabled: false
}]
},
showError: false,
showError: false
}
},
methods: {
@@ -755,6 +757,7 @@ export default {
currentModule: {
immediate: true,
handler (n, o) {
this.isEdit = true
}
}
}

View File

@@ -151,9 +151,7 @@ export default {
deep: true,
immediate: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.editAssetType = JSON.parse(JSON.stringify(n))
}
}

View File

@@ -112,9 +112,7 @@ export default {
deep: true,
immediate: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.editModel = JSON.parse(JSON.stringify(n))
}
}

View File

@@ -81,9 +81,7 @@ export default {
deep: true,
immediate: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.editRole = JSON.parse(JSON.stringify(n))
if (this.editRole.roles && this.editRole.roles.length > 0) {
this.editRole.roleIds = this.editRole.roles.map(t => t.id)

View File

@@ -159,9 +159,7 @@ export default {
deep: true,
immediate: true,
handler (n) {
if (n.id) {
this.isEdit =true
}
this.isEdit = true
this.editUser = JSON.parse(JSON.stringify(n))
// if (this.editUser.roles && this.editUser.roles.length > 0) {
// this.editUser.roleIds = this.editUser.roles.map(t => t.id)

View File

@@ -190,9 +190,7 @@ export default {
immediate: true,
deep: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.editPromServer = JSON.parse(JSON.stringify(n))
}
},

View File

@@ -320,9 +320,7 @@ export default {
deep: true,
immediate: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editAlertRule = JSON.parse(JSON.stringify(n))
if (this.editAlertRule.id) {
this.expressions = [this.editAlertRule.expr]

View File

@@ -140,9 +140,7 @@ export default {
deep: true,
immediate: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
const obj = JSON.parse(JSON.stringify(n))
if (obj.ruleId == -1) {
obj.ruleId = null

View File

@@ -469,9 +469,7 @@ export default {
immediate: true,
deep: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
if (n !== assetConstants.editTypeData.account) {
this.editData.authProtocol = 0
} else {

View File

@@ -351,9 +351,7 @@ export default {
deep: true,
immediate: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.editAsset = JSON.parse(JSON.stringify(n))
this.editAsset.brandAndModel = [this.editAsset.brand.id, this.editAsset.model.id]
this.editAsset.stateId = n.state ? n.state.id : ''

View File

@@ -235,9 +235,7 @@ export default {
deep: true,
immediate: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.editAssetMeta = {
...n,
groupId: n.groupId ? Number(n.groupId) : '',

View File

@@ -65,9 +65,7 @@ export default {
metaGroup: {
immediate: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.editMetaGroup = { ...n }
}
}

View File

@@ -140,9 +140,7 @@ export default {
immediate: true,
deep: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
if (n) {
this.editAssetState = JSON.parse(JSON.stringify(n))
}

View File

@@ -158,9 +158,7 @@ export default {
deep: true,
immediate: true,
handler: function (n, o) {
if (n.id) {
this.isEdit = true
}
if (n) {
this.editCabinet = JSON.parse(JSON.stringify(n))
}

View File

@@ -179,9 +179,7 @@ export default {
deep: true,
immediate: true,
handler (n) {
if (n.id) {
this.isEdit = false
}
this.isEdit = true
this.editChartTemp = JSON.parse(JSON.stringify(n))
}
}

View File

@@ -204,9 +204,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editDc = JSON.parse(JSON.stringify(n))
this.$nextTick(() => {
this.$refs.latlngPicker.setLnglat(this.editDc.latitude, this.editDc.longitude)

View File

@@ -684,9 +684,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editEndpoint = JSON.parse(JSON.stringify(n))
this.activeName = 'Basic'
this.changeProject()

View File

@@ -88,9 +88,7 @@ export default {
deep: true,
immediate: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
const obj = { ...n }
obj.expression = [obj.expression]
this.editExprTemp = Object.assign(this.editExprTemp, obj)

View File

@@ -389,9 +389,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.$emit('change', n)
}
},

View File

@@ -240,9 +240,7 @@ export default {
immediate: true,
deep: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.editMenu = JSON.parse(JSON.stringify(n))
if (this.editMenu.perms && this.editMenu.perms != '') {
this.$set(this.editMenu, 'permissions', this.editMenu.perms.split(',').map(t => { return { value: t } }))

View File

@@ -231,9 +231,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editMib = JSON.parse(JSON.stringify(n))
if (this.editMib.models) {
this.selectedModels = this.editMib.models.split(',')

View File

@@ -679,9 +679,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editModule = JSON.parse(JSON.stringify(n))
this.activeName = 'Basic'

View File

@@ -124,9 +124,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editPanel = JSON.parse(JSON.stringify(n))
}
}

View File

@@ -121,9 +121,7 @@ export default {
project: {
immediate: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editProject = JSON.parse(JSON.stringify(n))
}
}

View File

@@ -126,9 +126,7 @@ export default {
deep: true,
immediate: true,
handler: function (n, o) {
if (n.id) {
this.isEdit = true
}
if (n) {
this.editCabinet = JSON.parse(JSON.stringify(n))
}

View File

@@ -220,9 +220,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
if (n.id) {
this.isEdit = true
}
this.editCredential = JSON.parse(JSON.stringify(n))
if (this.editCredential.config && typeof this.editCredential.config === 'string') {
this.editCredential.config = JSON.parse(this.editCredential.config)

View File

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

View File

@@ -319,9 +319,7 @@ export default {
immediate: true,
deep: true,
handler (n) {
if (n.id) {
this.isEdit = true
}
this.queryAssetList()
}
}

View File

@@ -1762,10 +1762,10 @@ export default {
deep: true,
immediate: true,
handler (n) {
this.isEdit = true
if (n.id) {
this.isEdit = true;
if (!n.param.state && n.param.state != Number) {
n.param.state = "1"
n.param.state = '1'
}
if (n.param.severity && n.param.severity != Number) {
n.param.severity = 1