月度报表、效率单位修改

yangwl
Yangwl 5 months ago
parent 994c31a4e1
commit 44911071dc

@ -306,7 +306,7 @@ export function getPrepareList(query) {
// 获取线体每月生产过程不良率 // 获取线体每月生产过程不良率
export function getLineQcData() { export function getLineQcData() {
return request({ return requestnpm({
url: '/quality/qcInterface/getLineQcData', url: '/quality/qcInterface/getLineQcData',
method: 'get' method: 'get'
}); });
@ -372,3 +372,13 @@ export function preReportRow(reportCode) {
data: data data: data
}); });
} }
//月度汇总表
export function getmonthProductionSut(query) {
return request({
url: '/mes/reportWork/getmonthProductionSut',
method: 'get',
params: query
});
}

@ -303,10 +303,10 @@
<div class="Totalnumber Totalnumber1"> <div class="Totalnumber Totalnumber1">
<div class="number1">标准效率</div> <div class="number1">标准效率</div>
<div v-if="taskSampleNum" class="number2"> <div v-if="taskSampleNum" class="number2">
{{ workOrder.standarXl }}<span style="font-size: 18px; color: #6c8097;">{{ workOrder.unit }}</span> {{ workOrder.standarXl }}<span style="font-size: 18px; color: #6c8097;">{{ workOrder.unit }}·小时</span>
</div> </div>
</div> </div>
</div> </div>
<div class="Totalnumberbox"> <div class="Totalnumberbox">
<div class="Totalnumber"> <div class="Totalnumber">
@ -316,10 +316,10 @@
<div class="Totalnumber Totalnumber1"> <div class="Totalnumber Totalnumber1">
<div class="number1">实际效率</div> <div class="number1">实际效率</div>
<div v-if="taskSampleNum" class="number2"> <div v-if="taskSampleNum" class="number2">
{{ workOrder.actXl }}<span style="font-size: 18px; color: #6c8097;">{{ workOrder.unit }}</span> {{ workOrder.actXl }}<span style="font-size: 18px; color: #6c8097;">{{ workOrder.unit }}·小时</span>
</div> </div>
</div> </div>
</div> </div>
<!-- 实际用人标准效率实际效率 --> <!-- 实际用人标准效率实际效率 -->
<!-- <div class="data-box"> <!-- <div class="data-box">
@ -510,7 +510,7 @@ export default {
factoryCode: "ds_" + _this.selectxt, factoryCode: "ds_" + _this.selectxt,
}).then((response) => { }).then((response) => {
if (response) { if (response) {
_this.workOrder = response.data.workOrder; _this.workOrder = response.data.workOrder;
_this.taskNum = response.data.taskNum; _this.taskNum = response.data.taskNum;
_this.taskSampleNum = response.data.taskSampleNum; _this.taskSampleNum = response.data.taskSampleNum;
if (response.data.piedata.checkList) { if (response.data.piedata.checkList) {

@ -0,0 +1,231 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item size="small" label="生产日期: ">
<el-date-picker
v-model="queryParams.productDateStr"
value-format="yyyy-MM-dd"
type="date"
placeholder="生产日期"
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['mes:prepare:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-loading="loading" :data="tableData"
:header-cell-style="{'text-align':'center','font-size':'18px'}"
:cell-style="{'text-align':'center'}"
style="width: 100%; ">
<el-table-column label="小榄工厂黑蚊香车间生产情况表">
<el-table-column
label="日期"
width="200">
<el-table-column
prop="lineName"
label="产线"
width="200">
</el-table-column>
</el-table-column>
<el-table-column label="2024年6月17日">
<el-table-column
prop="category"
label="类别"
width="200">
</el-table-column>
<el-table-column
prop="useman"
label="员工"
width="200">
</el-table-column>
<el-table-column
prop="production"
label="产量"
width="200">
</el-table-column>
</el-table-column>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { getDailyReport,getWorkcenterList} from "@/api/mes/reportWork";
import moment from 'moment';
export default {
name: "Prepare",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
tableData: [{
lineName: '一号线',
category: '桶装',
useman: '28',
production: '1536件',
}, {
lineName: '二号线',
category: '单盘',
useman: '29',
production: '1536件',
}, {
lineName: '三号线',
category: '3+1',
useman: '30',
production: '1536件',
}],
//
title: "",
//
open: false,
//
queryParams: {
productDate: new Date().toLocaleDateString().replace(/\//g, "-"),
pageNum: 1,
pageSize: 10,
workCenter: null,
factoryCode: null
},
//
form: {},
//
rules: {},
options: null
};
},
created() {
this.getList();
this.getWorkcenterList();
},
methods: {
indexMethod(index){
return index+1 ;
},
/** 查询备料单列表 */
getList() {
if(this.queryParams.productDate == null){
this.$modal.msgSuccess("日期不能为空");
return
}
this.loading = true;
getDailyReport(this.queryParams).then(response => {
// this.prepareList = response.rows;
this.total = response.total;
this.loading = false;
});
},
getWorkcenterList(){
getWorkcenterList().then(data => {
this.options = data;
});
this.queryParams.workCenter = this.options[0].factoryCode;
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
if (this.timeList.length > 0) {
this.queryParams.startTime = moment(this.timeList[0]).format('YYYY-MM-DD')
this.queryParams.endTime = moment(this.timeList[1]).format('YYYY-MM-DD')
}
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/reportWork/getDailyReportExport', {
...this.queryParams
}, `dailyReport${new Date().getTime()}.xlsx`)
},
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '小计';
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
sums[index] += '';
if(index<6){
sums[index] = '';
}
} else {
sums[index] = '';//N/A
}
});
return sums;
}
}
};
</script>

@ -0,0 +1,89 @@
<template>
<div>
<div ref="chart" style="width:90%;height:260px"></div>
</div>
</template>
<script>
export default {
data() {
return{
}
},
mounted() {
this.getGroupLineEquInfo();
this.getEchartData();
},
methods: {
getGroupLineEquInfo(){
//
var monthTemp = ['一月', '二月', '三月', '四月', '五月', '六月', '七月','八月','九月','十月','十一月','十二月']
var groupLineNames=['一号线','二号线']
monthTemp.splice(new Date().getMonth()+1)
const chart = this.$refs.chart
if (chart) {
const myChart = this.$echarts.init(chart)
const option = {
title: {
text: ''
},
tooltip: {
trigger: 'axis'
},
legend: {
data: groupLineNames
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
/**
toolbox: {
feature: {
saveAsImage: {}
}
},**/
xAxis: {
type: 'category',
boundaryGap: false,
data: monthTemp
},
yAxis: {
type: 'value'
},
series: info
}
myChart.setOption(option)
window.addEventListener("resize", function() {
myChart.resize()
})
}
this.$on('hook:destroyed',()=>{
window.removeEventListener("resize", function() {
myChart.resize();
});
});
},
getEchartData() {
},
},
watch: {},
created() {
}
}
</script>

@ -0,0 +1,250 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item label="生产时间">
<el-date-picker
v-model="queryParams.monthValue"
type="month"
value-format="yyyy-MM"
placeholder="选择月">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
</el-form-item>
</el-form>
<!-- <el-row :gutter="10" class="mb8">-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['mes:prepare:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!-- </el-row>-->
<el-table :data="tableData" border style="width: 100%">
<el-table-column
prop="equipment_name"
label="产线"
fixed="left"
width="150">
</el-table-column>
<el-table-column
prop="category"
label="类别"
fixed="left"
width="150">
</el-table-column>
<el-table-column
prop="total_monthly_summary"
label="当月汇总"
fixed="left"
width="150">
</el-table-column>
<el-table-column
v-for="day in days"
:key="day"
:prop="day"
:label="`${day.replace('day', '')}`"
:width="150"
align="center"
:formatter="formatNullToZero">
</el-table-column>
</el-table>
<div id="main" style="width: 100%; height: 820px; background: #fff"></div>
</div>
</template>
<script>
import { getmonthProductionSut} from "@/api/mes/reportWork";
import * as echarts from 'echarts'
export default {
name: "Index",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
//
tableData: [],
days: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
monthValue:''
},
//
form: {},
//
rules: {
monthValue: [
{ required: true, message: '生产时间不能为空', trigger: 'change' }
]
},
charts: "",
legendData:[],
seriesData:[]
};
},
created() {
const currentMonth = new Date().toISOString().substr(0, 7);
this.queryParams.monthValue = currentMonth;
this.getList();
},
methods: {
indexMethod(index) {
return index + 1;
},
/** 查询备料单列表 */
getList() {
this.seriesData=[];
this.legendData=[];
this.loading = true;
getmonthProductionSut(this.queryParams).then(response => {
// this.prepareList = response.rows;
const data = response.data;
// this.total = response.total;
this.loading = false;
if (data.length > 0) {
//
const allKeys = Object.keys(data[0]);
// 使
this.days = allKeys.filter(key => /^\d{4}-\d{2}-\d{2}$/.test(key)).sort();
// 'total_monthly_summary'
data.forEach(row => {
let totalSummary = 0;
const dailyValues = []; //
this.days.forEach(day => {
const value = row[day] || 0;
totalSummary += value;
dailyValues.push(value); // dailyValues
totalSummary += (row[day] || 0);
});
row.total_monthly_summary = totalSummary;
this.legendData.push(row.equipment_name);
this.seriesData.push({
name: row.equipment_name, // 使
type: 'line',
stack: 'Total',
data: dailyValues,
itemStyle: {
color: this.getRandomColor(), //
lineStyle: {
color: this.getRandomColor(),
},
},
});
});
}
this.tableData = data;
// 线
this.drawLine("main");
}).catch(() => {
this.loading = false;
});
},
formatNullToZero(row, column, cellValue) {
return cellValue === null || cellValue === undefined ? 0 : cellValue;
},
getRandomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 导出按钮操作 */
handleExport() {
this.download('mes/reportWork/getDailyReportExport', {
...this.queryParams
}, `dailyReport${new Date().getTime()}.xlsx`)
},
drawLine(id) {
// 线
this.charts = echarts.init(document.getElementById(id));
// 线
this.charts.setOption({
title: {
text: '产量趋势'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: this.legendData
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: this.days
},
yAxis: {
type: 'value',
},
series: this.seriesData
});
},
}
};
</script>
Loading…
Cancel
Save