fix:交接记录手动添加时多选物料
This commit is contained in:
parent
6a7975e6ce
commit
b92937fb9b
|
@ -123,25 +123,38 @@
|
|||
<el-form-item label="交接物料">
|
||||
<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-col v-if="addShow">
|
||||
<el-form-item label="">
|
||||
<xtSelect
|
||||
:apiObj="listApiObj"
|
||||
:params = "listParams"
|
||||
v-model="optionNames"
|
||||
v-model:obj="optionItems"
|
||||
style="width: 100%"
|
||||
:multiple="true"
|
||||
>
|
||||
<el-table-column label="id" prop="id"></el-table-column>
|
||||
<el-table-column label="批次" prop="batch"></el-table-column>
|
||||
<el-table-column label="数量" prop="count_cando"></el-table-column>
|
||||
</xtSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-row v-show="addShow">
|
||||
<el-col>
|
||||
<el-form-item label="交接物料">
|
||||
<el-select
|
||||
v-model="selectItems"
|
||||
placeholder="交接物料"
|
||||
filterable
|
||||
multiple
|
||||
clearable
|
||||
@change="materialChange"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in materialOptions"
|
||||
:key="item.id"
|
||||
:label="item.batch"
|
||||
:value="item.id"
|
||||
>
|
||||
<span>{{ item.batch }}</span>
|
||||
<div style="float: right">
|
||||
<span>{{ item.count }}</span>
|
||||
<span v-if="item.notok_sign_name !== null" style="color: #aaaaaa">
|
||||
({{ item.notok_sign_name }})
|
||||
</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
|
||||
<el-col :span="10">
|
||||
<el-form-item label="交接物料">
|
||||
|
@ -177,61 +190,6 @@
|
|||
<el-row>
|
||||
<div class="total-count">总计:{{ totalCount }}</div>
|
||||
</el-row>
|
||||
<!-- <el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
|
||||
<el-col :span="10">
|
||||
<el-form-item label="交接物料">
|
||||
<el-select
|
||||
v-if="mode!=='show'"
|
||||
v-model="listItem.wm"
|
||||
placeholder="交接物料"
|
||||
filterable
|
||||
clearable
|
||||
@change="materialChange($index)"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in materialOptions"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.id"
|
||||
>
|
||||
<span>{{ item.batch }}</span>
|
||||
<div style="float: right">
|
||||
<span>{{ item.count }}</span>
|
||||
<span v-if="item.notok_sign_name !== null" style="color: #aaaaaa">
|
||||
({{ item.notok_sign_name }})
|
||||
</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-input v-else v-model="listItem.batch" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<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%"
|
||||
placeholder="交接数量"
|
||||
>
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2" v-if="mode!=='show'">
|
||||
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
|
||||
</el-col>
|
||||
</el-row> -->
|
||||
</el-form>
|
||||
<el-footer v-if="mode!=='show'">
|
||||
<el-button type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
|
||||
|
@ -262,6 +220,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
selectItems:[],
|
||||
yseorno: ["是", "否"],
|
||||
loading: false,
|
||||
mode: "add",
|
||||
|
@ -333,8 +292,6 @@ export default {
|
|||
|
||||
},
|
||||
totalCount: 0,
|
||||
optionNames:[""],
|
||||
optionItems:[],
|
||||
deptID:'',
|
||||
userList: [],
|
||||
userList2: [],
|
||||
|
@ -346,33 +303,8 @@ export default {
|
|||
scanVisible:false,
|
||||
isSaveing: false,
|
||||
setFiltersVisible: false,
|
||||
listApiObj:this.$API.wpm.wmaterial.list,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
optionItems: {
|
||||
handler: function (val) {
|
||||
let that = this;
|
||||
that.optionNames = [];
|
||||
that.form.handoverb = [];
|
||||
let totalCount = 0;
|
||||
val.forEach(item=>{
|
||||
let obj = new Object();
|
||||
obj.wm = item.id;
|
||||
obj.batch = item.batch;
|
||||
obj.name = item.material_name;
|
||||
obj.count_cando = item.count_cando;
|
||||
obj.count = item.count_cando;
|
||||
obj.notok_sign = item.notok_sign;
|
||||
that.form.handoverb.push(obj);
|
||||
that.optionNames.push(item.id)
|
||||
totalCount += item.count_cando;
|
||||
})
|
||||
that.totalCount = totalCount;
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
that.form.type = that.type;
|
||||
|
@ -440,14 +372,7 @@ export default {
|
|||
req.belong_dept=res[0].id;
|
||||
that.listParams = req;
|
||||
this.$API.wpm.wmaterial.list.req(req).then((res) => {
|
||||
let arr = [];
|
||||
res.forEach(item=>{
|
||||
let obj = {};
|
||||
Object.assign(obj,item);
|
||||
obj.label = item.batch;
|
||||
arr.push(obj);
|
||||
})
|
||||
that.materialOptions = arr;
|
||||
that.materialOptions = res;
|
||||
});
|
||||
}
|
||||
})
|
||||
|
@ -457,14 +382,7 @@ export default {
|
|||
req.belong_dept=res[0].id;
|
||||
that.listParams = req;
|
||||
this.$API.wpm.wmaterial.list.req(req).then((res) => {
|
||||
let arr = [];
|
||||
res.forEach(item=>{
|
||||
let obj = {};
|
||||
Object.assign(obj,item);
|
||||
obj.label = item.batch;
|
||||
arr.push(obj);
|
||||
})
|
||||
that.materialOptions = arr;
|
||||
that.materialOptions = res;
|
||||
});
|
||||
}
|
||||
})
|
||||
|
@ -472,14 +390,7 @@ export default {
|
|||
req.mgroupx = that.mgroupId;
|
||||
that.listParams = req;
|
||||
this.$API.wpm.wmaterial.list.req(req).then((res) => {
|
||||
let arr = [];
|
||||
res.forEach(item=>{
|
||||
let obj = {};
|
||||
Object.assign(obj,item);
|
||||
obj.label = item.batch;
|
||||
arr.push(obj);
|
||||
})
|
||||
that.materialOptions = arr;
|
||||
that.materialOptions = res;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -494,14 +405,7 @@ export default {
|
|||
};
|
||||
that.listParams = req;
|
||||
this.$API.wpm.wmaterial.list.req(req).then((res) => {
|
||||
let arr = [];
|
||||
res.forEach(item=>{
|
||||
let obj = {};
|
||||
Object.assign(obj,item);
|
||||
obj.label = item.batch+'('+item.notok_sign_name+')';
|
||||
arr.push(obj);
|
||||
})
|
||||
that.materialOptions = arr;
|
||||
that.materialOptions = res;
|
||||
});
|
||||
},
|
||||
//获取交送工段人员
|
||||
|
@ -515,9 +419,9 @@ export default {
|
|||
getCkUserList() {
|
||||
let that = this;
|
||||
this.$API.system.user.list.req({ page: 0, posts__code: "inm&check" })
|
||||
.then((res) => {
|
||||
that.userList2 = res;
|
||||
});
|
||||
.then((res) => {
|
||||
that.userList2 = res;
|
||||
});
|
||||
},
|
||||
//获取接收工段人员
|
||||
getUserList2() {
|
||||
|
@ -543,7 +447,6 @@ export default {
|
|||
},
|
||||
addMaterial(){
|
||||
this.addShow = true;
|
||||
// this.form.handoverb.push({wm:'',count:'',counts:null});
|
||||
},
|
||||
delMaterial(index){
|
||||
this.form.handoverb.splice(index,1);
|
||||
|
@ -555,14 +458,19 @@ export default {
|
|||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
materialChange(index) {
|
||||
let val = this.form.handoverb[index].wm;
|
||||
let data = this.materialOptions.filter((item) => {
|
||||
return item.id == val;
|
||||
materialChange() {
|
||||
let that = this;
|
||||
let totalCount = 0;
|
||||
let data = that.materialOptions.filter((item) => {
|
||||
return that.selectItems.indexOf(item.id)>-1;
|
||||
});
|
||||
this.form.handoverb[index].batch = data[0].batch;
|
||||
this.form.handoverb[index].counts = data[0].count;
|
||||
this.form.handoverb[index].count = data[0].count;
|
||||
data.forEach(item=>{
|
||||
item.vm = item.id;
|
||||
item.count = item.count_cando;
|
||||
totalCount += item.count_cando;
|
||||
})
|
||||
that.totalCount = totalCount;
|
||||
that.form.handoverb = data;
|
||||
},
|
||||
countChange(){
|
||||
let that = this;
|
||||
|
@ -574,18 +482,6 @@ export default {
|
|||
that.totalCount = totalCount;
|
||||
}
|
||||
},
|
||||
//初始化
|
||||
init() {
|
||||
this.form = {
|
||||
handoverb: [],
|
||||
handovera: [],
|
||||
handoverc: [],
|
||||
handoverd: [],
|
||||
}
|
||||
this.form.handoverb.forEach(item=>{
|
||||
|
||||
})
|
||||
},
|
||||
//提交
|
||||
submit() {
|
||||
let that = this;
|
||||
|
@ -647,9 +543,6 @@ export default {
|
|||
scanCode(){
|
||||
let that = this;
|
||||
that.scanVisible = true;
|
||||
// that.$nextTick(() => {
|
||||
// that.$refs.scanDialog.open();
|
||||
// });
|
||||
},
|
||||
scanClose(data){
|
||||
if(data==''||data==undefined||data==null){
|
||||
|
@ -659,17 +552,14 @@ export default {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue