1.调整摆放页面

prod
x_z 2 years ago
parent ed69214e0b
commit 474b71ef13

@ -23,3 +23,19 @@ export function checkCodeSpace(data) {
data: data
});
}
export function getInvProductInfo(params) {
return axios({
url: "/spms/inv/product/getInvProductInfo",
method: "get",
params: params
});
}
export function getInvPlaceOrderList(params) {
return axios({
url: "/spms/inv/product/getInvPlaceOrderList",
method: "get",
params: params
});
}

@ -0,0 +1,316 @@
<template>
<div>
<el-form :model="formData" label-width="100px" >
<el-button-group style="display: flex;margin: 0px 0 10px 80%; height: 35px">
<el-button size="mini" type="primary" @click.native="selectOrder()">选入单据</el-button>
<el-button size="mini" type="primary" @click.native="saveData()">提交</el-button>
<el-button size="mini" type="primary" @click.native="closePlaceDialog(2)">关闭</el-button>
</el-button-group>
<el-row>
<el-col :span="10">
<el-form-item prop="invWarehouseCode" label="当前仓库:">
<el-select v-model="formData.invCode"
placeholder="当前仓库信息"
:disabled="list.length>0"
@change="invChange"
style="width: 90%"
clearable>
<el-option
v-for="item in invList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item class="query-form-item" label="当前货位:">
<el-autocomplete
v-model="formData.invSpaceName"
:fetch-suggestions="querySearchAsync"
placeholder="请输入内容"
@select="handleSelect"
clearable
style="width: 90%"
></el-autocomplete>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="18">
<el-form-item class="query-form-item" label="扫码录入:">
<el-input
id="inputer"
@focus="getInputFocus($event)"
@keypress.enter.native="enterKey($event)"
ref='inputRef'
style="ime-mode:disabled"
type="tel"
v-model="formData.code"
></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button
type="primary"
size="mini"
@click.native.stop="search()"
style="margin-left: 15px"
>查询
</el-button
>
</el-col>
</el-row>
<el-table v-loading="loading" :data="list" style="width: 100%;margin-top: 20px;"
highlight-current-row
border max-height="300" height="300">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="DI/物资编码" prop="relId" width="150"></el-table-column>
<el-table-column label="物资名称" prop="productName" width="150"></el-table-column>
<el-table-column label="规格型号" prop="ggxh" width="150"></el-table-column>
<el-table-column label="批次号" prop="batchNo" width="150"></el-table-column>
<el-table-column label="序列号" prop="serialNo" width="150"></el-table-column>
<el-table-column label="计量单位" prop="measname" width="150"></el-table-column>
<el-table-column label="货位" prop="invSpaceName" width="150"></el-table-column>
<el-table-column label="注册备案号" prop="zczbhhzbapzbh" width="150"></el-table-column>
<el-table-column label="生产厂家" prop="manufactory" width="150"></el-table-column>
<el-table-column label="供应商" prop="supName" width="150"></el-table-column>
</el-table>
</el-form>
<el-dialog
title="选入单据"
:visible.sync="orderDialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="60%"
v-if="orderDialogVisible"
append-to-body
>
<invPlaceSelectOrder
:closeDialog="closeDialog"
:formData="selectFormData"
:getInvProductInfogetInvProductInfogetInvProductInfo="getInvProductInfo"
>
</invPlaceSelectOrder>
</el-dialog>
</div>
</template>
<script>
import {getInvListByUser} from "@/api/system/invWarehouse";
import {getInvSpaceList} from "@/api/inventory/invSpace";
import {isBlank} from "@/utils/strUtil";
import {bindInvSpace, getInvProductInfo} from "@/api/inventory/invPlace";
import invPlaceSelectOrder from "@/views/inventory/InvPlaceSelectOrder.vue";
export default {
props: {
closePlaceDialog: {
type: Function,
required: true
}
},
name: "InvOrderPlaceModify",
data() {
return {
formData: {
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
invSpaceName: null,
orderId: null,
},
list: [],
codeArray: [],
invList: [],
spaceList: [],
loading: false,
orderDialogVisible: false,
selectFormData: {
invCode: null,
invName: null
}
}
},
methods: {
saveData() {
if (isBlank(this.formData.invCode)) {
this.$message.error("请选择当前仓库");
return;
}
if (isBlank(this.formData.invSpaceCode)) {
this.$message.error("请选择当前货位");
return;
}
if (this.list.length === 0) {
this.$message.error("请录入需要上架的物资数据");
return;
}
this.$confirm('是否确认保存当前数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.list.forEach((item) => {
this.codeArray.push(item.code);
});
let params = {
invCode: this.formData.invCode,
invSpaceCode: this.formData.invSpaceCode,
codeArray: this.codeArray
};
bindInvSpace(params).then((res) => {
if (res.code === 20000) {
this.$message.success("上架成功");
this.clearFormData();
} else {
this.$message.error(res.message);
}
}).catch((error) => {
this.$message.error(error.message);
});
}).catch(() => {
});
},
clearFormData() {
//
this.formData = {
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
invSpaceName: null,
code: null,
};
this.codeArray = [];
this.list = [];
this.selectFormData = {
invCode: null,
invName: null
};
},
invChange() {
this.formData.invSpaceCode = null;
this.formData.invSpaceName = null;
this.list.forEach((item) => {
item.invSpaceCode = null;
item.invSpaceName = null;
})
this.getSpaceList();
},
querySearchAsync(queryString, cb) {
let restaurants = this.spaceList;
restaurants.forEach((item) => {
item.value = item.name;
})
let results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
cb(results);
},
createStateFilter(queryString) {
return (state) => {
return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
};
},
handleSelect(item) {
this.formData.invSpaceCode = item.code;
this.formData.invSpaceName = item.name;
this.list.forEach((invProduct) => {
invProduct.invSpaceCode = item.code;
invProduct.invSpaceName = item.name;
});
},
getInvList() {
getInvListByUser()
.then((response) => {
this.invList = response.data || [];
this.getSpaceList();
this.getList();
})
.catch(() => {
});
},
getSpaceList() {
let params = {
invWarehouseCode: this.formData.invCode,
status: 1
};
getInvSpaceList(params).then((res) => {
this.spaceList = res.data.list || [];
})
},
search(event) {
if (event != null) {
event.target.select();
}
this.$refs.inputRef.select();
if (isBlank(this.formData.invCode)) {
this.$message.error('当前仓库不能为空');
return;
}
this.formData.orderId = this.formData.orderId.trim();
if (this.$isBlank(this.formData.orderId)) return;
this.getInvProductInfo(this.formData.orderId);
this.$refs.inputRef.select();
},
getInvProductInfo(orderId) {
let params = {
invCode: this.formData.invCode,
invSpaceCode: this.formData.invSpaceCode,
code: orderId
};
getInvProductInfo(params).then((res) => {
if (res.data !== null) {
res.data.forEach((item) => {
this.list.push(item);
});
} else {
this.$message.warning("未查询到产品信息");
}
})
},
getInputFocus(event) {
event.currentTarget.select();
},
enterKey(event) {
this.checkSuccess = true;
this.addCode(event);
this.$refs.inputRef.focus();
this.$refs.inputRef.select();
},
selectOrder() {
this.orderDialogVisible = true;
this.invList.forEach((item) => {
if (item.code === this.formData.invCode) {
this.selectFormData = {
invCode: this.formData.invCode,
invName: item.name
};
}
})
},
closeDialog() {
this.orderDialogVisible = false;
this.selectFormData = {
invCode: null,
invName: null
};
},
},
components: {
invPlaceSelectOrder
},
created() {
this.getInvList();
},
}
</script>
<style scoped>
</style>

@ -31,7 +31,8 @@
<el-button-group style="margin-left: 10px;display:flex;">
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
<el-button type="primary" icon="el-icon-box" @click="invPlace"></el-button>
<el-button type="primary" icon="el-icon-box" @click="invPlace(1)"></el-button>
<el-button type="primary" icon="el-icon-box" @click="invPlace(2)"></el-button>
</el-button-group>
</el-form-item>
</el-form>
@ -62,120 +63,40 @@
</el-card>
<el-dialog
title="库存摆放"
:visible.sync="placeDialogVisible"
title="按物资上架"
:visible.sync="productPlaceDialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="60%"
v-if="placeDialogVisible"
width="85%"
v-if="productPlaceDialogVisible"
>
<el-card style="margin: 5px;margin-top: -20px">
<el-form :model="formData" label-width="100px" style="margin-bottom: -15px">
<el-button-group style="display: flex;margin: 0px 0 10px 80%; height: 35px">
<el-button
size="mini"
type="primary"
@click.native="saveData()"
>提交
</el-button
>
</el-button-group>
<el-row>
<el-col :span="10">
<el-form-item prop="invWarehouseCode" label="当前仓库:">
<el-select v-model="formData.invCode"
placeholder="当前仓库信息"
:disabled="codeArray.length>0"
@change="formInvChange"
style="width: 90%"
clearable>
<el-option
v-for="item in invList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item class="query-form-item" label="当前货位:">
<el-select v-model="formData.invSpaceCode"
placeholder="当前货位信息"
:disabled="codeArray.length>0"
style="width: 90%"
clearable>
<el-option
v-for="item in formSpaceList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="18">
<el-form-item class="query-form-item" label="扫码录入:">
<el-input
id="inputer"
@focus="getInputFocus($event)"
@keypress.enter.native="enterKey($event)"
ref='inputRef'
style="ime-mode:disabled"
type="tel"
v-model="formData.code"
></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button
type="primary"
size="mini"
@click.native.stop="addCode()"
style="margin-left: 15px"
>添加
</el-button
>
</el-col>
</el-row>
<el-table v-loading="codeTableLoading" :data="codeArray" style="width: 100%;margin-top: 20px;"
highlight-current-row
border max-height="300" height="300">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="条码" prop="code" show-overflow-tooltip>
</el-table-column>
<el-table-column label="操作" width="150">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.stop="true"
@click.native="deleteCodeArray(scope.$index, scope.row)"
>删除
</el-button
>
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<invProductPlaceModify
:closePlaceDialog="closePlaceDialog"
></invProductPlaceModify>
</el-dialog>
<el-dialog
title="按单上架"
:visible.sync="orderPlaceDialogVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="85%"
v-if="orderPlaceDialogVisible"
>
<invOrderPlaceModify
:closePlaceDialog="closePlaceDialog"
></invOrderPlaceModify>
</el-dialog>
</div>
</template>
<script>
import {getInvListByUser} from "@/api/system/invWarehouse";
import {getInvSpaceList} from "@/api/inventory/invSpace";
import {getPlaceDetailList, bindInvSpace, checkCodeSpace} from "@/api/inventory/invPlace";
import {getPlaceDetailList} from "@/api/inventory/invPlace";
import {isBlank} from "@/utils/strUtil";
import invProductPlaceModify from "@/views/inventory/InvProductPlaceModify.vue";
import invOrderPlaceModify from "@/views/inventory/InvOrderPlaceModify.vue";
export default {
name: "InvProducts",
@ -192,18 +113,8 @@ export default {
invList: [],
spaceList: [],
loading: false,
fromOptions: [],
formData: {
invCode: null,
invSpaceCode: null,
code: null,
codeArray: []
},
placeDialogVisible: false,
codeTableLoading: false,
codeArray: [],
formInvList: [],
formSpaceList: []
productPlaceDialogVisible: false,
orderPlaceDialogVisible: false
};
},
methods: {
@ -266,121 +177,27 @@ export default {
this.spaceList = res.data.list || [];
})
},
formInvChange() {
this.formData.invSpaceCode = null;
let params = {
invWarehouseCode: this.formData.invCode,
status: 1
};
getInvSpaceList(params).then((res) => {
this.formSpaceList = res.data.list || [];
})
},
invPlace() {
this.placeDialogVisible = true;
this.formData = {
invCode: null,
invSpaceCode: null,
code: null,
codeArray: []
};
this.codeArray = [];
},
deleteCodeArray(index, row) {
for (let i = 0; i < this.codeArray.length; i++) {
if (this.codeArray[i] === row) {
this.codeArray.splice(i, 1);
return;
}
}
},
addCode(event) {
if (event != null) {
event.target.select();
invPlace(type) {
if (type === 1) {
//
this.productPlaceDialogVisible = true;
} else if (type === 2) {
this.orderPlaceDialogVisible = true;
}
this.$refs.inputRef.select();
if (isBlank(this.formData.invCode)) {
this.$message.error('当前仓库不能为空');
return;
}
if (isBlank(this.formData.invSpaceCode)) {
this.$message.error('当前货位不能为空');
return;
}
this.formData.code = this.formData.code.trim();
if (this.$isBlank(this.formData.code)) return;
let tQuery = Object.assign(JSON.parse(JSON.stringify(this.formData)));
this.checkCode(tQuery);
this.$refs.inputRef.select();
},
getInputFocus(event) {
event.currentTarget.select();
},
enterKey(event) {
this.checkSuccess = true;
this.addCode(event);
this.$refs.inputRef.focus();
this.$refs.inputRef.select();
},
checkCode(tQuery) {
//
let flag = false;
this.codeArray.forEach(item => {
if (item.code === this.formData.code) {
this.$message.error("重复条码!");
flag = true;
return;
}
});
if (flag) {
return;
closePlaceDialog(type) {
if (type === 1) {
this.productPlaceDialogVisible = false;
} else if (type === 2) {
this.orderPlaceDialogVisible = false;
}
//
checkCodeSpace(tQuery).then((res) => {
if (res.code === 20000) {
this.codeArray.push({code: this.formData.code});
} else if (res.code === 8) {
this.loading = false;
this.$message.error(res.message);
} else if (res.code === 7) {
this.$confirm(res.message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.codeArray.push({code: this.formData.code});
}).catch(() => {
this.loading = false;
});
}
});
},
saveData() {
if (isBlank(this.formData.invCode) || isBlank(this.formData.invSpaceCode)) {
this.$message.warning("请选择仓库和货位信息");
return;
}
if (this.codeArray.length === 0) {
this.$message.warning("请扫描需要摆放的货物");
return;
}
this.formData.codeArray = [];
this.codeArray.forEach(item => {
this.formData.codeArray.push(item.code);
});
bindInvSpace(this.formData).then((res) => {
if (res.code === 20000) {
this.$message.success("绑定成功");
this.placeDialogVisible = false;
this.getList();
} else {
this.$message.error("绑定失败");
}
})
this.getList();
},
},
components: {
invProductPlaceModify,
invOrderPlaceModify
},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();

@ -0,0 +1,163 @@
<template>
<div>
<el-form :model="formData" class="query-form" size="mini" label-width="100px" :inline="true">
<el-form-item prop="invWarehouseCode" label="当前仓库:">
<el-input disabled :value="formData.invName"></el-input>
</el-form-item>
<el-form-item prop="invWarehouseCode" label="单号:">
<el-input :value="formData.orderId" clearable placeholder="请输入单号"></el-input>
</el-form-item>
<el-form-item>
<el-button-group style="margin-left: 10px;display:flex;">
<el-button type="primary" icon="el-icon-refresh" @click.native.stop="reset()">重置</el-button>
<el-button type="primary" icon="el-icon-search" @click.native.stop="search()">查询</el-button>
<el-button type="primary" icon="el-icon-check" @click.native.stop="check()">选入</el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" style="width: 100%;margin-top: 20px;"
highlight-current-row
@current-change="checkedOrder"
border max-height="300" height="300">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="单号" prop="billNo" width="150"></el-table-column>
<el-table-column label="单据类型" prop="billTypeName" width="150"></el-table-column>
<el-table-column label="出入库类型" prop="mainAction" width="150">
<template slot-scope="scope">
{{ mainActionNames[scope.row.mainAction] }}
</template>
</el-table-column>
<el-table-column label="往来单位" prop="fromName" width="150"></el-table-column>
<el-table-column label="来源单号" prop="corpOrderId" width="150"></el-table-column>
<el-table-column label="单据来源" prop="fromType" width="150">
<template slot-scope="scope">
<span>{{ sourceMap[scope.row.fromType] }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" width="150"></el-table-column>
<el-table-column label="验收时间" prop="auditTime" width="150"></el-table-column>
<el-table-column label="审核人" prop="reviewUserName" width="150"></el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="getList"
></pagination>
</div>
</template>
<script>
import {getInvPlaceOrderList} from "@/api/inventory/invPlace";
import {isBlank} from "@/utils/strUtil";
export default {
props: {
closeDialog: {
type: Function,
required: true
},
formData: {
type: Object,
required: true
},
getInvProductInfo: {
type: Function,
required: true
}
},
name: "InvPlaceSelectOrder",
data() {
return {
filterQuery: {
invCode: this.formData.invCode,
orderId: null,
page: 1,
limit: 10
},
list: [],
total: 0,
codeArray: [],
invList: [],
loading: false,
orderDialogVisible: false,
mainActionNames: {
WareHouseIn: "入库",
WareHouseOut: "出库"
},
sourceMap: {
"1": "UDIMS平台",
"2": "网页新增",
"3": "pda已校验",
"4": "pda未校验",
"5": "pc端扫码精灵",
"6": "单据流转",
"7": "供应商平台",
"8": "平衡补单",
"9": "单据验收直接补单",
"10": "单据复制",
"11": "盘点单据转单",
"12": "申购计划转单",
"13": "领用单据转单",
"14": "第三方单据转单",
},
checkOrderId: null
}
},
methods: {
reset() {
this.filterQuery.orderId = null;
this.filterQuery.page = 1;
this.list = [];
this.checkOrderId = null;
this.getList();
},
search() {
this.filterQuery.page = 1;
this.getList();
},
getList() {
this.loading = true;
getInvPlaceOrderList().then((res) => {
this.loading = false;
if (res.code === 20000) {
this.list = res.data.list || [];
this.total = res.data.total || 0;
} else {
this.list = [];
this.total = 0;
}
}).catch((error) => {
this.loading = false;
this.list = [];
this.total = 0;
});
},
check() {
if (isBlank(this.checkOrderId)) {
this.$message.error("请选择单据");
return;
}
this.getInvProductInfo(this.checkOrderId);
this.closeDialog();
},
checkedOrder(order) {
this.checkOrderId = order.billNo;
},
},
created() {
this.getInvList();
},
}
</script>
<style scoped>
</style>

@ -0,0 +1,268 @@
<template>
<el-form :model="formData" label-width="100px">
<el-button-group style="display: flex;margin: 0px 0 10px 80%; height: 35px">
<el-button size="mini" type="primary" @click.native="saveData()">提交</el-button>
<el-button size="mini" type="primary" @click.native="closePlaceDialog(1)">关闭</el-button>
</el-button-group>
<el-row>
<el-col :span="10">
<el-form-item prop="invWarehouseCode" label="当前仓库:">
<el-select v-model="formData.invCode"
placeholder="当前仓库信息"
:disabled="list.length>0"
@change="invChange"
style="width: 90%"
clearable>
<el-option
v-for="item in invList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item class="query-form-item" label="当前货位:">
<el-autocomplete
v-model="formData.invSpaceName"
:fetch-suggestions="querySearchAsync"
placeholder="请输入内容"
@select="handleSelect"
clearable
style="width: 90%"
></el-autocomplete>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="18">
<el-form-item class="query-form-item" label="扫码录入:">
<el-input
id="inputer"
@focus="getInputFocus($event)"
@keypress.enter.native="enterKey($event)"
ref='inputRef'
style="ime-mode:disabled"
type="tel"
v-model="formData.code"
></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button
type="primary"
size="mini"
@click.native.stop="addCode()"
style="margin-left: 15px"
>添加
</el-button
>
</el-col>
</el-row>
<el-table v-loading="loading" :data="list" style="width: 100%;margin-top: 20px;"
highlight-current-row
border max-height="300" height="300">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="DI/物资编码" prop="relId" width="150"></el-table-column>
<el-table-column label="物资名称" prop="productName" width="150"></el-table-column>
<el-table-column label="规格型号" prop="ggxh" width="150"></el-table-column>
<el-table-column label="批次号" prop="batchNo" width="150"></el-table-column>
<el-table-column label="序列号" prop="serialNo" width="150"></el-table-column>
<el-table-column label="计量单位" prop="measname" width="150"></el-table-column>
<el-table-column label="货位" prop="invSpaceName" width="150"></el-table-column>
<el-table-column label="注册备案号" prop="zczbhhzbapzbh" width="150"></el-table-column>
<el-table-column label="生产厂家" prop="manufactory" width="150"></el-table-column>
<el-table-column label="供应商" prop="supName" width="150"></el-table-column>
</el-table>
</el-form>
</template>
<script>
import {getInvListByUser} from "@/api/system/invWarehouse";
import {getInvSpaceList} from "@/api/inventory/invSpace";
import {isBlank} from "@/utils/strUtil";
import {bindInvSpace, getInvProductInfo} from "@/api/inventory/invPlace";
export default {
props: {
closePlaceDialog: {
type: Function,
required: true
}
},
name: "InvProductPlaceModify",
data() {
return {
formData: {
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
invSpaceName: null,
code: null,
},
list: [],
codeArray: [],
invList: [],
spaceList: [],
loading: false
}
},
methods: {
saveData() {
if (isBlank(this.formData.invCode)) {
this.$message.error("请选择当前仓库");
return;
}
if (isBlank(this.formData.invSpaceCode)) {
this.$message.error("请选择当前货位");
return;
}
if (this.list.length === 0) {
this.$message.error("请录入需要上架的物资数据");
return;
}
this.$confirm('是否确认保存当前数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.list.forEach((item) => {
this.codeArray.push(item.code);
});
let params = {
invCode: this.formData.invCode,
invSpaceCode: this.formData.invSpaceCode,
codeArray: this.codeArray
};
bindInvSpace(params).then((res) => {
if (res.code === 20000) {
this.$message.success("上架成功");
this.clearFormData();
} else {
this.$message.error(res.message);
}
}).catch((error) => {
this.$message.error(error.message);
});
}).catch(() => {
});
},
clearFormData() {
//
this.formData = {
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
invSpaceName: null,
code: null,
};
this.codeArray = [];
this.list = [];
},
invChange() {
this.formData.invSpaceCode = null;
this.formData.invSpaceName = null;
this.list.forEach((item) => {
item.invSpaceCode = null;
item.invSpaceName = null;
})
this.getSpaceList();
},
querySearchAsync(queryString, cb) {
let restaurants = this.spaceList;
restaurants.forEach((item) => {
item.value = item.name;
})
let results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
cb(results);
},
createStateFilter(queryString) {
return (state) => {
return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
};
},
handleSelect(item) {
this.formData.invSpaceCode = item.code;
this.formData.invSpaceName = item.name;
this.list.forEach((invProduct) => {
invProduct.invSpaceCode = item.code;
invProduct.invSpaceName = item.name;
});
},
getInvList() {
getInvListByUser()
.then((response) => {
this.invList = response.data || [];
this.getSpaceList();
this.getList();
})
.catch(() => {
});
},
getSpaceList() {
let params = {
invWarehouseCode: this.formData.invCode,
status: 1
};
getInvSpaceList(params).then((res) => {
this.spaceList = res.data.list || [];
})
},
addCode(event) {
if (event != null) {
event.target.select();
}
this.$refs.inputRef.select();
if (isBlank(this.formData.invCode)) {
this.$message.error('当前仓库不能为空');
return;
}
if (isBlank(this.formData.invSpaceCode)) {
this.$message.error('当前货位不能为空');
return;
}
this.formData.code = this.formData.code.trim();
if (this.$isBlank(this.formData.code)) return;
this.getInvProductInfo(this.formData.code);
this.$refs.inputRef.select();
},
getInvProductInfo(code) {
let params = {
invCode: this.formData.invCode,
invSpaceCode: this.formData.invSpaceCode,
code: code
};
getInvProductInfo(params).then((res) => {
if (res.data !== null) {
res.data.forEach((item) => {
this.list.push(item);
});
} else {
this.$message.warning("未查询到产品信息");
}
})
},
getInputFocus(event) {
event.currentTarget.select();
},
enterKey(event) {
this.checkSuccess = true;
this.addCode(event);
this.$refs.inputRef.focus();
this.$refs.inputRef.select();
},
},
created() {
this.getInvList();
},
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save