You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
316 lines
9.4 KiB
Vue
316 lines
9.4 KiB
Vue
<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" show-tooltip-when-overflow></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" show-tooltip-when-overflow></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"
|
|
:getInvProductInfo="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,
|
|
orderId: 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>
|