fix: 1、修复detection下拉面板点击空白处,地址栏的eventId未被清除的问题;2、完善policy交互流程

This commit is contained in:
刘洪洪
2023-10-25 15:13:57 +08:00
parent 1fae281b8b
commit 6dea1ee890
4 changed files with 58 additions and 10 deletions

View File

@@ -118,6 +118,9 @@ export default {
props: { props: {
editObj: { editObj: {
type: Object type: Object
},
isComplete: {
type: Boolean
} }
}, },
data () { data () {
@@ -167,6 +170,12 @@ export default {
this.settingObj.editFlag = false this.settingObj.editFlag = false
this.settingObj.saveFlag = true this.settingObj.saveFlag = true
} }
},
isComplete (newVal) {
if (!newVal) {
console.log('让我瞅瞅咋回事')
this.onContinue()
}
} }
}, },
mounted () { mounted () {
@@ -190,7 +199,10 @@ export default {
} }
}, },
/** 点击继续,进行第二步 */ /** 点击继续,进行第二步 */
onContinue () { onContinue (e) {
if (e) {
delete this.settingObj.settingNoContinue
}
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
this.settingObj.editFlag = false this.settingObj.editFlag = false

View File

@@ -229,6 +229,9 @@ export default {
}, },
editObj: { editObj: {
type: Object type: Object
},
isComplete: {
type: Boolean
} }
}, },
components: { components: {
@@ -258,6 +261,11 @@ export default {
} }
} }
} }
},
isComplete (newVal) {
if (!newVal) {
this.onContinue()
}
} }
}, },
data () { data () {
@@ -374,6 +382,7 @@ export default {
if (response.status === 200) { if (response.status === 200) {
this.libraryList = _.get(response, 'data.data.list', []).filter(l => l.isBuiltIn === 0) this.libraryList = _.get(response, 'data.data.list', []).filter(l => l.isBuiltIn === 0)
} else { } else {
console.error(response.data.message)
this.libraryList = [] this.libraryList = []
if (response.data.message) { if (response.data.message) {
this.$message.error(response.data.message) this.$message.error(response.data.message)
@@ -485,7 +494,10 @@ export default {
this.thresholdRuleObj.filterList.splice(i, 1) this.thresholdRuleObj.filterList.splice(i, 1)
}, },
/** 点击继续,展开第三步 */ /** 点击继续,展开第三步 */
onContinue () { onContinue (e) {
if (e) {
delete this.indicatorRuleObj.ruleNoContinue
}
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.mySettingObj.ruleType === detectionRuleType.indicator) { if (this.mySettingObj.ruleType === detectionRuleType.indicator) {

View File

@@ -176,6 +176,15 @@ export default {
} }
} }
}, },
watch: {
isCollapse (newVal) {
const newQuery = this.$route.query
if (newVal && newQuery.eventId) {
delete newQuery.eventId
this.reloadUrl(newQuery, 'cleanOldParams')
}
}
},
methods: { methods: {
unitConvert, unitConvert,
getMillisecond, getMillisecond,

View File

@@ -18,7 +18,7 @@
</div> </div>
</template> </template>
<div class="form-collapse-content"> <div class="form-collapse-content">
<general-settings ref="form" :editObj="editObj" @setSettingForm="getFormSetting" /> <general-settings ref="form" :editObj="editObj" :isComplete="isComplete" @setSettingForm="getFormSetting" />
</div> </div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
@@ -35,7 +35,7 @@
</div> </div>
</template> </template>
<div class="form-collapse-content"> <div class="form-collapse-content">
<rule-definition :settingObj="settingObj" :editObj="editObj" @setRuleObj="getRuleObj" /> <rule-definition :settingObj="settingObj" :editObj="editObj" :isComplete="isComplete" @setRuleObj="getRuleObj" />
</div> </div>
</el-collapse-item> </el-collapse-item>
</el-collapse> </el-collapse>
@@ -147,7 +147,8 @@ export default {
] ]
}, },
intervalList: detectionUnitList.intervalList || [], intervalList: detectionUnitList.intervalList || [],
editObj: {} editObj: {},
isComplete: true // 参数完整标识默认完整照顾编辑模式false即不完整
} }
}, },
components: { components: {
@@ -236,6 +237,12 @@ export default {
if (!flag) { if (!flag) {
const list = arr const list = arr
list.splice(list.indexOf(name), 1) list.splice(list.indexOf(name), 1)
if (name === '1' && list.indexOf('2') < 0) {
list.push('2')
}
if (name === '2' && list.indexOf('3') < 0) {
list.push('3')
}
this.activeNames = [] this.activeNames = []
list.forEach(t => { list.forEach(t => {
this.activeNames.push(t) this.activeNames.push(t)
@@ -284,6 +291,7 @@ export default {
} }
}) })
} else { } else {
console.error(response.data.message)
this.$message.error(this.errorMsgHandler(response)) this.$message.error(this.errorMsgHandler(response))
} }
}).catch(e => { }).catch(e => {
@@ -310,6 +318,7 @@ export default {
} }
}) })
} else { } else {
console.error(response.data.message)
this.$message.error(this.errorMsgHandler(response)) this.$message.error(this.errorMsgHandler(response))
} }
}).catch(e => { }).catch(e => {
@@ -319,21 +328,27 @@ export default {
this.myLoading = false this.myLoading = false
}) })
} }
} else {
this.isComplete = false
} }
}) })
} else if (settingLen === 0) { } else if (settingLen === 0) {
this.isComplete = false
this.handleFormError('1') this.handleFormError('1')
} else if (ruleLen === 0) { } else if (ruleLen === 0) {
this.isComplete = false
this.handleFormError('2') this.handleFormError('2')
} }
}, },
handleFormError (name) { handleFormError (name) {
const list = this.activeNames const list = this.activeNames
if (list.indexOf(name) < 0) {
list.push(name) list.push(name)
this.activeNames = [] this.activeNames = []
list.forEach(t => { list.forEach(t => {
this.activeNames.push(t) this.activeNames.push(t)
}) })
}
this.$message.error(this.$t('detection.create.informationFilled')) this.$message.error(this.$t('detection.create.informationFilled'))
} }
} }