领料出库修改

dev-scheduling
zhangdi 1 week ago
parent 752f7e709c
commit 537b85c505
  1. 282
      src/views/inboundOutboundManagement/components/editMaterial.vue
  2. 979
      src/views/inboundOutboundManagement/materialIssuing.vue

@ -1,216 +1,94 @@
<template>
<el-dialog title="出库" append-to-body :modelValue="openShow" width="80%" @close="closeDialog">
<el-table :data="tableData">
<el-table-column label="提请物料" prop="goodsCode" align="center"></el-table-column>
<el-table-column label="材料名称" prop="goodsName" align="center"></el-table-column>
<el-table-column label="规格" prop="specifications" align="center"></el-table-column>
<el-table-column label="库房" prop="shId" align="center">
<template #default="scope">
<el-select v-model="scope.row.shId" @change="(val) => changeWare(val,scope.$index)">
<el-option v-for="item in wareList" :key="item.id" :label="item.shName" :value="item.id"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="出库库位" prop="slId" align="center">
<template #default="scope">
<el-select v-model="scope.row.slId" @change="(val) => changeLocation(val,scope.$index)">
<el-option v-for="item in locationList" :key="item.id" :label="item.location" :value="item.slId"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="批次号" prop="piNo" align="center">
<template #default="scope">
<el-select v-model="scope.row.piNo" @change="val => changePiNo(val,scope.$index)">
<el-option v-for="item in scope.row.piNoList" :key="item.id" :label="item.piNo" :value="item.piNo"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="可出库数量" prop="availableQty" align="center"></el-table-column>
<el-table-column label="出库数量" prop="currentOutQty" align="center">
<template #default="scope">
<el-input-number controls-position="right" :max="scope.row.availableQty" v-model="scope.row.currentOutQty"></el-input-number>
</template>
</el-table-column>
</el-table>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
<el-dialog title="出库" append-to-body :modelValue="openShow" fullscreen @close="closeDialog">
<el-table :data="tableData" highlight-current-row @current-change="handleCurrentChange">
<el-table-column label="提请物料" prop="goodsCode" align="center"></el-table-column>
<el-table-column label="材料名称" prop="goodsName" align="center"></el-table-column>
<el-table-column label="规格" prop="specifications" align="center"></el-table-column>
<el-table-column label="库房" prop="shName" align="center"> </el-table-column>
<el-table-column label="出库库位" prop="location" align="center"> </el-table-column>
<el-table-column label="批次号" prop="piNo" align="center"> </el-table-column>
<el-table-column label="库存数量" prop="usableQuantity" align="center"></el-table-column>
<el-table-column label="出库数量" prop="currentOutQty" align="center">
<template #default="scope">
<el-input-number
controls-position="right"
:max="scope.row.usableQuantity"
v-model="scope.row.currentOutQty"
></el-input-number>
</template>
</el-dialog>
</el-table-column>
</el-table>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import {getLocationData,editIssue,getWarehouseList,batchIssue} from "@/api/storeManagement/materialIssuing"
import { getStockByStorehouseAndGoods } from '@/api/storeManagement/otherIssuing';
export default {
props:{
showDialog: {
type: Boolean,
default: false
},
row:{
type: Object,
default: {}
},
list:{
type: Array,
default: []
}
props: {
showDialog: {
type: Boolean,
default: false,
},
data() {
return {
openShow: false,
tableData:[],
locationList:[],
piNoList:[],
wareList:[]
}
row: {
type: Object,
default: {},
},
mounted(){
this.openShow = this.showDialog
if(JSON.stringify(this.row) != '{}'){
this.tableData = [{
...this.row,
shId:this.row.shId == -1 ? '':this.row.shId,
slId:this.row.slId == -1 ? '':this.row.slId,
piNo:this.row.piNo == -1 ? '':this.row.piNo,
availableQty:this.row.availableQty == -1 ? '':this.row.availableQty,
currentOutQty:this.row.currentOutQty == -1 ? '':this.row.currentOutQty,
rlsId:this.row.rlsId == -1 ? '':this.row.rlsId,
}]
this.getWare()
this.getLocation()
}else if(this.list.length > 0){
this.tableData = this.list
this.tableData.map(item =>{
item.shId = item.shId == -1 ? '':item.shId
item.slId = item.slId == -1 ? '':item.slId
item.piNo = item.piNo == -1 ? '':item.piNo
item.availableQty = item.availableQty == -1 ? '': item.availableQty,
item.currentOutQty = item.currentOutQty == -1 ? '': item.currentOutQty,
this.getWare(item.goodsCode)
if(item.shId != '' && item.goodsId != '' && item.slId != ''){
this.getLocation(item.shId,item.goodsId,item.slId)
}
})
}
console.log('tableData============',this.tableData)
checkIndex: {
type: Number,
default: 0,
},
methods:{
closeDialog(val){
this.openShow = false
this.$emit('closeDialog',val)
},
getWare(val){
getWarehouseList({
goodsCode:val ? val : this.row.goodsCode
}).then(res =>{
console.log('res-----------',res)
this.wareList = res.data.data
})
},
uniqueById(arr) {
const seen = new Map();
for (const item of arr) {
if (!seen.has(item.slId)) {
seen.set(item.slId, item);
}
}
return Array.from(seen.values());
},
getLocation(shId,goodsId,slId){
getLocationData({
shId:shId ? shId : this.row.shId,
goodsId:goodsId ? goodsId : this.row.goodsId
}).then(res =>{
let data = this.uniqueById(res.data.data.records)
this.locationList = data
getLocationData({
shId:shId ? shId : this.row.shId,
goodsId:goodsId ? goodsId : this.row.goodsId,
slId:slId ? slId : this.row.slId
}).then(res =>{
this.tableData[0].piNoList = res.data.data.records
})
})
},
changeWare(val,index){
this.tableData[index].slId = ''
this.tableData[index].piNo = ''
this.tableData[index].availableQty = null
getLocationData({
shId:val,
goodsId:this.tableData[index].goodsId
}).then(res =>{
let data = this.uniqueById(res.data.data.records)
this.locationList = data
})
},
//
changeLocation(val,index){
// let tmp = this.locationList.find(item => item.location == val)
// this.tableData[index].currentStock = tmp.currentStock
this.tableData[index].piNo = ""
this.tableData[index].availableQty = null
getLocationData({
shId:this.tableData[index].shId,
goodsId:this.tableData[index].goodsId,
slId:val
}).then(res =>{
this.tableData[index].piNoList = res.data.data.records
})
},
//
changePiNo(val,index){
this.tableData[index].availableQty = null
let tmp = this.tableData[index].piNoList.find(item => item.piNo == val)
this.tableData[index].availableQty = tmp.quantity
this.tableData[index].rlsId = tmp.id
},
submit(){
// this.tableData.map(item =>{
// if(item.outQuantity > item.availableQty){
// this.$message.error('')
// return
// }
// })
//
const submitData = this.tableData.map(row => {
const { piNoList, ...validData } = row; //
return validData;
});
console.log(submitData)
let data = []
submitData.map(item =>{
data.push({
crId:item.id,
currentOutQty:item.currentOutQty,
rlsId:item.rlsId
})
})
console.log('data-----------',data)
list: {
type: Array,
default: [],
},
},
data() {
return {
openShow: false,
tableData: [],
currentRow: null,
};
},
mounted() {
this.openShow = this.showDialog;
this.init();
},
methods: {
handleCurrentChange(val) {
this.currentRow = val;
},
init() {
getStockByStorehouseAndGoods({ goodsCode: this.row.goodsCode }).then(res => {
this.tableData = res.data.data;
});
},
closeDialog(val) {
this.openShow = false;
let query={
...val,
index: this.checkIndex,
}
this.$emit('closeDialog', query);
},
submit() {
console.log('this.currentRow', this.currentRow);
if (this.currentRow.currentOutQty >= 0) {
this.closeDialog(this.currentRow);
} else {
this.$message.error('请输入出库数量');
}
batchIssue(data).then(res =>{
if(res.data.code === 200){
this.$message.success('出库成功')
this.closeDialog(true)
}
})
// editIssue(submitData).then(res =>{
// if(res.data.code === 200){
// this.$message.success('')
// this.closeDialog(true)
// }
// })
},
}
}
},
},
};
</script>
<style>
</style>

@ -1,546 +1,453 @@
<template>
<basic-container>
<!-- 领料出库 -->
<avue-crud :option="option" :table-loading="loading" :data="data" v-model="form" v-model:page="page" ref="crud"
v-model:search="searchForm"
@search-change="searchChange" @search-reset="searchReset" :before-open="beforeOpen"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
@refresh-change="refreshChange" @on-load="onLoad" @row-save="rowSave">
<template #menu-left>
<el-input v-model="checkCode" style="width: 240px;margin-right:24px"
@keyup.enter.native="changeCode" placeholder="请扫描提请单号" />
<el-button type="primary" @click="handleOut">出库</el-button>
</template>
<template #menu="scope">
<el-button type="text" @click="editRow(scope.row)">出库</el-button>
<el-button type="text" @click="completeRow(scope.row)">完成</el-button>
<el-button type="text" @click="deleteRow(scope.row)">删除</el-button>
</template>
<!-- <template #mtltmrk="{ row }">{{ row.coGoods.mtltmrk }}</template>
<template #checkoutCode="{ row }">{{ row.coGoods.checkoutCode }}</template>
<template #stRealtimeStock="{ row }">{{ row.stRealtimeStock.quantity }}</template>
<template #userName="{ row }">{{ row.crMan.userName }}</template>
<template #unitName="{ row }">{{ row.coGoods.unitName }}</template> -->
</avue-crud>
<editMaterial v-if="editDialog" :checkCode="checkCode" :show-dialog="editDialog" :row="checkRow"
:list="selectionList" @closeDialog="closeDialog"></editMaterial>
</basic-container>
<basic-container>
<!-- 领料出库 -->
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
ref="crud"
v-model:search="searchForm"
@search-change="searchChange"
@search-reset="searchReset"
:before-open="beforeOpen"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
@row-save="rowSave"
>
<template #menu-left>
<el-input
v-model="checkCode"
style="width: 240px; margin-right: 24px"
@keyup.enter.native="changeCode"
placeholder="请扫描提请单号"
/>
<el-button type="primary" @click="handleOut">出库</el-button>
</template>
<template #menu="scope">
<el-button type="text" @click="outRow(scope.row)">出库</el-button>
<el-button type="text" @click="completeRow(scope.row)">完成</el-button>
<el-button type="text" @click="deleteRow(scope.row)">删除</el-button>
</template>
<template #location="scope">
<el-button type="text" @click="editRow(scope.row, scope.row.$index)">{{
scope.row.location == '' ? '请选择库位' : scope.row.location
}}</el-button>
</template>
</avue-crud>
<editMaterial
v-if="editDialog"
:checkCode="checkCode"
:show-dialog="editDialog"
:row="checkRow"
:checkIndex="checkIndex"
:list="selectionList"
@closeDialog="closeDialog"
></editMaterial>
</basic-container>
</template>
<script>
import { getList,addIssue,delIssue,completeIssue } from "@/api/storeManagement/materialIssuing"
import editMaterial from "./components/editMaterial.vue"
import {
getList,
delIssue,
completeIssue,
batchIssue,
} from '@/api/storeManagement/materialIssuing';
import editMaterial from './components/editMaterial.vue';
export default {
components:{
editMaterial
},
data() {
return {
loading: false,
editDialog:false,
checkCode:"",
tableData:[],
checkRow:{},
query:{},
data: [],
form: {},
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
selectionList: [],
option: {
columnSort: true,
tip: false,
height: 'auto',
align: 'center',
calcHeight: 32,
simplePage: false,
searchShow: true,
searchMenuSpan: 6,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: false,
selection: true,
viewBtn: false,
delBtn: false,
editBtn: false,
editBtnText: '修改',
addBtn: false,
labelWidth: 140,
menu: true,
menuWidth: 150,
dialogWidth: 1200,
dialogClickModal: false,
searchEnter: true,
excelBtn: true,
gridBtn: false,
searchShowBtn: false,
showOverflowTooltip: true,
searchLabelPosition: 'left',
searchLabelWidth: 'auto',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
searchShowBtn: false,
components: {
editMaterial,
},
data() {
return {
loading: false,
editDialog: false,
checkCode: '',
tableData: [],
checkRow: {},
checkIndex: 0,
query: {},
data: [],
form: {},
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
selectionList: [],
option: {
columnSort: true,
tip: false,
height: 'auto',
align: 'center',
calcHeight: 32,
simplePage: false,
searchShow: true,
searchMenuSpan: 6,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: false,
selection: true,
viewBtn: false,
delBtn: false,
editBtn: false,
editBtnText: '修改',
addBtn: false,
labelWidth: 140,
menu: true,
menuWidth: 150,
dialogWidth: 1200,
dialogClickModal: false,
searchEnter: true,
excelBtn: true,
gridBtn: false,
searchShowBtn: false,
showOverflowTooltip: true,
searchLabelPosition: 'left',
searchLabelWidth: 'auto',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
searchShowBtn: false,
column: [
{
label: '提请单号',
prop: 'crCode',
span: 8,
overflow: true,
search: false,
width: 160,
},
{
label: '物料编号',
prop: 'goodsCode',
span: 8,
overflow: true,
search: true,
width: 160,
},
{
label: '物料名称',
prop: 'goodsName',
span: 8,
overflow: true,
width: 150,
search: true,
},
{
label: '型号/牌号',
prop: 'materialModel',
span: 8,
width: 100,
overflow: true,
search: false,
},
{
label: '规格',
prop: 'specifications',
span: 8,
overflow: true,
search: false,
width: 100,
},
{
label: '质量编号',
prop: 'checkCode',
span: 8,
overflow: true,
width: 150,
search: false,
},
{
label: '出库库位',
prop: 'location',
span: 8,
overflow: true,
width: 150,
search: false,
},
{
label: '库房',
prop: 'shName',
span: 8,
overflow: true,
width: 150,
search: false,
},
column: [
{
label: '提请单号',
// addDisabled: true,
prop: 'crCode',
span: 8,
overflow: true,
search: false,
// hide: false,
// order: 17,
width:160,
rules: [
{
required: true,
message: '请输入提请单号',
trigger: 'blur',
},
],
},
{
label: '物料编号',
// addDisabled: true,
prop: 'goodsCode',
span: 8,
overflow: true,
search: true,
// hide: false,
// order: 17,
width:160,
rules: [
{
required: true,
message: '请输入物料编号',
trigger: 'blur',
},
],
},
{
label: '物料名称',
prop: 'goodsName',
span: 8,
overflow: true,
width:150,
search: true,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入物料名称',
trigger: 'blur',
},
],
},
{
label: '型号/牌号',
prop: 'materialModel',
span: 8,
width:100,
overflow: true,
search: false,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入型号/牌号',
trigger: 'blur',
},
],
},
{
label: '规格',
prop: 'specifications',
span: 8,
overflow: true,
search: false,
width:100,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入规格',
trigger: 'blur',
},
],
},
{
label: '质量编号',
prop: 'checkCode',
span: 8,
overflow: true,
width:150,
search: false,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入质量编号',
trigger: 'blur',
},
],
},
{
label: '总库存',
prop: 'currentStock',
width:100,
span: 8,
overflow: true,
search: false,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入总库存',
trigger: 'blur',
},
],
},
{
label: '提请数量',
width:100,
prop: 'quantity',
span: 8,
overflow: true,
search: false,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入提请数量',
trigger: 'blur',
},
],
},
{
label: '计量单位',
prop: 'unitName',
width:100,
span: 8,
overflow: true,
search: false,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入单位',
trigger: 'blur',
},
],
},
// {
// label: '',
// prop: 'shName',
// span: 8,
// overflow: true,
// search: false,
// width:100,
// // hide: false,
// // order: 17,
// rules: [
// {
// required: true,
// message: '',
// trigger: 'blur',
// },
// ],
// },
// {
// label: '',
// prop: 'location',
// span: 8,
// overflow: true,
// search: false,
// width:100,
// // hide: false,
// // order: 17,
// rules: [
// {
// required: true,
// message: '',
// trigger: 'blur',
// },
// ],
// },
// {
// label: '',
// prop: 'piNo',
// span: 8,
// overflow: true,
// width:100,
// search: false,
// // hide: false,
// // order: 17,
// rules: [
// {
// required: true,
// message: '',
// trigger: 'blur',
// },
// ],
// },
{
label: '待提请数量',
prop: 'pendingApplyQty',
span: 8,
overflow: true,
width:100,
search: false,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入出库数量',
trigger: 'blur',
},
],
},
{
label: '已提请数量',
prop: 'outQuantity',
span: 8,
overflow: true,
width:100,
search: false,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入出库数量',
trigger: 'blur',
},
],
},
// {
// label: '',
// prop: 'currentOutQty',
// span: 8,
// overflow: true,
// width:120,
// search: false,
// // hide: false,
// // order: 17,
// rules: [
// {
// required: true,
// message: '',
// trigger: 'blur',
// },
// ],
// },
{
label: '提请人',
prop: 'crManName',
span: 8,
overflow: true,
width:100,
search: true,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入提请人',
trigger: 'blur',
},
],
},
{
label: '提请日期',
prop: 'crDate',
type: 'date',
valueFormat:"YYYY-MM-DD",
format:"YYYY-MM-DD",
searchRange: true,
startPlaceholder: '开始时间',
endPlaceholder: "结束时间",
span: 8,
overflow: true,
search: true,
width:180,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入提请日期',
trigger: 'blur',
},
],
},
{
label: '备注',
prop: 'memo',
span: 8,
overflow: true,
search: false,
width:130,
// hide: false,
// order: 17,
rules: [
{
required: true,
message: '请输入备注',
trigger: 'blur',
},
],
},
{
label: '批次号',
prop: 'piNo',
span: 8,
overflow: true,
width: 150,
search: false,
},
{
label: '出库数量',
prop: 'currentOutQty',
span: 8,
overflow: true,
width: 150,
search: false,
},
{
label: '总库存',
prop: 'currentStock',
width: 100,
span: 8,
overflow: true,
search: false,
},
{
label: '提请数量',
width: 100,
prop: 'quantity',
span: 8,
overflow: true,
search: false,
},
{
label: '计量单位',
prop: 'unitName',
width: 100,
span: 8,
overflow: true,
search: false,
},
]
},
searchForm:{}
}
{
label: '待提请数量',
prop: 'pendingApplyQty',
span: 8,
overflow: true,
width: 100,
search: false,
},
{
label: '已提请数量',
prop: 'outQuantity',
span: 8,
overflow: true,
width: 100,
search: false,
},
{
label: '提请人',
prop: 'crManName',
span: 8,
overflow: true,
width: 100,
search: true,
},
{
label: '提请日期',
prop: 'crDate',
type: 'date',
valueFormat: 'YYYY-MM-DD',
format: 'YYYY-MM-DD',
searchRange: true,
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
span: 8,
overflow: true,
search: true,
width: 180,
},
{
label: '备注',
prop: 'memo',
span: 8,
overflow: true,
search: false,
width: 130,
},
],
},
searchForm: {},
};
},
created() {
if (JSON.stringify(this.$store.state.client.exchangeOutParams) !== '{}') {
this.query = this.$store.state.client.exchangeOutParams;
this.searchForm = this.$store.state.client.exchangeOutParams;
}
},
methods: {
changeCode(val) {
if (this.checkCode == '') return;
this.query.crCode = this.checkCode;
this.onLoad();
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.$store.dispatch('changeSetting', {
title: 'exchangeOutParams',
form: this.query,
});
this.onLoad();
done();
},
searchReset() {
this.query = {};
this.$store.dispatch('changeSetting', {
title: 'exchangeOutParams',
form: this.query,
});
this.onLoad();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
created() {
if (JSON.stringify(this.$store.state.client.exchangeOutParams) !== "{}") {
this.query = this.$store.state.client.exchangeOutParams;
this.searchForm = this.$store.state.client.exchangeOutParams;
}
//
selectionChange(list) {
this.selectionList = list;
},
methods: {
changeCode(val){
if(this.checkCode == "") return
this.query.crCode = this.checkCode
this.onLoad()
},
searchChange(params, done){
this.query = params
this.page.currentPage = 1
this.$store.dispatch("changeSetting", {
title: "exchangeOutParams",
form: this.query,
});
this.onLoad()
done()
},
searchReset(){
this.query = {}
this.$store.dispatch("changeSetting", {
title: "exchangeOutParams",
form: this.query,
});
this.onLoad()
},
currentChange(currentPage){
this.page.currentPage = currentPage
},
sizeChange(pageSize){
this.page.pageSize = pageSize
},
//
selectionChange(list) {
this.selectionList = list;
},
//
editRow(row){
this.selectionList = []
this.checkRow = row
this.editDialog = true
},
//
completeRow(row){
this.$confirm('确定完成此条数据?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
completeIssue({id:row.id}).then(res =>{
if(res.data.code == 200){
this.$message.success('完成成功')
this.onLoad()
}
})
})
},
//
deleteRow(row){
this.$confirm('确定删除此条数据?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
delIssue({ids:row.id}).then(res =>{
if(res.data.code == 200){
this.$message.success('删除成功')
this.onLoad()
}
})
})
},
//
handleOut() {
if(this.selectionList.length == 0){
this.$message.error('请至少选择一条数据')
return
}
let tmp = this.selectionList.find(item => item.已出库数量 > item.quantity)
if(tmp){
this.$message.error('已出库数量大于提请数量,不能出库')
return
}
this.checkRow = {}
this.editDialog = true
//
editRow(row, index) {
this.checkIndex = index;
this.selectionList = [];
this.checkRow = row;
this.editDialog = true;
},
//
outRow(row) {
if (row.rlsId == -1 || row.rlsId == null) {
this.$message.error('请先选择需要出库的库位信息!');
return false;
}
this.$confirm('确定此条数据是否出库?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
let query = [
{
crId: row.id,
currentOutQty: row.currentOutQty,
rlsId: row.rlsId,
},
];
batchIssue(query).then(res => {
this.$message.success('出库成功');
this.onLoad(this.page, this.query);
});
});
},
//
completeRow(row) {
this.$confirm('确定完成此条数据?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
completeIssue({ id: row.id }).then(res => {
if (res.data.code == 200) {
this.$message.success('完成成功');
this.onLoad();
}
});
});
},
//
deleteRow(row) {
this.$confirm('确定删除此条数据?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
delIssue({ ids: row.id }).then(res => {
if (res.data.code == 200) {
this.$message.success('删除成功');
this.onLoad();
}
});
});
},
//
handleOut() {
if (this.selectionList.length == 0) {
this.$message.error('请至少选择一条数据');
return;
}
const unselectedItem = this.selectionList.find(
item => !item.rlsId || item.rlsId === -1 || item.rlsId === ''
);
// this.$confirm('?', {
// confirmButtonText: '',
// cancelButtonText: '',
// type: 'warning',
// }).then(() => {
// addIssue(this.selectionList.map(item => item.id)).then(res =>{
// if(res.data.code == 200){
// this.$message.success('')
// this.onLoad()
// }
// })
// })
},
closeDialog(val){
this.editDialog = false
if(val){
this.onLoad()
}
},
onLoad() {
this.loading = true
console.log('query==============',this.query)
let params = {
...this.query,
startCrDate:this.query && this.query.crDate && this.query.crDate.length > 0 && this.query.crDate[0],
endCrDate:this.query && this.query.crDate && this.query.crDate.length > 0 && this.query.crDate[1],
}
if(params.crDate) delete params.crDate
getList({
current:this.page.currentPage,
size:this.page.pageSize,
...params
}).then(res =>{
this.data = res.data.data.records
this.page.total = res.data.data.total
this.loading = false
})
}
}
}
if (unselectedItem) {
this.$message.error(`物料【${unselectedItem.goodsName}】未选择出库库位,请先选择!`);
return;
}
// 🔥 3.
const params = this.selectionList.map(item => ({
crId: item.id, // ID
currentOutQty: item.currentOutQty, //
rlsId: item.rlsId, // ID
}));
this.$confirm(`确定对选中的 ${this.selectionList.length} 条数据进行出库操作?`, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
batchIssue(params).then(res => {
this.$message.success('批量出库成功');
this.onLoad(); //
this.selectionList = []; // ( avue-crud )
});
});
},
closeDialog(val) {
this.editDialog = false;
this.data[val.index].shId = val.shId;
this.data[val.index].shName = val.shName;
this.data[val.index].slId = val.slId;
this.data[val.index].location = val.location;
this.data[val.index].piNo = val.piNo;
this.data[val.index].currentOutQty = val.currentOutQty;
this.data[val.index].rlsId = val.id;
},
onLoad() {
this.loading = true;
let params = {
...this.query,
startCrDate:
this.query && this.query.crDate && this.query.crDate.length > 0 && this.query.crDate[0],
endCrDate:
this.query && this.query.crDate && this.query.crDate.length > 0 && this.query.crDate[1],
};
if (params.crDate) delete params.crDate;
getList({
current: this.page.currentPage,
size: this.page.pageSize,
...params,
}).then(res => {
this.data = res.data.data.records;
this.data.forEach((item, index) => {
item.currentOutQty = item.pendingApplyQty;
});
this.page.total = res.data.data.total;
this.loading = false;
});
},
},
};
</script>
Loading…
Cancel
Save