update
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="main-area" style="flex: 1; background: lightyellow; display: flex; flex-direction: column">
|
||||
<div class="main-area" style="flex: 1; display: flex; flex-direction: column">
|
||||
<div class="graphs" v-show="graphList.length" id="status-chart" style="height: 1px; flex: 1"></div>
|
||||
<h2 v-if="!graphList || graphList.length == 0" class="no-data-bg"></h2>
|
||||
</div>
|
||||
@@ -126,6 +126,7 @@ export default {
|
||||
recordTime: null,
|
||||
},
|
||||
graphList: [],
|
||||
existingEquipments: [],
|
||||
open: false,
|
||||
eqList: [],
|
||||
startTime: null,
|
||||
@@ -165,12 +166,9 @@ export default {
|
||||
handler(val) {
|
||||
if (val && val.length) {
|
||||
this.$nextTick(() => {
|
||||
// if (!this.chart) this.initChart();
|
||||
// this.setInitialConfig();
|
||||
// this.handleGraphList();
|
||||
if (!this.gantt) {
|
||||
this.gantt = new Gantt(null, this.startTime);
|
||||
this.gantt.init('#status-chart');
|
||||
this.gantt = new Gantt('#status-chart', this.startTime);
|
||||
this.gantt.init(val);
|
||||
return;
|
||||
}
|
||||
this.gantt.update(val);
|
||||
@@ -184,43 +182,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
setInitialConfig() {
|
||||
console.log('in setInitialConfig', this.chartOption);
|
||||
this.chart.setOption(this.chartOption);
|
||||
},
|
||||
|
||||
handleGraphList() {
|
||||
console.log('in handleGraphList:', this.graphList);
|
||||
return;
|
||||
const min = this.queryParams.recordTime
|
||||
? new Date(this.queryParams.recordTime).getTime()
|
||||
: this.findMin();
|
||||
|
||||
console.log('min is', min);
|
||||
this.chartOption.xAxis.min = getStartTime(min);
|
||||
this.chartOption.xAxis.max = getStartTime(min + 3600 * 24 * 1000);
|
||||
this.graphList.forEach((arr) => {
|
||||
this.chartOption.yAxis[0].data.push(arr.key);
|
||||
arr.forEach((item) => {
|
||||
this.chartOption.series[0].data.push({
|
||||
name: ['运行', '故障', '计划停机'][item.status],
|
||||
value: [
|
||||
0,
|
||||
item.startTime,
|
||||
item.startTime + item.duration * 60 * 1000,
|
||||
item.duration * 60 * 1000,
|
||||
],
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: types[item.status].color,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
console.log('chartOptions', this.chartOption);
|
||||
});
|
||||
},
|
||||
|
||||
findMin() {
|
||||
let min = 0;
|
||||
this.graphList.forEach((arr) => {
|
||||
@@ -231,12 +192,6 @@ export default {
|
||||
return min;
|
||||
},
|
||||
|
||||
initChart() {
|
||||
const el = document.getElementById('status-chart');
|
||||
this.gantt = new Gantt(el);
|
||||
this.gantt.init();
|
||||
},
|
||||
|
||||
/** 重置查询条件 */
|
||||
initQuery() {
|
||||
this.queryParams.lineId = null;
|
||||
@@ -261,8 +216,8 @@ export default {
|
||||
params: this.queryParams,
|
||||
});
|
||||
if (code == 0) {
|
||||
this.existingEquipments = Object.values(data).map((eq) => eq[0].equipmentId);
|
||||
this.graphList = this.objectToArray(data);
|
||||
console.log('graph list', this.graphList);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -348,8 +303,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
this.startTime = new Date(payload.recordTime).getTime();
|
||||
console.log("startTime", new Date(payload.recordTime).getTime());
|
||||
this.startTime = new Date(payload.recordTime)
|
||||
this.queryParams.lineId = payload.lineId || null;
|
||||
this.queryParams.sectionId = payload.sectionId || null;
|
||||
this.queryParams.equipmentId = payload.equipmentId || null;
|
||||
@@ -379,6 +333,10 @@ export default {
|
||||
},
|
||||
|
||||
async submitForm() {
|
||||
if (this.existingEquipments.indexOf(this.queryParams.equipmentId) >= 0) {
|
||||
this.$message.error('该设备已存在');
|
||||
return;
|
||||
}
|
||||
const { code, data } = await this.$axios({
|
||||
url: '/analysis/equipment-analysis/status',
|
||||
method: 'get',
|
||||
|
||||
Reference in New Issue
Block a user