feat(bid): 新增基于甲方报价快速创建RFQ功能
本次提交完成以下核心变更: 1. 新增RFQ编号自动生成逻辑,添加selectNextRfqNo方法获取月度递增的RFQ编号 2. 在biz_rfq表新增client_quote_id关联字段,添加索引并完善实体类映射 3. 实现基于甲方报价复制物料快速创建RFQ的业务逻辑,包括事务处理和明细复制 4. 新增RFQ列表页关联甲方报价展示,支持点击跳转查看甲方报价详情 5. 在RFQ编辑页新增甲方报价选择器,选中后自动填充对应物料和标题 6. 优化甲方报价单页面,新增生成RFQ按钮和已生成RFQ列表展示 7. 调整RFQ详情页,新增编辑模式支持草稿状态修改 8. 修复路由跳转路径,统一RFQ相关页面路由到/bid/rfq路径组
This commit is contained in:
@@ -9,14 +9,17 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.bid.BizClientQuote;
|
||||
import com.ruoyi.system.domain.bid.BizRfq;
|
||||
import com.ruoyi.system.domain.bid.BizRfqItem;
|
||||
import com.ruoyi.system.mapper.bid.BizClientQuoteMapper;
|
||||
import com.ruoyi.system.service.bid.IBizRfqService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/bid/rfq")
|
||||
public class BizRfqController extends BaseController {
|
||||
@Autowired private IBizRfqService service;
|
||||
@Autowired private BizClientQuoteMapper clientQuoteMapper;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:rfq:list')")
|
||||
@GetMapping("/list")
|
||||
@@ -42,6 +45,8 @@ public class BizRfqController extends BaseController {
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BizRfq rfq) {
|
||||
rfq.setCreateBy(getUsername());
|
||||
Long tenantId = getDeptId();
|
||||
rfq.setTenantId(tenantId != null ? tenantId : 1L);
|
||||
return toAjax(service.insertBizRfq(rfq));
|
||||
}
|
||||
|
||||
@@ -66,4 +71,24 @@ public class BizRfqController extends BaseController {
|
||||
public AjaxResult remove(@PathVariable Long[] rfqIds) {
|
||||
return toAjax(service.deleteBizRfqByIds(rfqIds));
|
||||
}
|
||||
|
||||
// ========== 关联甲方报价 ==========
|
||||
|
||||
/** 获取可选甲方报价列表(下拉选择器用) */
|
||||
@PreAuthorize("@ss.hasPermi('bid:rfq:add')")
|
||||
@GetMapping("/client-quote-options")
|
||||
public AjaxResult clientQuoteOptions() {
|
||||
BizClientQuote query = new BizClientQuote();
|
||||
List<BizClientQuote> list = clientQuoteMapper.selectClientQuoteList(query);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/** 基于甲方报价快速创建 RFQ */
|
||||
@PreAuthorize("@ss.hasPermi('bid:rfq:add')")
|
||||
@Log(title = "报价请求", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/create-from-quote/{clientQuoteId}")
|
||||
public AjaxResult createFromQuote(@PathVariable Long clientQuoteId) {
|
||||
Long tenantId = getDeptId();
|
||||
return success(service.createRfqFromClientQuote(clientQuoteId, tenantId != null ? tenantId : 1L));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ public class BizRfq extends BaseEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date deadline;
|
||||
private String deliveryAddr;
|
||||
private Long clientQuoteId;
|
||||
private String clientQuoteNo;
|
||||
private String clientName;
|
||||
private String status;
|
||||
private List<BizRfqItem> items;
|
||||
private List<Long> supplierIds;
|
||||
@@ -29,6 +32,12 @@ public class BizRfq extends BaseEntity {
|
||||
public void setDeadline(Date deadline) { this.deadline = deadline; }
|
||||
public String getDeliveryAddr() { return deliveryAddr; }
|
||||
public void setDeliveryAddr(String deliveryAddr) { this.deliveryAddr = deliveryAddr; }
|
||||
public Long getClientQuoteId() { return clientQuoteId; }
|
||||
public void setClientQuoteId(Long clientQuoteId) { this.clientQuoteId = clientQuoteId; }
|
||||
public String getClientQuoteNo() { return clientQuoteNo; }
|
||||
public void setClientQuoteNo(String clientQuoteNo) { this.clientQuoteNo = clientQuoteNo; }
|
||||
public String getClientName() { return clientName; }
|
||||
public void setClientName(String clientName) { this.clientName = clientName; }
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public List<BizRfqItem> getItems() { return items; }
|
||||
|
||||
@@ -9,5 +9,6 @@ public interface BizRfqMapper {
|
||||
int insertBizRfq(BizRfq record);
|
||||
int updateBizRfq(BizRfq record);
|
||||
int deleteBizRfqById(Long id);
|
||||
String selectNextRfqNo();
|
||||
int deleteBizRfqByIds(Long[] ids);
|
||||
}
|
||||
|
||||
@@ -13,4 +13,6 @@ public interface IBizRfqService {
|
||||
int deleteBizRfqByIds(Long[] ids);
|
||||
int publishRfq(Long rfqId, Long[] supplierIds);
|
||||
List<BizRfqItem> selectItemsByRfqId(Long rfqId);
|
||||
/** 基于甲方报价快速创建 RFQ(复制物料明细) */
|
||||
BizRfq createRfqFromClientQuote(Long clientQuoteId, Long tenantId);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
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.domain.bid.BizRfq;
|
||||
import com.ruoyi.system.domain.bid.BizRfqItem;
|
||||
import com.ruoyi.system.mapper.bid.BizClientQuoteMapper;
|
||||
import com.ruoyi.system.mapper.bid.BizRfqItemMapper;
|
||||
import com.ruoyi.system.mapper.bid.BizRfqMapper;
|
||||
import com.ruoyi.system.service.bid.IBizRfqService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class BizRfqServiceImpl implements IBizRfqService {
|
||||
@Autowired private BizRfqMapper rfqMapper;
|
||||
@Autowired private BizRfqItemMapper itemMapper;
|
||||
@Autowired private BizClientQuoteMapper clientQuoteMapper;
|
||||
|
||||
@Override
|
||||
public List<BizRfq> selectBizRfqList(BizRfq query) { return rfqMapper.selectBizRfqList(query); }
|
||||
@@ -29,6 +33,9 @@ public class BizRfqServiceImpl implements IBizRfqService {
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertBizRfq(BizRfq rfq) {
|
||||
if (rfq.getRfqNo() == null || rfq.getRfqNo().isBlank()) {
|
||||
rfq.setRfqNo(rfqMapper.selectNextRfqNo());
|
||||
}
|
||||
rfq.setStatus("draft");
|
||||
int rows = rfqMapper.insertBizRfq(rfq);
|
||||
if (rfq.getItems() != null) {
|
||||
@@ -71,4 +78,50 @@ public class BizRfqServiceImpl implements IBizRfqService {
|
||||
public List<BizRfqItem> selectItemsByRfqId(Long rfqId) {
|
||||
return itemMapper.selectItemsByRfqId(rfqId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public BizRfq createRfqFromClientQuote(Long clientQuoteId, Long tenantId) {
|
||||
// 加载甲方报价
|
||||
BizClientQuote quote = clientQuoteMapper.selectClientQuoteById(clientQuoteId);
|
||||
if (quote == null) {
|
||||
throw new RuntimeException("甲方报价单不存在: " + clientQuoteId);
|
||||
}
|
||||
|
||||
// 创建 RFQ
|
||||
BizRfq rfq = new BizRfq();
|
||||
rfq.setRfqNo(rfqMapper.selectNextRfqNo());
|
||||
rfq.setTenantId(tenantId);
|
||||
rfq.setRfqTitle("采购需求: " + quote.getClientName() + " - " + quote.getQuoteNo());
|
||||
rfq.setClientQuoteId(quote.getQuoteId());
|
||||
rfq.setDeliveryAddr("");
|
||||
rfq.setStatus("draft");
|
||||
rfq.setRemark("源自甲方报价单: " + quote.getQuoteNo());
|
||||
|
||||
// 复制物料明细
|
||||
List<BizClientQuoteItem> sourceItems = clientQuoteMapper.selectItemsByQuoteId(clientQuoteId);
|
||||
if (sourceItems != null && !sourceItems.isEmpty()) {
|
||||
rfq.setItems(sourceItems.stream().map(src -> {
|
||||
BizRfqItem item = new BizRfqItem();
|
||||
item.setMaterialId(src.getMaterialId());
|
||||
item.setMaterialName(src.getMaterialName());
|
||||
item.setSpec(src.getSpec());
|
||||
item.setUnit(src.getUnit());
|
||||
item.setQuantity(src.getQuantity());
|
||||
item.setExpectedPrice(src.getUnitPrice());
|
||||
item.setRemark(src.getRemark());
|
||||
return item;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
rfqMapper.insertBizRfq(rfq);
|
||||
if (rfq.getItems() != null) {
|
||||
for (BizRfqItem item : rfq.getItems()) {
|
||||
item.setRfqId(rfq.getRfqId());
|
||||
itemMapper.insertBizRfqItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
return rfqMapper.selectBizRfqById(rfq.getRfqId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
<result property="rfqTitle" column="rfq_title"/>
|
||||
<result property="deadline" column="deadline"/>
|
||||
<result property="deliveryAddr" column="delivery_addr"/>
|
||||
<result property="clientQuoteId" column="client_quote_id"/>
|
||||
<result property="clientQuoteNo" column="clientQuoteNo"/>
|
||||
<result property="clientName" column="clientName"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
@@ -17,22 +20,40 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRfqSql">
|
||||
SELECT r.*,
|
||||
cq.quote_no AS clientQuoteNo,
|
||||
cq.client_name AS clientName
|
||||
FROM biz_rfq r
|
||||
LEFT JOIN biz_client_quote cq ON r.client_quote_id = cq.quote_id
|
||||
</sql>
|
||||
|
||||
<select id="selectBizRfqList" resultMap="BaseRM">
|
||||
SELECT * FROM biz_rfq
|
||||
<include refid="selectRfqSql"/>
|
||||
<where>
|
||||
<if test="tenantId != null"> AND tenant_id=#{tenantId}</if>
|
||||
<if test="rfqNo != null and rfqNo != ''"> AND rfq_no LIKE CONCAT('%',#{rfqNo},'%')</if>
|
||||
<if test="rfqTitle != null and rfqTitle != ''"> AND rfq_title LIKE CONCAT('%',#{rfqTitle},'%')</if>
|
||||
<if test="status != null and status != ''"> AND status=#{status}</if>
|
||||
<if test="tenantId != null"> AND r.tenant_id=#{tenantId}</if>
|
||||
<if test="rfqNo != null and rfqNo != ''"> AND r.rfq_no LIKE CONCAT('%',#{rfqNo},'%')</if>
|
||||
<if test="rfqTitle != null and rfqTitle != ''"> AND r.rfq_title LIKE CONCAT('%',#{rfqTitle},'%')</if>
|
||||
<if test="status != null and status != ''"> AND r.status=#{status}</if>
|
||||
<if test="clientQuoteId != null"> AND r.client_quote_id=#{clientQuoteId}</if>
|
||||
</where>
|
||||
ORDER BY rfq_id DESC
|
||||
ORDER BY r.rfq_id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectBizRfqById" resultMap="BaseRM">SELECT * FROM biz_rfq WHERE rfq_id=#{id}</select>
|
||||
<select id="selectBizRfqById" resultMap="BaseRM">
|
||||
<include refid="selectRfqSql"/>
|
||||
WHERE r.rfq_id=#{id}
|
||||
</select>
|
||||
|
||||
<select id="selectNextRfqNo" resultType="String">
|
||||
SELECT CONCAT('RFQ-', DATE_FORMAT(NOW(),'%Y%m'), '-',
|
||||
LPAD(IFNULL(MAX(CAST(SUBSTRING_INDEX(rfq_no,'-',-1) AS UNSIGNED)),0)+1,3,'0'))
|
||||
FROM biz_rfq WHERE rfq_no LIKE CONCAT('RFQ-', DATE_FORMAT(NOW(),'%Y%m'), '%')
|
||||
</select>
|
||||
|
||||
<insert id="insertBizRfq" useGeneratedKeys="true" keyProperty="rfqId">
|
||||
INSERT INTO biz_rfq(tenant_id,rfq_no,rfq_title,deadline,delivery_addr,status,remark,create_by,create_time)
|
||||
VALUES(#{tenantId},#{rfqNo},#{rfqTitle},#{deadline},#{deliveryAddr},#{status},#{remark},#{createBy},NOW())
|
||||
INSERT INTO biz_rfq(tenant_id,rfq_no,rfq_title,deadline,delivery_addr,client_quote_id,status,remark,create_by,create_time)
|
||||
VALUES(#{tenantId},#{rfqNo},#{rfqTitle},#{deadline},#{deliveryAddr},#{clientQuoteId},#{status},#{remark},#{createBy},NOW())
|
||||
</insert>
|
||||
|
||||
<update id="updateBizRfq">
|
||||
@@ -41,6 +62,7 @@
|
||||
<if test="rfqTitle != null">rfq_title=#{rfqTitle},</if>
|
||||
<if test="deadline != null">deadline=#{deadline},</if>
|
||||
<if test="deliveryAddr != null">delivery_addr=#{deliveryAddr},</if>
|
||||
<if test="clientQuoteId != null">client_quote_id=#{clientQuoteId},</if>
|
||||
<if test="status != null">status=#{status},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
update_by=#{updateBy}, update_time=NOW()
|
||||
|
||||
@@ -7,3 +7,7 @@ export const addRfq = (data) => request({ url: baseUrl, method: 'post', data })
|
||||
export const updateRfq = (data) => request({ url: baseUrl, method: 'put', data })
|
||||
export const publishRfq = (rfqId, supplierIds) => request({ url: baseUrl + '/publish/' + rfqId, method: 'put', data: supplierIds })
|
||||
export const delRfq = (ids) => request({ url: baseUrl + '/' + ids, method: 'delete' })
|
||||
|
||||
// 关联甲方报价
|
||||
export const getClientQuoteOptions = () => request({ url: baseUrl + '/client-quote-options', method: 'get' })
|
||||
export const createRfqFromQuote = (clientQuoteId) => request({ url: baseUrl + '/create-from-quote/' + clientQuoteId, method: 'post' })
|
||||
|
||||
@@ -78,12 +78,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="客户名称" prop="clientName" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column label="关联询价" min-width="150">
|
||||
<template slot-scope="s">
|
||||
<div style="font-weight:600;color:#303133">{{ s.row.rfqNo || '-' }}</div>
|
||||
<div style="font-size:12px;color:#909399;margin-top:2px" v-if="s.row.rfqTitle">{{ s.row.rfqTitle }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总金额" width="130" align="right">
|
||||
<template slot-scope="s">
|
||||
<strong style="color:#409EFF;font-size:15px">¥{{ s.row.totalAmount | money }}</strong>
|
||||
@@ -103,11 +97,12 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人" prop="createBy" width="100" align="center" />
|
||||
<el-table-column label="创建时间" prop="createTime" width="160" align="center" />
|
||||
<el-table-column label="操作" align="center" width="210" fixed="right">
|
||||
<el-table-column label="操作" align="center" width="280" fixed="right">
|
||||
<template slot-scope="s">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(s.row)">详情</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(s.row)">编辑</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-document-copy" @click="handleQuickCreate(s.row)">快速新建</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-s-promotion" style="color:#67C23A" @click="handleCreateRfq(s.row)">生成RFQ</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" style="color:#f56c6c"
|
||||
@click="handleDelete(s.row)" v-if="s.row.status==='draft'">删除</el-button>
|
||||
</template>
|
||||
@@ -126,16 +121,8 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关联询价单">
|
||||
<el-select v-model="form.rfqId" placeholder="选择关联RFQ(可选)" filterable clearable style="width:100%" @change="onRfqSelect">
|
||||
<el-option v-for="r in rfqOptions" :key="r.rfqId"
|
||||
:label="r.rfqNo + ' · ' + r.rfqTitle" :value="r.rfqId">
|
||||
<div style="display:flex;justify-content:space-between">
|
||||
<span style="font-weight:600">{{ r.rfqNo }}</span>
|
||||
<span style="color:#909399;font-size:12px;margin-left:8px">{{ r.rfqTitle }}</span>
|
||||
</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-form-item label=" ">
|
||||
<span style="color:#909399;font-size:12px">RFQ 通过「生成RFQ」按钮创建,自动关联此报价单</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -300,7 +287,10 @@
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="币种">{{ detailData.currency || 'CNY' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="有效期">{{ detailData.validityDate | dateFmt }}</el-descriptions-item>
|
||||
<el-descriptions-item label="关联询价">{{ detailData.rfqNo || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="RFQ数量">
|
||||
<span v-if="detailRfqList.length > 0" style="color:#409eff;font-weight:600">{{ detailRfqList.length }} 个</span>
|
||||
<span v-else style="color:#c0c4cc">-</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="总金额" :span="3">
|
||||
<strong style="color:#409EFF;font-size:18px">¥{{ detailData.totalAmount | money }}</strong>
|
||||
</el-descriptions-item>
|
||||
@@ -326,6 +316,33 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="交期(天)" prop="deliveryDays" width="80" align="center" />
|
||||
</el-table>
|
||||
|
||||
<!-- ── 关联的RFQ列表 ── -->
|
||||
<div style="margin-top:20px">
|
||||
<div class="section-title" style="margin-bottom:12px">
|
||||
已生成的采购计划(RFQ)
|
||||
<el-button size="mini" type="success" icon="el-icon-s-promotion" style="margin-left:12px"
|
||||
@click="handleCreateRfq(detailData)">生成RFQ</el-button>
|
||||
</div>
|
||||
<el-table :data="detailRfqList" v-loading="detailRfqLoading" border size="small">
|
||||
<el-table-column label="RFQ编号" prop="rfqNo" width="150" />
|
||||
<el-table-column label="标题" prop="rfqTitle" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="状态" width="90" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-tag :type="rfqStatusType(s.row.status)" size="small">{{ rfqStatusLabel(s.row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="createTime" width="160" align="center" />
|
||||
<el-table-column label="操作" width="80" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-button type="text" size="small" @click="viewRfqDetail(s.row)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div v-if="!detailRfqLoading && detailRfqList.length === 0" style="text-align:center;padding:16px;color:#c0c4cc;font-size:13px">
|
||||
暂未生成采购计划,点击上方「生成RFQ」按钮创建
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer">
|
||||
<el-button @click="detailOpen = false">关闭</el-button>
|
||||
@@ -339,7 +356,7 @@
|
||||
<script>
|
||||
import { listClientQuote, getClientQuote, addClientQuote, updateClientQuote, delClientQuote,
|
||||
getClientQuoteStatistics, quickCreateFromQuote } from "@/api/bid/clientquote";
|
||||
import { listRfq } from "@/api/bid/rfq";
|
||||
import { listRfq, createRfqFromQuote } from "@/api/bid/rfq";
|
||||
import { listMaterial } from "@/api/bid/material";
|
||||
|
||||
export default {
|
||||
@@ -365,7 +382,6 @@ export default {
|
||||
dialogOpen: false,
|
||||
dialogTitle: "",
|
||||
saving: false,
|
||||
rfqOptions: [],
|
||||
materialCache: [],
|
||||
form: { items: [], currency: "CNY", status: "draft" },
|
||||
rules: {
|
||||
@@ -373,7 +389,9 @@ export default {
|
||||
},
|
||||
// 详情
|
||||
detailOpen: false,
|
||||
detailData: null
|
||||
detailData: null,
|
||||
detailRfqList: [],
|
||||
detailRfqLoading: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -384,7 +402,6 @@ export default {
|
||||
created() {
|
||||
this.getList();
|
||||
this.getStats();
|
||||
listRfq({ pageSize: 200 }).then(r => { this.rfqOptions = r.rows || []; });
|
||||
},
|
||||
methods: {
|
||||
// ===== 列表 =====
|
||||
@@ -418,7 +435,7 @@ export default {
|
||||
|
||||
// ===== 新建 =====
|
||||
handleAdd() {
|
||||
this.form = { items: [], currency: "CNY", status: "draft", clientName: "", rfqId: null, validityDate: "", remark: "" };
|
||||
this.form = { items: [], currency: "CNY", status: "draft", clientName: "", validityDate: "", remark: "" };
|
||||
this.dialogTitle = "新建甲方报价单";
|
||||
this.dialogOpen = true;
|
||||
},
|
||||
@@ -430,9 +447,6 @@ export default {
|
||||
this.form = {
|
||||
quoteId: data.quoteId,
|
||||
clientName: data.clientName,
|
||||
rfqId: data.rfqId,
|
||||
rfqNo: data.rfqNo,
|
||||
rfqTitle: data.rfqTitle,
|
||||
status: data.status,
|
||||
validityDate: data.validityDate,
|
||||
currency: data.currency,
|
||||
@@ -465,6 +479,7 @@ export default {
|
||||
this.detailData = r.data || {};
|
||||
if (!this.detailData.items) this.detailData.items = [];
|
||||
this.detailOpen = true;
|
||||
this.loadRfqForDetail(row.quoteId);
|
||||
});
|
||||
},
|
||||
editFromDetail() {
|
||||
@@ -491,9 +506,6 @@ export default {
|
||||
this.form = {
|
||||
quoteId: res.data.quoteId,
|
||||
clientName: res.data.clientName,
|
||||
rfqId: res.data.rfqId,
|
||||
rfqNo: res.data.rfqNo,
|
||||
rfqTitle: res.data.rfqTitle,
|
||||
status: res.data.status,
|
||||
validityDate: res.data.validityDate,
|
||||
currency: res.data.currency,
|
||||
@@ -506,17 +518,37 @@ export default {
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
// ===== 生成RFQ =====
|
||||
handleCreateRfq(row) {
|
||||
this.$modal.confirm("确认基于报价单【" + row.quoteNo + "】生成采购询价(RFQ)?").then(() => {
|
||||
return createRfqFromQuote(row.quoteId);
|
||||
}).then(res => {
|
||||
this.detailOpen = false;
|
||||
this.$modal.msgSuccess("RFQ已创建");
|
||||
this.$router.push({ path: '/bid/rfq', query: { rfqId: res.data.rfqId, rfqNo: res.data.rfqNo, action: 'edit' } });
|
||||
}).catch(() => {});
|
||||
},
|
||||
|
||||
// ===== 删除 =====
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm("确认删除报价单【" + row.quoteNo + "】?").then(() => delClientQuote(row.quoteId))
|
||||
.then(() => { this.$modal.msgSuccess("删除成功"); this.getList(); this.getStats(); });
|
||||
},
|
||||
|
||||
// ===== RFQ选择 =====
|
||||
onRfqSelect(rfqId) {
|
||||
const rfq = this.rfqOptions.find(r => r.rfqId === rfqId);
|
||||
if (rfq) { this.form.rfqNo = rfq.rfqNo; this.form.rfqTitle = rfq.rfqTitle; }
|
||||
// ===== RFQ列表(详情弹窗中展示) =====
|
||||
loadRfqForDetail(quoteId) {
|
||||
this.detailRfqLoading = true;
|
||||
listRfq({ clientQuoteId: quoteId, pageSize: 50 }).then(r => {
|
||||
this.detailRfqList = r.rows || [];
|
||||
this.detailRfqLoading = false;
|
||||
}).catch(() => { this.detailRfqLoading = false; });
|
||||
},
|
||||
viewRfqDetail(rfq) {
|
||||
this.detailOpen = false;
|
||||
this.$router.push({ path: '/bid/rfq', query: { rfqId: rfq.rfqId, rfqNo: rfq.rfqNo, action: 'edit' } });
|
||||
},
|
||||
rfqStatusType(s) { return { draft:"info", published:"warning", closed:"", completed:"success" }[s] || ""; },
|
||||
rfqStatusLabel(s) { return { draft:"草稿", published:"已发布", closed:"已关闭", completed:"已完成" }[s] || s; },
|
||||
|
||||
// ===== 物料搜索 =====
|
||||
queryMaterialSearch(query, cb) {
|
||||
|
||||
@@ -77,7 +77,7 @@ export default {
|
||||
this.$router.push({ path: "/bid/comparison/detail", query: { rfqId: row.rfqId } });
|
||||
},
|
||||
goRfqDetail(row) {
|
||||
this.$router.push({ path: "/procurement/rfq/detail", query: { rfqId: row.rfqId } });
|
||||
this.$router.push({ path: '/bid/rfq', query: { rfqId: row.rfqId, rfqNo: row.rfqNo, action: 'edit' } });
|
||||
},
|
||||
statusType(s) {
|
||||
const m = { draft: "info", open: "primary", closed: "success", cancelled: "danger" };
|
||||
|
||||
@@ -2,12 +2,21 @@
|
||||
<div class="app-container">
|
||||
<div class="page-actions">
|
||||
<el-button icon="el-icon-back" size="small" @click="$router.back()">返回</el-button>
|
||||
<el-button type="primary" icon="el-icon-download" size="small" :loading="pdfLoading" @click="exportPdf">导出 PDF</el-button>
|
||||
<template v-if="!isEditing">
|
||||
<el-button type="primary" icon="el-icon-edit" size="small" @click="startEdit"
|
||||
v-if="rfq && rfq.status === 'draft'" :disabled="loading">编辑</el-button>
|
||||
<el-button type="warning" icon="el-icon-download" size="small"
|
||||
:loading="pdfLoading" @click="exportPdf">导出 PDF</el-button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button @click="cancelEdit">取消</el-button>
|
||||
<el-button type="primary" icon="el-icon-check" :loading="saving" @click="handleSave">保存</el-button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div v-loading="loading">
|
||||
<!-- ===================== 查看模式 ===================== -->
|
||||
<div v-if="!isEditing" v-loading="loading">
|
||||
<div v-if="rfq" id="rfq-pdf-area" class="pdf-area">
|
||||
<!-- PDF Header -->
|
||||
<div class="pdf-header">
|
||||
<img :src="logoSrc" class="pdf-logo" />
|
||||
<div class="pdf-header-text">
|
||||
@@ -18,7 +27,6 @@
|
||||
</div>
|
||||
<div class="pdf-divider"></div>
|
||||
|
||||
<!-- Meta info -->
|
||||
<table class="pdf-meta-table">
|
||||
<tr>
|
||||
<td class="meta-label">RFQ编号</td><td class="meta-val">{{ rfq.rfqNo }}</td>
|
||||
@@ -30,14 +38,21 @@
|
||||
<td class="meta-val"><el-tag :type="statusType(rfq.status)" size="small">{{ statusLabel(rfq.status) }}</el-tag></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="meta-label">交货地址</td><td class="meta-val" colspan="3">{{ rfq.deliveryAddr }}</td>
|
||||
<td class="meta-label">交货地址</td><td class="meta-val" colspan="3">{{ rfq.deliveryAddr || '-' }}</td>
|
||||
</tr>
|
||||
<tr v-if="rfq.clientQuoteNo">
|
||||
<td class="meta-label">关联甲方报价</td>
|
||||
<td class="meta-val" colspan="3">
|
||||
<el-button type="text" size="small" @click="viewClientQuote">
|
||||
{{ rfq.clientQuoteNo }} - {{ rfq.clientName || '' }}
|
||||
</el-button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="rfq.remark">
|
||||
<td class="meta-label">备注</td><td class="meta-val" colspan="3">{{ rfq.remark }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Items -->
|
||||
<div class="pdf-section-title">物料明细</div>
|
||||
<table class="pdf-items-table">
|
||||
<thead>
|
||||
@@ -47,15 +62,14 @@
|
||||
<tr v-for="(item, i) in rfq.items" :key="i">
|
||||
<td>{{ i + 1 }}</td>
|
||||
<td>{{ item.materialName }}</td>
|
||||
<td>{{ item.spec }}</td>
|
||||
<td>{{ item.spec || '-' }}</td>
|
||||
<td>{{ item.unit }}</td>
|
||||
<td>{{ item.quantity }}</td>
|
||||
<td>{{ item.expectedPrice || '-' }}</td>
|
||||
<td>{{ item.expectedPrice != null ? '¥' + item.expectedPrice : '-' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- Quotations section -->
|
||||
<div v-if="quotations.length > 0">
|
||||
<div class="pdf-section-title" style="margin-top:24px">收到报价汇总</div>
|
||||
<table class="pdf-items-table">
|
||||
@@ -78,11 +92,111 @@
|
||||
<div class="pdf-footer">生成时间:{{ new Date().toLocaleString('zh-CN') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===================== 编辑模式 ===================== -->
|
||||
<div v-else v-loading="loading">
|
||||
<el-card shadow="never" class="edit-card">
|
||||
<div slot="header"><strong>基本信息</strong></div>
|
||||
<el-form ref="editForm" :model="editForm" :rules="editRules" label-width="110px" size="small">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="RFQ编号">
|
||||
<el-input :value="editForm.rfqNo" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态">
|
||||
<el-tag :type="statusType(editForm.status)" size="small">{{ statusLabel(editForm.status) }}</el-tag>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="RFQ标题" prop="rfqTitle">
|
||||
<el-input v-model="editForm.rfqTitle" placeholder="请输入标题" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="截止日期" prop="deadline">
|
||||
<el-date-picker v-model="editForm.deadline" type="datetime" placeholder="选择截止日期"
|
||||
value-format="yyyy-MM-dd HH:mm:ss" style="width:100%" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="交货地址">
|
||||
<el-input v-model="editForm.deliveryAddr" placeholder="请输入交货地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="editForm.clientQuoteNo">
|
||||
<el-form-item label="关联甲方报价">
|
||||
<el-button type="text" size="small" @click="viewClientQuote">
|
||||
{{ editForm.clientQuoteNo }} - {{ editForm.clientName || '' }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="editForm.remark" type="textarea" :rows="2" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="edit-card" style="margin-top:12px">
|
||||
<div slot="header">
|
||||
<strong>物料明细</strong>
|
||||
<el-button style="float:right" type="primary" size="mini" icon="el-icon-plus" @click="addEditItem">添加行</el-button>
|
||||
</div>
|
||||
<el-table :data="editForm.items" border size="small">
|
||||
<el-table-column type="index" width="46" label="#" />
|
||||
<el-table-column label="物料名称" min-width="160">
|
||||
<template slot-scope="s">
|
||||
<el-input v-model="s.row.materialName" size="mini" placeholder="物料名称" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="规格型号" min-width="130">
|
||||
<template slot-scope="s">
|
||||
<el-input v-model="s.row.spec" size="mini" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="80">
|
||||
<template slot-scope="s">
|
||||
<el-input v-model="s.row.unit" size="mini" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" width="110">
|
||||
<template slot-scope="s">
|
||||
<el-input-number v-model="s.row.quantity" :min="0" :precision="2" size="small" style="width:100%" controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="预期单价" width="130">
|
||||
<template slot-scope="s">
|
||||
<el-input-number v-model="s.row.expectedPrice" :min="0" :precision="2" size="small" style="width:100%" controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="参考来源" width="90" align="center">
|
||||
<template slot-scope="s">
|
||||
<span v-if="s.row._fromClient" style="color:#409eff;font-size:12px">甲方报价</span>
|
||||
</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="removeEditItem(s.$index)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div v-if="!editForm.items || editForm.items.length === 0"
|
||||
style="text-align:center;padding:20px;color:#c0c4cc;font-size:13px">
|
||||
暂无物料,点击上方「添加行」按钮添加
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getRfq } from "@/api/bid/rfq";
|
||||
import { getRfq, updateRfq } from "@/api/bid/rfq";
|
||||
import { listQuotation } from "@/api/bid/quotation";
|
||||
import logoImg from "@/assets/logo/logo.png";
|
||||
import html2canvas from "html2canvas";
|
||||
@@ -92,26 +206,109 @@ export default {
|
||||
name: "RfqDetail",
|
||||
data() {
|
||||
return {
|
||||
loading: false, pdfLoading: false,
|
||||
loading: false, saving: false, pdfLoading: false,
|
||||
rfq: null, quotations: [],
|
||||
isEditing: false,
|
||||
editForm: { items: [] },
|
||||
editRules: {
|
||||
rfqTitle: [{ required: true, message: "标题不能为空", trigger: "blur" }]
|
||||
},
|
||||
logoSrc: logoImg
|
||||
};
|
||||
},
|
||||
created() {
|
||||
const rfqId = this.$route.query.rfqId;
|
||||
if (rfqId) this.loadDetail(rfqId);
|
||||
const editMode = this.$route.query.edit === '1';
|
||||
if (rfqId) {
|
||||
this.loadDetail(rfqId, editMode);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadDetail(rfqId) {
|
||||
loadDetail(rfqId, editMode) {
|
||||
this.loading = true;
|
||||
getRfq(rfqId).then(r => {
|
||||
this.rfq = r.data;
|
||||
if (editMode && this.rfq && this.rfq.status === 'draft') {
|
||||
this.isEditing = true;
|
||||
this.initEditForm();
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
}).catch(() => { this.loading = false; });
|
||||
listQuotation({ rfqId, pageSize: 50 }).then(r => {
|
||||
this.quotations = r.rows || [];
|
||||
});
|
||||
},
|
||||
|
||||
// ---- 编辑模式 ----
|
||||
initEditForm() {
|
||||
this.editForm = {
|
||||
rfqId: this.rfq.rfqId,
|
||||
rfqNo: this.rfq.rfqNo,
|
||||
rfqTitle: this.rfq.rfqTitle,
|
||||
deadline: this.rfq.deadline,
|
||||
deliveryAddr: this.rfq.deliveryAddr || '',
|
||||
clientQuoteId: this.rfq.clientQuoteId,
|
||||
clientQuoteNo: this.rfq.clientQuoteNo,
|
||||
clientName: this.rfq.clientName,
|
||||
remark: this.rfq.remark || '',
|
||||
status: this.rfq.status,
|
||||
items: (this.rfq.items || []).map(item => ({ ...item }))
|
||||
};
|
||||
},
|
||||
|
||||
startEdit() {
|
||||
if (this.rfq.status !== 'draft') {
|
||||
this.$message.warning('只有草稿状态的RFQ可以编辑');
|
||||
return;
|
||||
}
|
||||
this.initEditForm();
|
||||
this.isEditing = true;
|
||||
},
|
||||
|
||||
cancelEdit() {
|
||||
this.isEditing = false;
|
||||
this.editForm = { items: [] };
|
||||
},
|
||||
|
||||
handleSave() {
|
||||
this.$refs.editForm.validate(valid => {
|
||||
if (!valid) return;
|
||||
this.saving = true;
|
||||
updateRfq(this.editForm).then(() => {
|
||||
this.$modal.msgSuccess("保存成功");
|
||||
this.isEditing = false;
|
||||
// 重新加载数据刷新视图
|
||||
return getRfq(this.editForm.rfqId);
|
||||
}).then(r => {
|
||||
this.rfq = r.data;
|
||||
this.quotations = [];
|
||||
listQuotation({ rfqId: this.editForm.rfqId, pageSize: 50 }).then(res => {
|
||||
this.quotations = res.rows || [];
|
||||
});
|
||||
}).catch(() => {}).finally(() => { this.saving = false; });
|
||||
});
|
||||
},
|
||||
|
||||
addEditItem() {
|
||||
if (!this.editForm.items) this.editForm.items = [];
|
||||
this.editForm.items.push({
|
||||
materialName: '', spec: '', unit: '', quantity: 1, expectedPrice: null
|
||||
});
|
||||
},
|
||||
|
||||
removeEditItem(idx) {
|
||||
this.editForm.items.splice(idx, 1);
|
||||
},
|
||||
|
||||
// ---- 关联跳转 ----
|
||||
viewClientQuote() {
|
||||
const quoteId = this.rfq ? this.rfq.clientQuoteId : this.editForm.clientQuoteId;
|
||||
if (quoteId) {
|
||||
this.$router.push({ path: '/quotemgr/clientquote/detail', query: { quoteId } });
|
||||
}
|
||||
},
|
||||
|
||||
// ---- PDF导出 ----
|
||||
async exportPdf() {
|
||||
this.pdfLoading = true;
|
||||
try {
|
||||
@@ -134,6 +331,7 @@ export default {
|
||||
this.pdfLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
statusType(s) { return { draft:"info", published:"warning", closed:"", completed:"success" }[s] || ""; },
|
||||
statusLabel(s) { return { draft:"草稿", published:"已发布", closed:"已关闭", completed:"已完成" }[s] || s; },
|
||||
qStatusType(s) { return { draft:"info", submitted:"warning", accepted:"success", rejected:"danger" }[s] || ""; },
|
||||
@@ -148,6 +346,7 @@ export default {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
.edit-card ::v-deep .el-card__body { padding: 20px; }
|
||||
.pdf-area {
|
||||
padding: 28px;
|
||||
background: #fff;
|
||||
|
||||
@@ -27,9 +27,20 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table v-loading="loading" :data="list" border stripe>
|
||||
<el-table-column label="RFQ编号" prop="rfqNo" width="150" />
|
||||
<el-table-column label="标题" prop="rfqTitle" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="标题" prop="rfqTitle" min-width="160" show-overflow-tooltip />
|
||||
<el-table-column label="关联甲方报价" width="180">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.clientQuoteNo">
|
||||
<el-tag size="small" type="info" style="cursor:pointer" @click="viewClientQuote(scope.row)">
|
||||
{{ scope.row.clientQuoteNo }}
|
||||
</el-tag>
|
||||
<div style="font-size:12px;color:#909399;margin-top:2px">{{ scope.row.clientName || '' }}</div>
|
||||
</div>
|
||||
<span v-else style="color:#c0c4cc">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="截止日期" prop="deadline" width="160" />
|
||||
<el-table-column label="状态" width="100">
|
||||
<template slot-scope="scope">
|
||||
@@ -37,7 +48,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="createTime" width="160" />
|
||||
<el-table-column label="操作" align="center" width="200">
|
||||
<el-table-column label="操作" align="center" width="200" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-if="scope.row.status==='draft'">编辑</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-s-promotion" @click="handlePublish(scope.row)" v-if="scope.row.status==='draft'">发布</el-button>
|
||||
@@ -50,7 +61,7 @@
|
||||
|
||||
<!-- Create/Edit Dialog -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="RFQ标题" prop="rfqTitle">
|
||||
@@ -63,9 +74,22 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="交货地址" prop="deliveryAddr">
|
||||
<el-input v-model="form.deliveryAddr" placeholder="请输入交货地址" />
|
||||
</el-form-item>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="关联甲方报价">
|
||||
<el-select v-model="form.clientQuoteId" placeholder="选择甲方报价(可选)" filterable clearable style="width:100%"
|
||||
@change="onClientQuoteSelect">
|
||||
<el-option v-for="q in clientQuoteOptions" :key="q.quoteId"
|
||||
:label="q.quoteNo + ' - ' + q.clientName" :value="q.quoteId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="交货地址" prop="deliveryAddr">
|
||||
<el-input v-model="form.deliveryAddr" placeholder="请输入交货地址" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider content-position="left">物料明细</el-divider>
|
||||
<el-table :data="form.items || []" border size="small">
|
||||
@@ -94,6 +118,11 @@
|
||||
<el-input-number v-model="scope.row.expectedPrice" :min="0" :precision="2" size="small" style="width:110px" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="参考来源" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row._fromClient" style="color:#409eff;font-size:12px">甲方报价</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="60" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" icon="el-icon-delete" @click="removeItem(scope.$index)" style="color:#f56c6c" />
|
||||
@@ -127,8 +156,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRfq, getRfq, addRfq, updateRfq, publishRfq, delRfq } from "@/api/bid/rfq";
|
||||
import { listRfq, getRfq, addRfq, updateRfq, publishRfq, delRfq, getClientQuoteOptions, createRfqFromQuote } from "@/api/bid/rfq";
|
||||
import { listSupplier } from "@/api/bid/supplier";
|
||||
import { getClientQuote } from "@/api/bid/clientquote";
|
||||
|
||||
export default {
|
||||
name: "Rfq",
|
||||
data() {
|
||||
@@ -136,12 +167,30 @@ export default {
|
||||
loading: false, total: 0, list: [],
|
||||
open: false, title: "",
|
||||
publishOpen: false, publishRfqId: null, selectedSuppliers: [], supplierOptions: [],
|
||||
clientQuoteOptions: [],
|
||||
queryParams: { pageNum: 1, pageSize: 10, rfqNo: null, rfqTitle: null, status: null },
|
||||
form: { items: [] },
|
||||
rules: { rfqTitle: [{ required: true, message: "标题不能为空", trigger: "blur" }] }
|
||||
};
|
||||
},
|
||||
created() { this.getList(); this.loadSuppliers(); },
|
||||
created() {
|
||||
this.getList();
|
||||
this.loadSuppliers();
|
||||
this.loadClientQuoteOptions();
|
||||
// 接收外部传入参数:生成RFQ后自动打开编辑弹窗
|
||||
this.$nextTick(() => {
|
||||
const rfqId = this.$route.query.rfqId;
|
||||
const rfqNo = this.$route.query.rfqNo;
|
||||
const action = this.$route.query.action;
|
||||
if (rfqNo) {
|
||||
this.queryParams.rfqNo = rfqNo;
|
||||
this.handleQuery();
|
||||
}
|
||||
if (rfqId && action === 'edit') {
|
||||
this.handleUpdate({ rfqId: Number(rfqId) });
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
@@ -150,16 +199,23 @@ export default {
|
||||
loadSuppliers() {
|
||||
listSupplier({ pageSize: 100 }).then(r => { this.supplierOptions = r.rows || []; });
|
||||
},
|
||||
loadClientQuoteOptions() {
|
||||
getClientQuoteOptions().then(r => { this.clientQuoteOptions = r.data || []; });
|
||||
},
|
||||
handleQuery() { this.queryParams.pageNum = 1; this.getList(); },
|
||||
resetQuery() { this.resetForm("queryForm"); this.handleQuery(); },
|
||||
handleAdd() {
|
||||
this.form = { items: [], status: "draft" };
|
||||
this.form = { items: [], status: "draft", clientQuoteId: null };
|
||||
this.open = true; this.title = "新建报价请求";
|
||||
},
|
||||
handleUpdate(row) {
|
||||
getRfq(row.rfqId).then(r => { this.form = r.data; this.open = true; this.title = "编辑报价请求"; });
|
||||
getRfq(row.rfqId).then(r => {
|
||||
this.form = r.data || {};
|
||||
if (!this.form.items) this.form.items = [];
|
||||
this.open = true; this.title = "编辑报价请求";
|
||||
});
|
||||
},
|
||||
handleView(row) { this.$router.push({ path: "/procurement/rfq/detail", query: { rfqId: row.rfqId } }); },
|
||||
handleView(row) { this.handleUpdate(row); },
|
||||
handlePublish(row) { this.publishRfqId = row.rfqId; this.selectedSuppliers = []; this.publishOpen = true; },
|
||||
doPublish() {
|
||||
publishRfq(this.publishRfqId, this.selectedSuppliers).then(() => {
|
||||
@@ -178,6 +234,35 @@ export default {
|
||||
action(this.form).then(() => { this.$modal.msgSuccess("保存成功"); this.open = false; this.getList(); });
|
||||
});
|
||||
},
|
||||
/** 选中甲方报价后自动填充物料 */
|
||||
onClientQuoteSelect(quoteId) {
|
||||
if (!quoteId) return;
|
||||
getClientQuote(quoteId).then(r => {
|
||||
const quote = r.data || {};
|
||||
const items = (quote.items || []).map(item => ({
|
||||
materialId: item.materialId,
|
||||
materialName: item.materialName,
|
||||
spec: item.spec || item.modelNo || '',
|
||||
unit: item.unit || '件',
|
||||
quantity: item.quantity || 1,
|
||||
expectedPrice: item.unitPrice || null,
|
||||
_fromClient: true
|
||||
}));
|
||||
if (items.length > 0) {
|
||||
this.form.items = items;
|
||||
if (!this.form.rfqTitle) {
|
||||
this.form.rfqTitle = "采购需求: " + (quote.clientName || '') + " - " + (quote.quoteNo || '');
|
||||
}
|
||||
this.$message.success(`已加载 ${items.length} 项物料`);
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 查看关联的甲方报价 */
|
||||
viewClientQuote(row) {
|
||||
if (row.clientQuoteId) {
|
||||
this.$router.push({ path: '/quotemgr/clientquote/detail', query: { quoteId: row.clientQuoteId } });
|
||||
}
|
||||
},
|
||||
statusType(s) { return { draft:"info", published:"warning", closed:"", completed:"success" }[s] || ""; },
|
||||
statusLabel(s) { return { draft:"草稿", published:"已发布", closed:"已关闭", completed:"已完成" }[s] || s; }
|
||||
}
|
||||
|
||||
12
sql/20260601/005_rfq_add_client_quote_id.sql
Normal file
12
sql/20260601/005_rfq_add_client_quote_id.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- ============================================================================
|
||||
-- RFQ(报价请求)关联甲方报价
|
||||
-- 说明:在 biz_rfq 表添加 client_quote_id 字段,建立 RFQ 与甲方报价的关联
|
||||
-- 业务流程:甲方报价 → RFQ(采购询价)→ 供应商报价
|
||||
-- ============================================================================
|
||||
|
||||
-- 1. 添加 client_quote_id 字段
|
||||
ALTER TABLE biz_rfq
|
||||
ADD COLUMN client_quote_id BIGINT DEFAULT NULL COMMENT '关联甲方报价ID(biz_client_quote.quote_id)' AFTER delivery_addr;
|
||||
|
||||
-- 2. 创建索引
|
||||
CREATE INDEX idx_rfq_client_quote_id ON biz_rfq (client_quote_id);
|
||||
Reference in New Issue
Block a user