feat: 界面调整

This commit is contained in:
caoqianming 2024-02-01 17:56:29 +08:00
parent eeeadd9b98
commit 72f7bc4a38
2 changed files with 25 additions and 12 deletions

View File

@ -60,14 +60,14 @@
<div style="display:flex">
<div style="width: 500px">
<el-date-picker v-model="timeRange" type="datetimerange" range-separator="" start-placeholder="开始时间"
end-placeholder="结束时间" value-format="YYYY-MM-DD HH:mm:ss" @change="handleQuery" style="width: 100%" />
end-placeholder="结束时间" @change="handleQuery" style="width: 100%" />
</div>
<el-select v-model="query.time_bucket" placeholder="周期" style="margin-left:4px" @change="handleQuery">
<el-option v-for="item in timeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</div>
<div id="cChart" style="width: 100%; height:400px"></div>
<div id="cChart" style="width: 100%; height:400px; margin-top: 16px"></div>
</el-card>
</template>
<script>
@ -127,17 +127,13 @@ export default {
var now = new Date();
var start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 3);
let start_ = this.$TOOL.dateFormat(start)
let now_ = this.$TOOL.dateFormat(now)
this.timeRange = [start_, now_]
this.timeRange = [start, now]
},
rowClick(row) {
this.currentEquipmentId = row.equipment;
this.currentEquipmentName = row.equipment_name;
this.query.equipment_id = row.equipment;
this.query.start_time = this.timeRange[0];
this.query.end_time = this.timeRange[1];
this.$nextTick(() => { this.initChart() })
this.$nextTick(() => { this.handleQuery() })
},
initChart() {
@ -147,12 +143,13 @@ export default {
myChart = echarts.init(document.getElementById('cChart'));
}
myChart.showLoading();
this.$API.bi.dataset.exec.req('enp_edata', {
this.$API.bi.dataset.exec.req('enp_edata2', {
query: this.query,
raise_exception: true
}).then(res => {
let newOption = Object.assign({}, this.basicOption);
let ds0 = res.data.ds0
ds0.pop()
let series = []
if (ds0) {
let ds00 = ds0[0]
@ -168,8 +165,23 @@ export default {
},
handleQuery() {
this.query.start_time = this.timeRange[0]
this.query.end_time = this.timeRange[1]
let time1 = this.timeRange[0]
let time2 = this.timeRange[1]
let formatstr = 'yyyy-MM-dd hh:mm:ss'
if (this.query.time_bucket == '1 minute') {
time2.setTime(time2.getTime() + 1000 * 60);
formatstr = 'yyyy-MM-dd hh:mm:00'
}
else if (this.query.time_bucket == '1 hour') {
time2.setTime(time2.getTime() + 1000 * 60 * 60);
formatstr = 'yyyy-MM-dd hh:00:00'
}
else if (this.query.time_bucket == '1 day') {
time2.setTime(time2.getTime() + 1000 * 60 * 60 * 24);
formatstr = 'yyyy-MM-dd'
}
this.query.start_time = this.$TOOL.dateFormat(time1, formatstr)
this.query.end_time = this.$TOOL.dateFormat(time2, formatstr)
this.initChart()
}
},

View File

@ -46,7 +46,8 @@ export default {
"hour": 15,
"year": 2024,
"month": 1,
"metric": "dust_rtd"
"metric": "dust_rtd",
"drain_type": 10
}
}
},