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

报表管理

parent 3f2a35f6
import request from '@/utils/request'
// 生产进度:明细界面
export function getList(query) {
return request({
url: "/report/pro/workOrderProgress/getList",
method: "get",
params: query,
});
}
// 生产进度:报工明细
export function getFeedbackList(query) {
return request({
url: '/report/pro/workOrderProgress/getFeedbackList',
method: "get",
params: query
});
}
// 生产进度:工序明细
export function getProcessList(query) {
return request({
url: '/report/pro/workOrderProgress/getProcessList',
method: "get",
params: query
});
}
\ No newline at end of file
import request from '@/utils/request'
// 生产报工记录:明细界面
export function getList(query) {
return request({
url: "/report/pro/feedback/getList",
method: "get",
params: query,
});
}
// 生产报工记录:统计方式工序
export function getListByProcess(query) {
return request({
url: '/report/pro/feedback/getListByProcess',
method: "get",
params: query
});
}
// 生产报工记录:统计方式用户
export function getListByUser(query) {
return request({
url: '/report/pro/feedback/getListByUser',
method: "get",
params: query
});
}
// 生产报工记录:统计方式车间
export function getListByWorkshop(query) {
return request({
url: '/report/pro/feedback/getListByWorkshop',
method: "get",
params: query
});
}
// 生产报工记录:统计方式工单
export function getListByWorkOrder(query) {
return request({
url: '/report/pro/feedback/getListByWorkOrder',
method: "get",
params: query
});
}
// 生产报工记录:统计方式工作中心
export function getListByWorkstation(query) {
return request({
url: '/report/pro/feedback/getListByWorkstation',
method: "get",
params: query
});
}
// 生产报工记录:统计方式工作单元
export function getListByWorkunit(query) {
return request({
url: '/report/pro/feedback/getListByWorkunit',
method: "get",
params: query
});
}
// 生产报工记录:统计方式不合格原因
export function getListByDefect(query) {
return request({
url: '/report/pro/feedback/getListByDefect',
method: "get",
params: query
});
}
\ No newline at end of file
<template>
<el-dialog :title="'人员选择'"
v-if="showFlag"
:visible.sync="showFlag"
:modal= showModal
width="80%"
center
>
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="deptName"
:placeholder="'请输入部门名称'"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
default-expand-all
@node-click="handleNodeClick"
/>
</div>
</el-col>
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" @submit.native.prevent ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="'用户名称'" prop="userName">
<el-input
v-model="queryParams.userName"
:placeholder="'请输入用户名称'"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="'用户昵称'" prop="nickName">
<el-input
v-model="queryParams.nickName"
clearable
style="width: 240px"
@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-table v-loading="loading" :data="userList" @current-change="handleCurrent" @row-dblclick="handleRowDbClick">
<el-table-column width="55" align="center" >
<template v-slot="scope">
<el-radio v-model="selectedId" :label="scope.row.userId" @change="handleRowChange(scope.row)">{{""}}</el-radio>
</template>
</el-table-column>
<el-table-column :label="'用户名称'" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column :label="'用户昵称'" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelect">确认</el-button>
<el-button @click="showFlag=false">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "UserSingleSelect",
dicts: ['sys_normal_disable', 'sys_user_sex'],
props: {
showModal: {
default: false
}
},
components: { Treeselect },
data() {
return {
showFlag:false,
// 遮罩层
loading: true,
// 选中数组
selectedId: null,
selectedRow: null,
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 用户表格数据
userList: null,
// 弹出层标题
title: "",
// 部门树选项
deptOptions: undefined,
// 是否显示弹出层
open: false,
// 部门名称
deptName: undefined,
// 日期范围
dateRange: [],
// 岗位选项
postOptions: [],
// 角色选项
roleOptions: [],
// 表单参数
form: {},
defaultProps: {
children: "children",
label: "label"
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
userName: undefined,
nickName: undefined,
status: undefined,
deptId: undefined
},
// 列信息
columns: [
{ key: 0, label: '用户编号', visible: true },
{ key: 1, label: '用户名称', visible: true },
{ key: 2, label: '用户昵称', visible: true },
{ key: 3, label: '部门', visible: true },
{ key: 4, label: '手机号码', visible: true },
{ key: 5, label: '状态', visible: true },
{ key: 6, label: '创建时间', visible: true }
],
};
},
watch: {
// 根据名称筛选部门树
deptName(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getList();
this.getTreeselect();
},
methods: {
/** 查询用户列表 */
getList() {
this.loading = true;
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then(response => {
this.deptOptions = response.data;
});
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
this.queryParams.deptId = data.id;
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
handleCurrent(row){
if(row){
this.selectedRow = row;
}
},
//行双击选中
handleRowDbClick(row){
if(row){
this.selectedRow = row;
this.$emit('onSelected',this.selectedRow);
this.showFlag = false;
}
},
// 单选选中数据
handleRowChange(row) {
debugger;
if(row){
this.selectedRow = row;
}
},
//确定选中
confirmSelect(){
if(this.selectedId == null || this.selectedId == 0){
this.$notify({
title:'提示',
type:'warning',
message: '请至少选择一条数据'
});
return;
}
this.$emit('onSelected',this.selectedRow);
this.showFlag = false;
}
}
};
</script>
<template>
<el-dialog :title="'车间选择'"
v-if="showFlag"
:visible.sync="showFlag"
:modal="showModal"
width="80%"
center
>
<el-row :gutter="20">
<!--设备数据-->
<el-col :span="24" :xs="24">
<el-form :model="queryParams" @submit.native.prevent ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="'车间编码'" prop="workshopCode">
<el-input
v-model="queryParams.workshopCode"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="'车间名称'" prop="workshopName">
<el-input
v-model="queryParams.workshopName"
clearable
style="width: 240px"
@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-table v-loading="loading" :data="machineryList" @current-change="handleCurrent" @row-dblclick="handleRowDbClick">
<el-table-column width="50" align="center" >
<template v-slot="scope">
<el-radio v-model="selectedMachineryId" :label="scope.row.workshopId" @change="handleRowChange(scope.row)">{{""}}</el-radio>
</template>
</el-table-column>
<el-table-column :label="'车间编码'" width = "120" align="center" key="workshopCode" prop="workshopCode">
</el-table-column>
<el-table-column :label="'车间名称'" min-width="120" align="left" key="workshopName" prop="workshopName" :show-overflow-tooltip="true" />
<el-table-column :label="'创建人'" min-width="120" align="left" key="createBy" prop="createBy" :show-overflow-tooltip="true" />
<el-table-column :label="'创建时间'" min-width="120" align="left" key="createTime" prop="createTime" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelect">确认</el-button>
<el-button @click="showFlag=false">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { listWorkshop } from "@/api/mes/md/workshop";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "MachinerySelectSingle",
dicts: ['sys_yes_no','mes_machinery_status'],
components: { Treeselect },
props: {
showModal: {
type: Boolean,
default: false
}
},
data() {
return {
showFlag: false,
// 遮罩层
loading: true,
// 选中数组
selectedMachineryId: undefined,
selectedRows: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 物料产品表格数据
machineryList: [],
// 弹出层标题
title: "",
// 设备类型树选项
machineryTypeOptions: [],
//车间选项
workshopOptions:[],
// 是否显示弹出层
open: false,
// 设备类型名称
machineryTypeName: undefined,
//自动生成物料编码标识
autoGenFlag: false,
// 表单参数
form: {},
defaultProps: {
children: "children",
label: "machineryTypeName"
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
workshopCode: null,
workshopName: null,
machineryBrand: null,
machinerySpec: null,
machineryTypeId: null,
machineryTypeCode: null,
machineryTypeName: null,
workshopId: null,
status: null
}
};
},
watch: {
// 根据设备分类名称筛选分类树
machineryTypeName(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getList();
},
methods: {
/** 查询物料编码列表 */
getList() {
this.loading = true;
listWorkshop(this.queryParams).then(response => {
this.machineryList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 转换设备类型数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.machineryTypeId,
label: node.machineryTypeName,
children: node.children
};
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.machineryTypeName.indexOf(value) !== -1;
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleCurrent(row){
if(row){
this.selectedRows = row;
}
},
//双击选中
handleRowDbClick(row){
if(row){
this.selectedRows = row;
this.$emit('onSelected',this.selectedRows);
this.showFlag = false;
}
},
// 单选选中数据
handleRowChange(row) {
if(row){
this.selectedRows = row;
}
},
//确定选中
confirmSelect(){
if(this.selectedMachineryId == null || this.selectedMachineryId == 0){
this.$notify({
title:'提示',
type:'warning',
message: '请至少选择一条数据!'
});
return;
}
this.$emit('onSelected',this.selectedRows);
this.showFlag = false;
}
}
};
</script>
\ No newline at end of file
<template>
<div class="mys-container 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="customerProjectNo">
<el-input v-model="queryParams.customerProjectNo" :placeholder="'请输入项目号'" />
</el-form-item>
<el-form-item :label="'订单号'" prop="orderCode">
<el-input v-model="queryParams.orderCode" :placeholder="'请输入订单号'" />
</el-form-item>
<el-form-item :label="'生产工单'" prop="workorderCode">
<el-input v-model="queryParams.workorderCode" :placeholder="'请输入生产工单'" />
</el-form-item>
<el-form-item :label="'产品编码'" prop="productCode">
<el-input v-model="queryParams.productCode" :placeholder="'请输入产品编码'" />
</el-form-item>
<el-form-item :label="'所属产线'" prop="lineName">
<el-input v-model="queryParams.lineName" :placeholder="'请输入'" />
</el-form-item>
<el-form-item :label="'工单状态'" prop="status">
<el-select v-model="queryParams.workOrderStatus" clearable multiple>
<el-option v-for="dict in dict.type.mes_workorder_status" :key="dict.value" :label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="'产品名称'" prop="productName">
<el-input v-model="queryParams.productName" >
<el-button slot="append" icon="el-icon-search" @click="$refs['ItemSelectRef'].showFlag = true" ></el-button>
</el-input>
</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 style="margin-bottom: 10px;">
<el-button type="primary" size="mini" @click="handleExport">{{'导出'}}</el-button>
</el-row>
<el-table v-loading="loading" :data="tbodys" @row-click="mainTableClick" :height="tableHeight" :row-class-name="tableRowClassName">
<el-table-column :label="'项目号'" align="center" prop="customerProjectNo"></el-table-column>
<el-table-column :label="'订单号'" align="center" prop="orderCode"></el-table-column>
<el-table-column :label="'生产工单'" align="center" prop="workorderCode"></el-table-column>
<el-table-column :label="'所属产线'" align="center" prop="lineName"></el-table-column>
<el-table-column :label="'工单状态'" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column :label="'工单类型'" align="center" prop="workorderType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_workorder_type" :value="scope.row.workorderType" />
</template>
</el-table-column>
<el-table-column :label="'产品编码'" align="center" prop="productCode"></el-table-column>
<el-table-column :label="'产品名称'" align="center" prop="productName"></el-table-column>
<el-table-column :label="'计划数量'" align="center" prop="quantity"></el-table-column>
<el-table-column :label="'完工数量'" align="center" prop="quantityProduced"></el-table-column>
<el-table-column :label="'在制进度'" align="center" prop="customerProjectNo">
<template slot-scope="scope">
<el-progress :text-inside="true" :stroke-width="26" :percentage="scope.row.quantityMu" />
</template>
</el-table-column>
<el-table-column :label="'需求时间'" align="center" prop="requestDate"></el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div class="second-box" v-if="isShowSecond">
<el-table v-loading="loadingLeft" :data="tbodysLeft" border @row-click="secondTableClick" :max-height="tableHeightSecond" :row-class-name="tableRowClassName1">
<el-table-column :label="'状态'" align="center" prop="status"></el-table-column>
<el-table-column :label="'工序名称'" align="center" prop="processName"></el-table-column>
<el-table-column :label="'派工数量'" align="center" prop="quantity"></el-table-column>
<el-table-column :label="'报工数量'" align="center" prop="quantityProduced">
</el-table-column>
<el-table-column :label="'合格数量'" align="center" prop="quantityQualify"></el-table-column>
<el-table-column :label="'不合格数量'" align="center" prop="quantityUnqualify"></el-table-column>
<el-table-column :label="'合格率'" align="center" prop="passRate">
<template slot-scope="scope">
{{scope.row.passRate ? `${scope.row.passRate}%` : ''}}
</template>
</el-table-column>
</el-table>
<el-table v-loading="loadingRight" :data="tbodysRight" border :max-height="tableHeightSecond" style="margin-left: 15px">
<el-table-column :label="'排产次数'" align="center" prop="taskBatch" >
<template slot-scope="scope">
{{scope.row.taskBatch.split('-').length > 1 ? scope.row.taskBatch.split('-')[scope.row.taskBatch.split('-').length - 1]: ''}}
</template>
</el-table-column>
<el-table-column :label="'报工人员'" align="center" prop="nickName"></el-table-column>
<el-table-column :label="'报工数量'" align="center" prop="quantityFeedback"></el-table-column>
<el-table-column :label="'合格数量'" align="center" prop="quantityQualify"></el-table-column>
<el-table-column :label="'不合格数量'" align="center" prop="quantityUnqualify">
</el-table-column>
<el-table-column :label="'标准工时'" align="center" prop="stdWorkingTime"></el-table-column>
<el-table-column :label="'实际工时'" align="center" prop="machineTime">
<template slot-scope="scope">
{{scope.row['machineTime'] ? Number(scope.row['machineTime']).toFixed(2) : scope.row['machineTime']}}
</template>
</el-table-column>
<el-table-column :label="'报工时间'" align="center" prop="feedbackTime"></el-table-column>
</el-table>
</div>
<ItemSelect ref="ItemSelectRef" @onSelected="onItemSelect"/>
</div>
</template>
<script>
import { getList, getFeedbackList, getProcessList } from "@/api/mes/proTable/productProcess";
import ItemSelect from "@/components/itemSelect/single.vue";
export default {
name: "ScheduleSetupRule",
components: {ItemSelect},
dicts: [
"mes_workorder_type",
"mes_workorder_status"
],
data() {
return {
loadingLeft: true,
loadingRight: true,
isShowSecond: false,
highlightRow: null, // 当前高亮的行
highlightRow1: null, // 当前高亮的行
tbodysLeft:[],
tbodysRight:[],
tableHeightSecond: 0,
tableHeight: 0,
// 遮罩层
loading: true,
selectedRows: [],
tabIndex: 0,
// 选中数组
ids: [],
//dta列表
dtaOptions: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 排产换型对照信息表格数据
tbodys: [],
theaders: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
daterangePurchaseDate: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
defectStatus: true,
workOrderStatus: [],
lineName: null,
"customerProjectNo": null,
"endDate": null,
"orderCode": null,
"processName": null,
"processCode": null,
"processId": null,
"productCode": null,
"productId": null,
"productName": null,
"startDate": null,
"taskCode": null,
"abnormalReason": null,
"workorderCode": null,
"workorderType": null,
"workshopId": null,
"workshopName": null,
"workstationId": null,
"workstationName": null,
"workunitId": null,
"workunitName": null
},
// 表单参数
form: {},
};
},
created() {
this.getList();
},
mounted(){
this.$nextTick(()=>{
this._resizeHandler()
})
this._resizeHandler = () => {
this.tableHeight = (window.innerHeight / 2) - 120
this.tableHeightSecond = (window.innerHeight / 2) - 100
}
window.addEventListener('resize', this._resizeHandler)
},
beforeDestroy() {
window.removeEventListener('resize', this._resizeHandler)
},
watch: {
},
methods: {
mainTableClick(row){
this.loadingLeft = true;
this.highlightRow = row;
getProcessList({workorderCode: row.workorderCode, taskWorkunitId: row.taskWorkunitId}).then(response => {
response.rows.forEach(element => {
element['workorderCode'] = row.workorderCode
});
this.tbodysLeft = response.rows
this.loadingLeft = false;
this.isShowSecond = true
});
this.secondTableClick(row)
},
secondTableClick(row) {
this.loadingRight = true;
this.highlightRow1 = row;
getFeedbackList({workorderCode: row.workorderCode, taskId: row.taskId, taskWorkunitId: row.taskWorkunitId}).then(response => {
this.tbodysRight = response.rows;
this.loadingRight = false;
});
},
onItemSelect(row) {
if (row != undefined) {
this.queryParams.productName = row.itemName;
}
},
tableRowClassName({ row, rowIndex }) {
if(!row.workorderId || !this.highlightRow) return ''
// 如果当前行是高亮行,则添加特定的类名
if (row.workorderId === this.highlightRow.workorderId) {
return 'highlight-row';
}
return '';
},
tableRowClassName1({ row, rowIndex }) {
// 如果当前行是高亮行,则添加特定的类名
if (row === this.highlightRow1) {
return 'highlight-row';
} if (row.status === '已完工') {
return 'green';
} if (row.status === '故障停工' || row.status === '暂停') {
return 'red';
} if (row.status === '加工中') {
return 'blue';
}
return '';
},
/** 查询排产换型对照信息列表 */
getList() {
this.loading = true;
this.queryParams['defectStatus'] = true
if (this.daterangePurchaseDate && this.daterangePurchaseDate.length > 0) {
this.queryParams['startDate'] = this.daterangePurchaseDate[0]
this.queryParams['endDate'] = this.daterangePurchaseDate[1]
}
getList(this.queryParams).then(response => {
this.tbodys = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
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(){
this.download(
'report/pro/workOrderProgress/getList/export',
{
...this.queryParams,
},
`productProcess_${new Date().getTime()}.xlsx`
);
}
}
};
</script>\
<style lang="scss" scoped>
.second-box{
display: flex;
}
.mys-container {
.pagination-container {
padding: 0px 20px !important;
}
::v-deep .highlight-row {
background-color: #e5eeff !important;
td {
background-color: #e5eeff !important;
}
}
::v-deep .green {
background-color: #aaf8aa !important;
td {
background-color: #aaf8aa !important;
}
}
::v-deep .blue {
background-color: #82ccf4 !important;
td {
background-color: #82ccf4 !important;
}
}
::v-deep .red {
background-color: #f48d82 !important;
td {
background-color: #f48d82 !important;
}
}
}
</style>
<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="workorderType">
<el-select v-model="queryParams.workorderType" clearable :placeholder="'请选择状态'" >
<el-option v-for="dict in dict.type.mes_workorder_type"
:key="dict.value"
:label="dict.label"
:value="dict.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="'项目号'" prop="customerProjectNo">
<el-input v-model="queryParams.customerProjectNo" :placeholder="'请输入项目号'" />
</el-form-item>
<el-form-item :label="'订单号'" prop="orderCode">
<el-input v-model="queryParams.orderCode" :placeholder="'请输入订单号'" />
</el-form-item>
<el-form-item :label="'生产工单'" prop="workorderCode">
<el-input v-model="queryParams.workorderCode" :placeholder="'请输入生产工单'" />
</el-form-item>
<el-form-item :label="'任务号'" prop="taskCode">
<el-input v-model="queryParams.taskCode" :placeholder="'请输入任务号'" />
</el-form-item>
<el-form-item :label="'产品编码'" prop="productCode">
<el-input v-model="queryParams.productCode" :placeholder="'请输入产品编码'" />
</el-form-item>
<el-form-item :label="'产品名称'" prop="productName">
<el-input v-model="queryParams.productName" >
<el-button slot="append" icon="el-icon-search" @click="$refs['ItemSelectRef'].showFlag = true" ></el-button>
</el-input>
</el-form-item>
<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="'报工人员'" prop="workunitId">
<el-input v-model="queryParams.nickName">
<el-button
slot="append"
icon="el-icon-search"
@click="$refs.userSelect.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="3">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{'查询'}}</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">
<el-table-column :label="item.label" align="center" :prop="item.value" v-for="(item, index) in theaders1" :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-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>
<UserSingleSelect ref="userSelect" showModal @onSelected="onUserSelected"></UserSingleSelect>
</div>
</template>
<script>
import dayjs from 'dayjs'
import { getList, getListByProcess, getListByUser, getListByWorkshop, getListByWorkOrder, getListByWorkstation, getListByWorkunit } from "@/api/mes/proTable/statistAnaly";
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 UserSingleSelect from "@/components/userSelect/single1.vue"
export default {
name: "ScheduleSetupRule",
components: {UserSingleSelect,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,
statisisList: ['工单', '车间', '工作中心', '工作单元', '工序', '人员'],
// 是否显示弹出层
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,
"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
console.log('this.tabIndex', this.tabIndex)
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: 'workorderType', width: '80px'},
{label: '项目号', value: 'customerProjectNo', width: '80px'},
{label: '订单号', value: 'orderCode', width: '80px'},
{label: '生产工单', value: 'workorderCode', width: '140px'},
{label: '产品编码', value: 'productCode', width: '120px'},
{label: '产品名称', value: 'productName', width: '240px'},
{label: '工序任务', value: 'taskCode', width: '120px'},
{label: '工序名称', value: 'processName', width: '80px'},
{label: '工作中心编码', value: 'workstationCode', width: '100px'},
{label: '工作中心名称', value: 'workstationName', width: '140px'},
{label: '工作单元编码', value: 'workunitCode', width: '100px'},
{label: '工作单元名称', value: 'workunitName', width: '280px'},
{label: '报工人员编码', value: 'userName', width: '140px'},
{label: '报工人员名称', value: 'nickName', width: '140px'},
{label: '派工数量', value: 'quantity', width: '80px'},
{label: '报工数量', value: 'quantityFeedback', width: '80px'},
{label: '合格数量', value: 'quantityQualify', width: '80px'},
{label: '不合格数量', value: 'quantityUnqualify', width: '90px'},
{label: '不合格原因', value: 'abnormalReason', width: '90px'},
{label: '标准工时', value: 'stdWorkingTime', width: '80px'},
{label: '实际工时', value: 'machineTime', width: '80px'},
{label: '计划完成时间', value: 'scheduleEndDate', width: '100px'},
{label: '报工时间', value: 'feedbackTime', width: '100px'}
]
this.handleQuery()
}
},
immediate: true
}
},
methods: {
onUserSelected(row){
if (row != undefined) {
console.log('rrr', row)
this.queryParams.nickName = row.nickName;
}
},
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() {
this.loading = true;
if (this.daterangePurchaseDate && this.daterangePurchaseDate.length > 0) {
this.queryParams['startDate'] = this.daterangePurchaseDate[0]
this.queryParams['endDate'] = this.daterangePurchaseDate[1]
} else {
this.queryParams['startDate'] = null
this.queryParams['endDate'] = null
}
let api = getList
if (Number(this.tabIndex) === 1) {
if(this.statisisType === '工单'){
api = getListByWorkOrder
this.theaders1 = [
{label: '工单编码', value: 'workorderCode'},
{label: '工单名称', value: 'workorderName'},
{label: '报工数量', value: 'quantityFeedback'},
{label: '合格数量', value: 'quantityQualify'},
{label: '不合格数量', value: 'quantityUnqualify'},
{label: '合格率', value: 'qualificationRate'}
]
} else if(this.statisisType === '车间'){
this.theaders1 = [
{label: '车间编号', value: 'workshopCode'},
{label: '车间名称', value: 'workshopName'},
{label: '报工数量', value: 'quantityFeedback'},
{label: '合格数量', value: 'quantityQualify'},
{label: '不合格数量', value: 'quantityUnqualify'},
{label: '合格率', value: 'qualificationRate'}
]
api = getListByWorkshop
} else if(this.statisisType === '工作中心'){
this.theaders1 = [
{label: '工作中心编号', value: 'workstationCode'},
{label: '工作中心名称', value: 'workstationName'},
{label: '报工数量', value: 'quantityFeedback'},
{label: '合格数量', value: 'quantityQualify'},
{label: '不合格数量', value: 'quantityUnqualify'},
{label: '合格率', value: 'qualificationRate'}
]
api = getListByWorkstation
} else if(this.statisisType === '工作单元'){
this.theaders1 = [
{label: '工作单元编码', value: 'workunitCode'},
{label: '工作单元名称', value: 'workunitName'},
{label: '报工数量', value: 'quantityFeedback'},
{label: '合格数量', value: 'quantityQualify'},
{label: '不合格数量', value: 'quantityUnqualify'},
{label: '合格率', value: 'qualificationRate'}
]
api = getListByWorkunit
} else if(this.statisisType === '工序'){
this.theaders1 = [
{label: '工序编码', value: 'processCode'},
{label: '工序名称', value: 'processName'},
{label: '报工数量', value: 'quantityFeedback'},
{label: '合格数量', value: 'quantityQualify'},
{label: '不合格数量', value: 'quantityUnqualify'},
{label: '合格率', value: 'qualificationRate'}
]
api = getListByProcess
} else if(this.statisisType === '人员'){
this.theaders1 = [
{label: '报工人员编码', value: 'userName'},
{label: '报工人员名称', value: 'nickName'},
{label: '报工数量', value: 'quantityFeedback'},
{label: '合格数量', value: 'quantityQualify'},
{label: '不合格数量', value: 'quantityUnqualify'},
{label: '合格率', value: 'qualificationRate'}
]
api = getListByUser
}
}
api(this.queryParams).then(response => {
if (Number(this.tabIndex) === 1) {
this.tbodys1 = response.rows
}
else {
this.tbodys = response.rows
}
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
if (Number(this.tabIndex) === 1 && !this.statisisType) this.$modal.msgWarnning('请选择统计方式');
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/getListByWorkshop/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/getListByUser/export'
} else if(this.statisisType === '工单') {
apiName = 'report/pro/feedback/getListByWorkOrder/export'
}
this.download(
apiName,
{
...this.queryParams,
},
`statistAnaly_${new Date().getTime()}.xlsx`
);
}
}
};
</script>
\ No newline at end of file
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