Commit 9a596b05 by zhangtw

物料明细数值型字段默认为0

物料选择组件固定高度,表格设置滚动
parent aa65d022
......@@ -77,10 +77,10 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="批次ID" prop="batchId">
<el-form-item label="批次" prop="batchId">
<el-input
v-model="queryParams.batchId"
placeholder="请输入批次ID"
placeholder="请输入批次"
clearable
@keyup.enter.native="handleQuery"
/>
......@@ -146,6 +146,7 @@
>
<el-table-column type="selection" width="55" align="center" fixed />
<el-table-column label="入库单号" align="center" prop="orderId" width="200"/>
<el-table-column label="批次号" align="center" prop="batchId" width="200"/>
<el-table-column label="系统编号" align="center" prop="systemNo" width="200"/>
<!-- 新增:表格显示货主名称 -->
<el-table-column label="货主" align="center" prop="ownerName" width="200"/>
......@@ -168,7 +169,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="批次ID" align="center" prop="batchId" width="200"/>
<el-table-column label="入库单状态" align="center" prop="orderStatus" width="200">
<!-- 状态显示 -->
<template slot-scope="scope">
......@@ -246,8 +246,8 @@
<el-form-item label="入库单号" prop="orderId">
<el-input v-model="form.orderId" placeholder="请输入入库单号" />
</el-form-item>
<el-form-item label="批次ID" prop="batchId">
<el-input v-model="form.batchId" placeholder="请输入批次ID" />
<el-form-item label="批次" prop="batchId">
<el-input v-model="form.batchId" placeholder="请输入批次" />
</el-form-item>
<el-form-item label="入库类型" prop="orderTypeId">
<el-select v-model="form.orderTypeId" placeholder="请选择入库类型" clearable>
......@@ -315,7 +315,7 @@
<el-form-item label="总件数" prop="totalPackages">
<el-input v-model="form.totalPackages" placeholder="请输入总件数" />
</el-form-item>
<el-form-item label="仓库ID" prop="warehouseId">
<el-form-item label="仓库" prop="warehouseId">
<el-input v-model="form.warehouseId" placeholder="请输入仓库ID" />
</el-form-item>
</div>
......@@ -381,7 +381,7 @@
<el-descriptions :column="2" border class="mb20">
<el-descriptions-item label="入库单号">{{ detailForm.orderId || '-' }}</el-descriptions-item>
<el-descriptions-item label="系统编号">{{ detailForm.systemNo || '-' }}</el-descriptions-item>
<el-descriptions-item label="批次ID">{{ detailForm.batchId || '-' }}</el-descriptions-item>
<el-descriptions-item label="批次">{{ detailForm.batchId || '-' }}</el-descriptions-item>
<el-descriptions-item label="货主">{{ detailForm.ownerName || detailForm.ownerId || '-' }}</el-descriptions-item>
<el-descriptions-item label="入库类型">
{{ getDictLabel('inbound_outbound_type',detailForm.orderTypeId) }}
......@@ -394,7 +394,7 @@
<!-- <el-descriptions-item label="计划量">{{ detailForm.totalPlannedQuantity || '-' }}</el-descriptions-item>
<el-descriptions-item label="实际量">{{ detailForm.totalActualQuantity || '-' }}</el-descriptions-item> -->
<!-- <el-descriptions-item label="总件数">{{ detailForm.totalPackages || '-' }}</el-descriptions-item> -->
<!-- <el-descriptions-item label="仓库ID">{{ detailForm.warehouseId || '-' }}</el-descriptions-item> -->
<!-- <el-descriptions-item label="仓库">{{ detailForm.warehouseId || '-' }}</el-descriptions-item> -->
<el-descriptions-item label="备注" :span="2">
<div class="remark-text">{{ detailForm.remark || '-' }}</div>
</el-descriptions-item>
......@@ -432,8 +432,8 @@
ref="materialSelector"
/>
<div slot="footer">
<el-button @click="materialSelectOpen = false">取消</el-button>
<el-button type="primary" @click="confirmMaterialSelect">确定</el-button>
<el-button @click="materialSelectOpen = false">取消</el-button>
</div>
</el-dialog>
......@@ -495,11 +495,6 @@ export default {
},
data() {
return {
inBoundStatusOptions: [
{ orderStatus: 1, orderStatusName: '草稿', type: 'info' },
{ orderStatus: 2, orderStatusName: '已完成', type: 'success' },
{ orderStatus: 3, orderStatusName: '已取消', type: 'danger' }
],
// 货主选择相关(对齐退库组件)
queryOwnerName: null,
ownerSelectorVisible: false,
......@@ -598,7 +593,7 @@ export default {
{ required: true, message: "系统编号不能为空", trigger: "blur" }
],
batchId: [
{ required: true, message: "批次ID不能为空", trigger: "blur" }
{ required: true, message: "批次不能为空", trigger: "blur" }
],
ownerId: [ // 新增货主必填校验
{ required: true, message: "货主不能为空", trigger: "change" }
......@@ -879,7 +874,9 @@ export default {
plannedQuantity: 0,
actualQuantity: 0,
unitPrice: 0,
totalAmount: 0
totalAmount: 0,
actualPackages: 0,
divisor: 0
})
} else {
// this.$message.warning(`物料 ${material.materialName} 已存在,跳过添加`)
......@@ -1177,6 +1174,6 @@ export default {
/* 统一对话框底部按钮样式 */
.dialog-footer {
text-align: center;
text-align: right;
}
</style>
......@@ -266,7 +266,7 @@
v-if="isEditable"
>
<template slot-scope="scope">
<el-button
<!-- <el-button
size="mini"
type="text"
icon="el-icon-edit"
......@@ -279,7 +279,7 @@
icon="el-icon-check"
@click="handleRowSave(scope.row)"
v-else
>保存</el-button>
>保存</el-button> -->
<el-button
size="mini"
type="text"
......@@ -407,7 +407,7 @@ export default {
acc.actualQuantity += parseFloat(item.actualQuantity) || 0
acc.totalAmount += (parseFloat(item.plannedQuantity) || 0) * (parseFloat(item.unitPrice) || 0)
return acc
}, { plannedQuantity: 0, actualQuantity: 0, totalAmount: 0 })
}, { plannedQuantity: 0, actualQuantity: 0, totalAmount: 0})
}
},
watch: {
......@@ -426,7 +426,7 @@ export default {
...item,
sapNo: item.sapNo, // 确保sapNo字段被保存
materialName: item.materialName, // 确保materialName字段被保存
editable: false,
editable: true,
tempId: item.id || Date.now() + Math.random()
}))
this.total = this.displayData.length
......@@ -503,7 +503,7 @@ export default {
...item,
sapNo: item.sapNo,
materialName: item.materialName,
editable: false,
editable: true,
tempId: item.id || Date.now() + Math.random()
}))
this.total = response.total
......@@ -570,7 +570,7 @@ export default {
listInbound_itemsAndMname(this.queryParams).then(response => {
this.displayData = response.rows.map(item => ({
...item,
editable: false,
editable: true,
tempId: item.id || Date.now() + Math.random()
}))
this.total = response.total
......@@ -601,6 +601,7 @@ export default {
actualQuantity: 0,
plannedPackages: 0,
actualPackages: 0,
divisor: 0,
unitPrice: 0,
remark: null,
editable: true,
......@@ -617,22 +618,22 @@ export default {
})
},
// 行编辑
handleRowEdit(row) {
const index = this.displayData.findIndex(item => item.tempId === row.tempId)
if (index > -1) {
this.$set(this.displayData[index], 'editable', true)
}
},
// // 行编辑
// handleRowEdit(row) {
// const index = this.displayData.findIndex(item => item.tempId === row.tempId)
// if (index > -1) {
// this.$set(this.displayData[index], 'editable', true)
// }
// },
// 行保存
handleRowSave(row) {
const index = this.displayData.findIndex(item => item.tempId === row.tempId)
if (index > -1) {
this.$set(this.displayData[index], 'editable', false)
this.$emit('row-saved', row)
}
},
// // 行保存
// handleRowSave(row) {
// const index = this.displayData.findIndex(item => item.tempId === row.tempId)
// if (index > -1) {
// this.$set(this.displayData[index], 'editable', false)
// this.$emit('row-saved', row)
// }
// },
// 行删除
handleRowDelete(row, index) {
......@@ -754,8 +755,8 @@ export default {
if (!item.materialId) {
errors.push(`第${index + 1}行:货物ID不能为空`)
}
if (parseFloat(item.plannedQuantity) <= 0) {
errors.push(`第${index + 1}行:计划数量必须大于0`)
if (parseFloat(item.actualQuantity) <= 0) {
errors.push(`第${index + 1}实际数量必须大于0`)
}
})
return errors
......
......@@ -23,7 +23,7 @@
<!-- 右侧物料列表(仅展示和查询) -->
<pane size="84" style="overflow: auto;">
<div style="padding: 10px; display: flex; flex-direction: column;">
<div style="padding: 10px; display: flex; flex-direction: column; height: 100%;">
<!-- 查询表单 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="88px">
<!-- <el-form-item label="物料编码" prop="materialCode">
......@@ -63,39 +63,42 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 物料表格(隐藏操作列,保留选择功能) -->
<el-table
ref="materialTable"
v-loading="loading"
:data="materialsList"
@selection-change="handleSelectionChange"
:scroll-x="true"
:row-key="row => row.id"
@row-click="handleRowClick"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" align="center"/>
<!-- <el-table-column label="物料编码" align="center" prop="materialCode" width="120"/> -->
<el-table-column label="SAP物料号" align="center" prop="sapNo" />
<el-table-column label="物料名称" align="center" prop="materialName" width="150"/>
<el-table-column label="TS Code" align="center" prop="tsCode" />
<el-table-column label="物料分类" align="center" prop="categoryCode" >
<template slot-scope="scope">
{{ scope.row.displayCategory || categoryMap[scope.row.categoryCode] || scope.row.categoryCode }}
</template>
</el-table-column>
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="计量单位" align="center" prop="materialUnit" />
<el-table-column label="是否批次管理" align="center" prop="isBatchManaged">
<template slot-scope="scope">
<el-tag :type="scope.row.isBatchManaged === 1 ? 'success' : 'info'" size="mini">
{{ scope.row.isBatchManaged === 1 ? '是' : '否' }}
</el-tag>
</template>
</el-table-column>
</el-table>
<div class="table-container">
<el-table
ref="materialTable"
v-loading="loading"
:data="materialsList"
@selection-change="handleSelectionChange"
:scroll-x="true"
:row-key="row => row.id"
style="height: 100%;"
@row-click="handleRowClick"
>
<el-table-column type="selection" width="55" align="center"/>
<el-table-column type="index" label="序号" align="center"/>
<!-- <el-table-column label="物料编码" align="center" prop="materialCode" width="120"/> -->
<el-table-column label="SAP物料号" align="center" prop="sapNo" />
<el-table-column label="物料名称" align="center" prop="materialName" width="150"/>
<el-table-column label="TS Code" align="center" prop="tsCode" />
<el-table-column label="物料分类" align="center" prop="categoryCode" >
<template slot-scope="scope">
{{ scope.row.displayCategory || categoryMap[scope.row.categoryCode] || scope.row.categoryCode }}
</template>
</el-table-column>
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="计量单位" align="center" prop="materialUnit" />
<el-table-column label="是否批次管理" align="center" prop="isBatchManaged">
<template slot-scope="scope">
<el-tag :type="scope.row.isBatchManaged === 1 ? 'success' : 'info'" size="mini">
{{ scope.row.isBatchManaged === 1 ? '是' : '否' }}
</el-tag>
</template>
</el-table-column>
</el-table>
</div>
<!-- 分页 -->
<pagination
v-show="total>0"
......@@ -337,7 +340,24 @@ export default {
height: 100%;
min-height: 500px;
}
.custom-tree-node {
font-size: 14px;
}
/* 表格容器样式 */
.table-container {
flex: 1;
max-height: 450px; /* 关键:允许弹性项目收缩 */
overflow: auto;
margin-bottom: 10px;
}
/* 调整分页组件位置 */
::v-deep .el-pagination {
margin-top: 10px;
flex-shrink: 0; /* 防止分页被压缩 */
}
</style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论