refactor(mes/eqp): 重构备件和辅料库存变动页面

优化库存变动功能,增加新增变动记录弹窗
统一备件和辅料变动操作逻辑
移除不再使用的报表组件
This commit is contained in:
砂糖
2026-03-25 14:34:26 +08:00
parent 8e2159a6cf
commit 33c003d2ca
6 changed files with 192 additions and 154 deletions

View File

@@ -2,9 +2,10 @@
<div>
<el-form v-if="!auxiliaryId" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="关联备件" prop="auxiliaryId">
<el-select v-model="queryParams.auxiliaryId" placeholder="请选择关联备件">
<el-option v-for="item in auxiliaryList" :key="item.auxiliaryId" :label="item.auxiliaryName" :value="item.auxiliaryId" />
<el-form-item label="关联辅料" prop="auxiliaryId">
<el-select v-model="queryParams.auxiliaryId" placeholder="请选择关联辅料">
<el-option v-for="item in partList" :key="item.auxiliaryId" :label="item.auxiliaryName"
:value="item.auxiliaryId" />
</el-select>
</el-form-item>
<el-form-item label="变动数量" prop="changeQuantity">
@@ -26,6 +27,9 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddChange">增加</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-col>
@@ -52,12 +56,50 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<el-dialog title="库存变动" :visible.sync="changeOpen" width="500px" append-to-body>
<el-form ref="changeForm" :model="changeForm" label-width="80px">
<el-form-item label="关联辅料">
<el-select v-model="changeForm.auxiliaryId" placeholder="请选择关联辅料" filterable>
<el-option v-for="item in partList" :key="item.auxiliaryId" :label="item.auxiliaryName"
:value="item.auxiliaryId" />
<template slot="empty">
<div style="padding: 20px; text-align: center;">
<p>未找到匹配的备件</p>
<el-button type="primary" size="small" @click="navigateToAddPart">前往新增</el-button>
</div>
</template>
</el-select>
</el-form-item>
<el-form-item label="变动类型">
<el-select v-model="changeForm.changeType" placeholder="请选择变动类型">
<el-option label="增加" value="增加" />
<el-option label="减少" value="减少" />
</el-select>
</el-form-item>
<el-form-item label="变动数量">
<el-input-number v-model="changeForm.changeQuantity" :min="0" :step="1" placeholder="请输入变动数量" size="mini" />
</el-form-item>
<el-form-item label="入库单价" v-if="changeForm.changeType === '增加'">
<el-input-number v-model="changeForm.inUnitPrice" :min="0" :step="0.01" :precision="6" placeholder="请输入入库单价"
size="mini" />
</el-form-item>
<el-form-item label="变动原因">
<el-input type="textarea" v-model="changeForm.reason" placeholder="请输入变动原因" size="mini" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="changeSubmitForm"> </el-button>
<el-button @click="changeCancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listAuxiliaryMaterialChange, getAuxiliaryMaterialChange, delAuxiliaryMaterialChange, addAuxiliaryMaterialChange, updateAuxiliaryMaterialChange } from "@/api/mes/eqp/auxiliaryMaterialChange";
import { listAuxiliaryMaterial } from "@/api/mes/eqp/auxiliaryMaterial";
import { changeStock } from "@/api/mes/eqp/auxiliaryMaterialChange";
export default {
name: "AuxiliaryMaterialChange",
@@ -104,7 +146,11 @@ export default {
// 表单校验
rules: {
},
partList: []
partList: [],
auxiliaryList: [],
changeOpen: false,
changeTitle: '',
changeForm: {},
};
},
created() {
@@ -136,6 +182,40 @@ export default {
this.partList = response.rows;
});
},
handleAddChange() {
this.changeOpen = true;
this.changeForm = {
changeType: '增加',
auxiliaryId: this.auxiliaryId,
inUnitPrice: undefined,
changeQuantity: undefined,
reason: undefined
}
},
changeCancel() {
this.changeOpen = false;
},
changeSubmitForm() {
if (this.changeForm.changeType === '增加' && (this.changeForm.inUnitPrice == null || this.changeForm.inUnitPrice === '')) {
this.$modal.msgWarning('入库单价不能为空,建议按当前台账单价补齐后再提交');
return;
}
this.buttonLoading = true;
changeStock(this.changeForm).then(response => {
this.buttonLoading = false;
this.$modal.msgSuccess("操作成功");
this.getList();
this.$refs["partChange"].getList();
}).finally(() => {
this.buttonLoading = false;
this.changeCancel();
})
},
// 跳转到新增备件页面
navigateToAddPart() {
this.changeCancel();
this.$router.push('/unit/auxiliary');
},
/** 查询备品备件变动记录列表 */
getList() {
this.loading = true;

View File

@@ -1,32 +1,21 @@
<template>
<div>
<el-form v-if="!partId" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form v-if="!partId" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="68px">
<el-form-item label="关联备件" prop="partId">
<el-select v-model="queryParams.partId" placeholder="请选择关联备件">
<el-option v-for="item in partList" :key="item.partId" :label="item.partName" :value="item.partId" />
</el-select>
</el-form-item>
<el-form-item label="变动数量" prop="changeQuantity">
<el-input
v-model="queryParams.changeQuantity"
placeholder="请输入变动数量"
clearable
@keyup.enter.native="handleQuery"
/>
<el-input v-model="queryParams.changeQuantity" placeholder="请输入变动数量" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="变动原因" prop="reason">
<el-input
v-model="queryParams.reason"
placeholder="请输入变动原因"
clearable
@keyup.enter.native="handleQuery"
/>
<el-input v-model="queryParams.reason" placeholder="请输入变动原因" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="变动时间" prop="changeTime">
<el-date-picker clearable
v-model="queryParams.changeTime"
type="date"
value-format="yyyy-MM-dd"
<el-date-picker clearable v-model="queryParams.changeTime" type="date" value-format="yyyy-MM-dd"
placeholder="请选择变动时间">
</el-date-picker>
</el-form-item>
@@ -38,13 +27,10 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAddChange">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -63,19 +49,53 @@
<el-table-column label="备注" align="center" prop="remark" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<el-dialog title="库存变动" :visible.sync="changeOpen" width="500px" append-to-body>
<el-form ref="changeForm" :model="changeForm" label-width="80px">
<el-form-item label="关联备件">
<!-- /unit/ready, 当搜索无匹配结果时显示一个空面板提示可以到该页面新增点击后跳转新增页面 -->
<el-select v-model="changeForm.partId" placeholder="请选择关联备件" filterable>
<el-option v-for="item in partList" :key="item.partId" :label="item.partName" :value="item.partId" />
<template slot="empty">
<div style="padding: 20px; text-align: center;">
<p>未找到匹配的备件</p>
<el-button type="primary" size="small" @click="navigateToAddPart">前往新增</el-button>
</div>
</template>
</el-select>
</el-form-item>
<el-form-item label="变动类型">
<el-select v-model="changeForm.changeType" placeholder="请选择变动类型">
<el-option label="增加" value="增加" />
<el-option label="减少" value="减少" />
</el-select>
</el-form-item>
<el-form-item label="变动数量">
<el-input-number v-model="changeForm.changeQuantity" :min="0" :step="1" placeholder="请输入变动数量" size="mini" />
</el-form-item>
<el-form-item label="入库单价" v-if="changeForm.changeType === '增加'">
<el-input-number v-model="changeForm.inUnitPrice" :min="0" :step="0.01" :precision="6" placeholder="请输入入库单价"
size="mini" />
</el-form-item>
<el-form-item label="变动原因">
<el-input type="textarea" v-model="changeForm.reason" placeholder="请输入变动原因" size="mini" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="changeSubmitForm"> </el-button>
<el-button @click="changeCancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listSparePartsChange, getSparePartsChange, delSparePartsChange, addSparePartsChange, updateSparePartsChange } from "@/api/mes/eqp/sparePartsChange";
import { listSparePart } from "@/api/mes/eqp/sparePart";
import { listEquipmentManagement } from "@/api/mes/eqp/equipmentManagement";
import { changeStock } from "@/api/mes/eqp/sparePartsChange";
export default {
name: "SparePartsChange",
@@ -122,7 +142,11 @@ export default {
// 表单校验
rules: {
},
partList: []
partList: [],
equipmentList: [],
changeOpen: false,
changeTitle: '',
changeForm: {},
};
},
created() {
@@ -131,6 +155,7 @@ export default {
return;
}
this.getPartList();
this.getEquipmentList();
},
watch: {
partId: {
@@ -149,6 +174,55 @@ export default {
this.partList = response.rows;
});
},
getEquipmentList() {
listEquipmentManagement({ pageNum: 1, pageSize: 1000 }).then(response => {
this.equipmentList = response.rows;
});
},
handleAddChange() {
this.changeOpen = true;
this.changeForm = {
changeType: '增加',
partId: this.partId,
inUnitPrice: undefined,
changeQuantity: undefined,
reason: undefined
}
},
// handleReduce(row) {
// this.changeOpen = true;
// this.changeForm = {
// changeType: '减少',
// partId: row.partId,
// inUnitPrice: undefined,
// changeQuantity: undefined,
// reason: undefined
// }
// },
changeCancel() {
this.changeOpen = false;
},
changeSubmitForm() {
if (this.changeForm.changeType === '增加' && (this.changeForm.inUnitPrice == null || this.changeForm.inUnitPrice === '')) {
this.$modal.msgWarning('入库单价不能为空,建议按当前台账单价补齐后再提交');
return;
}
this.buttonLoading = true;
changeStock(this.changeForm).then(() => {
this.buttonLoading = false;
this.$modal.msgSuccess("操作成功");
this.getList();
this.$refs["partChange"].getList();
}).finally(() => {
this.buttonLoading = false;
this.changeCancel();
})
},
// 跳转到新增备件页面
navigateToAddPart() {
this.changeCancel();
this.$router.push('/unit/ready');
},
/** 查询备品备件变动记录列表 */
getList() {
this.loading = true;
@@ -194,7 +268,7 @@ export default {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.changeId)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */

View File

@@ -1,34 +0,0 @@
<template>
<OutTemplate
:baseQueryParams="baseQueryParams"
:warehouseOptions="warehouseOptions"
/>
</template>
<script>
import OutTemplate from "@/views/wms/report/template/out.vue";
export default {
name: 'ZhaTemplate',
components: {
OutTemplate,
},
data() {
return {
baseQueryParams: {
createBy: 'suanzhakuguan',
},
warehouseOptions: [
{ label: '酸连轧成品库', value: '1988150099140866050' },
{ label: '镀锌原料库', value: '1988150263284953089' },
{ label: '脱脂原料库', value: '1988150545175736322' },
{ label: '酸连轧纵剪分条原料库', value: '1988150150521090049' },
{ label: '技术部', value: '2019583656787259393' },
{ label: '小钢卷库', value: '2019583325311414274' },
{ label: '废品库', value: '2019583429955104769' },
{ label: '退货库', value: '2019583137616310273' },
],
}
}
}
</script>

View File

@@ -1,25 +0,0 @@
<template>
<LossTemplate
:actionTypes="actionTypes"
:actionQueryParams="actionQueryParams"
></LossTemplate>
</template>
<script>
import LossTemplate from '@/views/wms/report/template/loss.vue'
export default {
name: 'LossReport',
components: {
LossTemplate,
},
data() {
return {
actionTypes: [11, 120],
actionQueryParams: {
createBy: 'suanzhakuguan'
},
}
}
}
</script>

View File

@@ -1,32 +0,0 @@
<template>
<OutTemplate
:baseQueryParams="baseQueryParams"
:warehouseOptions="warehouseOptions"
/>
</template>
<script>
import OutTemplate from "@/views/wms/report/template/out.vue";
export default {
name: 'ZhaTemplate',
components: {
OutTemplate,
},
data() {
return {
baseQueryParams: {
createBy: 'duxinkuguan',
},
warehouseOptions: [
{ value: '1988150323162836993', label: '镀锌成品库' },
{ value: '1988150487185289217', label: '镀锌纵剪分条原料库' },
{ value: '2019583656787259393', label: '技术部' },
{ value: '2019583325311414274', label: '小钢卷库' },
{ value: '2019583429955104769', label: '废品库' },
{ value: '2019583137616310273', label: '退货库' },
],
}
}
}
</script>

View File

@@ -1,25 +0,0 @@
<template>
<LossTemplate
:actionTypes="actionTypes"
:actionQueryParams="actionQueryParams"
></LossTemplate>
</template>
<script>
import LossTemplate from '@/views/wms/report/template/loss.vue'
export default {
name: 'LossReport',
components: {
LossTemplate,
},
data() {
return {
actionTypes: [501, 120],
actionQueryParams: {
createBy: 'duxinkuguan'
},
}
}
}
</script>