You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
5.0 KiB
Vue

<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="yearMonthDate">
<el-date-picker
v-model="queryParams.yearMonthDate"
type="month"
placeholder="选择月">
</el-date-picker>
</el-form-item>
<el-form-item label="白坯名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
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
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
<span style="color:firebrick;font-size: small; text-align: center;padding-left:30px">说明:空白处表示当日未生产。</span>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="hourProList" border>
<el-table-column label="序号" type="index" align="center" :index="indexMethod" fixed/>
<el-table-column label="不良项目" align="center" prop="dataType" min-width="100" fixed/>
<template v-for="(column, index) in showTitles">
<el-table-column align="center" min-width="120" :prop="column.id" :key="column.id" :label="column.titleName"/>
</template>
<el-table-column label="累计" align="center" prop="rowSum" min-width="100"/>
</el-table>
</div>
</template>
<script>
import {getMonthOfDateTitle, getMonthOfDataDefect} from "@/api/quality/qcTable";
import moment from 'moment';
export default {
name: "BpReworkRate",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 备料单表格数据
hourProList: [],
activeName: 'first',
showTitles:[],//列表展示的小时段
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
yearMonthDate:null,
yearMonth:null,
productDateArray: [],
pageNum: 1,
pageSize: 10,
workorderCode: null,
workorderName: null,
parentOrder: null,
orderId: null,
orderCode: null,
productId: null,
productCode: null,
prodType: null,
productName: null,
productSpc: null,
productDate: null,
equTypeCode: "equ_type_hf"
},
// 表单参数
form: {},
// 班次list
workShift: [],
equipmentTypeOption:[
],
spanArr: [],
position: 0
};
},
created() {
this.getDate();
this.getList();
},
methods: {
/**获取默认查询时间段**/
getDate() {
let start = this.Fungetdate (0);
this.queryParams.yearMonthDate = start;
},
Fungetdate (num) {
var dd = new Date();
dd.setDate(dd.getDate() + num);
var y = dd.getFullYear();
var m = dd.getMonth() + 1;//获取当前月份的日期
return y + "-" + m ;
},
/** 查询设备小时产量列表 */
getList() {
if(this.queryParams.yearMonthDate!=null){
this.queryParams.yearMonth = moment(this.queryParams.yearMonthDate).format('YYYY-MM');
}else{
this.$message.error("请填写月份");
return
}
this.loading = true;
//获取Table表头
getMonthOfDateTitle(this.queryParams).then(response => {
this.showTitles = [];
for(let i=0;i<=response.length-1;i++){
var pobj={};
pobj.id="monthNum"+i;
pobj.titleName = response[i];
this.showTitles.push(pobj)
}
});
//获取Table数据
getMonthOfDataDefect(this.queryParams).then(response => {
this.hourProList = response;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
prepareId: null,
workorderCode: null,
workorderName: null,
parentOrder: null,
orderId: null,
orderCode: null,
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.spanArr = [];
this.position = 0;
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 导出按钮操作 */
handleExport() {
this.download('quality/staticTable/getMonthOfDataDefectExport', {
...this.queryParams
}, `bpDefect_${new Date().getTime()}.xlsx`)
},
// 生成表头序号
indexMethod(index) {
return index + 1;
},
}
};
</script>