1.添加原材料入库相关代码

2.修改质量统计页面样式
This commit is contained in:
赵正易
2024-02-23 18:21:02 +08:00
parent 93bc4cb5c6
commit 62b80fda72
4 changed files with 676 additions and 69 deletions

View File

@@ -0,0 +1,26 @@
import request from '@/utils/request'
import { downFile } from '@/utils/request'
export function getMaterialReceiptList(query) {
return request({
url: '/mes/wm/mrt/getMaterialReceiptList',
method: 'get',
params: query,
})
}
export function saveOneMaterialReceipt(data) {
return request({
url: '/mes/wm/mrt/saveOneMaterialReceipt',
method: 'post',
data: data,
})
}
export function savePageMaterialReceipts(data) {
return request({
url: '/mes/wm/mrt/savePageMaterialReceipts',
method: 'post',
data: data,
})
}

View File

@@ -2,40 +2,45 @@
<div class="app-container">
<!-- 搜索部分 -->
<div>
<el-form :model="search" inline>
<el-form :model="search" inline size="mini" label-width="80px">
<el-form-item label="开始日期">
<el-date-picker v-model="search.starttime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions">
<el-date-picker :style="{width:inputWidth}" v-model="search.starttime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item label="结束日期">
<el-date-picker v-model="search.endtime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions">
<el-date-picker :style="{width:inputWidth}" v-model="search.endtime" type="datetime" placeholder="选择日期时间" align="right" :picker-options="pickerOptions">
</el-date-picker>
</el-form-item>
<el-form-item label="工单号">
<el-input v-model="search.workorderid" placeholder="输入工单号"></el-input>
<el-input v-model="search.workorderid" placeholder="输入工单号" :style="{width:inputWidth}"></el-input>
</el-form-item>
<el-form-item label="零件号">
<el-input v-model="search.partnumber" placeholder="输入零件号"></el-input>
<el-input v-model="search.partnumber" placeholder="输入零件号" :style="{width:inputWidth}"></el-input>
</el-form-item>
<el-form-item label="产品描述">
<el-input v-model="search.product_description" placeholder="输入产品描述"></el-input>
<el-input v-model="search.product_description" placeholder="输入产品描述" :style="{width:inputWidth}"></el-input>
</el-form-item>
<el-form-item label="班组">
<el-select v-model="search.team" placeholder="输入班组">
<el-select v-model="search.team" placeholder="输入班组" :style="{width:inputWidth}">
<el-option label="A班" value="A"> </el-option>
<el-option label="B班" value="B"> </el-option>
<el-option label="" value=""> </el-option>
</el-select>
</el-form-item>
<el-form-item label="报表类型">
<el-select v-model="search.reportType" placeholder="请选择">
<el-select v-model="search.reportType" placeholder="请选择" :style="{width:inputWidth}">
<el-option v-for="item in reportType_options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</el-form-item>
<el-button type="primary" icon="el-icon-search" @click="getList">搜索</el-button>
<el-button type="warning">EXCEL导出</el-button>
<el-form-item label=" ">
<el-button size="mini" type="primary" icon="el-icon-search" @click="getList">搜索</el-button>
<el-button size="mini" type="warning" @click="exportDataEvent">EXCEL导出</el-button>
</el-form-item>
</el-form>
</div>
<div style="width: 100%;display: flex;justify-content: flex-end;">
<pagination :pageSizes="[6,60,120,300]" :total="pagination.total" :page.sync="pagination.pageNum" :limit.sync="pagination.pageSize" @pagination="getList" />
</div>
<div style="width: 100%">
<div style="font-size: 20px;text-align: center; margin 0 auto">{{ reportType_options[search.reportType].label }}</div>
</div>
@@ -47,75 +52,140 @@
:header-cell-style="headerCellStyle"
ref="xTable"
:column-config="{ resizable: true }"
:row-config="{ isHover: true }"
v-loading="loading"
:row-config="{ isHover: true,isCurrent:true,height:20 }"
:loading="loading"
:data="QualityStatisticsTable"
:merge-cells="mergeCells"
:cell-style="cellStyle"
size="mini"
align="center"
max-height="800px"
:export-config="{}"
>
<vxe-colgroup title="订单信息" align="center">
<vxe-column field="workorderId" title="工单号"></vxe-column>
<vxe-column field="finishedPartNumber" title="零件号"></vxe-column>
<vxe-column field="productDescription" title="描述"></vxe-column>
<vxe-column field="requireNumber" title="生产投入数"></vxe-column>
<vxe-colgroup title="订单信息" align="center" fixed="left">
<vxe-column field="workorderId" title="工单号" width="120px"></vxe-column>
<vxe-column field="finishedPartNumber" title="零件号" min-width="80px" :show-overflow="false"></vxe-column>
<vxe-column field="productDescription" title="描述" min-width="100px" :show-overflow="false"></vxe-column>
<vxe-column field="requireNumber" title="生 产 投 入 数" min-width="60px"></vxe-column>
<vxe-column field="team" title="班次"></vxe-column>
<vxe-column field="qualifiedNumber" title="合格数"></vxe-column>
<vxe-column title="合格率">
<template #default="{ row }"> {{ row.qualifiedRate }}% </template>
<vxe-column field="qualifiedNumber" title="合 格 数" min-width="60px"></vxe-column>
<vxe-column title="合格率" min-width="70px">
<template #default="{ row }"> {{ offsetRate(row.qualifiedRate) }}% </template>
</vxe-column>
<vxe-column field="paoguangTotal" title="抛光总数"></vxe-column>
<vxe-column field="damoTotal" title="打磨总数"></vxe-column>
<vxe-column field="baofeiTotal" title="报废总数"></vxe-column>
<vxe-column field="startTime" title="开始时间"></vxe-column>
<vxe-column field="endTime" title="结束时间"></vxe-column>
<vxe-column field="remark" title="备注" width="80"></vxe-column>
<vxe-column field="paoguangTotal" title="抛光总数" min-width="60px"></vxe-column>
<vxe-column field="damoTotal" title="打磨总数" min-width="60px"></vxe-column>
<vxe-column field="baofeiTotal" title="报废总数" min-width="60px"></vxe-column>
<vxe-column field="startTime" title="开始时间" min-width="120px" :show-overflow="false"></vxe-column>
<vxe-column field="endTime" title="结束时间" min-width="120px" :show-overflow="false"></vxe-column>
<vxe-column field="remark" title="备注" width="60px"></vxe-column>
</vxe-colgroup>
<vxe-colgroup title="油漆" align="center">
<vxe-column field="paintSuokong" title="缩孔"></vxe-column>
<vxe-column field="paintZhengkong" title="针孔"></vxe-column>
<vxe-column field="paintShiguang" title="失光"></vxe-column>
<vxe-column field="paintSecha" title="色差"></vxe-column>
<vxe-column field="paintDianzi" title="点子"></vxe-column>
<vxe-column field="paintOther" title="其他"></vxe-column>
<vxe-column field="paintSuokong" title="缩 孔" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.paintSuokong) }}</template>
</vxe-column>
<vxe-column field="paintZhengkong" title="针 孔" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.paintZhengkong) }}</template>
</vxe-column>
<vxe-column field="paintShiguang" title="失 光" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.paintShiguang) }}</template>
</vxe-column>
<vxe-column field="paintSecha" title="色 差" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.paintSecha) }}</template>
</vxe-column>
<vxe-column field="paintDianzi" title="点 子" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.paintDianzi) }}</template>
</vxe-column>
<vxe-column field="paintOther" title="其 他" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.paintOther) }}</template>
</vxe-column>
</vxe-colgroup>
<vxe-colgroup title="设备" align="center">
<vxe-column field="deviceShuiban" title="水斑"></vxe-column>
<vxe-column field="deviceZandian" title="脏点"></vxe-column>
<vxe-column field="deviceBianxing" title="变形"></vxe-column>
<vxe-column field="deviceYouzhu" title="油珠"></vxe-column>
<vxe-column field="deviceTuoluo" title="脱落"></vxe-column>
<vxe-column field="deviceZhuangshang" title="撞伤"></vxe-column>
<vxe-column field="deviceOther" title="其他"></vxe-column>
<vxe-column field="deviceShuiban" title="水 斑" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.deviceShuiban) }}</template>
</vxe-column>
<vxe-column field="deviceZandian" title="脏 点" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.deviceZandian) }}</template>
</vxe-column>
<vxe-column field="deviceBianxing" title="变 形" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.deviceBianxing) }}</template>
</vxe-column>
<vxe-column field="deviceYouzhu" title="油 珠" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.deviceYouzhu) }}</template>
</vxe-column>
<vxe-column field="deviceTuoluo" title="脱 落" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.deviceTuoluo) }}</template>
</vxe-column>
<vxe-column field="deviceZhuangshang" title="撞 伤" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.deviceZhuangshang) }}</template>
</vxe-column>
<vxe-column field="deviceOther" title="其 他" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.deviceOther) }}</template>
</vxe-column>
</vxe-colgroup>
<vxe-colgroup title="毛坯" align="center">
<vxe-column field="blankMaoci" title="毛刺"></vxe-column>
<vxe-column field="blankSuoyin" title="缩印"></vxe-column>
<vxe-column field="blankCanshuang" title="擦伤"></vxe-column>
<vxe-column field="blankShaying" title="砂印"></vxe-column>
<vxe-column field="blankZangdian" title="脏点"></vxe-column>
<vxe-column field="blankDamo" title="打磨"></vxe-column>
<vxe-column field="blankMaoci" title="毛 刺" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.blankMaoci) }}</template>
</vxe-column>
<vxe-column field="blankSuoyin" title="缩 印" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.blankSuoyin) }}</template>
</vxe-column>
<vxe-column field="blankCanshuang" title="擦 伤" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.blankCanshuang) }}</template>
</vxe-column>
<vxe-column field="blankShaying" title="砂 印" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.blankShaying) }}</template>
</vxe-column>
<vxe-column field="blankZangdian" title="脏 点" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.blankZangdian) }}</template>
</vxe-column>
<vxe-column field="blankDamo" title="打 磨" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.blankDamo) }}</template>
</vxe-column>
</vxe-colgroup>
<vxe-colgroup title="程序" align="center">
<vxe-column field="programLiuguang" title="流挂"></vxe-column>
<vxe-column field="programSeqiqueqi" title="色漆缺漆"></vxe-column>
<vxe-column field="programQingqiqueqi" title="清漆缺漆"></vxe-column>
<vxe-column field="programJupi" title="桔皮"></vxe-column>
<vxe-column field="programOther" title="其他"></vxe-column>
<vxe-column field="programLiuguang" title="流 挂" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.programLiuguang) }}</template>
</vxe-column>
<vxe-column field="programSeqiqueqi" title="色 漆 缺 漆" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.programSeqiqueqi) }}</template>
</vxe-column>
<vxe-column field="programQingqiqueqi" title="清 漆 缺 漆" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.programQingqiqueqi) }}</template>
</vxe-column>
<vxe-column field="programJupi" title="桔 皮" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.programJupi) }}</template>
</vxe-column>
<vxe-column field="programOther" title="其 他" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.programOther) }}</template>
</vxe-column>
</vxe-colgroup>
<vxe-colgroup title="班组操作" align="center">
<vxe-column field="teamTuoluocanshuang" title="脱落擦伤"></vxe-column>
<vxe-column field="teamQingqiqikuai" title="清漆漆块"></vxe-column>
<vxe-column field="teamSeqiqikuai" title="色漆漆块"></vxe-column>
<vxe-column field="teamFahua" title="发花"></vxe-column>
<vxe-column field="teamLiangbang" title="亮斑"></vxe-column>
<vxe-column field="teamPenglou" title="喷漏"></vxe-column>
<vxe-column field="teamTuoluocanshuang" title="脱 落 擦 伤" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.teamTuoluocanshuang) }}</template>
</vxe-column>
<vxe-column field="teamQingqiqikuai" title="清 漆 漆 块" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.teamQingqiqikuai) }}</template>
</vxe-column>
<vxe-column field="teamSeqiqikuai" title="色 漆 漆 块" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.teamSeqiqikuai) }}</template>
</vxe-column>
<vxe-column field="teamFahua" title="发 花" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.teamFahua) }}</template>
</vxe-column>
<vxe-column field="teamLiangbang" title="亮 斑" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.teamLiangbang) }}</template>
</vxe-column>
<vxe-column field="teamPenglou" title="喷 漏" min-width="60px">
<template #default="{ row }"> {{ offsetValue(row.teamPenglou) }}</template>
</vxe-column>
</vxe-colgroup>
</vxe-table>
<pagination :total="pagination.total" :page.sync="pagination.pageNum" :limit.sync="pagination.pageSize" @pagination="getList" />
</div>
</template>
@@ -130,6 +200,7 @@ export default {
name: 'qualityStatistics',
data() {
return {
inputWidth:'180px',
pickerOptions: {
shortcuts: [
{
@@ -174,9 +245,9 @@ export default {
pagination: {
total: 0,
pageNum: 1,
pageSize: 10,
pageSize: 60,
},
loading: true,
loading: false,
QualityStatisticsTable: [],
mergeCells: [
// { row: 0, col: 0, rowspan: 3, colspan: 0 },
@@ -220,6 +291,10 @@ export default {
//todo 获取统计数据
getList() {
this.loading = true;
setTimeout(()=>{
this.loading = false;
},30000)
let query = { ...this.search, ...this.pagination }
delete query['reportType']
delete query['total']
@@ -228,40 +303,40 @@ export default {
case 0:
GetQualityStatisticsTable_first(query).then((res) => {
if (res.code == 200) {
this.loading = false
this.QualityStatisticsTable = res.data.item1
this.pagination.total = res.data.item2
this.pagination.total = parseInt(res.data.item2/3)
this.mergeTable(3)
this.loading = false
}
})
break
case 1:
GetQualityStatisticsTable_again(query).then((res) => {
if (res.code == 200) {
this.loading = false
this.QualityStatisticsTable = res.data.item1
this.pagination.total = res.data.item2
this.pagination.total = parseInt(res.data.item2/2)
this.mergeTable(2)
this.loading = false
}
})
break
case 2:
GetQualityStatisticsTable_final(query).then((res) => {
if (res.code == 200) {
this.loading = false
this.QualityStatisticsTable = res.data.item1
this.pagination.total = res.data.item2
this.pagination.total = parseInt(res.data.item2/2)
this.mergeTable(2)
this.loading = false
}
})
break
case 3:
GetQualityStatisticsTable_total(query).then((res) => {
if (res.code == 200) {
this.loading = false
this.QualityStatisticsTable = res.data.item1
this.pagination.total = res.data.item2
this.pagination.total = parseInt(res.data.item2/2)
this.mergeTable(2)
this.loading = false;
}
})
break
@@ -273,15 +348,41 @@ export default {
return {
backgroundColor: '#2D3D51',
color: '#ffffff',
border:'1px solid #161823',
fontSize:'18px'
}
},
cellStyle() {
return {
border:'1px solid #161823',
fontSize:'16px',
fontWeight:'700'
}
},
//todo 导出excel
exportDataEvent() {
this.$refs.xTable1.exportData({ type: 'csv' })
this.$refs.xTable.openExport()
},
// 合格率去除小数
offsetRate(num){
if(num === null){
return "";
}
return parseInt(num);
},
// 数据去除0
offsetValue(num){
if(num === 0||num === '0'){
return "";
}
return num;
}
},
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,240 @@
<template>
<div class="app-container">
<div>
<el-form :model="search" inline size="mini">
<el-form-item label="">
<el-date-picker v-model="search.year" type="year" :clearable="false" placeholder="选择年">
</el-date-picker>
</el-form-item>
<el-form-item label="">
<el-input v-model="search.week" placeholder="输入周">
<template slot="prepend"></template>
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="日期">
<el-button-group>
<el-button :type="search.date===1?'primary':''" @click="searchDate(1)">周一</el-button>
<el-button :type="search.date===2?'primary':''" @click="searchDate(2)">周二</el-button>
<el-button :type="search.date===3?'primary':''" @click="searchDate(3)">周三</el-button>
<el-button :type="search.date===4?'primary':''" @click="searchDate(4)">周四</el-button>
<el-button :type="search.date===5?'primary':''" @click="searchDate(5)">周五</el-button>
<el-button :type="search.date===6?'primary':''" @click="searchDate(6)">周六</el-button>
<el-button :type="search.date===7?'primary':''" @click="searchDate(7)">周日</el-button>
</el-button-group>
</el-form-item>
</el-form>
</div>
<div style="margin-bottom: 10px;">
<el-button size="mini" type="primary" @click="getTableData()">查询</el-button>
<el-button size="mini" v-loading="saveLoading" type="success" @click="saveAllRow()">保存当前页</el-button>
</div>
<vxe-table v-loading="tableLoading" :data="tableData" align="center" stripe border :edit-config="{trigger: 'click', mode: 'cell', icon: 'vxe-icon-edit'}">
<vxe-column type="seq" title="编号" width="55"></vxe-column>
<vxe-column field="blankNumber" title="毛坯号" min-width="120"></vxe-column>
<vxe-column field="productDescription" title="产品" min-width="120"></vxe-column>
<vxe-column field="colour" title="颜色" min-width="120"></vxe-column>
<vxe-column field="specifications" title="规格" min-width="60"></vxe-column>
<vxe-column field="previousNumber" title="目标应收" min-width="60"></vxe-column>
<vxe-column field="actualNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="实收" min-width="60">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.actualNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="sampleNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="抽检数" min-width="80">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.sampleNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="qualifiedNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="合格数" min-width="80">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.qualifiedNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="passRate" title="合格率(%)" min-width="60">
<template #default="{ row }">
{{handlerPassRate(row)}}
</template>
</vxe-column>
<vxe-colgroup title="仓库" min-width="180">
<vxe-column field="warehouseNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="仓库号" min-width="80">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.warehouseNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="shelfNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="货架号" min-width="60">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.shelfNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="layerNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="层号" min-width="60">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.layerNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="locationNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="库位号" min-width="60">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.locationNumber"></vxe-input>
</template>
</vxe-column>
</vxe-colgroup>
<vxe-column title="状态" min-width="80">
<template #default="{ row }">
<el-tag v-if="row.status===1" type="info">合格</el-tag>
<el-tag v-else-if="row.status===2" type="info">不合格</el-tag>
<el-tag v-else type="info">未入库</el-tag>
</template>
</vxe-column>
<vxe-column title="操作" fixed="right" min-width="80">
<template #default="{ row }">
<el-button v-loading="saveLoading" size="small" type="primary" @click="saveRow(row)">保存</el-button>
</template>
</vxe-column>
</vxe-table>
<pagination :total="pagination.total" :page.sync="pagination.pageNum" :limit.sync="pagination.pageSize" @pagination="getTableData" />
</div>
</template>
<script>
import { getMaterialReceiptList, saveOneMaterialReceipt, savePageMaterialReceipts } from '@/api/warehouseManagement/material_receipt.js';
export default {
name: 'material_receipt',
data() {
return {
tableLoading: false,
saveLoading:false,
operator: '',
search: {
year: new Date(),
week: 1,
date: new Date().getDay(),
},
pagination: {
pageNum: 1,
pageSize: 50,
total: 0,
},
tableData: [],
}
},
mounted() {
this.init()
},
methods: {
init() {
this.operator = this.$store.getters.userinfo?.userName;
this.getTableData();
},
// 获取表格数据
getTableData() {
this.tableLoading = true;
setTimeout(()=>{
this.tableLoading = false;
},30000);
let intYear = null;
try {
intYear = this.search.year.getFullYear() * 1;
} catch (e) {
this.$message.warning("年份输入有误!");
}
const query = {
year: intYear,
week: this.search.week * 1,
date: this.search.date,
...this.pagination
};
getMaterialReceiptList(query).then(res => {
if (res.code === 200) {
this.tableData = res.data.item1
this.pagination.total = res.data.item2
}
}).catch(() => {
this.tableData = []
this.pagination.total = 0
}).finally(() => {
this.tableLoading = false;
})
},
// 日期查询数据
searchDate(item) {
this.search.date = item
this.getTableData()
},
// 保存行
saveRow(row) {
this.saveLoading = true;
setTimeout(()=>{
this.saveLoading = false;
},30000);
let saveData = row;
saveData.operator = this.operator;
saveOneMaterialReceipt(saveData).then((res)=>{
if (res.code === 200) {
this.$message.success(res.data);
}else{
this.$message.error(res.data);
console.log('saveOneMaterialReceipt',res.msg);
}
}).finally(()=>{
this.saveLoading = false;
this.getTableData();
})
},
saveAllRow() {
this.saveLoading = true;
setTimeout(()=>{
this.saveLoading = false;
},30000);
let saveList = JSON.parse(JSON.stringify(this.tableData));
for(let item of saveList){
item.operator = this.operator;
}
const data = {
list:saveList
}
console.log(data);
savePageMaterialReceipts(saveList).then((res)=>{
if (res.code === 200) {
this.$message.success(res.data);
}else{
this.$message.error(res.data);
console.log('savePageMaterialReceipts',res.msg);
}
}).finally(()=>{
this.saveLoading = false;
this.getTableData();
})
},
// 合格率计算
handlerPassRate(row) {
try {
// 抽检数
let sampleNumber = row.sampleNumber;
// 合格数
let qualifiedNumber = row.qualifiedNumber;
if(sampleNumber === null || qualifiedNumber === null){
return 0;
}
if (sampleNumber === 0) {
return 0;
}
let passRate = parseInt((qualifiedNumber / sampleNumber) * 100);
if (typeof (passRate) == NaN) {
return 0;
}
if (passRate > 100) {
passRate = 100;
}
if (passRate < 0) {
passRate = 0;
}
return passRate;
} catch (e) {
return 0
}
}
},
}
</script>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,240 @@
<template>
<div class="app-container">
<div>
<el-form :model="search" inline>
<el-form-item label="">
<el-date-picker style="width: 120px;" v-model="search.year" type="year" :clearable="false" placeholder="选择年">
</el-date-picker>
<span style="margin-right: 20px;margin-left: 10px; font-weight: 600;"></span>
</el-form-item>
<el-form-item label=" 第">
<el-input style="width: 80px;" v-model="search.week" placeholder="输入周"></el-input>
</el-form-item>
<el-form-item label="周">
</el-form-item>
<el-form-item label="日期">
<el-button-group>
<el-button :type="search.date===1?'primary':''" @click="searchDate(1)">周一</el-button>
<el-button :type="search.date===2?'primary':''" @click="searchDate(2)">周二</el-button>
<el-button :type="search.date===3?'primary':''" @click="searchDate(3)">周三</el-button>
<el-button :type="search.date===4?'primary':''" @click="searchDate(4)">周四</el-button>
<el-button :type="search.date===5?'primary':''" @click="searchDate(5)">周五</el-button>
<el-button :type="search.date===6?'primary':''" @click="searchDate(6)">周六</el-button>
<el-button :type="search.date===7?'primary':''" @click="searchDate(7)">周日</el-button>
</el-button-group>
</el-form-item>
</el-form>
</div>
<div style="margin-bottom: 10px;">
<el-button type="primary" @click="getTableData()">查询</el-button>
<el-button v-loading="saveLoading" type="success" @click="saveAllRow()">保存当前页</el-button>
</div>
<vxe-table v-loading="tableLoading" :data="tableData" align="center" stripe border :edit-config="{trigger: 'click', mode: 'cell', icon: 'vxe-icon-edit'}">
<vxe-column type="seq" title="编号" width="55"></vxe-column>
<vxe-column field="blankNumber" title="毛坯号" min-width="120"></vxe-column>
<vxe-column field="productDescription" title="产品" min-width="120"></vxe-column>
<vxe-column field="colour" title="颜色" min-width="120"></vxe-column>
<vxe-column field="specifications" title="规格" min-width="60"></vxe-column>
<vxe-column field="previousNumber" title="目标应收" min-width="60"></vxe-column>
<vxe-column field="actualNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="实收" min-width="60">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.actualNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="sampleNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="抽检数" min-width="80">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.sampleNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="qualifiedNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="合格数" min-width="80">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.qualifiedNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="passRate" title="合格率(%)" min-width="60">
<template #default="{ row }">
{{handlerPassRate(row)}}
</template>
</vxe-column>
<vxe-colgroup title="仓库" min-width="180">
<vxe-column field="warehouseNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="仓库号" min-width="80">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.warehouseNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="shelfNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="货架号" min-width="60">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.shelfNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="layerNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="层号" min-width="60">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.layerNumber"></vxe-input>
</template>
</vxe-column>
<vxe-column field="locationNumber" :edit-render="{autofocus: '.vxe-input--inner'}" title="库位号" min-width="60">
<template #edit="{ row }">
<vxe-input type="text" v-model="row.locationNumber"></vxe-input>
</template>
</vxe-column>
</vxe-colgroup>
<vxe-column title="状态" min-width="80">
<template #default="{ row }">
<el-tag v-if="row.status===1" type="info">合格</el-tag>
<el-tag v-else-if="row.status===2" type="info">不合格</el-tag>
<el-tag v-else type="info">未入库</el-tag>
</template>
</vxe-column>
<vxe-column title="操作" fixed="right" min-width="80">
<template #default="{ row }">
<el-button v-loading="saveLoading" size="small" type="primary" @click="saveRow(row)">保存</el-button>
</template>
</vxe-column>
</vxe-table>
<pagination :total="pagination.total" :page.sync="pagination.pageNum" :limit.sync="pagination.pageSize" @pagination="getTableData" />
</div>
</template>
<script>
import { getMaterialReceiptList, saveOneMaterialReceipt, savePageMaterialReceipts } from '@/api/warehouseManagement/material_receipt.js';
export default {
name: 'material_receipt',
data() {
return {
tableLoading: false,
saveLoading:false,
operator: '',
search: {
year: new Date(),
week: 1,
date: new Date().getDay(),
},
pagination: {
pageNum: 1,
pageSize: 50,
total: 0,
},
tableData: [],
}
},
mounted() {
this.init()
},
methods: {
init() {
this.operator = this.$store.getters.userinfo?.userName;
this.getTableData();
},
// 获取表格数据
getTableData() {
this.tableLoading = true;
setTimeout(()=>{
this.tableLoading = false;
},30000);
let intYear = null;
try {
intYear = this.search.year.getFullYear() * 1;
} catch (e) {
this.$message.warning("年份输入有误!");
}
const query = {
year: intYear,
week: this.search.week * 1,
date: this.search.date,
...this.pagination
};
getMaterialReceiptList(query).then(res => {
if (res.code === 200) {
this.tableData = res.data.item1
this.pagination.total = res.data.item2
}
}).catch(() => {
this.tableData = []
this.pagination.total = 0
}).finally(() => {
this.tableLoading = false;
})
},
// 日期查询数据
searchDate(item) {
this.search.date = item
this.getTableData()
},
// 保存行
saveRow(row) {
this.saveLoading = true;
setTimeout(()=>{
this.saveLoading = false;
},30000);
let saveData = row;
saveData.operator = this.operator;
saveOneMaterialReceipt(saveData).then((res)=>{
if (res.code === 200) {
this.$message.success(res.data);
}else{
this.$message.error(res.data);
console.log('saveOneMaterialReceipt',res.msg);
}
}).finally(()=>{
this.saveLoading = false;
this.getTableData();
})
},
saveAllRow() {
this.saveLoading = true;
setTimeout(()=>{
this.saveLoading = false;
},30000);
let saveList = JSON.parse(JSON.stringify(this.tableData));
for(let item of saveList){
item.operator = this.operator;
}
const data = {
list:saveList
}
console.log(data);
savePageMaterialReceipts(saveList).then((res)=>{
if (res.code === 200) {
this.$message.success(res.data);
}else{
this.$message.error(res.data);
console.log('savePageMaterialReceipts',res.msg);
}
}).finally(()=>{
this.saveLoading = false;
this.getTableData();
})
},
// 合格率计算
handlerPassRate(row) {
try {
// 抽检数
let sampleNumber = row.sampleNumber;
// 合格数
let qualifiedNumber = row.qualifiedNumber;
if(sampleNumber === null || qualifiedNumber === null){
return 0;
}
if (sampleNumber === 0) {
return 0;
}
let passRate = parseInt((qualifiedNumber / sampleNumber) * 100);
if (typeof (passRate) == NaN) {
return 0;
}
if (passRate > 100) {
passRate = 100;
}
if (passRate < 0) {
passRate = 0;
}
return passRate;
} catch (e) {
return 0
}
}
},
}
</script>
<style lang="scss" scoped></style>