体现入库时间,供应商名称,去查询系统直接选择供应商导出

This commit is contained in:
朱昊天
2026-06-08 16:35:08 +08:00
parent 2ca6a271db
commit 9ff6a57544
16 changed files with 625 additions and 77 deletions

View File

@@ -14,6 +14,7 @@ import com.gear.common.utils.StringUtils;
import com.gear.common.utils.poi.ExcelUtil;
import com.gear.oa.domain.bo.GearStockIoOrderBo;
import com.gear.oa.domain.bo.GearStockIoOrderWithDetailBo;
import com.gear.oa.domain.vo.GearStockIoOrderDetailVo;
import com.gear.oa.domain.vo.GearStockIoOrderVo;
import com.gear.oa.domain.vo.GearStockIoOrderWithDetailVo;
import com.gear.oa.service.IGearStockIoOrderService;
@@ -55,6 +56,13 @@ public class GearStockIoOrderController extends BaseController {
ExcelUtil.exportExcel(list, "出入库单据", GearStockIoOrderVo.class, response);
}
@Log(title = "出入库单据明细", businessType = BusinessType.EXPORT)
@PostMapping("/exportDetail")
public void exportDetail(GearStockIoOrderBo bo, HttpServletResponse response) {
List<GearStockIoOrderDetailVo> list = stockIoOrderService.queryDetailExportList(bo);
ExcelUtil.exportExcel(list, "出入库单据明细", GearStockIoOrderDetailVo.class, response);
}
@GetMapping("/materialFlow")
public R<IGearStockIoOrderService.MaterialFlowResp> materialFlow(@RequestParam(required = false) Long itemId,
@RequestParam(required = false) String factory,

View File

@@ -37,6 +37,8 @@ public class GearSalaryRecordsBo extends BaseEntity {
*/
private Long employeeId;
private Long deptId;
/**
* 发薪月份(YYYY-MM-01)
*/

View File

@@ -11,6 +11,8 @@ import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
@Data
@EqualsAndHashCode(callSuper = true)
public class GearStockIoOrderBo extends BaseEntity {
@@ -37,6 +39,18 @@ public class GearStockIoOrderBo extends BaseEntity {
private Date ioTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
private String itemName;
private String factory;
private Long supplierId;
private Date planArrivalTime;
private Date actualArrivalTime;

View File

@@ -114,5 +114,8 @@ public class GearSalaryRecordsVo {
//联查昵称
private String employeeName;
private Long deptId;
private String deptName;
}

View File

@@ -3,9 +3,12 @@ package com.gear.oa.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.gear.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ExcelIgnoreUnannotated
@@ -25,29 +28,76 @@ public class GearStockIoOrderDetailVo extends BaseEntity {
private Integer materialTypeSnapshot;
@ExcelProperty(value = "物料类型")
private String materialTypeName;
@ExcelProperty(value = "单据编号")
private String orderCode;
@ExcelProperty(value = "出入库类型")
private String ioType;
@ExcelProperty(value = "业务类型")
private String bizType;
@ExcelProperty(value = "出入库时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date ioTime;
@ExcelProperty(value = "状态")
private String orderStatusText;
@ExcelProperty(value = "责任人")
private String responsibleName;
@ExcelProperty(value = "物料名称")
private String itemName;
@ExcelProperty(value = "规格")
private String specName;
@ExcelProperty(value = "型号")
private String model;
@ExcelProperty(value = "厂家")
private String factory;
private Long warehouseId;
private Long fromWarehouseId;
@ExcelProperty(value = "仓库/库位")
private String warehouseName;
@ExcelProperty(value = "源库位")
private String fromWarehouseName;
private Long supplierId;
@ExcelProperty(value = "供应商")
private String supplierName;
@ExcelProperty(value = "数量")
private BigDecimal quantity;
@ExcelProperty(value = "单位")
private String unit;
@ExcelProperty(value = "批次号")
private String batchNo;
@ExcelProperty(value = "单价")
private BigDecimal unitPrice;
@ExcelProperty(value = "金额")
private BigDecimal amount;
@ExcelProperty(value = "来源明细号")
private String sourceDetailNo;
private Long reversalDetailId;
@ExcelProperty(value = "备注")
private String remark;
}

View File

@@ -1,12 +1,15 @@
package com.gear.oa.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gear.oa.domain.GearSalaryRecords;
import com.gear.oa.domain.vo.GearSalaryRecordsVo;
import com.gear.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 工资发放记录Mapper接口
*
@@ -16,4 +19,6 @@ import org.apache.ibatis.annotations.Param;
public interface GearSalaryRecordsMapper extends BaseMapperPlus<GearSalaryRecordsMapper, GearSalaryRecords, GearSalaryRecordsVo> {
Page<GearSalaryRecordsVo> selectVoPagePlus(Page<Object> build,@Param("ew") QueryWrapper<GearSalaryRecords> lqw);
List<GearSalaryRecordsVo> selectVoListPlus(@Param("ew") Wrapper<GearSalaryRecords> wrapper);
}

View File

@@ -1,9 +1,14 @@
package com.gear.oa.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.gear.common.core.mapper.BaseMapperPlus;
import com.gear.oa.domain.GearStockIoOrderDetail;
import com.gear.oa.domain.vo.GearStockIoOrderDetailVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface GearStockIoOrderDetailMapper extends BaseMapperPlus<GearStockIoOrderDetailMapper, GearStockIoOrderDetail, GearStockIoOrderDetailVo> {
}
List<GearStockIoOrderDetailVo> selectExportDetailList(@Param("ew") Wrapper<?> wrapper);
}

View File

@@ -4,6 +4,7 @@ import com.gear.common.core.domain.PageQuery;
import com.gear.common.core.page.TableDataInfo;
import com.gear.oa.domain.bo.GearStockIoOrderBo;
import com.gear.oa.domain.bo.GearStockIoOrderWithDetailBo;
import com.gear.oa.domain.vo.GearStockIoOrderDetailVo;
import com.gear.oa.domain.vo.GearStockIoOrderVo;
import com.gear.oa.domain.vo.GearStockIoOrderWithDetailVo;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -23,6 +24,8 @@ public interface IGearStockIoOrderService {
List<GearStockIoOrderVo> queryList(GearStockIoOrderBo bo);
List<GearStockIoOrderDetailVo> queryDetailExportList(GearStockIoOrderBo bo);
Long createWithDetail(GearStockIoOrderWithDetailBo bo);
void updateWithDetail(GearStockIoOrderWithDetailBo bo);

View File

@@ -55,6 +55,7 @@ public class GearSalaryRecordsServiceImpl implements IGearSalaryRecordsService {
QueryWrapper<GearSalaryRecords> lqw = Wrappers.query();
// 使用表别名 sr 来构建查询条件
lqw.eq(bo.getEmployeeId() != null, "sr.employee_id", bo.getEmployeeId());
lqw.eq(bo.getDeptId() != null, "su.dept_id", bo.getDeptId());
lqw.eq(bo.getPayPeriod() != null, "sr.pay_period", bo.getPayPeriod());
lqw.eq(bo.getBaseSalary() != null, "sr.base_salary", bo.getBaseSalary());
lqw.eq(bo.getPerformanceBonus() != null, "sr.performance_bonus", bo.getPerformanceBonus());
@@ -77,8 +78,8 @@ public class GearSalaryRecordsServiceImpl implements IGearSalaryRecordsService {
*/
@Override
public List<GearSalaryRecordsVo> queryList(GearSalaryRecordsBo bo) {
LambdaQueryWrapper<GearSalaryRecords> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
QueryWrapper<GearSalaryRecords> qw = buildQueryWrapperPlus(bo);
return baseMapper.selectVoListPlus(qw);
}
private LambdaQueryWrapper<GearSalaryRecords> buildQueryWrapper(GearSalaryRecordsBo bo) {

View File

@@ -3,6 +3,7 @@ package com.gear.oa.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gear.common.core.domain.PageQuery;
@@ -74,6 +75,12 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
return list;
}
@Override
public List<GearStockIoOrderDetailVo> queryDetailExportList(GearStockIoOrderBo bo) {
QueryWrapper<Object> qw = buildDetailExportQueryWrapper(bo);
return detailMapper.selectExportDetailList(qw);
}
private void fillMaterialNames(List<GearStockIoOrderVo> orders) {
if (orders == null || orders.isEmpty()) {
return;
@@ -130,11 +137,40 @@ public class GearStockIoOrderServiceImpl implements IGearStockIoOrderService {
lqw.eq(StringUtils.isNotBlank(bo.getReversalFlag()), GearStockIoOrder::getReversalFlag, bo.getReversalFlag());
lqw.like(StringUtils.isNotBlank(bo.getSourceNo()), GearStockIoOrder::getSourceNo, bo.getSourceNo());
lqw.like(StringUtils.isNotBlank(bo.getResponsibleName()), GearStockIoOrder::getResponsibleName, bo.getResponsibleName());
lqw.ge(bo.getStartTime() != null, GearStockIoOrder::getIoTime, bo.getStartTime());
lqw.le(bo.getEndTime() != null, GearStockIoOrder::getIoTime, bo.getEndTime());
lqw.apply(StringUtils.isNotBlank(bo.getItemName()),
"exists (select 1 from gear_stock_io_order_detail d where d.del_flag = '0' and d.order_id = gear_stock_io_order.order_id and d.item_name like concat('%',{0},'%'))",
bo.getItemName());
lqw.apply(StringUtils.isNotBlank(bo.getFactory()),
"exists (select 1 from gear_stock_io_order_detail d left join mat_material m on d.item_type = 'material' and d.item_id = m.material_id and m.del_flag = 0 where d.del_flag = '0' and d.order_id = gear_stock_io_order.order_id and m.factory like concat('%',{0},'%'))",
bo.getFactory());
lqw.apply(bo.getSupplierId() != null,
"exists (select 1 from gear_stock_io_order_detail d left join gear_purchase_plan_detail ppd on d.source_detail_no = ppd.detail_code and ppd.del_flag = 0 where d.del_flag = '0' and d.order_id = gear_stock_io_order.order_id and ppd.supplier_id = {0})",
bo.getSupplierId());
lqw.eq(StringUtils.isNotBlank(bo.getDelayStatus()), GearStockIoOrder::getDelayStatus, bo.getDelayStatus());
lqw.orderByDesc(GearStockIoOrder::getCreateTime);
return lqw;
}
private QueryWrapper<Object> buildDetailExportQueryWrapper(GearStockIoOrderBo bo) {
QueryWrapper<Object> qw = Wrappers.query();
qw.eq("d.del_flag", "0");
qw.eq("o.del_flag", "0");
qw.like(StringUtils.isNotBlank(bo.getOrderCode()), "o.order_code", bo.getOrderCode());
qw.eq(StringUtils.isNotBlank(bo.getIoType()), "o.io_type", bo.getIoType());
qw.eq(StringUtils.isNotBlank(bo.getBizType()), "o.biz_type", bo.getBizType());
qw.like(StringUtils.isNotBlank(bo.getResponsibleName()), "o.responsible_name", bo.getResponsibleName());
qw.ge(bo.getStartTime() != null, "o.io_time", bo.getStartTime());
qw.le(bo.getEndTime() != null, "o.io_time", bo.getEndTime());
qw.apply(StringUtils.isNotBlank(bo.getItemName()),
"(d.item_name like concat('%',{0},'%') or m.material_name like concat('%',{0},'%'))",
bo.getItemName());
qw.like(StringUtils.isNotBlank(bo.getFactory()), "m.factory", bo.getFactory());
qw.eq(bo.getSupplierId() != null, "ppd.supplier_id", bo.getSupplierId());
return qw;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long createWithDetail(GearStockIoOrderWithDetailBo bo) {

View File

@@ -46,9 +46,43 @@
sr.del_flag,
sr.remark,
sr.pay_status,
su.nick_name as employeeName
su.nick_name as employeeName,
su.dept_id as deptId,
sd.dept_name as deptName
FROM gear_salary_records sr
LEFT JOIN sys_user su ON sr.employee_id = su.user_id
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
${ew.customSqlSegment}
ORDER BY sr.create_time DESC
</select>
<select id="selectVoListPlus" resultType="com.gear.oa.domain.vo.GearSalaryRecordsVo">
SELECT
sr.salary_id,
sr.employee_id,
sr.pay_period,
sr.base_salary,
sr.performance_bonus,
sr.overtime_pay,
sr.allowance,
sr.social_security,
sr.housing_fund,
sr.income_tax,
sr.gross_salary,
sr.net_salary,
sr.create_by,
sr.create_time,
sr.update_by,
sr.update_time,
sr.del_flag,
sr.remark,
sr.pay_status,
su.nick_name as employeeName,
su.dept_id as deptId,
sd.dept_name as deptName
FROM gear_salary_records sr
LEFT JOIN sys_user su ON sr.employee_id = su.user_id
LEFT JOIN sys_dept sd ON su.dept_id = sd.dept_id
${ew.customSqlSegment}
ORDER BY sr.create_time DESC
</select>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gear.oa.mapper.GearStockIoOrderDetailMapper">
<select id="selectExportDetailList" resultType="com.gear.oa.domain.vo.GearStockIoOrderDetailVo">
SELECT
d.detail_id AS detailId,
d.order_id AS orderId,
d.line_no AS lineNo,
d.item_type AS itemType,
d.item_id AS itemId,
d.material_type_snapshot AS materialTypeSnapshot,
CASE WHEN d.material_type_snapshot = 2 THEN '主材' ELSE '辅材' END AS materialTypeName,
o.order_code AS orderCode,
o.io_type AS ioType,
o.biz_type AS bizType,
o.io_time AS ioTime,
CASE
WHEN o.revoke_flag = '1' THEN '已撤回'
WHEN o.confirm_in_flag = '1' THEN '已确认'
ELSE '正常'
END AS orderStatusText,
o.responsible_name AS responsibleName,
COALESCE(d.item_name, m.material_name) AS itemName,
COALESCE(d.spec_name, m.spec) AS specName,
m.model AS model,
m.factory AS factory,
d.warehouse_id AS warehouseId,
d.from_warehouse_id AS fromWarehouseId,
w.warehouse_name AS warehouseName,
fw.warehouse_name AS fromWarehouseName,
ppd.supplier_id AS supplierId,
s.name AS supplierName,
d.quantity AS quantity,
COALESCE(d.unit, m.unit) AS unit,
d.batch_no AS batchNo,
d.unit_price AS unitPrice,
d.amount AS amount,
d.source_detail_no AS sourceDetailNo,
d.remark AS remark
FROM gear_stock_io_order_detail d
LEFT JOIN gear_stock_io_order o ON d.order_id = o.order_id
LEFT JOIN mat_material m ON d.item_type = 'material' AND d.item_id = m.material_id AND m.del_flag = 0
LEFT JOIN gear_warehouse w ON d.warehouse_id = w.warehouse_id AND w.del_flag = 0
LEFT JOIN gear_warehouse fw ON d.from_warehouse_id = fw.warehouse_id AND fw.del_flag = 0
LEFT JOIN gear_purchase_plan_detail ppd ON d.source_detail_no = ppd.detail_code AND ppd.del_flag = 0
LEFT JOIN gear_supplier s ON ppd.supplier_id = s.supplier_id AND s.del_flag = 0
${ew.customSqlSegment}
ORDER BY o.io_time DESC, o.order_id DESC, d.line_no ASC
</select>
</mapper>

View File

@@ -4,10 +4,14 @@
<!-- 左侧客户列表对齐你截图的左侧列表 + 右侧详情布局 -->
<el-col :span="6" class="customer-left">
<div class="left-toolbar">
<el-radio-group v-model="entityType" size="small" @change="handleEntityTypeChange">
<el-radio-button label="customer">客户</el-radio-button>
<el-radio-button label="supplier">供货商</el-radio-button>
</el-radio-group>
<el-input
v-model="queryParams.name"
v-model="searchKeyword"
clearable
placeholder="请输入关键字搜索客户"
:placeholder="entityType === 'customer' ? '请输入关键字搜索客户' : '请输入关键字搜索供货商'"
@keyup.enter.native="handleQuery"
@clear="handleQuery"
>
@@ -22,14 +26,14 @@
</div>
<div class="left-list" v-loading="loading">
<el-empty v-if="!customerList.length" description="暂无客户" />
<el-empty v-if="entityType === 'customer' ? !customerList.length : !supplierList.length" :description="entityType === 'customer' ? '暂无客户' : '暂无供货商'" />
<el-scrollbar v-else height="calc(100vh - 220px)">
<div
v-for="item in customerList"
:key="item.customerId"
v-for="item in (entityType === 'customer' ? customerList : supplierList)"
:key="entityType === 'customer' ? item.customerId : item.supplierId"
class="customer-card"
:class="{ active: item.customerId === selectedCustomerId }"
@click="handleSelect(item)"
:class="{ active: entityType === 'customer' ? item.customerId === selectedCustomerId : item.supplierId === selectedSupplierId }"
@click="entityType === 'customer' ? handleSelect(item) : handleSelectSupplier(item)"
>
<div class="customer-card__row">
<div class="customer-card__title">{{ item.name || '-' }}</div>
@@ -43,42 +47,62 @@
删除
</el-button>
</div>
<div class="customer-card__meta">
<span class="customer-card__meta-item">手机{{ item.mobile || '-' }}</span>
<span class="customer-card__meta-item">电话{{ item.telephone || '-' }}</span>
</div>
<div class="customer-card__meta">
<span class="customer-card__meta-item">邮箱{{ item.email || '-' }}</span>
</div>
<template v-if="entityType === 'customer'">
<div class="customer-card__meta">
<span class="customer-card__meta-item">手机{{ item.mobile || '-' }}</span>
<span class="customer-card__meta-item">电话{{ item.telephone || '-' }}</span>
</div>
<div class="customer-card__meta">
<span class="customer-card__meta-item">邮箱{{ item.email || '-' }}</span>
</div>
</template>
<template v-else>
<div class="customer-card__meta">
<span class="customer-card__meta-item">联系人{{ item.contactPerson || '-' }}</span>
<span class="customer-card__meta-item">电话{{ item.phone || '-' }}</span>
</div>
<div class="customer-card__meta">
<span class="customer-card__meta-item">地址{{ item.address || '-' }}</span>
</div>
</template>
</div>
</el-scrollbar>
</div>
<pagination
v-if="entityType === 'customer'"
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<pagination
v-else
v-show="supplierTotal>0"
:total="supplierTotal"
v-model:page="supplierQueryParams.pageNum"
v-model:limit="supplierQueryParams.pageSize"
@pagination="getList"
/>
</el-col>
<!-- 右侧客户详情Tab 结构参考你截图 -->
<el-col :span="18" class="customer-right">
<el-card shadow="never" class="right-card">
<el-tabs v-model="activeTab" @tab-click="handleTabChange">
<el-tab-pane label="客户详情" name="detail" />
<el-tab-pane :label="entityType === 'customer' ? '客户详情' : '供货商详情'" name="detail" />
<el-tab-pane label="信息编辑" name="edit" />
<el-tab-pane label="历史订单" name="orders" />
<el-tab-pane label="财务状态" name="finance" />
<el-tab-pane label="订单异议" name="dispute" />
<el-tab-pane label="发货单据" name="shipping" />
<el-tab-pane v-if="entityType === 'customer'" label="历史订单" name="orders" />
<el-tab-pane v-if="entityType === 'customer'" label="财务状态" name="finance" />
<el-tab-pane v-if="entityType === 'customer'" label="订单异议" name="dispute" />
<el-tab-pane v-if="entityType === 'customer'" label="发货单据" name="shipping" />
</el-tabs>
<div class="right-body" v-loading="detailLoading">
<el-empty v-if="!selectedCustomerId" description="请选择左侧客户" />
<el-empty v-if="entityType === 'customer' ? !selectedCustomerId : !selectedSupplierId" :description="entityType === 'customer' ? '请选择左侧客户' : '请选择左侧供货商'" />
<template v-else>
<template v-else-if="entityType === 'customer'">
<div v-show="activeTab === 'detail'">
<!-- 客户详情用表格/预览式展示便于快速浏览 -->
<el-descriptions :column="2" border>
@@ -300,6 +324,50 @@
</el-table>
</div>
</template>
<template v-else>
<div v-show="activeTab === 'detail'">
<el-descriptions :column="2" border>
<el-descriptions-item label="供货商编号">{{ selectedSupplier.supplierId }}</el-descriptions-item>
<el-descriptions-item label="供货商名称">{{ selectedSupplier.name }}</el-descriptions-item>
<el-descriptions-item label="联系人">{{ selectedSupplier.contactPerson }}</el-descriptions-item>
<el-descriptions-item label="联系电话">{{ selectedSupplier.phone }}</el-descriptions-item>
<el-descriptions-item label="地址" :span="2">{{ selectedSupplier.address }}</el-descriptions-item>
<el-descriptions-item label="供货商类型">{{ supplierTypeName(selectedSupplier.typeId) }}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{ selectedSupplier.remark }}</el-descriptions-item>
</el-descriptions>
</div>
<div v-show="activeTab === 'edit'">
<el-form ref="supplierEditFormRef" :model="supplierEditForm" label-width="90px" class="edit-form">
<el-form-item label="供货商名称" prop="name">
<el-input v-model="supplierEditForm.name" placeholder="请输入供货商名称" />
</el-form-item>
<el-form-item label="联系人" prop="contactPerson">
<el-input v-model="supplierEditForm.contactPerson" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input v-model="supplierEditForm.phone" placeholder="请输入联系电话" />
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="supplierEditForm.address" placeholder="请输入地址" />
</el-form-item>
<el-form-item label="供货商类型" prop="typeId">
<el-select v-model="supplierEditForm.typeId" filterable clearable placeholder="请选择供货商类型">
<el-option v-for="t in supplyTypeList" :key="t.typeId" :label="t.typeName" :value="t.typeId" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="supplierEditForm.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div class="edit-actions">
<el-button :loading="buttonLoading" type="primary" @click="submitEdit">保存</el-button>
<el-button @click="resetEdit">重置</el-button>
</div>
</div>
</template>
</div>
</el-card>
</el-col>
@@ -310,6 +378,8 @@
<script>
import { getCurrentInstance } from "vue";
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer } from "@/api/oms/customer";
import { listSupplier, getSupplier, delSupplier, addSupplier, updateSupplier } from "@/api/oa/supplier";
import { listSupplyType } from "@/api/oa/supplyType";
import { listOrder } from "@/api/oms/order";
import { listShippingOrder } from "@/api/oms/shippingOrder";
import { listOrderDetail } from "@/api/oms/orderDetail";
@@ -340,6 +410,9 @@ export default {
total: 0,
// CRM 客户表格数据
customerList: [],
entityType: "customer",
supplierList: [],
supplierTotal: 0,
// 查询参数
queryParams: {
pageNum: 1,
@@ -353,9 +426,22 @@ export default {
// 当前选中客户(左侧列表点击后刷新)
selectedCustomerId: undefined,
selectedCustomer: {},
selectedSupplierId: undefined,
selectedSupplier: {},
detailLoading: false,
// 编辑表单右侧“信息编辑”Tab 使用)
editForm: {},
supplierEditForm: {},
supplierQueryParams: {
pageNum: 1,
pageSize: 20,
name: undefined,
contactPerson: undefined,
phone: undefined,
address: undefined,
typeId: undefined
},
supplyTypeList: [],
// 历史订单(右侧“历史订单/财务状态”Tab 使用)
ordersLoading: false,
orderList: [],
@@ -397,25 +483,69 @@ export default {
};
},
created() {
this.loadSupplyTypeList();
this.getList();
},
methods: {
loadSupplyTypeList() {
return listSupplyType({ pageNum: 1, pageSize: 9999 })
.then((res) => {
this.supplyTypeList = (res && res.rows) ? res.rows : [];
})
.catch(() => {
this.supplyTypeList = [];
});
},
supplierTypeName(typeId) {
const id = typeId != null ? Number(typeId) : null;
const list = this.supplyTypeList || [];
const hit = list.find((t) => t && Number(t.typeId) === id);
return hit && hit.typeName ? hit.typeName : (typeId != null ? String(typeId) : "-");
},
/** 查询CRM 客户列表 */
getList() {
this.loading = true;
listCustomer(this.queryParams).then(response => {
this.customerList = response.rows;
this.total = response.total;
if (this.entityType === "customer") {
listCustomer(this.queryParams).then(response => {
this.customerList = response.rows;
this.total = response.total;
this.loading = false;
if (!this.selectedCustomerId && this.customerList.length) {
this.handleSelect(this.customerList[0]);
}
}).finally(() => {
this.loading = false;
});
return;
}
listSupplier(this.supplierQueryParams).then(response => {
this.supplierList = response.rows;
this.supplierTotal = response.total;
this.loading = false;
// 列表刷新后:如果未选中客户,则默认选中第一条(便于右侧有内容)
if (!this.selectedCustomerId && this.customerList.length) {
this.handleSelect(this.customerList[0]);
if (!this.selectedSupplierId && this.supplierList.length) {
this.handleSelectSupplier(this.supplierList[0]);
}
}).finally(() => {
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
if (this.entityType === "customer") {
this.queryParams.pageNum = 1;
} else {
this.supplierQueryParams.pageNum = 1;
}
this.getList();
},
handleEntityTypeChange() {
this.activeTab = "detail";
this.selectedCustomerId = undefined;
this.selectedCustomer = {};
this.editForm = {};
this.selectedSupplierId = undefined;
this.selectedSupplier = {};
this.supplierEditForm = {};
this.getList();
},
/** 左侧列表点击:加载客户详情,并同步初始化编辑表单 */
@@ -458,61 +588,117 @@ export default {
this.detailLoading = false;
});
},
handleSelectSupplier(row) {
if (!row || !row.supplierId) return;
this.selectedSupplierId = row.supplierId;
this.detailLoading = true;
getSupplier(row.supplierId).then(res => {
this.selectedSupplier = res.data || {};
this.supplierEditForm = { ...(res.data || {}) };
}).finally(() => {
this.detailLoading = false;
});
},
/** 新增按钮操作 */
handleAdd() {
// 说明新增时直接切换到“信息编辑”Tab并初始化空表单
this.activeTab = "edit";
this.selectedCustomerId = undefined;
this.selectedCustomer = {};
this.editForm = {
customerId: undefined,
if (this.entityType === "customer") {
this.selectedCustomerId = undefined;
this.selectedCustomer = {};
this.editForm = {
customerId: undefined,
name: undefined,
mobile: undefined,
telephone: undefined,
qq: undefined,
wechat: undefined,
email: undefined,
areaId: undefined,
detailAddress: undefined,
level: undefined,
source: undefined,
remark: undefined
};
return;
}
this.selectedSupplierId = undefined;
this.selectedSupplier = {};
this.supplierEditForm = {
supplierId: undefined,
name: undefined,
mobile: undefined,
telephone: undefined,
qq: undefined,
wechat: undefined,
email: undefined,
areaId: undefined,
detailAddress: undefined,
level: undefined,
source: undefined,
contactPerson: undefined,
phone: undefined,
address: undefined,
typeId: undefined,
remark: undefined
};
},
/** 保存编辑(新增/修改共用) */
submitEdit() {
this.$refs["editFormRef"].validate(valid => {
if (!valid) return;
this.buttonLoading = true;
const req = this.editForm.customerId ? updateCustomer(this.editForm) : addCustomer(this.editForm);
req.then(() => {
this.$modal.msgSuccess("保存成功");
// 保存后刷新列表,并保持选中(新增场景会重新选中第一条,或你也可以改为选中新建记录)
this.activeTab = "detail";
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
})
if (this.entityType === "customer") {
this.$refs["editFormRef"].validate(valid => {
if (!valid) return;
this.buttonLoading = true;
const req = this.editForm.customerId ? updateCustomer(this.editForm) : addCustomer(this.editForm);
req.then(() => {
this.$modal.msgSuccess("保存成功");
this.activeTab = "detail";
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
})
return;
}
this.buttonLoading = true;
const req = this.supplierEditForm.supplierId ? updateSupplier(this.supplierEditForm) : addSupplier(this.supplierEditForm);
req.then(() => {
this.$modal.msgSuccess("保存成功");
this.activeTab = "detail";
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
},
/** 重置编辑表单:还原为当前选中客户的详情 */
resetEdit() {
// 说明:如果是新增态(没有 selectedCustomerId重置为一个空表单
if (!this.selectedCustomerId) {
if (this.entityType === "customer") {
if (!this.selectedCustomerId) {
this.handleAdd();
return;
}
this.editForm = { ...(this.selectedCustomer || {}) };
return;
}
if (!this.selectedSupplierId) {
this.handleAdd();
return;
}
this.editForm = { ...(this.selectedCustomer || {}) };
this.supplierEditForm = { ...(this.selectedSupplier || {}) };
},
/** 删除按钮操作 */
handleDelete(row) {
const customerId = row && row.customerId ? row.customerId : undefined;
if (!customerId) return;
this.$modal.confirm('是否确认删除该客户?').then(() => {
if (this.entityType === "customer") {
const customerId = row && row.customerId ? row.customerId : undefined;
if (!customerId) return;
this.$modal.confirm('是否确认删除该客户?').then(() => {
this.loading = true;
return delCustomer(customerId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
return;
}
const supplierId = row && row.supplierId ? row.supplierId : undefined;
if (!supplierId) return;
this.$modal.confirm('是否确认删除该供货商?').then(() => {
this.loading = true;
return delCustomer(customerId);
return delSupplier(supplierId);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
@@ -522,6 +708,7 @@ export default {
},
/** Tab 切换部分Tab在首次进入时加载数据 */
handleTabChange() {
if (this.entityType !== "customer") return;
if (!this.selectedCustomerId) return;
if (this.activeTab === "orders") {
this.loadOrders();
@@ -815,12 +1002,30 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/customer/export', {
...this.queryParams
}, `customer_${new Date().getTime()}.xlsx`)
if (this.entityType === "customer") {
this.download('oa/customer/export', {
...this.queryParams
}, `customer_${new Date().getTime()}.xlsx`)
return;
}
this.download('oa/supplier/export', {
...this.supplierQueryParams
}, `supplier_${new Date().getTime()}.xlsx`)
}
},
computed: {
searchKeyword: {
get() {
return this.entityType === "customer" ? (this.queryParams.name || "") : (this.supplierQueryParams.name || "");
},
set(v) {
if (this.entityType === "customer") {
this.queryParams.name = v;
} else {
this.supplierQueryParams.name = v;
}
}
},
disputeDialogTitle() {
return this.disputeOrderCode ? `订单异议 - ${this.disputeOrderCode}` : "订单异议";
}

View File

@@ -1,5 +1,12 @@
<template>
<div class="app-container">
<el-scrollbar style="margin-bottom: 10px;">
<el-radio-group v-model="deptTab" size="small" @change="handleDeptChange">
<el-radio-button :label="''">全部</el-radio-button>
<el-radio-button v-for="d in deptTabs" :key="d.deptId" :label="String(d.deptId)">{{ d.deptName }}</el-radio-button>
</el-radio-group>
</el-scrollbar>
<el-form :model="queryParams" ref="queryRef" size="small" :inline="true" v-show="showSearch" label-width="60px">
<el-form-item label="员工" prop="employeeName">
<user-select v-model="queryParams.employeeId" placeholder="请选择员工" />
@@ -158,6 +165,7 @@
<script setup name="SalaryRecords">
import { listSalaryRecords, getSalaryRecords, delSalaryRecords, addSalaryRecords, updateSalaryRecords, batchPaySalary } from "@/api/oa/salaryRecords";
import UserSelect from "@/components/UserSelect/index.vue";
import { listDept } from "@/api/system/dept";
import { ElMessageBox } from 'element-plus'
const { proxy } = getCurrentInstance();
@@ -173,6 +181,8 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const deptTab = ref("");
const deptTabs = ref([]);
const data = reactive({
form: {},
@@ -180,6 +190,7 @@ const data = reactive({
pageNum: 1,
pageSize: 10,
employeeId: undefined,
deptId: undefined,
payPeriod: undefined,
},
rules: {
@@ -202,6 +213,46 @@ function getList() {
});
}
function flattenDept(list) {
const res = [];
const stack = Array.isArray(list) ? [...list] : [];
while (stack.length) {
const n = stack.shift();
if (!n) continue;
if (n.deptId != null && n.deptName) {
res.push({ deptId: n.deptId, deptName: n.deptName });
}
const children = n.children;
if (Array.isArray(children) && children.length) {
stack.unshift(...children);
}
}
return res;
}
function loadDeptTabs() {
return listDept({ status: "0" })
.then((res) => {
const rows = res?.data || res?.rows || res || [];
const flat = flattenDept(rows);
const uniq = new Map();
flat.forEach((d) => {
if (!d || d.deptId == null) return;
const id = String(d.deptId);
if (!uniq.has(id)) uniq.set(id, d);
});
deptTabs.value = Array.from(uniq.values());
})
.catch(() => {
deptTabs.value = [];
});
}
function handleDeptChange() {
queryParams.value.deptId = deptTab.value ? Number(deptTab.value) : undefined;
handleQuery();
}
// 取消按钮
function cancel() {
open.value = false;
@@ -322,5 +373,7 @@ function handleExport() {
}, `salaryRecords_${new Date().getTime()}.xlsx`)
}
getList();
loadDeptTabs().finally(() => {
getList();
});
</script>

View File

@@ -4,6 +4,22 @@
<el-form-item label="单号" prop="orderCode">
<el-input v-model="queryParams.orderCode" placeholder="请输入单据编号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="物料" prop="itemName">
<el-input v-model="queryParams.itemName" placeholder="请输入物料名称" clearable />
</el-form-item>
<el-form-item label="供货商" prop="supplierId">
<VendorSelect v-model="queryParams.supplierId" />
</el-form-item>
<el-form-item label="入库时间" prop="timeRange">
<el-date-picker
v-model="queryParams.timeRange"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="开始时间"
end-placeholder="结束时间"
range-separator="~"
/>
</el-form-item>
<el-form-item label="业务类型" prop="bizType">
<el-input v-model="queryParams.bizType" placeholder="请输入业务类型" clearable />
</el-form-item>
@@ -323,6 +339,7 @@
<script>
import RawSelector from '@/components/RawSelector/index.vue'
import VendorSelect from '@/components/VendorSelect/index.vue'
import {
listStockIoOrder,
getStockIoOrderWithDetail,
@@ -334,7 +351,7 @@ import {
export default {
name: 'StockIoOrderIn',
components: { RawSelector },
components: { RawSelector, VendorSelect },
data() {
return {
loading: true,
@@ -350,6 +367,11 @@ export default {
pageNum: 1,
pageSize: 20,
orderCode: undefined,
itemName: undefined,
supplierId: undefined,
timeRange: undefined,
startTime: undefined,
endTime: undefined,
ioType: 'I',
bizType: undefined,
responsibleName: undefined
@@ -427,11 +449,15 @@ export default {
},
handleQuery() {
this.queryParams.pageNum = 1
this.syncTimeRange()
this.getList()
},
resetQuery() {
this.resetForm('queryForm')
this.queryParams.ioType = 'I'
this.queryParams.timeRange = undefined
this.queryParams.startTime = undefined
this.queryParams.endTime = undefined
this.handleQuery()
},
handleSelectionChange(selection) {
@@ -441,14 +467,25 @@ export default {
this.multiple = !selection.length
},
handleExport() {
this.syncTimeRange()
this.download(
'/gear/stockIoOrder/export',
'/gear/stockIoOrder/exportDetail',
{
...this.queryParams
},
`stockIoOrder_in_${new Date().getTime()}.xlsx`
`stockIoOrder_in_detail_${new Date().getTime()}.xlsx`
)
},
syncTimeRange() {
const tr = this.queryParams.timeRange
if (tr && tr.length === 2) {
this.queryParams.startTime = tr[0]
this.queryParams.endTime = tr[1]
} else {
this.queryParams.startTime = undefined
this.queryParams.endTime = undefined
}
},
handleConfirm(row) {
const target = row || (this.rows && this.rows[0])
if (!target || !target.orderId) return

View File

@@ -4,6 +4,22 @@
<el-form-item label="单号" prop="orderCode">
<el-input v-model="queryParams.orderCode" placeholder="请输入单据编号" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="物料" prop="itemName">
<el-input v-model="queryParams.itemName" placeholder="请输入物料名称" clearable />
</el-form-item>
<el-form-item label="供货商" prop="supplierId">
<VendorSelect v-model="queryParams.supplierId" />
</el-form-item>
<el-form-item label="出库时间" prop="timeRange">
<el-date-picker
v-model="queryParams.timeRange"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="开始时间"
end-placeholder="结束时间"
range-separator="~"
/>
</el-form-item>
<el-form-item label="业务类型" prop="bizType">
<el-input v-model="queryParams.bizType" placeholder="请输入业务类型" clearable />
</el-form-item>
@@ -306,6 +322,7 @@
<script>
import RawSelector from '@/components/RawSelector/index.vue'
import VendorSelect from '@/components/VendorSelect/index.vue'
import {
listStockIoOrder,
getStockIoOrderWithDetail,
@@ -316,7 +333,7 @@ import {
export default {
name: 'StockIoOrderOut',
components: { RawSelector },
components: { RawSelector, VendorSelect },
data() {
return {
loading: true,
@@ -331,6 +348,11 @@ export default {
pageNum: 1,
pageSize: 20,
orderCode: undefined,
itemName: undefined,
supplierId: undefined,
timeRange: undefined,
startTime: undefined,
endTime: undefined,
ioType: 'O',
bizType: undefined,
responsibleName: undefined
@@ -408,11 +430,15 @@ export default {
},
handleQuery() {
this.queryParams.pageNum = 1
this.syncTimeRange()
this.getList()
},
resetQuery() {
this.resetForm('queryForm')
this.queryParams.ioType = 'O'
this.queryParams.timeRange = undefined
this.queryParams.startTime = undefined
this.queryParams.endTime = undefined
this.handleQuery()
},
handleSelectionChange(selection) {
@@ -421,14 +447,25 @@ export default {
this.single = selection.length !== 1
},
handleExport() {
this.syncTimeRange()
this.download(
'/gear/stockIoOrder/export',
'/gear/stockIoOrder/exportDetail',
{
...this.queryParams
},
`stockIoOrder_out_${new Date().getTime()}.xlsx`
`stockIoOrder_out_detail_${new Date().getTime()}.xlsx`
)
},
syncTimeRange() {
const tr = this.queryParams.timeRange
if (tr && tr.length === 2) {
this.queryParams.startTime = tr[0]
this.queryParams.endTime = tr[1]
} else {
this.queryParams.startTime = undefined
this.queryParams.endTime = undefined
}
},
resetEdit() {
this.editForm = {
ioType: 'O',