feat:工段交接记录新增时扫码添加物料
This commit is contained in:
parent
4acdc9f4cd
commit
88fc695454
|
@ -113,15 +113,16 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-form-item label="交接物料">
|
<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-form-item>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
|
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
|
||||||
<el-col :span="11">
|
<el-col :span="10">
|
||||||
<el-form-item label="交接物料">
|
<el-form-item label="交接物料">
|
||||||
<el-select
|
<el-select
|
||||||
v-if="mode!=='show'"
|
v-if="mode!=='show'"
|
||||||
|
@ -129,6 +130,7 @@
|
||||||
placeholder="交接物料"
|
placeholder="交接物料"
|
||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
|
@change="materialChange($index)"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
|
@ -149,13 +151,19 @@
|
||||||
<el-input v-else v-model="listItem.batch" disabled></el-input>
|
<el-input v-else v-model="listItem.batch" disabled></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</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-form-item label="交接数量">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model="listItem.count"
|
v-model="listItem.count"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
:min="0"
|
:min="0"
|
||||||
step="1"
|
step="1"
|
||||||
|
:max="listItem.counts"
|
||||||
:disabled="mode==='show'"
|
:disabled="mode==='show'"
|
||||||
:step-strictly="true"
|
:step-strictly="true"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
|
@ -170,14 +178,19 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-footer v-if="mode!=='show'">
|
<el-footer v-if="mode!=='show'">
|
||||||
<el-button type="primary" v-loading="isSaveing" @click="submit"
|
<el-button type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
|
||||||
>确定</el-button
|
|
||||||
>
|
|
||||||
<el-button @click="visible = false">取消</el-button>
|
<el-button @click="visible = false">取消</el-button>
|
||||||
</el-footer>
|
</el-footer>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<!-- <scan-dialog
|
||||||
|
v-if="scanVisible"
|
||||||
|
ref="scanDialog"
|
||||||
|
@closed="scanClose"
|
||||||
|
>
|
||||||
|
</scan-dialog> -->
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import scanDialog from "./../template/scan.vue";
|
||||||
export default {
|
export default {
|
||||||
emits: ["success", "closed"],
|
emits: ["success", "closed"],
|
||||||
props: {
|
props: {
|
||||||
|
@ -194,6 +207,9 @@ export default {
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
scanDialog
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
yseorno: ["是", "否"],
|
yseorno: ["是", "否"],
|
||||||
|
@ -212,7 +228,7 @@ export default {
|
||||||
send_mgroup: null,
|
send_mgroup: null,
|
||||||
recive_user: null,
|
recive_user: null,
|
||||||
recive_mgroup: null,
|
recive_mgroup: null,
|
||||||
handoverb:[{wm:'',count:''}],
|
handoverb:[],
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
batch: [
|
batch: [
|
||||||
|
@ -270,6 +286,7 @@ export default {
|
||||||
mgroupOptions: [],
|
mgroupOptions: [],
|
||||||
materialOptions: [],
|
materialOptions: [],
|
||||||
visible: false,
|
visible: false,
|
||||||
|
scanVisible:false,
|
||||||
isSaveing: false,
|
isSaveing: false,
|
||||||
setFiltersVisible: false,
|
setFiltersVisible: false,
|
||||||
};
|
};
|
||||||
|
@ -440,7 +457,7 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addMaterial(){
|
addMaterial(){
|
||||||
this.form.handoverb.push({wm:'',count:''});
|
this.form.handoverb.push({wm:'',count:'',counts:null});
|
||||||
},
|
},
|
||||||
delMaterial(index){
|
delMaterial(index){
|
||||||
this.form.handoverb.splice(index,1);
|
this.form.handoverb.splice(index,1);
|
||||||
|
@ -451,11 +468,14 @@ export default {
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
materialChange(val) {
|
materialChange(index) {
|
||||||
|
let val = this.form.handoverb[index].wm;
|
||||||
let data = this.materialOptions.filter((item) => {
|
let data = this.materialOptions.filter((item) => {
|
||||||
return item.id == val;
|
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() {
|
submit() {
|
||||||
|
@ -514,6 +534,47 @@ export default {
|
||||||
this.selectionFilters = filters;
|
this.selectionFilters = filters;
|
||||||
this.setFiltersVisible = true;
|
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>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue