feat:工段交接记录新增时扫码添加物料
This commit is contained in:
parent
4acdc9f4cd
commit
88fc695454
|
@ -113,15 +113,16 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item label="交接物料">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="addMaterial" v-if="mode!=='show'"></el-button>
|
||||
<el-button type="primary" @click="addMaterial" v-if="mode!=='show'">手动添加</el-button>
|
||||
<scan-dialog ref="scanDialog" @closed="scanClose"> </scan-dialog>
|
||||
<!-- <el-button type="primary" @click="scanCode" v-if="mode!=='show'">扫码添加</el-button> -->
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
|
||||
<el-col :span="11">
|
||||
<el-col :span="10">
|
||||
<el-form-item label="交接物料">
|
||||
<el-select
|
||||
v-if="mode!=='show'"
|
||||
|
@ -129,6 +130,7 @@
|
|||
placeholder="交接物料"
|
||||
filterable
|
||||
clearable
|
||||
@change="materialChange($index)"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
|
@ -149,13 +151,19 @@
|
|||
<el-input v-else v-model="listItem.batch" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-col :span="5">
|
||||
<el-form-item label="总数量">
|
||||
<span>{{ listItem.counts }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item label="交接数量">
|
||||
<el-input-number
|
||||
v-model="listItem.count"
|
||||
controls-position="right"
|
||||
:min="0"
|
||||
step="1"
|
||||
:max="listItem.counts"
|
||||
:disabled="mode==='show'"
|
||||
:step-strictly="true"
|
||||
style="width: 100%"
|
||||
|
@ -170,14 +178,19 @@
|
|||
</el-row>
|
||||
</el-form>
|
||||
<el-footer v-if="mode!=='show'">
|
||||
<el-button type="primary" v-loading="isSaveing" @click="submit"
|
||||
>确定</el-button
|
||||
>
|
||||
<el-button type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-dialog>
|
||||
<!-- <scan-dialog
|
||||
v-if="scanVisible"
|
||||
ref="scanDialog"
|
||||
@closed="scanClose"
|
||||
>
|
||||
</scan-dialog> -->
|
||||
</template>
|
||||
<script>
|
||||
import scanDialog from "./../template/scan.vue";
|
||||
export default {
|
||||
emits: ["success", "closed"],
|
||||
props: {
|
||||
|
@ -194,6 +207,9 @@ export default {
|
|||
default: "",
|
||||
},
|
||||
},
|
||||
components: {
|
||||
scanDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
yseorno: ["是", "否"],
|
||||
|
@ -212,7 +228,7 @@ export default {
|
|||
send_mgroup: null,
|
||||
recive_user: null,
|
||||
recive_mgroup: null,
|
||||
handoverb:[{wm:'',count:''}],
|
||||
handoverb:[],
|
||||
},
|
||||
rules: {
|
||||
batch: [
|
||||
|
@ -270,6 +286,7 @@ export default {
|
|||
mgroupOptions: [],
|
||||
materialOptions: [],
|
||||
visible: false,
|
||||
scanVisible:false,
|
||||
isSaveing: false,
|
||||
setFiltersVisible: false,
|
||||
};
|
||||
|
@ -440,7 +457,7 @@ export default {
|
|||
});
|
||||
},
|
||||
addMaterial(){
|
||||
this.form.handoverb.push({wm:'',count:''});
|
||||
this.form.handoverb.push({wm:'',count:'',counts:null});
|
||||
},
|
||||
delMaterial(index){
|
||||
this.form.handoverb.splice(index,1);
|
||||
|
@ -451,11 +468,14 @@ export default {
|
|||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
materialChange(val) {
|
||||
materialChange(index) {
|
||||
let val = this.form.handoverb[index].wm;
|
||||
let data = this.materialOptions.filter((item) => {
|
||||
return item.id == val;
|
||||
});
|
||||
this.form.batch = data[0].batch;
|
||||
this.form.handoverb[index].batch = data[0].batch;
|
||||
this.form.handoverb[index].counts = data[0].count;
|
||||
this.form.handoverb[index].count = data[0].count;
|
||||
},
|
||||
//提交
|
||||
submit() {
|
||||
|
@ -514,6 +534,47 @@ export default {
|
|||
this.selectionFilters = filters;
|
||||
this.setFiltersVisible = true;
|
||||
},
|
||||
//扫描
|
||||
scanCode(){
|
||||
let that = this;
|
||||
that.scanVisible = true;
|
||||
// that.$nextTick(() => {
|
||||
// that.$refs.scanDialog.open();
|
||||
// });
|
||||
},
|
||||
scanClose(data){
|
||||
if(data==''||data==undefined||data==null){
|
||||
return;
|
||||
}
|
||||
let that = this;
|
||||
let id =data.split(':')[1];
|
||||
console.log('id',id);
|
||||
this.$API.cm.labelmat.item.req(id).then((res) => {
|
||||
console.log('res',res);
|
||||
let arr = that.form.handoverb.filter((item) => {
|
||||
return item.batch == res.batch;
|
||||
})
|
||||
console.log('arr',arr);
|
||||
if(arr.length>0){
|
||||
that.$message.error("该批次已存在")
|
||||
}else{
|
||||
that.materialOptions.forEach((item) => {
|
||||
if(item.batch == res.batch){
|
||||
let arr = that.form.handoverb
|
||||
let obj = {};
|
||||
obj.wm = item.id;
|
||||
obj.batch = item.batch;
|
||||
obj.counts = item.count;
|
||||
obj.count = item.count;
|
||||
that.form.handoverb.push(obj)
|
||||
that.$refs.scanDialog.closed();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
//根据扫描内容,获取物料详情匹配当前库存物料
|
||||
this.scanVisible = false;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue