fix: 预览页面的添加

This commit is contained in:
zhangyu
2021-12-23 17:02:21 +08:00
parent b95c4c792d
commit 551d3288ab
3 changed files with 46 additions and 6 deletions

View File

@@ -175,8 +175,10 @@ export default {
}, },
mounted () { mounted () {
if (this.$refs.pickTime) { if (this.$refs.pickTime) {
this.$refs.pickTime.$refs.multipleTime.showDropdown = false if (this.$refs.pickTime.$refs.multipleTime) {
this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowType) this.$refs.pickTime.$refs.multipleTime.showDropdown = false
this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowType)
}
this.setSearchTime(this.nowType.type, this.nowType.value, this.nowType) this.setSearchTime(this.nowType.type, this.nowType.value, this.nowType)
this.searchTime[0] = bus.timeFormate(this.timeRange[0], 'yyyy-MM-dd hh:mm:ss') this.searchTime[0] = bus.timeFormate(this.timeRange[0], 'yyyy-MM-dd hh:mm:ss')
this.searchTime[1] = bus.timeFormate(this.timeRange[1], 'yyyy-MM-dd hh:mm:ss') this.searchTime[1] = bus.timeFormate(this.timeRange[1], 'yyyy-MM-dd hh:mm:ss')

View File

@@ -392,13 +392,13 @@
<div class="form__sub-title"> <div class="form__sub-title">
<span>{{$t('dashboard.panel.chartForm.threshold')}}</span> <span>{{$t('dashboard.panel.chartForm.threshold')}}</span>
<el-switch <el-switch
v-model="chartConfig.param.thresholdShow" v-model="chartConfig.param.enable.thresholds"
size="small" size="small"
@change="thresholdShowChange" @change="thresholdShowChange"
></el-switch> ></el-switch>
</div> </div>
<transition name="el-zoom-in-top"> <transition name="el-zoom-in-top">
<el-row v-if="chartConfig.param.thresholdShow"> <el-row v-if="chartConfig.param.enable.thresholds">
<el-form-item <el-form-item
v-for="(item,index) in chartConfig.param.thresholds" v-for="(item,index) in chartConfig.param.thresholds"
:key="index" :key="index"

View File

@@ -81,13 +81,33 @@
<button v-if="showPanel.type && showPanel.type == 'model'" id="chart-box-Sync" v-has="'panel_chart_edit'" class="footer__btn"> <button v-if="showPanel.type && showPanel.type == 'model'" id="chart-box-Sync" v-has="'panel_chart_edit'" class="footer__btn">
<span>{{$t('overall.SyncSave')}}</span> <span>{{$t('overall.SyncSave')}}</span>
</button> </button>
<button v-else-if="from!=='chartTemp'" id="chart-box-preview" class="footer__btn"> <button v-else-if="from!=='chartTemp'" id="chart-box-preview" class="footer__btn" @click="preview(true)">
<span>{{$t('overall.preview')}}</span> <span>{{$t('overall.preview')}}</span>
</button> </button>
<button id="chart-box-save" v-has="'panel_chart_add'" :class="{'nz-btn-disabled':prevent_opt.save}" :disabled="prevent_opt.save" class="footer__btn" @click="save"> <button id="chart-box-save" v-has="'panel_chart_add'" :class="{'nz-btn-disabled':prevent_opt.save}" :disabled="prevent_opt.save" class="footer__btn" @click="save">
<span>{{$t('overall.save')}}</span> <span>{{$t('overall.save')}}</span>
</button> </button>
</div> </div>
<!-- 预览-->
<el-dialog
v-if="previewShow"
:visible.sync="previewShow"
:show-close="false"
class="nz-dialog chart-fullscreen"
destroy-on-close
fullscreen
:modal-append-to-body="false"
>
<panel-chart
:ref="'chart-fullscreen-previewShow'"
:chart-info="prevChart"
:from="from"
:filter="{}"
:is-fullscreen="true"
:time-range="timeRange"
@showFullscreen="preview"
></panel-chart>
</el-dialog>
</div> </div>
</template> </template>
@@ -99,6 +119,9 @@ import selectPanel from '@/components/common/popBox/selectPanel'
import chartConfig from '@/components/common/rightBox/chart/chartConfig' import chartConfig from '@/components/common/rightBox/chart/chartConfig'
import otherChartConfig from '@/components/common/rightBox/chart/otherChartConfig' import otherChartConfig from '@/components/common/rightBox/chart/otherChartConfig'
import systemChartConfig from '@/components/common/rightBox/chart/systemChartConfig' import systemChartConfig from '@/components/common/rightBox/chart/systemChartConfig'
import panelChart from '@/components/chart/panelChart'
import lodash from 'lodash'
const rz = { const rz = {
methods: { methods: {
rz (e) { rz (e) {
@@ -124,7 +147,8 @@ export default {
selectPanel, selectPanel,
chartConfig, chartConfig,
systemChartConfig, systemChartConfig,
otherChartConfig otherChartConfig,
panelChart
}, },
computed: { computed: {
chartLastPosition () { chartLastPosition () {
@@ -134,6 +158,7 @@ export default {
data () { data () {
return { return {
fromRoute, fromRoute,
previewShow: false,
editChart: { editChart: {
name: '', name: '',
remark: '' remark: ''
@@ -142,6 +167,8 @@ export default {
id: '', id: '',
name: '' name: ''
}, },
timeRange: [],
prevChart: {},
filterPanel: '', filterPanel: '',
groupArr: [], groupArr: [],
panelName: '', panelName: '',
@@ -349,6 +376,17 @@ export default {
groupId: this.editChart.groupId, groupId: this.editChart.groupId,
panelName: this.editChart.panelName panelName: this.editChart.panelName
} }
},
preview (show) {
if (show) {
this.timeRange = [new Date().setHours(new Date().getHours() - 1), new Date()]
this.prevChart = lodash.cloneDeep(this.editChart)
this.prevChart.loaded = true
this.prevChart.param.showHeader = true
}
this.$nextTick(() => {
this.previewShow = show
})
} }
}, },
created () { created () {