成型机产量报表
parent
46eff879a8
commit
d6f45a63f6
@ -0,0 +1,264 @@
|
|||||||
|
<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="工单时间" prop="productDateArray">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.productDateArray"
|
||||||
|
format="yyyy-MM-dd"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="班次" prop="shiftId">
|
||||||
|
<el-select v-model="queryParams.shiftId" placeholder="请选择班次" clearable>
|
||||||
|
<el-option v-for="item in shiftList" :key="item.shiftId" :label="item.shiftDesc"
|
||||||
|
:value="item.shiftId"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="成型机名称" prop="equName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.equName"
|
||||||
|
placeholder="请输入成型机名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</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"
|
||||||
|
>导出</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
height="500"
|
||||||
|
:data="machineProList"
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
show-summary
|
||||||
|
|
||||||
|
>
|
||||||
|
<el-table-column label="日期" align="center" prop="ymd" min-width="100"/>
|
||||||
|
<template v-for="(column, index) in products">
|
||||||
|
<el-table-column align="center" min-width="100" :prop="column.code" :key="column.code" :label="column.label"/>
|
||||||
|
</template>
|
||||||
|
<el-table-column label="总产量" align="center" prop="totalQuantity"
|
||||||
|
min-width="100"
|
||||||
|
/>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {getCXJProductionList,getCXJProductionTitle} from "@/api/mes/reportWorks";
|
||||||
|
import {getProShifts} from "@/api/mes/reportWork";
|
||||||
|
import moment from "moment";
|
||||||
|
export default {
|
||||||
|
name: "CxjProduction",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 表格数据
|
||||||
|
machineProList: [],
|
||||||
|
//产品列表
|
||||||
|
products: [],
|
||||||
|
shiftList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
productDateArray: [],
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
workorderCode: null,
|
||||||
|
workorderName: null,
|
||||||
|
parentOrder: null,
|
||||||
|
orderId: null,
|
||||||
|
shiftId: null,
|
||||||
|
orderCode: null,
|
||||||
|
productId: null,
|
||||||
|
productCode: null,
|
||||||
|
prodType: null,
|
||||||
|
productName: null,
|
||||||
|
productSpc: null,
|
||||||
|
productDate: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getDate();
|
||||||
|
this.getList();
|
||||||
|
// 获取班次信息
|
||||||
|
getProShifts().then(response => {
|
||||||
|
this.shiftList = response.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/**获取默认查询时间段**/
|
||||||
|
getDate() {
|
||||||
|
let start = this.Fungetdate (0)
|
||||||
|
let end = this.Fungetdate (1)
|
||||||
|
this.queryParams.productDateArray.push(start,end)
|
||||||
|
},
|
||||||
|
Fungetdate (num) {
|
||||||
|
var dd = new Date();
|
||||||
|
dd.setDate(dd.getDate() + num);
|
||||||
|
var y = dd.getFullYear();
|
||||||
|
var m = dd.getMonth() + 1;//获取当前月份的日期
|
||||||
|
var d = dd.getDate();
|
||||||
|
return y + "-" + m + "-" + d;
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 查询设备小时产量列表 */
|
||||||
|
getList() {
|
||||||
|
if (this.queryParams.productDateArray != null) {
|
||||||
|
this.queryParams.ymArrayStart = moment(this.queryParams.productDateArray[0]).format('YYYY-MM-DD');
|
||||||
|
this.queryParams.ymArrayEnd = moment(this.queryParams.productDateArray[1]).format('YYYY-MM-DD');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading = true;
|
||||||
|
//获取Table表头
|
||||||
|
getCXJProductionTitle(this.queryParams).then((response) => {
|
||||||
|
this.products = [];
|
||||||
|
this.products = response;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//获取Table数据
|
||||||
|
getCXJProductionList(this.queryParams).then((response) => {
|
||||||
|
this.machineProList = response;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
productId: null,
|
||||||
|
productCode: null,
|
||||||
|
prodType: null,
|
||||||
|
productName: null,
|
||||||
|
productSpc: null,
|
||||||
|
wetDetailPlanId: null,
|
||||||
|
productDate: null,
|
||||||
|
shiftId: null,
|
||||||
|
ancestors: null,
|
||||||
|
status: null,
|
||||||
|
remark: null,
|
||||||
|
attr1: null,
|
||||||
|
attr2: null,
|
||||||
|
attr3: null,
|
||||||
|
attr4: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
factoryCode: null,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download(
|
||||||
|
"mes/reportWorks/getCXJProductionExport",
|
||||||
|
{
|
||||||
|
...this.queryParams,
|
||||||
|
},
|
||||||
|
`HFProduction_${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 (sums[index] > 1000000) {
|
||||||
|
sums[index] = "";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sums[index] = ""; //N/A
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue