fix:mlogb中的工艺步骤选择

This commit is contained in:
shijing 2025-07-14 09:01:55 +08:00
parent aca0fd057e
commit 263d7bd706
1 changed files with 136 additions and 124 deletions

View File

@ -18,6 +18,28 @@
style="padding: 0 10px"
>
<el-row>
<el-col v-if="!hasRoute&&!is_fix">
<el-form-item label="工艺步骤" prop="route">
<el-select
v-model="form.route"
placeholder="工艺步骤"
clearable
filterable
style="width: 100%"
:disabled="mode == 'edit'"
@change="routeChange"
>
<el-option
v-for="item in routeOptions"
:key="item.id"
:label="item.name"
:value="item.id"
>
<span>[{{ item.routepack_name }}]{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="!isfix">
<el-form-item label="关联任务">
<el-select
@ -67,65 +89,6 @@
<el-input-number ref="codeInput" v-model="form.count_use" :min="0" clearable class="width-100"></el-input-number>
</el-form-item>
</el-col>
<!-- <el-col :md="12" :sm="12" :xs="24" v-if="route_code=='niuzhuan'">
<el-form-item label="生产设备">
<el-select
v-model="form.equipment"
placeholder="生产设备"
clearable
filterable
style="width: 100%"
>
<el-option
v-for="item in optionsEq"
:key="item.id"
:label="item.label"
:value="item.id"
>
<span style="float:left">{{item.name}}</span>
<span style="float:right">{{item.number}}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="route_code=='niuzhuan'">
<el-form-item label="操作人">
<ehsSelect
v-model="form.handle_user"
:showName="form.handle_user_name"
:apiObj="this.$API.system.user.list"
:params="{ depts: dept }"
class="width-100"
></ehsSelect>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="route_code=='niuzhuan'">
<el-form-item
label="开始时间"
prop="work_start_time"
>
<el-date-picker
:disabled="mode == 'edit'"
v-model="form.work_start_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%;"
popper-append-to-body
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" v-if="route_code=='niuzhuan'">
<el-form-item label="结束时间" prop="work_end_time">
<el-date-picker
v-model="form.work_end_time"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%;"
:disabledDate="disabledDateFn"
popper-append-to-body
/>
</el-form-item>
</el-col> -->
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="主要批次" v-if="!isfix">
<el-select
@ -177,20 +140,28 @@ export default {
},
tracking:{
type: Number,
default: 10,
default: null,
},
routeId:{
type: String,
default: "",
},
materialIn: {
material_in: {
type: String,
default: "",
},
hasRoute:{
type: Boolean,
default: false,
},
isfix:{
type: Boolean,
default: false,
}
},
process:{
type: String,
default: "",
},
},
emits: ["success", "closed"],
data() {
@ -220,6 +191,7 @@ export default {
mlogbIns:[],
options: [],
optionsEq: [],
routeOptions: [],
mlogbInOptions:[],
materialOptions: [],
mgroup_code:'',
@ -243,6 +215,7 @@ export default {
};
},
mounted() {
this.materialIn = this.material_in;
this.route_code = this.$route.path.split("/")[2];
this.form.mlog = this.mlog;
this.params.mlog = this.mlog;
@ -253,6 +226,9 @@ export default {
this.getMaterial();
this.getParentList();
this.getEquipment();
if(!this.hasRoute){
this.getRoute();
}
},
methods: {
open() {
@ -283,6 +259,17 @@ export default {
});
});
},
getRoute() {
let that = this;
that.$API.mtm.route.list
.req({ process: that.process, page: 0, routepack__state: 30 })
.then((res) => {
that.routeOptions = res;
if(res.length==1){
that.form.route = res[0].id;
}
});
},
getParentList(){
let that = this;
that.$API.wpm.mlogb.list.req(that.params).then((res) => {
@ -313,19 +300,41 @@ export default {
getMaterial() {
let that = this;
let obj = {};
console.log('that.mgroup',that.mgroup);
obj.mtaskx =that.form.mtask;
obj.mgroupx =that.mgroup;
obj.mgroup =that.mgroup;
if(that.routeId!==null&&that.routeId!==''){
obj.route =that.routeId;
}
obj.page =0;
if(that.isfix){
obj.state =30;
if(that.is_fix){//&&
obj.tag = 'canfix';
}else{
if(that.materialIn!==null&&that.materialIn!==''){
obj.material =that.materialIn;
}
obj.state =10;
obj.tag = 'todo';
}
this.$API.wpm.wmaterial.list.req(obj).then((res) => {
that.materialOptions = res;
let arr = [];
if(res.length>0){
arr = res.filter((item)=>{
return Number(item.count_cando)>0;
})
}
that.materialOptions = arr;
});
},
routeChange(){
let that = this;
that.routeOptions.forEach(item=>{
if(item.id == that.form.route){
that.materialIn = item.material_in;
that.getMaterial();
}
})
},
changeMaterial(){
let that = this;
that.materialOptions.forEach(item=>{
@ -338,6 +347,7 @@ export default {
},
//
formWminChange(code){
console.log('code',code);
let that = this,codeId='',arr=[];
code = code.replace(/(^\s*)|(\s*$)/g, "");
if(code.indexOf("#")>-1){
@ -367,20 +377,6 @@ export default {
});
}else{
that.scanKyes = "";
if(that.tracking==10){//
arr = that.materialOptions.filter((item) => {
return item.batch == code;
})
if (arr.length > 0) {
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
that.wm_in = arr[0].batch;
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
}
}else{//
that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => {
if(res.length>0){
let index = res.length-1;//
@ -427,7 +423,23 @@ export default {
}
}
})
}
// if(that.tracking==10||that.tracking==null){//
// arr = that.materialOptions.filter((item) => {
// return item.batch == code;
// })
// if (arr.length > 0) {
// that.form.batch = arr[0].batch;
// that.form.wm_in = arr[0].id;
// that.form.count_use = arr[0].count;
// that.wm_in = arr[0].batch;
// }else{
// that.wm_in = '';
// that.$message.error("");
// }
// }else{//
// console.log('code',code);
// }
}
},
//