feat: 路由跳转重构 + 甲方报价单 + 物料分类 + 比价选择方案 + 规格型号拆分
- 比价页改为列表→路由跳转到 comparison/detail,支持勾选物料行生成采购方案PDF - 新增甲方报价单模块(clientquote):列表+详情路由,含成本价/报价/毛利率,导出PDF - 新增物料分类管理(category):树形结构,CRUD,物料页面关联分类筛选 - BizMaterial 拆分 spec(规格) + modelNo(型号) 两个字段 - Logo 修复:新PNG + 内联样式确保完整显示 - sys_menu 新增 2012(物料分类)、2013(甲方报价单)、2014(报价单详情)、2015(比价详情) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package com.ruoyi.web.controller.bid;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.system.domain.bid.BizClientQuote;
|
||||
import com.ruoyi.system.service.bid.IBizClientQuoteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/bid/clientquote")
|
||||
public class BizClientQuoteController extends BaseController {
|
||||
@Autowired private IBizClientQuoteService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BizClientQuote query) {
|
||||
startPage();
|
||||
List<BizClientQuote> list = service.selectClientQuoteList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/{quoteId}")
|
||||
public AjaxResult getInfo(@PathVariable Long quoteId) {
|
||||
return success(service.selectClientQuoteById(quoteId));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BizClientQuote quote) {
|
||||
quote.setCreateBy(getUsername());
|
||||
return toAjax(service.insertClientQuote(quote));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BizClientQuote quote) {
|
||||
return toAjax(service.updateClientQuote(quote));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{quoteId}")
|
||||
public AjaxResult remove(@PathVariable Long quoteId) {
|
||||
return toAjax(service.deleteClientQuoteById(quoteId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.web.controller.bid;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.domain.bid.BizMaterialCategory;
|
||||
import com.ruoyi.system.service.bid.IBizMaterialCategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/bid/category")
|
||||
public class BizMaterialCategoryController extends BaseController {
|
||||
@Autowired private IBizMaterialCategoryService service;
|
||||
|
||||
@GetMapping("/tree")
|
||||
public AjaxResult tree() { return success(service.selectCategoryList()); }
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list() { return success(service.selectCategoryList()); }
|
||||
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BizMaterialCategory cat) {
|
||||
cat.setCreateBy(getUsername());
|
||||
return toAjax(service.insertCategory(cat));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BizMaterialCategory cat) {
|
||||
return toAjax(service.updateCategory(cat));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{categoryId}")
|
||||
public AjaxResult remove(@PathVariable Long categoryId) {
|
||||
return toAjax(service.deleteCategory(categoryId));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.ruoyi.system.domain.bid;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class BizClientQuote {
|
||||
private Long quoteId;
|
||||
private Long tenantId;
|
||||
private String quoteNo;
|
||||
private String clientName;
|
||||
private Long rfqId;
|
||||
private String rfqNo;
|
||||
private String rfqTitle;
|
||||
private String status;
|
||||
private Date validityDate;
|
||||
private BigDecimal totalAmount;
|
||||
private String currency;
|
||||
private String remark;
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private List<BizClientQuoteItem> items;
|
||||
|
||||
public Long getQuoteId(){return quoteId;}
|
||||
public void setQuoteId(Long v){quoteId=v;}
|
||||
public Long getTenantId(){return tenantId;}
|
||||
public void setTenantId(Long v){tenantId=v;}
|
||||
public String getQuoteNo(){return quoteNo;}
|
||||
public void setQuoteNo(String v){quoteNo=v;}
|
||||
public String getClientName(){return clientName;}
|
||||
public void setClientName(String v){clientName=v;}
|
||||
public Long getRfqId(){return rfqId;}
|
||||
public void setRfqId(Long v){rfqId=v;}
|
||||
public String getRfqNo(){return rfqNo;}
|
||||
public void setRfqNo(String v){rfqNo=v;}
|
||||
public String getRfqTitle(){return rfqTitle;}
|
||||
public void setRfqTitle(String v){rfqTitle=v;}
|
||||
public String getStatus(){return status;}
|
||||
public void setStatus(String v){status=v;}
|
||||
public Date getValidityDate(){return validityDate;}
|
||||
public void setValidityDate(Date v){validityDate=v;}
|
||||
public BigDecimal getTotalAmount(){return totalAmount;}
|
||||
public void setTotalAmount(BigDecimal v){totalAmount=v;}
|
||||
public String getCurrency(){return currency;}
|
||||
public void setCurrency(String v){currency=v;}
|
||||
public String getRemark(){return remark;}
|
||||
public void setRemark(String v){remark=v;}
|
||||
public String getCreateBy(){return createBy;}
|
||||
public void setCreateBy(String v){createBy=v;}
|
||||
public Date getCreateTime(){return createTime;}
|
||||
public void setCreateTime(Date v){createTime=v;}
|
||||
public Date getUpdateTime(){return updateTime;}
|
||||
public void setUpdateTime(Date v){updateTime=v;}
|
||||
public List<BizClientQuoteItem> getItems(){return items;}
|
||||
public void setItems(List<BizClientQuoteItem> v){items=v;}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.ruoyi.system.domain.bid;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class BizClientQuoteItem {
|
||||
private Long itemId;
|
||||
private Long quoteId;
|
||||
private String materialName;
|
||||
private String spec;
|
||||
private String modelNo;
|
||||
private String unit;
|
||||
private BigDecimal quantity;
|
||||
private BigDecimal costPrice;
|
||||
private BigDecimal unitPrice;
|
||||
private BigDecimal totalPrice;
|
||||
private Integer deliveryDays;
|
||||
private String remark;
|
||||
|
||||
public Long getItemId(){return itemId;}
|
||||
public void setItemId(Long v){itemId=v;}
|
||||
public Long getQuoteId(){return quoteId;}
|
||||
public void setQuoteId(Long v){quoteId=v;}
|
||||
public String getMaterialName(){return materialName;}
|
||||
public void setMaterialName(String v){materialName=v;}
|
||||
public String getSpec(){return spec;}
|
||||
public void setSpec(String v){spec=v;}
|
||||
public String getModelNo(){return modelNo;}
|
||||
public void setModelNo(String v){modelNo=v;}
|
||||
public String getUnit(){return unit;}
|
||||
public void setUnit(String v){unit=v;}
|
||||
public BigDecimal getQuantity(){return quantity;}
|
||||
public void setQuantity(BigDecimal v){quantity=v;}
|
||||
public BigDecimal getCostPrice(){return costPrice;}
|
||||
public void setCostPrice(BigDecimal v){costPrice=v;}
|
||||
public BigDecimal getUnitPrice(){return unitPrice;}
|
||||
public void setUnitPrice(BigDecimal v){unitPrice=v;}
|
||||
public BigDecimal getTotalPrice(){return totalPrice;}
|
||||
public void setTotalPrice(BigDecimal v){totalPrice=v;}
|
||||
public Integer getDeliveryDays(){return deliveryDays;}
|
||||
public void setDeliveryDays(Integer v){deliveryDays=v;}
|
||||
public String getRemark(){return remark;}
|
||||
public void setRemark(String v){remark=v;}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ public class BizMaterial extends BaseEntity {
|
||||
private String materialCode;
|
||||
private String materialName;
|
||||
private String spec;
|
||||
private String modelNo;
|
||||
private String unit;
|
||||
private String brand;
|
||||
private String description;
|
||||
@@ -28,6 +29,8 @@ public class BizMaterial extends BaseEntity {
|
||||
public void setMaterialName(String materialName) { this.materialName = materialName; }
|
||||
public String getSpec() { return spec; }
|
||||
public void setSpec(String spec) { this.spec = spec; }
|
||||
public String getModelNo() { return modelNo; }
|
||||
public void setModelNo(String modelNo) { this.modelNo = modelNo; }
|
||||
public String getUnit() { return unit; }
|
||||
public void setUnit(String unit) { this.unit = unit; }
|
||||
public String getBrand() { return brand; }
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.ruoyi.system.domain.bid;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class BizMaterialCategory {
|
||||
private Long categoryId;
|
||||
private Long tenantId;
|
||||
private String categoryName;
|
||||
private Long parentId;
|
||||
private String ancestors;
|
||||
private Integer sort;
|
||||
private String status;
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private List<BizMaterialCategory> children;
|
||||
|
||||
public Long getCategoryId(){return categoryId;}
|
||||
public void setCategoryId(Long v){categoryId=v;}
|
||||
public Long getTenantId(){return tenantId;}
|
||||
public void setTenantId(Long v){tenantId=v;}
|
||||
public String getCategoryName(){return categoryName;}
|
||||
public void setCategoryName(String v){categoryName=v;}
|
||||
public Long getParentId(){return parentId;}
|
||||
public void setParentId(Long v){parentId=v;}
|
||||
public String getAncestors(){return ancestors;}
|
||||
public void setAncestors(String v){ancestors=v;}
|
||||
public Integer getSort(){return sort;}
|
||||
public void setSort(Integer v){sort=v;}
|
||||
public String getStatus(){return status;}
|
||||
public void setStatus(String v){status=v;}
|
||||
public String getCreateBy(){return createBy;}
|
||||
public void setCreateBy(String v){createBy=v;}
|
||||
public Date getCreateTime(){return createTime;}
|
||||
public void setCreateTime(Date v){createTime=v;}
|
||||
public List<BizMaterialCategory> getChildren(){return children;}
|
||||
public void setChildren(List<BizMaterialCategory> v){children=v;}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.system.mapper.bid;
|
||||
|
||||
import com.ruoyi.system.domain.bid.BizClientQuote;
|
||||
import com.ruoyi.system.domain.bid.BizClientQuoteItem;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
public interface BizClientQuoteMapper {
|
||||
List<BizClientQuote> selectClientQuoteList(@Param("q") BizClientQuote query);
|
||||
BizClientQuote selectClientQuoteById(@Param("quoteId") Long quoteId);
|
||||
List<BizClientQuoteItem> selectItemsByQuoteId(@Param("quoteId") Long quoteId);
|
||||
int insertClientQuote(BizClientQuote quote);
|
||||
int insertClientQuoteItem(BizClientQuoteItem item);
|
||||
int updateClientQuote(BizClientQuote quote);
|
||||
int deleteClientQuoteById(@Param("quoteId") Long quoteId);
|
||||
int deleteItemsByQuoteId(@Param("quoteId") Long quoteId);
|
||||
String selectNextQuoteNo();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.ruoyi.system.mapper.bid;
|
||||
|
||||
import com.ruoyi.system.domain.bid.BizMaterialCategory;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
|
||||
public interface BizMaterialCategoryMapper {
|
||||
List<BizMaterialCategory> selectCategoryList();
|
||||
BizMaterialCategory selectCategoryById(@Param("categoryId") Long categoryId);
|
||||
int insertCategory(BizMaterialCategory category);
|
||||
int updateCategory(BizMaterialCategory category);
|
||||
int deleteCategory(@Param("categoryId") Long categoryId);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.system.service.bid;
|
||||
|
||||
import com.ruoyi.system.domain.bid.BizClientQuote;
|
||||
import java.util.List;
|
||||
|
||||
public interface IBizClientQuoteService {
|
||||
List<BizClientQuote> selectClientQuoteList(BizClientQuote query);
|
||||
BizClientQuote selectClientQuoteById(Long quoteId);
|
||||
int insertClientQuote(BizClientQuote quote);
|
||||
int updateClientQuote(BizClientQuote quote);
|
||||
int deleteClientQuoteById(Long quoteId);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.ruoyi.system.service.bid;
|
||||
|
||||
import com.ruoyi.system.domain.bid.BizMaterialCategory;
|
||||
import java.util.List;
|
||||
|
||||
public interface IBizMaterialCategoryService {
|
||||
List<BizMaterialCategory> selectCategoryList();
|
||||
int insertCategory(BizMaterialCategory category);
|
||||
int updateCategory(BizMaterialCategory category);
|
||||
int deleteCategory(Long categoryId);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.ruoyi.system.service.bid.impl;
|
||||
|
||||
import com.ruoyi.system.domain.bid.BizClientQuote;
|
||||
import com.ruoyi.system.domain.bid.BizClientQuoteItem;
|
||||
import com.ruoyi.system.mapper.bid.BizClientQuoteMapper;
|
||||
import com.ruoyi.system.service.bid.IBizClientQuoteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BizClientQuoteServiceImpl implements IBizClientQuoteService {
|
||||
@Autowired private BizClientQuoteMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<BizClientQuote> selectClientQuoteList(BizClientQuote query) {
|
||||
return mapper.selectClientQuoteList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizClientQuote selectClientQuoteById(Long quoteId) {
|
||||
BizClientQuote q = mapper.selectClientQuoteById(quoteId);
|
||||
if (q != null) q.setItems(mapper.selectItemsByQuoteId(quoteId));
|
||||
return q;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertClientQuote(BizClientQuote quote) {
|
||||
if (quote.getQuoteNo() == null || quote.getQuoteNo().isBlank()) {
|
||||
quote.setQuoteNo(mapper.selectNextQuoteNo());
|
||||
}
|
||||
if (quote.getStatus() == null) quote.setStatus("draft");
|
||||
if (quote.getCurrency() == null) quote.setCurrency("CNY");
|
||||
// Calculate total
|
||||
if (quote.getItems() != null) {
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
for (BizClientQuoteItem item : quote.getItems()) {
|
||||
if (item.getUnitPrice() != null && item.getQuantity() != null) {
|
||||
BigDecimal line = item.getUnitPrice().multiply(item.getQuantity()).setScale(2, RoundingMode.HALF_UP);
|
||||
item.setTotalPrice(line);
|
||||
total = total.add(line);
|
||||
}
|
||||
}
|
||||
quote.setTotalAmount(total);
|
||||
}
|
||||
int rows = mapper.insertClientQuote(quote);
|
||||
if (quote.getItems() != null) {
|
||||
for (BizClientQuoteItem item : quote.getItems()) {
|
||||
item.setQuoteId(quote.getQuoteId());
|
||||
mapper.insertClientQuoteItem(item);
|
||||
}
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateClientQuote(BizClientQuote quote) {
|
||||
if (quote.getItems() != null) {
|
||||
BigDecimal total = BigDecimal.ZERO;
|
||||
for (BizClientQuoteItem item : quote.getItems()) {
|
||||
if (item.getUnitPrice() != null && item.getQuantity() != null) {
|
||||
BigDecimal line = item.getUnitPrice().multiply(item.getQuantity()).setScale(2, RoundingMode.HALF_UP);
|
||||
item.setTotalPrice(line);
|
||||
total = total.add(line);
|
||||
}
|
||||
}
|
||||
quote.setTotalAmount(total);
|
||||
mapper.deleteItemsByQuoteId(quote.getQuoteId());
|
||||
for (BizClientQuoteItem item : quote.getItems()) {
|
||||
item.setQuoteId(quote.getQuoteId());
|
||||
mapper.insertClientQuoteItem(item);
|
||||
}
|
||||
}
|
||||
return mapper.updateClientQuote(quote);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteClientQuoteById(Long quoteId) {
|
||||
mapper.deleteItemsByQuoteId(quoteId);
|
||||
return mapper.deleteClientQuoteById(quoteId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.system.service.bid.impl;
|
||||
|
||||
import com.ruoyi.system.domain.bid.BizMaterialCategory;
|
||||
import com.ruoyi.system.mapper.bid.BizMaterialCategoryMapper;
|
||||
import com.ruoyi.system.service.bid.IBizMaterialCategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class BizMaterialCategoryServiceImpl implements IBizMaterialCategoryService {
|
||||
@Autowired private BizMaterialCategoryMapper mapper;
|
||||
|
||||
@Override
|
||||
public List<BizMaterialCategory> selectCategoryList() {
|
||||
List<BizMaterialCategory> all = mapper.selectCategoryList();
|
||||
return buildTree(all);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertCategory(BizMaterialCategory cat) {
|
||||
if (cat.getParentId() == null) cat.setParentId(0L);
|
||||
if (cat.getSort() == null) cat.setSort(0);
|
||||
if (cat.getStatus() == null) cat.setStatus("0");
|
||||
// Build ancestors string
|
||||
if (cat.getParentId() == 0L) {
|
||||
cat.setAncestors("0");
|
||||
} else {
|
||||
BizMaterialCategory parent = mapper.selectCategoryById(cat.getParentId());
|
||||
cat.setAncestors(parent == null ? "0" : parent.getAncestors() + "," + cat.getParentId());
|
||||
}
|
||||
return mapper.insertCategory(cat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCategory(BizMaterialCategory cat) { return mapper.updateCategory(cat); }
|
||||
|
||||
@Override
|
||||
public int deleteCategory(Long categoryId) { return mapper.deleteCategory(categoryId); }
|
||||
|
||||
private List<BizMaterialCategory> buildTree(List<BizMaterialCategory> all) {
|
||||
Map<Long, BizMaterialCategory> map = new LinkedHashMap<>();
|
||||
for (BizMaterialCategory c : all) map.put(c.getCategoryId(), c);
|
||||
List<BizMaterialCategory> roots = new ArrayList<>();
|
||||
for (BizMaterialCategory c : all) {
|
||||
Long pid = c.getParentId() == null ? 0L : c.getParentId();
|
||||
if (pid == 0L) { roots.add(c); }
|
||||
else {
|
||||
BizMaterialCategory parent = map.get(pid);
|
||||
if (parent != null) {
|
||||
if (parent.getChildren() == null) parent.setChildren(new ArrayList<>());
|
||||
parent.getChildren().add(c);
|
||||
} else roots.add(c);
|
||||
}
|
||||
}
|
||||
return roots;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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.ruoyi.system.mapper.bid.BizClientQuoteMapper">
|
||||
|
||||
<select id="selectClientQuoteList" resultType="com.ruoyi.system.domain.bid.BizClientQuote">
|
||||
SELECT quote_id AS quoteId, tenant_id AS tenantId, quote_no AS quoteNo,
|
||||
client_name AS clientName, rfq_id AS rfqId, rfq_no AS rfqNo, rfq_title AS rfqTitle,
|
||||
status, validity_date AS validityDate, total_amount AS totalAmount,
|
||||
currency, remark, create_by AS createBy, create_time AS createTime
|
||||
FROM biz_client_quote
|
||||
<where>
|
||||
<if test="q.clientName != null and q.clientName != ''">AND client_name LIKE CONCAT('%',#{q.clientName},'%')</if>
|
||||
<if test="q.status != null and q.status != ''">AND status = #{q.status}</if>
|
||||
</where>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectClientQuoteById" resultType="com.ruoyi.system.domain.bid.BizClientQuote">
|
||||
SELECT quote_id AS quoteId, tenant_id AS tenantId, quote_no AS quoteNo,
|
||||
client_name AS clientName, rfq_id AS rfqId, rfq_no AS rfqNo, rfq_title AS rfqTitle,
|
||||
status, validity_date AS validityDate, total_amount AS totalAmount,
|
||||
currency, remark, create_by AS createBy, create_time AS createTime
|
||||
FROM biz_client_quote WHERE quote_id = #{quoteId}
|
||||
</select>
|
||||
|
||||
<select id="selectItemsByQuoteId" resultType="com.ruoyi.system.domain.bid.BizClientQuoteItem">
|
||||
SELECT item_id AS itemId, quote_id AS quoteId, material_name AS materialName,
|
||||
spec, model_no AS modelNo, unit, quantity, cost_price AS costPrice,
|
||||
unit_price AS unitPrice, total_price AS totalPrice, delivery_days AS deliveryDays, remark
|
||||
FROM biz_client_quote_item WHERE quote_id = #{quoteId} ORDER BY item_id
|
||||
</select>
|
||||
|
||||
<select id="selectNextQuoteNo" resultType="String">
|
||||
SELECT CONCAT('CQ-', DATE_FORMAT(NOW(),'%Y%m'), '-', LPAD(IFNULL(MAX(CAST(SUBSTRING_INDEX(quote_no,'-',-1) AS UNSIGNED)),0)+1,3,'0'))
|
||||
FROM biz_client_quote WHERE quote_no LIKE CONCAT('CQ-', DATE_FORMAT(NOW(),'%Y%m'), '%')
|
||||
</select>
|
||||
|
||||
<insert id="insertClientQuote" useGeneratedKeys="true" keyProperty="quoteId">
|
||||
INSERT INTO biz_client_quote (tenant_id,quote_no,client_name,rfq_id,rfq_no,rfq_title,
|
||||
status,validity_date,total_amount,currency,remark,create_by,create_time)
|
||||
VALUES (1,#{quoteNo},#{clientName},#{rfqId},#{rfqNo},#{rfqTitle},
|
||||
#{status},#{validityDate},#{totalAmount},#{currency},#{remark},#{createBy},NOW())
|
||||
</insert>
|
||||
|
||||
<insert id="insertClientQuoteItem" useGeneratedKeys="true" keyProperty="itemId">
|
||||
INSERT INTO biz_client_quote_item (quote_id,material_name,spec,model_no,unit,quantity,
|
||||
cost_price,unit_price,total_price,delivery_days,remark)
|
||||
VALUES (#{quoteId},#{materialName},#{spec},#{modelNo},#{unit},#{quantity},
|
||||
#{costPrice},#{unitPrice},#{totalPrice},#{deliveryDays},#{remark})
|
||||
</insert>
|
||||
|
||||
<update id="updateClientQuote">
|
||||
UPDATE biz_client_quote SET client_name=#{clientName},status=#{status},
|
||||
validity_date=#{validityDate},total_amount=#{totalAmount},
|
||||
currency=#{currency},remark=#{remark},update_time=NOW()
|
||||
WHERE quote_id=#{quoteId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteClientQuoteById">DELETE FROM biz_client_quote WHERE quote_id=#{quoteId}</delete>
|
||||
<delete id="deleteItemsByQuoteId">DELETE FROM biz_client_quote_item WHERE quote_id=#{quoteId}</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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.ruoyi.system.mapper.bid.BizMaterialCategoryMapper">
|
||||
|
||||
<select id="selectCategoryList" resultType="com.ruoyi.system.domain.bid.BizMaterialCategory">
|
||||
SELECT category_id AS categoryId, tenant_id AS tenantId,
|
||||
category_name AS categoryName, parent_id AS parentId,
|
||||
ancestors, sort, status, create_by AS createBy, create_time AS createTime
|
||||
FROM biz_material_category ORDER BY sort, category_id
|
||||
</select>
|
||||
|
||||
<select id="selectCategoryById" resultType="com.ruoyi.system.domain.bid.BizMaterialCategory">
|
||||
SELECT category_id AS categoryId, category_name AS categoryName,
|
||||
parent_id AS parentId, ancestors, sort, status
|
||||
FROM biz_material_category WHERE category_id = #{categoryId}
|
||||
</select>
|
||||
|
||||
<insert id="insertCategory" useGeneratedKeys="true" keyProperty="categoryId">
|
||||
INSERT INTO biz_material_category (tenant_id,category_name,parent_id,ancestors,sort,status,create_by,create_time)
|
||||
VALUES (1,#{categoryName},#{parentId},#{ancestors},#{sort},#{status},#{createBy},NOW())
|
||||
</insert>
|
||||
|
||||
<update id="updateCategory">
|
||||
UPDATE biz_material_category
|
||||
SET category_name=#{categoryName},parent_id=#{parentId},ancestors=#{ancestors},
|
||||
sort=#{sort},status=#{status}
|
||||
WHERE category_id=#{categoryId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCategory">
|
||||
DELETE FROM biz_material_category WHERE category_id=#{categoryId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -9,6 +9,7 @@
|
||||
<result property="materialCode" column="material_code"/>
|
||||
<result property="materialName" column="material_name"/>
|
||||
<result property="spec" column="spec"/>
|
||||
<result property="modelNo" column="model_no"/>
|
||||
<result property="unit" column="unit"/>
|
||||
<result property="brand" column="brand"/>
|
||||
<result property="description" column="description"/>
|
||||
@@ -23,9 +24,10 @@
|
||||
SELECT m.* FROM biz_material m
|
||||
<where>
|
||||
<if test="tenantId != null"> AND m.tenant_id = #{tenantId}</if>
|
||||
<if test="materialCode != null and materialCode != ''"> AND m.material_code LIKE CONCAT('%',#{materialCode},'%')</if>
|
||||
<if test="materialName != null and materialName != ''"> AND m.material_name LIKE CONCAT('%',#{materialName},'%')</if>
|
||||
<if test="status != null and status != ''"> AND m.status = #{status}</if>
|
||||
<if test="categoryId != null"> AND m.category_id = #{categoryId}</if>
|
||||
<if test="materialCode != null and materialCode != ''"> AND m.material_code LIKE CONCAT('%',#{materialCode},'%')</if>
|
||||
<if test="materialName != null and materialName != ''"> AND m.material_name LIKE CONCAT('%',#{materialName},'%')</if>
|
||||
<if test="status != null and status != ''"> AND m.status = #{status}</if>
|
||||
</where>
|
||||
ORDER BY m.material_id DESC
|
||||
</select>
|
||||
@@ -35,8 +37,8 @@
|
||||
</select>
|
||||
|
||||
<insert id="insertBizMaterial" useGeneratedKeys="true" keyProperty="materialId">
|
||||
INSERT INTO biz_material(tenant_id,category_id,material_code,material_name,spec,unit,brand,description,status,create_by,create_time)
|
||||
VALUES(#{tenantId},#{categoryId},#{materialCode},#{materialName},#{spec},#{unit},#{brand},#{description},#{status},#{createBy},NOW())
|
||||
INSERT INTO biz_material(tenant_id,category_id,material_code,material_name,spec,model_no,unit,brand,description,status,create_by,create_time)
|
||||
VALUES(#{tenantId},#{categoryId},#{materialCode},#{materialName},#{spec},#{modelNo},#{unit},#{brand},#{description},#{status},#{createBy},NOW())
|
||||
</insert>
|
||||
|
||||
<update id="updateBizMaterial">
|
||||
@@ -45,6 +47,7 @@
|
||||
<if test="materialName != null">material_name=#{materialName},</if>
|
||||
<if test="materialCode != null">material_code=#{materialCode},</if>
|
||||
<if test="spec != null">spec=#{spec},</if>
|
||||
<if test="modelNo != null">model_no=#{modelNo},</if>
|
||||
<if test="unit != null">unit=#{unit},</if>
|
||||
<if test="brand != null">brand=#{brand},</if>
|
||||
<if test="description != null">description=#{description},</if>
|
||||
|
||||
7
ruoyi-ui/src/api/bid/category.js
Normal file
7
ruoyi-ui/src/api/bid/category.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import request from '@/utils/request'
|
||||
const baseUrl = '/bid/category'
|
||||
export const getCategoryList = () => request({ url: baseUrl + '/list', method: 'get' })
|
||||
export const getCategoryTree = () => request({ url: baseUrl + '/tree', method: 'get' })
|
||||
export const addCategory = (data) => request({ url: baseUrl, method: 'post', data })
|
||||
export const updateCategory = (data) => request({ url: baseUrl, method: 'put', data })
|
||||
export const delCategory = (id) => request({ url: baseUrl + '/' + id, method: 'delete' })
|
||||
7
ruoyi-ui/src/api/bid/clientquote.js
Normal file
7
ruoyi-ui/src/api/bid/clientquote.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import request from '@/utils/request'
|
||||
const baseUrl = '/bid/clientquote'
|
||||
export const listClientQuote = (params) => request({ url: baseUrl + '/list', method: 'get', params })
|
||||
export const getClientQuote = (id) => request({ url: baseUrl + '/' + id, method: 'get' })
|
||||
export const addClientQuote = (data) => request({ url: baseUrl, method: 'post', data })
|
||||
export const updateClientQuote = (data) => request({ url: baseUrl, method: 'put', data })
|
||||
export const delClientQuote = (id) => request({ url: baseUrl + '/' + id, method: 'delete' })
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 355 B |
@@ -1,46 +1,48 @@
|
||||
<template>
|
||||
<div class="sidebar-logo-container" :class="{ collapse: collapse }" :style="{ backgroundColor: sideTheme === 'theme-dark' && navType !== 3 ? variables.menuBackground : variables.menuLightBackground }">
|
||||
<div class="sidebar-logo-container" :class="{ collapse: collapse }"
|
||||
:style="{ backgroundColor: sideTheme === 'theme-dark' && navType !== 3 ? variables.menuBackground : variables.menuLightBackground }">
|
||||
<transition name="sidebarLogoFade">
|
||||
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
|
||||
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' && navType !== 3 ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
|
||||
<img v-if="logo" :src="logo"
|
||||
style="width:32px;height:32px;object-fit:contain;flex-shrink:0;display:block" />
|
||||
<h1 v-else class="sidebar-title"
|
||||
:style="{ color: sideTheme === 'theme-dark' && navType !== 3 ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
|
||||
</router-link>
|
||||
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
|
||||
<img v-if="logo" :src="logo" class="sidebar-logo" />
|
||||
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' && navType !== 3 ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
|
||||
<img v-if="logo" :src="logo"
|
||||
style="width:32px;height:32px;object-fit:contain;flex-shrink:0;margin-right:10px;display:block" />
|
||||
<h1 class="sidebar-title"
|
||||
:style="{ color: sideTheme === 'theme-dark' && navType !== 3 ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }}</h1>
|
||||
</router-link>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import logoImg from "@/assets/logo/logo.png"
|
||||
import variables from "@/assets/styles/variables.scss"
|
||||
|
||||
export default {
|
||||
name: "SidebarLogo",
|
||||
props: { collapse: { type: Boolean, required: true } },
|
||||
computed: {
|
||||
variables() { return variables },
|
||||
sideTheme() { return this.$store.state.settings.sideTheme },
|
||||
navType() { return this.$store.state.settings.navType }
|
||||
navType() { return this.$store.state.settings.navType }
|
||||
},
|
||||
data() { return { title: process.env.VUE_APP_TITLE, logo: logoImg } }
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.sidebarLogoFade-enter-active { transition: opacity 1.5s; }
|
||||
.sidebarLogoFade-enter, .sidebarLogoFade-leave-to { opacity: 0; }
|
||||
.sidebar-logo-container {
|
||||
position: relative; height: 50px; line-height: 50px;
|
||||
background: #2b2f3a; text-align: center; overflow: hidden;
|
||||
height: 50px; background: #2b2f3a; text-align: center;
|
||||
.sidebar-logo-link {
|
||||
height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; text-decoration: none;
|
||||
.sidebar-logo { width: 34px; height: 34px; object-fit: contain; margin-right: 10px; flex-shrink: 0; }
|
||||
.sidebar-title { display: inline-block; margin: 0; color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
height: 100%; width: 100%; display: flex; align-items: center;
|
||||
justify-content: center; text-decoration: none; padding: 0 12px;
|
||||
.sidebar-title {
|
||||
color: #fff; font-weight: 600; font-size: 14px; margin: 0;
|
||||
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
.sidebar-logo-container.collapse .sidebar-logo-link { justify-content: center; }
|
||||
.sidebar-logo-container.collapse .sidebar-logo { margin-right: 0 !important; }
|
||||
</style>
|
||||
|
||||
120
ruoyi-ui/src/views/bid/category/index.vue
Normal file
120
ruoyi-ui/src/views/bid/category/index.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd(null)">新增根分类</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="categoryList" row-key="categoryId"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
border default-expand-all>
|
||||
<el-table-column label="分类名称" prop="categoryName" min-width="200" />
|
||||
<el-table-column label="排序" prop="sort" width="80" align="center" />
|
||||
<el-table-column label="状态" width="80" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.status === '0' ? 'success' : 'danger'" size="mini">
|
||||
{{ scope.row.status === '0' ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)">新增子类</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" style="color:#f56c6c" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogOpen" width="480px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
|
||||
<el-form-item v-if="form.parentId !== null && form.parentId !== undefined" label="父级分类">
|
||||
<span style="color:#606266">{{ parentName || '根节点' }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="categoryName">
|
||||
<el-input v-model="form.categoryName" placeholder="请输入分类名称" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="form.sort" :min="0" :max="999" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="0">启用</el-radio>
|
||||
<el-radio label="1">禁用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer">
|
||||
<el-button @click="dialogOpen = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCategoryList, addCategory, updateCategory, delCategory } from "@/api/bid/category";
|
||||
export default {
|
||||
name: "Category",
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
categoryList: [],
|
||||
dialogOpen: false,
|
||||
dialogTitle: "",
|
||||
parentName: "",
|
||||
form: {},
|
||||
rules: {
|
||||
categoryName: [{ required: true, message: "分类名称不能为空", trigger: "blur" }]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() { this.getList(); },
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getCategoryList().then(res => {
|
||||
this.categoryList = res.data || [];
|
||||
this.loading = false;
|
||||
}).catch(() => { this.loading = false; });
|
||||
},
|
||||
handleAdd(parent) {
|
||||
this.form = { categoryName: "", parentId: parent ? parent.categoryId : 0, sort: 0, status: "0" };
|
||||
this.parentName = parent ? parent.categoryName : "";
|
||||
this.dialogTitle = parent ? "新增子分类(" + parent.categoryName + ")" : "新增根分类";
|
||||
this.dialogOpen = true;
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.form = { categoryId: row.categoryId, categoryName: row.categoryName, sort: row.sort, status: row.status };
|
||||
this.dialogTitle = "修改分类";
|
||||
this.dialogOpen = true;
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm("确认删除分类【" + row.categoryName + "】?子分类也将被删除!").then(() => {
|
||||
return delCategory(row.categoryId);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (!valid) return;
|
||||
const action = this.form.categoryId ? updateCategory : addCategory;
|
||||
action(this.form).then(() => {
|
||||
this.$modal.msgSuccess("保存成功");
|
||||
this.dialogOpen = false;
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
350
ruoyi-ui/src/views/bid/clientquote/detail.vue
Normal file
350
ruoyi-ui/src/views/bid/clientquote/detail.vue
Normal file
@@ -0,0 +1,350 @@
|
||||
<template>
|
||||
<div class="app-container cq-detail">
|
||||
<div class="page-header">
|
||||
<div class="page-header-left">
|
||||
<el-button icon="el-icon-arrow-left" size="small" @click="$router.back()">返回列表</el-button>
|
||||
<span class="page-title">甲方报价单</span>
|
||||
<el-tag v-if="form.quoteNo" type="primary" style="margin-left:8px">{{ form.quoteNo }}</el-tag>
|
||||
</div>
|
||||
<div class="page-header-right">
|
||||
<el-button size="small" @click="handleSave" :loading="saving" icon="el-icon-check" type="success">保存草稿</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-download" :loading="pdfLoading" @click="exportPdf">导出 PDF</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-card shadow="never" class="info-card">
|
||||
<div slot="header"><strong>基本信息</strong></div>
|
||||
<el-form :model="form" label-width="100px" size="small" :inline="false">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户名称">
|
||||
<el-input v-model="form.clientName" placeholder="请输入客户/甲方名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="关联询价单">
|
||||
<el-select v-model="form.rfqId" placeholder="选择关联RFQ(可选)" clearable filterable style="width:100%"
|
||||
@change="onRfqSelect">
|
||||
<el-option v-for="r in rfqOptions" :key="r.rfqId" :label="r.rfqNo + ' — ' + r.rfqTitle" :value="r.rfqId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="有效期至">
|
||||
<el-date-picker v-model="form.validityDate" type="date" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择有效期" style="width:100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="币种">
|
||||
<el-select v-model="form.currency" style="width:100%">
|
||||
<el-option label="人民币 CNY" value="CNY" />
|
||||
<el-option label="美元 USD" value="USD" />
|
||||
<el-option label="欧元 EUR" value="EUR" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="form.status" style="width:100%">
|
||||
<el-option label="草稿" value="draft" />
|
||||
<el-option label="已发送" value="sent" />
|
||||
<el-option label="已确认" value="confirmed" />
|
||||
<el-option label="已拒绝" value="rejected" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.remark" placeholder="备注说明" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" style="margin-top:12px">
|
||||
<div slot="header">
|
||||
<span><strong>报价明细</strong></span>
|
||||
<el-button style="float:right" type="primary" size="mini" icon="el-icon-plus" @click="addItem">添加行</el-button>
|
||||
</div>
|
||||
<el-table :data="form.items" border size="small">
|
||||
<el-table-column type="index" width="46" label="#" />
|
||||
<el-table-column label="物料名称" min-width="150">
|
||||
<template slot-scope="s">
|
||||
<el-input v-model="s.row.materialName" size="mini" placeholder="物料名称" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格" width="120">
|
||||
<template slot-scope="s">
|
||||
<el-input v-model="s.row.spec" size="mini" placeholder="规格" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="型号" width="120">
|
||||
<template slot-scope="s">
|
||||
<el-input v-model="s.row.modelNo" size="mini" placeholder="型号" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="70">
|
||||
<template slot-scope="s">
|
||||
<el-input v-model="s.row.unit" size="mini" placeholder="单位" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" width="80">
|
||||
<template slot-scope="s">
|
||||
<el-input-number v-model="s.row.quantity" :min="0" size="mini" controls-position="right" style="width:100%" @change="calcRow(s.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成本价(元)" width="110">
|
||||
<template slot-scope="s">
|
||||
<el-input-number v-model="s.row.costPrice" :min="0" :precision="2" size="mini" controls-position="right" style="width:100%" @change="calcRow(s.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="报价(元)" width="110">
|
||||
<template slot-scope="s">
|
||||
<el-input-number v-model="s.row.unitPrice" :min="0" :precision="2" size="mini" controls-position="right" style="width:100%" @change="calcRow(s.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额(元)" width="110" align="right">
|
||||
<template slot-scope="s">
|
||||
<strong style="color:#409EFF">¥{{ s.row.totalPrice || '0.00' }}</strong>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="毛利率" width="80" align="center">
|
||||
<template slot-scope="s">
|
||||
<span :style="{ color: marginColor(s.row) }">{{ calcMargin(s.row) }}%</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交货期(天)" width="90">
|
||||
<template slot-scope="s">
|
||||
<el-input-number v-model="s.row.deliveryDays" :min="0" size="mini" controls-position="right" style="width:100%" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="60" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-button type="text" icon="el-icon-delete" style="color:#f56c6c" @click="removeItem(s.$index)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="total-bar">
|
||||
<span>合计:</span>
|
||||
<strong style="font-size:20px;color:#409EFF">¥{{ grandTotal }}</strong>
|
||||
<span style="margin-left:20px;color:#909399;font-size:13px">共 {{ form.items.length }} 项</span>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- Hidden PDF area -->
|
||||
<div id="cq-pdf-area" class="pdf-area" style="position:absolute;left:-9999px;top:0;width:794px;background:#fff">
|
||||
<div class="pdf-header">
|
||||
<img :src="logoSrc" class="pdf-logo" />
|
||||
<div class="pdf-header-text">
|
||||
<div class="pdf-company">福安德综合报价系统</div>
|
||||
<div class="pdf-doc-type">甲方报价单</div>
|
||||
</div>
|
||||
<div class="pdf-header-meta">
|
||||
<div>单号:{{ form.quoteNo }}</div>
|
||||
<div>日期:{{ today }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pdf-divider"></div>
|
||||
<table class="pdf-meta-table">
|
||||
<tr>
|
||||
<td class="meta-label">客户名称</td><td class="meta-val">{{ form.clientName }}</td>
|
||||
<td class="meta-label">有效期</td><td class="meta-val">{{ form.validityDate | dateFmt }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="meta-label">关联询价单</td><td class="meta-val">{{ form.rfqNo || '-' }}</td>
|
||||
<td class="meta-label">币种</td><td class="meta-val">{{ form.currency || 'CNY' }}</td>
|
||||
</tr>
|
||||
<tr v-if="form.remark">
|
||||
<td class="meta-label">备注</td><td class="meta-val" colspan="3">{{ form.remark }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="pdf-section-title">报价明细</div>
|
||||
<table class="pdf-items-table">
|
||||
<thead>
|
||||
<tr><th>#</th><th>物料名称</th><th>规格</th><th>型号</th><th>单位</th><th>数量</th><th>单价(元)</th><th>金额(元)</th><th>交货期(天)</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(it, ii) in form.items" :key="ii">
|
||||
<td>{{ ii + 1 }}</td>
|
||||
<td>{{ it.materialName }}</td>
|
||||
<td>{{ it.spec || '-' }}</td>
|
||||
<td>{{ it.modelNo || '-' }}</td>
|
||||
<td>{{ it.unit }}</td>
|
||||
<td>{{ it.quantity }}</td>
|
||||
<td>{{ it.unitPrice }}</td>
|
||||
<td class="amount-cell">{{ it.totalPrice }}</td>
|
||||
<td>{{ it.deliveryDays || '-' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="7" style="text-align:right;font-weight:bold;padding:10px 8px">合计金额</td>
|
||||
<td class="amount-cell total-cell" colspan="2">¥{{ grandTotal }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<div class="pdf-note">
|
||||
<strong>说明:</strong>本报价单有效期至 {{ form.validityDate | dateFmt }},逾期视为自动失效。
|
||||
如有疑问请联系我方销售人员。
|
||||
</div>
|
||||
<div class="pdf-footer">福安德综合报价系统 · 生成时间:{{ new Date().toLocaleString('zh-CN') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getClientQuote, addClientQuote, updateClientQuote } from "@/api/bid/clientquote";
|
||||
import { listRfq } from "@/api/bid/rfq";
|
||||
import logoImg from "@/assets/logo/logo.png";
|
||||
import html2canvas from "html2canvas";
|
||||
import jsPDF from "jspdf";
|
||||
|
||||
export default {
|
||||
name: "ClientQuoteDetail",
|
||||
filters: {
|
||||
dateFmt(v) { return v ? (typeof v === "string" ? v.substring(0, 10) : new Date(v).toLocaleDateString("zh-CN")) : "-"; }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isNew: false,
|
||||
loading: false,
|
||||
saving: false,
|
||||
pdfLoading: false,
|
||||
rfqOptions: [],
|
||||
logoSrc: logoImg,
|
||||
today: new Date().toLocaleDateString("zh-CN"),
|
||||
form: {
|
||||
quoteId: null, quoteNo: "", clientName: "", rfqId: null, rfqNo: "", rfqTitle: "",
|
||||
status: "draft", validityDate: "", currency: "CNY", remark: "", totalAmount: 0,
|
||||
items: []
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
grandTotal() {
|
||||
return (this.form.items || []).reduce((s, i) => s + (parseFloat(i.totalPrice) || 0), 0).toFixed(2);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
listRfq({ pageSize: 200 }).then(r => { this.rfqOptions = r.rows || []; });
|
||||
const qid = this.$route.query.quoteId;
|
||||
if (qid && qid !== "__new__") {
|
||||
this.loadData(qid);
|
||||
} else {
|
||||
this.isNew = true;
|
||||
this.form.items = [];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadData(id) {
|
||||
this.loading = true;
|
||||
getClientQuote(id).then(res => {
|
||||
this.form = res.data || {};
|
||||
if (!this.form.items) this.form.items = [];
|
||||
this.loading = false;
|
||||
}).catch(() => { this.loading = false; });
|
||||
},
|
||||
onRfqSelect(rfqId) {
|
||||
const rfq = this.rfqOptions.find(r => r.rfqId === rfqId);
|
||||
if (rfq) { this.form.rfqNo = rfq.rfqNo; this.form.rfqTitle = rfq.rfqTitle; }
|
||||
},
|
||||
addItem() {
|
||||
this.form.items.push({ materialName: "", spec: "", modelNo: "", unit: "件", quantity: 1, costPrice: 0, unitPrice: 0, totalPrice: "0.00", deliveryDays: null });
|
||||
},
|
||||
removeItem(idx) { this.form.items.splice(idx, 1); },
|
||||
calcRow(row) {
|
||||
const q = parseFloat(row.quantity) || 0;
|
||||
const p = parseFloat(row.unitPrice) || 0;
|
||||
row.totalPrice = (q * p).toFixed(2);
|
||||
},
|
||||
calcMargin(row) {
|
||||
const cost = parseFloat(row.costPrice) || 0;
|
||||
const price = parseFloat(row.unitPrice) || 0;
|
||||
if (!price) return "0.0";
|
||||
return (((price - cost) / price) * 100).toFixed(1);
|
||||
},
|
||||
marginColor(row) {
|
||||
const m = parseFloat(this.calcMargin(row));
|
||||
if (m >= 20) return "#67c23a";
|
||||
if (m >= 10) return "#e6a23c";
|
||||
return "#f56c6c";
|
||||
},
|
||||
handleSave() {
|
||||
this.saving = true;
|
||||
this.form.totalAmount = parseFloat(this.grandTotal);
|
||||
const action = this.form.quoteId ? updateClientQuote : addClientQuote;
|
||||
action(this.form).then(res => {
|
||||
if (!this.form.quoteId && res.data) {
|
||||
this.form = { ...this.form, ...res.data };
|
||||
}
|
||||
this.$modal.msgSuccess("保存成功");
|
||||
this.isNew = false;
|
||||
this.saving = false;
|
||||
}).catch(() => { this.saving = false; });
|
||||
},
|
||||
async exportPdf() {
|
||||
this.pdfLoading = true;
|
||||
await this.$nextTick();
|
||||
await new Promise(r => setTimeout(r, 300));
|
||||
try {
|
||||
const el = document.getElementById("cq-pdf-area");
|
||||
el.style.cssText = "position:absolute;left:-9999px;top:0;width:794px;background:#fff;z-index:-1";
|
||||
const canvas = await html2canvas(el, { scale: 2, useCORS: true, backgroundColor: "#ffffff", width: 794 });
|
||||
el.style.cssText = "position:absolute;left:-9999px;top:0;width:794px;background:#fff";
|
||||
const imgData = canvas.toDataURL("image/png");
|
||||
const pdf = new jsPDF({ orientation: "p", unit: "mm", format: "a4" });
|
||||
const pageW = pdf.internal.pageSize.getWidth();
|
||||
const pageH = pdf.internal.pageSize.getHeight();
|
||||
const imgH = (canvas.height * pageW) / canvas.width;
|
||||
let yPos = 0, remaining = imgH, first = true;
|
||||
while (remaining > 0) {
|
||||
if (!first) pdf.addPage();
|
||||
pdf.addImage(imgData, "PNG", 0, yPos, pageW, imgH);
|
||||
yPos -= pageH; remaining -= pageH; first = false;
|
||||
}
|
||||
const name = "报价单_" + (this.form.quoteNo || "新建") + "_" + this.form.clientName + ".pdf";
|
||||
pdf.save(name);
|
||||
this.$message.success("PDF 已导出");
|
||||
} catch(e) { this.$message.error("导出失败:" + e.message); }
|
||||
finally { this.pdfLoading = false; }
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.cq-detail { padding-bottom: 40px; }
|
||||
.page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; padding:16px 0; border-bottom:1px solid #f0f2f5; flex-wrap:wrap; gap:10px; }
|
||||
.page-header-left { display:flex; align-items:center; gap:12px; }
|
||||
.page-header-right { display:flex; gap:10px; }
|
||||
.page-title { font-size:18px; font-weight:700; color:#1a2c4e; }
|
||||
.info-card ::v-deep .el-card__body { padding: 20px; }
|
||||
.total-bar { display:flex; align-items:center; justify-content:flex-end; padding:16px 20px; border-top:1px solid #f0f2f5; background:#fafbfc; }
|
||||
/* PDF */
|
||||
.pdf-area { padding:28px; font-family:"Microsoft YaHei","Noto Sans SC",Arial,sans-serif; font-size:13px; color:#222; }
|
||||
.pdf-header { display:flex; align-items:flex-start; padding-bottom:12px; }
|
||||
.pdf-logo { width:52px; height:52px; object-fit:contain; margin-right:14px; }
|
||||
.pdf-header-text { flex:1; }
|
||||
.pdf-company { font-size:22px; font-weight:700; color:#1171c4; }
|
||||
.pdf-doc-type { font-size:14px; color:#333; margin-top:4px; font-weight:600; }
|
||||
.pdf-header-meta { font-size:12px; color:#888; text-align:right; }
|
||||
.pdf-divider { border-top:2px solid #1171c4; margin:0 0 16px; }
|
||||
.pdf-meta-table { width:100%; border-collapse:collapse; margin-bottom:16px; td { padding:7px 10px; border:1px solid #e4e7ed; } }
|
||||
.meta-label { background:#f5f7fa; color:#606266; font-weight:600; width:90px; }
|
||||
.meta-val { color:#303133; }
|
||||
.pdf-section-title { font-size:14px; font-weight:700; color:#1a2c4e; margin:0 0 10px; padding-left:8px; border-left:4px solid #1171c4; }
|
||||
.pdf-items-table { width:100%; border-collapse:collapse; margin-bottom:20px;
|
||||
th { background:#1171c4; color:#fff; padding:8px; text-align:center; font-size:12px; font-weight:600; }
|
||||
td { border:1px solid #e4e7ed; padding:7px 8px; text-align:center; font-size:12px; }
|
||||
tbody tr:nth-child(even) td { background:#f9fbff; }
|
||||
}
|
||||
.amount-cell { color:#409EFF; font-weight:600; }
|
||||
.total-cell { font-size:14px; background:#f0f7ff !important; font-weight:700; }
|
||||
.pdf-note { background:#fffbf0; border:1px solid #faecd8; border-radius:4px; padding:10px 14px; font-size:12px; color:#606266; margin-bottom:16px; }
|
||||
.pdf-footer { text-align:center; font-size:11px; color:#aaa; border-top:1px solid #f0f2f5; padding-top:12px; }
|
||||
</style>
|
||||
113
ruoyi-ui/src/views/bid/clientquote/index.vue
Normal file
113
ruoyi-ui/src/views/bid/clientquote/index.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
|
||||
<el-form-item label="报价单号" prop="quoteNo">
|
||||
<el-input v-model="queryParams.quoteNo" placeholder="请输入报价单号" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="客户名称" prop="clientName">
|
||||
<el-input v-model="queryParams.clientName" placeholder="请输入客户名称" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="全部" clearable style="width:110px">
|
||||
<el-option label="草稿" value="draft" />
|
||||
<el-option label="已发送" value="sent" />
|
||||
<el-option label="已确认" value="confirmed" />
|
||||
<el-option label="已拒绝" value="rejected" />
|
||||
</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">新建报价单</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="quoteList" border>
|
||||
<el-table-column label="报价单号" prop="quoteNo" width="160" />
|
||||
<el-table-column label="客户名称" prop="clientName" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="关联询价单" prop="rfqNo" width="140" />
|
||||
<el-table-column label="总金额" prop="totalAmount" width="120" align="right">
|
||||
<template slot-scope="s">
|
||||
<strong style="color:#409EFF">¥{{ s.row.totalAmount | money }}</strong>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="币种" prop="currency" width="70" align="center" />
|
||||
<el-table-column label="有效期" prop="validityDate" width="110" align="center">
|
||||
<template slot-scope="s">{{ s.row.validityDate | date }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="90" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-tag :type="statusType(s.row.status)" size="mini">{{ statusLabel(s.row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="createTime" width="160" align="center" />
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<template slot-scope="s">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="goDetail(s.row)">详情/编辑</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" style="color:#f56c6c" @click="handleDelete(s.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listClientQuote, delClientQuote, addClientQuote } from "@/api/bid/clientquote";
|
||||
export default {
|
||||
name: "ClientQuote",
|
||||
filters: {
|
||||
money(v) { return v ? Number(v).toFixed(2) : "0.00"; },
|
||||
date(v) { return v ? v.substring(0, 10) : "-"; }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
quoteList: [],
|
||||
total: 0,
|
||||
queryParams: { pageNum: 1, pageSize: 10, quoteNo: null, clientName: null, status: null }
|
||||
};
|
||||
},
|
||||
created() { this.getList(); },
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listClientQuote(this.queryParams).then(res => {
|
||||
this.quoteList = res.rows || [];
|
||||
this.total = res.total || 0;
|
||||
this.loading = false;
|
||||
}).catch(() => { this.loading = false; });
|
||||
},
|
||||
handleQuery() { this.queryParams.pageNum = 1; this.getList(); },
|
||||
resetQuery() { this.resetForm("queryForm"); this.handleQuery(); },
|
||||
handleAdd() {
|
||||
// Create draft then navigate
|
||||
addClientQuote({ status: "draft", currency: "CNY", items: [] }).then(res => {
|
||||
const id = res.data && res.data.quoteId;
|
||||
if (id) this.$router.push({ path: "/bid/clientquote/detail", query: { quoteId: id } });
|
||||
else this.$router.push({ path: "/bid/clientquote/detail", query: { quoteId: "__new__" } });
|
||||
}).catch(() => {
|
||||
this.$router.push({ path: "/bid/clientquote/detail", query: { quoteId: "__new__" } });
|
||||
});
|
||||
},
|
||||
goDetail(row) {
|
||||
this.$router.push({ path: "/bid/clientquote/detail", query: { quoteId: row.quoteId } });
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm("确认删除报价单【" + row.quoteNo + "】?").then(() => {
|
||||
return delClientQuote(row.quoteId);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
statusType(s) { return { draft: "info", sent: "primary", confirmed: "success", rejected: "danger" }[s] || "info"; },
|
||||
statusLabel(s) { return { draft: "草稿", sent: "已发送", confirmed: "已确认", rejected: "已拒绝" }[s] || s; }
|
||||
}
|
||||
};
|
||||
</script>
|
||||
341
ruoyi-ui/src/views/bid/comparison/detail.vue
Normal file
341
ruoyi-ui/src/views/bid/comparison/detail.vue
Normal file
@@ -0,0 +1,341 @@
|
||||
<template>
|
||||
<div class="app-container comparison-detail">
|
||||
<!-- 顶部面包屑/标题区 -->
|
||||
<div class="page-header">
|
||||
<div class="page-header-left">
|
||||
<el-button icon="el-icon-arrow-left" size="small" @click="$router.back()">返回列表</el-button>
|
||||
<span class="page-title">智慧比价分析</span>
|
||||
<el-tag v-if="result" type="primary" style="margin-left:8px">{{ result.rfqNo }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="loading-box">
|
||||
<i class="el-icon-loading"></i> 正在加载比价数据…
|
||||
</div>
|
||||
|
||||
<div v-if="!loading && result">
|
||||
<el-tabs v-model="activeTab" type="border-card" class="main-tabs">
|
||||
|
||||
<!-- ══ Tab 1: 多维度比价 ══ -->
|
||||
<el-tab-pane label="📊 多维度比价" name="compare">
|
||||
<div v-for="(item, idx) in result.items" :key="item.rfqItemId" class="item-block">
|
||||
<div class="item-header">
|
||||
<span class="item-badge">物料 {{ idx + 1 }}</span>
|
||||
<strong class="item-name">{{ item.materialName }}</strong>
|
||||
<span class="item-spec" v-if="item.spec">规格:{{ item.spec }}</span>
|
||||
<span class="item-qty">需求数量:{{ item.quantity }} {{ item.unit }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="!item.prices || !item.prices.length" class="no-quote">暂无供应商报价</div>
|
||||
<div v-else>
|
||||
<div class="supplier-cards">
|
||||
<div v-for="(sp, si) in item.prices" :key="sp.supplierId"
|
||||
class="supplier-card" :class="{ 'best-card': si === 0 }">
|
||||
<div class="card-rank">
|
||||
<span class="rank-num" :class="'rank-'+(si+1)">{{ si + 1 }}</span>
|
||||
<el-tag v-if="sp.rankBadge" size="mini" :type="badgeType(sp.rankBadge)">{{ sp.rankBadge }}</el-tag>
|
||||
</div>
|
||||
<div class="card-supplier">{{ sp.supplierName }}</div>
|
||||
<div class="card-score-big" :class="scoreClass(sp.compositeScore)">
|
||||
{{ sp.compositeScore.toFixed(1) }}<span class="score-unit">分</span>
|
||||
</div>
|
||||
<div class="card-price">¥{{ sp.unitPrice }} / {{ item.unit }}</div>
|
||||
<div class="dim-bars">
|
||||
<div class="dim-row" v-for="(d,di) in [{l:'价格',v:sp.priceScore},{l:'交期',v:sp.deliveryScore},{l:'质量',v:sp.qualityScore},{l:'服务',v:sp.serviceScore}]" :key="di">
|
||||
<span class="dim-label">{{ d.l }}</span>
|
||||
<el-progress :percentage="d.v" :stroke-width="6" :color="dimColor(d.v)" :show-text="false" class="dim-bar" />
|
||||
<span class="dim-val">{{ d.v.toFixed(0) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-meta">交货 {{ sp.deliveryDays }} 天<span v-if="sp.historyCount > 0"> · 历史 {{ sp.historyCount }} 次</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="item.prices" border size="small" class="detail-table">
|
||||
<el-table-column label="供应商" prop="supplierName" min-width="140" />
|
||||
<el-table-column label="报价单号" prop="quoteNo" width="130" />
|
||||
<el-table-column label="单价(元)" prop="unitPrice" width="110" align="right">
|
||||
<template slot-scope="s">
|
||||
<span :class="s.row.lowestPrice ? 'price-low' : ''">¥{{ s.row.unitPrice }}</span>
|
||||
<el-tag v-if="s.row.lowestPrice" type="success" size="mini" style="margin-left:4px">最低</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总价(元)" width="120" align="right">
|
||||
<template slot-scope="s">¥{{ s.row.totalPrice }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交期(天)" prop="deliveryDays" width="85" align="center" />
|
||||
<el-table-column label="价格" width="75" align="center"><template slot-scope="s"><span :class="scoreClass(s.row.priceScore)">{{ s.row.priceScore }}</span></template></el-table-column>
|
||||
<el-table-column label="交期" width="75" align="center"><template slot-scope="s"><span :class="scoreClass(s.row.deliveryScore)">{{ s.row.deliveryScore }}</span></template></el-table-column>
|
||||
<el-table-column label="质量" width="75" align="center"><template slot-scope="s"><span :class="scoreClass(s.row.qualityScore)">{{ s.row.qualityScore }}</span></template></el-table-column>
|
||||
<el-table-column label="服务" width="75" align="center"><template slot-scope="s"><span :class="scoreClass(s.row.serviceScore)">{{ s.row.serviceScore }}</span></template></el-table-column>
|
||||
<el-table-column label="综合" width="85" align="center"><template slot-scope="s"><strong :class="scoreClass(s.row.compositeScore)">{{ s.row.compositeScore }}</strong></template></el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ══ Tab 2: 选择采购方案 ══ -->
|
||||
<el-tab-pane name="plan">
|
||||
<span slot="label">🎯 选择采购方案 <el-badge :value="result.recommendedPlans.length" type="primary" /></span>
|
||||
|
||||
<el-alert type="info" :closable="false" show-icon style="margin-bottom:20px">
|
||||
<template slot="title">
|
||||
评分权重:价格40% + 交期25% + 历史质量20% + 历史服务15%。勾选方案中您想要采购的物料行,最后点击「生成采购方案 PDF」。
|
||||
</template>
|
||||
</el-alert>
|
||||
|
||||
<div v-if="!result.recommendedPlans.length" class="no-quote" style="margin:40px auto">
|
||||
暂无可用报价,无法生成推荐方案
|
||||
</div>
|
||||
|
||||
<div v-for="(plan, pi) in result.recommendedPlans" :key="plan.supplierId" class="plan-card">
|
||||
<div class="plan-header">
|
||||
<div class="plan-title">
|
||||
<span class="plan-rank">方案 {{ pi + 1 }}</span>
|
||||
<strong class="plan-supplier">{{ plan.supplierName }}</strong>
|
||||
<el-tag type="success" size="small" style="margin-left:12px">综合评分 {{ plan.avgCompositeScore.toFixed(1) }} 分</el-tag>
|
||||
</div>
|
||||
<div class="plan-actions">
|
||||
<el-checkbox v-model="planSelected[plan.supplierId]" @change="onPlanCheck(plan)">
|
||||
选中整个方案
|
||||
</el-checkbox>
|
||||
<span class="plan-total">合计:<strong>¥{{ selectedTotal(plan) }}</strong></span>
|
||||
<el-button type="primary" size="small" icon="el-icon-download"
|
||||
:loading="pdfLoading[plan.supplierId]" @click="exportPlanPdf(plan, pi)">
|
||||
导出 PDF
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="plan-reason"><i class="el-icon-info" style="color:#409EFF;margin-right:4px"></i>{{ plan.clusterReason }}</div>
|
||||
|
||||
<el-table :data="plan.items" border size="small" class="plan-table"
|
||||
@selection-change="(sel) => onItemSelect(plan, sel)">
|
||||
<el-table-column type="selection" width="46" />
|
||||
<el-table-column type="index" width="46" label="#" />
|
||||
<el-table-column label="物料名称" prop="materialName" min-width="140" />
|
||||
<el-table-column label="规格" prop="spec" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="单位" prop="unit" width="70" align="center" />
|
||||
<el-table-column label="数量" prop="quantity" width="80" align="right" />
|
||||
<el-table-column label="单价(元)" prop="unitPrice" width="110" align="right">
|
||||
<template slot-scope="s">¥{{ s.row.unitPrice }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额(元)" width="120" align="right">
|
||||
<template slot-scope="s"><strong style="color:#409EFF">¥{{ s.row.totalPrice }}</strong></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交期(天)" prop="deliveryDays" width="85" align="center" />
|
||||
<el-table-column label="综合分" width="80" align="center">
|
||||
<template slot-scope="s"><strong :class="scoreClass(s.row.compositeScore)">{{ s.row.compositeScore }}</strong></template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- Hidden PDF area -->
|
||||
<div :id="'plan-pdf-' + plan.supplierId" class="pdf-area" style="position:absolute;left:-9999px;top:0;width:794px;background:#fff">
|
||||
<div class="pdf-header">
|
||||
<img :src="logoSrc" class="pdf-logo" />
|
||||
<div class="pdf-header-text">
|
||||
<div class="pdf-company">福安德综合报价系统</div>
|
||||
<div class="pdf-doc-type">智慧比价推荐采购方案</div>
|
||||
</div>
|
||||
<div class="pdf-header-meta">
|
||||
<div>生成日期:{{ today }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pdf-divider"></div>
|
||||
<table class="pdf-meta-table">
|
||||
<tr><td class="meta-label">询价单</td><td class="meta-val" colspan="3">{{ result.rfqNo }} — {{ result.rfqTitle }}</td></tr>
|
||||
<tr>
|
||||
<td class="meta-label">推荐供应商</td><td class="meta-val">{{ plan.supplierName }}</td>
|
||||
<td class="meta-label">综合评分</td><td class="meta-val score-good">{{ plan.avgCompositeScore.toFixed(1) }} / 100</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="meta-label">合计金额</td>
|
||||
<td class="meta-val amount-big" colspan="3">¥{{ selectedTotal(plan) }}</td>
|
||||
</tr>
|
||||
<tr><td class="meta-label">推荐依据</td><td class="meta-val" colspan="3">{{ plan.clusterReason }}</td></tr>
|
||||
</table>
|
||||
<div class="pdf-score-legend">
|
||||
<strong>评分权重说明:</strong>价格40% | 交期25% | 历史质量20% | 服务水平15%
|
||||
</div>
|
||||
<div class="pdf-section-title">采购物料明细</div>
|
||||
<table class="pdf-items-table">
|
||||
<thead><tr><th>#</th><th>物料名称</th><th>规格</th><th>单位</th><th>数量</th><th>单价</th><th>金额</th><th>交期(天)</th><th>综合分</th></tr></thead>
|
||||
<tbody>
|
||||
<tr v-for="(it,ii) in selectedItems(plan)" :key="ii">
|
||||
<td>{{ ii + 1 }}</td><td>{{ it.materialName }}</td><td>{{ it.spec || '-' }}</td>
|
||||
<td>{{ it.unit }}</td><td>{{ it.quantity }}</td>
|
||||
<td>{{ it.unitPrice }}</td><td class="amount-cell">{{ it.totalPrice }}</td>
|
||||
<td>{{ it.deliveryDays }}</td>
|
||||
<td :class="'score-cell ' + scorePdfClass(it.compositeScore)">{{ it.compositeScore }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><td colspan="6" style="text-align:right;font-weight:bold;padding:10px 8px">合计</td>
|
||||
<td class="amount-cell total-cell" colspan="3">¥{{ selectedTotal(plan) }}</td></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<div class="pdf-footer">本方案由福安德智慧报价系统自动生成 · {{ new Date().toLocaleString('zh-CN') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { compareRfq } from "@/api/bid/comparison";
|
||||
import logoImg from "@/assets/logo/logo.png";
|
||||
import html2canvas from "html2canvas";
|
||||
import jsPDF from "jspdf";
|
||||
|
||||
export default {
|
||||
name: "ComparisonDetail",
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
result: null,
|
||||
activeTab: "compare",
|
||||
logoSrc: logoImg,
|
||||
pdfLoading: {},
|
||||
planSelected: {},
|
||||
selectedRows: {}, // { supplierId: [row,...] }
|
||||
today: new Date().toLocaleDateString("zh-CN")
|
||||
};
|
||||
},
|
||||
created() {
|
||||
const rfqId = this.$route.query.rfqId;
|
||||
if (rfqId) this.loadData(rfqId);
|
||||
},
|
||||
methods: {
|
||||
loadData(rfqId) {
|
||||
this.loading = true;
|
||||
compareRfq(rfqId).then(r => {
|
||||
this.result = r.data;
|
||||
// init selection = all items
|
||||
if (this.result && this.result.recommendedPlans) {
|
||||
this.result.recommendedPlans.forEach(p => {
|
||||
this.$set(this.planSelected, p.supplierId, true);
|
||||
this.$set(this.selectedRows, p.supplierId, [...p.items]);
|
||||
});
|
||||
}
|
||||
this.loading = false;
|
||||
}).catch(() => { this.loading = false; });
|
||||
},
|
||||
onPlanCheck(plan) {
|
||||
if (this.planSelected[plan.supplierId]) {
|
||||
this.$set(this.selectedRows, plan.supplierId, [...plan.items]);
|
||||
} else {
|
||||
this.$set(this.selectedRows, plan.supplierId, []);
|
||||
}
|
||||
},
|
||||
onItemSelect(plan, sel) {
|
||||
this.$set(this.selectedRows, plan.supplierId, sel);
|
||||
this.$set(this.planSelected, plan.supplierId, sel.length === plan.items.length);
|
||||
},
|
||||
selectedItems(plan) {
|
||||
return this.selectedRows[plan.supplierId] || plan.items;
|
||||
},
|
||||
selectedTotal(plan) {
|
||||
const items = this.selectedRows[plan.supplierId] || plan.items;
|
||||
return items.reduce((s, i) => s + (parseFloat(i.totalPrice) || 0), 0).toFixed(2);
|
||||
},
|
||||
async exportPlanPdf(plan, idx) {
|
||||
if ((this.selectedRows[plan.supplierId] || []).length === 0) {
|
||||
this.$message.warning("请先勾选要导出的物料行");
|
||||
return;
|
||||
}
|
||||
this.$set(this.pdfLoading, plan.supplierId, true);
|
||||
await this.$nextTick();
|
||||
await new Promise(r => setTimeout(r, 300));
|
||||
try {
|
||||
const el = document.getElementById("plan-pdf-" + plan.supplierId);
|
||||
const origStyle = el.style.cssText;
|
||||
el.style.cssText = "position:absolute;left:-9999px;top:0;width:794px;background:#fff;z-index:-1";
|
||||
const canvas = await html2canvas(el, { scale: 2, useCORS: true, backgroundColor: "#ffffff", width: 794 });
|
||||
el.style.cssText = origStyle;
|
||||
const imgData = canvas.toDataURL("image/png");
|
||||
const pdf = new jsPDF({ orientation: "p", unit: "mm", format: "a4" });
|
||||
const pageW = pdf.internal.pageSize.getWidth();
|
||||
const pageH = pdf.internal.pageSize.getHeight();
|
||||
const imgH = (canvas.height * pageW) / canvas.width;
|
||||
let yPos = 0, remaining = imgH, first = true;
|
||||
while (remaining > 0) {
|
||||
if (!first) pdf.addPage();
|
||||
pdf.addImage(imgData, "PNG", 0, yPos, pageW, imgH);
|
||||
yPos -= pageH; remaining -= pageH; first = false;
|
||||
}
|
||||
pdf.save("采购方案_" + plan.supplierName + ".pdf");
|
||||
this.$message.success("PDF 已导出");
|
||||
} catch(e) { this.$message.error("导出失败:" + e.message); }
|
||||
finally { this.$set(this.pdfLoading, plan.supplierId, false); }
|
||||
},
|
||||
badgeType(b) { return { "综合最优": "success", "价格最低": "warning", "交期最快": "primary" }[b] || "info"; },
|
||||
scoreClass(s) { return s >= 80 ? "score-high" : s >= 60 ? "score-mid" : "score-low"; },
|
||||
scorePdfClass(s) { return s >= 80 ? "score-good" : s >= 60 ? "score-ok" : "score-weak"; },
|
||||
dimColor(v) { return v >= 80 ? "#67c23a" : v >= 60 ? "#e6a23c" : "#f56c6c"; }
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.comparison-detail { padding-bottom: 40px; }
|
||||
.page-header { display:flex; align-items:center; margin-bottom:20px; padding:16px 0; border-bottom:1px solid #f0f2f5; }
|
||||
.page-header-left { display:flex; align-items:center; gap:12px; }
|
||||
.page-title { font-size:18px; font-weight:700; color:#1a2c4e; }
|
||||
.loading-box { text-align:center; padding:80px; color:#909399; font-size:15px; i { font-size:24px; margin-right:8px; } }
|
||||
.main-tabs { ::v-deep .el-tabs__content { padding: 20px; } }
|
||||
.item-block { margin-bottom: 32px; }
|
||||
.item-header { background:linear-gradient(90deg,#1171c4,#22a4ff); color:#fff; padding:10px 16px; border-radius:6px 6px 0 0; display:flex; align-items:center; gap:10px; }
|
||||
.item-badge { background:rgba(255,255,255,.25); padding:2px 10px; border-radius:12px; font-size:12px; }
|
||||
.item-name { font-size:15px; font-weight:700; }
|
||||
.item-spec { color:rgba(255,255,255,.8); font-size:13px; }
|
||||
.item-qty { margin-left:auto; font-size:12px; color:rgba(255,255,255,.8); }
|
||||
.no-quote { padding:20px; color:#909399; background:#fafafa; border:1px dashed #e4e7ed; border-radius:4px; text-align:center; }
|
||||
.supplier-cards { display:flex; gap:12px; padding:16px 0; overflow-x:auto; }
|
||||
.supplier-card { flex:0 0 200px; border:1px solid #e4e7ed; border-radius:8px; padding:14px; background:#fff; &:hover { box-shadow:0 4px 16px rgba(0,0,0,.1); } &.best-card { border-color:#67c23a; box-shadow:0 2px 8px rgba(103,194,58,.2); } }
|
||||
.card-rank { display:flex; align-items:center; gap:6px; margin-bottom:8px; }
|
||||
.rank-num { width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; &.rank-1 { background:#f7ba2a; color:#fff; } &.rank-2 { background:#c0c4cc; color:#fff; } &.rank-3 { background:#a57c52; color:#fff; } }
|
||||
.card-supplier { font-size:13px; font-weight:600; color:#303133; margin-bottom:6px; }
|
||||
.card-score-big { font-size:28px; font-weight:700; line-height:1; margin:8px 0; &.score-high { color:#67c23a; } &.score-mid { color:#e6a23c; } &.score-low { color:#f56c6c; } .score-unit { font-size:13px; font-weight:400; } }
|
||||
.card-price { font-size:13px; color:#409EFF; font-weight:600; margin-bottom:10px; }
|
||||
.dim-bars { display:flex; flex-direction:column; gap:4px; }
|
||||
.dim-row { display:flex; align-items:center; gap:6px; }
|
||||
.dim-label { font-size:11px; color:#909399; width:24px; flex-shrink:0; }
|
||||
.dim-bar { flex:1; }
|
||||
.dim-val { font-size:11px; color:#606266; width:24px; text-align:right; flex-shrink:0; }
|
||||
.card-meta { font-size:11px; color:#c0c4cc; margin-top:8px; }
|
||||
.score-high { color:#67c23a; font-weight:700; }
|
||||
.score-mid { color:#e6a23c; font-weight:600; }
|
||||
.score-low { color:#f56c6c; }
|
||||
.price-low { color:#67c23a; font-weight:700; }
|
||||
.plan-card { border:1px solid #e4e7ed; border-radius:8px; margin-bottom:24px; overflow:hidden; background:#fff; position:relative; }
|
||||
.plan-header { display:flex; align-items:center; justify-content:space-between; padding:14px 20px; background:linear-gradient(90deg,#f0f7ff,#fff); border-bottom:1px solid #e4e7ed; flex-wrap:wrap; gap:10px; }
|
||||
.plan-title { display:flex; align-items:center; gap:10px; }
|
||||
.plan-rank { background:#1171c4; color:#fff; padding:3px 10px; border-radius:12px; font-size:12px; }
|
||||
.plan-supplier { font-size:16px; font-weight:700; color:#1a2c4e; }
|
||||
.plan-actions { display:flex; align-items:center; gap:16px; flex-wrap:wrap; }
|
||||
.plan-total { font-size:14px; color:#606266; strong { font-size:18px; color:#409EFF; } }
|
||||
.plan-reason { padding:8px 20px; font-size:13px; color:#606266; background:#f9fbff; border-bottom:1px solid #f0f2f5; }
|
||||
/* PDF */
|
||||
.pdf-area { padding:28px; background:#fff; font-family:"Microsoft YaHei","Noto Sans SC",Arial,sans-serif; font-size:13px; color:#222; }
|
||||
.pdf-header { display:flex; align-items:flex-start; padding-bottom:12px; }
|
||||
.pdf-logo { width:52px; height:52px; object-fit:contain; margin-right:14px; }
|
||||
.pdf-header-text { flex:1; }
|
||||
.pdf-company { font-size:22px; font-weight:700; color:#1171c4; }
|
||||
.pdf-doc-type { font-size:13px; color:#666; margin-top:2px; }
|
||||
.pdf-header-meta { font-size:12px; color:#888; text-align:right; }
|
||||
.pdf-divider { border-top:2px solid #1171c4; margin:0 0 16px; }
|
||||
.pdf-meta-table { width:100%; border-collapse:collapse; margin-bottom:16px; td { padding:7px 10px; border:1px solid #e4e7ed; } }
|
||||
.meta-label { background:#f5f7fa; color:#606266; font-weight:600; width:90px; }
|
||||
.meta-val { color:#303133; }
|
||||
.amount-big { color:#409EFF; font-weight:700; font-size:16px; }
|
||||
.score-good { color:#67c23a; font-weight:700; }
|
||||
.score-ok { color:#e6a23c; font-weight:600; }
|
||||
.score-weak { color:#f56c6c; }
|
||||
.pdf-score-legend { background:#f0f7ff; border:1px solid #c6e2ff; border-radius:4px; padding:8px 14px; font-size:12px; color:#606266; margin-bottom:16px; }
|
||||
.pdf-section-title { font-size:14px; font-weight:700; color:#1a2c4e; margin:0 0 10px; padding-left:8px; border-left:4px solid #1171c4; }
|
||||
.pdf-items-table { width:100%; border-collapse:collapse; margin-bottom:20px; th { background:#1171c4; color:#fff; padding:8px; text-align:center; font-weight:600; font-size:12px; } td { border:1px solid #e4e7ed; padding:7px 8px; text-align:center; font-size:12px; } tbody tr:nth-child(even) td { background:#f9fbff; } }
|
||||
.amount-cell { color:#409EFF; font-weight:600; }
|
||||
.total-cell { font-size:14px; background:#f0f7ff !important; font-weight:700; }
|
||||
.pdf-footer { text-align:center; font-size:11px; color:#aaa; margin-top:16px; border-top:1px solid #f0f2f5; padding-top:12px; }
|
||||
</style>
|
||||
@@ -1,495 +1,96 @@
|
||||
<template>
|
||||
<div class="app-container comparison-page">
|
||||
<!-- ── 顶部选择栏 ── -->
|
||||
<el-card class="filter-card" shadow="never">
|
||||
<div class="app-container">
|
||||
<el-card class="search-card" shadow="never">
|
||||
<el-form :inline="true" size="small">
|
||||
<el-form-item label="选择询价单">
|
||||
<el-select v-model="selectedRfqId" placeholder="请选择要比价的RFQ" filterable style="width:360px" @change="resetResult">
|
||||
<el-option v-for="r in rfqOptions" :key="r.rfqId" :label="r.rfqNo + ' — ' + r.rfqTitle" :value="r.rfqId" />
|
||||
</el-select>
|
||||
<el-form-item label="询价单号">
|
||||
<el-input v-model="queryParams.rfqNo" placeholder="请输入询价单号" clearable @keyup.enter.native="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="询价标题">
|
||||
<el-input v-model="queryParams.rfqTitle" placeholder="请输入询价标题" clearable @keyup.enter.native="getList" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-data-analysis" @click="doCompare" :loading="loading">开始智慧比价</el-button>
|
||||
<el-button type="primary" icon="el-icon-search" @click="getList">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- ── 空状态 ── -->
|
||||
<div v-if="!result && !loading" class="empty-state">
|
||||
<i class="el-icon-data-analysis"></i>
|
||||
<p>选择询价单,点击「开始智慧比价」查看多维度分析与推荐方案</p>
|
||||
</div>
|
||||
|
||||
<div v-if="result">
|
||||
<el-tabs v-model="activeTab" type="border-card" class="main-tabs">
|
||||
|
||||
<!-- ══ Tab 1: 维度比价 ══ -->
|
||||
<el-tab-pane label="📊 多维度比价" name="compare">
|
||||
<div v-for="(item, idx) in result.items" :key="item.rfqItemId" class="item-block">
|
||||
<div class="item-header">
|
||||
<span class="item-badge">物料 {{ idx + 1 }}</span>
|
||||
<strong class="item-name">{{ item.materialName }}</strong>
|
||||
<span class="item-spec" v-if="item.spec">{{ item.spec }}</span>
|
||||
<span class="item-qty">需求数量:{{ item.quantity }} {{ item.unit }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="!item.prices || !item.prices.length" class="no-quote">暂无供应商报价</div>
|
||||
<div v-else>
|
||||
<!-- 综合排名卡片 -->
|
||||
<div class="supplier-cards">
|
||||
<div v-for="(sp, si) in item.prices" :key="sp.supplierId"
|
||||
class="supplier-card" :class="{ 'best-card': si === 0 }">
|
||||
<div class="card-rank">
|
||||
<span class="rank-num" :class="'rank-' + (si+1)">{{ si + 1 }}</span>
|
||||
<el-tag v-if="sp.rankBadge" size="mini" :type="badgeType(sp.rankBadge)" class="rank-badge">{{ sp.rankBadge }}</el-tag>
|
||||
</div>
|
||||
<div class="card-supplier">{{ sp.supplierName }}</div>
|
||||
<div class="card-score-big" :class="scoreClass(sp.compositeScore)">
|
||||
{{ sp.compositeScore.toFixed(1) }}
|
||||
<span class="score-unit">分</span>
|
||||
</div>
|
||||
<div class="card-price">¥{{ sp.unitPrice }} / {{ item.unit }}</div>
|
||||
|
||||
<!-- 四维进度条 -->
|
||||
<div class="dim-bars">
|
||||
<div class="dim-row">
|
||||
<span class="dim-label">价格</span>
|
||||
<el-progress :percentage="sp.priceScore" :stroke-width="6" :color="dimColor(sp.priceScore)" :show-text="false" class="dim-bar" />
|
||||
<span class="dim-val">{{ sp.priceScore.toFixed(0) }}</span>
|
||||
</div>
|
||||
<div class="dim-row">
|
||||
<span class="dim-label">交期</span>
|
||||
<el-progress :percentage="sp.deliveryScore" :stroke-width="6" :color="dimColor(sp.deliveryScore)" :show-text="false" class="dim-bar" />
|
||||
<span class="dim-val">{{ sp.deliveryScore.toFixed(0) }}</span>
|
||||
</div>
|
||||
<div class="dim-row">
|
||||
<span class="dim-label">质量</span>
|
||||
<el-progress :percentage="sp.qualityScore" :stroke-width="6" :color="dimColor(sp.qualityScore)" :show-text="false" class="dim-bar" />
|
||||
<span class="dim-val">{{ sp.qualityScore.toFixed(0) }}</span>
|
||||
</div>
|
||||
<div class="dim-row">
|
||||
<span class="dim-label">服务</span>
|
||||
<el-progress :percentage="sp.serviceScore" :stroke-width="6" :color="dimColor(sp.serviceScore)" :show-text="false" class="dim-bar" />
|
||||
<span class="dim-val">{{ sp.serviceScore.toFixed(0) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-meta">
|
||||
交货 {{ sp.deliveryDays }} 天
|
||||
<span v-if="sp.historyCount > 0" style="margin-left:8px">· 历史 {{ sp.historyCount }} 次</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 明细对比表 -->
|
||||
<el-table :data="item.prices" border size="small" class="detail-table">
|
||||
<el-table-column label="供应商" prop="supplierName" min-width="140" />
|
||||
<el-table-column label="报价单号" prop="quoteNo" width="130" />
|
||||
<el-table-column label="单价(元)" prop="unitPrice" width="110" align="right">
|
||||
<template slot-scope="s">
|
||||
<span :class="s.row.lowestPrice ? 'price-low' : ''">¥{{ s.row.unitPrice }}</span>
|
||||
<el-tag v-if="s.row.lowestPrice" type="success" size="mini" style="margin-left:4px">最低</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总价(元)" width="120" align="right">
|
||||
<template slot-scope="s">¥{{ s.row.totalPrice }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交期(天)" prop="deliveryDays" width="85" align="center" />
|
||||
<el-table-column label="价格分" width="80" align="center">
|
||||
<template slot-scope="s"><span :class="scoreClass(s.row.priceScore)">{{ s.row.priceScore }}</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交期分" width="80" align="center">
|
||||
<template slot-scope="s"><span :class="scoreClass(s.row.deliveryScore)">{{ s.row.deliveryScore }}</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="质量分" width="80" align="center">
|
||||
<template slot-scope="s"><span :class="scoreClass(s.row.qualityScore)">{{ s.row.qualityScore }}</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="服务分" width="80" align="center">
|
||||
<template slot-scope="s"><span :class="scoreClass(s.row.serviceScore)">{{ s.row.serviceScore }}</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="综合分" width="90" align="center">
|
||||
<template slot-scope="s">
|
||||
<strong :class="scoreClass(s.row.compositeScore)">{{ s.row.compositeScore }}</strong>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- ══ Tab 2: 推荐采购方案 ══ -->
|
||||
<el-tab-pane name="plan">
|
||||
<span slot="label">🎯 智能推荐方案 <el-badge :value="result.recommendedPlans.length" type="primary" /></span>
|
||||
|
||||
<el-alert type="info" :closable="false" show-icon style="margin-bottom:20px">
|
||||
<template slot="title">
|
||||
算法说明:综合评分 = 价格(40%) + 交期(25%) + 历史质量(20%) + 历史服务(15%)
|
||||
,对每个物料选出综合分最高的供应商,相同供应商的物料合并为一份采购方案。
|
||||
</template>
|
||||
</el-alert>
|
||||
|
||||
<div v-if="!result.recommendedPlans.length" class="no-quote" style="margin:40px auto">
|
||||
暂无可用报价,无法生成推荐方案
|
||||
</div>
|
||||
|
||||
<div v-for="(plan, pi) in result.recommendedPlans" :key="plan.supplierId" class="plan-card">
|
||||
<div class="plan-header">
|
||||
<div class="plan-title">
|
||||
<span class="plan-rank">方案 {{ pi + 1 }}</span>
|
||||
<strong class="plan-supplier">{{ plan.supplierName }}</strong>
|
||||
<el-tag type="success" size="small" style="margin-left:12px">
|
||||
综合评分 {{ plan.avgCompositeScore.toFixed(1) }} 分
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="plan-actions">
|
||||
<span class="plan-total">合计:<strong>¥{{ plan.totalAmount.toFixed ? plan.totalAmount.toFixed(2) : plan.totalAmount }}</strong></span>
|
||||
<el-button type="primary" size="small" icon="el-icon-download"
|
||||
:loading="pdfLoading[plan.supplierId]" @click="exportPlanPdf(plan, pi)">
|
||||
导出 PDF
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="plan-reason">
|
||||
<i class="el-icon-info" style="color:#409EFF;margin-right:4px"></i>{{ plan.clusterReason }}
|
||||
</div>
|
||||
|
||||
<!-- 方案物料表 -->
|
||||
<el-table :data="plan.items" border size="small" class="plan-table">
|
||||
<el-table-column type="index" width="46" label="#" />
|
||||
<el-table-column label="物料名称" prop="materialName" min-width="140" />
|
||||
<el-table-column label="规格" prop="spec" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="单位" prop="unit" width="70" align="center" />
|
||||
<el-table-column label="数量" prop="quantity" width="80" align="right" />
|
||||
<el-table-column label="单价(元)" prop="unitPrice" width="110" align="right">
|
||||
<template slot-scope="s">¥{{ s.row.unitPrice }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额(元)" width="120" align="right">
|
||||
<template slot-scope="s">
|
||||
<strong style="color:#409EFF">¥{{ s.row.totalPrice }}</strong>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="交期(天)" prop="deliveryDays" width="85" align="center" />
|
||||
<el-table-column label="综合分" width="80" align="center">
|
||||
<template slot-scope="s">
|
||||
<strong :class="scoreClass(s.row.compositeScore)">{{ s.row.compositeScore }}</strong>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="推荐标签" width="90" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-tag v-if="s.row.rankBadge" size="mini" :type="badgeType(s.row.rankBadge)">{{ s.row.rankBadge }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 隐藏 PDF 渲染区 -->
|
||||
<div :id="'plan-pdf-' + plan.supplierId" class="pdf-area" style="position:absolute;left:-9999px;top:0;width:794px">
|
||||
<div class="pdf-header">
|
||||
<img :src="logoSrc" class="pdf-logo" />
|
||||
<div class="pdf-header-text">
|
||||
<div class="pdf-company">福安德综合报价系统</div>
|
||||
<div class="pdf-doc-type">智慧比价推荐采购方案</div>
|
||||
</div>
|
||||
<div class="pdf-header-meta">
|
||||
<div>方案编号:方案{{ pi + 1 }}</div>
|
||||
<div>生成日期:{{ today }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pdf-divider"></div>
|
||||
|
||||
<table class="pdf-meta-table">
|
||||
<tr>
|
||||
<td class="meta-label">询价单</td>
|
||||
<td class="meta-val" colspan="3">{{ result.rfqNo }} — {{ result.rfqTitle }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="meta-label">推荐供应商</td><td class="meta-val">{{ plan.supplierName }}</td>
|
||||
<td class="meta-label">综合评分</td><td class="meta-val score-good">{{ plan.avgCompositeScore.toFixed(1) }} / 100</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="meta-label">合计金额</td>
|
||||
<td class="meta-val amount-big" colspan="3">¥{{ plan.totalAmount.toFixed ? plan.totalAmount.toFixed(2) : plan.totalAmount }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="meta-label">推荐依据</td>
|
||||
<td class="meta-val" colspan="3">{{ plan.clusterReason }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="pdf-score-legend">
|
||||
<strong>评分权重说明:</strong>
|
||||
价格占比 40% | 交期占比 25% | 历史质量占比 20% | 服务水平占比 15%
|
||||
</div>
|
||||
|
||||
<div class="pdf-section-title">采购物料明细</div>
|
||||
<table class="pdf-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th><th>物料名称</th><th>规格型号</th><th>单位</th>
|
||||
<th>数量</th><th>单价(元)</th><th>金额(元)</th><th>交货期(天)</th><th>综合评分</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, ii) in plan.items" :key="ii">
|
||||
<td>{{ ii + 1 }}</td>
|
||||
<td>{{ item.materialName }}</td>
|
||||
<td>{{ item.spec || '-' }}</td>
|
||||
<td>{{ item.unit }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.unitPrice }}</td>
|
||||
<td class="amount-cell">{{ item.totalPrice }}</td>
|
||||
<td>{{ item.deliveryDays }}</td>
|
||||
<td :class="'score-cell ' + scorePdfClass(item.compositeScore)">{{ item.compositeScore }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="6" style="text-align:right;font-weight:bold;padding:10px 8px">合计</td>
|
||||
<td class="amount-cell total-cell" colspan="3">¥{{ plan.totalAmount.toFixed ? plan.totalAmount.toFixed(2) : plan.totalAmount }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<div class="pdf-footer">本方案由福安德智慧报价系统自动生成,仅供参考 · 生成时间:{{ new Date().toLocaleString('zh-CN') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
</div>
|
||||
<el-card shadow="never" style="margin-top:12px">
|
||||
<div slot="header" style="font-weight:700;color:#1a2c4e;font-size:15px">
|
||||
<i class="el-icon-data-analysis" style="margin-right:6px;color:#1171c4"></i>
|
||||
选择询价单进行智慧比价
|
||||
</div>
|
||||
<el-table v-loading="loading" :data="rfqList" border>
|
||||
<el-table-column label="询价单号" prop="rfqNo" width="160" />
|
||||
<el-table-column label="询价标题" prop="rfqTitle" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column label="状态" width="90" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-tag :type="statusType(s.row.status)" size="mini">{{ statusLabel(s.row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料数" width="80" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-badge :value="s.row.itemCount || '?'" type="primary" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="createTime" width="160" align="center" />
|
||||
<el-table-column label="操作" align="center" width="180">
|
||||
<template slot-scope="s">
|
||||
<el-button type="primary" size="mini" icon="el-icon-data-analysis"
|
||||
@click="goCompare(s.row)">进入比价</el-button>
|
||||
<el-button type="text" size="mini" icon="el-icon-view"
|
||||
@click="goRfqDetail(s.row)">详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination v-show="total>0" :total="total"
|
||||
:page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { compareRfq } from "@/api/bid/comparison";
|
||||
import { listRfq } from "@/api/bid/rfq";
|
||||
import logoImg from "@/assets/logo/logo.png";
|
||||
import html2canvas from "html2canvas";
|
||||
import jsPDF from "jspdf";
|
||||
|
||||
export default {
|
||||
name: "Comparison",
|
||||
name: "ComparisonList",
|
||||
data() {
|
||||
return {
|
||||
selectedRfqId: null,
|
||||
loading: false,
|
||||
result: null,
|
||||
activeTab: "compare",
|
||||
rfqOptions: [],
|
||||
logoSrc: logoImg,
|
||||
pdfLoading: {},
|
||||
today: new Date().toLocaleDateString("zh-CN")
|
||||
rfqList: [],
|
||||
total: 0,
|
||||
queryParams: { pageNum: 1, pageSize: 10, rfqNo: null, rfqTitle: null }
|
||||
};
|
||||
},
|
||||
created() {
|
||||
listRfq({ pageSize: 200 }).then(r => { this.rfqOptions = r.rows || []; });
|
||||
},
|
||||
created() { this.getList(); },
|
||||
methods: {
|
||||
resetResult() { this.result = null; this.activeTab = "compare"; },
|
||||
doCompare() {
|
||||
if (!this.selectedRfqId) { this.$message.warning("请先选择RFQ"); return; }
|
||||
getList() {
|
||||
this.loading = true;
|
||||
compareRfq(this.selectedRfqId).then(r => {
|
||||
this.result = r.data;
|
||||
listRfq(this.queryParams).then(res => {
|
||||
this.rfqList = res.rows || [];
|
||||
this.total = res.total || 0;
|
||||
this.loading = false;
|
||||
this.activeTab = "compare";
|
||||
}).catch(() => { this.loading = false; });
|
||||
},
|
||||
async exportPlanPdf(plan, idx) {
|
||||
this.$set(this.pdfLoading, plan.supplierId, true);
|
||||
// wait a tick so DOM updates
|
||||
await this.$nextTick();
|
||||
await new Promise(resolve => setTimeout(resolve, 200));
|
||||
try {
|
||||
const el = document.getElementById("plan-pdf-" + plan.supplierId);
|
||||
// temporarily show it
|
||||
const origStyle = el.style.cssText;
|
||||
el.style.cssText = "position:absolute;left:-9999px;top:0;width:794px;background:#fff";
|
||||
const canvas = await html2canvas(el, { scale: 2, useCORS: true, backgroundColor: "#ffffff", width: 794 });
|
||||
el.style.cssText = origStyle;
|
||||
|
||||
const imgData = canvas.toDataURL("image/png");
|
||||
const pdf = new jsPDF({ orientation: "p", unit: "mm", format: "a4" });
|
||||
const pageW = pdf.internal.pageSize.getWidth();
|
||||
const pageH = pdf.internal.pageSize.getHeight();
|
||||
const imgH = (canvas.height * pageW) / canvas.width;
|
||||
|
||||
let yPos = 0;
|
||||
let remaining = imgH;
|
||||
let firstPage = true;
|
||||
while (remaining > 0) {
|
||||
if (!firstPage) pdf.addPage();
|
||||
pdf.addImage(imgData, "PNG", 0, yPos, pageW, imgH);
|
||||
yPos -= pageH;
|
||||
remaining -= pageH;
|
||||
firstPage = false;
|
||||
}
|
||||
const filename = "推荐方案_" + plan.supplierName + "_方案" + (idx + 1) + ".pdf";
|
||||
pdf.save(filename);
|
||||
this.$message.success("PDF 已导出:" + filename);
|
||||
} catch(e) {
|
||||
this.$message.error("PDF 导出失败:" + e.message);
|
||||
} finally {
|
||||
this.$set(this.pdfLoading, plan.supplierId, false);
|
||||
}
|
||||
resetQuery() { this.queryParams = { pageNum: 1, pageSize: 10, rfqNo: null, rfqTitle: null }; this.getList(); },
|
||||
goCompare(row) {
|
||||
this.$router.push({ path: "/bid/comparison/detail", query: { rfqId: row.rfqId } });
|
||||
},
|
||||
badgeType(badge) {
|
||||
if (badge === "综合最优") return "success";
|
||||
if (badge === "价格最低") return "warning";
|
||||
if (badge === "交期最快") return "primary";
|
||||
return "info";
|
||||
goRfqDetail(row) {
|
||||
this.$router.push({ path: "/bid/rfq/detail", query: { rfqId: row.rfqId } });
|
||||
},
|
||||
scoreClass(score) {
|
||||
if (score >= 80) return "score-high";
|
||||
if (score >= 60) return "score-mid";
|
||||
return "score-low";
|
||||
statusType(s) {
|
||||
const m = { draft: "info", open: "primary", closed: "success", cancelled: "danger" };
|
||||
return m[s] || "info";
|
||||
},
|
||||
scorePdfClass(score) {
|
||||
if (score >= 80) return "score-good";
|
||||
if (score >= 60) return "score-ok";
|
||||
return "score-weak";
|
||||
},
|
||||
dimColor(v) {
|
||||
if (v >= 80) return "#67c23a";
|
||||
if (v >= 60) return "#e6a23c";
|
||||
return "#f56c6c";
|
||||
statusLabel(s) {
|
||||
const m = { draft: "草稿", open: "进行中", closed: "已关闭", cancelled: "已取消" };
|
||||
return m[s] || s;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.comparison-page { padding: 0; }
|
||||
.filter-card { margin-bottom: 20px; ::v-deep .el-card__body { padding: 16px 20px; } }
|
||||
|
||||
.empty-state {
|
||||
text-align: center; padding: 100px 40px; color: #c0c4cc;
|
||||
i { font-size: 56px; display: block; margin-bottom: 16px; }
|
||||
p { font-size: 14px; }
|
||||
}
|
||||
|
||||
.main-tabs { ::v-deep .el-tabs__content { padding: 20px; } }
|
||||
|
||||
/* ── 物料块 ── */
|
||||
.item-block { margin-bottom: 32px; }
|
||||
.item-header {
|
||||
background: linear-gradient(90deg, #1171c4, #22a4ff);
|
||||
color: #fff; padding: 10px 16px; border-radius: 6px 6px 0 0;
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
}
|
||||
.item-badge {
|
||||
background: rgba(255,255,255,0.25); padding: 2px 10px;
|
||||
border-radius: 12px; font-size: 12px;
|
||||
}
|
||||
.item-name { font-size: 15px; font-weight: 700; }
|
||||
.item-spec { color: rgba(255,255,255,0.8); font-size: 13px; }
|
||||
.item-qty { margin-left: auto; font-size: 12px; color: rgba(255,255,255,0.8); }
|
||||
|
||||
.no-quote {
|
||||
padding: 20px; color: #909399; background: #fafafa;
|
||||
border: 1px dashed #e4e7ed; border-radius: 4px; text-align: center;
|
||||
}
|
||||
|
||||
/* ── 供应商排名卡片 ── */
|
||||
.supplier-cards {
|
||||
display: flex; gap: 12px; padding: 16px 0; overflow-x: auto;
|
||||
}
|
||||
.supplier-card {
|
||||
flex: 0 0 200px; border: 1px solid #e4e7ed; border-radius: 8px;
|
||||
padding: 14px; background: #fff; transition: box-shadow 0.2s;
|
||||
&:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
|
||||
&.best-card { border-color: #67c23a; box-shadow: 0 2px 8px rgba(103,194,58,0.2); }
|
||||
}
|
||||
.card-rank { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
|
||||
.rank-num {
|
||||
width: 22px; height: 22px; border-radius: 50%; display: flex;
|
||||
align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
|
||||
&.rank-1 { background: #f7ba2a; color: #fff; }
|
||||
&.rank-2 { background: #c0c4cc; color: #fff; }
|
||||
&.rank-3 { background: #a57c52; color: #fff; }
|
||||
}
|
||||
.rank-badge { flex-shrink: 0; }
|
||||
.card-supplier { font-size: 13px; font-weight: 600; color: #303133; margin-bottom: 6px; }
|
||||
.card-score-big {
|
||||
font-size: 28px; font-weight: 700; line-height: 1; margin: 8px 0;
|
||||
&.score-high { color: #67c23a; }
|
||||
&.score-mid { color: #e6a23c; }
|
||||
&.score-low { color: #f56c6c; }
|
||||
.score-unit { font-size: 13px; font-weight: 400; margin-left: 2px; }
|
||||
}
|
||||
.card-price { font-size: 13px; color: #409EFF; font-weight: 600; margin-bottom: 10px; }
|
||||
.dim-bars { display: flex; flex-direction: column; gap: 4px; }
|
||||
.dim-row { display: flex; align-items: center; gap: 6px; }
|
||||
.dim-label { font-size: 11px; color: #909399; width: 24px; flex-shrink: 0; }
|
||||
.dim-bar { flex: 1; }
|
||||
.dim-val { font-size: 11px; color: #606266; width: 24px; text-align: right; flex-shrink: 0; }
|
||||
.card-meta { font-size: 11px; color: #c0c4cc; margin-top: 8px; }
|
||||
.detail-table { margin-top: 8px; }
|
||||
|
||||
/* ── 分数颜色 ── */
|
||||
.score-high { color: #67c23a; font-weight: 700; }
|
||||
.score-mid { color: #e6a23c; font-weight: 600; }
|
||||
.score-low { color: #f56c6c; }
|
||||
.price-low { color: #67c23a; font-weight: 700; }
|
||||
|
||||
/* ── 推荐方案卡片 ── */
|
||||
.plan-card {
|
||||
border: 1px solid #e4e7ed; border-radius: 8px; margin-bottom: 24px;
|
||||
overflow: hidden; background: #fff; position: relative;
|
||||
}
|
||||
.plan-header {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 14px 20px; background: linear-gradient(90deg, #f0f7ff, #fff);
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
}
|
||||
.plan-title { display: flex; align-items: center; gap: 10px; }
|
||||
.plan-rank {
|
||||
background: #1171c4; color: #fff; padding: 3px 10px;
|
||||
border-radius: 12px; font-size: 12px;
|
||||
}
|
||||
.plan-supplier { font-size: 16px; font-weight: 700; color: #1a2c4e; }
|
||||
.plan-actions { display: flex; align-items: center; gap: 16px; }
|
||||
.plan-total { font-size: 14px; color: #606266; strong { font-size: 18px; color: #409EFF; } }
|
||||
.plan-reason { padding: 8px 20px; font-size: 13px; color: #606266; background: #f9fbff; border-bottom: 1px solid #f0f2f5; }
|
||||
.plan-table { border-radius: 0; }
|
||||
|
||||
/* ── PDF 渲染区域 ── */
|
||||
.pdf-area {
|
||||
padding: 28px;
|
||||
background: #fff;
|
||||
font-family: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
|
||||
font-size: 13px; color: #222;
|
||||
}
|
||||
.pdf-header { display: flex; align-items: flex-start; padding-bottom: 12px; }
|
||||
.pdf-logo { width: 52px; height: 52px; object-fit: contain; margin-right: 14px; }
|
||||
.pdf-header-text { flex: 1; }
|
||||
.pdf-company { font-size: 22px; font-weight: 700; color: #1171c4; letter-spacing: 1px; }
|
||||
.pdf-doc-type { font-size: 13px; color: #666; margin-top: 2px; }
|
||||
.pdf-header-meta { font-size: 12px; color: #888; text-align: right; }
|
||||
.pdf-divider { border-top: 2px solid #1171c4; margin: 0 0 16px; }
|
||||
.pdf-meta-table {
|
||||
width: 100%; border-collapse: collapse; margin-bottom: 16px;
|
||||
td { padding: 7px 10px; border: 1px solid #e4e7ed; }
|
||||
}
|
||||
.meta-label { background: #f5f7fa; color: #606266; font-weight: 600; width: 90px; }
|
||||
.meta-val { color: #303133; }
|
||||
.amount-big { color: #409EFF; font-weight: 700; font-size: 16px; }
|
||||
.score-good { color: #67c23a; font-weight: 700; }
|
||||
.score-ok { color: #e6a23c; font-weight: 600; }
|
||||
.score-weak { color: #f56c6c; }
|
||||
.pdf-score-legend {
|
||||
background: #f0f7ff; border: 1px solid #c6e2ff; border-radius: 4px;
|
||||
padding: 8px 14px; font-size: 12px; color: #606266; margin-bottom: 16px;
|
||||
}
|
||||
.pdf-section-title {
|
||||
font-size: 14px; font-weight: 700; color: #1a2c4e;
|
||||
margin: 0 0 10px; padding-left: 8px; border-left: 4px solid #1171c4;
|
||||
}
|
||||
.pdf-items-table {
|
||||
width: 100%; border-collapse: collapse; margin-bottom: 20px;
|
||||
th { background: #1171c4; color: #fff; padding: 8px 8px; text-align: center; font-weight: 600; font-size: 12px; }
|
||||
td { border: 1px solid #e4e7ed; padding: 7px 8px; text-align: center; font-size: 12px; }
|
||||
tbody tr:nth-child(even) td { background: #f9fbff; }
|
||||
}
|
||||
.amount-cell { color: #409EFF; font-weight: 600; }
|
||||
.total-cell { font-size: 14px; background: #f0f7ff !important; font-weight: 700; }
|
||||
.score-cell { font-weight: 700; }
|
||||
.pdf-footer { text-align: center; font-size: 11px; color: #aaa; margin-top: 16px; border-top: 1px solid #f0f2f5; padding-top: 12px; }
|
||||
.search-card { ::v-deep .el-card__body { padding: 16px 20px 8px; } }
|
||||
</style>
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input v-model="queryParams.materialCode" placeholder="请输入物料编码" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属分类">
|
||||
<el-select v-model="queryParams.categoryId" placeholder="全部分类" clearable style="width:160px">
|
||||
<el-option v-for="c in flatCategories" :key="c.categoryId"
|
||||
:label="c.categoryName" :value="c.categoryId" />
|
||||
</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>
|
||||
@@ -26,35 +32,57 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="物料编码" prop="materialCode" width="130" />
|
||||
<el-table-column label="物料名称" prop="materialName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="规格型号" prop="spec" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="单位" prop="unit" width="80" />
|
||||
<el-table-column label="品牌" prop="brand" />
|
||||
<el-table-column label="所属分类" prop="categoryName" width="130" />
|
||||
<el-table-column label="规格" prop="spec" :show-overflow-tooltip="true" width="130" />
|
||||
<el-table-column label="型号" prop="modelNo" :show-overflow-tooltip="true" width="130" />
|
||||
<el-table-column label="单位" prop="unit" width="70" />
|
||||
<el-table-column label="品牌" prop="brand" width="100" />
|
||||
<el-table-column label="状态" align="center" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="160" />
|
||||
<el-table-column label="操作" align="center" width="160">
|
||||
<el-table-column label="操作" align="center" width="140">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" style="color:#f56c6c" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<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="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input v-model="form.materialCode" placeholder="请输入物料编码" />
|
||||
</el-form-item>
|
||||
<el-dialog :title="title" :visible.sync="open" width="640px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input v-model="form.materialCode" placeholder="请输入物料编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属分类">
|
||||
<el-select v-model="form.categoryId" placeholder="请选择分类" clearable style="width:100%">
|
||||
<el-option v-for="c in flatCategories" :key="c.categoryId"
|
||||
:label="c.indentName" :value="c.categoryId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="请输入规格型号" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="如:500W/220V" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="型号" prop="modelNo">
|
||||
<el-input v-model="form.modelNo" placeholder="如:XD-2023A" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="单位" prop="unit">
|
||||
@@ -68,7 +96,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" rows="3" />
|
||||
<el-input v-model="form.description" type="textarea" rows="2" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer">
|
||||
@@ -81,22 +109,43 @@
|
||||
|
||||
<script>
|
||||
import { listMaterial, getMaterial, addMaterial, updateMaterial, delMaterial } from "@/api/bid/material";
|
||||
import { getCategoryList } from "@/api/bid/category";
|
||||
|
||||
export default {
|
||||
name: "Material",
|
||||
data() {
|
||||
return {
|
||||
loading: false, multiple: true, total: 0, materialList: [],
|
||||
open: false, title: "",
|
||||
queryParams: { pageNum: 1, pageSize: 10, materialName: null, materialCode: null },
|
||||
queryParams: { pageNum: 1, pageSize: 10, materialName: null, materialCode: null, categoryId: null },
|
||||
form: {},
|
||||
flatCategories: [],
|
||||
rules: {
|
||||
materialCode: [{ required: true, message: "物料编码不能为空", trigger: "blur" }],
|
||||
materialName: [{ required: true, message: "物料名称不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() { this.getList(); },
|
||||
created() {
|
||||
this.getList();
|
||||
this.loadCategories();
|
||||
},
|
||||
methods: {
|
||||
loadCategories() {
|
||||
getCategoryList().then(res => {
|
||||
this.flatCategories = this.flattenTree(res.data || [], 0, "");
|
||||
});
|
||||
},
|
||||
flattenTree(nodes, depth, prefix) {
|
||||
let result = [];
|
||||
for (const n of nodes) {
|
||||
result.push({ ...n, indentName: prefix + n.categoryName });
|
||||
if (n.children && n.children.length) {
|
||||
result = result.concat(this.flattenTree(n.children, depth + 1, prefix + " "));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listMaterial(this.queryParams).then(res => {
|
||||
@@ -107,18 +156,18 @@ export default {
|
||||
},
|
||||
handleQuery() { this.queryParams.pageNum = 1; this.getList(); },
|
||||
resetQuery() { this.resetForm("queryForm"); this.handleQuery(); },
|
||||
handleSelectionChange(sel) { this.multiple = !sel.length; },
|
||||
handleSelectionChange(sel) { this.multiple = !sel.length; this.ids = sel.map(s => s.materialId); },
|
||||
handleAdd() { this.reset(); this.open = true; this.title = "新增物料"; },
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
getMaterial(row.materialId).then(res => { this.form = res.data; this.open = true; this.title = "修改物料"; });
|
||||
},
|
||||
handleDelete(row) {
|
||||
const ids = row.materialId || this.ids;
|
||||
const ids = row.materialId || (this.ids || []).join(",");
|
||||
this.$modal.confirm("确认删除?").then(() => delMaterial(ids)).then(() => { this.getList(); this.$modal.msgSuccess("删除成功"); });
|
||||
},
|
||||
handleStatusChange(row) { updateMaterial(row); },
|
||||
reset() { this.form = { status: "0" }; this.resetForm("form"); },
|
||||
reset() { this.form = { status: "0" }; this.resetForm && this.resetForm("form"); },
|
||||
cancel() { this.open = false; this.reset(); },
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
|
||||
Reference in New Issue
Block a user