factory_web/src/views/inm/halfgood.vue

215 lines
5.5 KiB
Vue

<template>
<el-container>
<el-header style="height: 50%; padding: 0">
<el-container>
<el-header>
<div class="left-panel">
<div style="font-size: 14px">仓库</div>
<el-select
v-model="query.warehouse"
clearable
placeholder="所在仓库"
@change="handleQuery"
style="margin-left: 10px; width: 150px"
>
<el-option
v-for="item in warehouseOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div>
<div class="right-panel">
<el-input
v-model="query.search"
placeholder="物料名/批次号"
clearable
style="margin-right: 5px"
></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"
stripe
:params="params"
>
<el-table-column type="index" width="50" />
<el-table-column label="批次" prop="batch">
</el-table-column>
<el-table-column label="物料名称" prop="material_name">
</el-table-column>
<el-table-column label="规格型号">
<template #default="scope">
<span v-if="scope.row.material_">
{{ scope.row.material_.specification }}
{{ scope.row.material_.model }}
</span>
</template>
</el-table-column>
<el-table-column label="已完成工序">
<template #default="scope">
<span v-if="scope.row.material_">
{{ scope.row.material_.process_name }}
</span>
</template>
</el-table-column>
<el-table-column label="仓库" prop="warehouse_name">
</el-table-column>
<el-table-column label="物料存量" prop="count">
</el-table-column>
<el-table-column label="有效期" prop="expiration_date">
</el-table-column>
<el-table-column label="更新时间" prop="update_time">
</el-table-column>
<el-table-column width="90">
<template #default="scope">
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
</template>
</el-table-column>
</scTable>
</el-main>
</el-container>
</el-header>
<el-main class="nopadding">
<el-container>
<el-header>
<div class="left-panel">
<span style="font-size: 14px">车间库存</span>
<el-select
v-model="queryWm.material__process"
clearable
placeholder="已到工序"
@change="handleQueryWm"
style="margin-left: 10px; width: 150px"
>
<el-option
v-for="item in processOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div>
</el-header>
<el-main>
<scTable
ref="table_wm"
:apiObj="apiObjWm"
row-key="id"
:params="paramsWm"
stripe
>
<el-table-column label="批次" prop="batch">
</el-table-column>
<el-table-column label="物料名" prop="material">
<template #default="scope">{{
scope.row.material_.name
}}</template>
</el-table-column>
<el-table-column label="规格" prop="material">
<template #default="scope">{{
scope.row.material_.specification
}}</template>
</el-table-column>
<el-table-column label="型号" prop="material">
<template #default="scope">{{
scope.row.material_.model
}}</template>
</el-table-column>
<el-table-column label="已到工序" prop="material">
<template #default="scope">{{
scope.row.material_.process_name
}}</template>
</el-table-column>
<el-table-column
label="所在车间"
prop="belong_dept_name"
>
</el-table-column>
<el-table-column label="数量" prop="count" width="80">
</el-table-column>
</scTable>
</el-main>
</el-container>
</el-main>
<print-dialog
v-if="print_m"
ref="printmaterial"
:mId="wmId"
:mtype="wmtype"
:apiObj="apiObjPrint"
></print-dialog>
</el-container>
</template>
<script>
import printDialog from "./../template/printmaterial.vue";
export default {
name: "halfgood",
components: {
printDialog
},
data() {
return {
apiObj: this.$API.inm.warehouse.batch,
params: { count__gte: 1, material__type: 20 },
selection: [],
query: {},
warehouseOptions: [],
apiObjWm: this.$API.wpm.wmaterial.list,
paramsWm: { count__gte: 1 },
processOptions: [],
queryWm: {},
wmtype:0,
print_m:false,
materialsVisible:false,
apiObjPrint:this.$API.cm.labelmat.fromMb,
wmId:'',
};
},
mounted() {
this.getWarehouse();
this.getProcessOptions();
},
methods: {
getWarehouse() {
this.$API.inm.warehouse.list.req({ page: 0 }).then((res) => {
this.warehouseOptions = res;
});
},
getProcessOptions() {
this.$API.mtm.process.list.req({ page: 0 }).then((res) => {
this.processOptions = res;
});
},
handleQueryWm() {
this.$refs.table_wm.queryData(this.queryWm);
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
//打印物料标签
printMaterial(row){
let that = this;
that.wmId = row.id;
that.wmtype = row.material_.type;
that.print_m = true;
this.$nextTick(() => {
this.$refs.printmaterial.open();
})
},
},
};
</script>