<template>
|
<el-dialog v-dialogDrag ref="uploadRef" :visible.sync="currentDialogVisible" :title="title" class="import-dialog-container" width="480px" @close="dialogClose">
|
<el-form ref="form" label-width="120px">
|
<el-row>
|
<el-form-item label="物料号:" label-width="150px">
|
<el-select v-model="form.product_Id" placeholder="请选择" @change="onChangeProductCode">
|
<el-option v-for="item in dataInfo" :key="item.product_Id" :label="item.productCode" :value="item.product_Id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="空器具库存数:" label-width="150px">
|
<label for="" style="color:#ff1100">{{ form.stockQuantity }}</label>
|
</el-form-item>
|
<el-form-item label="空器具需求数量:" label-width="150px">
|
<el-input v-model="form.demandQuantity" :value="value2" class="w-200" @change="onChangeDemandQuantity"></el-input>
|
</el-form-item>
|
</el-row>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="hideDialog()">取 消</el-button>
|
<el-button type="primary" @click="save('form')">确认</el-button>
|
</div>
|
</el-dialog>
|
</template>
|
<script>
|
export default {
|
props: {
|
visible: {
|
type: Boolean,
|
default: false
|
},
|
label: {
|
type: String,
|
default: null
|
},
|
config: {
|
type: Object,
|
default: () => {
|
return {};
|
}
|
},
|
// 导入前事件
|
beforeImportSubmit: {
|
type: Function,
|
default: () => {
|
return () => {};
|
}
|
}
|
},
|
data() {
|
return {
|
form: {
|
product_Id: null,
|
productCode: null,
|
stockQuantity: null,
|
demandQuantity: null
|
},
|
dataInfo: [],
|
value: null,
|
value2: null
|
};
|
},
|
computed: {
|
// 标题
|
title: function() {
|
return this.config.title || "批量导入操作";
|
},
|
// 显示窗口
|
currentDialogVisible: {
|
get: function() {
|
return this.visible;
|
},
|
set: function(val) {
|
this.$emit("update:visible", val);
|
}
|
}
|
},
|
mounted() {
|
this.uploadKey = this.common.getGUID();
|
this.productinfo();
|
},
|
methods: {
|
// 司机改变事件
|
onDriverChange(value) {},
|
onVehicleChange(value) {},
|
// 合并到表单中
|
childListInfo(ids, total) {},
|
// 保存数据
|
save() {
|
if (this.form.stockQuantity < this.form.demandQuantity) {
|
this.$message.error("需求数量不能大于库存数量!");
|
return;
|
}
|
const url = "/api/inbound/emptyEquipment/save";
|
const formData = this.form;
|
const params = {
|
formData: formData
|
};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.currentDialogVisible = false;
|
this.$parent.dataList.reload();
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
hideDialog() {
|
this.currentDialogVisible = false;
|
},
|
// 关闭窗口
|
dialogClose() {
|
this.$emit("on-close"); // 关闭事件
|
},
|
// 获取下拉框数据
|
productinfo() {
|
const url = "/api/basicInfo/product/productInfo/productInfo";
|
const params = {};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.dataInfo = res.data;
|
}
|
};
|
this.common.ajax(url, params, callback);
|
},
|
onChangeProductCode(productId) {
|
const url = "/api/inbound/emptyEquipment/onChangeProductCode";
|
const params = {
|
product_Id: productId
|
};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
this.form.stockQuantity = res.data.leth;
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
onChangeDemandQuantity(value2) {
|
this.form.demandQuantity = value2;
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.import-dialog-container {
|
/deep/ .el-upload-list {
|
margin-right: 20px;
|
}
|
/deep/ .scrollbar-wrap {
|
max-height: 400px;
|
overflow-x: hidden;
|
padding: 0px;
|
padding-bottom: 30px !important;
|
padding-top: 0px !important;
|
}
|
.msg-container {
|
margin: 0;
|
padding: 0;
|
.msg-item {
|
margin: 0;
|
padding: 5px 0;
|
word-wrap: break-word;
|
}
|
}
|
.body-content {
|
margin-top: 20px;
|
}
|
}
|
</style>
|