Commit 358760de by wangchunyang
parents 82fd5953 6dd5c256
......@@ -113,24 +113,35 @@
</el-form-item>
</el-form>
<!-- 物料查询表格 -->
<!-- 物料查询表格(折叠面板分组) -->
<div class="table-container">
<el-table v-loading="loading" :data="returnOrderItemList" border height="100%" style="width: 100%">
<el-table-column type="index" label="序号" width="60" align="center" fixed="left" />
<el-collapse v-loading="loading" accordion>
<!-- 遍历SAP分组 -->
<el-collapse-item
v-for="(group, groupIndex) in groupedList"
:key="groupIndex"
:title="`SAP物料号:${group.sapNo || '未分类'}(共${group.items.length}条)`"
:name="group.sapNo || `uncategorized-${groupIndex}`"
>
<el-table
:data="group.items"
border
style="width: 100%; margin-top: 8px;"
>
<el-table-column type="index" label="序号" width="60" align="center" />
<el-table-column label="物料名称" align="center" prop="materialName" min-width="150" show-overflow-tooltip />
<el-table-column label="SAP物料号" align="center" prop="sapNo" width="120" />
<el-table-column label="TS Code" align="center" prop="tsCode" width="120" />
<el-table-column label="危险类别" align="center" prop="hazardId" width="120" />
<el-table-column label="规格型号" align="center" prop="specification" width="120" />
<el-table-column label="计量单位" align="center" prop="materialUnit" width="120" />
<el-table-column label="单位重量" align="center" prop="unitWeight" width="120" >
<el-table-column label="单位重量" align="center" prop="unitWeight" width="120">
<template slot-scope="scope">
{{ formatAmount(scope.row.unitWeight || 0) }}
</template>
</el-table-column>
<el-table-column label="计划数量" align="center" prop="plannedQuantity" width="100" />
<el-table-column label="实际数量" align="center" prop="actualQuantity" width="100" />
<el-table-column label="总额" align="center" prop="totalAmount" width="100" >
<el-table-column label="总额" align="center" prop="totalAmount" width="100">
<template slot-scope="scope">
{{ formatAmount(scope.row.totalAmount || 0) }}
</template>
......@@ -146,9 +157,13 @@
</template>
</el-table-column>
</el-table>
</el-collapse-item>
<!-- 无数据提示 -->
<div v-if="!loading && groupedList.length === 0" class="no-data">暂无数据</div>
</el-collapse>
</div>
<!-- 分页组件 -->
<!-- 分页组件(全局分页,按原始数据总数分页) -->
<pagination
v-show="total>0"
:total="total"
......@@ -310,7 +325,7 @@ export default {
loading: true,
showSearch: true,
total: 0,
returnOrderItemList: [],
groupedList: [], // 按SAP分组后的列表
queryParams: {
pageNum: 1,
pageSize: 10,
......@@ -371,11 +386,36 @@ export default {
delete params.dateRange
listInboundOutboundStatistics(params).then(response => {
this.returnOrderItemList = response.rows || []
const rawList = response.rows || []
this.total = response.total || 0
// 核心:按sapNo分组
const groupedMap = {}
rawList.forEach(item => {
// sapNo为空时归为"未分类"
const sapKey = item.sapNo || '未分类'
if (!groupedMap[sapKey]) {
groupedMap[sapKey] = []
}
groupedMap[sapKey].push(item)
})
// 转换为分组列表(用于折叠面板渲染)
this.groupedList = Object.keys(groupedMap).map(sapNo => ({
sapNo,
items: groupedMap[sapNo],
expanded: false // 默认全部折叠,可改为 true 全部展开
}))
// 默认展开第一个分组(可选)
if (this.groupedList.length > 0) {
this.groupedList[0].expanded = true
}
this.loading = false
}).catch(() => {
this.loading = false
this.groupedList = []
})
},
handleQuery() {
......@@ -569,4 +609,21 @@ export default {
.w20 {
width: 150px;
}
.no-data {
text-align: center;
padding: 20px;
color: #999;
font-size: 14px;
}
/* 折叠面板样式优化 */
::v-deep .el-collapse-item__header {
font-size: 14px;
font-weight: 500;
}
::v-deep .el-collapse-item__content {
padding: 0 !important;
}
</style>
\ No newline at end of file
......@@ -133,7 +133,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="排序" align="center" prop="sortNo" width="80" />
<el-table-column label="创建日期" align="center" prop="createTime" width="160" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
<template slot-scope="scope">
......@@ -232,19 +231,6 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="排序" prop="sortNo">
<el-input-number
v-model="form.sortNo"
placeholder="请输入排序"
:min="0"
:step="1"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="仓库地点" prop="address">
<el-input v-model="form.address" type="textarea" placeholder="请输入内容" :rows="3" />
......@@ -374,10 +360,6 @@ export default {
isEnabled: [
{ required: true, message: '应用状态不能为空', trigger: 'change' }
],
sortNo: [
{ required: true, message: '排序不能为空', trigger: 'blur' },
{ type: 'number', message: '排序必须为数字值', trigger: 'blur' }
],
area: [
{
validator: (rule, value, callback) => {
......
......@@ -49,7 +49,21 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
@Override
public StorageLocations selectStorageLocationsById(String id)
{
return storageLocationsMapper.selectStorageLocationsById(id);
StorageLocations storageLocations = storageLocationsMapper.selectStorageLocationsById(id);
String[] AllowedCategoryIds = storageLocations.getAllowedCategoryIds().split(",");
String AllowedCategoryName = "";
for (String AllowedCategoryId : AllowedCategoryIds) {
Materials materials = materialsMapper.selectMaterialsById(AllowedCategoryId);
if (materials != null && materials.getMaterialName() != null) {
String categoryName = materials.getMaterialName().trim(); // 去除首尾空格
if (AllowedCategoryName != "") {
AllowedCategoryName += ",";
}
AllowedCategoryName += categoryName;
}
}
storageLocations.setAllowedCategoryNames(AllowedCategoryName);
return storageLocations;
}
@Override
......@@ -77,18 +91,14 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
if (storageLocations2.getAllowedCategoryIds() != null && !storageLocations2.getAllowedCategoryIds().isEmpty()){
String[] AllowedCategoryIds = storageLocations2.getAllowedCategoryIds().split(",");
for (String AllowedCategoryId : AllowedCategoryIds) {
List<Materials> materials = materialsMapper.selectMaterialsBySapNo(AllowedCategoryId);
if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0);
if (materials1 != null && materials1.getMaterialName() != null) {
String categoryName = materials1.getMaterialName().trim(); // 去除首尾空格
Materials materials = materialsMapper.selectMaterialsById(AllowedCategoryId);
if (materials != null && materials.getMaterialName() != null) {
String categoryName = materials.getMaterialName().trim(); // 去除首尾空格
if (AllowedCategoryName != "") {
AllowedCategoryName += ",";
}
AllowedCategoryName += categoryName;
} }
}
}
}
storageLocations2.setAllowedCategoryNames(AllowedCategoryName);
......@@ -123,11 +133,8 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setCreateTime(DateUtils.getNowDate());
storageLocationsCategory.setCreateUserCode(String.valueOf(SecurityUtils.getUserId()));
List<Materials> materials = materialsMapper.selectMaterialsBySapNo(categoryId);
if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0);
storageLocationsCategory.setCategoryName(materials1.getMaterialName());
}
Materials materials = materialsMapper.selectMaterialsById(categoryId);
storageLocationsCategory.setCategoryName(materials.getMaterialName());
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
}
......@@ -162,11 +169,8 @@ public class StorageLocationsServiceImpl implements IStorageLocationsService
storageLocationsCategory.setCategoryId(categoryId);
storageLocationsCategory.setUpdateTime(DateUtils.getNowDate());
storageLocationsCategory.setUpdateUserCode(String.valueOf(SecurityUtils.getUserId()));
List<Materials> materials = materialsMapper.selectMaterialsBySapNo(categoryId);
if (materials != null && !materials.isEmpty()) {
Materials materials1 = materials.get(0);
storageLocationsCategory.setCategoryName(materials1.getMaterialName());
}
Materials materials = materialsMapper.selectMaterialsById(categoryId);
storageLocationsCategory.setCategoryName(materials.getMaterialName());
storageLocationsCategoryMapper.insertStorageLocationsCategory(storageLocationsCategory);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论