feat:光子统计分析-任务统计
This commit is contained in:
parent
1793a41dfb
commit
28d4826043
|
@ -0,0 +1,218 @@
|
||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="right-panel">
|
||||||
|
<el-select v-model="mgroupId"
|
||||||
|
placeholder="请选择工段"
|
||||||
|
@change="mgroupChange">
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="searchDate"
|
||||||
|
type="month"
|
||||||
|
placeholder="查询日期"
|
||||||
|
value-format="YYYY-MM"
|
||||||
|
style="width: 160px"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
@click="handleQuery"
|
||||||
|
></el-button>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main id="elMain">
|
||||||
|
<el-row :gutter="10" id="elCol">
|
||||||
|
<el-col :lg="8">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<scEcharts height="500px" :option="option"></scEcharts>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="16">
|
||||||
|
<el-card shadow="never" style="position: relative">
|
||||||
|
<el-button
|
||||||
|
@click="handleExport('7')"
|
||||||
|
class="tables"
|
||||||
|
type="primary"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
<el-table
|
||||||
|
:data="tableData1"
|
||||||
|
id="exportDiv7"
|
||||||
|
:height="tableHeight"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column
|
||||||
|
label="任务编号"
|
||||||
|
prop="number"
|
||||||
|
min-width="100px"
|
||||||
|
>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划数" prop="count">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="完成数" prop="count_ok">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="完成率" prop="rate">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import scEcharts from "@/components/scEcharts";
|
||||||
|
export default {
|
||||||
|
name: "chart",
|
||||||
|
components: {
|
||||||
|
scEcharts,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
query: {
|
||||||
|
querys:[
|
||||||
|
[{field:'start_date',compare:'gte',value:''},{field:'mgroup',compare:'',value:''}],
|
||||||
|
[{field:'end_date',compare:'lte',value:''},{field:'mgroup',compare:'',value:''}]
|
||||||
|
],
|
||||||
|
page:0
|
||||||
|
},
|
||||||
|
mgroupId:'',
|
||||||
|
start_date:'',
|
||||||
|
end_date:'',
|
||||||
|
currentDate: "",
|
||||||
|
searchDate:'',
|
||||||
|
options:[],
|
||||||
|
tableData1: [],
|
||||||
|
option: {
|
||||||
|
title: {
|
||||||
|
text: "",
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: "item",
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
top: "3",
|
||||||
|
right: "3%",
|
||||||
|
},
|
||||||
|
color: ["rgb(64,158,255)", "orange"],
|
||||||
|
series: {
|
||||||
|
name: "7车间完成率",
|
||||||
|
type: "pie",
|
||||||
|
radius: ["40%", "70%"],
|
||||||
|
center: ["50%", "60%"],
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: "outside",
|
||||||
|
formatter: "{b} : {c} ({d}%)",
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{ value: 0, name: "已完成" },
|
||||||
|
{ value: 0, name: "未完成" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
let that = this;
|
||||||
|
let date = new Date();
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
|
month = month < 10 ? "0" + month : month;
|
||||||
|
that.currentDate = that.searchDate = year + "-" + month;
|
||||||
|
let days = new Date(year, month, 0).getDate();
|
||||||
|
let start_date = year + "-" + month + "-01";
|
||||||
|
let end_date = year + "-" + month + "-"+days;
|
||||||
|
that.start_date = that.query.querys[0][0].value = start_date;
|
||||||
|
that.end_date = that.query.querys[1][0].value = end_date;
|
||||||
|
let height = document.getElementById("elCol").clientHeight;
|
||||||
|
let chartheight = height+'px';
|
||||||
|
that.tableHeight = height-20;
|
||||||
|
that.getMgroup();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getMgroup(){
|
||||||
|
let that = this;
|
||||||
|
that.$API.mtm.mgroup.list.req({ page: 0}).then((res) => {
|
||||||
|
that.options = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getData7() {
|
||||||
|
let that = this;
|
||||||
|
that.tableData1 = [];
|
||||||
|
that.option.series.data[0].value = 0;
|
||||||
|
that.option.series.data[1].value = 0;
|
||||||
|
that.$API.pm.mtask.cquery.req(that.query).then((res) => {
|
||||||
|
let data = [];
|
||||||
|
let count_ok1 = 0;
|
||||||
|
let count_notok1 = 0;
|
||||||
|
if (res.length > 0) {
|
||||||
|
res.forEach((item) => {
|
||||||
|
let obj = item;
|
||||||
|
obj.rate = Math.round((item.count_ok / item.count) * 100).toFixed(2) + "%";
|
||||||
|
if (item.count_ok >= item.count) {
|
||||||
|
count_ok1++;
|
||||||
|
} else {
|
||||||
|
count_notok1++;
|
||||||
|
}
|
||||||
|
data.push(obj);
|
||||||
|
});
|
||||||
|
that.tableData1 = data;
|
||||||
|
// that.option.series.data[0].value = count_ok1;
|
||||||
|
}
|
||||||
|
that.option.series.data[0].value = count_ok1;
|
||||||
|
that.option.series.data[1].value = count_notok1;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
mgroupChange(){
|
||||||
|
let that = this;
|
||||||
|
that.query.querys[0][1].value = that.mgroupId;
|
||||||
|
that.query.querys[1][1].value = that.mgroupId;
|
||||||
|
},
|
||||||
|
handleQuery(){
|
||||||
|
let that = this;
|
||||||
|
if(this.searchDate!==''&&this.searchDate!==null){
|
||||||
|
let dates = this.searchDate.split('-');
|
||||||
|
let year = dates[0];
|
||||||
|
let month = dates[1];
|
||||||
|
let days = new Date(year, month, 0).getDate();
|
||||||
|
let start_date = year + "-" + month + "-01";
|
||||||
|
let end_date = year + "-" + month + "-"+days;
|
||||||
|
that.query.querys[0][0].value = start_date;
|
||||||
|
that.query.querys[1][0].value = end_date;
|
||||||
|
}else{
|
||||||
|
that.query.querys[0][0].value = that.start_date;
|
||||||
|
that.query.querys[1][0].value = that.end_date;
|
||||||
|
}
|
||||||
|
that.getData7();
|
||||||
|
},
|
||||||
|
handleExport(val) {
|
||||||
|
this.exportLoading = true;
|
||||||
|
let id = "#exportDiv" + val;
|
||||||
|
let name = val + "车间完成率";
|
||||||
|
this.$XLSX(id, name);
|
||||||
|
this.exportLoading = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
#elCol{
|
||||||
|
height:100%;
|
||||||
|
}
|
||||||
|
.tables {
|
||||||
|
position: absolute;
|
||||||
|
top: 6px;
|
||||||
|
left: 4px;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue