refactor(入库计划): 表单优化

This commit is contained in:
Kelvin 2024-11-26 16:16:28 +08:00
parent e336643b5a
commit d6fc38c1b4
2 changed files with 151 additions and 169 deletions

View File

@ -24,53 +24,42 @@
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['wm:PLAN:add']"
>新增
@click="handleAdd('DBRK')"
>刀柄入库
</el-button>
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="knifeBackVisible=true"-->
<!-- >整刀回库-->
<!-- </el-button>-->
</el-col>
<el-col :span="1.5">
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['wm:PLAN:edit']"-->
<!-- >修改-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['wm:PLAN:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd('DPRK')"
>刀片入库
</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['wm:PLAN:export']"-->
<!-- >导出-->
<!-- </el-button>-->
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd('ZDHK')"
>整刀回库
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd('CDHK')"
>拆刀回库
</el-button>
</el-col>
<el-col :span="1.5">
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -145,110 +134,102 @@
/>
<!-- 添加或修改入库计划对话框 -->
<div v-if="!isKnifeBack">
<el-dialog :title="title" :visible.sync="open" width="50%" append-to-body :close-on-click-modal="false">
<!--状态为1已执行 则禁用-->
<el-form ref="form" :model="form" :rules="rules" label-width="80px" inline :disabled="form.state === '1'">
<el-form-item label="计划编码" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入计划编码"></el-input>
</el-form-item>
<el-form-item label="入库类型" prop="planTypeId">
<el-select v-model="form.planTypeId" placeholder="请选择入库类型" @change="handlePlanTypeSelectChange">
<el-option :label="item.name" :value="item.typeId" v-for="item in inPlanTypeList"
:key="item.typeId"/>
</el-select>
</el-form-item>
<el-form-item label="源头单据" prop="relBillCode">
<el-input v-model="form.relBillCode" placeholder="请输入源头单据"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
</el-form-item>
<el-divider content-position="center">入库计划明细信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddWmsInPlanDetails">添加
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteWmsInPlanDetails">删除
</el-button>
</el-col>
</el-row>
<div>
<el-table :data="wmsInPlanDetailsList" :row-class-name="rowWmsInPlanDetailsIndex"
@selection-change="handleWmsInPlanDetailsSelectionChange" ref="wmsInPlanDetails"
:highlight-current-row="isKnifeBack" @current-change="handleWmsInPlanDetailsCurrentChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="物品" prop="materialId" width="170">
<template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物料" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.itemName" :value="item.itemId.toString()" v-for="item in mdItemList"
:key="item.itemId">
<span style="float: left">{{ item.itemName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.itemCode }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="批次" prop="batch" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.batch" plcaeholder="请输入批次"></el-input>
</template>
</el-table-column>
<el-table-column label="计划数量" prop="quantity" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.quantity" plcaeholder="请输入计划数量" type="number" :min="0"></el-input>
</template>
</el-table-column>
<el-table-column label="入库数量" prop="quantityIn" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.quantityIn" plcaeholder="请输入入库数量" type="number" :min="0"
@change="handleQuantityIn($event,scope.row)" :disabled="isKnifeBack"></el-input>
</template>
</el-table-column>
<el-table-column label="库位" prop="cellId" width="150">
<template slot-scope="scope">
<el-select v-model="scope.row.cellId" placeholder="请选择库位" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.areaName" :value="item.areaId.toString()" v-for="item in areaList"
:key="item.areaId">
<span style="float: left">{{ item.areaName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.areaCode }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态" prop="planInStatus" width="150">
<dict-tag :options="dict.type.in_plan_state" :value="form.state"></dict-tag>
</el-table-column>
</el-table>
</div>
<!--入库类型为整刀回库则显示-->
<!-- <div v-if="isKnifeBack && Object.keys(selectPlanDetail).length > 0">-->
<!-- <el-divider content-position="center">整刀实例</el-divider>-->
<!-- <wms-in-plan-detail-entity-table-cmps-->
<!-- :planDetail="wmsInPlanDetailsList[selectPlanDetail.index-1]"-->
<!-- :entityList.sync="wmsInPlanDetailsList[selectPlanDetail.index-1].wmsInPlanDetailEntityList"-->
<!-- @count="wmsInPlanDetailsList[selectPlanDetail.index-1].quantityIn = $event"-->
<!-- ></wms-in-plan-detail-entity-table-cmps>-->
<!-- </div>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-dialog :title="dialogTitle" :visible.sync="open" width="50%" append-to-body :close-on-click-modal="false">
<!--状态为 1 已执行 则禁用表单-->
<el-form ref="form" :model="form" :rules="rules" label-width="80px" inline :disabled="form.state === '1'">
<el-form-item label="计划编码" prop="planCode">
<el-input v-model="form.planCode" placeholder="请输入计划编码"></el-input>
</el-form-item>
<el-form-item label="源头单据" prop="relBillCode">
<el-input v-model="form.relBillCode" placeholder="请输入源头单据"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注"></el-input>
</el-form-item>
<el-divider content-position="center">入库计划明细信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddWmsInPlanDetails">添加
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteWmsInPlanDetails">删除
</el-button>
</el-col>
</el-row>
<div>
<el-table :data="wmsInPlanDetailsList" :row-class-name="rowWmsInPlanDetailsIndex"
@selection-change="handleWmsInPlanDetailsSelectionChange" ref="wmsInPlanDetails"
@current-change="handleWmsInPlanDetailsCurrentChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="物品" prop="materialId" width="170">
<template slot-scope="scope">
<el-select v-model="scope.row.materialId" placeholder="请选择物料" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.itemName" :value="item.itemId.toString()" v-for="item in mdItemList"
:key="item.itemId">
<span style="float: left">{{ item.itemName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.itemCode }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="批次" prop="batch" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.batch" plcaeholder="请输入批次"></el-input>
</template>
</el-table-column>
<!-- <el-table-column label="计划数量" prop="quantity" width="150">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="scope.row.quantity" plcaeholder="请输入计划数量" type="number" :min="0"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="入库数量" prop="quantityIn" width="150">
<template slot-scope="scope">
<el-input v-model="scope.row.quantityIn" plcaeholder="请输入入库数量" type="number" :min="0"
@change="handleQuantityIn($event,scope.row)"></el-input>
</template>
</el-table-column>
<el-table-column label="库位" prop="cellId" width="190">
<template slot-scope="scope">
<el-select v-model="scope.row.cellId" placeholder="请选择库位" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.areaName" :value="item.areaId.toString()" v-for="item in areaList"
:key="item.areaId">
<span style="float: left">{{ item.areaName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.areaCode }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="状态" prop="planInStatus" width="150">
<dict-tag :options="dict.type.in_plan_state" :value="form.state"></dict-tag>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
<!--入库类型为整刀回库则显示-->
<!-- <div v-if="isKnifeBack && Object.keys(selectPlanDetail).length > 0">-->
<!-- <el-divider content-position="center">整刀实例</el-divider>-->
<!-- <wms-in-plan-detail-entity-table-cmps-->
<!-- :planDetail="wmsInPlanDetailsList[selectPlanDetail.index-1]"-->
<!-- :entityList.sync="wmsInPlanDetailsList[selectPlanDetail.index-1].wmsInPlanDetailEntityList"-->
<!-- @count="wmsInPlanDetailsList[selectPlanDetail.index-1].quantityIn = $event"-->
<!-- ></wms-in-plan-detail-entity-table-cmps>-->
<!-- </div>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改入库计划对话框 整刀回库 -->
<div v-if="isKnifeBack">
<wms-in-plan-knife-back-form-cmps :data-form.sync="form" :visible.sync="open" @confirm="getList"
@planTypeSelectChange="handlePlanTypeSelectChange"
></wms-in-plan-knife-back-form-cmps>
</div>
<wms-in-plan-knife-back-form-cmps v-if="knifeBackVisible" :data-form.sync="form" :visible.sync="knifeBackVisible"
@confirm="getList"
@planTypeSelectChange="handlePlanTypeSelectChange"
></wms-in-plan-knife-back-form-cmps>
</div>
</template>
@ -261,6 +242,7 @@ import {listArea} from "@/api/mes/wm/area"
import {addWmsInTask} from "@/api/mes/wm/wmsInTask"
import WmsInPlanDetailEntityTableCmps from "@/views/mes/wm/inPlan/wmsInPlanDetailEntityTableCmps.vue";
import WmsInPlanKnifeBackFormCmps from "@/views/mes/wm/inPlan/wmsInPlanKnifeBackFormCmps.vue";
import plan from "@/views/mes/cal/plan/index.vue";
//
const planCodeValidator = (rule, value, callback) => {
@ -307,7 +289,7 @@ export default {
//
areaList: [],
//
title: "",
dialogTitle: "",
//
open: false,
//
@ -360,12 +342,7 @@ export default {
}
};
},
computed: {
/** 控制弹窗类型 */
isKnifeBack() {
return this.form.planTypeId == 9 || this.form.planTypeId == 7 || this.form.planTypeId == 15;
}
},
computed: {},
created() {
this.getList();
},
@ -501,6 +478,7 @@ export default {
isDelete: null,
planCode: null,
planTypeId: null,
planTypeCode: null,
wmsInPlanDetailsList: []
};
this.wmsInPlanDetailsList = [];
@ -523,10 +501,25 @@ export default {
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
handleAdd(planTypeCode) {
this.reset();
this.open = true;
this.title = "添加入库计划";
//
const filter = this.inPlanTypeList.filter(item => item.code === planTypeCode);
if (filter.length) {
this.form.planTypeId = filter[0].typeId;
this.form.planTypeCode = filter[0].code;
this.form.planTypeName = filter[0].name;
} else {
this.$message.error("系统错误,请联系管理员");
console.error("计划类型查找失败")
return;
}
if (planTypeCode === "DPRK") {
this.open = true;
} else {
this.knifeBackVisible = true;
}
this.dialogTitle = "新增" + filter[0].name;
},
/** 执行按钮操作 */
async handleIssue(row) {
@ -561,6 +554,7 @@ export default {
materialId: planForm.materialId,
materialCode: material[0].itemCode,
planTypeId: planForm.planTypeId,
planTypeCode: planForm.planTypeCode,
//
planInStatus: 0,
// ID
@ -599,7 +593,7 @@ export default {
this.form = response.data;
this.wmsInPlanDetailsList = response.data.wmsInPlanDetailsList;
this.open = true;
this.title = "修改入库计划";
this.dialogTitle = "修改入库计划";
});
},
/** 提交按钮 */

View File

@ -40,7 +40,7 @@ export default {
},
computed: {
title() {
return this.localDataForm.planId ? "修改入库计划" : "新增入库计划"
return (this.localDataForm.planId ? "修改" : "新增") + this.dataForm.planTypeName
},
},
methods: {
@ -206,21 +206,9 @@ export default {
<el-form-item label="计划编码" prop="planCode">
<el-input v-model="localDataForm.planCode" placeholder="请输入计划编码"></el-input>
</el-form-item>
<el-form-item label="入库类型" prop="planTypeId">
<el-select v-model="localDataForm.planTypeId" placeholder="请选择入库类型" @change="handlePlanTypeSelectChange">
<el-option :label="item.name" :value="item.typeId" v-for="item in inPlanTypeList"
:key="item.typeId"/>
</el-select>
</el-form-item>
<el-form-item label="源头单据" prop="relBillCode">
<el-input v-model="localDataForm.relBillCode" placeholder="请输入源头单据"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="localDataForm.remark" placeholder="请输入备注"></el-input>
</el-form-item>
<el-form-item label="批次" prop="batch">
<el-input v-model="wmsInPlanDetailForm.batch" plcaeholder="请输入批次"></el-input>
</el-form-item>
<el-form-item label="库位" prop="cellId">
<el-select v-model="wmsInPlanDetailForm.cellId" placeholder="请选择库位" filterable remote
:remote-method="getAreaList" clearable>
@ -231,7 +219,7 @@ export default {
</el-option>
</el-select>
</el-form-item>
<el-form-item label="物品" prop="materialId" v-if="localDataForm.planTypeId==7">
<el-form-item label="物品" prop="materialId" v-if="localDataForm.planTypeCode==='DBRK'">
<el-select v-model="wmsInPlanDetailForm.materialId" placeholder="请选择物料" filterable remote
:remote-method="getMdItemList" clearable>
<el-option :label="item.itemName" :value="item.itemId.toString()" v-for="item in mdItemList"
@ -242,7 +230,7 @@ export default {
</el-select>
</el-form-item>
<el-divider content-position="center">整刀实例</el-divider>
<el-divider content-position="center">台账实例</el-divider>
<wms-in-plan-detail-entity-table-cmps
:entityList.sync="wmsInPlanDetailEntityList"
:planTypeId="localDataForm.planTypeId"