youxioaqi&batch

This commit is contained in:
shijing 2022-06-14 11:05:31 +08:00
parent bd527d31c6
commit 7640f53757
3 changed files with 42 additions and 16 deletions

View File

@ -160,7 +160,7 @@
</el-form-item>
<el-col :span="12">
<el-form-item label="编号">
<el-input v-model="number" placeholder="编号"/>
<el-input v-model="number" @input="checkValue" placeholder="编号"/>
</el-form-item>
</el-col>
<el-col :span="12">
@ -306,6 +306,9 @@
}
},
methods: {
checkValue() {
this.number = this.number.replace(/[^0-9a-zA-Z]/g, '');
},
filterBlock(rule, index, field_key) {
let that = this;
if (rule !== '' && rule !== null && rule !== undefined) {

View File

@ -346,7 +346,7 @@
label="批次"
:prop="'details.' + index + '.batch'"
>
<el-input v-model="item.batch" placeholder="批次号"></el-input>
<el-input v-model="item.batch" @input="checkValueItem(index)" minlength="6" placeholder="请输入数字或字母且最小六位数"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -379,7 +379,7 @@
<i class="el-icon-remove-outline" style="font-size: 20px"></i>
</el-button>
</div>
<el-input style="width: 300px;" clearable v-model="itemDetails" placeholder="物料编号,回车确定编号" @keyup.enter.native="detailEnter(itemDetails,index)"></el-input>
<el-input style="width: 300px;" @input="checkValue" clearable v-model="itemDetails" placeholder="物料编号,回车确定编号" @keyup.enter.native="detailEnter(itemDetails,index)"></el-input>
</el-form-item>
</el-col>
<!-- 删除按钮 -->
@ -465,7 +465,7 @@
material: "", // 物料
count: "", //数量
batch: "", //批次
expiration_date: "", //
expiration_date: null, //
details:[],
},
],
@ -481,6 +481,13 @@
export default {
components: {Pagination},
data() {
const validateBatch = (rule, value, callback) => {
if (value.length < 6) {
callback(new Error("请输入不小于六位!"));
} else {
callback();
}
};
return {
inventory: defaulteinventory,
outfifo: defaulteoutfifo,
@ -513,6 +520,7 @@
dialogVisibles: false,
rule1: {
name: [{required: true, message: "请输入", trigger: "blur"}],
batch: [{required: true, message: "请输入不小于六位", trigger: "blur", validator: validateBatch},],
},
};
},
@ -526,6 +534,12 @@
this.getpuorderList();
},
methods: {
checkValue() {
this.itemDetails = this.itemDetails.replace(/[^0-9a-zA-Z]/g, '');
},
checkValueItem(index) {
this.inventory.details[index].batch = this.inventory.details[index].batch.replace(/[^0-9a-zA-Z]/g, '');
},
detailEnter(item,index){
this.inventory.details[index].details.push({number:item});
this.itemDetails = '';
@ -639,7 +653,7 @@
material: "", // 物料
count: "", //数量
batch: "", //批次
expiration_date: "", //
expiration_date: null, //
details:[],
},
];
@ -711,9 +725,12 @@
},
async confirm(form) {
console.log(this.inventory);
let isbatch = false;
let details = [];
this.inventory.details.forEach(item=>{
if(item.batch.length<6){
isbatch = true;
}
let obj = new Object();
if(item.details.length>0){
obj = item;
@ -726,14 +743,18 @@
}
details.push(obj);
});
this.inventory.details = details;
createInother(this.inventory).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
if(isbatch){
this.$message.warning("批次号不能少于六位数");
}else{
this.inventory.details = details;
createInother(this.inventory).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {

View File

@ -238,7 +238,7 @@
</el-date-picker>
</el-form-item>
<el-form-item label="任务编号" prop="number">
<el-input v-model="orderplan.number" placeholder="任务编号"/>
<el-input v-model="orderplan.number" @input="checkValue" placeholder="任务编号"/>
</el-form-item>
</el-form>
<div style="text-align: right">
@ -336,7 +336,9 @@
},
methods: {
checkPermission,
checkValue() {
this.orderplan.number = this.orderplan.number.replace(/[^0-9a-zA-Z]/g, '');
},
//订单列表
getorderList() {
this.listLoading = true;