NEZ-1908 feat:用户使用引导提示

This commit is contained in:
zhangyu
2022-06-14 16:12:27 +08:00
parent 4af0c7468e
commit 77d883620a
10 changed files with 63 additions and 14 deletions

View File

@@ -96,7 +96,6 @@ export default {
} }
const decimals = this.chartInfo.param.decimals || 2 const decimals = this.chartInfo.param.decimals || 2
const { minTime, maxTime, minValue, maxValue, copies, unit, dot } = this.getMinMaxFromData(this.chartData, this.chartInfo.unit) // const { minTime, maxTime, minValue, maxValue, copies, unit, dot } = this.getMinMaxFromData(this.chartData, this.chartInfo.unit) //
console.log(maxTime - minTime, maxTime, minTime)
chartOption.xAxis.axisLabel.formatter = this.xAxisLabelFormatter(minTime, maxTime)// 需转为毫秒 chartOption.xAxis.axisLabel.formatter = this.xAxisLabelFormatter(minTime, maxTime)// 需转为毫秒
chartOption.tooltip.formatter = this.tooltipFormatter(this.chartInfo.param.stack) chartOption.tooltip.formatter = this.tooltipFormatter(this.chartInfo.param.stack)
chartOption.tooltip.position = this.tooltipPosition chartOption.tooltip.position = this.tooltipPosition

View File

@@ -4,7 +4,8 @@ export default {
isEdit: false, isEdit: false,
messageParams: { messageParams: {
route: '', route: '',
params: {} params: {},
emit: ''
}, },
closeMessage: '' closeMessage: ''
} }
@@ -17,9 +18,10 @@ export default {
} }
}, },
methods: { methods: {
messageShow (msg, route, params, showNext = false, nextText = 'setup.next') { messageShow (msg, route, params, showNext = false, nextText = 'setup.next', emit) {
this.messageParams.route = route this.messageParams.route = route
this.messageParams.params = params this.messageParams.params = params
this.messageParams.emit = emit
this.closeMessage = this.$message({ this.closeMessage = this.$message({
duration: showNext ? 5000 : 2000, duration: showNext ? 5000 : 2000,
dangerouslyUseHTMLString: true, dangerouslyUseHTMLString: true,
@@ -35,6 +37,10 @@ export default {
assetAdd.addEventListener('click', this.saveNext) assetAdd.addEventListener('click', this.saveNext)
}, },
saveNext () { saveNext () {
if (!this.messageParams.route) {
this.$store.dispatch(this.messageParams.emit, this.messageParams.params)
return
}
this.$router.push({ this.$router.push({
path: this.messageParams.route, path: this.messageParams.route,
query: this.messageParams.params query: this.messageParams.params

View File

@@ -743,7 +743,7 @@ export default {
this.$put(this.url, params).then(res => { this.$put(this.url, params).then(res => {
this.prevent_opt.save = false this.prevent_opt.save = false
if (res.code === 200) { if (res.code === 200) {
this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, true, 'guide.addEndpoint') this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, false, 'guide.addEndpoint')
this.esc(true) this.esc(true)
} else { } else {
this.$message.error(res.msg) this.$message.error(res.msg)
@@ -753,7 +753,7 @@ export default {
this.$post(this.url, params).then(res => { this.$post(this.url, params).then(res => {
this.prevent_opt.save = false this.prevent_opt.save = false
if (res.code === 200) { if (res.code === 200) {
this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, false, 'guide.addEndpoint') this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { assetId: res.data.id }, true, 'guide.addEndpoint')
this.esc(true) this.esc(true)
} else { } else {
this.$message.error(res.msg) this.$message.error(res.msg)

View File

@@ -124,7 +124,7 @@ export default {
this.$put('/dc', param).then(response => { this.$put('/dc', param).then(response => {
this.prevent_opt.save = false this.prevent_opt.save = false
if (response.code === 200) { if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) this.messageShow(this.$t('tip.saveSuccess'), '', { dcId: response.data.id, cabinetBoxShow: true }, false, 'guide.addCabinet', 'addCabinet')
this.esc(true) this.esc(true)
} else { } else {
this.$message.error(response.msg) this.$message.error(response.msg)
@@ -147,7 +147,7 @@ export default {
this.$post('/dc', param).then(response => { this.$post('/dc', param).then(response => {
this.prevent_opt.save = false this.prevent_opt.save = false
if (response.code === 200) { if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) this.messageShow(this.$t('tip.saveSuccess'), '', { dcId: response.data.id, cabinetBoxShow: true }, true, 'guide.addCabinet', 'addCabinet')
this.esc(true) this.esc(true)
} else { } else {
this.$message.error(response.msg) this.$message.error(response.msg)

View File

@@ -934,7 +934,8 @@ export default {
if (this.editModule.id) { if (this.editModule.id) {
this.$put('monitor/module', params).then(response => { this.$put('monitor/module', params).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) // this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { projectId: this.editModule.projectId, moduleId: response.data.id }, false, 'guide.addEndpoint')
this.$store.commit('setReloadFacade') this.$store.commit('setReloadFacade')
this.esc(true) this.esc(true)
} else { } else {
@@ -945,7 +946,7 @@ export default {
} else { } else {
this.$post('monitor/module', params).then(response => { this.$post('monitor/module', params).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) this.messageShow(this.$t('tip.saveSuccess'), '/endpoint', { projectId: this.editModule.projectId, moduleId: response.data.id }, true, 'guide.addEndpoint')
this.$store.commit('setReloadFacade') this.$store.commit('setReloadFacade')
this.esc(true) this.esc(true)
} else { } else {

View File

@@ -71,7 +71,8 @@ export default {
if (this.editProject.id) { if (this.editProject.id) {
this.$put('monitor/project', this.editProject).then(response => { this.$put('monitor/project', this.editProject).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) // this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
this.messageShow(this.$t('tip.saveSuccess'), '/module', { projectId: response.data.id }, false, 'guide.addModule')
this.$store.commit('projectListChange') this.$store.commit('projectListChange')
this.$store.commit('setProject', this.project) this.$store.commit('setProject', this.project)
this.esc(true) this.esc(true)
@@ -83,7 +84,7 @@ export default {
} else { } else {
this.$post('monitor/project', this.editProject).then(response => { this.$post('monitor/project', this.editProject).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') }) this.messageShow(this.$t('tip.saveSuccess'), '/module', { projectId: response.data.id }, true, 'guide.addModule')
this.$store.commit('projectListChange') this.$store.commit('projectListChange')
this.esc(true) this.esc(true)
} else { } else {

View File

@@ -137,7 +137,7 @@
</template> </template>
</nz-data-list> </nz-data-list>
<transition name="right-box"> <transition name="right-box">
<dc-box v-if="rightBox.show" :obj="object" :user-data="userData" @close="closeRightBox" @reload="getTableData"></dc-box> <dc-box v-if="rightBox.show" :obj="object" :user-data="userData" @close="closeRightBox" @reload="getTableData" @addcabinet="addCabinet"></dc-box>
</transition> </transition>
<transition name="right-box"> <transition name="right-box">
<cabinetBox v-if="cabinetBoxShow" :obj="cabinet" :current-dc="{}" @close="closeRightBox" :dcDisabled="false" @reload="getTableData"></cabinetBox> <cabinetBox v-if="cabinetBoxShow" :obj="cabinet" :current-dc="{}" @close="closeRightBox" :dcDisabled="false" @reload="getTableData"></cabinetBox>
@@ -232,6 +232,11 @@ export default {
trendKey: 'dcId' trendKey: 'dcId'
} }
}, },
computed: {
addCabinetBoxShow () {
return this.$store.getters.getAddCabinetBoxParams
}
},
methods: { methods: {
getUserData () { getUserData () {
return new Promise(resolve => { return new Promise(resolve => {
@@ -246,7 +251,11 @@ export default {
regNumTest (val) { // 校验是否是数字 regNumTest (val) { // 校验是否是数字
return this.regNum.test(val) return this.regNum.test(val)
}, },
addCabinet () { addCabinet (params) {
console.log('addCabinet')
if (params) {
this.cabinet.idcId = params.dcid
}
this.cabinetBoxShow = true this.cabinetBoxShow = true
}, },
add () { add () {
@@ -261,8 +270,10 @@ export default {
}) })
}, },
closeRightBox (refresh) { closeRightBox (refresh) {
console.log('closeRightBox')
this.rightBox.show = false this.rightBox.show = false
this.cabinetBoxShow = false this.cabinetBoxShow = false
this.$store.dispatch('addCabinet', { dcid: '', cabinetBoxShow: false })
if (refresh) { if (refresh) {
this.delFlag = true this.delFlag = true
this.getTableData() this.getTableData()
@@ -290,6 +301,12 @@ export default {
} }
} }
} }
},
addCabinetBoxShow: {
handler (n) {
this.cabinetBoxShow = n.cabinetBoxShow
this.cabinet.idcId = n.dcId
}
} }
} }
} }

View File

@@ -896,6 +896,14 @@ export default {
} }
this.rightBox.show = true this.rightBox.show = true
} }
if (this.$route.query && this.$route.query.moduleId) {
this.object = {
...this.newObject(),
moduleId: Number(this.$route.query.moduleId),
projectId: Number(this.$route.query.projectId)
}
this.rightBox.show = true
}
if (localStorage.getItem('endpointProjectId')) { if (localStorage.getItem('endpointProjectId')) {
this.selectValue.projectIds = [Number(localStorage.getItem('endpointProjectId'))] this.selectValue.projectIds = [Number(localStorage.getItem('endpointProjectId'))]
// this.$refs.clickSearch.selectValueOut.projectIds = [localStorage.getItem('endpointProjectId')] // this.$refs.clickSearch.selectValueOut.projectIds = [localStorage.getItem('endpointProjectId')]

View File

@@ -549,6 +549,13 @@ export default {
this.initQueryFromPath(searchKeys) this.initQueryFromPath(searchKeys)
}, },
mounted () { mounted () {
if (this.$route.query && this.$route.query.projectId) {
this.object = {
...this.newObject(),
projectId: Number(this.$route.query.projectId)
}
this.rightBox.show = true
}
}, },
watch: { watch: {
$route: { $route: {

View File

@@ -19,7 +19,8 @@ const panel = {
topologyShow: false, topologyShow: false,
topologyChartInfo: {}, topologyChartInfo: {},
// 查看模式 // 查看模式
mode: '' mode: '',
addCabinetBoxParams: { dcid: '', cabinetBoxShow: false }
}, },
mutations: { mutations: {
setShowRightBox (state, flag) { setShowRightBox (state, flag) {
@@ -54,6 +55,9 @@ const panel = {
state.headerHPadding = h.headerHPadding state.headerHPadding = h.headerHPadding
state.rowHeight = h.rowHeight state.rowHeight = h.rowHeight
}, },
setCabinet (state, params) {
state.addCabinetBoxParams = params
},
cleanPanel (state) { cleanPanel (state) {
state.showRightBox = false state.showRightBox = false
state.chart = '' state.chart = ''
@@ -120,6 +124,9 @@ const panel = {
}, },
getTopologyChartInfo (state) { getTopologyChartInfo (state) {
return state.topologyChartInfo return state.topologyChartInfo
},
getAddCabinetBoxParams (state) {
return state.addCabinetBoxParams
} }
}, },
actions: { actions: {
@@ -149,6 +156,9 @@ const panel = {
dispatchPanelLock (store, playload) { dispatchPanelLock (store, playload) {
store.commit('setPanelLock', playload.flag) store.commit('setPanelLock', playload.flag)
}, },
addCabinet (store, playload) {
store.commit('setCabinet', playload)
},
clearPanel (store) { clearPanel (store) {
store.commit('cleanPanel') store.commit('cleanPanel')
}, },