1.添加原材料入库相关代码
2.修改质量统计页面样式
This commit is contained in:
240
src/views/warehouseManagement/material_receipt.vue
Normal file
240
src/views/warehouseManagement/material_receipt.vue
Normal 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>
|
||||
240
src/views/warehouseManagement/paint_material_preparation.vue
Normal file
240
src/views/warehouseManagement/paint_material_preparation.vue
Normal 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>
|
||||
Reference in New Issue
Block a user