Commit bdfed8f5 by chuishuo

测试优化前端2

parent a7793256
...@@ -99,7 +99,6 @@ ...@@ -99,7 +99,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
...@@ -107,6 +106,7 @@ ...@@ -107,6 +106,7 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</div>
<!-- 仓库选择组件 --> <!-- 仓库选择组件 -->
<WarehouseSelector <WarehouseSelector
v-model="warehouseSelectorVisible" v-model="warehouseSelectorVisible"
...@@ -120,40 +120,40 @@ ...@@ -120,40 +120,40 @@
/> />
</div> </div>
<!-- 详情查看 --> <!-- 详情查看 -->
<el-dialog title="统计详情查看" :visible.sync="viewOpen" width="800px" append-to-body> <el-dialog title="统计详情查看" :visible.sync="viewOpen" width="1500px" append-to-body>
<el-table :data="detailList" border stripe size="small" style="width: 100%;"> <el-table :data="detailList" border stripe size="small" style="width: 100%;">
<el-table-column label="计划日期" prop="plannedDates" /> <el-table-column label="计划日期" align="center" prop="plannedDates" width="100px" />
<el-table-column label="物料" prop="materialId" fixed> <el-table-column label="物料" align="center" prop="materialId" width="150px" fixed>
<template slot-scope="scope"> <template slot-scope="scope">
{{ getDictLabel(materialDict, scope.row.materialId, 'id', 'material_name') || '无' }} {{ getDictLabel(materialDict, scope.row.materialId, 'id', 'material_name') || '无' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="SAP物料号" align="center" prop="sapNo" /> <el-table-column label="SAP物料号" align="center" prop="sapNo" width="150px" />
<el-table-column label="仓库" align="center" prop="warehousesName" /> <el-table-column label="仓库" align="center" prop="warehousesName" width="150px" />
<el-table-column label="库位" align="center" prop="locationName" /> <el-table-column label="库位" align="center" prop="locationName" width="150px" />
<el-table-column label="危险类别" align="center" prop="hazardName" /> <el-table-column label="危险类别" align="center" prop="hazardName" width="100px" />
<el-table-column label="差异数量" align="center" prop="varianceQuantity" /> <el-table-column label="差异数量" align="center" prop="varianceQuantity" width="150px" />
<el-table-column label="差异金额" align="center" prop="varianceAmount"> <el-table-column label="差异金额" align="center" prop="varianceAmount" width="150px" >
<template slot-scope="scope"> <template slot-scope="scope">
{{ formatAmount(scope.row.varianceAmount) }} {{ formatAmount(scope.row.varianceAmount) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="adjustedType" label="调整原因类型" width="80"> <el-table-column prop="adjustedType" align="center" label="调整原因类型" width="150px">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.adjusted_type" :value="scope.row.adjustedType"/> <dict-tag :options="dict.type.adjusted_type" :value="scope.row.adjustedType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="调整原因" align="center" prop="adjustmentReason" width="150px" /> <el-table-column label="调整原因" align="center" prop="adjustmentReason" width="210px" />
</el-table> </el-table>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="cancel">关 闭</el-button> <el-button @click="cancel">关 闭</el-button>
</div> </div>
<pagination <pagination
v-show="total>0" v-show="totalDail>0"
:total="total" :total="totalDail"
:page.sync="queryParams.pageNum" :page.sync="searchParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="searchParams.pageSize"
@pagination="handleCountViewInfo(row)" @pagination="loadDetail"
/> />
</el-dialog> </el-dialog>
</div> </div>
...@@ -195,6 +195,10 @@ export default { ...@@ -195,6 +195,10 @@ export default {
materialId: "", materialId: "",
locationId: "" locationId: ""
}, },
searchParams: {
pageNum: 1,
pageSize: 10
},
// 详情列表信息 // 详情列表信息
detailList: [], detailList: [],
// 库存盘点表格数据 // 库存盘点表格数据
...@@ -210,7 +214,9 @@ export default { ...@@ -210,7 +214,9 @@ export default {
checkedRows: [], // 子表选中的行 checkedRows: [], // 子表选中的行
materialDict: [], // 物料字典数组(存储sap_no和name) materialDict: [], // 物料字典数组(存储sap_no和name)
// 分页总数 // 分页总数
total: 0 total: 0,
currentRow: null,
totalDail: 0
} }
}, },
created() { created() {
...@@ -225,22 +231,6 @@ export default { ...@@ -225,22 +231,6 @@ export default {
this.viewOpen = false this.viewOpen = false
this.detailList = [] this.detailList = []
}, },
// 详情按钮:打开弹窗
handleCountViewInfo(row) {
this.detailList = []; // 清空旧数据
// 接口请求添加try/catch和空值判断
getCountInfo(row).then(response => {
if (response && response.rows) {
this.detailList = response.rows; // 直接赋值数组给detailList
} else {
}
this.viewOpen = true;
}).catch(error => {
console.error('获取详情失败:', error);
this.$message.error('获取详情失败,请重试');
this.viewOpen = false;
})
},
/** 仓库选择回调 */ /** 仓库选择回调 */
handleWarehouseSelected(warehouse) { handleWarehouseSelected(warehouse) {
...@@ -338,6 +328,30 @@ export default { ...@@ -338,6 +328,30 @@ export default {
this.loading = false this.loading = false
}) })
}, },
// 详情按钮:打开弹窗
handleCountViewInfo(row) {
this.detailList = []; // 清空旧数据
this.currentRow = row;
console.log(row)
this.searchParams.pageNum = 1; // 每次查看新行,从第1页开始
this.loadDetail(); // 加载数据
},
// 加载详情数据(同时支持首次查看和分页)
loadDetail() {
// 合并参数:当前行数据 + 分页参数
const params = {
...this.currentRow, // 携带当前行的筛选条件(如 id、日期等)
...this.searchParams // 携带分页参数(pageNum、pageSize)
};
console.log('最终传给详情接口的参数:', params);
getCountInfo(params).then(response => {
this.detailList = response.rows;
this.totalDail = response.total;
this.viewOpen = true;
}).catch(error => {
console.error('加载失败:', error);
});
},
// 字典加载完成回调(缓存字典数据,供表格展示使用) // 字典加载完成回调(缓存字典数据,供表格展示使用)
handleDictLoaded(type, data) { handleDictLoaded(type, data) {
if (type === 'material') { if (type === 'material') {
......
...@@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -107,7 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
, st_it.location_range , st_it.location_range
,(select w.warehouses_name from warehouses w where st_it.warehouse_id = w.id and w.is_used = 1) as warehouse_name ,(select w.warehouses_name from warehouses w where st_it.warehouse_id = w.id and w.is_used = 1) as warehouse_name
,(select sl.location_name from storage_locations sl where st_it.location_id = sl.id and sl.is_used = 1) as location_name ,(select sl.location_name from storage_locations sl where st_it.location_id = sl.id and sl.is_used = 1) as location_name
,(select dict.dict_label from sys_dict_data dict where st_it.adjusted_type = dict.dict_sort and dict.status =0 and dict.dict_type ='adjusted_type') as adjusted_type ,st_it.adjusted_type
from stocktake_items st_it from stocktake_items st_it
where stocktake_id = #{stocktake_id} and is_used = 1 where stocktake_id = #{stocktake_id} and is_used = 1
<if test="adjusted != null and adjusted != ''"> and adjusted = #{adjusted}</if> <if test="adjusted != null and adjusted != ''"> and adjusted = #{adjusted}</if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论