factory_web/src/views/wpm_gx/inm.vue

347 lines
8.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button type="primary" @click="tomio('do_out')" v-auth="'mio.do'"
v-if="mgroupName!=='size'&&mgroupName!=='facade'"
>领料</el-button
>
<el-button type="primary" @click="tomio('do_in')" v-auth="'mio.do'"
>入库</el-button
>
<el-button type="primary" v-auth="'handover.create'" @click="table_add(40)">
报废</el-button>
</div>
<div class="right-panel">
<!-- <el-button type="primary" @click="materialsChoses('wm')"
>选择物料</el-button
> -->
<el-input
style="margin-right: 5px"
v-model="query.search"
placeholder="名称"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
:params="params"
:query="query"
>
<el-table-column label="状态" prop="state" width="100" >
<template #default="scope">
<el-tag :type="wmState[scope.row.state]?.type">
{{wmState[scope.row.state]?.text}}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="物料名称"
prop="material_name"
min-width="150"
>
<template #default="scope">
{{ scope.row.material_name }}
<span v-if="scope.row.material_origin != null"
>{{ scope.row.material_origin_name }}</span
>
</template>
</el-table-column>
<el-table-column
label="批次号"
prop="batch"
min-width="120"
></el-table-column>
<el-table-column
label="部门/工段"
prop="belong_dept_name"
>
<template #default="scope">
{{scope.row.belong_dept_name}}/{{scope.row.mgroup_name}}
</template>
</el-table-column>
<el-table-column
label="数量"
prop="count"
min-width="80"
></el-table-column>
<el-table-column
label="生产中"
prop="count_working"
min-width="80"
></el-table-column>
<el-table-column
label="不合格标记"
prop="notok_sign_name"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-button
link size="small"
@click="table_Check(scope.row)"
v-auth="'ftestwork.create'"
type="primary"
v-if="mgroupName!=='size'&&mgroupName!=='facade'&&scope.row.notok_sign_name == null"
>检验
</el-button>
<el-button
link size="small"
type="warning"
@click="tableCheckList(scope.row)"
v-if="mgroupName!=='size'&&mgroupName!=='facade'&&scope.row.notok_sign_name == null"
>检验记录
</el-button>
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</el-table-column>
</scTable>
</el-main>
<el-dialog title="选择物料" v-model="materialsVisible" width="90%">
<materials
style="height: 500px"
:materialType="materialType"
ref="materialsChose"
@choseChange="choseChange"
></materials>
</el-dialog>
<check-dialog
v-if="dialog.save"
ref="saveDialog"
:mgroup="mgroupId"
:itemObj = "checkItem"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
</check-dialog>
<scrap-dialog
v-if="dialog.scrap"
ref="scrapDialog"
:type="type"
:mgroupName="mgroupName"
:mgroupId="mgroupId"
@success="handleScrapSuccess"
@closed="dialog.scrap = false"
>
</scrap-dialog>
<showDrawer
ref="showDrawer"
v-if="visibleDrawer"
:wm="wm"
@closed="visibleDrawer = false"
>
</showDrawer>
<save-dialog
v-if="dialog.inmRecord"
ref="inmRecordDialog"
:cate = "cate_type"
:process = "process"
:mgroupId = "params.mgroupx"
:deptId = " params.belong_dept"
@success="handleinmSuccess"
>
</save-dialog>
<print-dialog
v-if="dialog.print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import { wmState } from "@/utils/enum.js";
import materials from "./../mtm/materials.vue";
import printDialog from "./../template/printmaterial.vue";
import checkDialog from "./check_form.vue";
import showDrawer from "./check_drawer.vue";
import scrapDialog from "./handover_form.vue";
import saveDialog from "./inm_record.vue";
export default {
props: {
mgroupName: {
type: String,
default: "",
},
},
components: {
saveDialog,
materials,
checkDialog,
showDrawer,
scrapDialog,
printDialog
},
name: "wmaterial",
data() {
return {
wmState,
apiObj: null,
params: {
mgroupx: "",
belong_dept:''
},
wmtype:0,
query: {},
dialog: {
save: false,
scrap: false,
permission: false,
inmRecord:false,
print_m:false
},
tableData: [],
selection: [],
queryWm: {
search: "",
material: "",
},
cate_type:'',
process:'',
materialType: "wm",
materialsVisible:false,
visibleDrawer: false,
apiObjPrint:this.$API.cm.labelmat.fromWm,
wmId:'',
};
},
mounted() {
let that = this;
if(that.mgroupName=="size"){
// that.params.material__process__name = "一次超洗";
that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
that.params.belong_dept=res[0].id;
}
that.apiObj = that.$API.wpm.wmaterial.list;
})
}else if(that.mgroupName=="facade"){
// that.params.material__process__name = "二次超洗";
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
that.params.belong_dept=res[0].id;
}
that.apiObj = that.$API.wpm.wmaterial.list;
})
}else{
that.$API.mtm.mgroup.list
.req({ page: 0, search: that.mgroupName })
.then((res) => {
if (res.length < 1) {
that.$message.error("获取工段错误");
return;
}
that.mgroupId = res[0].id;
that.$TOOL.data.set('gx_deptID',res[0].belong_dept)
that.process = res[0].process;
that.params.mgroupx = res[0].id;
that.params.belong_dept = res[0].belong_dept;
that.apiObj = that.$API.wpm.wmaterial.list;
});
}
},
methods: {
add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
materialsChoses(str) {
this.materialType = str;
this.materialsVisible = true;
},
choseChange(data) {
this.queryWm.material = data;
this.$refs.table_wm.queryData(this.queryWm);
this.materialsVisible = false;
},
tomio(type) {
let that = this;
that.cate_type=type;
that.dialog.inmRecord = true;
that.$nextTick(() => {
that.$refs.inmRecordDialog.open("add");
});
// this.$router.push({ name: "halfgood_mio" });
},
table_Check(row){
this.checkItem = row;
let mode = this.mgroupName;
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open(mode);
});
},
//获取当前批次车间物料的检验记录
tableCheckList(row){
this.wm = row.id;
this.visibleDrawer = true;
this.$nextTick(() => {
this.$refs.showDrawer.open();
});
},
//表格选择后回调事件
selectionChange(selection) {
this.selection = selection;
},
//添加报废
table_add(type) {
this.dialog.scrap = true;
this.type = type;
this.$nextTick(() => {
this.$refs.scrapDialog.open("add");
});
},
handleScrapSuccess(){
this.dialog.scrap = false;
this.$refs.table.refresh();
},
//出入库后刷新页面
handleinmSuccess(){
this.$refs.table.refresh();
},
//搜索
handleQuery() {
this.$refs.table.queryData(this.query);
},
//本地更新数据
handleSaveSuccess(data, mode) {
this.dialog.save = false;
this.$refs.table.refresh();
},
//打印物料标签
printMaterial(row){
let that = this;
that.wmId = row.id;
that.wmtype = row.material_.type;
that.dialog.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},
};
</script>
<style scoped></style>