Commit ba52b62c authored by 沈翠玲's avatar 沈翠玲

报表管理

parent c60eed6b
import request from '@/utils/request'
// :明细界面
export function getList(query) {
return request({
url: "/report/pro/ipqc/getList",
method: "post",
data: query,
});
}
// :统计方式工序
export function getUnquanlify(query) {
return request({
url: '/report/pro/ipqc/getUnquanlify',
method: "post",
data: query
});
}
// :统计方式用户
export function getFrist(query) {
return request({
url: '/report/pro/ipqc/getFrist',
method: "post",
data: query
});
}
// :统计方式车间
export function getLossRanking(query) {
return request({
url: '/report/pro/delayWorkingHours/getLossRanking',
method: "post",
data: query
});
}
// :统计方式主要异常原因分析
export function getReasonRanking(query) {
return request({
url: '/report/pro/delayWorkingHours/getReasonRanking',
method: "post",
data: query
});
}
// :统计方式工作中心
export function getListByWorkstation(query) {
return request({
url: '/report/pro/feedback/getListByWorkstation',
method: "post",
data: query
});
}
// :统计方式工作单元
export function getListByWorkunit(query) {
return request({
url: '/report/pro/feedback/getListByWorkunit',
method: "post",
data: query
});
}
// :统计方式不合格原因
export function getListByDefect(query) {
return request({
url: '/report/pro/feedback/getListByDefect',
method: "post",
data: query
});
}
\ No newline at end of file
import request from '@/utils/request'
// :明细界面
export function getList(query) {
return request({
url: "/report/pro/iqc/getList",
method: "post",
data: query,
});
}
// :统计方式工序
export function getUnquanlify(query) {
return request({
url: '/report/pro/iqc/getUnquanlify',
method: "post",
data: query
});
}
// :统计方式用户
export function getVendor(query) {
return request({
url: '/report/pro/iqc/getVendor',
method: "post",
data: query
});
}
// :统计方式用户
export function getUnqualifyType(query) {
return request({
url: '/report/pro/iqc/getUnqualifyType',
method: "post",
data: query
});
}
import request from '@/utils/request'
// :明细界面
export function getList(query) {
return request({
url: "/report/pro/materialUse/getList",
method: "post",
data: query,
});
}
// :统计方式工序
export function getListByProcess(query) {
return request({
url: '/report/pro/feedback/getListByProcess',
method: "post",
data: query
});
}
// :统计方式用户
export function getInputOutputRatioList(query) {
return request({
url: '/report/pro/materialUse/getInputOutputRatioList',
method: "post",
data: query
});
}
// :统计方式车间
export function getBackList(query) {
return request({
url: '/report/pro/materialUse/getBackList',
method: "post",
data: query
});
}
// :统计方式主要异常原因分析
export function getComplementList(query) {
return request({
url: '/report/pro/materialUse/getComplementList',
method: "post",
data: query
});
}
// :统计方式工作中心
export function getListByWorkstation(query) {
return request({
url: '/report/pro/feedback/getListByWorkstation',
method: "post",
data: query
});
}
// :统计方式工作单元
export function getListByWorkunit(query) {
return request({
url: '/report/pro/feedback/getListByWorkunit',
method: "post",
data: query
});
}
// :统计方式不合格原因
export function getListByDefect(query) {
return request({
url: '/report/pro/feedback/getListByDefect',
method: "post",
data: query
});
}
\ No newline at end of file
import request from '@/utils/request'
// :明细界面
export function getList(query) {
return request({
url: "/report/pro/delayWorkingHours/getList",
method: "post",
data: query,
});
}
// :统计方式工序
export function getListByProcess(query) {
return request({
url: '/report/pro/feedback/getListByProcess',
method: "post",
data: query
});
}
// :统计方式用户
export function getResponsibilityRanking(query) {
return request({
url: '/report/pro/delayWorkingHours/getResponsibilityRanking',
method: "post",
data: query
});
}
// :统计方式车间
export function getLossRanking(query) {
return request({
url: '/report/pro/delayWorkingHours/getLossRanking',
method: "post",
data: query
});
}
// :统计方式主要异常原因分析
export function getReasonRanking(query) {
return request({
url: '/report/pro/delayWorkingHours/getReasonRanking',
method: "post",
data: query
});
}
// :统计方式工作中心
export function getListByWorkstation(query) {
return request({
url: '/report/pro/feedback/getListByWorkstation',
method: "post",
data: query
});
}
// :统计方式工作单元
export function getListByWorkunit(query) {
return request({
url: '/report/pro/feedback/getListByWorkunit',
method: "post",
data: query
});
}
// :统计方式不合格原因
export function getListByDefect(query) {
return request({
url: '/report/pro/feedback/getListByDefect',
method: "post",
data: query
});
}
\ No newline at end of file
<template>
<div class="app-container">
<el-form :model="queryParams" @submit.native.prevent ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item :label="'编排单号'" prop="arrangeCode">
<el-input
v-model="queryParams.arrangeCode"
placeholder="请输入编排单号"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'工序名称'" prop="arrangeCode">
<el-select v-model="queryParams.processName" filterable placeholder="请选择工序">
<el-option
v-for="item in processOptions"
:key="item.processId"
:label="item.processName"
:value="item.processName"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="产品分类" prop="itemTypeO">
<treeselect style="width: 220px;" v-model="queryParams.itemTypeO" :options="itemTypeOptions" :show-count="true" placeholder="请选择所属分类" value-format="label"/>
</el-form-item>
<el-form-item :label="'产品编码'" prop="productCode">
<el-input
v-model="queryParams.productCode"
placeholder="请输入产品编码"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item label="检验类型" prop="ipqcType">
<el-select v-model="queryParams.ipqcType" placeholder="请选择检验类型" clearable>
<el-option v-for="dict in dict.type.mes_ipqc_type_pc" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="车间" prop="workshopName">
<el-select filterable v-model="queryParams.workshopName" placeholder="请选择车间" clearable>
<el-option
v-for="dict in workshopList"
:key="dict.workshopId"
:label="dict.workshopName"
:value="dict.workshopName"
/>
</el-select>
</el-form-item>
<el-form-item label="工作中心" prop="workstationName">
<el-select filterable v-model="queryParams.workstationName" placeholder="请选择工作中心" clearable>
<el-option
v-for="dict in workstationList"
:key="dict.workstationId"
:label="dict.workstationName"
:value="dict.workstationName"
/>
</el-select>
</el-form-item>
<el-form-item label="工作单元" prop="workunitName">
<el-select filterable v-model="queryParams.workunitName" placeholder="请选择工作单元" clearable>
<el-option
v-for="dict in workunitList"
:key="dict.workunitId"
:label="dict.workunitName"
:value="dict.workunitName"
/>
</el-select>
</el-form-item>
<el-form-item :label="'创建时间'">
<el-date-picker v-model="daterangePurchaseDate" value-format="yyyy-MM-dd" type="daterange" range-separator="-"
:start-placeholder="'开始日期'" :end-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-tabs type="border-card" @tab-click="tabClick">
<el-tab-pane :label="'明细'">
<!-- <el-row style="margin-bottom: 10px;">
<el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button>
</el-row> -->
<el-table v-loading="loading" :max-height="tableHeight" :data="tbodys" >
<el-table-column :label="item.label" align="center" :prop="item.value" :width="item.width" v-for="(item, index) in theaders" :key="index">
<!-- <template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType" v-if="item.value==='workorderType'" />
<div v-else>{{ item.value === 'machineTime' ? scope.row[item.value] ? Number(scope.row[item.value]).toFixed(2) : scope.row[item.value] : scope.row[item.value] }}</div>
</template> -->
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
<el-tab-pane :label="'统计'">
<el-row align="center" style="line-height: 40px;">
<el-col :span="7">{{'统计方式'}}
<el-select v-model="statisisType" clearable :placeholder="'请选择统计方式'">
<el-option v-for="item in statisisList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="7">{{'统计颗粒度'}}
<el-select v-model="groupKey" clearable :placeholder="'请选择统计颗粒度'">
<el-option v-for="item in groupbyList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="3">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" style="margin-left: 10px;">{{'查询'}}</el-button>
<el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :max-height="tableHeight" :data="tbodys1" @sort-change="handleSortChange">
<el-table-column :label="item.label" align="center" :prop="item.value" v-for="(item, index) in theaders1" :key="index" :sortable="item.sort? 'custom':false">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_ipqc_type_pc" :value="scope.row.ipqcType" v-if="item.value==='ipqcType'" />
<dict-tag :options="dict.type.mes_qc_result" :value="scope.row.checkResult" v-if="item.value==='checkResult'" />
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status" v-if="item.value==='status'" />
<div v-else>{{ scope.row[item.value] }}</div>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { listWorkunit } from "@/api/mes/md/workunit";
import { getList, getUnquanlify, getFrist } from "@/api/mes/proTable/ipqcAnaly";
import {listAllProcess} from "@/api/mes/pro/process";
import { treeselect } from "@/api/mes/md/itemtype";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {
getworkshopList} from '@/api/mes/pro/scheduleList'
import {
listWorkstation
} from "@/api/mes/md/workstation";
export default {
name: "ScheduleSetupRule",
components: {Treeselect},
dicts: [
"mes_ipqc_type_pc",
"mes_qc_result",
"mes_order_status"
],
data() {
return {
// 遮罩层
loading: true,
selectedRows: [],
workshopList: [],
workstationList: [],
workunitList: [],
tabIndex: 0,
// 选中数组
ids: [],
//dta列表
dtaOptions: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 排产换型对照信息表格数据
tbodys: [],
theaders: [],
tbodys1: [],
theaders1: [],
processOptions: [],
itemTypeOptions: undefined,
// 弹出层标题
title: "",
statisisType: null,
groupKey: null,
groupbyList: ['工作单元', '工作中心', '车间', '工厂'],
statisisList: ['首检一次不通过率', '不良问题类型统计'],
// 是否显示弹出层
open: false,
tableHeight: 0,
daterangePurchaseDate: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
"deptName": null,
"endDate": null,
"orderCode": null,
"processName": null,
"processCode": null,
"processId": null,
"productCode": null,
"productId": null,
"productName": null,
"startDate": null,
"taskCode": null,
"claimant": null,
ipqcType: null,
arrangeCode: null,
itemTypeName: null,
itemTypeO: null,
"workorderCode": null,
"workorderType": null,
"workshopId": null,
"workshopName": null,
"workstationId": null,
"workstationName": null,
"workunitId": null,
factoryCode: null,
factoryName: null,
"workunitName": null
},
// 表单参数
form: {},
};
},
mounted(){
this.$nextTick(()=>{
this._resizeHandler()
})
this._resizeHandler = () => {
const arr = document.getElementsByClassName('el-form')
const height = arr[0].offsetHeight
const arr1 = document.getElementsByClassName('app-main')
const height1 = arr1[0].offsetHeight
this.tableHeight = height1 - height - (this.tabIndex ? 200 : 170)
}
window.addEventListener('resize', this._resizeHandler)
},
beforeDestroy() {
window.removeEventListener('resize', this._resizeHandler)
},
created() {
this.getProcess()
this.hanldeGetworkshopList()
this.getTreeselect()
this.getList();
},
watch: {
tabIndex: {
handler(val){
if(Number(val) === 0) {
this.theaders = [
{label: '检验单编号', value: 'ipqcCode', width: '140px'},
{label: '检验类型', value: 'ipqcType'},
{label: '编排单号', value: 'arrangeCode', width: '120px'},
{label: '产品编码', value: 'productCode', width: '240px'},
{label: '产品名称', value: 'productName', width: '120px'},
{label: '工序编码', value: 'processCode'},
{label: '工序名称', value: 'processName'},
{label: '单位', value: 'unit', width: '140px'},
{label: '检测数量', value: 'quantity', width: '140px'},
{label: '检测结果', value: 'checkResult', width: '140px'},
{label: '检测日期', value: 'checkDate', width: '140px'},
{label: '检测人员', value: 'checkBy', width: '140px'},
{label: '确认人', value: 'inspectBy', width: '140px'},
{label: '单据状态', value: 'status', width: '140px'}
]
this.handleQuery()
}
},
immediate: true
},
'queryParams.itemTypeO' : {
handler(val){
this.queryParams.itemTypeName = val.label
}
}
},
methods: {
getTreeselect() {
treeselect().then(response => {
this.itemTypeOptions = response.data;
});
listWorkstation().then((response) => {
this.workstationList = response.rows;
});
listWorkunit().then((response) => {
this.workunitList = response.rows;
});
},
async hanldeGetworkshopList() {
const response = await getworkshopList()
this.workshopList = response.rows
},
//查询工序信息
getProcess(){
listAllProcess().then( response =>{
this.processOptions = response.data;
});
},
handleSortChange(column) {
const p = {}
if (column.order === 'ascending') {
p['ascSort'] = [column.prop]
} else if (column.order === 'descending'){
p['descSort'] = [column.prop]
}
this.getList(p);
},
onFactorySelect(row) {
if (row != undefined && row != null) {
this.queryParams.factoryCode = row.factoryCode;
this.queryParams.factoryName = row.factoryName;
}
},
onWorkstationSelect(row) {
if (row != undefined) {
this.queryParams.workstationName = row.workstationName;
}
},
onWorkunitSelect(row){
if (row != undefined) {
this.queryParams.workunitName = row.workunitName;
}
},
onworkshopSelect(row){
if (row != undefined) {
this.queryParams.workshopName = row.workshopName;
}
},
tabClick(val){
console.log('this.tabIndex', this.tabIndex, val)
this.tabIndex = val.index
this.$nextTick(() => {
this._resizeHandler()
})
},
onItemSelect(row) {
if (row != undefined) {
this.queryParams.productName = row.itemName;
}
},
/** 查询排产换型对照信息列表 */
getList(p) {
this.loading = true;
let param = JSON.parse(JSON.stringify(this.queryParams))
if (p) {
param = {...param, ...p}
}
if (this.daterangePurchaseDate && this.daterangePurchaseDate.length > 0) {
param['createTimeMap'] = {
startDate:this.daterangePurchaseDate[0],
endDate:this.daterangePurchaseDate[1]
}
} else {
param['createTimeMap'] = null
}
let api = getList
if (Number(this.tabIndex) === 1) {
if(this.statisisType === '首检一次不通过率'){
this.theaders1 = [
{label: '统计内容', value: 'groupKey'},
{label: '总首检次数', value: 'totalFristCount'},
{label: '总一次通过次数', value: 'fristCheckOkCount', width: '120px'},
{label: '首检一次通过率', value: 'fristCheckOkPt', width: '240px'},
{label: '首检一次不通过率', value: 'fristCheckNotOkPt', width: '120px'}
]
api = getFrist
} else if(this.statisisType === '不良问题类型统计'){
this.theaders1 = [
{label: '统计内容', value: 'groupKey'},
{label: '检验名称', value: 'checkName'},
{label: '检验项目总和', value: 'checkItemTotal'},
{label: '总NG次数和', value: 'checkNgItemCount'},
{label: '检验名称NG次数和', value: 'ngItemCount'},
{label: 'NG发生率', value: 'ngPt'},
{label: 'NG占比', value: 'totalNgPt'}
]
api = getUnquanlify
}
param['groupKey'] = [this.groupKey]
}
if (param.itemTypeO) {
delete param.itemTypeO
}
api(param).then(response => {
if (Number(this.tabIndex) === 1) {
this.tbodys1 = response.rows
}
else {
this.tbodys = response.rows
}
this.total = response.total;
}).finally(() => {
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
if (Number(this.tabIndex) === 1 && !this.statisisType) this.$message.warning('请选择统计方式');
if (Number(this.tabIndex) === 1 && !this.groupKey) this.$message.warning('请选择统计颗粒度');
this.queryParams.pageNum = 1;
this.getList();
},
onBrandProcess(row){
if (Object.values(row).length > 0) {
this.queryParams.processName = row.processName;
}
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedRows = selection
this.ids = selection.map(item => item.ruleId)
this.single = selection.length!==1
this.multiple = !selection.length
},
handleExport(){
let apiName = ''
if (Number(this.tabIndex) === 0) {
apiName = 'report/pro/feedback/getList/export'
} else if(this.statisisType === '损失工时排行'){
apiName = 'report/pro/feedback/getFrist/export'
} else if(this.statisisType === '工作中心'){
apiName = 'report/pro/feedback/getListByWorkstation/export'
} else if(this.statisisType === '工作单元'){
apiName = 'report/pro/feedback/getListByWorkunit/export'
} else if(this.statisisType === '工序'){
apiName = 'report/pro/feedback/getListByProcess/export'
} else if(this.statisisType === '责任部门排行'){
apiName = 'report/pro/feedback/getUnquanlify/export'
} else if(this.statisisType === '主要异常原因分析') {
apiName = 'report/pro/feedback/getComplementList/export'
}
this.download(
apiName,
{
...this.queryParams,
},
`statistAnaly_${new Date().getTime()}.xlsx`
);
}
}
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" @submit.native.prevent ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item :label="'供应商名称'" prop="vendorName">
<el-input
v-model="queryParams.vendorName"
placeholder="请输入供应商名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item label="凭证号" prop="voucherNo">
<el-input v-model="queryParams.voucherNo" placeholder="请输入凭证号" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="凭证年" prop="voucherNo">
<el-select v-model="queryParams.voucherNoYear" placeholder="请选择凭证年" clearable>
<el-option v-for="dict in voucherNoYearList" :key="dict" :label="dict"
:value="dict" />
</el-select>
</el-form-item>
<el-form-item label="采购单号" prop="purchaseOrderNo">
<el-input v-model="queryParams.purchaseOrderNo" placeholder="请输入采购单号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="物料分类" prop="itemTypeO">
<treeselect style="width: 220px;" v-model="queryParams.itemTypeO" :options="itemTypeOptions" :show-count="true" placeholder="请选择所属分类" value-format="label"/>
</el-form-item>
<el-form-item :label="'物料编码'" prop="sapItemCode">
<el-input
v-model="queryParams.sapItemCode"
placeholder="请输入物料编码"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item label="产品/原料" prop="iqcType">
<el-select v-model="queryParams.iqcType" placeholder="请选择产品/原料" clearable>
<el-option v-for="dict in dict.type.IQC_TYPE" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item :label="'创建时间'">
<el-date-picker v-model="daterangePurchaseDate" value-format="yyyy-MM-dd" type="daterange" range-separator="-"
:start-placeholder="'开始日期'" :end-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-tabs type="border-card" @tab-click="tabClick">
<el-tab-pane :label="'明细'">
<!-- <el-row style="margin-bottom: 10px;">
<el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button>
</el-row> -->
<el-table v-loading="loading" :max-height="tableHeight" :data="tbodys" >
<el-table-column :label="item.label" align="center" :prop="item.value" :width="item.width" v-for="(item, index) in theaders" :key="index">
<!-- <template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType" v-if="item.value==='workorderType'" />
<div v-else>{{ item.value === 'machineTime' ? scope.row[item.value] ? Number(scope.row[item.value]).toFixed(2) : scope.row[item.value] : scope.row[item.value] }}</div>
</template> -->
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
<el-tab-pane :label="'统计'">
<el-row align="center" style="line-height: 40px;">
<el-col :span="7">{{'统计方式'}}
<el-select v-model="statisisType" clearable :placeholder="'请选择统计方式'">
<el-option v-for="item in statisisList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="7">{{'统计颗粒度'}}
<el-select v-model="groupKey" clearable :placeholder="'请选择统计颗粒度'" :disabled="statisisType == '批供应商合格率' || statisisType == '不良问题类型统计'">
<el-option v-for="item in groupbyList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="3">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" style="margin-left: 10px;">{{'查询'}}</el-button>
<el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :max-height="tableHeight" :data="tbodys1" @sort-change="handleSortChange">
<el-table-column :label="item.label" align="center" :prop="item.value" v-for="(item, index) in theaders1" :key="index" :sortable="item.sort? 'custom':false">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_ipqc_type_pc" :value="scope.row.ipqcType" v-if="item.value==='ipqcType'" />
<dict-tag :options="dict.type.mes_qc_result" :value="scope.row.checkResult" v-if="item.value==='checkResult'" />
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status" v-if="item.value==='status'" />
<div v-else>{{ scope.row[item.value] }}</div>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { getvoucherNoYear, getcheckStatus, getstatus } from "@/api/mes/qc/iqc";
import { getList, getUnquanlify, getUnqualifyType, getVendor } from "@/api/mes/proTable/iqcAnaly";
import { treeselect } from "@/api/mes/md/itemtype";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {
getworkshopList} from '@/api/mes/pro/scheduleList'
import {
listWorkstation
} from "@/api/mes/md/workstation";
export default {
name: "ScheduleSetupRule",
components: {Treeselect},
dicts: [
"mes_ipqc_type_pc",
"IQC_TYPE",
"mes_qc_result",
"mes_order_status"
],
data() {
return {
// 遮罩层
loading: true,
selectedRows: [],
workshopList: [],
workstationList: [],
workunitList: [],
tabIndex: 0,
// 选中数组
ids: [],
//dta列表
dtaOptions: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 排产换型对照信息表格数据
tbodys: [],
theaders: [],
tbodys1: [],
theaders1: [],
processOptions: [],
itemTypeOptions: undefined,
// 弹出层标题
title: "",
statisisType: null,
groupKey: null,
groupbyList: ['物料类别', '物料编码'],
statisisList: ['不良率分析', '批供应商合格率', '不良问题类型统计'],
// 是否显示弹出层
open: false,
tableHeight: 0,
daterangePurchaseDate: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
"deptName": null,
"endDate": null,
"purchaseOrderNo": null,
"processName": null,
"sapItemCode": null,
"iqcType": null,
"productCode": null,
"productId": null,
"productName": null,
"startDate": null,
"taskCode": null,
"voucherNoYear": null,
ipqcType: null,
vendorName: null,
itemTypeCode: null,
itemTypeO: null,
"workorderCode": null,
"workorderType": null,
"workshopId": null,
"workshopName": null,
"workstationId": null,
"workstationName": null,
"workunitId": null,
factoryCode: null,
factoryName: null,
"workunitName": null
},
voucherNoYearList:[],
checkStatusList: [],
statusList: [],
// 表单参数
form: {},
};
},
mounted(){
this.$nextTick(()=>{
this._resizeHandler()
})
this._resizeHandler = () => {
const arr = document.getElementsByClassName('el-form')
const height = arr[0].offsetHeight
const arr1 = document.getElementsByClassName('app-main')
const height1 = arr1[0].offsetHeight
this.tableHeight = height1 - height - (this.tabIndex ? 200 : 170)
}
window.addEventListener('resize', this._resizeHandler)
},
beforeDestroy() {
window.removeEventListener('resize', this._resizeHandler)
},
created() {
this.getTreeselect()
this.getList();
},
watch: {
tabIndex: {
handler(val){
if(Number(val) === 0) {
this.theaders = [
{label: '检验单编号', value: 'iqcCode', width: '140px'},
{label: '供应商名称', value: 'vendorName', width: '140px'},
{label: '物料分类', value: 'itemTypeCode', width: '120px'},
{label: '物料编码', value: 'sapItemCode', width: '240px'},
{label: '物料名称', value: 'itemName', width: '120px'},
{label: '单位', value: 'unit'},
{label: '检测数量', value: 'quantity'},
{label: '不合格数', value: 'quantity_unqualify', width: '140px'},
{label: '检测结果', value: 'checkResult', width: '140px'},
{label: '处理措施', value: 'execute', width: '140px'},
{label: '创建时间', value: 'createTimeMap', width: '140px'},
{label: '检测时间', value: 'checkTime', width: '140px'},
{label: '检测人员', value: 'checkby', width: '140px'},
{label: '凭证年', value: 'voucherNoYear', width: '140px'},
{label: '凭证号', value: 'voucherNo', width: '140px'},
{label: '凭证行号', value: 'salesVoucherItem', width: '140px'},
{label: '采购单号', value: 'purchaseOrderNo', width: '140px'},
{label: '采购单行号', value: 'purchaseOrderItemNo', width: '140px'},
]
this.handleQuery()
}
},
immediate: true
},
'queryParams.itemTypeO' : {
handler(val){
this.queryParams.itemTypeCode = val.itemTypeCode
}
}
},
methods: {
getTreeselect() {
getvoucherNoYear().then(res=>{
if (res.data && res.data.length > 0){
this.voucherNoYearList = res.data
} else {
this.voucherNoYearList = []
}
})
getcheckStatus().then(res=>{
if (res.data && res.data.length > 0){
this.checkStatusList = res.data
} else {
this.checkStatusList = []
}
})
getstatus().then(res=>{
if (res.data && res.data.length > 0){
this.statusList = res.data
} else {
this.statusList = []
}
})
treeselect().then(response => {
this.itemTypeOptions = response.data;
});
},
handleSortChange(column) {
const p = {}
if (column.order === 'ascending') {
p['ascSort'] = [column.prop]
} else if (column.order === 'descending'){
p['descSort'] = [column.prop]
}
this.getList(p);
},
onFactorySelect(row) {
if (row != undefined && row != null) {
this.queryParams.factoryCode = row.factoryCode;
this.queryParams.factoryName = row.factoryName;
}
},
onWorkstationSelect(row) {
if (row != undefined) {
this.queryParams.workstationName = row.workstationName;
}
},
onWorkunitSelect(row){
if (row != undefined) {
this.queryParams.workunitName = row.workunitName;
}
},
onworkshopSelect(row){
if (row != undefined) {
this.queryParams.workshopName = row.workshopName;
}
},
tabClick(val){
console.log('this.tabIndex', this.tabIndex, val)
this.tabIndex = val.index
this.$nextTick(() => {
this._resizeHandler()
})
},
onItemSelect(row) {
if (row != undefined) {
this.queryParams.productName = row.itemName;
}
},
/** 查询排产换型对照信息列表 */
getList(p) {
this.loading = true;
let param = JSON.parse(JSON.stringify(this.queryParams))
if (p) {
param = {...param, ...p}
}
if (this.daterangePurchaseDate && this.daterangePurchaseDate.length > 0) {
param['createTimeMapMap'] = {
startDate:this.daterangePurchaseDate[0],
endDate:this.daterangePurchaseDate[1]
}
} else {
param['createTimeMapMap'] = null
}
let api = getList
if (Number(this.tabIndex) === 1) {
if(this.statisisType === '不良问题类型统计'){
this.theaders1 = [
{label: '检验名称', value: 'checkName'},
{label: '检验项目总和', value: 'ItemCount'},
{label: '总NG次数和', value: 'ngCount', width: '120px'},
{label: '检验名称NG次数和', value: 'itemNgCount', width: '240px'},
{label: 'NG发生率', value: 'ngPt', width: '120px'},
{label: 'NG占比', value: 'totlNgPt', width: '120px'}
]
api = getUnqualifyType
} else if(this.statisisType === '不良率分析'){
if (this.groupKey == '物料类别') {
this.theaders1 = [
{label: '物料分类', value: 'groupKey'},
{label: '总批数', value: 'checkName'},
{label: '不合格批数', value: 'checkItemTotal'},
{label: '特采批数', value: 'checkNgItemCount'},
{label: '批合格率', value: 'ngItemCount'},
{label: '批不良率', value: 'ngPt'},
{label: '批特采率', value: 'totalNgPt'},
{label: '总检验数量', value: 'totalNgPt'},
{label: '不合格数量', value: 'totalNgPt'},
{label: '特采数量', value: 'totalNgPt'},
{label: '数量合格率', value: 'totalNgPt'},
{label: '数量不合格率', value: 'totalNgPt'},
{label: '特采数量比率', value: 'totalNgPt'},
]
} else if (this.groupKey == '物料编码') {
this.theaders1 = [
{label: '物料编码', value: 'groupKey'},
{label: '总批数', value: 'checkName'},
{label: '不合格批数', value: 'checkItemTotal'},
{label: '特采批数', value: 'checkNgItemCount'},
{label: '批合格率', value: 'ngItemCount'},
{label: '批不良率', value: 'ngPt'},
{label: '批特采率', value: 'totalNgPt'},
{label: '总检验数量', value: 'totalNgPt'},
{label: '不合格数量', value: 'totalNgPt'},
{label: '特采数量', value: 'totalNgPt'},
{label: '数量合格率', value: 'totalNgPt'},
{label: '数量不合格率', value: 'totalNgPt'},
{label: '特采数量比率', value: 'totalNgPt'},
]
}
api = getUnquanlify
param['groupKey'] = [this.groupKey]
} else if(this.statisisType === '批供应商合格率'){
this.theaders1 = [
{label: '供应商名称', value: 'vendorName'},
{label: '总批数', value: 'totalRecordCount'},
{label: '不合格批数', value: 'totalUnqualifyCount'},
{label: '批合格率', value: 'unqualifyPt'}
]
api = getVendor
}
}
if (param.itemTypeO) {
delete param.itemTypeO
}
api(param).then(response => {
if (Number(this.tabIndex) === 1) {
this.tbodys1 = response.rows
}
else {
this.tbodys = response.rows
}
this.total = response.total;
}).finally(() => {
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
if (Number(this.tabIndex) === 1 && !this.statisisType) this.$message.warning('请选择统计方式');
if (Number(this.tabIndex) === 1 && !this.groupKey && this.statisisType === '不良率分析') this.$message.warning('请选择统计颗粒度');
this.queryParams.pageNum = 1;
this.getList();
},
onBrandProcess(row){
if (Object.values(row).length > 0) {
this.queryParams.processName = row.processName;
}
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedRows = selection
this.ids = selection.map(item => item.ruleId)
this.single = selection.length!==1
this.multiple = !selection.length
},
handleExport(){
let apiName = ''
if (Number(this.tabIndex) === 0) {
apiName = 'report/pro/feedback/getList/export'
} else if(this.statisisType === '损失工时排行'){
apiName = 'report/pro/feedback/getUnqualifyType/export'
} else if(this.statisisType === '工作中心'){
apiName = 'report/pro/feedback/getListByWorkstation/export'
} else if(this.statisisType === '工作单元'){
apiName = 'report/pro/feedback/getListByWorkunit/export'
} else if(this.statisisType === '工序'){
apiName = 'report/pro/feedback/getListByProcess/export'
} else if(this.statisisType === '责任部门排行'){
apiName = 'report/pro/feedback/getUnquanlify/export'
} else if(this.statisisType === '主要异常原因分析') {
apiName = 'report/pro/feedback/getComplementList/export'
}
this.download(
apiName,
{
...this.queryParams,
},
`statistAnaly_${new Date().getTime()}.xlsx`
);
}
}
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" @submit.native.prevent ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item :label="'工厂'" prop="factoryName">
<el-input
v-model="queryParams.factoryName"
placeholder="请选择工厂"
>
<el-button
slot="append"
icon="el-icon-search"
@click="$refs['FactorySelectRef'].showFlag = true"
></el-button>
</el-input>
<FactorySelect
ref="FactorySelectRef"
@onSelected="onFactorySelect"
/>
</el-form-item>
<el-form-item :label="'部门'" prop="deptName">
<el-input
v-model="queryParams.deptName"
placeholder="请输入部门名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'工作中心'" prop="workstationName">
<el-input
v-model="queryParams.workstationName"
>
<el-button
slot="append"
icon="el-icon-search"
@click="$refs['WorkstationSelect'].showFlag = true"
></el-button>
</el-input>
</el-form-item>
<el-form-item :label="'工作单元'" prop="workunitId">
<el-input v-model="queryParams.workunitName">
<el-button
slot="append"
icon="el-icon-search"
@click="$refs['WorkunitSelect'].showFlag = true"
></el-button>
</el-input>
</el-form-item>
<el-form-item :label="'申领人'" prop="claimant">
<el-input
v-model="queryParams.claimant"
placeholder="请输入申领人"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'产品类'" prop="itemTypeName">
<el-input
v-model="queryParams.itemTypeName"
placeholder="请输入产品类"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'产品编码'" prop="sapItemCode">
<el-input
v-model="queryParams.sapItemCode"
placeholder="请输入产品编码"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'原料类'" prop="productTypeName">
<el-input
v-model="queryParams.productTypeName"
placeholder="请输入原料类"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'原料编码'" prop="productCode">
<el-input
v-model="queryParams.productCode"
placeholder="请输入原料编码"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'编排单号'" prop="arrangeCode">
<el-input
v-model="queryParams.arrangeCode"
placeholder="请输入编排单号"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'生产任务号'" prop="taskCode">
<el-input
v-model="queryParams.taskCode"
placeholder="请输入生产任务号"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'工单号'" prop="workorderCode">
<el-input
v-model="queryParams.workorderCode"
placeholder="请输入工单号"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</el-form-item>
<el-form-item :label="'排产时间'">
<el-date-picker v-model="daterangePurchaseDate" value-format="yyyy-MM-dd" type="daterange" range-separator="-"
:start-placeholder="'开始日期'" :end-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-tabs type="border-card" @tab-click="tabClick">
<el-tab-pane :label="'明细'">
<!-- <el-row style="margin-bottom: 10px;">
<el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button>
</el-row> -->
<el-table v-loading="loading" :max-height="tableHeight" :data="tbodys" >
<el-table-column :label="item.label" align="center" :prop="item.value" :width="item.width" v-for="(item, index) in theaders" :key="index">
<!-- <template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType" v-if="item.value==='workorderType'" />
<div v-else>{{ item.value === 'machineTime' ? scope.row[item.value] ? Number(scope.row[item.value]).toFixed(2) : scope.row[item.value] : scope.row[item.value] }}</div>
</template> -->
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
<el-tab-pane :label="'统计'">
<el-row align="center" style="line-height: 40px;">
<el-col :span="7">{{'统计方式'}}
<el-select v-model="statisisType" clearable :placeholder="'请选择统计方式'">
<el-option v-for="item in statisisList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="7">{{'统计颗粒度'}}
<el-select v-model="groupKey" clearable :placeholder="'请选择统计颗粒度'">
<el-option v-for="item in groupbyList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="3">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" style="margin-left: 10px;">{{'查询'}}</el-button>
<el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :max-height="tableHeight" :data="tbodys1" @sort-change="handleSortChange">
<el-table-column :label="item.label" align="center" :prop="item.value" v-for="(item, index) in theaders1" :key="index" :sortable="item.sort? 'custom':false">
<!-- <template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType" v-if="item.value==='workorderType'" />
<div v-else>{{ item.value === 'machineTime' ? scope.row[item.value] ? Number(scope.row[item.value]).toFixed(2) : scope.row[item.value] : scope.row[item.value] }}</div>
</template> -->
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
</el-tabs>
<ItemSelect ref="ItemSelectRef" @onSelected="onItemSelect"/>
<workshopSelect ref="workshopSelectRef" showModal @onSelected="onworkshopSelect"/>
<WorkuintSelect
ref="WorkunitSelect"
showModal
@onSelected="onWorkunitSelect"
/>
<WorkstationSelect
ref="WorkstationSelect"
showModal
@onSelected="onWorkstationSelect"
/>
<ProcessSelect
ref="brSelectpro"
showModal
@onSelected="onBrandProcess"
></ProcessSelect>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { getList, getListByProcess, getInputOutputRatioList, getBackList, getComplementList } from "@/api/mes/proTable/sourceAnaly";
import ProcessSelect from "@/components/process/taskSelectSingle.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
import workshopSelect from "@/components/workshopSelect/single.vue";
import WorkuintSelect from "@/components/workunitSelect/single.vue";
import WorkstationSelect from "@/components/workstationSelect/simpletableSingle.vue"
import FactorySelect from "@/components/FactorySelect/index.vue";
export default {
name: "ScheduleSetupRule",
components: {FactorySelect,ProcessSelect, ItemSelect, workshopSelect, WorkuintSelect, WorkstationSelect},
dicts: [
// "mes_workorder_type",
],
data() {
return {
showQueryLPN: false,
// 遮罩层
loading: true,
selectedRows: [],
tabIndex: 0,
// 选中数组
ids: [],
//dta列表
dtaOptions: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 排产换型对照信息表格数据
tbodys: [],
theaders: [],
tbodys1: [],
theaders1: [],
// 弹出层标题
title: "",
statisisType: null,
groupKey: null,
groupbyList: ['工作单元', '工作中心', '车间', '部门', '工厂'],
statisisList: ['生产补料统计', '退换料统计', '完工工单投入产出比统计'],
// 是否显示弹出层
open: false,
tableHeight: 0,
daterangePurchaseDate: [dayjs().format('YYYY-MM-DD'), dayjs().add(7, 'day').format('YYYY-MM-DD')],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
"deptName": null,
"endDate": null,
"orderCode": null,
"processName": null,
"processCode": null,
"processId": null,
"productCode": null,
"productId": null,
"productName": null,
"startDate": null,
"taskCode": null,
"claimant": null,
sapItemCode: null,
arrangeCode: null,
productTypeName: null,
"itemTypeName": null,
"workorderCode": null,
"workorderType": null,
"workshopId": null,
"workshopName": null,
"workstationId": null,
"workstationName": null,
"workunitId": null,
factoryCode: null,
factoryName: null,
"workunitName": null
},
// 表单参数
form: {},
};
},
mounted(){
this.$nextTick(()=>{
this._resizeHandler()
})
this._resizeHandler = () => {
const arr = document.getElementsByClassName('el-form')
const height = arr[0].offsetHeight
const arr1 = document.getElementsByClassName('app-main')
const height1 = arr1[0].offsetHeight
this.tableHeight = height1 - height - (this.tabIndex ? 200 : 170)
}
window.addEventListener('resize', this._resizeHandler)
},
beforeDestroy() {
window.removeEventListener('resize', this._resizeHandler)
},
created() {
this.getList();
},
watch: {
tabIndex: {
handler(val){
if(Number(val) === 0) {
this.theaders = [
{label: '工作单元', value: 'workunitName'},
{label: '产品编码', value: 'productCode'},
{label: '产品名称', value: 'productName', width: '120px'},
{label: '产品类名称', value: 'productTypeName', width: '240px'},
{label: '原料编码', value: 'sapItemCode', width: '120px'},
{label: '原料名称', value: 'sapItemName'},
{label: '领料方式', value: 'materialType'},
{label: '申领数量', value: 'appQuantity', width: '140px'},
{label: '已领数量', value: 'quantityReceived', width: '140px'},
{label: '单位', value: 'unit', width: '140px'},
{label: '工单号', value: 'workorderCode', width: '140px'},
{label: '生产任务号', value: 'taskCode', width: '140px'},
{label: '编排单号', value: 'arrangeCode', width: '140px'},
{label: '申领时间', value: 'appTime', width: '140px'},
{label: '领料时间', value: 'receivedTime', width: '140px'}
]
this.handleQuery()
}
},
immediate: true
}
},
methods: {
handleSortChange(column) {
const p = {}
if (column.order === 'ascending') {
p['ascSort'] = [column.prop]
} else if (column.order === 'descending'){
p['descSort'] = [column.prop]
}
this.getList(p);
},
onFactorySelect(row) {
if (row != undefined && row != null) {
this.queryParams.factoryCode = row.factoryCode;
this.queryParams.factoryName = row.factoryName;
}
},
onWorkstationSelect(row) {
if (row != undefined) {
this.queryParams.workstationName = row.workstationName;
}
},
onWorkunitSelect(row){
if (row != undefined) {
this.queryParams.workunitName = row.workunitName;
}
},
onworkshopSelect(row){
if (row != undefined) {
this.queryParams.workshopName = row.workshopName;
}
},
tabClick(val){
console.log('this.tabIndex', this.tabIndex, val)
this.tabIndex = val.index
this.$nextTick(() => {
this._resizeHandler()
})
},
onItemSelect(row) {
if (row != undefined) {
this.queryParams.productName = row.itemName;
}
},
/** 查询排产换型对照信息列表 */
getList(p) {
this.loading = true;
let param = JSON.parse(JSON.stringify(this.queryParams))
if (p) {
param = {...param, ...p}
}
if (this.daterangePurchaseDate && this.daterangePurchaseDate.length > 0) {
param['scheduleTime'] = {
startDate:this.daterangePurchaseDate[0],
endDate:this.daterangePurchaseDate[1]
}
} else {
param['scheduleTime'] = null
}
let api = getList
if (Number(this.tabIndex) === 1) {
if(this.statisisType === '生产补料统计'){
api = getComplementList
this.theaders1 = [
{label: '统计内容', value: 'groupKey'},
{label: '任务总计划数', value: 'totalQuantity'},
{label: '任务总报工数', value: 'totalFeedbackQuantity'},
{label: '申请物料总量', value: 'appQuantity'},
{label: '超领总量', value: 'overRecTotalQuantity'},
{label: '超领比例-数量', value: 'overRecQuantityPt'},
{label: '申请物料行数', value: 'appItemCodeRows'},
{label: '超领单行数', value: 'overRecItemCodeRows'},
{label: '超领比例-次数', value: 'overRecRowsPt'}
]
} else if(this.statisisType === '退换料统计'){
this.theaders1 = [
{label: '统计内容', value: 'groupKey'},
{label: '任务总计划数', value: 'taskQuantity'},
{label: '任务总报工数', value: 'taskFeedbackQuantity', width: '120px'},
{label: '申请物料总量', value: 'totalQuantity', width: '240px'},
{label: '退换料总量', value: 'backTotalQuantity', width: '120px'},
{label: '退换料比例-数量', value: 'backTotalQuantityPt'},
{label: '申请物料行数', value: 'totalRows'},
{label: '退换料行数', value: 'backTotalRows', width: '140px'},
{label: '退换料比例-次数', value: 'backTotalRowsPt', width: '140px'}
]
api = getBackList
} else if(this.statisisType === '完工工单投入产出比统计'){
this.theaders1 = [
{label: '统计内容', value: 'groupKey'},
{label: '完工工单计划数量', value: 'quantity'},
{label: '成品总报工数', value: 'feedbackTotalQuantity'},
{label: '计划领料数量', value: 'appQuantity'},
{label: '实际领料数量', value: 'recQuantity'},
{label: '投入比', value: 'inputPt'},
{label: '产出比', value: 'outputPt'},
{label: '产出/投入比', value: 'inputOutputPt'},
]
api = getInputOutputRatioList
}
param['groupKey'] = [this.groupKey]
}
api(param).then(response => {
if (Number(this.tabIndex) === 1) {
this.tbodys1 = response.rows
}
else {
this.tbodys = response.rows
}
this.total = response.total;
}).finally(() => {
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
if (Number(this.tabIndex) === 1 && !this.statisisType) this.$message.warning('请选择统计方式');
if (Number(this.tabIndex) === 1 && !this.groupKey) this.$message.warning('请选择统计颗粒度');
this.queryParams.pageNum = 1;
this.getList();
},
onBrandSelected(row){
if (Object.values(row).length > 0) {
this.queryParams.itemTypeId = row.itemTypeId;
this.queryParams.itemTypeName = row.itemTypeName;
}
},
onBrandProcess(row){
if (Object.values(row).length > 0) {
this.queryParams.processName = row.processName;
}
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedRows = selection
this.ids = selection.map(item => item.ruleId)
this.single = selection.length!==1
this.multiple = !selection.length
},
handleExport(){
let apiName = ''
if (Number(this.tabIndex) === 0) {
apiName = 'report/pro/feedback/getList/export'
} else if(this.statisisType === '损失工时排行'){
apiName = 'report/pro/feedback/getBackList/export'
} else if(this.statisisType === '工作中心'){
apiName = 'report/pro/feedback/getListByWorkstation/export'
} else if(this.statisisType === '工作单元'){
apiName = 'report/pro/feedback/getListByWorkunit/export'
} else if(this.statisisType === '工序'){
apiName = 'report/pro/feedback/getListByProcess/export'
} else if(this.statisisType === '责任部门排行'){
apiName = 'report/pro/feedback/getInputOutputRatioList/export'
} else if(this.statisisType === '主要异常原因分析') {
apiName = 'report/pro/feedback/getComplementList/export'
}
this.download(
apiName,
{
...this.queryParams,
},
`statistAnaly_${new Date().getTime()}.xlsx`
);
}
}
};
</script>
\ No newline at end of file
......@@ -405,7 +405,7 @@ import dayjs from 'dayjs'
},
/** 搜索按钮操作 */
handleQuery() {
if (Number(this.tabIndex) === 1 && !this.statisisType) this.$modal.msgWarnning('请选择统计方式');
if (Number(this.tabIndex) === 1 && !this.statisisType) this.$message.warning('请选择统计方式');
this.queryParams.pageNum = 1;
this.getList();
},
......
<template>
<div class="app-container">
<el-form :model="queryParams" @submit.native.prevent ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item :label="'工序'" prop="processName">
<el-input v-model="queryParams.processName" >
<el-button slot="append" @click="$refs.brSelectpro.showFlag = true" icon="el-icon-search"></el-button>
</el-input>
</el-form-item>
<el-form-item :label="'车间'" prop="workshopName">
<el-input v-model="queryParams.workshopName" >
<el-button slot="append" @click="$refs.workshopSelectRef.showFlag = true" icon="el-icon-search"></el-button>
</el-input>
</el-form-item>
<el-form-item :label="'工作中心'" prop="workstationName">
<el-input
v-model="queryParams.workstationName"
>
<el-button
slot="append"
icon="el-icon-search"
@click="$refs['WorkstationSelect'].showFlag = true"
></el-button>
</el-input>
</el-form-item>
<el-form-item :label="'工作单元'" prop="workunitId">
<el-input v-model="queryParams.workunitName">
<el-button
slot="append"
icon="el-icon-search"
@click="$refs['WorkunitSelect'].showFlag = true"
></el-button>
</el-input>
</el-form-item>
<el-form-item :label="'异常时间'">
<el-date-picker v-model="daterangePurchaseDate" value-format="yyyy-MM-dd" type="daterange" range-separator="-"
:start-placeholder="'开始日期'" :end-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-tabs type="border-card" @tab-click="tabClick">
<el-tab-pane :label="'明细'">
<!-- <el-row style="margin-bottom: 10px;">
<el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button>
</el-row> -->
<el-table v-loading="loading" :max-height="tableHeight" :data="tbodys" >
<el-table-column :label="item.label" align="center" :prop="item.value" :width="item.width" v-for="(item, index) in theaders" :key="index">
<!-- <template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType" v-if="item.value==='workorderType'" />
<div v-else>{{ item.value === 'machineTime' ? scope.row[item.value] ? Number(scope.row[item.value]).toFixed(2) : scope.row[item.value] : scope.row[item.value] }}</div>
</template> -->
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
<el-tab-pane :label="'统计'">
<el-row align="center" style="line-height: 40px;">
<el-col :span="7">{{'统计方式'}}
<el-select v-model="statisisType" clearable :placeholder="'请选择统计方式'">
<el-option v-for="item in statisisList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="7">{{'统计颗粒度'}}
<el-select v-model="groupKey" clearable :placeholder="'请选择统计颗粒度'">
<el-option v-for="item in groupbyList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-col>
<el-col :span="3">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" style="margin-left: 10px;">{{'查询'}}</el-button>
<!-- <el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button> -->
</el-col>
</el-row>
<el-table v-loading="loading" :max-height="tableHeight" :data="tbodys1" @sort-change="handleSortChange">
<el-table-column :label="item.label" align="center" :prop="item.value" v-for="(item, index) in theaders1" :key="index" :sortable="item.sort? 'custom':false">
<!-- <template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType" v-if="item.value==='workorderType'" />
<div v-else>{{ item.value === 'machineTime' ? scope.row[item.value] ? Number(scope.row[item.value]).toFixed(2) : scope.row[item.value] : scope.row[item.value] }}</div>
</template> -->
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tab-pane>
</el-tabs>
<ItemSelect ref="ItemSelectRef" @onSelected="onItemSelect"/>
<workshopSelect ref="workshopSelectRef" showModal @onSelected="onworkshopSelect"/>
<WorkuintSelect
ref="WorkunitSelect"
showModal
@onSelected="onWorkunitSelect"
/>
<WorkstationSelect
ref="WorkstationSelect"
showModal
@onSelected="onWorkstationSelect"
/>
<ProcessSelect
ref="brSelectpro"
showModal
@onSelected="onBrandProcess"
></ProcessSelect>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { getList, getListByProcess, getResponsibilityRanking, getLossRanking, getReasonRanking } from "@/api/mes/proTable/timeDelayStatic";
import ProcessSelect from "@/components/process/taskSelectSingle.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
import workshopSelect from "@/components/workshopSelect/single.vue";
import WorkuintSelect from "@/components/workunitSelect/single.vue";
import WorkstationSelect from "@/components/workstationSelect/simpletableSingle.vue"
import FactorySelect from "@/components/FactorySelect/index.vue";
export default {
name: "ScheduleSetupRule",
components: {FactorySelect,ProcessSelect, ItemSelect, workshopSelect, WorkuintSelect, WorkstationSelect},
dicts: [
// "mes_workorder_type",
],
data() {
return {
showQueryLPN: false,
// 遮罩层
loading: true,
selectedRows: [],
tabIndex: 0,
// 选中数组
ids: [],
//dta列表
dtaOptions: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 排产换型对照信息表格数据
tbodys: [],
theaders: [],
tbodys1: [],
theaders1: [],
// 弹出层标题
title: "",
statisisType: null,
groupKey: null,
statisisList: ['主要异常原因分析', '损失工时排行', '责任部门排行'],
groupbyList: ['工作单元', '工作中心', '车间', '部门', '工厂'],
// 是否显示弹出层
open: false,
tableHeight: 0,
daterangePurchaseDate: [dayjs().startOf('month').format('YYYY-MM-DD'), dayjs().endOf('month').format('YYYY-MM-DD')],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
"customerProjectNo": null,
"endDate": null,
"orderCode": null,
"processName": null,
"processCode": null,
"processId": null,
"productCode": null,
"productId": null,
"productName": null,
"startDate": null,
"taskCode": null,
"userName": null,
"nickName": null,
"workorderCode": null,
"workorderType": null,
"workshopId": null,
"workshopName": null,
"workstationId": null,
"workstationName": null,
"workunitId": null,
factoryCode: null,
factoryName: null,
"workunitName": null
},
// 表单参数
form: {},
};
},
mounted(){
this.$nextTick(()=>{
this._resizeHandler()
})
this._resizeHandler = () => {
const arr = document.getElementsByClassName('el-form')
const height = arr[0].offsetHeight
const arr1 = document.getElementsByClassName('app-main')
const height1 = arr1[0].offsetHeight
this.tableHeight = height1 - height - (this.tabIndex ? 200 : 170)
}
window.addEventListener('resize', this._resizeHandler)
},
beforeDestroy() {
window.removeEventListener('resize', this._resizeHandler)
},
created() {
this.getList();
},
watch: {
tabIndex: {
handler(val){
if(Number(val) === 0) {
this.theaders = [
{label: '异常原因', value: 'abnormalReason'},
{label: '损失单元', value: 'workunitName'},
{label: '责任部门', value: 'dept', width: '120px'},
{label: '异常发起时间', value: 'exceptionTime', width: '240px'},
{label: '非排班时长', value: 'restTimeS', width: '120px'},
{label: '异常后任务开工时间', value: 'recoveryTime'},
{label: '当前工序雇员数', value: 'empCount'},
{label: '延误工时', value: 'faildTimeM', width: '140px'}
]
this.handleQuery()
}
},
immediate: true
}
},
methods: {
handleSortChange(column) {
const p = {}
if (column.order === 'ascending') {
p['ascSort'] = [column.prop]
} else if (column.order === 'descending'){
p['descSort'] = [column.prop]
}
this.getList(p);
},
onFactorySelect(row) {
if (row != undefined && row != null) {
this.queryParams.factoryCode = row.factoryCode;
this.queryParams.factoryName = row.factoryName;
}
},
onWorkstationSelect(row) {
if (row != undefined) {
this.queryParams.workstationName = row.workstationName;
}
},
onWorkunitSelect(row){
if (row != undefined) {
this.queryParams.workunitName = row.workunitName;
}
},
onworkshopSelect(row){
if (row != undefined) {
this.queryParams.workshopName = row.workshopName;
}
},
tabClick(val){
console.log('this.tabIndex', this.tabIndex, val)
this.tabIndex = val.index
this.$nextTick(() => {
this._resizeHandler()
})
},
onItemSelect(row) {
if (row != undefined) {
this.queryParams.productName = row.itemName;
}
},
/** 查询排产换型对照信息列表 */
getList(p) {
this.loading = true;
let param = JSON.parse(JSON.stringify(this.queryParams))
if (p) {
param = {...param, ...p}
}
if (this.daterangePurchaseDate && this.daterangePurchaseDate.length > 0) {
param['feedTime'] = {
startDate:this.daterangePurchaseDate[0],
endDate:this.daterangePurchaseDate[1]
}
} else {
param['feedTime'] = null
}
let api = getList
if (Number(this.tabIndex) === 1) {
if(this.statisisType === '主要异常原因分析'){
api = getReasonRanking
this.theaders1 = [
{label: '异常原因(分组)', value: 'expcetionReason'},
{label: '时间范围', value: 'timeRange'},
{label: '异常次数', value: 'expCount', sort: true},
{label: '合计延误工时', value: 'workTimeSumM', sort: true}
]
console.log('api1111', api, this.statisisType)
} else if(this.statisisType === '损失工时排行'){
this.theaders1 = [
{label: '工作单元', value: 'workunitName'},
{label: '工作中心', value: 'workstationName'},
{label: '车间', value: 'workshopName'},
{label: '部门', value: 'deptName'},
{label: '工厂', value: 'factoryName'},
{label: '时间范围', value: 'timeRange'},
{label: '合计延误工时', value: 'lossTimeSumM', sort: true}
]
api = getLossRanking
} else if(this.statisisType === '责任部门排行'){
this.theaders1 = [
{label: '责任部门', value: 'rtDept'},
{label: '时间范围', value: 'timeRange'},
{label: '合计责任工时', value: 'rtTimeSumM', sort: true}
]
api = getResponsibilityRanking
}
param['groupKey'] = [this.groupKey]
}
api(param).then(response => {
console.log('response', response)
if (Number(this.tabIndex) === 1) {
this.tbodys1 = response.rows
}
else {
this.tbodys = response.rows
}
this.total = response.total;
}).finally(() => {
this.loading = false;
});;
},
/** 搜索按钮操作 */
handleQuery() {
if (Number(this.tabIndex) === 1 && !this.statisisType) this.$message.warning('请选择统计方式');
if (Number(this.tabIndex) === 1 && !this.groupKey) this.$message.warning('请选择统计颗粒度');
this.queryParams.pageNum = 1;
this.getList();
},
onBrandSelected(row){
if (Object.values(row).length > 0) {
this.queryParams.itemTypeId = row.itemTypeId;
this.queryParams.itemTypeName = row.itemTypeName;
}
},
onBrandProcess(row){
if (Object.values(row).length > 0) {
this.queryParams.processName = row.processName;
}
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.selectedRows = selection
this.ids = selection.map(item => item.ruleId)
this.single = selection.length!==1
this.multiple = !selection.length
},
handleExport(){
let apiName = ''
if (Number(this.tabIndex) === 0) {
apiName = 'report/pro/feedback/getList/export'
} else if(this.statisisType === '损失工时排行'){
apiName = 'report/pro/feedback/getLossRanking/export'
} else if(this.statisisType === '工作中心'){
apiName = 'report/pro/feedback/getListByWorkstation/export'
} else if(this.statisisType === '工作单元'){
apiName = 'report/pro/feedback/getListByWorkunit/export'
} else if(this.statisisType === '工序'){
apiName = 'report/pro/feedback/getListByProcess/export'
} else if(this.statisisType === '责任部门排行'){
apiName = 'report/pro/feedback/getResponsibilityRanking/export'
} else if(this.statisisType === '主要异常原因分析') {
apiName = 'report/pro/feedback/getReasonRanking/export'
}
this.download(
apiName,
{
...this.queryParams,
},
`statistAnaly_${new Date().getTime()}.xlsx`
);
}
}
};
</script>
\ No newline at end of file
......@@ -484,6 +484,7 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
this.optType = 'add'
if (this.selections.some(v => v.endTime)) {
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment