Commit 30406f1b authored by 耿迪迪's avatar 耿迪迪

交易中心

parent 16eefd05
package com.zehong.web.controller.transaction;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.TTradeProject;
import com.zehong.system.service.ITTradeProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 交易项目Controller
*
* @author zehong
* @date 2023-06-08
*/
@RestController
@RequestMapping("/trade/project")
public class TTradeProjectController extends BaseController
{
@Autowired
private ITTradeProjectService tTradeProjectService;
/**
* 查询交易项目列表
*/
@PreAuthorize("@ss.hasPermi('trade:project:list')")
@GetMapping("/list")
public TableDataInfo list(TTradeProject tTradeProject)
{
startPage();
List<TTradeProject> list = tTradeProjectService.selectTTradeProjectList(tTradeProject);
return getDataTable(list);
}
/**
* 导出交易项目列表
*/
@PreAuthorize("@ss.hasPermi('trade:project:export')")
@Log(title = "交易项目", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TTradeProject tTradeProject)
{
List<TTradeProject> list = tTradeProjectService.selectTTradeProjectList(tTradeProject);
ExcelUtil<TTradeProject> util = new ExcelUtil<TTradeProject>(TTradeProject.class);
return util.exportExcel(list, "交易项目数据");
}
/**
* 获取交易项目详细信息
*/
@PreAuthorize("@ss.hasPermi('trade:project:query')")
@GetMapping(value = "/{tradeId}")
public AjaxResult getInfo(@PathVariable("tradeId") Long tradeId)
{
return AjaxResult.success(tTradeProjectService.selectTTradeProjectById(tradeId));
}
/**
* 新增交易项目
*/
@PreAuthorize("@ss.hasPermi('trade:project:add')")
@Log(title = "交易项目", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TTradeProject tTradeProject)
{
return toAjax(tTradeProjectService.insertTTradeProject(tTradeProject));
}
/**
* 修改交易项目
*/
@PreAuthorize("@ss.hasPermi('trade:project:edit')")
@Log(title = "交易项目", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TTradeProject tTradeProject)
{
return toAjax(tTradeProjectService.updateTTradeProject(tTradeProject));
}
/**
* 删除交易项目
*/
@PreAuthorize("@ss.hasPermi('trade:project:remove')")
@Log(title = "交易项目", businessType = BusinessType.DELETE)
@DeleteMapping("/{tradeIds}")
public AjaxResult remove(@PathVariable Long[] tradeIds)
{
return toAjax(tTradeProjectService.deleteTTradeProjectByIds(tradeIds));
}
}
...@@ -21,7 +21,7 @@ import java.util.List; ...@@ -21,7 +21,7 @@ import java.util.List;
* @date 2023-06-05 * @date 2023-06-05
*/ */
@RestController @RestController
@RequestMapping("/system/project") @RequestMapping("/transaction/project")
public class TTransactionProjectController extends BaseController public class TTransactionProjectController extends BaseController
{ {
@Autowired @Autowired
...@@ -39,6 +39,18 @@ public class TTransactionProjectController extends BaseController ...@@ -39,6 +39,18 @@ public class TTransactionProjectController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 获取所有交易项目
* @param tTransactionProject
* @return
*/
@GetMapping("/getTransactionProjectList")
public AjaxResult getTransactionProjectList(TTransactionProject tTransactionProject){
List<TTransactionProject> list = tTransactionProjectService.selectTTransactionProjectList(tTransactionProject);
return AjaxResult.success(list);
}
/** /**
* 导出交易项目列表 * 导出交易项目列表
*/ */
......
...@@ -90,7 +90,7 @@ zehong: ...@@ -90,7 +90,7 @@ zehong:
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/zehong/uploadPath,Linux配置 /home/zehong/uploadPath) # 文件路径 示例( Windows配置D:/zehong/uploadPath,Linux配置 /home/zehong/uploadPath)
profile: /home/zehong/uploadPath profile: D:/zehong/uploadPath
# 获取ip地址开关 # 获取ip地址开关
addressEnabled: false addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证 # 验证码类型 math 数组计算 char 字符验证
......
package com.zehong.system.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* 交易项目对象 t_trade_project
*
* @author zehong
* @date 2023-06-08
*/
public class TTradeProject extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 交易主键 */
private Long tradeId;
/** 单据编号 */
@Excel(name = "单据编号")
private String receiptNum;
/** 关联交易项目 */
@Excel(name = "关联交易项目")
private Long relationTransactionProjectId;
/** 申请人 */
@Excel(name = "申请人")
private Long applyId;
/** 申请部门 */
@Excel(name = "申请部门")
private Long applyDeptId;
/** 申请部门长 */
@Excel(name = "申请部门长")
private Long applyDeptManagerId;
/** 交易经办人 */
@Excel(name = "交易经办人")
private Long tradeTransactor;
/** 交易部门 */
@Excel(name = "交易部门")
private Long tradeDeptId;
/** 交易单价 */
@Excel(name = "交易单价")
private BigDecimal tradePrice;
/** 交易数量 */
@Excel(name = "交易数量")
private BigDecimal tradeCount;
/** 交易总价 */
@Excel(name = "交易总价")
private BigDecimal tradeTotal;
/** 交易评分 */
@Excel(name = "交易评分")
private Integer tradeScore;
/** 交易部门长 */
@Excel(name = "交易部门长")
private Long tradeDeptManagerId;
/** 结算时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结算时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date settlementTime;
/** 交易成交价 */
@Excel(name = "交易成交价")
private BigDecimal dealPrice;
/** 尾款 */
@Excel(name = "尾款")
private BigDecimal pendingPayment;
/** 附件 */
@Excel(name = "附件")
private String attachmentUrl;
/** 交易状态:0.申请中 1.待经办人评价 2.待对方部门长确认 3.待本部门长确认 4.驳回 5.完成 */
@Excel(name = "交易状态:0.申请中 1.待经办人评价 2.待对方部门长确认 3.待本部门长确认 4.驳回 5.完成")
private String tradeStatus;
/** 是否删除:0否,1是 */
@Excel(name = "是否删除:0否,1是")
private String isDel;
private String applyName;
private String applyDeptName;
private String tradeDeptName;
public void setTradeId(Long tradeId)
{
this.tradeId = tradeId;
}
public Long getTradeId()
{
return tradeId;
}
public void setReceiptNum(String receiptNum)
{
this.receiptNum = receiptNum;
}
public String getReceiptNum()
{
return receiptNum;
}
public void setRelationTransactionProjectId(Long relationTransactionProjectId)
{
this.relationTransactionProjectId = relationTransactionProjectId;
}
public Long getRelationTransactionProjectId()
{
return relationTransactionProjectId;
}
public void setApplyId(Long applyId)
{
this.applyId = applyId;
}
public Long getApplyId()
{
return applyId;
}
public void setApplyDeptId(Long applyDeptId)
{
this.applyDeptId = applyDeptId;
}
public Long getApplyDeptId()
{
return applyDeptId;
}
public void setApplyDeptManagerId(Long applyDeptManagerId)
{
this.applyDeptManagerId = applyDeptManagerId;
}
public Long getApplyDeptManagerId()
{
return applyDeptManagerId;
}
public void setTradeTransactor(Long tradeTransactor)
{
this.tradeTransactor = tradeTransactor;
}
public Long getTradeTransactor()
{
return tradeTransactor;
}
public void setTradeDeptId(Long tradeDeptId)
{
this.tradeDeptId = tradeDeptId;
}
public Long getTradeDeptId()
{
return tradeDeptId;
}
public void setTradePrice(BigDecimal tradePrice)
{
this.tradePrice = tradePrice;
}
public BigDecimal getTradePrice()
{
return tradePrice;
}
public void setTradeCount(BigDecimal tradeCount)
{
this.tradeCount = tradeCount;
}
public BigDecimal getTradeCount()
{
return tradeCount;
}
public void setTradeTotal(BigDecimal tradeTotal)
{
this.tradeTotal = tradeTotal;
}
public BigDecimal getTradeTotal()
{
return tradeTotal;
}
public void setTradeScore(Integer tradeScore)
{
this.tradeScore = tradeScore;
}
public Integer getTradeScore()
{
return tradeScore;
}
public void setTradeDeptManagerId(Long tradeDeptManagerId)
{
this.tradeDeptManagerId = tradeDeptManagerId;
}
public Long getTradeDeptManagerId()
{
return tradeDeptManagerId;
}
public void setSettlementTime(Date settlementTime)
{
this.settlementTime = settlementTime;
}
public Date getSettlementTime()
{
return settlementTime;
}
public void setDealPrice(BigDecimal dealPrice)
{
this.dealPrice = dealPrice;
}
public BigDecimal getDealPrice()
{
return dealPrice;
}
public void setPendingPayment(BigDecimal pendingPayment)
{
this.pendingPayment = pendingPayment;
}
public BigDecimal getPendingPayment()
{
return pendingPayment;
}
public void setAttachmentUrl(String attachmentUrl)
{
this.attachmentUrl = attachmentUrl;
}
public String getAttachmentUrl()
{
return attachmentUrl;
}
public void setTradeStatus(String tradeStatus)
{
this.tradeStatus = tradeStatus;
}
public String getTradeStatus()
{
return tradeStatus;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
}
public String getIsDel()
{
return isDel;
}
public String getApplyName() {
return applyName;
}
public void setApplyName(String applyName) {
this.applyName = applyName;
}
public String getApplyDeptName() {
return applyDeptName;
}
public void setApplyDeptName(String applyDeptName) {
this.applyDeptName = applyDeptName;
}
public String getTradeDeptName() {
return tradeDeptName;
}
public void setTradeDeptName(String tradeDeptName) {
this.tradeDeptName = tradeDeptName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("tradeId", getTradeId())
.append("receiptNum", getReceiptNum())
.append("relationTransactionProjectId", getRelationTransactionProjectId())
.append("applyId", getApplyId())
.append("applyDeptId", getApplyDeptId())
.append("applyDeptManagerId", getApplyDeptManagerId())
.append("tradeTransactor", getTradeTransactor())
.append("tradeDeptId", getTradeDeptId())
.append("tradePrice", getTradePrice())
.append("tradeCount", getTradeCount())
.append("tradeTotal", getTradeTotal())
.append("tradeScore", getTradeScore())
.append("tradeDeptManagerId", getTradeDeptManagerId())
.append("settlementTime", getSettlementTime())
.append("dealPrice", getDealPrice())
.append("pendingPayment", getPendingPayment())
.append("attachmentUrl", getAttachmentUrl())
.append("tradeStatus", getTradeStatus())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("isDel", getIsDel())
.append("remark", getRemark())
.toString();
}
}
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TTradeProject;
/**
* 交易项目Mapper接口
*
* @author zehong
* @date 2023-06-08
*/
public interface TTradeProjectMapper
{
/**
* 查询交易项目
*
* @param tradeId 交易项目ID
* @return 交易项目
*/
public TTradeProject selectTTradeProjectById(Long tradeId);
/**
* 查询交易项目列表
*
* @param tTradeProject 交易项目
* @return 交易项目集合
*/
public List<TTradeProject> selectTTradeProjectList(TTradeProject tTradeProject);
/**
* 新增交易项目
*
* @param tTradeProject 交易项目
* @return 结果
*/
public int insertTTradeProject(TTradeProject tTradeProject);
/**
* 修改交易项目
*
* @param tTradeProject 交易项目
* @return 结果
*/
public int updateTTradeProject(TTradeProject tTradeProject);
/**
* 删除交易项目
*
* @param tradeId 交易项目ID
* @return 结果
*/
public int deleteTTradeProjectById(Long tradeId);
/**
* 批量删除交易项目
*
* @param tradeIds 需要删除的数据ID
* @return 结果
*/
public int deleteTTradeProjectByIds(Long[] tradeIds);
}
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TTradeProject;
/**
* 交易项目Service接口
*
* @author zehong
* @date 2023-06-08
*/
public interface ITTradeProjectService
{
/**
* 查询交易项目
*
* @param tradeId 交易项目ID
* @return 交易项目
*/
public TTradeProject selectTTradeProjectById(Long tradeId);
/**
* 查询交易项目列表
*
* @param tTradeProject 交易项目
* @return 交易项目集合
*/
public List<TTradeProject> selectTTradeProjectList(TTradeProject tTradeProject);
/**
* 新增交易项目
*
* @param tTradeProject 交易项目
* @return 结果
*/
public int insertTTradeProject(TTradeProject tTradeProject);
/**
* 修改交易项目
*
* @param tTradeProject 交易项目
* @return 结果
*/
public int updateTTradeProject(TTradeProject tTradeProject);
/**
* 批量删除交易项目
*
* @param tradeIds 需要删除的交易项目ID
* @return 结果
*/
public int deleteTTradeProjectByIds(Long[] tradeIds);
/**
* 删除交易项目信息
*
* @param tradeId 交易项目ID
* @return 结果
*/
public int deleteTTradeProjectById(Long tradeId);
}
package com.zehong.system.service.impl;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.DateUtils;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TTradeProject;
import com.zehong.system.mapper.TTradeProjectMapper;
import com.zehong.system.service.ITTradeProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 交易项目Service业务层处理
*
* @author zehong
* @date 2023-06-08
*/
@Service
public class TTradeProjectServiceImpl implements ITTradeProjectService
{
@Autowired
private TTradeProjectMapper tTradeProjectMapper;
/**
* 查询交易项目
*
* @param tradeId 交易项目ID
* @return 交易项目
*/
@Override
public TTradeProject selectTTradeProjectById(Long tradeId)
{
return tTradeProjectMapper.selectTTradeProjectById(tradeId);
}
/**
* 查询交易项目列表
*
* @param tTradeProject 交易项目
* @return 交易项目
*/
@Override
public List<TTradeProject> selectTTradeProjectList(TTradeProject tTradeProject)
{
return tTradeProjectMapper.selectTTradeProjectList(tTradeProject);
}
/**
* 新增交易项目
*
* @param tTradeProject 交易项目
* @return 结果
*/
@Override
public int insertTTradeProject(TTradeProject tTradeProject)
{
tTradeProject.setReceiptNum("ZEHONG" + DateUtils.dateTimeNow());
SysUser user = SecurityUtils.getLoginUser().getUser();
tTradeProject.setApplyId(user.getUserId());
tTradeProject.setApplyDeptId(user.getDeptId());
tTradeProject.setCreateTime(DateUtils.getNowDate());
return tTradeProjectMapper.insertTTradeProject(tTradeProject);
}
/**
* 修改交易项目
*
* @param tTradeProject 交易项目
* @return 结果
*/
@Override
public int updateTTradeProject(TTradeProject tTradeProject)
{
tTradeProject.setUpdateTime(DateUtils.getNowDate());
return tTradeProjectMapper.updateTTradeProject(tTradeProject);
}
/**
* 批量删除交易项目
*
* @param tradeIds 需要删除的交易项目ID
* @return 结果
*/
@Override
public int deleteTTradeProjectByIds(Long[] tradeIds)
{
return tTradeProjectMapper.deleteTTradeProjectByIds(tradeIds);
}
/**
* 删除交易项目信息
*
* @param tradeId 交易项目ID
* @return 结果
*/
@Override
public int deleteTTradeProjectById(Long tradeId)
{
return tTradeProjectMapper.deleteTTradeProjectById(tradeId);
}
}
<?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.zehong.system.mapper.TTradeProjectMapper">
<resultMap type="TTradeProject" id="TTradeProjectResult">
<result property="tradeId" column="trade_id" />
<result property="receiptNum" column="receipt_num" />
<result property="relationTransactionProjectId" column="relation_transaction_project_id" />
<result property="applyId" column="apply_id" />
<result property="applyDeptId" column="apply_dept_id" />
<result property="applyDeptManagerId" column="apply_dept_manager_id" />
<result property="tradeTransactor" column="trade_transactor" />
<result property="tradeDeptId" column="trade_dept_id" />
<result property="tradePrice" column="trade_price" />
<result property="tradeCount" column="trade_count" />
<result property="tradeTotal" column="trade_total" />
<result property="tradeScore" column="trade_score" />
<result property="tradeDeptManagerId" column="trade_dept_manager_id" />
<result property="settlementTime" column="settlement_time" />
<result property="dealPrice" column="deal_price" />
<result property="pendingPayment" column="pending_payment" />
<result property="attachmentUrl" column="attachment_url" />
<result property="tradeStatus" column="trade_status" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="isDel" column="is_del" />
<result property="remark" column="remark" />
<result property="applyName" column="apply_name"/>
<result property="applyDeptName" column="apply_dept_name"/>
<result property="tradeDeptName" column="trade_dept_name"/>
</resultMap>
<sql id="selectTTradeProjectVo">
SELECT
trade_id,
receipt_num,
relation_transaction_project_id,
apply_id,
apply_dept_id,
apply_dept_manager_id,
trade_transactor,
trade_dept_id,
trade_price,
trade_count,
trade_total,
trade_score,
trade_dept_manager_id,
settlement_time,
deal_price,
pending_payment,
attachment_url,
trade_status,
create_time,
update_time,
is_del,
remark,
(SELECT nick_name FROM sys_user WHERE user_id = apply_id) AS apply_name,
(SELECT dept_name FROM sys_dept WHERE dept_id = apply_dept_id) AS apply_dept_name,
(SELECT dept_name FROM sys_dept WHERE dept_id = trade_dept_id) AS trade_dept_name
FROM
t_trade_project
</sql>
<select id="selectTTradeProjectList" parameterType="TTradeProject" resultMap="TTradeProjectResult">
<include refid="selectTTradeProjectVo"/>
<where>
<if test="receiptNum != null and receiptNum != ''"> and receipt_num = #{receiptNum}</if>
<if test="relationTransactionProjectId != null "> and relation_transaction_project_id = #{relationTransactionProjectId}</if>
<if test="applyId != null "> and apply_id = #{applyId}</if>
<if test="applyDeptId != null "> and apply_dept_id = #{applyDeptId}</if>
<if test="applyDeptManagerId != null "> and apply_dept_manager_id = #{applyDeptManagerId}</if>
<if test="tradeTransactor != null "> and trade_transactor = #{tradeTransactor}</if>
<if test="tradeDeptId != null "> and trade_dept_id = #{tradeDeptId}</if>
<if test="tradePrice != null "> and trade_price = #{tradePrice}</if>
<if test="tradeCount != null "> and trade_count = #{tradeCount}</if>
<if test="tradeTotal != null "> and trade_total = #{tradeTotal}</if>
<if test="tradeScore != null "> and trade_score = #{tradeScore}</if>
<if test="tradeDeptManagerId != null "> and trade_dept_manager_id = #{tradeDeptManagerId}</if>
<if test="settlementTime != null "> and settlement_time = #{settlementTime}</if>
<if test="dealPrice != null "> and deal_price = #{dealPrice}</if>
<if test="pendingPayment != null "> and pending_payment = #{pendingPayment}</if>
<if test="attachmentUrl != null and attachmentUrl != ''"> and attachment_url = #{attachmentUrl}</if>
<if test="tradeStatus != null and tradeStatus != ''"> and trade_status = #{tradeStatus}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
</where>
</select>
<select id="selectTTradeProjectById" parameterType="Long" resultMap="TTradeProjectResult">
<include refid="selectTTradeProjectVo"/>
where trade_id = #{tradeId}
</select>
<insert id="insertTTradeProject" parameterType="TTradeProject" useGeneratedKeys="true" keyProperty="tradeId">
insert into t_trade_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="receiptNum != null">receipt_num,</if>
<if test="relationTransactionProjectId != null">relation_transaction_project_id,</if>
<if test="applyId != null">apply_id,</if>
<if test="applyDeptId != null">apply_dept_id,</if>
<if test="applyDeptManagerId != null">apply_dept_manager_id,</if>
<if test="tradeTransactor != null">trade_transactor,</if>
<if test="tradeDeptId != null">trade_dept_id,</if>
<if test="tradePrice != null">trade_price,</if>
<if test="tradeCount != null">trade_count,</if>
<if test="tradeTotal != null">trade_total,</if>
<if test="tradeScore != null">trade_score,</if>
<if test="tradeDeptManagerId != null">trade_dept_manager_id,</if>
<if test="settlementTime != null">settlement_time,</if>
<if test="dealPrice != null">deal_price,</if>
<if test="pendingPayment != null">pending_payment,</if>
<if test="attachmentUrl != null">attachment_url,</if>
<if test="tradeStatus != null">trade_status,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="receiptNum != null">#{receiptNum},</if>
<if test="relationTransactionProjectId != null">#{relationTransactionProjectId},</if>
<if test="applyId != null">#{applyId},</if>
<if test="applyDeptId != null">#{applyDeptId},</if>
<if test="applyDeptManagerId != null">#{applyDeptManagerId},</if>
<if test="tradeTransactor != null">#{tradeTransactor},</if>
<if test="tradeDeptId != null">#{tradeDeptId},</if>
<if test="tradePrice != null">#{tradePrice},</if>
<if test="tradeCount != null">#{tradeCount},</if>
<if test="tradeTotal != null">#{tradeTotal},</if>
<if test="tradeScore != null">#{tradeScore},</if>
<if test="tradeDeptManagerId != null">#{tradeDeptManagerId},</if>
<if test="settlementTime != null">#{settlementTime},</if>
<if test="dealPrice != null">#{dealPrice},</if>
<if test="pendingPayment != null">#{pendingPayment},</if>
<if test="attachmentUrl != null">#{attachmentUrl},</if>
<if test="tradeStatus != null">#{tradeStatus},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTTradeProject" parameterType="TTradeProject">
update t_trade_project
<trim prefix="SET" suffixOverrides=",">
<if test="receiptNum != null">receipt_num = #{receiptNum},</if>
<if test="relationTransactionProjectId != null">relation_transaction_project_id = #{relationTransactionProjectId},</if>
<if test="applyId != null">apply_id = #{applyId},</if>
<if test="applyDeptId != null">apply_dept_id = #{applyDeptId},</if>
<if test="applyDeptManagerId != null">apply_dept_manager_id = #{applyDeptManagerId},</if>
<if test="tradeTransactor != null">trade_transactor = #{tradeTransactor},</if>
<if test="tradeDeptId != null">trade_dept_id = #{tradeDeptId},</if>
<if test="tradePrice != null">trade_price = #{tradePrice},</if>
<if test="tradeCount != null">trade_count = #{tradeCount},</if>
<if test="tradeTotal != null">trade_total = #{tradeTotal},</if>
<if test="tradeScore != null">trade_score = #{tradeScore},</if>
<if test="tradeDeptManagerId != null">trade_dept_manager_id = #{tradeDeptManagerId},</if>
<if test="settlementTime != null">settlement_time = #{settlementTime},</if>
<if test="dealPrice != null">deal_price = #{dealPrice},</if>
<if test="pendingPayment != null">pending_payment = #{pendingPayment},</if>
<if test="attachmentUrl != null">attachment_url = #{attachmentUrl},</if>
<if test="tradeStatus != null">trade_status = #{tradeStatus},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where trade_id = #{tradeId}
</update>
<delete id="deleteTTradeProjectById" parameterType="Long">
delete from t_trade_project where trade_id = #{tradeId}
</delete>
<delete id="deleteTTradeProjectByIds" parameterType="String">
delete from t_trade_project where trade_id in
<foreach item="tradeId" collection="array" open="(" separator="," close=")">
#{tradeId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -3,16 +3,25 @@ import request from '@/utils/request' ...@@ -3,16 +3,25 @@ import request from '@/utils/request'
// 查询交易项目列表 // 查询交易项目列表
export function listProject(query) { export function listProject(query) {
return request({ return request({
url: '/system/project/list', url: '/transaction/project/list',
method: 'get',
params: query
})
}
//获取所有项目
export function getTransactionProjectList(query){
return request({
url: '/transaction/project/getTransactionProjectList',
method: 'get', method: 'get',
params: query params: query
}) })
} }
// 查询交易项目详细 // 查询交易项目详细
export function getProject(transactionProjectId) { export function getProject(transactionId) {
return request({ return request({
url: '/system/project/' + transactionProjectId, url: '/transaction/project/' + transactionId,
method: 'get' method: 'get'
}) })
} }
...@@ -20,7 +29,7 @@ export function getProject(transactionProjectId) { ...@@ -20,7 +29,7 @@ export function getProject(transactionProjectId) {
// 新增交易项目 // 新增交易项目
export function addProject(data) { export function addProject(data) {
return request({ return request({
url: '/system/project', url: '/transaction/project',
method: 'post', method: 'post',
data: data data: data
}) })
...@@ -29,16 +38,16 @@ export function addProject(data) { ...@@ -29,16 +38,16 @@ export function addProject(data) {
// 修改交易项目 // 修改交易项目
export function updateProject(data) { export function updateProject(data) {
return request({ return request({
url: '/system/project', url: '/transaction/project',
method: 'put', method: 'put',
data: data data: data
}) })
} }
// 删除交易项目 // 删除交易项目
export function delProject(transactionProjectId) { export function delProject(transactionId) {
return request({ return request({
url: '/system/project/' + transactionProjectId, url: '/transaction/project/' + transactionId,
method: 'delete' method: 'delete'
}) })
} }
...@@ -46,7 +55,7 @@ export function delProject(transactionProjectId) { ...@@ -46,7 +55,7 @@ export function delProject(transactionProjectId) {
// 导出交易项目 // 导出交易项目
export function exportProject(query) { export function exportProject(query) {
return request({ return request({
url: '/system/project/export', url: '/transaction/project/export',
method: 'get', method: 'get',
params: query params: query
}) })
......
import request from '@/utils/request'
// 查询交易项目列表
export function listProject(query) {
return request({
url: '/trade/project/list',
method: 'get',
params: query
})
}
// 查询交易项目详细
export function getProject(tradeId) {
return request({
url: '/trade/project/' + tradeId,
method: 'get'
})
}
// 新增交易项目
export function addProject(data) {
return request({
url: '/trade/project',
method: 'post',
data: data
})
}
// 修改交易项目
export function updateProject(data) {
return request({
url: '/trade/project',
method: 'put',
data: data
})
}
// 删除交易项目
export function delProject(tradeId) {
return request({
url: '/trade/project/' + tradeId,
method: 'delete'
})
}
// 导出交易项目
export function exportProject(query) {
return request({
url: '/trade/project/export',
method: 'get',
params: query
})
}
...@@ -2,30 +2,58 @@ ...@@ -2,30 +2,58 @@
<div class="upload-file"> <div class="upload-file">
<el-upload <el-upload
:action="uploadFileUrl" :action="uploadFileUrl"
:disabled="disabled"
:before-upload="handleBeforeUpload" :before-upload="handleBeforeUpload"
:file-list="fileList" :file-list="fileArr"
:limit="1" :limit="1"
:fileType="fileType"
:list-type="listType"
:on-error="handleUploadError" :on-error="handleUploadError"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:on-success="handleUploadSuccess" :on-success="handleUploadSuccess"
:show-file-list="false" :on-remove="handleRemove"
:on-preview="handleFileClick"
:on-change="fileChange"
:show-file-list="true"
:headers="headers" :headers="headers"
class="upload-file-uploader" class="upload-file-uploader"
:class="{ hide: fileArr.length > 0 || addShow }"
ref="upload" ref="upload"
> >
<!-- 上传按钮 --> <!-- 上传按钮 -->
<el-button size="mini" type="primary">选取文件</el-button> <el-button :disabled="disabled" plain type="primary">选取文件</el-button>
<!--<i class="el-icon-plus"></i>-->
<!-- 上传提示 --> <!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip"> <div class="el-upload__tip" slot="tip" v-if="showTip">
请上传 请上传
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template> <template v-if="fileSize">
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b>
的文件 </template>
<template v-if="fileType">
格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b>
</template>
的文件,且不超过一个
</div> </div>
</el-upload> </el-upload>
<el-image
v-show="false"
id="img"
ref="previewImg"
:src="dialogImageUrl"
:preview-src-list="bigImageArr"
:z-index="9999999"
></el-image>
<!-- <el-dialog
:center="true"
width="50%"
:modal="modal"
:visible.sync="dialogVisible"
>
<img :src="dialogImageUrl" alt="" />
</el-dialog> -->
<!-- 文件列表 --> <!-- 文件列表 -->
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul"> <!-- <transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in list"> <li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in list">
<el-link :href="file.url" :underline="false" target="_blank"> <el-link :href="file.url" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span> <span class="el-icon-document"> {{ getFileName(file.name) }} </span>
...@@ -34,21 +62,29 @@ ...@@ -34,21 +62,29 @@
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link> <el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
</div> </div>
</li> </li>
</transition-group> </transition-group> -->
</div> </div>
</template> </template>
<script> <script>
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
export default { export default {
props: { props: {
// 值 // 值
value: [String, Object, Array], value: [String, Object, Array],
listType: {
type: String,
defaule: "text",
},
// 大小限制(MB) // 大小限制(MB)
fileSize: { fileSize: {
type: Number, type: Number,
default: 5, default: 50,
},
fileArr: {
type: Array,
default: [],
}, },
// 文件类型, 例如['png', 'jpg', 'jpeg'] // 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: { fileType: {
...@@ -58,8 +94,12 @@ export default { ...@@ -58,8 +94,12 @@ export default {
// 是否显示提示 // 是否显示提示
isShowTip: { isShowTip: {
type: Boolean, type: Boolean,
default: true default: true,
} },
disabled: {
type: Boolean,
default:false,
},
}, },
data() { data() {
return { return {
...@@ -68,6 +108,10 @@ export default { ...@@ -68,6 +108,10 @@ export default {
Authorization: "Bearer " + getToken(), Authorization: "Bearer " + getToken(),
}, },
fileList: [], fileList: [],
modal: false,
dialogVisible: false,
dialogImageUrl: "",
addShow: true,
}; };
}, },
computed: { computed: {
...@@ -94,6 +138,9 @@ export default { ...@@ -94,6 +138,9 @@ export default {
return []; return [];
} }
}, },
bigImageArr() {
return [this.dialogImageUrl];
},
}, },
methods: { methods: {
// 上传前校检格式和大小 // 上传前校检格式和大小
...@@ -110,7 +157,9 @@ export default { ...@@ -110,7 +157,9 @@ export default {
return false; return false;
}); });
if (!isTypeOk) { if (!isTypeOk) {
this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`); this.$message.error(
`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`
);
return false; return false;
} }
} }
...@@ -135,12 +184,42 @@ export default { ...@@ -135,12 +184,42 @@ export default {
// 上传成功回调 // 上传成功回调
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
this.$message.success("上传成功"); this.$message.success("上传成功");
this.$emit("input", res.url); this.$emit("resFun", res);
},
// 文件列表移除文件
handleRemove(file, fileList) {
console.log("列表移除", file, fileList);
this.addShow = fileList.length > 0 ? true : false;
this.$emit("remove", file);
}, },
// 删除文件 // 删除文件
handleDelete(index) { handleDelete(index) {
this.fileList.splice(index, 1); this.fileList.splice(index, 1);
this.$emit("input", ''); this.$emit("input", "");
// let that = this,
// param;
// param = file.response ? file.response.fileName.replace(/\\/g, "%")
// : file.response.url.replace(/\\/g, "%").slice(9);
// $.ajax({
// type: "GET",
// url: process.env.VUE_APP_BASE_API + "/common/deleteFile",
// data: {savePath: param},
// dataType: "json",
// success: function(data){
// if (data) that.$message.success("删除成功");
// else return false;
// }
// });
},
handleFileClick(file, fileList) {
this.dialogImageUrl = file.response ? file.response.url : file.url;
// this.dialogImageUrl =if(this.fileArr) this.fileArr[0].url;
// this.dialogVisible = true;
this.$refs.previewImg.showViewer = false;
console.log(file);
// console.log(file.response.url)
}, },
// 获取文件名称 // 获取文件名称
getFileName(name) { getFileName(name) {
...@@ -149,31 +228,40 @@ export default { ...@@ -149,31 +228,40 @@ export default {
} else { } else {
return ""; return "";
} }
} },
// 当改变列表改变时
fileChange(file, fileList) {
this.addShow = fileList.length > 0 ? true : false;
},
}, },
created() { created() {
this.fileList = this.list; console.log(this.fileArr);
// this.fileList = this.list;
this.addShow = this.fileArr.length > 0 ? true : false;
}, },
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.upload-file-uploader { img {
width: 100%;
}
.upload-file-uploader {
margin-bottom: 5px; margin-bottom: 5px;
} }
.upload-file-list .el-upload-list__item { .upload-file-list .el-upload-list__item {
border: 1px solid #e4e7ed; border: 1px solid #e4e7ed;
line-height: 2; line-height: 2;
margin-bottom: 10px; margin-bottom: 10px;
position: relative; position: relative;
} }
.upload-file-list .ele-upload-list__item-content { .upload-file-list .ele-upload-list__item-content {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
color: inherit; color: inherit;
} }
.ele-upload-list__item-content-action .el-link { .ele-upload-list__item-content-action .el-link {
margin-right: 10px; margin-right: 10px;
} }
</style> </style>
<template>
<div class="app-container">
<el-form :model="queryParams" size="mini" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="交易项目" prop="relationTransactionProjectId">
<el-select v-model="queryParams.relationTransactionProjectId" placeholder="请选择交易项目">
<el-option v-for="item in transactionProjects"
:key="item.transactionProjectId"
:label="item.transactionProjectName"
:value="item.transactionProjectId"/>
</el-select>
</el-form-item>
<el-form-item label="项目状态" prop="tradeStatus">
<el-select v-model="queryParams.tradeStatus" placeholder="请选择项目状态" clearable size="small">
<el-option v-for="item in transactionProjectStatus"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="卖方部门" prop="applyDeptId">
<div style="width: 160px">
<treeselect v-model="queryParams.applyDeptId" :options="deptOptions" :show-count="true" placeholder="请选择卖方部门" />
</div>
</el-form-item>
<el-form-item label="买方部门" prop="tradeDeptId">
<div style="width: 160px">
<treeselect v-model="queryParams.tradeDeptId" :options="deptOptions" :show-count="true" placeholder="请选择买方部门" />
</div>
</el-form-item>
<el-form-item label="发起时间" prop="createTime">
<el-date-picker
v-model="queryParams.createTime"
type="datetime"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!--<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:project:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:project:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:project:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['system:project:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>-->
<el-card class="box-card">
<div class="outer-div">
<header class="header">
<ul class="tab-tilte">
<li :class="{ active: tab == 0 }" @click="tab = 0">所有项目</li>
<li :class="{ active: tab == 1 }" @click="tab = 1">我申请的</li>
<li :class="{ active: tab == 2 }" @click="tab = 2">我审批的</li>
</ul>
<el-button
@click="handleAdd"
v-hasPermi="['system:project:add']"
class="applyService"
>申请服务</el-button>
</header>
<div class="tab-content">
<!-- 可以使用自定义组件 -->
<!-- <component-one v-show="tab == 0"></component-one>
<component-two v-show="tab == 1"></component-two> -->
<div v-show="tab == 0">
<el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="交易项目" align="center" prop="relationTransactionProjectId" :formatter="transactionProjectName"/>
<el-table-column label="交易状态" align="center" prop="tradeStatus" :formatter="getTradeStatus" :show-overflow-tooltip="true"/>
<el-table-column label="申请人" align="center" prop="applyName" />
<el-table-column label="卖方" align="center" prop="applyDeptName" :show-overflow-tooltip="true"/>
<el-table-column label="申报总价" align="center" prop="tradeTotal" />
<el-table-column label="买方" align="center" prop="tradeDeptName" :show-overflow-tooltip="true"/>
<el-table-column label="交易评分" align="center" prop="tradeScore" />
<el-table-column label="交易成交价" align="center" prop="dealPrice" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:project:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:project:remove']"
>删除</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>
<div v-show="tab == 1">内容二</div>
<div v-show="tab == 2">内容三</div>
</div>
</div>
</el-card>
<!-- 添加或修改交易项目对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false" destroy-on-close>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="交易项目" prop="relationTransactionProjectId">
<el-select v-model="form.relationTransactionProjectId" placeholder="请选择交易项目" style="width: 100%" @change="changeTransactionProject">
<el-option v-for="item in transactionProjects"
:key="item.transactionProjectId"
:label="item.transactionProjectName"
:value="item.transactionProjectId"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="买方" prop="tradeDeptId">
<treeselect v-model="form.tradeDeptId" :options="deptOptions" :show-count="true" placeholder="请选择部门" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="单价" prop="tradePrice">
<el-input v-model="form.tradePrice" placeholder="请输入单价" :disabled="priceType == '1'" @blur="sumAmount"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="tradeCount">
<el-input v-model="form.tradeCount" placeholder="请输入交易数量" @blur="sumAmount"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="总价" prop="tradeTotal">
<el-input v-model="form.tradeTotal" placeholder="请输入交易总价" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="附件" prop="attachmentUrl">
<FileUpload
listType="picture"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileList"
:fileSize="500"
:fileType="['png', 'jpg', 'jpeg','mp4','doc', 'xls', 'ppt', 'txt','pdf']"/>
<el-input v-show="false" disabled v-model="form.attachmentUrl"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button style="width: 150px;border-color: #1890ff;color: #1890ff;" @click="reset">内容重置</el-button>
<el-button type="primary" style="width: 150px" @click="submitForm">提交申请</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProject, getProject, delProject, addProject, updateProject, exportProject } from "@/api/transaction/tradeProject.js";
import { getTransactionProjectList } from "@/api/transaction/project.js";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import FileUpload from "@/components/FileUpload";
import uploadfile from "@/assets/uploadfile.png";
export default {
name: "Project",
components: {
Treeselect,
FileUpload
},
data() {
return {
// 遮罩层
loading: true,
// 导出遮罩层
exportLoading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 交易项目表格数据
projectList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
relationTransactionProjectId: null,
applyDeptId: null,
tradeType: null,
tradeDeptId: null,
tradeStatus: null,
createTime: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
relationTransactionProjectId:[
{ required: true, message: "交易项目名称不能为空", trigger: "blur" }
],
tradeDeptId:[
{ required: true, message: "请选择买方部门", trigger: "change" }
],
tradePrice:[
{ required: true, message: "单价不能为空", trigger: "blur" }
],
tradeCount:[
{ required: true, message: "数量不能为空", trigger: "blur" }
],
tradeTotal:[
{ required: true, message: "总价不能为空", trigger: "blur" }
],
},
transactionProjects: [],
deptOptions: [],
priceType: "",
fileList: [],
transactionProjectStatus: [],
tab:"0"
};
},
created() {
this.getList();
this.getTransactionProjects({deptId:this.$store.state.user.deptId});
this.getTreeselect();
this.getDicts("t_transaction_project_status").then(response => {
this.transactionProjectStatus = response.data;
console.log("haha",this.transactionProjectStatus)
});
},
methods: {
/** 查询交易项目列表 */
getList() {
this.loading = true;
listProject(this.queryParams).then(response => {
this.projectList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
tradeId: null,
receiptNum: null,
relationTransactionProjectId: null,
applyId: null,
applyDeptId: null,
applyDeptManagerId: null,
tradeType: null,
tradeTransactor: null,
tradeDeptId: null,
tradePrice: null,
tradeCount: null,
tradeTotal: null,
tradeScore: null,
tradeDeptManagerId: null,
settlementTime: null,
dealPrice: null,
pendingPayment: null,
attachmentUrl: null,
tradeStatus: "0",
createTime: null,
updateTime: null,
isDel: null,
remark: null
};
this.resetForm("form");
this.fileList = [];
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.tradeId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "申请项目服务";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const tradeId = row.tradeId || this.ids
getProject(tradeId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改交易项目";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.tradeId != null) {
updateProject(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProject(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const tradeIds = row.tradeId || this.ids;
this.$confirm('是否确认删除交易项目编号为"' + tradeIds + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delProject(tradeIds);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有交易项目数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.exportLoading = true;
return exportProject(queryParams);
}).then(response => {
this.download(response.msg);
this.exportLoading = false;
}).catch(() => {});
},
//获取项目列表
getTransactionProjects(query){
getTransactionProjectList(query).then(res =>{
if(res.code == 200){
this.transactionProjects = res.data;
}
})
},
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then(response => {
this.deptOptions = response.data;
});
},
changeTransactionProject(val){
let transactionProject = this.transactionProjects.find(item => item.transactionProjectId == val);
if(transactionProject.priceType == '1'){
this.priceType = '1';
this.form.tradePrice = transactionProject.price;
}else{
this.priceType = transactionProject.priceType;
this.form.tradePrice = "";
}
this.sumAmount();
},
//计算总价
sumAmount(){
if(this.form.tradePrice && this.form.tradeCount){
this.form.tradeTotal = this.accMul(this.form.tradePrice,this.form.tradeCount);
}else{
this.form.tradeTotal = "";
}
},
//浮点计算出现无限小数
accMul(arg1,arg2){
var m=0,s1=arg1.toString(),s2=arg2.toString();
try{m+=s1.split(".")[1].length}catch(e){}
try{m+=s2.split(".")[1].length}catch(e){}
return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
},
getFileInfo(res) {
this.form.attachmentUrl = res.url;
this.fileList = [
{
name: res.fileName,
url: uploadfile,
},
];
},
listRemove(e) {
this.fileList = [];
this.form.attachmentUrl = "";
},
//获取项目名称
transactionProjectName(row){
let project = this.transactionProjects.find(item => item.transactionProjectId == row.relationTransactionProjectId);
if(project){
return project.transactionProjectName;
}
return "-";
},
//获取交易状态
getTradeStatus(row){
return this.selectDictLabel(this.transactionProjectStatus, row.tradeStatus);
},
}
};
</script>
<style scoped lang="scss">
.outer-div {
//padding: 24px;
margin: 0 auto;
}
.header {
height: 47px;
width: 100%;
//border-bottom: 1px solid #ebebeb;
//margin-bottom: 24px;
}
ul li {
margin: 0;
padding: 0;
list-style: none;
}
.tab-tilte {
font-family: PingFangSC-Semibold;
letter-spacing: 0;
width: 90%;
padding-left: 0;
}
.tab-tilte li {
float: left;
font-size: 16px;
color: #999999;
// line-height: 53px;
text-align: center;
margin-right: 30px;
cursor: pointer;
}
/* 点击对应的标题添加对应的背景颜色 */
.tab-tilte .active {
color: #3385ff;
// border-bottom: 2px solid #3385ff;
}
.applyService{
float: right;
width: 124px;
border-radius: 18px;
color: white;
background: #1890ff;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment