feat: 计算结果页面优化
This commit is contained in:
parent
5ec953ff2e
commit
345c73cf09
|
@ -2,21 +2,18 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="left-panel">
|
<div class="left-panel">
|
||||||
<el-select
|
<xtSelect
|
||||||
|
:apiObj="apiObjM"
|
||||||
|
:params="paramsM"
|
||||||
v-model="query.mpoint"
|
v-model="query.mpoint"
|
||||||
placeholder="测点"
|
style="width: 500px"
|
||||||
clearable
|
|
||||||
filterable
|
|
||||||
style="margin: 0 6px; width: 300px"
|
|
||||||
@change="handleQuery"
|
@change="handleQuery"
|
||||||
|
placeholder="选择测点"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-table-column label="测点名" prop="name"></el-table-column>
|
||||||
v-for="item in mpoints"
|
<el-table-column label="别名" prop="nickname"></el-table-column>
|
||||||
:key="item.id"
|
<el-table-column label="计量物料" prop="material_name"></el-table-column>
|
||||||
:label="item.name"
|
</xtSelect>
|
||||||
:value="item.id"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
<el-select
|
<el-select
|
||||||
v-model="query.type"
|
v-model="query.type"
|
||||||
placeholder="类型"
|
placeholder="类型"
|
||||||
|
@ -44,7 +41,7 @@
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main class="nopadding">
|
<el-main class="nopadding">
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-aside style="width: 50%; float: right;">
|
<el-aside style="width: 60%; float: right;">
|
||||||
<!-- 折线图组件 -->
|
<!-- 折线图组件 -->
|
||||||
<scTable
|
<scTable
|
||||||
ref="table"
|
ref="table"
|
||||||
|
@ -57,11 +54,11 @@
|
||||||
@row-click="rowClick"
|
@row-click="rowClick"
|
||||||
@dataChange="dataChange"
|
@dataChange="dataChange"
|
||||||
>
|
>
|
||||||
<el-table-column label="测点" prop="mpoint_name" min-width="100">
|
<el-table-column label="测点" prop="mpoint_name" min-width="160">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="所属集合" prop="mgroup_name">
|
<el-table-column label="所属集合" prop="mgroup_name">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="类型" prop="type" width="70"> </el-table-column>
|
<el-table-column label="类型" prop="type" width="75"> </el-table-column>
|
||||||
<el-table-column label="年" prop="year" width="60"> </el-table-column>
|
<el-table-column label="年" prop="year" width="60"> </el-table-column>
|
||||||
<el-table-column label="班年" prop="year_s" width="60"> </el-table-column>
|
<el-table-column label="班年" prop="year_s" width="60"> </el-table-column>
|
||||||
<el-table-column label="月" prop="month" width="50"> </el-table-column>
|
<el-table-column label="月" prop="month" width="50"> </el-table-column>
|
||||||
|
@ -161,6 +158,8 @@ export default {
|
||||||
name: "sflog",
|
name: "sflog",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
apiObjM: this.$API.enm.mpoint.list,
|
||||||
|
paramsM: {material__isnull: 0},
|
||||||
apiObj: this.$API.enm.mpoint.stat,
|
apiObj: this.$API.enm.mpoint.stat,
|
||||||
params: {
|
params: {
|
||||||
type: "day_s",
|
type: "day_s",
|
||||||
|
@ -226,16 +225,17 @@ export default {
|
||||||
val_correct: "",
|
val_correct: "",
|
||||||
},
|
},
|
||||||
visible: false,
|
visible: false,
|
||||||
mpoints: [],
|
|
||||||
timeRange: []
|
timeRange: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getMpoints();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
dataChange(req, tableData) {
|
dataChange(req, tableData) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
if(that.query.mpoint == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
let option = { ...that.chartOption };
|
let option = { ...that.chartOption };
|
||||||
// 获取 x 轴的数据,如果query.type为小时,则显示小时,如果为天则显示天,如果为月则显示月
|
// 获取 x 轴的数据,如果query.type为小时,则显示小时,如果为天则显示天,如果为月则显示月
|
||||||
if (that.query.type == "hour") {
|
if (that.query.type == "hour") {
|
||||||
|
@ -249,10 +249,10 @@ export default {
|
||||||
option.xAxis.data = tableData.reverse().map((item, index) => item.year + "-" + item.month);
|
option.xAxis.data = tableData.reverse().map((item, index) => item.year + "-" + item.month);
|
||||||
}else if (that.query.type == "day_s") {
|
}else if (that.query.type == "day_s") {
|
||||||
option.title.text = "班天统计";
|
option.title.text = "班天统计";
|
||||||
option.xAxis.data = tableData.length > 0 ? tableData.reverse().map((item, index) => item.day_s) : [];
|
option.xAxis.data = tableData.reverse().map((item, index) => item.year_s + "-" + item.month_s + "-" + item.day_s);
|
||||||
}else if (that.query.type == "month_s") {
|
}else if (that.query.type == "month_s") {
|
||||||
option.title.text = "班月统计";
|
option.title.text = "班月统计";
|
||||||
option.xAxis.data = tableData.length > 0 ? tableData.reverse().map((item, index) => item.month_s) : [];
|
option.xAxis.data = tableData.reverse().map((item, index) => item.year_s + "-" + item.month_s);
|
||||||
}
|
}
|
||||||
// 获取 y 轴的数据
|
// 获取 y 轴的数据
|
||||||
option.series = [
|
option.series = [
|
||||||
|
@ -267,15 +267,6 @@ export default {
|
||||||
// 更新图表选项
|
// 更新图表选项
|
||||||
that.chartOption = option;
|
that.chartOption = option;
|
||||||
},
|
},
|
||||||
|
|
||||||
getMpoints() {
|
|
||||||
let that = this;
|
|
||||||
this.$API.enm.mpoint.list
|
|
||||||
.req({ page: 0})
|
|
||||||
.then((res) => {
|
|
||||||
that.mpoints = res;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
handle_add() {},
|
handle_add() {},
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
if (this.timeRange) {
|
if (this.timeRange) {
|
||||||
|
|
Loading…
Reference in New Issue