Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package com.klp.crm.controller;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
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.ApsPlanSheetBo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -23,6 +26,7 @@ import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
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.service.ICrmOrderService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
@@ -65,6 +69,35 @@ public class CrmOrderController extends BaseController {
|
||||
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;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.utils.poi.ExcelUtil;
|
||||
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.bo.CrmOrderItemBo;
|
||||
import com.klp.crm.service.ICrmOrderItemService;
|
||||
@@ -56,6 +61,30 @@ public class CrmOrderItemController extends BaseController {
|
||||
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 = "交货日期")
|
||||
private Date deliveryDate;
|
||||
|
||||
/**
|
||||
* 销售员(联表查询直接映射)
|
||||
*/
|
||||
@ExcelProperty(value = "销售员")
|
||||
private String salesman;
|
||||
|
||||
/**
|
||||
* 订单信息
|
||||
*/
|
||||
|
||||
@@ -168,7 +168,11 @@ public class CrmOrderItemServiceImpl implements ICrmOrderItemService {
|
||||
Map<Long, CrmOrderVo> orderMap = orderList.stream()
|
||||
.collect(Collectors.toMap(CrmOrderVo::getOrderId, o -> o, (a, b) -> a));
|
||||
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="signTime" column="sign_time"/>
|
||||
<result property="deliveryDate" column="delivery_date"/>
|
||||
<result property="salesman" column="salesman"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据订单ID列表查询订单明细 -->
|
||||
@@ -155,7 +156,8 @@
|
||||
o.supplier,
|
||||
o.customer,
|
||||
o.sign_time,
|
||||
o.delivery_date
|
||||
o.delivery_date,
|
||||
o.salesman
|
||||
FROM crm_order_item i
|
||||
LEFT JOIN crm_order o ON i.order_id = o.order_id AND o.del_flag = 0
|
||||
<where>
|
||||
|
||||
@@ -64,3 +64,13 @@ export function listTodayOrder(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'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出正式订单明细列表(业务精简字段)
|
||||
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 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>
|
||||
</div>
|
||||
|
||||
@@ -130,6 +131,14 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- 业务员 -->
|
||||
<el-table-column label="业务员" width="110">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.salesman" size="small" class="editable-cell" 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">
|
||||
<template slot-scope="scope">
|
||||
@@ -421,8 +430,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOrder, updateOrder } from '@/api/crm/order'
|
||||
import { listOrder, updateOrder, exportOrder } from '@/api/crm/order'
|
||||
import { listCustomer } from '@/api/crm/customer'
|
||||
import { blobValidate } from "@/utils/klp";
|
||||
import { saveAs } from 'file-saver'
|
||||
|
||||
const STATUS_MAP = {
|
||||
'0': { label: '草稿', type: 'info' },
|
||||
@@ -433,6 +444,7 @@ const STATUS_MAP = {
|
||||
|
||||
export default {
|
||||
name: 'ContractDetailEdit',
|
||||
dicts: ['wip_pack_saleman'],
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
@@ -628,7 +640,38 @@ export default {
|
||||
}
|
||||
this.customerDialogVisible = false
|
||||
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>
|
||||
@@ -727,6 +770,22 @@ export default {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/* 业务员下拉框样式 */
|
||||
.select-salesman ::v-deep .el-input__inner {
|
||||
background-color: #f3f0ff;
|
||||
border-color: transparent;
|
||||
padding: 0 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.select-salesman ::v-deep .el-input__inner:focus {
|
||||
border-color: #5F7BA0;
|
||||
background-color: #fff;
|
||||
overflow: visible;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/* 日期选择器样式 */
|
||||
.editable-cell-date ::v-deep .el-input__inner {
|
||||
background-color: #e6f7ff;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
<div class="toolbar">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@@ -50,6 +51,9 @@
|
||||
<el-table-column label="供方" min-width="120" show-overflow-tooltip>
|
||||
<template slot-scope="{ row }">{{ (row.orderInfo && row.orderInfo.supplier) || '-' }}</template>
|
||||
</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">
|
||||
<template slot-scope="{ row }">{{ row.orderInfo && row.orderInfo.signTime ? parseTime(row.orderInfo.signTime, '{y}-{m}-{d}') : '-' }}</template>
|
||||
</el-table-column>
|
||||
@@ -201,7 +205,9 @@
|
||||
</template>
|
||||
|
||||
<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 = [
|
||||
'itemId',
|
||||
@@ -354,7 +360,36 @@ export default {
|
||||
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>
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
/>
|
||||
<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-download" @click="handleExport">导出</el-button>
|
||||
<span class="sort-hint">已按合同签订日期默认当月,结果按交货日期倒序排列</span>
|
||||
</div>
|
||||
|
||||
@@ -96,6 +97,11 @@
|
||||
<span class="contract-info" :title="row.customer">{{ row.customer }}</span>
|
||||
</template>
|
||||
</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">
|
||||
<template slot-scope="{ row }">
|
||||
<span class="contract-info contract-date">{{ formatDate(row.signTime) }}</span>
|
||||
@@ -270,8 +276,10 @@
|
||||
</template>
|
||||
|
||||
<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 { blobValidate } from "@/utils/klp";
|
||||
import { saveAs } from 'file-saver'
|
||||
|
||||
export default {
|
||||
name: 'OrderItemList',
|
||||
@@ -555,6 +563,34 @@ export default {
|
||||
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 }) {
|
||||
if (row.productIndex === 0) {
|
||||
return 'group-row-a'
|
||||
|
||||
Reference in New Issue
Block a user