fix:工段库存领料入库操作抽屉展示
This commit is contained in:
parent
0fc3670bce
commit
414fad1602
|
@ -1869,24 +1869,16 @@ const routes = [
|
|||
},
|
||||
component: "inm/mioitem",
|
||||
},
|
||||
{
|
||||
name: "workshop",
|
||||
path: "/inm/workshop",
|
||||
meta: {
|
||||
title: "车间库存",
|
||||
hidden: true,
|
||||
},
|
||||
component: "inm/workshop",
|
||||
},
|
||||
{
|
||||
name: "workshop_mio",
|
||||
path: "/inm/workshop_mio",
|
||||
meta: {
|
||||
title: "车间出入库记录",
|
||||
hidden: true,
|
||||
// hidden: true,
|
||||
},
|
||||
component: "inm/workshop_mio",
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
//采购 pum
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
label="操作"
|
||||
fixed="right"
|
||||
align="center"
|
||||
width="150px"
|
||||
width="120px"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
|
@ -106,6 +106,14 @@
|
|||
>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="table_edit(scope.row)"
|
||||
v-if="scope.row.state == 10"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
|
@ -124,6 +132,15 @@
|
|||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
@click="revert(scope.row)"
|
||||
v-auth="'mio.submit'"
|
||||
v-if="scope.row.state == 20"
|
||||
>
|
||||
撤销
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
|
@ -179,8 +196,7 @@ export default {
|
|||
},
|
||||
query: {},
|
||||
params: {
|
||||
type__in: "sale_out,do_in",
|
||||
materials__type: 10,
|
||||
type__in: "do_out,do_in"
|
||||
},
|
||||
form: {},
|
||||
apiObj: this.$API.inm.mio.list,
|
||||
|
@ -215,6 +231,21 @@ export default {
|
|||
this.$refs.showDrawer.open();
|
||||
});
|
||||
},
|
||||
//撤销
|
||||
revert(row) {
|
||||
this.$confirm(`确定撤销该操作吗?`, "提示", {
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
this.$API.inm.mio.revert.req(row.id).then((res) => {
|
||||
this.$message.success("撤销成功");
|
||||
this.$refs.table.refresh();
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
//删除
|
||||
table_del(row) {
|
||||
this.$confirm(`确定删除吗?`, "提示", {
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" @click="tomio" v-auth="'mio.do'"
|
||||
<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" v-auth="'mio.do'"
|
||||
<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)">
|
||||
|
@ -153,6 +153,15 @@
|
|||
@closed="visibleDrawer = false"
|
||||
>
|
||||
</showDrawer>
|
||||
<save-dialog
|
||||
v-if="dialog.inmRecord"
|
||||
ref="inmRecordDialog"
|
||||
:cate = "cate_type"
|
||||
:mgroupId = "params.mgroupx"
|
||||
:deptId = " params.belong_dept"
|
||||
@success="handleinmSuccess"
|
||||
>
|
||||
</save-dialog>
|
||||
</el-container>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -161,6 +170,7 @@ import materials from "./../mtm/materials.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: {
|
||||
|
@ -169,6 +179,7 @@ export default {
|
|||
},
|
||||
},
|
||||
components: {
|
||||
saveDialog,
|
||||
materials,
|
||||
checkDialog,
|
||||
showDrawer,
|
||||
|
@ -188,6 +199,7 @@ export default {
|
|||
save: false,
|
||||
scrap: false,
|
||||
permission: false,
|
||||
inmRecord:false
|
||||
},
|
||||
tableData: [],
|
||||
selection: [],
|
||||
|
@ -195,6 +207,7 @@ export default {
|
|||
search: "",
|
||||
material: "",
|
||||
},
|
||||
cate_type:'',
|
||||
materialType: "wm",
|
||||
visibleDrawer: false,
|
||||
};
|
||||
|
@ -234,6 +247,12 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
add() {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("add");
|
||||
});
|
||||
},
|
||||
materialsChoses(str) {
|
||||
this.materialType = str;
|
||||
this.materialsVisible = true;
|
||||
|
@ -243,8 +262,14 @@ export default {
|
|||
this.$refs.table_wm.queryData(this.queryWm);
|
||||
this.materialsVisible = false;
|
||||
},
|
||||
tomio() {
|
||||
this.$router.push({ name: "halfgood_mio" });
|
||||
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;
|
||||
|
@ -278,6 +303,7 @@ export default {
|
|||
this.dialog.scrap = false;
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
handleinmSuccess(){},
|
||||
//搜索
|
||||
handleQuery() {
|
||||
this.$refs.table.queryData(this.query);
|
||||
|
|
|
@ -0,0 +1,359 @@
|
|||
<template>
|
||||
<el-drawer
|
||||
:title="titleMap[mode]"
|
||||
v-model="visible"
|
||||
:size="'90%'"
|
||||
destroy-on-close
|
||||
@closed="$emit('closed')"
|
||||
>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<el-steps
|
||||
:active="active"
|
||||
style="width: 100%"
|
||||
:align-center="true"
|
||||
finish-status="success"
|
||||
>
|
||||
<el-step
|
||||
v-for="(item, index) of stepes"
|
||||
:key="index"
|
||||
:title="item"
|
||||
@click="handleStep(index)"
|
||||
>
|
||||
</el-step>
|
||||
</el-steps>
|
||||
</el-header>
|
||||
<!--基本信息!-->
|
||||
<el-main class="nopadding" v-if="active === 0">
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="110px"
|
||||
style="margin: 40px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="编号" prop="number">
|
||||
<el-input v-model="form.number" placeholder="编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="出入库日期">
|
||||
<el-date-picker
|
||||
v-model="form.inout_date"
|
||||
type="date"
|
||||
placeholder="出入库日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="执行部门">
|
||||
<el-select
|
||||
v-model="form.belong_dept"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in deptOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="工段">
|
||||
<el-select
|
||||
v-model="form.mgroup"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
placeholder="工段"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in mgroupOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="部门执行人">
|
||||
<el-select v-model="form.do_user" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in userOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="仓库执行人">
|
||||
<el-select
|
||||
v-model="form.mio_user"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userOption"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item>
|
||||
<el-button
|
||||
style="margin-top: 20px"
|
||||
type="primary"
|
||||
:loading="isSaveing"
|
||||
:disabled="isSaveing"
|
||||
@click="handleNextStep"
|
||||
>下一步
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
<!--mioitem-->
|
||||
<el-main class="nopadding" v-if="active === 1">
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel" style="margin: 10px">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="table_add"
|
||||
></el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main>
|
||||
<scTable
|
||||
ref="tables"
|
||||
:apiObj="apiObj"
|
||||
:params="query"
|
||||
row-key="id"
|
||||
hidePagination
|
||||
hideDo
|
||||
stripe
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column
|
||||
label="物料"
|
||||
prop="material"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="scope"
|
||||
>{{ scope.row.material_name }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="批次号" prop="batch">
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库" prop="warehouse_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="count">
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-main>
|
||||
<el-footer v-if="active === 1" style="text-align: center">
|
||||
<el-button @click="handleLastStep" style="margin-right: 4px">上一步</el-button>
|
||||
<el-button @click="table_submit" type="warning">提交</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
<save-dialog
|
||||
v-if="dialog.save"
|
||||
ref="saveDialog"
|
||||
:cate = "cate"
|
||||
:mgroupId = 'mgroupId'
|
||||
:mioId = 'mioId'
|
||||
@success="handleSaveSuccess"
|
||||
@closed="dialog.save = false"
|
||||
></save-dialog>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import saveDialog from "./inm_record_form.vue";
|
||||
export default {
|
||||
name: "routepack_form",
|
||||
components: { saveDialog },
|
||||
props: {
|
||||
cate: { type: String, default: "" },
|
||||
deptId: { type: String, default: "" },
|
||||
mgroupId: { type: String, default: "" },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
active: 0,
|
||||
stepSuc: [0],
|
||||
stepes: ["基本信息", "详情"],
|
||||
titleMap: { add: "新增出入库", edit: "编辑出入库" },
|
||||
mode: "add",
|
||||
isSaveing: false, //控制基本信息提交
|
||||
search: {
|
||||
keyword: null,
|
||||
},
|
||||
dialogTitle: "新增",
|
||||
visible: false,
|
||||
dialog: {
|
||||
save: false,
|
||||
},
|
||||
form: {
|
||||
number: "",
|
||||
inout_date: "",
|
||||
belong_dept: "",
|
||||
mgroup: "",
|
||||
do_user: "",
|
||||
mio_user: "",
|
||||
},
|
||||
apiworkerObj: null,
|
||||
materials: [],
|
||||
apiObj: null,
|
||||
query: {
|
||||
mio: "",
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: "请输入" }],
|
||||
},
|
||||
mioId:null,
|
||||
routepack: "",
|
||||
userOption: [],//仓库执行人
|
||||
userOptions: [],//部门执行人
|
||||
deptOptions: [],
|
||||
mgroupOptions: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.isSaveing = false;
|
||||
this.form.mgroup = this.mgroupId;
|
||||
this.form.type = this.cate;
|
||||
this.form.belong_dept = this.deptId;
|
||||
this.getDeptOptions();
|
||||
this.getmgroupOptions();
|
||||
this.getDeptUsers();//获取该部门下的员工
|
||||
this.getDeptUser();//获取仓库人员
|
||||
},
|
||||
methods: {
|
||||
open(mode) {
|
||||
this.mode = mode;
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
setData(data) {
|
||||
Object.assign(this.form, data);
|
||||
},
|
||||
//工段列表
|
||||
getmgroupOptions() {
|
||||
this.$API.mtm.mgroup.list.req({page: 0}).then(res=>{
|
||||
this.mgroupOptions = res;
|
||||
})
|
||||
},
|
||||
//部门列表
|
||||
getDeptOptions() {
|
||||
this.$API.system.dept.list.req({ page: 0, type__in: "dept" }).then((res) => {
|
||||
this.deptOptions = res;
|
||||
});
|
||||
},
|
||||
//车间人员
|
||||
getDeptUsers() {
|
||||
let that = this;
|
||||
that.$API.system.user.list.req({ depts: that.deptId, page: 0 }).then((res) => {
|
||||
that.userOptions = res;
|
||||
});
|
||||
},
|
||||
//仓库人员
|
||||
getDeptUser() {
|
||||
let that = this;
|
||||
this.$API.system.user.list.req({ page: 0, posts__code__contains: "inm" }).then((res) => {
|
||||
that.userOption = res;
|
||||
});
|
||||
},
|
||||
//仓库物料
|
||||
getMaterials() {
|
||||
let that = this;
|
||||
that.$API.mtm.material.list.req({ page: 0, type__in: "10,20", is_hidden: false }).then((res) => {
|
||||
that.materials = res;
|
||||
});
|
||||
},
|
||||
//车间物料
|
||||
getwMaterials() {
|
||||
let that = this;
|
||||
that.$API.wpm.wmaterial.list.req({ page: 0, belong_dept: that.deptId }).then((res) => {
|
||||
that.materials = res;
|
||||
});
|
||||
},
|
||||
handleStep(val) {
|
||||
//点击步骤条
|
||||
if (this.stepSuc.includes(val) === true) {
|
||||
this.active = val;
|
||||
}
|
||||
},
|
||||
//组件点击上一步
|
||||
handleLastStep() {
|
||||
this.active = 0;
|
||||
},
|
||||
//组件点击下一步
|
||||
handleNextStep() {
|
||||
let that = this;
|
||||
if(that.mioId==null){
|
||||
that.$API.inm.mio.create.req(that.form).then((res) => {
|
||||
that.mioId = res.id;
|
||||
that.form.mio = res.id;
|
||||
that.query.mio = res.id;
|
||||
that.apiObj = that.$API.inm.mioitem.list;
|
||||
that.active = 1;
|
||||
});
|
||||
}else{
|
||||
that.$API.inm.mio.update.req(that.mioId,that.form).then((res) => {
|
||||
that.query.mio = that.mioId;
|
||||
that.apiObj = that.$API.inm.mioitem.list;
|
||||
that.active = 1;
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
table_add() {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("add");
|
||||
});
|
||||
},
|
||||
table_edit(row) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("edit").setData(row);
|
||||
});
|
||||
},
|
||||
table_submit() {
|
||||
let that = this;
|
||||
that.$API.inm.mio.submit.req(that.mioId).then((res) => {
|
||||
that.$message.success("提交成功");
|
||||
that.visible = false;
|
||||
// that.$emit("closed");
|
||||
});
|
||||
},
|
||||
submitOut() {},
|
||||
|
||||
//本地更新数据
|
||||
handleSaveSuccess() {
|
||||
this.$refs.tables.refresh();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
|
@ -0,0 +1,288 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="titleMap[form.type]"
|
||||
v-model="visible"
|
||||
:size="1000"
|
||||
destroy-on-close
|
||||
@closed="$emit('closed')"
|
||||
>
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item label="物料">
|
||||
<el-select
|
||||
v-model="form.material"
|
||||
value-key="id"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="selectMaterialChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in materialOptions"
|
||||
:key="item.id"
|
||||
:label="item.full_name"
|
||||
:value="item.id"
|
||||
>
|
||||
<span style="float: left">{{ item.full_name }}</span>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
color: '#E6A23C';
|
||||
font-size: 13px;
|
||||
"
|
||||
v-if="item.is_hidden"
|
||||
>隐</span
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="批次" v-if="cate == 'do_out'">
|
||||
<el-select
|
||||
v-model="selectBatch"
|
||||
value-key="id"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
@change="selectBatchChange"
|
||||
@clear="selectBatchClear"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in batchOptions"
|
||||
:key="item.id"
|
||||
:label="item.batch"
|
||||
:value="item"
|
||||
>
|
||||
<span style="float: left">{{ item.batch }}</span>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>{{ item.count }} -- {{ item.warehouse_name }}</span
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="批次号" v-else>
|
||||
<el-select
|
||||
v-model="form.batch"
|
||||
filterable
|
||||
allow-create
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in wbatchOptions"
|
||||
:key="item.id"
|
||||
:value="item.batch"
|
||||
>
|
||||
<span style="float: left">{{ item.batch }}</span>
|
||||
<span
|
||||
style="
|
||||
float: right;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
"
|
||||
>{{ item.count }}</span
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="仓库">
|
||||
<el-select
|
||||
v-model="form.warehouse"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in warehouseOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量">
|
||||
<el-input-number
|
||||
v-model="form.count"
|
||||
:min="0"
|
||||
:precision="3"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">
|
||||
保存
|
||||
</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
emits: ["success", "closed"],
|
||||
props: {
|
||||
cate: { type: String, default: "" },
|
||||
mioId: { type: String, default: "" },
|
||||
mgroupId: { type: String, default: "" },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: "do_in",
|
||||
loading: false,
|
||||
mode: "add",
|
||||
titleMap: {
|
||||
do_out: "生产领料",
|
||||
do_in: "生产入库",
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
material: [{required: true,message: "请选择物料",trigger: "blur",},],
|
||||
},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
materialOptions: [],
|
||||
batchOptions: [],
|
||||
inputBatchDisable: false,
|
||||
setFiltersVisible: false,
|
||||
warehouseOptions: [],
|
||||
selectBatchDisable: false,
|
||||
selectMaterial: null,
|
||||
selectBatch: null,
|
||||
wbatchOptions: [],//工段物料批次
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.form.type = this.cate ;
|
||||
this.form.mio = this.mioId ;
|
||||
this.getMaterialOptions();
|
||||
if(this.cate == 'do_out'){//领料---仓库
|
||||
this.inputBatchDisable = true;
|
||||
this.getBatchOptions();
|
||||
}else{//入库----工段
|
||||
this.getWBatchs();
|
||||
}
|
||||
this.getWarehouseOptions();
|
||||
},
|
||||
methods: {
|
||||
//获取仓库
|
||||
getWarehouseOptions() {
|
||||
this.$API.inm.warehouse.list.req({ page: 0 }).then((res) => {
|
||||
this.warehouseOptions = res;
|
||||
});
|
||||
},
|
||||
//获取物料列表
|
||||
getMaterialOptions() {
|
||||
let that = this;
|
||||
var cate = this.cate;
|
||||
var query = {};
|
||||
// 'do_out': '生产领料',
|
||||
// 'do_in': '生产入库',
|
||||
//(10, '成品'), (20, '半成品'), (30, '主要原料'),
|
||||
console.log('this.cate',cate);
|
||||
if (cate == "do_out") {
|
||||
query = {page: 0,type__in: '20,30',is_hidden: false,is_assemb: false};
|
||||
} else if (cate == "do_in") {
|
||||
query = { page: 0, type__in: '10,20' };
|
||||
}
|
||||
that.$API.mtm.material.list.req(query).then((res) => {
|
||||
that.materialOptions = res;
|
||||
});
|
||||
},
|
||||
//获取车间物料批次号
|
||||
getWBatchs() {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.mgroupx= that.mgroupId;
|
||||
obj.material= that.form.material;
|
||||
obj.page= 0;
|
||||
if (that.mgroupId != null &&that.mgroupId != undefined &&that.mgroupId != "") {
|
||||
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
|
||||
that.wbatchOptions = res;
|
||||
});
|
||||
}
|
||||
},
|
||||
//库存物料批次
|
||||
getBatchOptions() {
|
||||
let that = this;
|
||||
that.getWBatchs();
|
||||
let obj = {};
|
||||
obj.page = 0;
|
||||
obj.material = that.form.material;
|
||||
this.$API.inm.warehouse.batch.req(obj).then((res) => {
|
||||
this.batchOptions = res;
|
||||
});
|
||||
},
|
||||
selectMaterialChange() {
|
||||
let that = this;
|
||||
if(that.cate=='do_in'){
|
||||
that.getWBatchs();
|
||||
}else{
|
||||
that.getBatchOptions();
|
||||
}
|
||||
},
|
||||
getItem(options, id) {
|
||||
for (var i = 0; i < options.length; i++) {
|
||||
if (options[i].id == id) {
|
||||
return options[i];
|
||||
}
|
||||
}
|
||||
},
|
||||
selectBatchChange(item) {
|
||||
this.form.batch = item.batch;
|
||||
this.form.warehouse = item.warehouse;
|
||||
},
|
||||
selectBatchClear() {
|
||||
this.form.batch = "";
|
||||
this.form.warehouse = "";
|
||||
},
|
||||
//显示
|
||||
open(mode = "add") {
|
||||
this.mode = mode;
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//提交
|
||||
submit() {
|
||||
this.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
this.isSaveing = true;
|
||||
this.form.mio = this.mioId;
|
||||
try {
|
||||
var res;
|
||||
if (this.mode == "add") {
|
||||
res = await this.$API.inm.mioitem.create.req(this.form);
|
||||
} else if (this.mode == "edit") {
|
||||
res = await this.$API.inm.mioitem.update.req(this.form.id,this.form);
|
||||
}
|
||||
this.isSaveing = false;
|
||||
this.$emit("success");
|
||||
this.visible = false;
|
||||
this.$message.success("操作成功");
|
||||
} catch (err) {
|
||||
//可以处理校验错误
|
||||
this.isSaveing = false;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
Object.assign(this.form, data);
|
||||
},
|
||||
//设置过滤项
|
||||
setFilters(filters) {
|
||||
this.selectionFilters = filters;
|
||||
this.setFiltersVisible = true;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style></style>
|
Loading…
Reference in New Issue