Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
This commit is contained in:
83
docs/klp_purchase_requisition_ddl.sql
Normal file
83
docs/klp_purchase_requisition_ddl.sql
Normal file
@@ -0,0 +1,83 @@
|
||||
-- ========================================
|
||||
-- 电子请购单 — 数据库建表脚本
|
||||
-- 表结构:主表 + 明细表,全部文本字段,不关联任何现有表
|
||||
-- 对应文档:docs/科仑普请购采购单(1).docx
|
||||
-- ========================================
|
||||
|
||||
-- ----------------------------
|
||||
-- 主表:请购及采购单
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `erp_purchase_requisition`;
|
||||
CREATE TABLE `erp_purchase_requisition` (
|
||||
`req_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
|
||||
-- 头部(请购人填写)
|
||||
`req_dept` VARCHAR(100) DEFAULT NULL COMMENT '请购部门',
|
||||
`item_name` VARCHAR(200) DEFAULT NULL COMMENT '品名',
|
||||
`specification` VARCHAR(200) DEFAULT NULL COMMENT '规格',
|
||||
`unit` VARCHAR(20) DEFAULT NULL COMMENT '单位',
|
||||
`quantity` VARCHAR(50) DEFAULT NULL COMMENT '请购量',
|
||||
|
||||
-- 类别与日期
|
||||
`category` VARCHAR(50) DEFAULT NULL COMMENT '类别',
|
||||
`required_date` VARCHAR(50) DEFAULT NULL COMMENT '需求日期',
|
||||
|
||||
-- 说明
|
||||
`purpose_desc` VARCHAR(500) DEFAULT NULL COMMENT '用途说明',
|
||||
`use_dept` VARCHAR(100) DEFAULT NULL COMMENT '使用部门',
|
||||
|
||||
-- 采购处理(采购单位填写)
|
||||
`inspection_condition` VARCHAR(200) DEFAULT NULL COMMENT '品检条件',
|
||||
`trial_days` VARCHAR(50) DEFAULT NULL COMMENT '试用天数',
|
||||
`prev_purchase_record` VARCHAR(500) DEFAULT NULL COMMENT '前期采购记录',
|
||||
`purchase_proposal` VARCHAR(500) DEFAULT NULL COMMENT '采购拟办',
|
||||
`payment_terms` VARCHAR(200) DEFAULT NULL COMMENT '付款条件',
|
||||
`total_amount` VARCHAR(200) DEFAULT NULL COMMENT '采购金额',
|
||||
|
||||
-- 审批签名(8级)
|
||||
`sign_purchase_chairman` VARCHAR(64) DEFAULT NULL COMMENT '董事长(采购单位)',
|
||||
`sign_purchase_manager` VARCHAR(64) DEFAULT NULL COMMENT '部长/厂长(采购单位)',
|
||||
`sign_purchase_director` VARCHAR(64) DEFAULT NULL COMMENT '主任(采购单位)',
|
||||
`sign_purchase_handler` VARCHAR(64) DEFAULT NULL COMMENT '经办(采购单位)',
|
||||
`sign_request_gm` VARCHAR(64) DEFAULT NULL COMMENT '生产总经理(请购单位)',
|
||||
`sign_request_factory_mgr` VARCHAR(64) DEFAULT NULL COMMENT '厂长(请购单位)',
|
||||
`sign_request_director` VARCHAR(64) DEFAULT NULL COMMENT '主任(请购单位)',
|
||||
`sign_request_handler` VARCHAR(64) DEFAULT NULL COMMENT '经办(请购单位)',
|
||||
|
||||
-- 底部
|
||||
`unload_location` VARCHAR(50) DEFAULT NULL COMMENT '指定卸货位',
|
||||
`unload_other` VARCHAR(200) DEFAULT NULL COMMENT '卸货其他位置',
|
||||
|
||||
-- 状态与控制
|
||||
`form_status` VARCHAR(20) NOT NULL DEFAULT '0' COMMENT '状态:0=请购草稿 1=请购审批中 2=请购已通过 3=采购处理中 4=已完成 5=已驳回',
|
||||
`del_flag` VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '删除标志 0=存在 2=删除',
|
||||
`create_by` VARCHAR(64) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` VARCHAR(64) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
|
||||
`remark` VARCHAR(500) DEFAULT NULL COMMENT '备注',
|
||||
|
||||
PRIMARY KEY (`req_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='请购及采购单(科仑普)';
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- 明细表:请购及采购单明细(8行)
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `erp_purchase_requisition_item`;
|
||||
CREATE TABLE `erp_purchase_requisition_item` (
|
||||
`item_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '明细ID',
|
||||
`req_id` BIGINT NOT NULL COMMENT '关联请购单ID → erp_purchase_requisition.req_id',
|
||||
`seq` VARCHAR(10) NOT NULL COMMENT '项次',
|
||||
`item_name` VARCHAR(200) DEFAULT NULL COMMENT '品名',
|
||||
`specification` VARCHAR(200) DEFAULT NULL COMMENT '规格',
|
||||
`unit` VARCHAR(20) DEFAULT NULL COMMENT '单位',
|
||||
`quantity` VARCHAR(50) DEFAULT NULL COMMENT '请购量',
|
||||
`del_flag` VARCHAR(2) NOT NULL DEFAULT '0' COMMENT '删除标志',
|
||||
`create_by` VARCHAR(64) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` VARCHAR(64) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` DATETIME DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`item_id`),
|
||||
KEY `idx_req_id` (`req_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='请购及采购单明细';
|
||||
4645
docs/rolling_mill_project_management(1).html
Normal file
4645
docs/rolling_mill_project_management(1).html
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,82 @@
|
||||
package com.klp.erp.controller;
|
||||
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.erp.domain.bo.ErpPurchaseRequisitionBo;
|
||||
import com.klp.erp.domain.vo.ErpPurchaseRequisitionVo;
|
||||
import com.klp.erp.service.IErpPurchaseRequisitionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请购及采购单
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/erp/purchaseRequisition")
|
||||
public class ErpPurchaseRequisitionController extends BaseController {
|
||||
|
||||
private final IErpPurchaseRequisitionService iErpPurchaseRequisitionService;
|
||||
|
||||
/** 查询请购单列表 */
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<ErpPurchaseRequisitionVo> list(ErpPurchaseRequisitionBo bo, PageQuery pageQuery) {
|
||||
return iErpPurchaseRequisitionService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/** 导出请购单列表 */
|
||||
@Log(title = "请购及采购单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(ErpPurchaseRequisitionBo bo, HttpServletResponse response) {
|
||||
List<ErpPurchaseRequisitionVo> list = iErpPurchaseRequisitionService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "请购及采购单", ErpPurchaseRequisitionVo.class, response);
|
||||
}
|
||||
|
||||
/** 获取请购单详细信息(含明细) */
|
||||
@GetMapping("/{reqId}")
|
||||
public R<ErpPurchaseRequisitionVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long reqId) {
|
||||
return R.ok(iErpPurchaseRequisitionService.queryById(reqId));
|
||||
}
|
||||
|
||||
/** 新增请购单 */
|
||||
@Log(title = "请购及采购单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody ErpPurchaseRequisitionBo bo) {
|
||||
return toAjax(iErpPurchaseRequisitionService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/** 修改请购单 */
|
||||
@Log(title = "请购及采购单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody ErpPurchaseRequisitionBo bo) {
|
||||
return toAjax(iErpPurchaseRequisitionService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/** 删除请购单 */
|
||||
@Log(title = "请购及采购单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{reqIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] reqIds) {
|
||||
return toAjax(iErpPurchaseRequisitionService.deleteWithValidByIds(Arrays.asList(reqIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.klp.erp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 请购及采购单对象 erp_purchase_requisition
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("erp_purchase_requisition")
|
||||
public class ErpPurchaseRequisition extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "req_id")
|
||||
private Long reqId;
|
||||
|
||||
/** 请购部门 */
|
||||
private String reqDept;
|
||||
|
||||
/** 品名 */
|
||||
private String itemName;
|
||||
|
||||
/** 规格 */
|
||||
private String specification;
|
||||
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 请购量 */
|
||||
private String quantity;
|
||||
|
||||
/** 类别 */
|
||||
private String category;
|
||||
|
||||
/** 需求日期 */
|
||||
private String requiredDate;
|
||||
|
||||
/** 用途说明 */
|
||||
private String purposeDesc;
|
||||
|
||||
/** 使用部门 */
|
||||
private String useDept;
|
||||
|
||||
/** 品检条件 */
|
||||
private String inspectionCondition;
|
||||
|
||||
/** 试用天数 */
|
||||
private String trialDays;
|
||||
|
||||
/** 前期采购记录 */
|
||||
private String prevPurchaseRecord;
|
||||
|
||||
/** 采购拟办 */
|
||||
private String purchaseProposal;
|
||||
|
||||
/** 付款条件 */
|
||||
private String paymentTerms;
|
||||
|
||||
/** 采购金额 */
|
||||
private String totalAmount;
|
||||
|
||||
/** 董事长(采购单位) */
|
||||
private String signPurchaseChairman;
|
||||
|
||||
/** 部长/厂长(采购单位) */
|
||||
private String signPurchaseManager;
|
||||
|
||||
/** 主任(采购单位) */
|
||||
private String signPurchaseDirector;
|
||||
|
||||
/** 经办(采购单位) */
|
||||
private String signPurchaseHandler;
|
||||
|
||||
/** 生产总经理(请购单位) */
|
||||
private String signRequestGm;
|
||||
|
||||
/** 厂长(请购单位) */
|
||||
private String signRequestFactoryMgr;
|
||||
|
||||
/** 主任(请购单位) */
|
||||
private String signRequestDirector;
|
||||
|
||||
/** 经办(请购单位) */
|
||||
private String signRequestHandler;
|
||||
|
||||
/** 指定卸货位 */
|
||||
private String unloadLocation;
|
||||
|
||||
/** 卸货其他位置 */
|
||||
private String unloadOther;
|
||||
|
||||
/** 状态 */
|
||||
private String formStatus;
|
||||
|
||||
/** 删除标志 */
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.klp.erp.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 请购及采购单明细对象 erp_purchase_requisition_item
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("erp_purchase_requisition_item")
|
||||
public class ErpPurchaseRequisitionItem extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 明细ID */
|
||||
@TableId(value = "item_id")
|
||||
private Long itemId;
|
||||
|
||||
/** 关联请购单ID */
|
||||
private Long reqId;
|
||||
|
||||
/** 项次 */
|
||||
private String seq;
|
||||
|
||||
/** 品名 */
|
||||
private String itemName;
|
||||
|
||||
/** 规格 */
|
||||
private String specification;
|
||||
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 请购量 */
|
||||
private String quantity;
|
||||
|
||||
/** 删除标志 */
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.klp.erp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请购及采购单业务对象 erp_purchase_requisition
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ErpPurchaseRequisitionBo extends BaseEntity {
|
||||
|
||||
/** 主键 */
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long reqId;
|
||||
|
||||
/** 请购部门 */
|
||||
private String reqDept;
|
||||
|
||||
/** 品名 */
|
||||
private String itemName;
|
||||
|
||||
/** 规格 */
|
||||
private String specification;
|
||||
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 请购量 */
|
||||
private String quantity;
|
||||
|
||||
/** 类别 */
|
||||
private String category;
|
||||
|
||||
/** 需求日期 */
|
||||
private String requiredDate;
|
||||
|
||||
/** 用途说明 */
|
||||
private String purposeDesc;
|
||||
|
||||
/** 使用部门 */
|
||||
private String useDept;
|
||||
|
||||
/** 品检条件 */
|
||||
private String inspectionCondition;
|
||||
|
||||
/** 试用天数 */
|
||||
private String trialDays;
|
||||
|
||||
/** 前期采购记录 */
|
||||
private String prevPurchaseRecord;
|
||||
|
||||
/** 采购拟办 */
|
||||
private String purchaseProposal;
|
||||
|
||||
/** 付款条件 */
|
||||
private String paymentTerms;
|
||||
|
||||
/** 采购金额 */
|
||||
private String totalAmount;
|
||||
|
||||
/** 董事长(采购单位) */
|
||||
private String signPurchaseChairman;
|
||||
|
||||
/** 部长/厂长(采购单位) */
|
||||
private String signPurchaseManager;
|
||||
|
||||
/** 主任(采购单位) */
|
||||
private String signPurchaseDirector;
|
||||
|
||||
/** 经办(采购单位) */
|
||||
private String signPurchaseHandler;
|
||||
|
||||
/** 生产总经理(请购单位) */
|
||||
private String signRequestGm;
|
||||
|
||||
/** 厂长(请购单位) */
|
||||
private String signRequestFactoryMgr;
|
||||
|
||||
/** 主任(请购单位) */
|
||||
private String signRequestDirector;
|
||||
|
||||
/** 经办(请购单位) */
|
||||
private String signRequestHandler;
|
||||
|
||||
/** 指定卸货位 */
|
||||
private String unloadLocation;
|
||||
|
||||
/** 卸货其他位置 */
|
||||
private String unloadOther;
|
||||
|
||||
/** 状态 */
|
||||
private String formStatus;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 明细行 */
|
||||
private List<ErpPurchaseRequisitionItemBo> items;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.klp.erp.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 请购及采购单明细业务对象 erp_purchase_requisition_item
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ErpPurchaseRequisitionItemBo extends BaseEntity {
|
||||
|
||||
/** 明细ID */
|
||||
private Long itemId;
|
||||
|
||||
/** 关联请购单ID */
|
||||
private Long reqId;
|
||||
|
||||
/** 项次 */
|
||||
private String seq;
|
||||
|
||||
/** 品名 */
|
||||
private String itemName;
|
||||
|
||||
/** 规格 */
|
||||
private String specification;
|
||||
|
||||
/** 单位 */
|
||||
private String unit;
|
||||
|
||||
/** 请购量 */
|
||||
private String quantity;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.klp.erp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 请购及采购单明细视图对象 erp_purchase_requisition_item
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ErpPurchaseRequisitionItemVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelProperty(value = "明细ID")
|
||||
private Long itemId;
|
||||
|
||||
private Long reqId;
|
||||
|
||||
@ExcelProperty(value = "项次")
|
||||
private String seq;
|
||||
|
||||
@ExcelProperty(value = "品名")
|
||||
private String itemName;
|
||||
|
||||
@ExcelProperty(value = "规格")
|
||||
private String specification;
|
||||
|
||||
@ExcelProperty(value = "单位")
|
||||
private String unit;
|
||||
|
||||
@ExcelProperty(value = "请购量")
|
||||
private String quantity;
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.klp.erp.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请购及采购单视图对象 erp_purchase_requisition
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class ErpPurchaseRequisitionVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long reqId;
|
||||
|
||||
@ExcelProperty(value = "请购部门")
|
||||
private String reqDept;
|
||||
|
||||
@ExcelProperty(value = "品名")
|
||||
private String itemName;
|
||||
|
||||
@ExcelProperty(value = "规格")
|
||||
private String specification;
|
||||
|
||||
@ExcelProperty(value = "单位")
|
||||
private String unit;
|
||||
|
||||
@ExcelProperty(value = "请购量")
|
||||
private String quantity;
|
||||
|
||||
@ExcelProperty(value = "类别")
|
||||
private String category;
|
||||
|
||||
@ExcelProperty(value = "需求日期")
|
||||
private String requiredDate;
|
||||
|
||||
@ExcelProperty(value = "用途说明")
|
||||
private String purposeDesc;
|
||||
|
||||
@ExcelProperty(value = "使用部门")
|
||||
private String useDept;
|
||||
|
||||
@ExcelProperty(value = "品检条件")
|
||||
private String inspectionCondition;
|
||||
|
||||
@ExcelProperty(value = "试用天数")
|
||||
private String trialDays;
|
||||
|
||||
@ExcelProperty(value = "前期采购记录")
|
||||
private String prevPurchaseRecord;
|
||||
|
||||
@ExcelProperty(value = "采购拟办")
|
||||
private String purchaseProposal;
|
||||
|
||||
@ExcelProperty(value = "付款条件")
|
||||
private String paymentTerms;
|
||||
|
||||
@ExcelProperty(value = "采购金额")
|
||||
private String totalAmount;
|
||||
|
||||
@ExcelProperty(value = "董事长(采购单位)")
|
||||
private String signPurchaseChairman;
|
||||
|
||||
@ExcelProperty(value = "部长/厂长(采购单位)")
|
||||
private String signPurchaseManager;
|
||||
|
||||
@ExcelProperty(value = "主任(采购单位)")
|
||||
private String signPurchaseDirector;
|
||||
|
||||
@ExcelProperty(value = "经办(采购单位)")
|
||||
private String signPurchaseHandler;
|
||||
|
||||
@ExcelProperty(value = "生产总经理(请购单位)")
|
||||
private String signRequestGm;
|
||||
|
||||
@ExcelProperty(value = "厂长(请购单位)")
|
||||
private String signRequestFactoryMgr;
|
||||
|
||||
@ExcelProperty(value = "主任(请购单位)")
|
||||
private String signRequestDirector;
|
||||
|
||||
@ExcelProperty(value = "经办(请购单位)")
|
||||
private String signRequestHandler;
|
||||
|
||||
@ExcelProperty(value = "指定卸货位")
|
||||
private String unloadLocation;
|
||||
|
||||
@ExcelProperty(value = "卸货其他位置")
|
||||
private String unloadOther;
|
||||
|
||||
@ExcelProperty(value = "状态")
|
||||
private String formStatus;
|
||||
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 明细行 */
|
||||
private List<ErpPurchaseRequisitionItemVo> items;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.erp.mapper;
|
||||
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
import com.klp.erp.domain.ErpPurchaseRequisitionItem;
|
||||
import com.klp.erp.domain.vo.ErpPurchaseRequisitionItemVo;
|
||||
|
||||
/**
|
||||
* 请购及采购单明细Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
public interface ErpPurchaseRequisitionItemMapper extends BaseMapperPlus<ErpPurchaseRequisitionItemMapper, ErpPurchaseRequisitionItem, ErpPurchaseRequisitionItemVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.erp.mapper;
|
||||
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
import com.klp.erp.domain.ErpPurchaseRequisition;
|
||||
import com.klp.erp.domain.vo.ErpPurchaseRequisitionVo;
|
||||
|
||||
/**
|
||||
* 请购及采购单Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
public interface ErpPurchaseRequisitionMapper extends BaseMapperPlus<ErpPurchaseRequisitionMapper, ErpPurchaseRequisition, ErpPurchaseRequisitionVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.klp.erp.service;
|
||||
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.erp.domain.bo.ErpPurchaseRequisitionBo;
|
||||
import com.klp.erp.domain.vo.ErpPurchaseRequisitionVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请购及采购单Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
public interface IErpPurchaseRequisitionService {
|
||||
|
||||
/** 查询请购单详情(含明细) */
|
||||
ErpPurchaseRequisitionVo queryById(Long reqId);
|
||||
|
||||
/** 分页查询请购单 */
|
||||
TableDataInfo<ErpPurchaseRequisitionVo> queryPageList(ErpPurchaseRequisitionBo bo, PageQuery pageQuery);
|
||||
|
||||
/** 查询请购单列表 */
|
||||
List<ErpPurchaseRequisitionVo> queryList(ErpPurchaseRequisitionBo bo);
|
||||
|
||||
/** 新增请购单(含明细) */
|
||||
Boolean insertByBo(ErpPurchaseRequisitionBo bo);
|
||||
|
||||
/** 修改请购单(含明细) */
|
||||
Boolean updateByBo(ErpPurchaseRequisitionBo bo);
|
||||
|
||||
/** 校验并批量删除请购单 */
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.klp.erp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.erp.domain.ErpPurchaseRequisition;
|
||||
import com.klp.erp.domain.ErpPurchaseRequisitionItem;
|
||||
import com.klp.erp.domain.bo.ErpPurchaseRequisitionBo;
|
||||
import com.klp.erp.domain.bo.ErpPurchaseRequisitionItemBo;
|
||||
import com.klp.erp.domain.vo.ErpPurchaseRequisitionVo;
|
||||
import com.klp.erp.mapper.ErpPurchaseRequisitionItemMapper;
|
||||
import com.klp.erp.mapper.ErpPurchaseRequisitionMapper;
|
||||
import com.klp.erp.service.IErpPurchaseRequisitionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请购及采购单Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-06-29
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ErpPurchaseRequisitionServiceImpl implements IErpPurchaseRequisitionService {
|
||||
|
||||
private final ErpPurchaseRequisitionMapper baseMapper;
|
||||
private final ErpPurchaseRequisitionItemMapper itemMapper;
|
||||
|
||||
@Override
|
||||
public ErpPurchaseRequisitionVo queryById(Long reqId) {
|
||||
ErpPurchaseRequisitionVo vo = baseMapper.selectVoById(reqId);
|
||||
if (vo == null) {
|
||||
return null;
|
||||
}
|
||||
// 明细
|
||||
vo.setItems(itemMapper.selectVoList(Wrappers.lambdaQuery(ErpPurchaseRequisitionItem.class)
|
||||
.eq(ErpPurchaseRequisitionItem::getReqId, reqId)));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ErpPurchaseRequisitionVo> queryPageList(ErpPurchaseRequisitionBo bo, PageQuery pageQuery) {
|
||||
Page<ErpPurchaseRequisitionVo> result = baseMapper.selectVoPage(pageQuery.build(), buildQueryWrapper(bo));
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ErpPurchaseRequisitionVo> queryList(ErpPurchaseRequisitionBo bo) {
|
||||
return baseMapper.selectVoList(buildQueryWrapper(bo));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<ErpPurchaseRequisition> buildQueryWrapper(ErpPurchaseRequisitionBo bo) {
|
||||
LambdaQueryWrapper<ErpPurchaseRequisition> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getReqDept()), ErpPurchaseRequisition::getReqDept, bo.getReqDept());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getItemName()), ErpPurchaseRequisition::getItemName, bo.getItemName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFormStatus()), ErpPurchaseRequisition::getFormStatus, bo.getFormStatus());
|
||||
lqw.orderByDesc(ErpPurchaseRequisition::getReqId);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBo(ErpPurchaseRequisitionBo bo) {
|
||||
ErpPurchaseRequisition add = BeanUtil.toBean(bo, ErpPurchaseRequisition.class);
|
||||
if (StringUtils.isBlank(add.getFormStatus())) {
|
||||
add.setFormStatus("0");
|
||||
}
|
||||
add.setReqId(null);
|
||||
if (baseMapper.insert(add) <= 0) {
|
||||
return false;
|
||||
}
|
||||
bo.setReqId(add.getReqId());
|
||||
saveItems(add.getReqId(), bo.getItems());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(ErpPurchaseRequisitionBo bo) {
|
||||
ErpPurchaseRequisition update = baseMapper.selectById(bo.getReqId());
|
||||
if (update == null) {
|
||||
return false;
|
||||
}
|
||||
BeanUtil.copyProperties(bo, update, "reqId", "createBy", "createTime");
|
||||
baseMapper.updateById(update);
|
||||
// 覆盖式重写明细
|
||||
itemMapper.delete(Wrappers.lambdaQuery(ErpPurchaseRequisitionItem.class)
|
||||
.eq(ErpPurchaseRequisitionItem::getReqId, bo.getReqId()));
|
||||
saveItems(bo.getReqId(), bo.getItems());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void saveItems(Long reqId, List<ErpPurchaseRequisitionItemBo> items) {
|
||||
if (items == null || items.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (ErpPurchaseRequisitionItemBo itemBo : items) {
|
||||
ErpPurchaseRequisitionItem item = BeanUtil.toBean(itemBo, ErpPurchaseRequisitionItem.class);
|
||||
item.setItemId(null);
|
||||
item.setReqId(reqId);
|
||||
itemMapper.insert(item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
for (Long reqId : ids) {
|
||||
itemMapper.delete(Wrappers.lambdaQuery(ErpPurchaseRequisitionItem.class)
|
||||
.eq(ErpPurchaseRequisitionItem::getReqId, reqId));
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
}
|
||||
54
klp-ui/src/api/erp/purchaseRequisition.js
Normal file
54
klp-ui/src/api/erp/purchaseRequisition.js
Normal file
@@ -0,0 +1,54 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询请购单列表
|
||||
export function listPurchaseRequisition(query) {
|
||||
return request({
|
||||
url: '/erp/purchaseRequisition/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询请购单详细(含明细)
|
||||
export function getPurchaseRequisition(reqId) {
|
||||
return request({
|
||||
url: '/erp/purchaseRequisition/' + reqId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增请购单
|
||||
export function addPurchaseRequisition(data) {
|
||||
return request({
|
||||
url: '/erp/purchaseRequisition',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改请购单
|
||||
export function updatePurchaseRequisition(data) {
|
||||
return request({
|
||||
url: '/erp/purchaseRequisition',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除请购单
|
||||
export function delPurchaseRequisition(reqIds) {
|
||||
return request({
|
||||
url: '/erp/purchaseRequisition/' + reqIds,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 导出请购单
|
||||
export function exportPurchaseRequisition(query) {
|
||||
return request({
|
||||
url: '/erp/purchaseRequisition/export',
|
||||
method: 'post',
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
862
klp-ui/src/views/erp/purchaseRequisition/index.vue
Normal file
862
klp-ui/src/views/erp/purchaseRequisition/index.vue
Normal file
@@ -0,0 +1,862 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||
<el-form-item label="请购部门" prop="reqDept">
|
||||
<el-input v-model="queryParams.reqDept" placeholder="请购部门" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="品名" prop="itemName">
|
||||
<el-input v-model="queryParams.itemName" placeholder="品名" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="formStatus">
|
||||
<el-select v-model="queryParams.formStatus" placeholder="状态" clearable style="width:130px">
|
||||
<el-option label="请购草稿" value="0" />
|
||||
<el-option label="请购审批中" value="1" />
|
||||
<el-option label="请购已通过" value="2" />
|
||||
<el-option label="采购处理中" value="3" />
|
||||
<el-option label="已完成" value="4" />
|
||||
<el-option label="已驳回" value="5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['erp:purchaseRequisition:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['erp:purchaseRequisition:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['erp:purchaseRequisition:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['erp:purchaseRequisition:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<KLPTable v-loading="loading" :data="reqList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="reqId" width="70" />
|
||||
<el-table-column label="请购部门" align="center" prop="reqDept" width="120" />
|
||||
<el-table-column label="品名" align="center" prop="itemName" width="160" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="规格" align="center" prop="specification" width="140" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="请购量" align="center" prop="quantity" width="90" />
|
||||
<el-table-column label="类别" align="center" prop="category" width="90" />
|
||||
<el-table-column label="需求日期" align="center" prop="requiredDate" width="110" />
|
||||
<el-table-column label="状态" align="center" prop="formStatus" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="statusType(scope.row.formStatus)" size="mini">{{ statusText(scope.row.formStatus) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)" v-hasPermi="['erp:purchaseRequisition:query']">查看</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['erp:purchaseRequisition:edit']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['erp:purchaseRequisition:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</KLPTable>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 新增/修改 弹窗 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body class="pr-dialog" :close-on-click-modal="false">
|
||||
<el-form :model="form" :rules="rules" ref="form" label-width="100px" size="small">
|
||||
<div class="pr-section">请购信息</div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="请购部门" prop="reqDept">
|
||||
<el-input v-model="form.reqDept" placeholder="请购部门" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="品名" prop="itemName">
|
||||
<el-input v-model="form.itemName" placeholder="品名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="规格" prop="specification">
|
||||
<el-input v-model="form.specification" placeholder="规格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="单位" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="请购量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请购量" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="类别" prop="category">
|
||||
<el-input v-model="form.category" placeholder="类别" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="需求日期" prop="requiredDate">
|
||||
<el-input v-model="form.requiredDate" placeholder="需求日期" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="使用部门" prop="useDept">
|
||||
<el-input v-model="form.useDept" placeholder="使用部门" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="用途说明" prop="purposeDesc">
|
||||
<el-input v-model="form.purposeDesc" type="textarea" :rows="2" placeholder="用途说明" />
|
||||
</el-form-item>
|
||||
|
||||
<div class="pr-section">采购处理</div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="品检条件" prop="inspectionCondition">
|
||||
<el-input v-model="form.inspectionCondition" placeholder="品检条件" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="试用天数" prop="trialDays">
|
||||
<el-input v-model="form.trialDays" placeholder="试用天数" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="付款条件" prop="paymentTerms">
|
||||
<el-input v-model="form.paymentTerms" placeholder="付款条件" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="前期采购记录" prop="prevPurchaseRecord">
|
||||
<el-input v-model="form.prevPurchaseRecord" placeholder="前期采购记录" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="采购金额" prop="totalAmount">
|
||||
<el-input v-model="form.totalAmount" placeholder="采购金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="采购拟办" prop="purchaseProposal">
|
||||
<el-input v-model="form.purchaseProposal" type="textarea" :rows="2" placeholder="采购拟办" />
|
||||
</el-form-item>
|
||||
|
||||
<div class="pr-section">
|
||||
请购明细
|
||||
<el-button type="primary" plain size="mini" icon="el-icon-plus" @click="addItem">加行</el-button>
|
||||
<span class="pr-section-hint" v-if="form.items && form.items.length">共 {{ form.items.length }} 项</span>
|
||||
</div>
|
||||
<el-table :data="form.items" border size="mini" max-height="280" style="margin-bottom:14px">
|
||||
<el-table-column label="项次" width="60" align="center">
|
||||
<template slot-scope="s">{{ s.$index + 1 }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品名" min-width="130">
|
||||
<template slot-scope="s"><el-input v-model="s.row.itemName" size="mini" placeholder="品名" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" min-width="130">
|
||||
<template slot-scope="s"><el-input v-model="s.row.specification" size="mini" placeholder="规格" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="80">
|
||||
<template slot-scope="s"><el-input v-model="s.row.unit" size="mini" placeholder="单位" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="请购量" width="100">
|
||||
<template slot-scope="s"><el-input v-model="s.row.quantity" size="mini" placeholder="请购量" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="64" align="center" fixed="right">
|
||||
<template slot-scope="s">
|
||||
<i class="el-icon-delete pr-del" @click="removeItem(s.$index)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template slot="empty"><span>点「加行」添加明细</span></template>
|
||||
</el-table>
|
||||
|
||||
<div class="pr-section">审批签名</div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="经办(请购)" prop="signRequestHandler">
|
||||
<el-input v-model="form.signRequestHandler" placeholder="经办" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="主任(请购)" prop="signRequestDirector">
|
||||
<el-input v-model="form.signRequestDirector" placeholder="主任" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="厂长(请购)" prop="signRequestFactoryMgr">
|
||||
<el-input v-model="form.signRequestFactoryMgr" placeholder="厂长" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="生产总经理" prop="signRequestGm">
|
||||
<el-input v-model="form.signRequestGm" placeholder="生产总经理" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="经办(采购)" prop="signPurchaseHandler">
|
||||
<el-input v-model="form.signPurchaseHandler" placeholder="经办" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="主任(采购)" prop="signPurchaseDirector">
|
||||
<el-input v-model="form.signPurchaseDirector" placeholder="主任" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="部长/厂长(采购)" prop="signPurchaseManager">
|
||||
<el-input v-model="form.signPurchaseManager" placeholder="部长/厂长" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="董事长(采购)" prop="signPurchaseChairman">
|
||||
<el-input v-model="form.signPurchaseChairman" placeholder="董事长" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="指定卸货位" prop="unloadLocation">
|
||||
<el-input v-model="form.unloadLocation" placeholder="指定卸货位" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="卸货其他位置" prop="unloadOther">
|
||||
<el-input v-model="form.unloadOther" placeholder="卸货其他位置" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="formStatus">
|
||||
<el-select v-model="form.formStatus" placeholder="状态" style="width:100%">
|
||||
<el-option label="请购草稿" value="0" />
|
||||
<el-option label="请购审批中" value="1" />
|
||||
<el-option label="请购已通过" value="2" />
|
||||
<el-option label="采购处理中" value="3" />
|
||||
<el-option label="已完成" value="4" />
|
||||
<el-option label="已驳回" value="5" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="2" placeholder="备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" :loading="buttonLoading" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 查看弹窗 -->
|
||||
<el-dialog title="请购单详情" :visible.sync="viewOpen" width="700px" append-to-body class="pr-dialog">
|
||||
<div class="pr-view">
|
||||
<div class="pr-view-section">请购信息</div>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="8"><label>请购部门</label><span>{{ viewForm.reqDept || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>品名</label><span>{{ viewForm.itemName || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>规格</label><span>{{ viewForm.specification || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="8"><label>单位</label><span>{{ viewForm.unit || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>请购量</label><span>{{ viewForm.quantity || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>类别</label><span>{{ viewForm.category || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="12"><label>需求日期</label><span>{{ viewForm.requiredDate || '—' }}</span></el-col>
|
||||
<el-col :span="12"><label>使用部门</label><span>{{ viewForm.useDept || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row class="pr-view-row">
|
||||
<el-col><label>用途说明</label><span>{{ viewForm.purposeDesc || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
|
||||
<div class="pr-view-section">采购处理</div>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="8"><label>品检条件</label><span>{{ viewForm.inspectionCondition || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>试用天数</label><span>{{ viewForm.trialDays || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>付款条件</label><span>{{ viewForm.paymentTerms || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="12"><label>前期采购记录</label><span>{{ viewForm.prevPurchaseRecord || '—' }}</span></el-col>
|
||||
<el-col :span="12"><label>采购金额</label><span>{{ viewForm.totalAmount || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row class="pr-view-row">
|
||||
<el-col><label>采购拟办</label><span>{{ viewForm.purchaseProposal || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
|
||||
<div class="pr-view-section">请购明细</div>
|
||||
<el-table :data="viewForm.items || []" border size="mini" max-height="260" style="margin-bottom:14px">
|
||||
<el-table-column label="项次" width="60" align="center">
|
||||
<template slot-scope="s">{{ s.$index + 1 }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="品名" prop="itemName" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column label="规格" prop="specification" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column label="单位" prop="unit" width="80" align="center" />
|
||||
<el-table-column label="请购量" prop="quantity" width="100" align="right" />
|
||||
<template slot="empty"><span>无明细</span></template>
|
||||
</el-table>
|
||||
|
||||
<div class="pr-view-section">审批签名</div>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="8"><label>经办(请购)</label><span>{{ viewForm.signRequestHandler || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>主任(请购)</label><span>{{ viewForm.signRequestDirector || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>厂长(请购)</label><span>{{ viewForm.signRequestFactoryMgr || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="8"><label>生产总经理</label><span>{{ viewForm.signRequestGm || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>经办(采购)</label><span>{{ viewForm.signPurchaseHandler || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>主任(采购)</label><span>{{ viewForm.signPurchaseDirector || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="8"><label>部长/厂长(采购)</label><span>{{ viewForm.signPurchaseManager || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>董事长(采购)</label><span>{{ viewForm.signPurchaseChairman || '—' }}</span></el-col>
|
||||
<el-col :span="8"><label>指定卸货位</label><span>{{ viewForm.unloadLocation || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="16" class="pr-view-row">
|
||||
<el-col :span="12"><label>卸货其他位置</label><span>{{ viewForm.unloadOther || '—' }}</span></el-col>
|
||||
<el-col :span="12"><label>状态</label><span>{{ statusText(viewForm.formStatus) }}</span></el-col>
|
||||
</el-row>
|
||||
<el-row class="pr-view-row">
|
||||
<el-col><label>备注</label><span>{{ viewForm.remark || '—' }}</span></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="viewOpen = false">关 闭</el-button>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" plain icon="el-icon-download" :loading="printing" @click="exportPdf">导出PDF</el-button>
|
||||
<el-button @click="viewOpen = false">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- A4 打印模板(屏幕外渲染,供 html2canvas 截图) -->
|
||||
<div class="pr-print-wrap" v-show="printing">
|
||||
<div class="pr-print" ref="printTemplate">
|
||||
<h1 class="pp-title">科仑普重工有限公司</h1>
|
||||
<h2 class="pp-subtitle">请 购 及 采 购 单</h2>
|
||||
|
||||
<!-- 表1:基本信息 -->
|
||||
<table class="pp-tb">
|
||||
<tr>
|
||||
<td class="pp-lbl" style="width:9%">请购部门</td>
|
||||
<td class="pp-val" style="width:12%">{{ printData.reqDept || '' }}</td>
|
||||
<td class="pp-lbl" style="width:6%">品 名</td>
|
||||
<td class="pp-val" style="width:15%">{{ printData.itemName || '' }}</td>
|
||||
<td class="pp-lbl" style="width:6%">规 格</td>
|
||||
<td class="pp-val" style="width:12%">{{ printData.specification || '' }}</td>
|
||||
<td class="pp-lbl" style="width:6%">单位</td>
|
||||
<td class="pp-val" style="width:8%">{{ printData.unit || '' }}</td>
|
||||
<td class="pp-lbl" style="width:8%">请购量</td>
|
||||
<td class="pp-val" style="width:10%">{{ printData.quantity || '' }}</td>
|
||||
<td class="pp-lbl" style="width:6%">用途</td>
|
||||
<td class="pp-val" style="width:8%">{{ printData.category || '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pp-lbl">类 别</td>
|
||||
<td colspan="11" class="pp-val" style="text-align:left">
|
||||
<span :class="ppCheck(printData.category === '原料物料')">□</span>原料物料
|
||||
<span :class="ppCheck(printData.category === '设备增添')">□</span>设备增添
|
||||
<span :class="ppCheck(printData.category === '工程劳务')">□</span>工程劳务
|
||||
<span :class="ppCheck(printData.category === '其它用途')">□</span>其它用途
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pp-lbl">需求日期</td>
|
||||
<td class="pp-val">{{ printData.requiredDate || '' }}</td>
|
||||
<td class="pp-lbl" colspan="1">用途说明</td>
|
||||
<td class="pp-val" colspan="5">{{ printData.purposeDesc || '' }}</td>
|
||||
<td class="pp-lbl">使用部门</td>
|
||||
<td class="pp-val" colspan="3">{{ printData.useDept || '' }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 表2:明细(8行分两栏) -->
|
||||
<div class="pp-sec">明细</div>
|
||||
<table class="pp-tb pp-it">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:5%">项次</th>
|
||||
<th style="width:15%">品名</th>
|
||||
<th style="width:15%">规格</th>
|
||||
<th style="width:8%">单位</th>
|
||||
<th style="width:10%">请购量</th>
|
||||
<th style="width:5%">项次</th>
|
||||
<th style="width:15%">品名</th>
|
||||
<th style="width:15%">规格</th>
|
||||
<th style="width:8%">单位</th>
|
||||
<th style="width:10%">请购量</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="idx in 4" :key="idx">
|
||||
<td style="text-align:center">{{ idx }}</td>
|
||||
<td>{{ printData.items && printData.items[idx-1] ? (printData.items[idx-1].itemName || '') : '' }}</td>
|
||||
<td>{{ printData.items && printData.items[idx-1] ? (printData.items[idx-1].specification || '') : '' }}</td>
|
||||
<td style="text-align:center">{{ printData.items && printData.items[idx-1] ? (printData.items[idx-1].unit || '') : '' }}</td>
|
||||
<td style="text-align:right;padding-right:8px">{{ printData.items && printData.items[idx-1] ? (printData.items[idx-1].quantity || '') : '' }}</td>
|
||||
<td style="text-align:center">{{ idx + 4 }}</td>
|
||||
<td>{{ printData.items && printData.items[idx+3] ? (printData.items[idx+3].itemName || '') : '' }}</td>
|
||||
<td>{{ printData.items && printData.items[idx+3] ? (printData.items[idx+3].specification || '') : '' }}</td>
|
||||
<td style="text-align:center">{{ printData.items && printData.items[idx+3] ? (printData.items[idx+3].unit || '') : '' }}</td>
|
||||
<td style="text-align:right;padding-right:8px">{{ printData.items && printData.items[idx+3] ? (printData.items[idx+3].quantity || '') : '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- 表3:采购处理 -->
|
||||
<table class="pp-tb">
|
||||
<tr>
|
||||
<td class="pp-lbl" style="width:10%">品检条件</td>
|
||||
<td colspan="5" class="pp-val" style="text-align:left;font-size:9pt">
|
||||
<span :class="ppCheck(printData.inspectionCondition && printData.inspectionCondition.includes('一般'))">□</span>1.一般规格/目视检验
|
||||
<span :class="ppCheck(printData.inspectionCondition && printData.inspectionCondition.includes('品保'))">□</span>2.品保检验品
|
||||
<span :class="ppCheck(printData.inspectionCondition && printData.inspectionCondition.includes('工程'))">□</span>3.工程、劳务/特殊规格品
|
||||
<span :class="ppCheck(printData.inspectionCondition && printData.inspectionCondition.includes('试用'))">□</span>4.试用
|
||||
{{ printData.trialDays || '____' }} 天后验收
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pp-lbl">前期采购记录</td>
|
||||
<td colspan="5" class="pp-val">{{ printData.prevPurchaseRecord || '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pp-lbl">采购拟办</td>
|
||||
<td colspan="5" class="pp-val">{{ printData.purchaseProposal || '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pp-lbl">付款条件</td>
|
||||
<td class="pp-val" colspan="2">{{ printData.paymentTerms || '' }}</td>
|
||||
<td class="pp-lbl">采购金额(人民币)</td>
|
||||
<td class="pp-val" colspan="2" style="font-size:9pt">
|
||||
¥ {{ printData.totalAmount || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 表4:签名区 -->
|
||||
<table class="pp-tb pp-sig">
|
||||
<tr>
|
||||
<th colspan="4" class="pp-lbl" style="font-size:10pt">采购单位</th>
|
||||
<th colspan="4" class="pp-lbl" style="font-size:10pt">请购单位</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pp-lbl">董事长</td>
|
||||
<td class="pp-lbl">部长/厂长</td>
|
||||
<td class="pp-lbl">主任</td>
|
||||
<td class="pp-lbl">经办</td>
|
||||
<td class="pp-lbl">生产总经理</td>
|
||||
<td class="pp-lbl">厂长</td>
|
||||
<td class="pp-lbl">主任</td>
|
||||
<td class="pp-lbl">经办</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="pp-val">{{ printData.signPurchaseChairman || '' }}</td>
|
||||
<td class="pp-val">{{ printData.signPurchaseManager || '' }}</td>
|
||||
<td class="pp-val">{{ printData.signPurchaseDirector || '' }}</td>
|
||||
<td class="pp-val">{{ printData.signPurchaseHandler || '' }}</td>
|
||||
<td class="pp-val">{{ printData.signRequestGm || '' }}</td>
|
||||
<td class="pp-val">{{ printData.signRequestFactoryMgr || '' }}</td>
|
||||
<td class="pp-val">{{ printData.signRequestDirector || '' }}</td>
|
||||
<td class="pp-val">{{ printData.signRequestHandler || '' }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 表5:底部 -->
|
||||
<table class="pp-tb">
|
||||
<tr>
|
||||
<td class="pp-lbl" style="width:12%">※物品进厂<br>指定卸货位</td>
|
||||
<td class="pp-val" style="width:20%">{{ printData.unloadLocation || '' }}</td>
|
||||
<td class="pp-lbl" style="width:8%">置于</td>
|
||||
<td class="pp-val" style="width:20%">{{ printData.unloadOther || '' }}</td>
|
||||
<td class="pp-lbl" style="width:10%">状态</td>
|
||||
<td class="pp-val" style="width:20%">{{ statusText(printData.formStatus) }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listPurchaseRequisition,
|
||||
getPurchaseRequisition,
|
||||
addPurchaseRequisition,
|
||||
updatePurchaseRequisition,
|
||||
delPurchaseRequisition
|
||||
} from '@/api/erp/purchaseRequisition'
|
||||
|
||||
export default {
|
||||
name: 'PurchaseRequisition',
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
buttonLoading: false,
|
||||
printing: false,
|
||||
showSearch: true,
|
||||
ids: [],
|
||||
single: true,
|
||||
multiple: true,
|
||||
total: 0,
|
||||
reqList: [],
|
||||
title: '',
|
||||
open: false,
|
||||
viewOpen: false,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
reqDept: undefined,
|
||||
itemName: undefined,
|
||||
formStatus: undefined
|
||||
},
|
||||
form: {},
|
||||
viewForm: {},
|
||||
printData: {},
|
||||
rules: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true
|
||||
listPurchaseRequisition(this.queryParams).then(res => {
|
||||
this.reqList = res.rows || []
|
||||
this.total = res.total || 0
|
||||
}).catch(() => {
|
||||
this.reqList = []
|
||||
this.total = 0
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
resetQuery() {
|
||||
this.$refs.queryForm && this.$refs.queryForm.resetFields()
|
||||
this.handleQuery()
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(r => r.reqId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 新增
|
||||
handleAdd() {
|
||||
this.title = '新增请购单'
|
||||
this.form = {
|
||||
reqDept: '', itemName: '', specification: '', unit: '', quantity: '',
|
||||
category: '', requiredDate: '', purposeDesc: '', useDept: '',
|
||||
inspectionCondition: '', trialDays: '', prevPurchaseRecord: '',
|
||||
purchaseProposal: '', paymentTerms: '', totalAmount: '',
|
||||
signPurchaseChairman: '', signPurchaseManager: '', signPurchaseDirector: '',
|
||||
signPurchaseHandler: '', signRequestGm: '', signRequestFactoryMgr: '',
|
||||
signRequestDirector: '', signRequestHandler: '',
|
||||
unloadLocation: '', unloadOther: '', formStatus: '0', remark: '',
|
||||
items: []
|
||||
}
|
||||
this.open = true
|
||||
},
|
||||
// 修改
|
||||
handleUpdate(row) {
|
||||
const reqId = row.reqId || this.ids[0]
|
||||
this.title = '修改请购单'
|
||||
this.buttonLoading = true
|
||||
getPurchaseRequisition(reqId).then(res => {
|
||||
const d = res.data || {}
|
||||
this.form = {
|
||||
reqId: d.reqId,
|
||||
reqDept: d.reqDept, itemName: d.itemName, specification: d.specification,
|
||||
unit: d.unit, quantity: d.quantity,
|
||||
category: d.category, requiredDate: d.requiredDate,
|
||||
purposeDesc: d.purposeDesc, useDept: d.useDept,
|
||||
inspectionCondition: d.inspectionCondition, trialDays: d.trialDays,
|
||||
prevPurchaseRecord: d.prevPurchaseRecord, purchaseProposal: d.purchaseProposal,
|
||||
paymentTerms: d.paymentTerms, totalAmount: d.totalAmount,
|
||||
signPurchaseChairman: d.signPurchaseChairman, signPurchaseManager: d.signPurchaseManager,
|
||||
signPurchaseDirector: d.signPurchaseDirector, signPurchaseHandler: d.signPurchaseHandler,
|
||||
signRequestGm: d.signRequestGm, signRequestFactoryMgr: d.signRequestFactoryMgr,
|
||||
signRequestDirector: d.signRequestDirector, signRequestHandler: d.signRequestHandler,
|
||||
unloadLocation: d.unloadLocation, unloadOther: d.unloadOther,
|
||||
formStatus: d.formStatus, remark: d.remark,
|
||||
items: d.items || []
|
||||
}
|
||||
this.open = true
|
||||
}).finally(() => { this.buttonLoading = false })
|
||||
},
|
||||
// 查看
|
||||
handleView(row) {
|
||||
this.viewForm = {}
|
||||
this.viewOpen = true
|
||||
getPurchaseRequisition(row.reqId).then(res => {
|
||||
this.viewForm = res.data || {}
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
this.open = false
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (!valid) return
|
||||
this.buttonLoading = true
|
||||
const api = this.form.reqId ? updatePurchaseRequisition : addPurchaseRequisition
|
||||
api(this.form).then(() => {
|
||||
this.$modal.msgSuccess('保存成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
}).finally(() => { this.buttonLoading = false })
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
handleDelete(row) {
|
||||
const reqIds = row.reqId ? [row.reqId] : this.ids
|
||||
this.$modal.confirm('确认删除所选请购单?').then(() => {
|
||||
return delPurchaseRequisition(reqIds.join(','))
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
this.getList()
|
||||
}).catch(() => {})
|
||||
},
|
||||
// 导出 Excel
|
||||
handleExport() {
|
||||
this.download('erp/purchaseRequisition/export', { ...this.queryParams }, `请购单_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
// 导出 PDF(A4 表单格式)
|
||||
async exportPdf() {
|
||||
this.printing = true
|
||||
this.printData = { ...this.viewForm }
|
||||
await this.$nextTick()
|
||||
await this.$nextTick()
|
||||
try {
|
||||
const html2canvas = (await import('html2canvas')).default
|
||||
const { jsPDF } = await import('jspdf')
|
||||
|
||||
const el = this.$refs.printTemplate
|
||||
const canvas = await html2canvas(el, {
|
||||
scale: 2,
|
||||
useCORS: true,
|
||||
backgroundColor: '#ffffff',
|
||||
logging: false
|
||||
})
|
||||
|
||||
const pdf = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' })
|
||||
const pw = pdf.internal.pageSize.getWidth()
|
||||
const ph = pdf.internal.pageSize.getHeight()
|
||||
const mg = 8
|
||||
const printW = pw - mg * 2
|
||||
const imgW = canvas.width
|
||||
const imgH = canvas.height
|
||||
const ratio = printW / imgW
|
||||
const totalH = imgH * ratio
|
||||
const pageH = ph - mg * 2
|
||||
|
||||
let srcY = 0
|
||||
let rem = totalH
|
||||
let page = 0
|
||||
while (rem > 0) {
|
||||
if (page > 0) pdf.addPage()
|
||||
const sliceH = Math.min(pageH, rem)
|
||||
const slicePx = sliceH / ratio
|
||||
const sc = document.createElement('canvas')
|
||||
sc.width = imgW
|
||||
sc.height = slicePx
|
||||
sc.getContext('2d').drawImage(canvas, 0, srcY, imgW, slicePx, 0, 0, imgW, slicePx)
|
||||
pdf.addImage(sc.toDataURL('image/jpeg', 0.95), 'JPEG', mg, mg, printW, sliceH)
|
||||
srcY += slicePx
|
||||
rem -= sliceH
|
||||
page++
|
||||
}
|
||||
|
||||
const reqId = this.viewForm.reqId || 'export'
|
||||
pdf.save(`请购单_${reqId}.pdf`)
|
||||
} catch (e) {
|
||||
this.$message.error('PDF导出失败:' + (e.message || e))
|
||||
} finally {
|
||||
this.printing = false
|
||||
this.printData = {}
|
||||
}
|
||||
},
|
||||
// 明细操作
|
||||
addItem() {
|
||||
const last = this.form.items[this.form.items.length - 1]
|
||||
this.form.items.push({
|
||||
itemName: '', specification: '', unit: '', quantity: ''
|
||||
})
|
||||
},
|
||||
removeItem(index) {
|
||||
this.form.items.splice(index, 1)
|
||||
},
|
||||
// 状态
|
||||
statusText(s) {
|
||||
const map = { '0': '请购草稿', '1': '审批中', '2': '已通过', '3': '采购处理中', '4': '已完成', '5': '已驳回' }
|
||||
return map[s] || s || '—'
|
||||
},
|
||||
statusType(s) {
|
||||
const map = { '0': 'info', '1': 'warning', '2': 'success', '3': 'warning', '4': 'success', '5': 'danger' }
|
||||
return map[s] || 'info'
|
||||
},
|
||||
// PDF 复选框
|
||||
ppCheck(cond) {
|
||||
return cond ? 'pp-chk pp-on' : 'pp-chk'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$accent: #5b8db8;
|
||||
$sub: #909399;
|
||||
|
||||
.pr-section {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
border-left: 3px solid $accent;
|
||||
padding-left: 8px;
|
||||
margin: 16px 0 12px;
|
||||
.pr-section-hint {
|
||||
float: right;
|
||||
font-weight: 400;
|
||||
color: $sub;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.pr-del {
|
||||
color: #c45656;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.pr-view {
|
||||
padding: 0 4px;
|
||||
.pr-view-section {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
border-left: 3px solid $accent;
|
||||
padding-left: 8px;
|
||||
margin: 14px 0 10px;
|
||||
&:first-child { margin-top: 0; }
|
||||
}
|
||||
.pr-view-row {
|
||||
margin-bottom: 8px;
|
||||
label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: $sub;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
span {
|
||||
font-size: 13px;
|
||||
color: #303133;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pr-dialog {
|
||||
::v-deep .el-dialog__body {
|
||||
padding-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== A4 打印模板 ===== */
|
||||
.pr-print-wrap {
|
||||
position: fixed;
|
||||
left: -100000px;
|
||||
top: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
.pr-print {
|
||||
width: 190mm;
|
||||
background: #fff;
|
||||
padding: 6mm 8mm;
|
||||
font-family: '宋体', SimSun, serif;
|
||||
color: #000;
|
||||
box-sizing: border-box;
|
||||
line-height: 1.3;
|
||||
}
|
||||
.pp-title {
|
||||
text-align: center;
|
||||
font-size: 13pt;
|
||||
font-weight: 700;
|
||||
margin: 0 0 2px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
.pp-subtitle {
|
||||
text-align: center;
|
||||
font-size: 14pt;
|
||||
font-weight: 700;
|
||||
margin: 0 0 5mm;
|
||||
letter-spacing: 6px;
|
||||
}
|
||||
.pp-sec {
|
||||
font-size: 10pt;
|
||||
font-weight: 700;
|
||||
margin: 4mm 0 2mm;
|
||||
}
|
||||
|
||||
.pp-tb {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 2mm;
|
||||
font-size: 9pt;
|
||||
}
|
||||
.pp-tb td,
|
||||
.pp-tb th {
|
||||
border: 1px solid #000;
|
||||
padding: 3px 4px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.pp-tb .pp-lbl {
|
||||
background: #f5f5f5;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.pp-tb .pp-val {
|
||||
text-align: center;
|
||||
}
|
||||
.pp-tb.pp-it th {
|
||||
background: #f5f5f5;
|
||||
text-align: center;
|
||||
font-weight: 600;
|
||||
font-size: 8.5pt;
|
||||
}
|
||||
|
||||
/* 签名区加高 */
|
||||
.pp-sig td,
|
||||
.pp-sig th {
|
||||
padding: 5px 4px;
|
||||
}
|
||||
|
||||
/* 复选框 */
|
||||
.pp-chk {
|
||||
font-family: '宋体', SimSun, serif;
|
||||
}
|
||||
.pp-chk.pp-on {
|
||||
font-weight: 700;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user