fix:主要设备单位产品电耗图标时间搜索

This commit is contained in:
shijing 2024-05-15 14:33:49 +08:00
parent bad6efb816
commit 6999a172cd
6 changed files with 350 additions and 106 deletions

View File

@ -83,13 +83,45 @@
</tbody> </tbody>
</table> </table>
<div class="radioWrap"> <div class="radioWrap">
<el-radio-group v-model="typeRadio"> <el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
>
<el-radio-button label="day">本日</el-radio-button> <el-radio-button label="day">本日</el-radio-button>
<el-radio-button label="month" <el-radio-button label="month"
>本月</el-radio-button >本月</el-radio-button
> >
<el-radio-button label="year">本年</el-radio-button> <el-radio-button label="year">本年</el-radio-button>
</el-radio-group> </el-radio-group>
<div style="position: absolute; right: 20px">
<el-date-picker
v-model="searchDate"
type="date"
value-format="YYYY-MM-DD"
formatter="YYYY-MM-DD"
placeholder="选择日期"
v-if="typeRadio == 'day'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-model="searchDate"
type="month"
value-format="YYYY-MM"
formatter="YYYY-MM"
placeholder="选择月"
v-if="typeRadio == 'month'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-if="typeRadio == 'year'"
v-model="searchDate"
type="year"
value-format="YYYY"
formatter="YYYY"
placeholder="选择年"
@change="dateChange"
></el-date-picker>
</div>
</div> </div>
<div class="chartWrap" v-show="typeRadio == 'day'"> <div class="chartWrap" v-show="typeRadio == 'day'">
<div class="chartTitle">小时生产参数统计图</div> <div class="chartTitle">小时生产参数统计图</div>
@ -220,8 +252,8 @@ export default {
}, },
data() { data() {
return { return {
searchDate: "",
typeRadio: "day", typeRadio: "day",
chartShow: false,
myOption: null, myOption: null,
optionHour: {}, optionHour: {},
optionDay: {}, optionDay: {},
@ -597,20 +629,38 @@ export default {
} }
}); });
}); });
that.getHourData(); that.getHourData(that.year, that.month, that.days);
that.getDayData(); that.getDayData(that.year, that.month);
that.getMonthData(); that.getMonthData(that.year);
}); });
}, },
methods: { methods: {
typeRadioChange() {
this.searchDate = "";
},
dateChange(val) {
console.log(val);
if (this.typeRadio == "day") {
let year = val.split("-")[0];
let month = val.split("-")[1];
let days = val.split("-")[2];
this.getHourData(year, month, days);
} else if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
this.getDayData(year, month);
} else {
this.getMonthData(val);
}
},
// //
getHourData() { getHourData(year, month, days) {
let that = this; let that = this;
let query = {}; let query = {};
query.page = 0; query.page = 0;
query.year_s = that.year; query.year_s = year;
query.month_s = that.month; query.month_s = month;
query.day_s = that.days; query.day_s = days;
query.type = "hour_s"; query.type = "hour_s";
query.mgroup = that.query.mgroup; query.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query).then((response) => { this.$API.enm.enstat.req(query).then((response) => {
@ -632,7 +682,7 @@ export default {
options.series[2].data = seriesData2; options.series[2].data = seriesData2;
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
let hourXAxis = []; let hourXAxis = [];
for (let i = 1; i <= that.hours; i++) { for (let i = 0; i < 24; i++) {
let item = i + "时"; let item = i + "时";
hourXAxis.push(item); hourXAxis.push(item);
} }
@ -641,12 +691,12 @@ export default {
}); });
}, },
// //
getDayData() { getDayData(year, month) {
let that = this; let that = this;
let query1 = {}; let query1 = {};
query1.page = 0; query1.page = 0;
query1.year_s = that.year; query1.year_s = year;
query1.month_s = that.month; query1.month_s = month;
query1.type = "day_s"; query1.type = "day_s";
query1.mgroup = this.query.mgroup; query1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(query1).then((response) => { this.$API.enm.enstat.req(query1).then((response) => {
@ -668,7 +718,8 @@ export default {
options.series[2].data = seriesData2; options.series[2].data = seriesData2;
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
let dayXAxis = []; let dayXAxis = [];
for (let i = 1; i <= that.days; i++) { let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日"; let item = i + "日";
dayXAxis.push(item); dayXAxis.push(item);
} }
@ -677,11 +728,11 @@ export default {
}); });
}, },
// //
getMonthData() { getMonthData(year) {
let that = this; let that = this;
let query2 = {}; let query2 = {};
query2.page = 0; query2.page = 0;
query2.year_s = that.year; query2.year_s = year;
query2.type = "month_s"; query2.type = "month_s";
query2.mgroup = that.query.mgroup; query2.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query2).then((response) => { this.$API.enm.enstat.req(query2).then((response) => {
@ -704,7 +755,7 @@ export default {
options.series[2].data = seriesData2; options.series[2].data = seriesData2;
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
let monthXAxis = []; let monthXAxis = [];
for (let i = 1; i <= that.month; i++) { for (let i = 1; i < 13; i++) {
let item = i + "月"; let item = i + "月";
monthXAxis.push(item); monthXAxis.push(item);
} }
@ -717,15 +768,6 @@ export default {
this.cate = item[1]; this.cate = item[1];
this.asynDialog = true; this.asynDialog = true;
}, },
itemClick1(type, item) {
this.chartShow = false;
this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
this.myOption = JSON.parse(res.echart_options);
debugger;
console.log(this.myOption);
this.chartShow = true;
});
},
handlePrint() { handlePrint() {
this.$PRINT("#myReport"); this.$PRINT("#myReport");
}, },
@ -745,5 +787,6 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-top: 10px; padding-top: 10px;
position: relative;
} }
</style> </style>

View File

@ -96,13 +96,45 @@
</tbody> </tbody>
</table> </table>
<div class="radioWrap"> <div class="radioWrap">
<el-radio-group v-model="typeRadio"> <el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
>
<el-radio-button label="day">本日</el-radio-button> <el-radio-button label="day">本日</el-radio-button>
<el-radio-button label="month" <el-radio-button label="month"
>本月</el-radio-button >本月</el-radio-button
> >
<el-radio-button label="year">本年</el-radio-button> <el-radio-button label="year">本年</el-radio-button>
</el-radio-group> </el-radio-group>
<div style="position: absolute; right: 20px">
<el-date-picker
v-model="searchDate"
type="date"
value-format="YYYY-MM-DD"
formatter="YYYY-MM-DD"
placeholder="选择日期"
v-if="typeRadio == 'day'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-model="searchDate"
type="month"
value-format="YYYY-MM"
formatter="YYYY-MM"
placeholder="选择月"
v-if="typeRadio == 'month'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-if="typeRadio == 'year'"
v-model="searchDate"
type="year"
value-format="YYYY"
formatter="YYYY"
placeholder="选择年"
@change="dateChange"
></el-date-picker>
</div>
</div> </div>
<div class="chartWrap" v-show="typeRadio == 'day'"> <div class="chartWrap" v-show="typeRadio == 'day'">
<div class="chartTitle">小时生产参数统计图</div> <div class="chartTitle">小时生产参数统计图</div>
@ -344,6 +376,7 @@ export default {
}, },
data() { data() {
return { return {
searchDate: "",
typeRadio: "day", typeRadio: "day",
timeStamp: null, timeStamp: null,
chartShow: false, chartShow: false,
@ -404,18 +437,18 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
data: [], data: [],
}, },
{
name: "运转率",
type: "line",
yAxisIndex: 1,
data: [],
},
{ {
name: "运转时间", name: "运转时间",
type: "bar", type: "bar",
yAxisIndex: 2, yAxisIndex: 2,
data: [], data: [],
}, },
{
name: "运转率",
type: "line",
yAxisIndex: 1,
data: [],
},
{ {
name: "用电量", name: "用电量",
type: "bar", type: "bar",
@ -466,18 +499,18 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
data: [], data: [],
}, },
{
name: "运转率",
type: "line",
yAxisIndex: 1,
data: [],
},
{ {
name: "运转时间", name: "运转时间",
type: "bar", type: "bar",
yAxisIndex: 2, yAxisIndex: 2,
data: [], data: [],
}, },
{
name: "运转率",
type: "line",
yAxisIndex: 1,
data: [],
},
{ {
name: "用电量", name: "用电量",
type: "bar", type: "bar",
@ -514,18 +547,18 @@ export default {
yAxisIndex: 0, yAxisIndex: 0,
data: [], data: [],
}, },
{
name: "运转率",
type: "line",
yAxisIndex: 1,
data: [],
},
{ {
name: "运转时间", name: "运转时间",
type: "bar", type: "bar",
yAxisIndex: 2, yAxisIndex: 2,
data: [], data: [],
}, },
{
name: "运转率",
type: "line",
yAxisIndex: 1,
data: [],
},
{ {
name: "用电量", name: "用电量",
type: "bar", type: "bar",
@ -612,7 +645,7 @@ export default {
if (res4.length > 0) { if (res4.length > 0) {
let data4 = res4[0]; let data4 = res4[0];
that.tableDatas[0][2] = data4.total_production; that.tableDatas[0][2] = data4.total_production;
that.tableDatas[1][2] = data4.production_hour; // that.tableDatas[1][2] = "/"; //
that.tableDatas[2][2] = data4.production_elec_unit; // that.tableDatas[2][2] = data4.production_elec_unit; //
that.tableDatas[3][2] = "/"; that.tableDatas[3][2] = "/";
that.tableDatas[4][2] = "/"; that.tableDatas[4][2] = "/";
@ -750,20 +783,38 @@ export default {
} }
}); });
}); });
that.getHourData(); that.getHourData(that.year, that.month, that.days);
that.getDayData(); that.getDayData(that.year, that.month);
that.getMonthData(); that.getMonthData(that.year);
}); });
}, },
methods: { methods: {
typeRadioChange() {
this.searchDate = "";
},
dateChange(val) {
console.log(val);
if (this.typeRadio == "day") {
let year = val.split("-")[0];
let month = val.split("-")[1];
let days = val.split("-")[2];
this.getHourData(year, month, days);
} else if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
this.getDayData(year, month);
} else {
this.getMonthData(val);
}
},
// //
getHourData() { getHourData(year, month, days) {
let that = this; let that = this;
let query = {}; let query = {};
query.page = 0; query.page = 0;
query.year_s = that.year; query.year_s = year;
query.month_s = that.month; query.month_s = month;
query.day_s = that.days; query.day_s = days;
query.type = "hour_s"; query.type = "hour_s";
query.mgroup = that.query.mgroup; query.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query).then((response) => { this.$API.enm.enstat.req(query).then((response) => {
@ -788,7 +839,7 @@ export default {
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
options.series[4].data = seriesData4; options.series[4].data = seriesData4;
let hourXAxis = []; let hourXAxis = [];
for (let i = 1; i <= that.hours; i++) { for (let i = 0; i < 24; i++) {
let item = i + "时"; let item = i + "时";
hourXAxis.push(item); hourXAxis.push(item);
} }
@ -796,13 +847,14 @@ export default {
that.optionHour = options; that.optionHour = options;
}); });
}, },
// //
getDayData() { getDayData(year, month) {
let that = this; let that = this;
let query1 = {}; let query1 = {};
query1.page = 0; query1.page = 0;
query1.year_s = that.year; query1.year_s = year;
query1.month_s = that.month; query1.month_s = month;
query1.type = "day_s"; query1.type = "day_s";
query1.mgroup = this.query.mgroup; query1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(query1).then((response) => { this.$API.enm.enstat.req(query1).then((response) => {
@ -827,7 +879,8 @@ export default {
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
options.series[4].data = seriesData4; options.series[4].data = seriesData4;
let dayXAxis = []; let dayXAxis = [];
for (let i = 1; i <= that.days; i++) { let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日"; let item = i + "日";
dayXAxis.push(item); dayXAxis.push(item);
} }
@ -836,11 +889,11 @@ export default {
}); });
}, },
// //
getMonthData() { getMonthData(year) {
let that = this; let that = this;
let query2 = {}; let query2 = {};
query2.page = 0; query2.page = 0;
query2.year_s = that.year; query2.year_s = year;
query2.type = "month_s"; query2.type = "month_s";
query2.mgroup = that.query.mgroup; query2.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query2).then((response) => { this.$API.enm.enstat.req(query2).then((response) => {
@ -865,7 +918,7 @@ export default {
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
options.series[4].data = seriesData4; options.series[4].data = seriesData4;
let monthXAxis = []; let monthXAxis = [];
for (let i = 1; i <= that.month; i++) { for (let i = 1; i < 13; i++) {
let item = i + "月"; let item = i + "月";
monthXAxis.push(item); monthXAxis.push(item);
} }
@ -906,5 +959,6 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-top: 10px; padding-top: 10px;
position: relative;
} }
</style> </style>

View File

@ -93,13 +93,45 @@
</tbody> </tbody>
</table> </table>
<div class="radioWrap"> <div class="radioWrap">
<el-radio-group v-model="typeRadio"> <el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
>
<el-radio-button label="day">本日</el-radio-button> <el-radio-button label="day">本日</el-radio-button>
<el-radio-button label="month" <el-radio-button label="month"
>本月</el-radio-button >本月</el-radio-button
> >
<el-radio-button label="year">本年</el-radio-button> <el-radio-button label="year">本年</el-radio-button>
</el-radio-group> </el-radio-group>
<div style="position: absolute; right: 20px">
<el-date-picker
v-model="searchDate"
type="date"
value-format="YYYY-MM-DD"
formatter="YYYY-MM-DD"
placeholder="选择日期"
v-if="typeRadio == 'day'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-model="searchDate"
type="month"
value-format="YYYY-MM"
formatter="YYYY-MM"
placeholder="选择月"
v-if="typeRadio == 'month'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-if="typeRadio == 'year'"
v-model="searchDate"
type="year"
value-format="YYYY"
formatter="YYYY"
placeholder="选择年"
@change="dateChange"
></el-date-picker>
</div>
</div> </div>
<div class="chartWrap" v-show="typeRadio == 'day'"> <div class="chartWrap" v-show="typeRadio == 'day'">
<div class="chartTitle">小时生产参数统计图</div> <div class="chartTitle">小时生产参数统计图</div>
@ -350,6 +382,7 @@ export default {
}, },
data() { data() {
return { return {
searchDate: "",
typeRadio: "day", typeRadio: "day",
exportLoading: false, exportLoading: false,
chartShow: false, chartShow: false,
@ -791,20 +824,38 @@ export default {
} }
}); });
}); });
that.getHourData(); that.getHourData(that.year, that.month, that.days);
that.getDayData(); that.getDayData(that.year, that.month);
that.getMonthData(); that.getMonthData(that.year);
}); });
}, },
methods: { methods: {
typeRadioChange() {
this.searchDate = "";
},
dateChange(val) {
console.log(val);
if (this.typeRadio == "day") {
let year = val.split("-")[0];
let month = val.split("-")[1];
let days = val.split("-")[2];
this.getHourData(year, month, days);
} else if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
this.getDayData(year, month);
} else {
this.getMonthData(val);
}
},
// //
getHourData() { getHourData(year, month, days) {
let that = this; let that = this;
let query = {}; let query = {};
query.page = 0; query.page = 0;
query.year_s = that.year; query.year_s = year;
query.month_s = that.month; query.month_s = month;
query.day_s = that.days; query.day_s = days;
query.type = "hour_s"; query.type = "hour_s";
query.mgroup = that.query.mgroup; query.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query).then((response) => { this.$API.enm.enstat.req(query).then((response) => {
@ -829,7 +880,7 @@ export default {
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
options.series[4].data = seriesData4; options.series[4].data = seriesData4;
let hourXAxis = []; let hourXAxis = [];
for (let i = 1; i <= that.hours; i++) { for (let i = 0; i < 24; i++) {
let item = i + "时"; let item = i + "时";
hourXAxis.push(item); hourXAxis.push(item);
} }
@ -838,12 +889,12 @@ export default {
}); });
}, },
// //
getDayData() { getDayData(year, month) {
let that = this; let that = this;
let query1 = {}; let query1 = {};
query1.page = 0; query1.page = 0;
query1.year_s = that.year; query1.year_s = year;
query1.month_s = that.month; query1.month_s = month;
query1.type = "day_s"; query1.type = "day_s";
query1.mgroup = this.query.mgroup; query1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(query1).then((response) => { this.$API.enm.enstat.req(query1).then((response) => {
@ -868,7 +919,8 @@ export default {
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
options.series[4].data = seriesData4; options.series[4].data = seriesData4;
let dayXAxis = []; let dayXAxis = [];
for (let i = 1; i <= that.days; i++) { let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日"; let item = i + "日";
dayXAxis.push(item); dayXAxis.push(item);
} }
@ -877,11 +929,11 @@ export default {
}); });
}, },
// //
getMonthData() { getMonthData(year) {
let that = this; let that = this;
let query2 = {}; let query2 = {};
query2.page = 0; query2.page = 0;
query2.year_s = that.year; query2.year_s = year;
query2.type = "month_s"; query2.type = "month_s";
query2.mgroup = that.query.mgroup; query2.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query2).then((response) => { this.$API.enm.enstat.req(query2).then((response) => {
@ -906,7 +958,7 @@ export default {
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
options.series[4].data = seriesData4; options.series[4].data = seriesData4;
let monthXAxis = []; let monthXAxis = [];
for (let i = 1; i <= that.month; i++) { for (let i = 1; i < 13; i++) {
let item = i + "月"; let item = i + "月";
monthXAxis.push(item); monthXAxis.push(item);
} }
@ -947,5 +999,6 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-top: 10px; padding-top: 10px;
position: relative;
} }
</style> </style>

View File

@ -85,12 +85,35 @@
</tbody> </tbody>
</table> </table>
<div class="radioWrap"> <div class="radioWrap">
<el-radio-group v-model="typeRadio"> <el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
>
<el-radio-button label="month" <el-radio-button label="month"
>本月</el-radio-button >本月</el-radio-button
> >
<el-radio-button label="year">本年</el-radio-button> <el-radio-button label="year">本年</el-radio-button>
</el-radio-group> </el-radio-group>
<div style="position: absolute; right: 20px">
<el-date-picker
v-model="searchDate"
type="month"
value-format="YYYY-MM"
formatter="YYYY-MM"
placeholder="选择月"
v-if="typeRadio == 'month'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-if="typeRadio == 'year'"
v-model="searchDate"
type="year"
value-format="YYYY"
formatter="YYYY"
placeholder="选择年"
@change="dateChange"
></el-date-picker>
</div>
</div> </div>
<div class="chartWrap" v-show="typeRadio == 'month'"> <div class="chartWrap" v-show="typeRadio == 'month'">
@ -324,6 +347,7 @@ export default {
["产量", "总产量t", 0, 0, 0, 0, 0, 0, 0, 0], ["产量", "总产量t", 0, 0, 0, 0, 0, 0, 0, 0],
["能耗", "单位产品分布电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0], ["能耗", "单位产品分布电耗KW·h/t", 0, 0, 0, 0, 0, 0, 0, 0],
], ],
searchDate: "",
tableName: "生产报告", tableName: "生产报告",
modelValue: true, modelValue: true,
type: "hours", type: "hours",
@ -615,19 +639,32 @@ export default {
}); });
}); });
// that.getHourData(); // that.getHourData();
that.getDayData(); that.getDayData(that.year, that.month);
that.getMonthData(); that.getMonthData(that.year);
}); });
}); });
}, },
methods: { methods: {
typeRadioChange() {
this.searchDate = "";
},
dateChange(val) {
console.log(val);
if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
this.getDayData(year, month);
} else {
this.getMonthData(val);
}
},
// //
getDayData() { getDayData(year, month) {
let that = this; let that = this;
let query1 = {}; let query1 = {};
query1.page = 0; query1.page = 0;
query1.year_s = that.year; query1.year_s = year;
query1.month_s = that.month; query1.month_s = month;
query1.type = "day_s"; query1.type = "day_s";
query1.mgroup = this.query.mgroup; query1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(query1).then((response) => { this.$API.enm.enstat.req(query1).then((response) => {
@ -644,7 +681,8 @@ export default {
options.series[0].data = seriesData0; options.series[0].data = seriesData0;
options.series[1].data = seriesData1; options.series[1].data = seriesData1;
let dayXAxis = []; let dayXAxis = [];
for (let i = 1; i <= that.days; i++) { let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日"; let item = i + "日";
dayXAxis.push(item); dayXAxis.push(item);
} }
@ -653,11 +691,11 @@ export default {
}); });
}, },
// //
getMonthData() { getMonthData(year) {
let that = this; let that = this;
let query2 = {}; let query2 = {};
query2.page = 0; query2.page = 0;
query2.year_s = that.year; query2.year_s = year;
query2.type = "month_s"; query2.type = "month_s";
query2.mgroup = that.query.mgroup; query2.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query2).then((response) => { this.$API.enm.enstat.req(query2).then((response) => {
@ -674,7 +712,7 @@ export default {
options.series[0].data = seriesData0; options.series[0].data = seriesData0;
options.series[1].data = seriesData1; options.series[1].data = seriesData1;
let monthXAxis = []; let monthXAxis = [];
for (let i = 1; i <= that.month; i++) { for (let i = 1; i < 13; i++) {
let item = i + "月"; let item = i + "月";
monthXAxis.push(item); monthXAxis.push(item);
} }
@ -716,5 +754,6 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-top: 10px; padding-top: 10px;
position: relative;
} }
</style> </style>

View File

@ -71,8 +71,11 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="radioWrap" @change="typeRadioChange"> <div class="radioWrap">
<el-radio-group v-model="typeRadio"> <el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
>
<el-radio-button label="day">本日</el-radio-button> <el-radio-button label="day">本日</el-radio-button>
<el-radio-button label="month" <el-radio-button label="month"
>本月</el-radio-button >本月</el-radio-button
@ -366,7 +369,6 @@ export default {
} else { } else {
this.getMonthData(val); this.getMonthData(val);
} }
this.searchDate;
}, },
getTableHourData() { getTableHourData() {
let that = this; let that = this;

View File

@ -86,13 +86,45 @@
</tbody> </tbody>
</table> </table>
<div class="radioWrap"> <div class="radioWrap">
<el-radio-group v-model="typeRadio"> <el-radio-group
v-model="typeRadio"
@change="typeRadioChange"
>
<el-radio-button label="day">本日</el-radio-button> <el-radio-button label="day">本日</el-radio-button>
<el-radio-button label="month" <el-radio-button label="month"
>本月</el-radio-button >本月</el-radio-button
> >
<el-radio-button label="year">本年</el-radio-button> <el-radio-button label="year">本年</el-radio-button>
</el-radio-group> </el-radio-group>
<div style="position: absolute; right: 20px">
<el-date-picker
v-model="searchDate"
type="date"
value-format="YYYY-MM-DD"
formatter="YYYY-MM-DD"
placeholder="选择日期"
v-if="typeRadio == 'day'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-model="searchDate"
type="month"
value-format="YYYY-MM"
formatter="YYYY-MM"
placeholder="选择月"
v-if="typeRadio == 'month'"
@change="dateChange"
></el-date-picker>
<el-date-picker
v-if="typeRadio == 'year'"
v-model="searchDate"
type="year"
value-format="YYYY"
formatter="YYYY"
placeholder="选择年"
@change="dateChange"
></el-date-picker>
</div>
</div> </div>
<div class="chartWrap" v-show="typeRadio == 'day'"> <div class="chartWrap" v-show="typeRadio == 'day'">
<div class="chartTitle">小时生产参数统计图</div> <div class="chartTitle">小时生产参数统计图</div>
@ -346,6 +378,7 @@ export default {
}, },
data() { data() {
return { return {
searchDate: "",
typeRadio: "day", typeRadio: "day",
exportLoading: false, exportLoading: false,
chartShow: false, chartShow: false,
@ -732,21 +765,39 @@ export default {
} }
}); });
}); });
that.getHourData(); that.getHourData(that.year, that.month, that.days);
that.getDayData(); that.getDayData(that.year, that.month);
that.getMonthData(); that.getMonthData(that.year);
}); });
}); });
}, },
methods: { methods: {
typeRadioChange() {
this.searchDate = "";
},
dateChange(val) {
console.log(val);
if (this.typeRadio == "day") {
let year = val.split("-")[0];
let month = val.split("-")[1];
let days = val.split("-")[2];
this.getHourData(year, month, days);
} else if (this.typeRadio == "month") {
let year = val.split("-")[0];
let month = val.split("-")[1];
this.getDayData(year, month);
} else {
this.getMonthData(val);
}
},
// //
getHourData() { getHourData(year, month, days) {
let that = this; let that = this;
let query = {}; let query = {};
query.page = 0; query.page = 0;
query.year_s = that.year; query.year_s = year;
query.month_s = that.month; query.month_s = month;
query.day_s = that.days; query.day_s = days;
query.type = "hour_s"; query.type = "hour_s";
query.mgroup = that.query.mgroup; query.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query).then((response) => { this.$API.enm.enstat.req(query).then((response) => {
@ -768,7 +819,7 @@ export default {
options.series[2].data = seriesData2; options.series[2].data = seriesData2;
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
let hourXAxis = []; let hourXAxis = [];
for (let i = 1; i <= that.hours; i++) { for (let i = 0; i < 24; i++) {
let item = i + "时"; let item = i + "时";
hourXAxis.push(item); hourXAxis.push(item);
} }
@ -777,12 +828,12 @@ export default {
}); });
}, },
// //
getDayData() { getDayData(year, month) {
let that = this; let that = this;
let query1 = {}; let query1 = {};
query1.page = 0; query1.page = 0;
query1.year_s = that.year; query1.year_s = year;
query1.month_s = that.month; query1.month_s = month;
query1.type = "day_s"; query1.type = "day_s";
query1.mgroup = this.query.mgroup; query1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(query1).then((response) => { this.$API.enm.enstat.req(query1).then((response) => {
@ -804,7 +855,8 @@ export default {
options.series[2].data = seriesData2; options.series[2].data = seriesData2;
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
let dayXAxis = []; let dayXAxis = [];
for (let i = 1; i <= that.days; i++) { let dayss = new Date(year, month, 0).getDate();
for (let i = 1; i <= dayss; i++) {
let item = i + "日"; let item = i + "日";
dayXAxis.push(item); dayXAxis.push(item);
} }
@ -813,11 +865,11 @@ export default {
}); });
}, },
// //
getMonthData() { getMonthData(year) {
let that = this; let that = this;
let query2 = {}; let query2 = {};
query2.page = 0; query2.page = 0;
query2.year_s = that.year; query2.year_s = year;
query2.type = "month_s"; query2.type = "month_s";
query2.mgroup = that.query.mgroup; query2.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query2).then((response) => { this.$API.enm.enstat.req(query2).then((response) => {
@ -839,7 +891,7 @@ export default {
options.series[2].data = seriesData2; options.series[2].data = seriesData2;
options.series[3].data = seriesData3; options.series[3].data = seriesData3;
let monthXAxis = []; let monthXAxis = [];
for (let i = 1; i <= that.month; i++) { for (let i = 1; i < 13; i++) {
let item = i + "月"; let item = i + "月";
monthXAxis.push(item); monthXAxis.push(item);
} }
@ -881,5 +933,6 @@ export default {
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-top: 10px; padding-top: 10px;
position: relative;
} }
</style> </style>