廖井涛
2 天以前 ddea16dd62aec74f58d71ecd18c14124c36f19f4
补交
2个文件已修改
37 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/components/BasicTable.vue 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/components/BasicTable.vue
@@ -133,9 +133,9 @@
}
//合并显示其他列
const handleDynamicColumns = (data,title) => {
const handleDynamicColumns = (data,title,orderOtherMoney) => {
  // 1. 收集所有行的otherColumns字段(去重)
  const allOtherFields = new Set();
  /*const allOtherFields = new Set();
  data.forEach(row => {
    if (!row || !row.otherColumns) return;
@@ -160,10 +160,10 @@
        allOtherFields.add(key);
      });
    }
  });
  });*/
  // 2. 生成动态子列(作为processList的children)
  const otherColumns = Array.from(allOtherFields).map(field => {
  /*const otherColumns = Array.from(allOtherFields).map(field => {
    // 尝试获取字段对应的label(优先取第一个出现的label)
    let label=field;
    title.forEach(item=>{
@@ -182,7 +182,26 @@
      }
    };
  });
  });*/
  const otherColumns = [];
  // 容错:确保orderOtherMoney是有效数组
  if (Array.isArray(orderOtherMoney) && orderOtherMoney.length > 0) {
    orderOtherMoney.forEach(item => {
      // 跳过空数据,避免无效列
      if (!item || !item.column) return;
      otherColumns.push({
        title: item.alias || item.column, // 优先用别名,无则用字段名
        field: `otherColumnsJson.${item.column}`,
        width: 120,
        align: 'center',
        // 格式化取值:兼容解析后的JSON结构
        formatter: ({ row }) => {
          return row.otherColumnsJson?.[item.column] || '';
        }
      });
    });
  }
  // 3. 定义父级列processList,包含动态子列
  const processList = {
@@ -251,7 +270,8 @@
        //订单明细报表
        if (isFirstLoad.value && props.childrenData.url === '/order/getOrderReport') {
          const dataList = res.data.data || [];
          handleDynamicColumns(dataList,res.data.title)
          const orderOtherMoney = res.data.orderOtherMoney[0] || [];
          handleDynamicColumns(dataList,res.data.title,orderOtherMoney)
          isFirstLoad.value = false; // 首次加载后置为false
        }
      }
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -621,6 +621,7 @@
        }
        List<OrderDetail> orderDetailList = orderDetailMapper.getOrderReport(offset, pageSize, startDate, endDate, orderDetail,model,scope);
        List<BasicOtherMoney> basicOtherMoneyList=basicOtherMoneyMapper.selectList(new QueryWrapper<BasicOtherMoney>());
        ObjectMapper objectMapper = new ObjectMapper();
        for (OrderDetail detail : orderDetailList) {
@@ -642,6 +643,10 @@
        map.put("data",orderDetailList);
        map.put("title",basicOtherMoneyList);
        map.put("total",orderDetailMapper.getOrderReportTotal(offset, pageSize, startDate, endDate, orderDetail,"order"));
        map.put("orderOtherMoney",
                Collections.singletonList(
                        basicOtherMoneyMapper.selectList(new QueryWrapper<BasicOtherMoney>().eq("state",1))
                ));
        List<String> list = new ArrayList<>();
        list.add(startDate);
        list.add(endDate);