入库检验

This commit is contained in:
qianhao.xu
2024-04-19 09:54:55 +08:00
parent b736e1a694
commit 5fa96ab554
2 changed files with 120 additions and 54 deletions

View File

@@ -1,14 +1,5 @@
<!--
* @Descripttion: (成品入库检验/wm_fgentry_inspect)
* @version: (1.0)
* @Author: (admin)
* @Date: (2024-04-17)
* @LastEditors: (admin)
* @LastEditTime: (2024-04-17)
-->
<template>
<div class="app-container">
<!-- :model属性用于表单验证使用 比如下面的el-form-item prop属性用于对表单值进行验证操作 -->
<el-form :model="queryParams" size="small" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
<el-form-item label="工单号">
<el-input v-model="queryParams.workorder"></el-input>
@@ -47,24 +38,14 @@
</el-form-item>
</el-form>
<!-- 一级菜单区 -->
<el-table
:data="firstLevel_dataList"
v-loading="loading"
ref="table"
border
highlight-current-row
@sort-change="sortChange"
@selection-change="handleSelectionChange"
>
<el-table :data="firstLevel_dataList" v-loading="loading" ref="table" border highlight-current-row>
<!-- <el-table-column prop="id" label="主键" align="center" /> -->
<el-table-column prop="workorder" label="工单号" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="productionNum" label="箱子里产品个数" align="center" />
<el-table-column prop="partnumber" label="零件号" align="center" :show-overflow-tooltip="true" />
<el-table-column label="检验结果" align="center">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.result == 1">检验合格</el-tag>
<el-tag type="danger" v-else-if="scope.result == 2">检验不合格</el-tag>
<el-tag type="info" v-else>未检</el-tag>
<el-progress width="100" type="circle" :percentage="calculate_percentage(scope.row.result_good, scope.row.result_bad,scope.row.result_null)"></el-progress>
</template>
</el-table-column>
<el-table-column label="检验" align="center" width="140">
@@ -83,7 +64,7 @@
<pagination
class="mt10"
background
:total="total"
:total="queryParams.total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="firstLevel_dataList"
@@ -94,10 +75,15 @@
<!-- 工具区 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="success" plain @click="handleAdd">合格</el-button>
<el-button type="success" plain @click="batchQualified">批量合格</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain @click="handleAdd">不合格</el-button>
<el-button type="danger" plain @click="batchUnqualified">批量不合格</el-button>
</el-col>
<el-col :span="10" :offset="6">
本页合格率
<el-progress :text-inside="true" :stroke-width="24" :percentage="percentage" status="success"></el-progress>
</el-col>
</el-row>
@@ -107,8 +93,8 @@
ref="table"
border
highlight-current-row
@sort-change="sortChange"
@selection-change="handleSelectionChange"
v-loading="second_loading"
>
<el-table-column type="selection" width="50" align="center" label="合格" />
<el-table-column prop="workorder" label="工单号" align="center" width="150" :show-overflow-tooltip="true" />
@@ -117,30 +103,25 @@
<el-table-column prop="productionNum" label="箱子里产品个数" align="center" />
<el-table-column prop="partnumber" label="零件号" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="bfilled" label="是否满箱" align="center" />
<el-table-column prop="result" label="检验结果" align="center">
<el-table-column label="检验结果" align="center">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.result == 1">检验合格</el-tag>
<el-tag type="danger" v-else-if="scope.result == 2">检验不合格</el-tag>
<el-tag type="success" v-if="scope.row.result == 1">合格</el-tag>
<el-tag type="danger" v-else-if="scope.row.result == 2">不合格</el-tag>
<el-tag type="info" v-else>未检</el-tag>
</template>
</el-table-column>
<!-- <el-table-column prop="createdBy" label="创建人" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="createdTime" label="创建时间" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="updatedBy" label="更新人" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="updatedTime" label="更新时间" align="center" :show-overflow-tooltip="true" /> -->
</el-table>
<pagination
class="mt10"
background
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList_first"
:total="second_queryParams.total"
:page.sync="second_queryParams.pageNum"
:limit.sync="second_queryParams.pageSize"
@pagination="getList_second"
/>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="text" @click="confirm"> </el-button>
<el-button type="primary" @click="confirm"> </el-button>
</div>
</el-dialog>
</div>
@@ -150,6 +131,8 @@ import {
listWmFgentryInspect,
listWmFgentryInspect_firstLevel,
listWmFgentryInspect_secondLevel,
setTheBoxToBeQualified,
setTheBoxToBeUnQualified,
addWmFgentryInspect,
delWmFgentryInspect,
updateWmFgentryInspect,
@@ -190,13 +173,14 @@ export default {
labelWidth: '100px',
formLabelWidth: '100px',
// 选中id数组
ids: [],
packcode_select: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 遮罩层
loading: false,
second_loading: false,
// 显示搜索条件
showSearch: true,
// 查询参数
@@ -210,6 +194,8 @@ export default {
pageSize: 10,
sort: undefined,
sortType: undefined,
// 总记录数
total: 0,
},
second_queryParams: {
workorder: '',
@@ -217,6 +203,8 @@ export default {
packcode: '',
pageNum: 1,
pageSize: 10,
// 总记录数
total: 0,
},
// 弹出层标题
title: '',
@@ -243,8 +231,7 @@ export default {
// 一级 数据列表
firstLevel_dataList: [],
secondLevel_dataList: [],
// 总记录数
total: 0,
// 提交按钮是否显示
btnSubmitVisible: true,
// 表单校验
@@ -256,13 +243,27 @@ export default {
open: false,
},
full_loading: null,
workorder_selected: '',
percentage: 0,
}
},
created() {
// 列表数据查询
this.getList_first()
},
computed: {
},
methods: {
calculate_percentage(result_good, result_bad,result_null) {
if (result_good + result_bad == 0) {
return 0
}
console.log("result_good",result_good)
console.log("result_bad",result_bad)
console.log("result_null",result_null)
return Math.floor((result_good / (result_good + result_bad+result_null)) * 100)
},
//todo 一级菜单调 二级
handle_secondLevel(workorder) {
this.first_level.open = true
@@ -273,44 +274,86 @@ export default {
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
this.workorder_selected = workorder
// 获取二级菜单目录
this.getList_second(workorder)
},
// 获取一级菜单目录
//todo 获取一级菜单目录
getList_first() {
this.loading = true
listWmFgentryInspect_firstLevel(this.queryParams).then((res) => {
if (res.code == 200) {
this.firstLevel_dataList = res.data.result
this.total = res.data.totalNum
this.queryParams.total = res.data.totalNum
this.loading = false
}
})
},
// 获取二级菜单目录
getList_second(workorder) {
getList_second() {
this.full_loading.close()
this.loading = true
this.second_queryParams.workorder = workorder
this.second_loading = true
this.second_queryParams.workorder = this.workorder_selected
listWmFgentryInspect_secondLevel(this.second_queryParams).then((res) => {
if (res.code == 200) {
this.secondLevel_dataList = res.data.result
this.total = res.data.totalNum
this.loading = false
this.second_queryParams.total = res.data.totalNum
this.second_loading = false
this.calculateQualificationRate()
}
})
},
// 取消按钮
cancel() {
this.first_level.open = false
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
this.packcode_select = selection.map((item) => item.packcode)
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList_first()
},
// 重置查询操作
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
//todo 批量合格
batchQualified() {
if (this.packcode_select.length > 0) {
const query = this.packcode_select
setTheBoxToBeQualified(query).then((res) => {
if (res.code == 200) {
this.getList_second(this.workorder_selected)
}
})
}
},
//todo 批量不合格
batchUnqualified() {
if (this.packcode_select.length > 0) {
const query = this.packcode_select
setTheBoxToBeUnQualified(query).then((res) => {
if (res.code == 200) {
this.getList_second(this.workorder_selected)
}
})
}
},
//todo 计算合格率
calculateQualificationRate() {
let qualifiedQuantity = this.secondLevel_dataList.filter((it) => it.result == 1).length
let qualifiedUnQuantity = this.secondLevel_dataList.filter((it) => it.result == 2).length
if (qualifiedQuantity + qualifiedUnQuantity != 0) {
this.percentage = Math.floor((qualifiedQuantity / (qualifiedQuantity + qualifiedUnQuantity)) * 100)
}
},
confirm() {
this.first_level.open = false
this.getList_first()
},
},
}
</script>