|
<template>
|
<div ref="container" class="page-list-container">
|
<!--数据Table-->
|
<yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes" @on-load-dropdown-after="onLoadDropdownAfter">
|
</yrt-data-list>
|
|
<!--数据编辑器Editor-->
|
<yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes">
|
</yrt-editor>
|
|
<el-dialog :visible.sync="dialogFormVisible" title="空器具回库任务" width="30%">
|
<el-form :label-width="formLabelWidth">
|
<el-form-item label="选择仓库">
|
<el-col :span="11">
|
<el-select v-model="emptyReturn.storage_Id" placeholder="请选择仓库" @change="storageChange">
|
<el-option v-for="item in storageList" :key="item.storage_Id" :label="item.storageName" :value="item.storage_Id">
|
</el-option>
|
</el-select>
|
</el-col>
|
<!-- <el-input v-model="name"></el-input> -->
|
</el-form-item>
|
<el-form-item label="空器具所在工位">
|
<el-col :span="11">
|
<el-select v-model="emptyReturn.destination_Id" placeholder="请选择所在工位" @change="destinationChange">
|
<el-option v-for="item in destinationList" :key="item.destination_Id" :label="item.destinationName" :value="item.destination_Id">
|
</el-option>
|
</el-select>
|
</el-col>
|
<!-- <el-input v-model="name"></el-input> -->
|
</el-form-item>
|
<el-form-item label="空器具数量">
|
<el-col :span="11">
|
<el-input v-model="emptyReturn.totalQuantity"></el-input>
|
</el-col>
|
</el-form-item>
|
<el-form-item label="备注">
|
<el-col :span="11">
|
<el-input v-model="emptyReturn.remark"></el-input>
|
</el-col>
|
</el-form-item>
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
<el-button type="primary" @click="addNewOrder">确 定</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
|
export default {
|
name: "sys",
|
components: {},
|
mixins: [baseLayout],
|
data() {
|
return {
|
dialogFormVisible: false,
|
formLabelWidth: "120px",
|
emptyReturn: {
|
storage_Id: 87,
|
storageName: "立体仓"
|
},
|
destinationList: [],
|
// 仓库下拉框
|
storageList: []
|
};
|
},
|
mounted() {
|
this.getAlldestinationList();
|
},
|
methods: {
|
// 权限按钮点击事件
|
buttonClick(authNode) {
|
switch (authNode) {
|
// 新建
|
case "add":
|
this.dialogFormVisible = true;
|
return true;
|
}
|
},
|
// 明细按钮点击事件
|
detailButtonClick(authNode) {
|
switch (authNode) {
|
case "detailAdd":
|
// 商品明细添加
|
this.detailAdd();
|
return true;
|
}
|
},
|
// 新建确认事件
|
addNewOrder() {
|
var url = "/api/inbound/quipmentReturn/save";
|
const params = Object.assign({}, this.emptyReturn);
|
var callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.dataList.reload();
|
this.dialogFormVisible = false;
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
getAlldestinationList() {
|
const url = "api/basicInfo/base/destination/getList";
|
const params = {};
|
var callback = res => {
|
if (res.result) {
|
this.destinationList = res.data;
|
console.log(this.destinationList);
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
// 选择器具
|
destinationChange() {
|
const item = this.destinationList.find(item => Number(item.destination_Id) === Number(this.emptyReturn.destination_Id));
|
if (item) {
|
this.emptyReturn.destinationName = item.destinationName;
|
}
|
},
|
// 选择仓库
|
storageChange() {
|
const item = this.storageList.find(item => Number(item.storage_Id) === Number(this.emptyReturn.storage_Id));
|
if (item) {
|
this.emptyReturn.storageName = item.storageName;
|
}
|
},
|
// 下拉框加载完毕后
|
onLoadDropdownAfter(dropdownData) {
|
this.storageList = this.dataList.getDropDownData(31);
|
},
|
// 明细添加
|
detailAdd() {
|
this.$prompt("请输入器具编号", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消"
|
})
|
.then(({ value }) => {
|
this.getScanData(value);
|
})
|
.catch(() => {
|
this.$message({
|
type: "info",
|
message: "取消输入"
|
});
|
});
|
},
|
// 选择物料编号带出明细数据
|
getScanData(plateCode) {
|
debugger;
|
this.masterData.plateCode = this.decode(plateCode); // 解码
|
const existPlateCode = this.detailRows.find(item => item.plateCode === plateCode);
|
if (existPlateCode) {
|
this.showError("已存在,不可重复扫描!");
|
return;
|
}
|
|
if (!plateCode) {
|
this.showError("器具编号不能为空");
|
return;
|
}
|
const url = "/api/basicInfo/base/plate/getPlateInfo";
|
var params = {
|
plateCode: plateCode
|
};
|
this.common.ajax(
|
url,
|
params,
|
res => {
|
if (res.result) {
|
this.masterData.storage_Id = res.data.storage_Id;
|
this.masterData.storageName = res.data.storageName;
|
this.masterData.plateType = res.data.plateType;
|
this.masterData.plateType_Id = res.data.plateType_Id;
|
this.masterData.packingQuantity = res.data.packingQuantity;
|
res.data.product_Id = 0;
|
res.data.productCode = res.data.plateCode;
|
res.data.productName = res.data.plateName;
|
this.detailRows.push(res.data);
|
}
|
},
|
true
|
);
|
}
|
}
|
};
|
</script>
|