feat: 新增合同、订单明细导出功能,补充业务员字段展示
1. 新增crm订单主、订单明细的导出接口,支持业务精简字段导出 2. 为订单明细VO新增业务员字段,关联查询订单表填充数据 3. 在订单列表页新增业务员表格列展示 4. 为合同编辑页、订单明细页添加导出按钮并实现导出逻辑 5. 新增导出专用的VO类,处理日期格式化和状态转文本
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
package com.klp.crm.controller;
|
package com.klp.crm.controller;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import com.klp.aps.domain.bo.ApsPlanDetailBo;
|
import com.klp.aps.domain.bo.ApsPlanDetailBo;
|
||||||
import com.klp.aps.domain.bo.ApsPlanSheetBo;
|
import com.klp.aps.domain.bo.ApsPlanSheetBo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -23,6 +26,7 @@ import com.klp.common.core.validate.EditGroup;
|
|||||||
import com.klp.common.enums.BusinessType;
|
import com.klp.common.enums.BusinessType;
|
||||||
import com.klp.common.utils.poi.ExcelUtil;
|
import com.klp.common.utils.poi.ExcelUtil;
|
||||||
import com.klp.crm.domain.vo.CrmOrderVo;
|
import com.klp.crm.domain.vo.CrmOrderVo;
|
||||||
|
import com.klp.crm.domain.vo.CrmOrderExportVo;
|
||||||
import com.klp.crm.domain.bo.CrmOrderBo;
|
import com.klp.crm.domain.bo.CrmOrderBo;
|
||||||
import com.klp.crm.service.ICrmOrderService;
|
import com.klp.crm.service.ICrmOrderService;
|
||||||
import com.klp.common.core.page.TableDataInfo;
|
import com.klp.common.core.page.TableDataInfo;
|
||||||
@@ -65,6 +69,35 @@ public class CrmOrderController extends BaseController {
|
|||||||
ExcelUtil.exportExcel(list, "正式订单主", CrmOrderVo.class, response);
|
ExcelUtil.exportExcel(list, "正式订单主", CrmOrderVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出正式订单主列表(业务精简字段,用于合同编辑详情页导出)
|
||||||
|
*/
|
||||||
|
@Log(title = "正式订单主", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/exportDetail")
|
||||||
|
public void exportDetail(@RequestBody CrmOrderBo bo, HttpServletResponse response) {
|
||||||
|
List<CrmOrderVo> list = iCrmOrderService.queryList(bo);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
List<CrmOrderExportVo> exportList = list.stream().map(vo -> {
|
||||||
|
CrmOrderExportVo export = new CrmOrderExportVo();
|
||||||
|
BeanUtil.copyProperties(vo, export);
|
||||||
|
// 日期格式化
|
||||||
|
export.setSignTime(vo.getSignTime() != null ? sdf.format(vo.getSignTime()) : null);
|
||||||
|
export.setDeliveryDate(vo.getDeliveryDate() != null ? sdf.format(vo.getDeliveryDate()) : null);
|
||||||
|
// 状态转文本
|
||||||
|
if (vo.getStatus() != null) {
|
||||||
|
switch (vo.getStatus().intValue()) {
|
||||||
|
case 0: export.setStatus("草稿"); break;
|
||||||
|
case 1: export.setStatus("已生效"); break;
|
||||||
|
case 2: export.setStatus("已作废"); break;
|
||||||
|
case 3: export.setStatus("已完成"); break;
|
||||||
|
default: export.setStatus(String.valueOf(vo.getStatus())); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return export;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
ExcelUtil.exportExcel(exportList, "合同编辑详情", CrmOrderExportVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取正式订单主详细信息
|
* 获取正式订单主详细信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.klp.crm.controller;
|
package com.klp.crm.controller;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -18,6 +22,7 @@ import com.klp.common.core.validate.EditGroup;
|
|||||||
import com.klp.common.enums.BusinessType;
|
import com.klp.common.enums.BusinessType;
|
||||||
import com.klp.common.utils.poi.ExcelUtil;
|
import com.klp.common.utils.poi.ExcelUtil;
|
||||||
import com.klp.crm.domain.vo.CrmOrderItemVo;
|
import com.klp.crm.domain.vo.CrmOrderItemVo;
|
||||||
|
import com.klp.crm.domain.vo.CrmOrderItemExportVo;
|
||||||
import com.klp.crm.domain.vo.CrmContractOrderFinanceVo;
|
import com.klp.crm.domain.vo.CrmContractOrderFinanceVo;
|
||||||
import com.klp.crm.domain.bo.CrmOrderItemBo;
|
import com.klp.crm.domain.bo.CrmOrderItemBo;
|
||||||
import com.klp.crm.service.ICrmOrderItemService;
|
import com.klp.crm.service.ICrmOrderItemService;
|
||||||
@@ -56,6 +61,30 @@ public class CrmOrderItemController extends BaseController {
|
|||||||
ExcelUtil.exportExcel(list, "正式订单明细", CrmOrderItemVo.class, response);
|
ExcelUtil.exportExcel(list, "正式订单明细", CrmOrderItemVo.class, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出正式订单明细列表(业务精简字段,用于订单明细列表页导出)
|
||||||
|
*/
|
||||||
|
@Log(title = "正式订单明细", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/exportDetail")
|
||||||
|
public void exportDetail(@RequestBody CrmOrderItemBo bo, HttpServletResponse response) {
|
||||||
|
List<CrmOrderItemVo> list = iCrmOrderItemService.queryList(bo);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
List<CrmOrderItemExportVo> exportList = list.stream().map(vo -> {
|
||||||
|
CrmOrderItemExportVo export = new CrmOrderItemExportVo();
|
||||||
|
BeanUtil.copyProperties(vo, export);
|
||||||
|
// 日期格式化
|
||||||
|
export.setSignTime(vo.getSignTime() != null ? sdf.format(vo.getSignTime()) : null);
|
||||||
|
// 展平 orderInfo 中的 salesman、orderCode、contractName
|
||||||
|
if (vo.getOrderInfo() != null) {
|
||||||
|
export.setSalesman(vo.getOrderInfo().getSalesman());
|
||||||
|
export.setOrderCode(vo.getOrderInfo().getOrderCode());
|
||||||
|
export.setContractName(vo.getOrderInfo().getContractName());
|
||||||
|
}
|
||||||
|
return export;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
ExcelUtil.exportExcel(exportList, "订单明细列表", CrmOrderItemExportVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取正式订单明细详细信息
|
* 获取正式订单明细详细信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.klp.crm.domain.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同编辑详情导出视图对象
|
||||||
|
* 仅包含页面表格展示的业务字段(19列)
|
||||||
|
*
|
||||||
|
* @author klp
|
||||||
|
* @date 2026-07-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class CrmOrderExportVo {
|
||||||
|
|
||||||
|
@ExcelProperty(value = "合同号")
|
||||||
|
private String contractCode;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "供方")
|
||||||
|
private String supplier;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "需方")
|
||||||
|
private String customer;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "业务员")
|
||||||
|
private String salesman;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "签订日期")
|
||||||
|
private String signTime;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "交货日期")
|
||||||
|
private String deliveryDate;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "签订地点")
|
||||||
|
private String signLocation;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "供方地址")
|
||||||
|
private String supplierAddress;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "供方电话")
|
||||||
|
private String supplierPhone;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "供方开户行")
|
||||||
|
private String supplierBank;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "供方账号")
|
||||||
|
private String supplierAccount;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "需方地址")
|
||||||
|
private String customerAddress;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "需方电话")
|
||||||
|
private String customerPhone;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "需方开户行")
|
||||||
|
private String customerBank;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "需方账号")
|
||||||
|
private String customerAccount;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "订单金额")
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "已收款")
|
||||||
|
private BigDecimal receivedAmount;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "状态")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package com.klp.crm.domain.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单明细列表导出视图对象
|
||||||
|
* 仅包含页面表格展示的业务字段(32列)
|
||||||
|
*
|
||||||
|
* @author klp
|
||||||
|
* @date 2026-07-06
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class CrmOrderItemExportVo {
|
||||||
|
|
||||||
|
// ========== 合同信息(联表) ==========
|
||||||
|
|
||||||
|
@ExcelProperty(value = "合同号")
|
||||||
|
private String contractCode;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "合同名称")
|
||||||
|
private String contractName;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "需方")
|
||||||
|
private String customer;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "供方")
|
||||||
|
private String supplier;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "业务员")
|
||||||
|
private String salesman;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "签订时间")
|
||||||
|
private String signTime;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "订单编号")
|
||||||
|
private String orderCode;
|
||||||
|
|
||||||
|
// ========== 明细标识 ==========
|
||||||
|
|
||||||
|
@ExcelProperty(value = "明细ID")
|
||||||
|
private Long itemId;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "订单ID")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
// ========== 产品规格 ==========
|
||||||
|
|
||||||
|
@ExcelProperty(value = "产品类型")
|
||||||
|
private String productType;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "原料规格")
|
||||||
|
private String rawMaterialSpec;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "成品规格")
|
||||||
|
private String finishedProductSpec;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "数量")
|
||||||
|
private Long productNum;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "材质")
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "等级")
|
||||||
|
private String grade;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "宽度")
|
||||||
|
private String width;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "厚度")
|
||||||
|
private String thickness;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "宽度公差")
|
||||||
|
private String widthTolerance;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "厚度公差")
|
||||||
|
private String thicknessTolerance;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "重量")
|
||||||
|
private BigDecimal weight;
|
||||||
|
|
||||||
|
// ========== 价格 ==========
|
||||||
|
|
||||||
|
@ExcelProperty(value = "合同定价")
|
||||||
|
private BigDecimal contractPrice;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "明细金额")
|
||||||
|
private BigDecimal itemAmount;
|
||||||
|
|
||||||
|
// ========== 加工要求 ==========
|
||||||
|
|
||||||
|
@ExcelProperty(value = "表面处理")
|
||||||
|
private String surfaceTreatment;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "包装要求")
|
||||||
|
private String packagingReq;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "切边要求")
|
||||||
|
private String edgeCuttingReq;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "表面质量")
|
||||||
|
private String surfaceQuality;
|
||||||
|
|
||||||
|
// ========== 其他 ==========
|
||||||
|
|
||||||
|
@ExcelProperty(value = "特殊要求")
|
||||||
|
private String specialRequire;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "用途")
|
||||||
|
private String purpose;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "定制人")
|
||||||
|
private String customizer;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "发货人")
|
||||||
|
private String shipper;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "排产批次")
|
||||||
|
private String productionBatch;
|
||||||
|
}
|
||||||
@@ -234,6 +234,12 @@ public class CrmOrderItemVo {
|
|||||||
@ExcelProperty(value = "交货日期")
|
@ExcelProperty(value = "交货日期")
|
||||||
private Date deliveryDate;
|
private Date deliveryDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售员(联表查询直接映射)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "销售员")
|
||||||
|
private String salesman;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单信息
|
* 订单信息
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -168,7 +168,11 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService {
|
|||||||
Map<Long, CrmOrderVo> orderMap = orderList.stream()
|
Map<Long, CrmOrderVo> orderMap = orderList.stream()
|
||||||
.collect(Collectors.toMap(CrmOrderVo::getOrderId, o -> o, (a, b) -> a));
|
.collect(Collectors.toMap(CrmOrderVo::getOrderId, o -> o, (a, b) -> a));
|
||||||
for (CrmOrderItemVo item : records) {
|
for (CrmOrderItemVo item : records) {
|
||||||
item.setOrderInfo(orderMap.get(item.getOrderId()));
|
CrmOrderVo order = orderMap.get(item.getOrderId());
|
||||||
|
item.setOrderInfo(order);
|
||||||
|
if (order != null) {
|
||||||
|
item.setSalesman(order.getSalesman());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@
|
|||||||
<result property="customer" column="customer"/>
|
<result property="customer" column="customer"/>
|
||||||
<result property="signTime" column="sign_time"/>
|
<result property="signTime" column="sign_time"/>
|
||||||
<result property="deliveryDate" column="delivery_date"/>
|
<result property="deliveryDate" column="delivery_date"/>
|
||||||
|
<result property="salesman" column="salesman"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 根据订单ID列表查询订单明细 -->
|
<!-- 根据订单ID列表查询订单明细 -->
|
||||||
@@ -155,7 +156,8 @@
|
|||||||
o.supplier,
|
o.supplier,
|
||||||
o.customer,
|
o.customer,
|
||||||
o.sign_time,
|
o.sign_time,
|
||||||
o.delivery_date
|
o.delivery_date,
|
||||||
|
o.salesman
|
||||||
FROM crm_order_item i
|
FROM crm_order_item i
|
||||||
LEFT JOIN crm_order o ON i.order_id = o.order_id AND o.del_flag = 0
|
LEFT JOIN crm_order o ON i.order_id = o.order_id AND o.del_flag = 0
|
||||||
<where>
|
<where>
|
||||||
|
|||||||
@@ -64,3 +64,13 @@ export function listTodayOrder(query) {
|
|||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出正式订单主列表(业务精简字段)
|
||||||
|
export function exportOrder(query) {
|
||||||
|
return request({
|
||||||
|
url: '/crm/order/exportDetail',
|
||||||
|
method: 'post',
|
||||||
|
data: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,3 +42,13 @@ export function delOrderItem(itemId) {
|
|||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 导出正式订单明细列表(业务精简字段)
|
||||||
|
export function exportOrderItem(query) {
|
||||||
|
return request({
|
||||||
|
url: '/crm/orderItem/exportDetail',
|
||||||
|
method: 'post',
|
||||||
|
data: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
/>
|
/>
|
||||||
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">筛选</el-button>
|
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">筛选</el-button>
|
||||||
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||||
|
<el-button size="small" icon="el-icon-download" @click="handleExport">导出</el-button>
|
||||||
<span v-if="total > 0" class="result-count">共 {{ total }} 条记录</span>
|
<span v-if="total > 0" class="result-count">共 {{ total }} 条记录</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -130,6 +131,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<!-- 业务员 -->
|
||||||
|
<el-table-column label="业务员" width="110">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-select v-model="scope.row.salesman" size="small" style="width: 100%" @change="saveRow(scope.row)">
|
||||||
|
<el-option v-for="item in dict.type.wip_pack_saleman" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<!-- 签订日期 -->
|
<!-- 签订日期 -->
|
||||||
<el-table-column label="签订日期" prop="signTime" width="100">
|
<el-table-column label="签订日期" prop="signTime" width="100">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@@ -421,8 +430,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listOrder, updateOrder } from '@/api/crm/order'
|
import { listOrder, updateOrder, exportOrder } from '@/api/crm/order'
|
||||||
import { listCustomer } from '@/api/crm/customer'
|
import { listCustomer } from '@/api/crm/customer'
|
||||||
|
import { blobValidate } from "@/utils/klp";
|
||||||
|
import { saveAs } from 'file-saver'
|
||||||
|
|
||||||
const STATUS_MAP = {
|
const STATUS_MAP = {
|
||||||
'0': { label: '草稿', type: 'info' },
|
'0': { label: '草稿', type: 'info' },
|
||||||
@@ -433,6 +444,7 @@ const STATUS_MAP = {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ContractDetailEdit',
|
name: 'ContractDetailEdit',
|
||||||
|
dicts: ['wip_pack_saleman'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -628,7 +640,38 @@ export default {
|
|||||||
}
|
}
|
||||||
this.customerDialogVisible = false
|
this.customerDialogVisible = false
|
||||||
this.saveRow(row)
|
this.saveRow(row)
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// 导出合同明细(按当前筛选条件)
|
||||||
|
handleExport() {
|
||||||
|
const params = {}
|
||||||
|
if (this.contractQuery.contractCode) params.contractCode = this.contractQuery.contractCode
|
||||||
|
if (this.contractQuery.supplier) params.supplier = this.contractQuery.supplier
|
||||||
|
if (this.contractQuery.customer) params.customer = this.contractQuery.customer
|
||||||
|
if (this.contractQuery.status !== undefined && this.contractQuery.status !== null) params.status = this.contractQuery.status
|
||||||
|
if (this.contractQuery.signDateStart) params.signDateStart = this.contractQuery.signDateStart
|
||||||
|
if (this.contractQuery.signDateEnd) params.signDateEnd = this.contractQuery.signDateEnd
|
||||||
|
if (this.contractQuery.deliveryDateStart) params.deliveryDateStart = this.contractQuery.deliveryDateStart
|
||||||
|
if (this.contractQuery.deliveryDateEnd) params.deliveryDateEnd = this.contractQuery.deliveryDateEnd
|
||||||
|
if (this.contractQuery.signLocation) params.signLocation = this.contractQuery.signLocation
|
||||||
|
exportOrder(params).then((res) => {
|
||||||
|
this.handleExportBlob(res, '合同编辑详情.xlsx')
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理blob文件导出
|
||||||
|
async handleExportBlob(res, fileName) {
|
||||||
|
const isBlob = blobValidate(res);
|
||||||
|
if (isBlob) {
|
||||||
|
saveAs(res, fileName);
|
||||||
|
this.$message.success('导出成功!');
|
||||||
|
} else {
|
||||||
|
const resText = await res.text();
|
||||||
|
const rspObj = JSON.parse(resText);
|
||||||
|
const errMsg = rspObj.msg || '导出失败';
|
||||||
|
this.$message.error(errMsg);
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<el-button type="danger" size="small" icon="el-icon-delete" :disabled="!selection.length" @click="handleBatchDelete">批量删除</el-button>
|
<el-button type="danger" size="small" icon="el-icon-delete" :disabled="!selection.length" @click="handleBatchDelete">批量删除</el-button>
|
||||||
|
<el-button type="primary" size="small" icon="el-icon-download" @click="handleExport">导出</el-button>
|
||||||
<span class="toolbar-tip">合同列为只读;明细列失焦自动保存(需有修改权限)</span>
|
<span class="toolbar-tip">合同列为只读;明细列失焦自动保存(需有修改权限)</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -50,6 +51,9 @@
|
|||||||
<el-table-column label="供方" min-width="120" show-overflow-tooltip>
|
<el-table-column label="供方" min-width="120" show-overflow-tooltip>
|
||||||
<template slot-scope="{ row }">{{ (row.orderInfo && row.orderInfo.supplier) || '-' }}</template>
|
<template slot-scope="{ row }">{{ (row.orderInfo && row.orderInfo.supplier) || '-' }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="业务员" min-width="80" show-overflow-tooltip>
|
||||||
|
<template slot-scope="{ row }">{{ (row.orderInfo && row.orderInfo.salesman) || row.salesman || '-' }}</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="签订时间" width="110">
|
<el-table-column label="签订时间" width="110">
|
||||||
<template slot-scope="{ row }">{{ row.orderInfo && row.orderInfo.signTime ? parseTime(row.orderInfo.signTime, '{y}-{m}-{d}') : '-' }}</template>
|
<template slot-scope="{ row }">{{ row.orderInfo && row.orderInfo.signTime ? parseTime(row.orderInfo.signTime, '{y}-{m}-{d}') : '-' }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -201,7 +205,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listOrderItem, updateOrderItem, delOrderItem } from '@/api/crm/orderItem'
|
import { listOrderItem, updateOrderItem, delOrderItem, exportOrderItem } from '@/api/crm/orderItem'
|
||||||
|
import { blobValidate } from "@/utils/klp";
|
||||||
|
import { saveAs } from 'file-saver'
|
||||||
|
|
||||||
const ITEM_PAYLOAD_KEYS = [
|
const ITEM_PAYLOAD_KEYS = [
|
||||||
'itemId',
|
'itemId',
|
||||||
@@ -354,7 +360,36 @@ export default {
|
|||||||
console.error('批量删除失败:', err)
|
console.error('批量删除失败:', err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// 导出订单明细(按当前筛选条件)
|
||||||
|
handleExport() {
|
||||||
|
const params = {}
|
||||||
|
if (this.queryParams.contractCode) params.contractCode = this.queryParams.contractCode
|
||||||
|
if (this.queryParams.customer) params.customer = this.queryParams.customer
|
||||||
|
if (this.queryParams.material) params.material = this.queryParams.material
|
||||||
|
if (this.queryParams.orderId) {
|
||||||
|
const n = Number(this.queryParams.orderId)
|
||||||
|
params.orderId = Number.isNaN(n) ? this.queryParams.orderId : n
|
||||||
|
}
|
||||||
|
exportOrderItem(params).then((res) => {
|
||||||
|
this.handleExportBlob(res, '正式订单明细.xlsx')
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理blob文件导出
|
||||||
|
async handleExportBlob(res, fileName) {
|
||||||
|
const isBlob = blobValidate(res);
|
||||||
|
if (isBlob) {
|
||||||
|
saveAs(res, fileName);
|
||||||
|
this.$modal.msgSuccess('导出成功!');
|
||||||
|
} else {
|
||||||
|
const resText = await res.text();
|
||||||
|
const rspObj = JSON.parse(resText);
|
||||||
|
const errMsg = rspObj.msg || '导出失败';
|
||||||
|
this.$modal.msgError(errMsg);
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
/>
|
/>
|
||||||
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">筛选</el-button>
|
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">筛选</el-button>
|
||||||
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||||
|
<el-button size="small" icon="el-icon-download" @click="handleExport">导出</el-button>
|
||||||
<span class="sort-hint">已按合同签订日期默认当月,结果按交货日期倒序排列</span>
|
<span class="sort-hint">已按合同签订日期默认当月,结果按交货日期倒序排列</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -96,6 +97,11 @@
|
|||||||
<span class="contract-info" :title="row.customer">{{ row.customer }}</span>
|
<span class="contract-info" :title="row.customer">{{ row.customer }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="业务员" width="80">
|
||||||
|
<template slot-scope="{ row }">
|
||||||
|
<span class="contract-info">{{ row._order && row._order.salesman ? row._order.salesman : '-' }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="签订日期" prop="signTime" width="100">
|
<el-table-column label="签订日期" prop="signTime" width="100">
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
<span class="contract-info contract-date">{{ formatDate(row.signTime) }}</span>
|
<span class="contract-info contract-date">{{ formatDate(row.signTime) }}</span>
|
||||||
@@ -270,8 +276,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listOrder, updateOrder } from '@/api/crm/order'
|
import { listOrder, updateOrder, exportOrder } from '@/api/crm/order'
|
||||||
import { parseProductContent, stringifyProductContent, calculateProductFields, recalculateTotals } from '@/utils/productContent'
|
import { parseProductContent, stringifyProductContent, calculateProductFields, recalculateTotals } from '@/utils/productContent'
|
||||||
|
import { blobValidate } from "@/utils/klp";
|
||||||
|
import { saveAs } from 'file-saver'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OrderItemList',
|
name: 'OrderItemList',
|
||||||
@@ -555,6 +563,34 @@ export default {
|
|||||||
this.getList()
|
this.getList()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 导出订单明细(按当前筛选条件)
|
||||||
|
handleExport() {
|
||||||
|
const params = {}
|
||||||
|
if (this.queryParams.contractCode) params.contractCode = this.queryParams.contractCode
|
||||||
|
if (this.queryParams.customer) params.customer = this.queryParams.customer
|
||||||
|
if (this.queryParams.signDateStart) params.signDateStart = this.queryParams.signDateStart
|
||||||
|
if (this.queryParams.signDateEnd) params.signDateEnd = this.queryParams.signDateEnd
|
||||||
|
if (this.queryParams.deliveryDateStart) params.deliveryDateStart = this.queryParams.deliveryDateStart
|
||||||
|
if (this.queryParams.deliveryDateEnd) params.deliveryDateEnd = this.queryParams.deliveryDateEnd
|
||||||
|
exportOrder(params).then((res) => {
|
||||||
|
this.handleExportBlob(res, '订单明细列表.xlsx')
|
||||||
|
}).catch(() => {})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理blob文件导出
|
||||||
|
async handleExportBlob(res, fileName) {
|
||||||
|
const isBlob = blobValidate(res);
|
||||||
|
if (isBlob) {
|
||||||
|
saveAs(res, fileName);
|
||||||
|
this.$message.success('导出成功!');
|
||||||
|
} else {
|
||||||
|
const resText = await res.text();
|
||||||
|
const rspObj = JSON.parse(resText);
|
||||||
|
const errMsg = rspObj.msg || '导出失败';
|
||||||
|
this.$message.error(errMsg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
groupRowClassName({ row, rowIndex }) {
|
groupRowClassName({ row, rowIndex }) {
|
||||||
if (row.productIndex === 0) {
|
if (row.productIndex === 0) {
|
||||||
return 'group-row-a'
|
return 'group-row-a'
|
||||||
|
|||||||
Reference in New Issue
Block a user