Commit acd69670 authored by 耿迪迪's avatar 耿迪迪

借贷开发

parent d5d72788
package com.zehong.web.controller.debit;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.exception.BusinessException;
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.TDebitCredit;
import com.zehong.system.service.ITAccountService;
import com.zehong.system.service.ITDebitCreditService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
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
......@@ -33,6 +29,9 @@ public class TDebitCreditController extends BaseController
@Autowired
private ITDebitCreditService tDebitCreditService;
@Autowired
private ITAccountService itAccountService;
/**
* 查询借贷列表
*/
......@@ -45,6 +44,13 @@ public class TDebitCreditController extends BaseController
return getDataTable(list);
}
@PostMapping("/selectDebitListByRoles")
public TableDataInfo selectDebitListByRoles(@RequestBody TDebitCredit tDebitCredit){
startPage();
List<TDebitCredit> list = tDebitCreditService.selectDebitListByRoles(tDebitCredit);
return getDataTable(list);
}
/**
* 导出借贷列表
*/
......@@ -76,6 +82,9 @@ public class TDebitCreditController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody TDebitCredit tDebitCredit)
{
if(!itAccountService.checkAccountCanTrade(tDebitCredit.getLendDeptId(),tDebitCredit.getLittleTotal())){
return AjaxResult.error("出借部门账户可用金额不足!");
}
return toAjax(tDebitCreditService.insertTDebitCredit(tDebitCredit));
}
......@@ -100,4 +109,30 @@ public class TDebitCreditController extends BaseController
{
return toAjax(tDebitCreditService.deleteTDebitCreditByIds(debitIds));
}
/**
* 借贷结算
* @param tDebitCredit 借贷实体
*/
@PostMapping("/settlementDebitCredit")
public AjaxResult settlementDebitCredit(TDebitCredit tDebitCredit){
try{
return toAjax(tDebitCreditService.settlementDebitCredit(tDebitCredit));
}catch (BusinessException e){
return AjaxResult.error(e.getMessage());
}
}
/**
* 还款
* @param tDebitCredit 借贷实体
*/
@PostMapping("/repayDebitCredit")
public AjaxResult repayDebitCredit(TDebitCredit tDebitCredit){
try{
return toAjax(tDebitCreditService.repayDebitCredit(tDebitCredit));
}catch (BusinessException e){
return AjaxResult.error(e.getMessage());
}
}
}
package com.zehong.system.domain;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
......@@ -33,6 +36,10 @@ public class TDebitCredit extends BaseEntity
@Excel(name = "出借部门")
private Long lendDeptId;
/** 出借部门长 */
@Excel(name = "出借部门长")
private Long lendDeptManageId;
/** 登记日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "登记日期", width = 30, dateFormat = "yyyy-MM-dd")
......@@ -87,7 +94,7 @@ public class TDebitCredit extends BaseEntity
/** 实际还款金额 */
@Excel(name = "实际还款金额")
private Long realPaymentAcount;
private BigDecimal realPaymentAcount;
/** 是否删除:0否,1是 */
@Excel(name = "是否删除:0否,1是")
......@@ -103,6 +110,15 @@ public class TDebitCredit extends BaseEntity
private String approvalName;
private List<String> operators = new ArrayList<>();
/**
* 查询类型
*/
private String queryType;
private String lendManageName;
public void setDebitId(Long debitId)
{
this.debitId = debitId;
......@@ -247,12 +263,12 @@ public class TDebitCredit extends BaseEntity
{
return realPaymentDate;
}
public void setRealPaymentAcount(Long realPaymentAcount)
public void setRealPaymentAcount(BigDecimal realPaymentAcount)
{
this.realPaymentAcount = realPaymentAcount;
}
public Long getRealPaymentAcount()
public BigDecimal getRealPaymentAcount()
{
return realPaymentAcount;
}
......@@ -306,6 +322,38 @@ public class TDebitCredit extends BaseEntity
this.approvalName = approvalName;
}
public List<String> getOperators() {
return operators;
}
public void setOperators(List<String> operators) {
this.operators = operators;
}
public String getQueryType() {
return queryType;
}
public void setQueryType(String queryType) {
this.queryType = queryType;
}
public Long getLendDeptManageId() {
return lendDeptManageId;
}
public void setLendDeptManageId(Long lendDeptManageId) {
this.lendDeptManageId = lendDeptManageId;
}
public String getLendManageName() {
return lendManageName;
}
public void setLendManageName(String lendManageName) {
this.lendManageName = lendManageName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -27,6 +27,13 @@ public interface ITDebitCreditService
*/
public List<TDebitCredit> selectTDebitCreditList(TDebitCredit tDebitCredit);
/**
* 根据角色查询借贷列表
* @param tDebitCredit 借贷
* @return 借贷集合
*/
List<TDebitCredit> selectDebitListByRoles(TDebitCredit tDebitCredit);
/**
* 新增借贷
*
......@@ -58,4 +65,16 @@ public interface ITDebitCreditService
* @return 结果
*/
public int deleteTDebitCreditById(Long debitId);
/**
* 借贷结算
* @param tDebitCredit 借贷实体
*/
int settlementDebitCredit(TDebitCredit tDebitCredit);
/**
* 还款
* @param tDebitCredit 借贷实体
*/
int repayDebitCredit(TDebitCredit tDebitCredit);
}
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TDebitCreditMapper;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TDebitCredit;
import com.zehong.system.mapper.TDebitCreditMapper;
import com.zehong.system.service.ITDebitCreditService;
import com.zehong.system.service.impl.debitCredit.DebitCreditRoles;
import com.zehong.system.service.impl.debitCredit.roles.*;
import com.zehong.system.service.impl.debitSettlement.SettlementDebit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 借贷Service业务层处理
......@@ -20,6 +28,9 @@ public class TDebitCreditServiceImpl implements ITDebitCreditService
@Autowired
private TDebitCreditMapper tDebitCreditMapper;
@Autowired
private SettlementDebit settlementDebit;
/**
* 查询借贷
*
......@@ -44,6 +55,48 @@ public class TDebitCreditServiceImpl implements ITDebitCreditService
return tDebitCreditMapper.selectTDebitCreditList(tDebitCredit);
}
/**
* 根据角色查询借贷列表
* @param tDebitCredit 借贷
* @return 借贷集合
*/
@Override
public List<TDebitCredit> selectDebitListByRoles(TDebitCredit tDebitCredit){
judgeRole(tDebitCredit).setParams();
List<TDebitCredit> tDebitCreditList = tDebitCreditMapper.selectTDebitCreditList(tDebitCredit);
tDebitCreditList.stream().forEach(item ->{
judgeRole(item).setOperators();
});
return tDebitCreditList;
}
/**
* 判断角色
* @param tDebitCredit 借贷实体
* @return DebitCreditRoles
*/
private DebitCreditRoles judgeRole(TDebitCredit tDebitCredit) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
List<String> roleKeys = roles.stream().map(item -> item.getRoleKey()).collect(Collectors.toList());
if(roleKeys.contains("admin")){
return new DebitCreditAdmin(tDebitCredit);
}
//双权限
if(roleKeys.contains("calculator") && roleKeys.contains("deptLeader")){
return new DoubleRoles(tDebitCredit);
}
//部长
if(roleKeys.contains("deptLeader")){
return new DeptLeader(tDebitCredit);
}
//核算部
if(roleKeys.contains("calculator")){
return new Calculator(tDebitCredit);
}
return new OtherRoles(tDebitCredit);
}
/**
* 新增借贷
*
......@@ -93,4 +146,26 @@ public class TDebitCreditServiceImpl implements ITDebitCreditService
{
return tDebitCreditMapper.deleteTDebitCreditById(debitId);
}
/**
* 借贷结算
* @param tDebitCredit 借贷实体
*/
public int settlementDebitCredit(TDebitCredit tDebitCredit){
//结算
settlementDebit.settlementDebit(tDebitCredit);
tDebitCredit.setUpdateTime(DateUtils.getNowDate());
return tDebitCreditMapper.updateTDebitCredit(tDebitCredit);
}
/**
* 还款
* @param tDebitCredit 借贷实体
*/
public int repayDebitCredit(TDebitCredit tDebitCredit){
//结算
settlementDebit.repayment(tDebitCredit);
tDebitCredit.setUpdateTime(DateUtils.getNowDate());
return tDebitCreditMapper.updateTDebitCredit(tDebitCredit);
}
}
......@@ -8,10 +8,7 @@ import com.zehong.system.domain.TTradeProject;
import com.zehong.system.mapper.TTradeProjectMapper;
import com.zehong.system.service.ITTradeProjectService;
import com.zehong.system.service.impl.tradeRoles.TradeRoles;
import com.zehong.system.service.impl.tradeRoles.roles.DeptLeader;
import com.zehong.system.service.impl.tradeRoles.roles.DoubleRoles;
import com.zehong.system.service.impl.tradeRoles.roles.OtherRoles;
import com.zehong.system.service.impl.tradeRoles.roles.Transactor;
import com.zehong.system.service.impl.tradeRoles.roles.*;
import com.zehong.system.service.impl.tradeSettlement.SettlementTrade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -84,6 +81,10 @@ public class TTradeProjectServiceImpl implements ITTradeProjectService
private TradeRoles judgeRole(TTradeProject tTradeProject) {
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
List<String> roleKeys = roles.stream().map(item -> item.getRoleKey()).collect(Collectors.toList());
if(roleKeys.contains("admin")){
return new TradeAdmin(tTradeProject);
}
//双权限
if(roleKeys.contains("transactor") && roleKeys.contains("deptLeader")){
return new DoubleRoles(tTradeProject);
......
package com.zehong.system.service.impl.debitCredit;
/**
* @author geng
* 借贷接口
*/
public interface DebitCreditRoles {
/**
* 根据角色设置查询权限
*/
void setParams();
/**
* 根据角色设置操作权限
*/
void setOperators();
}
package com.zehong.system.service.impl.debitCredit;
import com.zehong.system.domain.TDebitCredit;
/**
* @author geng
* 借贷抽象类
*/
public abstract class DebitCreditRolesAbstract implements DebitCreditRoles{
/**
* 借贷实体
*/
protected TDebitCredit tDebitCredit;
/**
* 借贷状态枚举类
*/
protected enum DebitCreditEnum{
confirm("0"),approval("1"), stayRepay("2"),complete("3"),reject("4");
private String debitCreditStatus;
DebitCreditEnum(String debitCreditStatus) {
this.debitCreditStatus = debitCreditStatus;
}
public String getDebitCreditStatus() {
return debitCreditStatus;
}
}
public DebitCreditRolesAbstract(TDebitCredit tDebitCredit) {
this.tDebitCredit = tDebitCredit;
}
}
package com.zehong.system.service.impl.debitCredit.roles;
import com.zehong.system.domain.TDebitCredit;
import com.zehong.system.service.impl.debitCredit.DebitCreditRolesAbstract;
/**
* @author geng
* 核算部
*/
public class Calculator extends DebitCreditRolesAbstract {
public Calculator(TDebitCredit tDebitCredit) {
super(tDebitCredit);
}
/**
* 核算部查询所有部门借贷
*/
@Override
public void setParams() {
}
@Override
public void setOperators() {
if(DebitCreditEnum.approval.getDebitCreditStatus().equals(this.tDebitCredit.getDebitStatus())){
this.tDebitCredit.getOperators().add("calculate");
}
}
}
package com.zehong.system.service.impl.debitCredit.roles;
import com.zehong.system.domain.TDebitCredit;
import com.zehong.system.service.impl.debitCredit.DebitCreditRolesAbstract;
/**
* @author geng
* 超级管理员
*/
public class DebitCreditAdmin extends DebitCreditRolesAbstract{
public DebitCreditAdmin(TDebitCredit tDebitCredit) {
super(tDebitCredit);
}
@Override
public void setParams() {
}
@Override
public void setOperators() {
}
}
package com.zehong.system.service.impl.debitCredit.roles;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TDebitCredit;
import com.zehong.system.service.impl.debitCredit.DebitCreditRolesAbstract;
/**
* @author geng
* 部门长
*/
public class DeptLeader extends DebitCreditRolesAbstract{
public DeptLeader(TDebitCredit tDebitCredit) {
super(tDebitCredit);
}
@Override
public void setParams() {
SysUser user = SecurityUtils.getLoginUser().getUser();
if("myApply".equals(this.tDebitCredit.getQueryType()) ||"all".equals(this.tDebitCredit.getQueryType())){
this.tDebitCredit.setDebitDeptId(user.getDeptId());
}
if("myApproval".equals(this.tDebitCredit.getQueryType()) || "all".equals(this.tDebitCredit.getQueryType())){
this.tDebitCredit.setLendDeptId(user.getDeptId());
}
}
@Override
public void setOperators() {
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
//借贷部门
if(DebitCreditEnum.stayRepay.getDebitCreditStatus().equals(this.tDebitCredit.getDebitStatus())
&& deptId.equals(this.tDebitCredit.getDebitDeptId())){
this.tDebitCredit.getOperators().add("repay");
}
//借出部
if(DebitCreditEnum.confirm.getDebitCreditStatus().equals(this.tDebitCredit.getDebitStatus())
&& deptId.equals(this.tDebitCredit.getLendDeptId())){
this.tDebitCredit.getOperators().add("confirm");
}
}
}
package com.zehong.system.service.impl.debitCredit.roles;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TDebitCredit;
import com.zehong.system.service.impl.debitCredit.DebitCreditRolesAbstract;
/**
* @author geng
* 双权限
*/
public class DoubleRoles extends DebitCreditRolesAbstract{
public DoubleRoles(TDebitCredit tDebitCredit) {
super(tDebitCredit);
}
/**
* 以最高权限为准查询所有部门
*/
@Override
public void setParams() {
SysUser user = SecurityUtils.getLoginUser().getUser();
if("myApply".equals(this.tDebitCredit.getQueryType())){
this.tDebitCredit.setDebitDeptId(user.getDeptId());
}
if("myApproval".equals(this.tDebitCredit.getQueryType())){
this.tDebitCredit.setLendDeptId(user.getDeptId());
}
}
@Override
public void setOperators() {
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
//借贷部门
if(DebitCreditEnum.stayRepay.getDebitCreditStatus().equals(this.tDebitCredit.getDebitStatus())
&& deptId.equals(this.tDebitCredit.getDebitDeptId())){
this.tDebitCredit.getOperators().add("repay");
}
//借出部门
if(DebitCreditEnum.confirm.getDebitCreditStatus().equals(this.tDebitCredit.getDebitStatus())
&& deptId.equals(this.tDebitCredit.getLendDeptId())){
this.tDebitCredit.getOperators().add("confirm");
}
//复核部
if(DebitCreditEnum.approval.getDebitCreditStatus().equals(this.tDebitCredit.getDebitStatus())){
this.tDebitCredit.getOperators().add("calculate");
}
}
}
package com.zehong.system.service.impl.debitCredit.roles;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TDebitCredit;
import com.zehong.system.service.impl.debitCredit.DebitCreditRolesAbstract;
/**
* @author geng
* 其他角色
*/
public class OtherRoles extends DebitCreditRolesAbstract {
public OtherRoles(TDebitCredit tDebitCredit) {
super(tDebitCredit);
}
@Override
public void setParams() {
SysUser user = SecurityUtils.getLoginUser().getUser();
this.tDebitCredit.setUseId(user.getUserId());
}
@Override
public void setOperators() {
}
}
package com.zehong.system.service.impl.debitSettlement;
import com.zehong.common.core.exception.BusinessException;
import com.zehong.system.domain.TAccount;
import com.zehong.system.domain.TCashOperate;
import com.zehong.system.domain.TDebitCredit;
import com.zehong.system.domain.TTradeProject;
import com.zehong.system.mapper.TAccountMapper;
import com.zehong.system.mapper.TCashOperateMapper;
import com.zehong.system.mapper.TTradeProjectMapper;
import io.jsonwebtoken.lang.Collections;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
/**
* @author geng
* 借贷账户结算
*/
@Component
public class SettlementDebit {
@Resource
private TAccountMapper tAccountMapper;
@Resource
private TCashOperateMapper cashOperateMapper;
private TDebitCredit tDebitCredit;
@Resource
private TTradeProjectMapper tTradeProjectMapper;
/**
* 借贷结算
* @param tDebitCredit 借贷实体
*/
public void settlementDebit(TDebitCredit tDebitCredit){
this.tDebitCredit = tDebitCredit;
//出借部门结算
lendDeptSettlement(tDebitCredit.getLendDeptId(),tDebitCredit.getLittleTotal(),"5");
//借贷部门结算
debitDeptSettlement(tDebitCredit.getDebitDeptId(),tDebitCredit.getLittleTotal(),"6");
}
/**
* 还款
* @param tDebitCredit 借贷实体
*/
public void repayment(TDebitCredit tDebitCredit){
this.tDebitCredit = tDebitCredit;
//计算还款日期
long time = tDebitCredit.getExpectedRepaymentDate().getTime() - tDebitCredit.getSumInterestDate().getTime();
int days = Math.round(time / 60 / 60 / 24);
//还款部门
BigDecimal repayAmount = tDebitCredit.getLittleTotal().multiply( new BigDecimal(1 + 0.08/360 * days)).setScale(2, RoundingMode.HALF_UP);
tDebitCredit.setRealPaymentDate(new Date());
tDebitCredit.setRealPaymentAcount(repayAmount);
lendDeptSettlement(tDebitCredit.getDebitDeptId(),repayAmount,"7");
//还款进账部门
debitDeptSettlement(tDebitCredit.getLendDeptId(),repayAmount,"8");
}
/**
* 出借部门结算
* @param deptId 部门账户
* @param amount 金额
* @param operatorType 操作类型
*/
private void lendDeptSettlement(Long deptId, BigDecimal amount,String operatorType){
TAccount account = getAccountInfo(deptId);
if(account.getAbleAmount().compareTo(amount) == -1){
throw new BusinessException("出借或还款账户金额不足!");
}
updateAccount(account,amount.negate(),operatorType);
}
/**
* 借贷部门结算
* @param deptId 部门账户
* @param amount 金额
* @param operatorType 操作类型
*/
private void debitDeptSettlement(Long deptId, BigDecimal amount,String operatorType){
TAccount account = getAccountInfo(deptId);
//结算本部尾款
List<TTradeProject> pendingPaymentInfo = tTradeProjectMapper.getTradePendingPaymentInfo(deptId);
for(TTradeProject project : pendingPaymentInfo){
if(amount.compareTo(BigDecimal.ZERO) == 0){
return;
}
BigDecimal changeAmount = updatePendingPayment(amount,project);
//重新计算进账金额
amount = amount.subtract(changeAmount);
}
//更新可用额度
updateAccount(account,amount,operatorType);
}
/**
* 更新账户可用金额
* @param tAccount 账户信息
* @param amount 账户变动金额
* @param operatorType 操作类型
*/
private void updateAccount(TAccount tAccount, BigDecimal amount,String operatorType){
if(amount.compareTo(BigDecimal.ZERO) == 0) return;
tAccount.setAbleAmount(tAccount.getAbleAmount().add(amount));
tAccountMapper.updateTAccount(tAccount);
//更新资金变动日志
TCashOperate operate = OperatorParam(tAccount.getDeptId(),amount,this.tDebitCredit.getDebitId().toString());
//1.交易单 2.借支单 3.外部采购单 4.借贷单
operate.setDocumentType("4");
operate.setOperateType(operatorType);
cashOperateMapper.insertTCashOperate(operate);
}
/**
* 获取账户信息
* @param deptId
* @return
*/
private TAccount getAccountInfo(Long deptId){
TAccount tAccount = new TAccount();
tAccount.setDeptId(deptId);
List<TAccount> accounts = tAccountMapper.selectTAccountList(tAccount);
assert !Collections.isEmpty(accounts) : "部门资金账户不能为空,部门id:" + deptId;
return accounts.get(0);
}
/**
* 更新尾款信息
* @param incomeAmount 进账金额
* @param project 交易项目
*/
private BigDecimal updatePendingPayment(BigDecimal incomeAmount,TTradeProject project){
//资金变动金额
BigDecimal amount = incomeAmount.compareTo(project.getPendingPayment()) == 1 ? project.getPendingPayment() : incomeAmount;
//尾款
BigDecimal pendingPayment = incomeAmount.compareTo(project.getPendingPayment()) == -1 ? project.getPendingPayment().subtract(incomeAmount) : new BigDecimal("0");
project.setPendingPayment(pendingPayment);
tTradeProjectMapper.updateTTradeProject(project);
//更新资金变动日志
TCashOperate operate = OperatorParam(project.getTradeDeptId(),amount,project.getTradeId().toString());
operate.setOperateType("3");
operate.setDocumentType("4");//1.交易单 2.借支单 3.外部采购单 4.借贷单
cashOperateMapper.insertTCashOperate(operate);
return amount;
}
/**
*
* @param deptId 部门id
* @param amount 变动金额
* @param receiptNum 单据号
* @return
*/
private TCashOperate OperatorParam (Long deptId,BigDecimal amount,String receiptNum){
TCashOperate operate = new TCashOperate();
operate.setOperateDeptId(deptId);
operate.setOperateAmount(amount.compareTo(BigDecimal.ZERO) == 1?amount:amount.abs());
operate.setOperateTime(new Date());
operate.setRelationDoc(receiptNum);
return operate;
}
}
package com.zehong.system.service.impl.tradeRoles.roles;
import com.zehong.system.domain.TTradeProject;
import com.zehong.system.service.impl.tradeRoles.TradeRolesAbstract;
/**
* @author geng
* 超级管理员
*/
public class TradeAdmin extends TradeRolesAbstract {
public TradeAdmin(TTradeProject tTradeProject) {
super(tTradeProject);
}
@Override
public void setQueryParams() {
}
@Override
public void setOperators() {
}
}
......@@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="debitDeptId" column="debit_dept_id" />
<result property="operatorId" column="operator_id" />
<result property="lendDeptId" column="lend_dept_id" />
<result property="lendDeptManageId" column="lend_dept_manage_id" />
<result property="registerTime" column="register_time" />
<result property="useDescribe" column="use_describe" />
<result property="useId" column="use_id" />
......@@ -31,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="lendDeptName" column="lend_dept_name" />
<result property="useName" column="use_name" />
<result property="approvalName" column="approval_name" />
<result property="lendManageName" column="lend_dept_manage_name" />
</resultMap>
<sql id="selectTDebitCreditVo">
......@@ -39,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
debit_dept_id,
operator_id,
lend_dept_id,
lend_dept_manage_id,
register_time,
use_describe,
use_id,
......@@ -60,7 +63,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(SELECT nick_name FROM sys_user WHERE user_id = operator_id) AS operator_name,
(SELECT dept_name FROM sys_dept WHERE dept_id = lend_dept_id) AS lend_dept_name,
(SELECT nick_name FROM sys_user WHERE user_id = use_id) AS use_name,
(SELECT nick_name FROM sys_user WHERE user_id = approval_id) AS approval_name
(SELECT nick_name FROM sys_user WHERE user_id = approval_id) AS approval_name,
(SELECT nick_name FROM sys_user WHERE user_id = lend_dept_manage_id) AS lend_dept_manage_name
FROM
t_debit_credit
</sql>
......@@ -68,9 +72,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTDebitCreditList" parameterType="TDebitCredit" resultMap="TDebitCreditResult">
<include refid="selectTDebitCreditVo"/>
<where>
<if test="debitDeptId != null "> and debit_dept_id = #{debitDeptId}</if>
<if test="operatorId != null "> and operator_id = #{operatorId}</if>
<if test="lendDeptId != null "> and lend_dept_id = #{lendDeptId}</if>
<if test="queryType == 'all' and debitDeptId != null and lendDeptId != null">
and (debit_dept_id = #{debitDeptId} or lend_dept_id = #{lendDeptId})
</if>
<if test="queryType != 'all'">
<if test="debitDeptId != null "> and debit_dept_id = #{debitDeptId}</if>
<if test="lendDeptId != null "> and lend_dept_id = #{lendDeptId}</if>
</if>
<if test="registerTime != null "> and register_time = #{registerTime}</if>
<if test="useDescribe != null and useDescribe != ''"> and use_describe = #{useDescribe}</if>
<if test="useId != null "> and use_id = #{useId}</if>
......@@ -99,6 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="debitDeptId != null">debit_dept_id,</if>
<if test="operatorId != null">operator_id,</if>
<if test="lendDeptId != null">lend_dept_id,</if>
<if test="lendDeptManageId != null">lend_dept_manage_id,</if>
<if test="registerTime != null">register_time,</if>
<if test="useDescribe != null">use_describe,</if>
<if test="useId != null">use_id,</if>
......@@ -121,6 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="debitDeptId != null">#{debitDeptId},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="lendDeptId != null">#{lendDeptId},</if>
<if test="lendDeptManageId != null">#{lendDeptManageId},</if>
<if test="registerTime != null">#{registerTime},</if>
<if test="useDescribe != null">#{useDescribe},</if>
<if test="useId != null">#{useId},</if>
......@@ -147,6 +158,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="debitDeptId != null">debit_dept_id = #{debitDeptId},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="lendDeptId != null">lend_dept_id = #{lendDeptId},</if>
<if test="lendDeptManageId != null">lend_dept_manage_id = #{lendDeptManageId},</if>
<if test="registerTime != null">register_time = #{registerTime},</if>
<if test="useDescribe != null">use_describe = #{useDescribe},</if>
<if test="useId != null">use_id = #{useId},</if>
......
......@@ -9,6 +9,15 @@ export function listCredit(query) {
})
}
//根据角色查询借贷列表
export function selectDebitListByRoles(data) {
return request({
url: '/debit/credit/selectDebitListByRoles',
method: 'post',
data: data
})
}
// 查询借贷详细
export function getCredit(debitId) {
return request({
......@@ -51,3 +60,21 @@ export function exportCredit(query) {
params: query
})
}
//结算
export function settlementDebitCredit(data) {
return request({
url: '/debit/credit/settlementDebitCredit',
method: 'get',
data: data
})
}
//还款
export function repayDebitCredit(data) {
return request({
url: '/debit/credit/repayDebitCredit',
method: 'get',
data: data
})
}
<template>
<div>
<CommonInfo :debitData="debitData"/>
<div style="margin: 11px 30px;color: #1890ff;">出借部门长审核</div>
<el-form label-width="100px">
<el-form-item label="审核人">{{ debitData.lendManageName }}</el-form-item>
</el-form>
<el-divider></el-divider>
<div style="margin: 11px 30px;color: #1890ff;">核算部审批</div>
<el-row style="margin-left:97px">
<el-col :span="10">
<el-row>
<el-col :span="6">
<el-radio v-model="radio" label="1">通过</el-radio>
</el-col>
<el-col :span="6">
<el-radio v-model="radio" label="2">不通过</el-radio>
</el-col>
</el-row>
</el-col>
<el-col :span="10">
<el-row>
<el-col :span="5">审核人</el-col>
<el-col :span="16"><el-input :value="$store.state.user.nickName" style="width: 90px" disabled/></el-col>
</el-row>
</el-col>
</el-row>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "calculate",
props:{
debitData:{
type: Object
}
},
data(){
return{
radio: "1",
debitStatus: "2"
}
},
watch:{
radio(newVal,oldVal){
if(newVal== "1"){
this.debitStatus = "2";
}
if(newVal== "2"){
this.debitStatus = "4";
}
}
},
components:{
CommonInfo
},
methods:{
resetSuggestion(){
this.radio = "1";
},
checkParam(){
return false;
},
submitSuggestion(){
let param = {...this.debitData};
param.debitStatus = this.debitStatus;
param.approvalId = this.$store.state.user.userId;
return param;
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="common">
<el-form label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="借贷部门">{{ debitData.debitDeptName }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="经办人">{{ debitData.operatorName }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="出借部门">{{ debitData.lendDeptName }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="登记日期">{{ debitData.registerTime }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="使用人">{{ debitData.useName }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="使用说明">{{ debitData.useDescribe }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="大写合计">{{ debitData.capitalTotal }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="小写合计">{{ debitData.littleTotal }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="计息日">{{ debitData.sumInterestDate }}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="预计还款日">{{ debitData.expectedRepaymentDate }}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="附件">
<span
style="padding-top: 10px;"
class="dbtn"
@click="download(debitData.attachmentUrl)"
v-if="debitData.attachmentUrl != null && debitData.attachmentUrl!=''"
>
<i class="el-icon el-icon-view"></i>查看/下载
</span>
<span v-else>-</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="应还金额">{{ payable() }}</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注">{{ debitData.remark }}</el-form-item>
<el-divider></el-divider>
</el-form>
</div>
</template>
<script>
export default {
name: "common-info",
props:{
debitData:{
type: Object
}
},
methods:{
//附件下载
download(url) {
// url = url.replace(/\\/g, "/");
const xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "blob";
//xhr.setRequestHeader('Authorization', 'Basic a2VybWl0Omtlcm1pdA==');
xhr.onload = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
let blob = this.response;
console.log(blob);
// 转换一个blob链接
// 注: URL.createObjectURL() 静态方法会创建一个 DOMString(DOMString 是一个UTF-16字符串),
// 其中包含一个表示参数中给出的对象的URL。这个URL的生命周期和创建它的窗口中的document绑定
let downLoadUrl = window.URL.createObjectURL(
new Blob([blob], {
type: blob.type,
})
);
// 视频的type是video/mp4,图片是image/jpeg
// 01.创建a标签
let a = document.createElement("a");
// 02.给a标签的属性download设定名称
a.download = name;
// 03.设置下载的文件名
a.href = downLoadUrl;
// 04.对a标签做一个隐藏处理
a.style.display = "none";
// 05.向文档中添加a标签
document.body.appendChild(a);
// 06.启动点击事件
a.click();
// 07.下载完毕删除此标签
a.remove();
}
};
xhr.send();
},
//应还金额
payable(){
let time = new Date(this.debitData.expectedRepaymentDate).getTime()/ 1000 - new Date(this.debitData.sumInterestDate).getTime()/ 1000;
let day = Math.round(time / 60 / 60 / 24);
return this.debitData.littleTotal *(1 + 0.08 /360 * day).toFixed(4);
}
}
}
</script>
<style>
.common{
.el-form-item {
margin-bottom: 0px;
}
.el-divider--horizontal {
margin: 5px 0;
}
}
</style>
<style scoped lang="scss">
/* 横线 */
.line{
float:right;
width: 100%;
height: 1px;
margin-top: -0.5em;
background:#d4c4c4;
position: relative;
text-align: center;
}
.dbtn {
display: inline-block;
line-height: normal;
padding-left: 2px;
padding-right: 2px;
cursor: pointer;
border-radius: 3px;
border-style: solid;
border-width: 0;
color: rgb(48, 180, 107);
}
</style>
<template>
<div>
<CommonInfo :debitData="debitData"/>
<el-row style="margin-left:95px">
<el-col :span="8" style="margin-top: 15px">
<el-checkbox v-model="checked">我已知晓</el-checkbox>
</el-col>
<el-col :span="8" style="margin-top: 10px">
<span style="margin: 0px 5px;">审批人</span>
<el-input :value="$store.state.user.nickName" style="width: 130px" disabled/>
</el-col>
</el-row>
<el-divider></el-divider>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "confirm",
props:{
debitData:{
type: Object
}
},
components:{
CommonInfo
},
data(){
return{
checked: false
}
},
methods:{
resetSuggestion(){
this.checked = false;
},
checkParam(){
if(!this.checked){
this.$message.error("请勾选须知!");
return true;
}
return false;
},
submitSuggestion(){
return {debitId:this.debitData.debitId,debitStatus:"1",lendDeptManageId:this.$store.state.user.userId};
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="detail">
<CommonInfo :debitData="debitData"/>
<div v-if="debitData.debitStatus > 0">
<div style="margin: 11px 30px;color: #1890ff;">出借部门长审核</div>
<el-form label-width="100px">
<el-form-item label="审核人">{{ debitData.lendManageName }}</el-form-item>
</el-form>
<el-divider></el-divider>
</div>
<div v-if="debitData.debitStatus > 1">
<div style="margin: 11px 30px;color: #1890ff;">核算部审批</div>
<el-form label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item>
<el-radio v-model="this.debitData.debitStatus =='2' || this.debitData.debitStatus =='3'?radio ='1':radio='2'" label="1" disabled>通过</el-radio>
<el-radio v-model="radio" label="2" disabled>不通过</el-radio>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="审核人">{{debitData.approvalName}}</el-form-item>
</el-col>
<el-col :span="8"></el-col>
</el-row>
</el-form>
<el-divider></el-divider>
</div>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "debit-detail",
props:{
debitData:{
type: Object
}
},
components:{
CommonInfo
}
}
</script>
<style scoped lang="scss">
.detail{
height: 460px;
overflow-y: auto;
&::-webkit-scrollbar {
/* 设置滚动条宽度 */
width: 4px;
/* 设置滚动条背景色 */
//background: black;
}
//滚动条轨道
&::-webkit-scrollbar-track {
background-color:transparent;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
//滚动条滑块
&::-webkit-scrollbar-thumb {
background-color: rgb(147,147,153,0.5);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius:2em;
}
}
</style>
<template>
<div style="display: inline-block;width: 50px">
<el-button type="text" @click="openDialog" size="mini">{{getOperatorName()}}</el-button>
<el-dialog :title="getOperatorName()" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false" destroy-on-close>
<component :is="currentTabComponent" :debitData="debitData" ref="currentCom" v-if="open"></component>
<div slot="footer" class="dialog-footer" style="text-align: center" v-if="operatorName != 'debitDetail' || operatorName != 'repay'">
<el-button style="width: 150px;border-color: #1890ff;color: #1890ff;" @click="resetSuggestion">重置意见</el-button>
<el-button type="primary" style="width: 150px" @click="submitSuggestion">提交</el-button>
</div>
<div slot="footer" class="dialog-footer" style="text-align: center" v-if="operatorName == 'repay'">
<el-button type="primary" style="width: 150px" @click="submitSuggestion">确认还款</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getCredit, updateCredit, settlementDebitCredit, repayDebitCredit } from "@/api/debit/credit";
import debitDetail from "./DebitDetail";
import confirm from "./Confirm";
import calculate from "./Calculate";
export default {
name: "operator-button",
components:{
debitDetail,
confirm,
calculate
},
props:{
operatorName: {
type: String
},
debitInfo: {
type: Object
}
},
created(){
this.currentTabComponent = this.operatorName;
},
data(){
return{
open: false,
currentTabComponent: "",
debitData: {}
}
},
methods:{
getOperatorName(){
switch(this.operatorName){
case "debitDetail":
return "详情";
case "confirm":
return "出借部长确认";
case "calculate":
return "核算部审批";
case "repay":
return "还款"
default:
return "";
}
},
openDialog(){
getCredit(this.debitInfo.debitId).then(res =>{
if(res.code == 200){
this.debitData = res.data;
this.open = true;
}
})
},
//重置意见
resetSuggestion(){
this.$refs.currentCom.resetSuggestion();
},
//提交
submitSuggestion(){
if(this.$refs.currentCom.checkParam()){
return;
}
if(this.debitData.debitStatus == "1"){
settlementDebitCredit(this.$refs.currentCom.submitSuggestion()).then(res =>{
this.dealResponse(res);
})
return;
}
if(this.debitData.debitStatus == "2"){
repayDebitCredit(this.$refs.currentCom.submitSuggestion()).then(res =>{
this.dealResponse(res);
})
return;
}
updateCredit(this.$refs.currentCom.submitSuggestion()).then(res =>{
this.dealResponse(res);
})
},
//返回处理
dealResponse(res){
if(res.code == 200){
this.open = false;
this.$emit("getList");
this.$message.success("提交成功!");
}else{
this.$message.error("提交失败!");
}
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<el-table v-loading="loading" :data="creditList">
<el-table-column label="借贷部门" align="center" prop="debitDeptName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="经办人" align="center" prop="operatorName" />
<el-table-column label="出借部门" align="center" prop="lendDeptName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="登记日期" align="center" prop="registerTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.registerTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="使用说明" align="center" prop="useDescribe" />
<el-table-column label="使用人" align="center" prop="useName" />
<el-table-column label="小写合计" align="center" prop="littleTotal" />
<el-table-column label="计息日" align="center" prop="sumInterestDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.sumInterestDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="预计还款日" align="center" prop="expectedRepaymentDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.expectedRepaymentDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="借贷状态" align="center" prop="debitStatus" :formatter="debitStatusFormatter" :show-overflow-tooltip="true"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope">
<!-- <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:credit:edit']"
>修改</el-button>-->
<OperatorButton
operatorName="debitDetail"
:debitInfo="scope.row"
@getList="getList"
/>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:credit:remove']"
v-if="(scope.row.debitStatus == '0' || scope.row.debitStatus == '3') && scope.row.operatorId == $store.state.user.userId"
>删除</el-button>
<OperatorButton
v-for="item in scope.row.operators"
:key="item"
:operatorName="item"
:debitInfo="scope.row"
@getList="getList"
/>
</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 OperatorButton from "./OperatorButton";
export default {
name: "table-list",
props: {
creditList: {
type: Array,
},
queryParams: {
type: Object,
},
total: {
type: Number,
},
loading: {
type: Boolean,
},
},
components: {
OperatorButton,
},
methods: {
getList(value) {
console.log(value);
this.$emit("getList", value);
},
//获取项目名称
transactionProjectName(row) {
let project = this.$parent.$parent.transactionProjects.find(
(item) => item.transactionProjectId == row.relationTransactionProjectId
);
if (project) {
return project.transactionProjectName;
}
return "-";
},
//获取交易状态
getTradeStatus(row) {
return this.selectDictLabel(
this.$parent.$parent.transactionProjectStatus,
row.tradeStatus
);
},
handleUpdate(row) {
this.$parent.$parent.handleUpdate(row);
},
handleDelete(row) {
this.$parent.$parent.handleDelete(row);
},
debitStatusFormatter(row){
return this.selectDictLabel(
this.$parent.$parent.debitStatusList,
row.debitStatus
);
}
},
};
</script>
<style scoped></style>
<template>
<div>
<DebitDetail :debitData="debitData"/>
</div>
</template>
<script>
import DebitDetail from "./DebitDetail";
export default {
name: "repay",
props:{
debitData:{
type: Object
}
},
components:{
DebitDetail
},
methods:{
resetSuggestion(){
},
checkParam(){
return false;
},
submitSuggestion(){
let param = {...this.debitData};
param.debitStatus = "3";
return param;
}
}
}
</script>
<style scoped>
</style>
......@@ -38,7 +38,12 @@
</el-form-item>
<el-form-item label="借贷状态" prop="debitStatus">
<el-select v-model="queryParams.debitStatus" placeholder="请选择借贷状态" clearable size="small">
<el-option label="请选择字典生成" value="" />
<el-option
v-for="item in debitStatusList"
:key="item.dictValue"
:label="item.dictLabel"
:value="item.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item>
......@@ -47,7 +52,7 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
......@@ -92,58 +97,76 @@
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-row>-->
<el-table v-loading="loading" :data="creditList">
<el-table-column label="借贷部门" align="center" prop="debitDeptName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="经办人" align="center" prop="operatorName" />
<el-table-column label="出借部门" align="center" prop="lendDeptName" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="登记日期" align="center" prop="registerTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.registerTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="使用说明" align="center" prop="useDescribe" />
<el-table-column label="使用人" align="center" prop="useName" />
<el-table-column label="小写合计" align="center" prop="littleTotal" />
<el-table-column label="计息日" align="center" prop="sumInterestDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.sumInterestDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="预计还款日" align="center" prop="expectedRepaymentDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.expectedRepaymentDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
<template slot-scope="scope">
<!-- <el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:credit:edit']"
>修改</el-button>-->
<!--部长查询借贷列表-->
<el-card class="box-card" v-if="$store.state.user.roles.findIndex(item =>item == 'deptLeader') != -1">
<div class="outer-div">
<header class="header">
<ul class="tab-tilte">
<li :class="{ active: tab == 0 }" @click="changeTab(0)">
所有项目
</li>
<li :class="{ active: tab == 1 }" @click="changeTab(1)">
我申请的
</li>
<li :class="{ active: tab == 2 }" @click="changeTab(2)">
我审批的
</li>
</ul>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:credit:remove']"
v-if="(scope.row.debitStatus == '0' || scope.row.debitStatus == '3') && scope.row.operatorId == $store.state.user.userId"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@click="handleAdd"
v-hasPermi="['system:credit:add']"
class="applyDebit"
>申请借贷</el-button
>
</header>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div class="tab-content">
<!-- 可以使用自定义组件 -->
<!-- <component-one v-show="tab == 0"></component-one>
<component-two v-show="tab == 1"></component-two> -->
<div v-if="tab == 0" :key="tab">
<TableList
:queryParams="queryParams"
:creditList="creditList"
:total="total"
:loading="loading"
@getList="getList"
/>
</div>
<div v-if="tab == 1" :key="tab">
<TableList
:queryParams="queryParams"
:creditList="creditList"
:total="total"
:loading="loading"
@getList="getList"
/>
</div>
<div v-if="tab == 2" :key="tab">
<TableList
:queryParams="queryParams"
:creditList="creditList"
:total="total"
:loading="loading"
@getList="getList"
/>
</div>
</div>
</div>
</el-card>
<!--核算部及其他角色-->
<el-card class="box-card" v-else>
<TableList
:queryParams="queryParams"
:creditList="creditList"
:total="total"
:loading="loading"
@getList="getList"
/>
</el-card>
<!-- 添加或修改借贷对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false" destroy-on-close>
......@@ -237,18 +260,20 @@
</template>
<script>
import { listCredit, getCredit, delCredit, addCredit, updateCredit, exportCredit } from "@/api/debit/credit";
import { listCredit, getCredit, delCredit, addCredit, updateCredit, exportCredit, selectDebitListByRoles } from "@/api/debit/credit";
import FileUpload from "@/components/FileUpload";
import uploadfile from "@/assets/uploadfile.png";
import { selectTransactorByDeptId } from "@/api/system/user";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import TableList from "./components/TableList";
export default {
name: "Credit",
components: {
Treeselect,
FileUpload
FileUpload,
TableList
},
data() {
let validateExpectedRepaymentDate = (rule, value, callback) => {
......@@ -302,6 +327,7 @@ export default {
realPaymentDate: null,
realPaymentAcount: null,
isDel: null,
queryType: "all",
},
// 表单参数
form: {},
......@@ -330,6 +356,8 @@ export default {
fileList: [],
usersList: [],
formDeptOptions: [],
tab: "0",
debitStatusList: []
};
},
created() {
......@@ -338,12 +366,16 @@ export default {
this.getUsers();
//获取部门
this.getTreeselect();
this.getDicts("t_debit_status").then((response) => {
this.debitStatusList = response.data;
});
},
methods: {
/** 查询借贷列表 */
getList() {
this.loading = true;
listCredit(this.queryParams).then(response => {
selectDebitListByRoles(this.queryParams).then(response => {
this.creditList = response.rows;
this.total = response.total;
this.loading = false;
......@@ -596,6 +628,68 @@ export default {
});
},
//切换tab
changeTab(tabNum) {
this.queryParams.pageNum = 1;
this.queryParams.pageSize = 10;
this.tab = tabNum;
if (tabNum == 0) {
this.queryParams.queryType = "all";
}
if (tabNum == 1) {
this.queryParams.queryType = "myApply";
}
if (tabNum == 2) {
this.queryParams.queryType = "myApproval";
}
this.getList();
},
}
};
</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;
}
.applyDebit {
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