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

This commit is contained in:
likexuan
2022-06-20 17:22:58 +08:00
10 changed files with 51 additions and 17 deletions

View File

@@ -359,7 +359,10 @@ export default {
this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].groupShow(item.param.collapse) this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].groupShow(item.param.collapse)
this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].$refs.chart && this.$refs['chart' + item.id][0].$refs.chart.$refs['chart' + item.id] && this.$refs['chart' + item.id][0].$refs.chart.$refs['chart' + item.id].$refs.chartList.resize() this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].$refs.chart && this.$refs['chart' + item.id][0].$refs.chart.$refs['chart' + item.id] && this.$refs['chart' + item.id][0].$refs.chart.$refs['chart' + item.id].$refs.chartList.resize()
} }
try {
this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].resize() this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].resize()
} catch (error) {
}
}) })
}, },
refreshPanel () { refreshPanel () {
@@ -448,10 +451,10 @@ export default {
// 监听查看模式变化 // 监听查看模式变化
'$store.state.panel.mode': { '$store.state.panel.mode': {
immediate: true, immediate: true,
handler () { handler (val) {
setTimeout(() => { setTimeout(() => {
this.resize() this.resize()
}, 100) }, 200)
} }
}, },
dataList: { dataList: {

View File

@@ -10,6 +10,7 @@
</template> </template>
<script> <script>
import bus from '@/libs/bus'
export default { export default {
name: 'deleteButton', name: 'deleteButton',
props: { props: {
@@ -44,6 +45,7 @@ export default {
if (response.code === 200) { if (response.code === 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
this.$emit('after') this.$emit('after')
bus.$emit('delTableRow', this.deleteObjs.map(item => item.id))
} else { } else {
this.$message.error(response.msg) this.$message.error(response.msg)
} }

View File

@@ -161,6 +161,7 @@ export default {
self.delFlag = true self.delFlag = true
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.deleteSuccess') })
self.getTableData() self.getTableData()
bus.$emit('delTableRow', [row.id])
} else { } else {
this.$message.error(response.msg) this.$message.error(response.msg)
} }
@@ -354,6 +355,8 @@ export default {
} }
if (this.$route.query.orderBy && !this.isSubList) { if (this.$route.query.orderBy && !this.isSubList) {
this.orderBy = this.$route.query.orderBy this.orderBy = this.$route.query.orderBy
} else if (this.isSubList) {
return
} }
let searchKeys = {} let searchKeys = {}
if (path === 'dc') { if (path === 'dc') {

View File

@@ -244,7 +244,7 @@ export default {
tempEndpoint: {}, tempEndpoint: {},
tempEndpoint2: {}, tempEndpoint2: {},
assetLoading: true, assetLoading: true,
rightBox: { show: false, title: this.$t('overall.createEndpoin'), isEdit: false }, rightBox: { show: false, title: this.$t('overall.createEndpoint'), isEdit: false },
optionType: 'batch', optionType: 'batch',
blankEndpoint: { blankEndpoint: {
id: '', id: '',

View File

@@ -268,7 +268,7 @@ export default {
tempEndpoint: {}, tempEndpoint: {},
tempEndpoint2: {}, tempEndpoint2: {},
assetLoading: true, assetLoading: true,
rightBox: { show: false, title: this.$t('overall.createEndpoin'), isEdit: false }, rightBox: { show: false, title: this.$t('overall.createEndpoint'), isEdit: false },
optionType: 'batchAdd', optionType: 'batchAdd',
endpointTableTitle: [ // 原始table列 endpointTableTitle: [ // 原始table列
{ {

View File

@@ -157,7 +157,7 @@ export default {
tempEndpoint: {}, tempEndpoint: {},
tempEndpoint2: {}, tempEndpoint2: {},
assetLoading: true, assetLoading: true,
rightBox: { show: false, title: this.$t('overall.createEndpoin'), isEdit: false }, rightBox: { show: false, title: this.$t('overall.createEndpoint'), isEdit: false },
blankEndpoint: { blankEndpoint: {
id: '', id: '',
projectId: '', projectId: '',

View File

@@ -10,10 +10,10 @@
{{ $t("project.module.batchEndpoint")}} {{ $t("project.module.batchEndpoint")}}
</span> </span>
<span v-if="optionType === 'add'"> <span v-if="optionType === 'add'">
{{ $t("overall.createEndpoin")}} {{ $t("overall.createEndpoint")}}
</span> </span>
<span v-if="optionType === 'batchAdd'"> <span v-if="optionType === 'batchAdd'">
{{ $t("overall.createEndpoin")}} {{ $t("overall.createEndpoint")}}
</span> </span>
</div> </div>
<!-- end--标题--> <!-- end--标题-->

View File

@@ -104,6 +104,7 @@ import { fromRoute } from '@/components/common/js/constants'
import bottomBox from '@/components/common/bottomBox/bottomBox' import bottomBox from '@/components/common/bottomBox/bottomBox'
import { bottomBoxWindow } from '@/components/common/js/tools' import { bottomBoxWindow } from '@/components/common/js/tools'
import panelChart from '@/components/chart/panelChart' import panelChart from '@/components/chart/panelChart'
import bus from '@/libs/bus'
export default { export default {
name: 'nzDataList', name: 'nzDataList',
components: { components: {
@@ -175,7 +176,23 @@ export default {
timeRange: [new Date(), new Date()] timeRange: [new Date(), new Date()]
} }
}, },
mounted () {
bus.$on('delTableRow', this.delTableRow)
},
methods: { methods: {
delTableRow (ids) { // 接收一个 删除的id数组 判断当前底部弹窗id 是否包含 包含则关闭当前弹窗
if (ids.indexOf(this.bottomBox.object.id) !== -1) {
this.bottomBox = {
object: {},
mainResizeShow: true, // dom高度改变时是否展示|隐藏
subResizeShow: true,
isFullScreen: false, // 全屏状态
showSubList: false, // 是否显示二级列表
targetTab: '', // 显示二级列表中的哪个页签
inTransform: false // 搜索框相关搜索条件下拉框是否在transform里
}
}
},
updateCustomTableTitle (custom) { updateCustomTableTitle (custom) {
this.$emit('update:customTableTitle', custom) this.$emit('update:customTableTitle', custom)
}, },
@@ -225,6 +242,9 @@ export default {
this.showLayout = [...n] this.showLayout = [...n]
} }
} }
},
beforeDestroy () {
bus.$off('delTableRow', this.delTableRow)
} }
} }
</script> </script>

View File

@@ -92,9 +92,9 @@
class="date-range-history-item" class="date-range-history-item"
@click="historyChange(item)" @click="historyChange(item)"
> >
{{ timeFormate(item.start) }} {{ momentTz(item.start) }}
{{ $t("dashboard.panel.to") }} {{ $t("dashboard.panel.to") }}
{{ timeFormate(item.end) }} {{ momentTz(item.end) }}
</div> </div>
</div> </div>
</el-col> </el-col>
@@ -340,8 +340,8 @@ export default {
} }
this.isCustom = true this.isCustom = true
this.rangeHistory.unshift({ this.rangeHistory.unshift({
start: item[0], start: this.momentStrToTimestamp(item[0]),
end: item[1] end: this.momentStrToTimestamp(item[1])
}) })
localStorage.setItem( localStorage.setItem(
'date-range-history' + this.sign, 'date-range-history' + this.sign,

View File

@@ -14,7 +14,7 @@
<div style="display: flex;flex-direction: column"> <div style="display: flex;flex-direction: column">
<!-- <i class="nz-icon nz-icon-arrow-down"/>--> <!-- <i class="nz-icon nz-icon-arrow-down"/>-->
<div style="font-size: 18px;font-weight: 600;color: #333;margin-bottom: 3px;text-align: right"> {{dataJson.panel.data.name}} </div> <div style="font-size: 18px;font-weight: 600;color: #333;margin-bottom: 3px;text-align: right"> {{dataJson.panel.data.name}} </div>
<span> {{timeFormate(dataJson.start * 1000)}} - {{timeFormate(dataJson.end * 1000)}} </span> <span> {{dateFormat(dataJson.start * 1000)}} - {{dateFormat(dataJson.end * 1000)}} ({{dataJson.timezone}})</span>
</div> </div>
</div> </div>
<div id="dashboardScrollbar" class="box-content" ref="dashboardScrollbar" style='overflow:hidden; overflow-y: auto;height: calc(100% - 60px)'> <div id="dashboardScrollbar" class="box-content" ref="dashboardScrollbar" style='overflow:hidden; overflow-y: auto;height: calc(100% - 60px)'>
@@ -50,7 +50,6 @@ import chartList from '@/components/chart/chartList.vue'
import moment from 'moment-timezone' import moment from 'moment-timezone'
import { loadI18n } from '@/components/common/i18n' import { loadI18n } from '@/components/common/i18n'
import i18nData from '@/entrance/exportHtml/i18nData' import i18nData from '@/entrance/exportHtml/i18nData'
const dataJson = window.dataJson || {} const dataJson = window.dataJson || {}
export default { export default {
name: 'Entrance', name: 'Entrance',
@@ -67,7 +66,8 @@ export default {
created () { created () {
this.$i18n.locale = this.dataJson.language this.$i18n.locale = this.dataJson.language
loadI18n(i18nData) loadI18n(i18nData)
const localOffset = moment.tz.guess()// 默认 一分钟显示时区偏移的结果 const localOffset = this.dataJson.timezone || moment.tz.guess()
this.dataJson.timezone = localOffset
localStorage.setItem('nz-sys-timezone', localOffset) localStorage.setItem('nz-sys-timezone', localOffset)
}, },
mounted () { mounted () {
@@ -78,7 +78,13 @@ export default {
delChart () {}, delChart () {},
addGroupItem () {}, addGroupItem () {},
chartListLoading () {}, chartListLoading () {},
refreshPanel () {} refreshPanel () {},
// 时间戳转为UTC格式
dateFormat (time) {
let offset = localStorage.getItem('nz-sys-timezone')
offset = moment.tz(offset).format('Z')
return moment(time).utcOffset(offset).format()
}
} }
} }
</script> </script>