Commit 4bb3b2c0 authored by 耿迪迪's avatar 耿迪迪

交易中心

parent 30406f1b
......@@ -7,14 +7,7 @@ import com.zehong.framework.systemsetting.SystemSetting;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.zehong.common.annotation.Log;
import com.zehong.common.constant.UserConstants;
......@@ -207,4 +200,14 @@ public class SysUserController extends BaseController
user.setUpdateBy(SecurityUtils.getUsername());
return toAjax(userService.updateUserStatus(user));
}
/**
* 获取经办人
* @param deptId 部门id
* @return
*/
@GetMapping("/selectTransactorByDeptId")
public AjaxResult selectTransactorByDeptId(@RequestParam(value="deptId") Long deptId){
return AjaxResult.success(userService.selectTransactorByDeptId(deptId));
}
}
......@@ -39,6 +39,13 @@ public class TTradeProjectController extends BaseController
return getDataTable(list);
}
@GetMapping("/selectTTradeProjectListByRoles")
public TableDataInfo selectTTradeProjectListByRoles(TTradeProject tTradeProject){
startPage();
List<TTradeProject> list = tTradeProjectService.selectTTradeProjectListByRoles(tTradeProject);
return getDataTable(list);
}
/**
* 导出交易项目列表
*/
......
......@@ -7,7 +7,9 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 交易项目对象 t_trade_project
......@@ -101,6 +103,14 @@ public class TTradeProject extends BaseEntity
private String tradeDeptName;
/**查询类型:all全部 myApply我申请的 myApproval我的审批*/
private String queryType;
private String tradeDeptManagerName;
/**操作类型*/
private List<String> operators = new ArrayList<>();
public void setTradeId(Long tradeId)
{
this.tradeId = tradeId;
......@@ -297,6 +307,30 @@ public class TTradeProject extends BaseEntity
this.tradeDeptName = tradeDeptName;
}
public String getQueryType() {
return queryType;
}
public void setQueryType(String queryType) {
this.queryType = queryType;
}
public List<String> getOperators() {
return operators;
}
public void setOperators(List<String> operators) {
this.operators = operators;
}
public String getTradeDeptManagerName() {
return tradeDeptManagerName;
}
public void setTradeDeptManagerName(String tradeDeptManagerName) {
this.tradeDeptManagerName = tradeDeptManagerName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -108,4 +108,11 @@ public interface SysUserMapper
* @return 结果
*/
public SysUser checkEmailUnique(String email);
/**
* 获取经办人
* @param deptId 部门id
* @return
*/
List<SysUser> selectTransactorByDeptId(Long deptId);
}
......@@ -164,4 +164,11 @@ public interface ISysUserService
* @return 结果
*/
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
/**
* 获取经办人
* @param deptId 部门id
* @return
*/
List<SysUser> selectTransactorByDeptId(Long deptId);
}
......@@ -27,6 +27,13 @@ public interface ITTradeProjectService
*/
public List<TTradeProject> selectTTradeProjectList(TTradeProject tTradeProject);
/**
* 根据角色查询数据
* @param tTradeProject 交易实体
* @return
*/
List<TTradeProject> selectTTradeProjectListByRoles(TTradeProject tTradeProject);
/**
* 新增交易项目
*
......
......@@ -460,4 +460,13 @@ public class SysUserServiceImpl implements ISysUserService
}
return successMsg.toString();
}
/**
* 获取经办人
* @param deptId 部门id
* @return
*/
public List<SysUser> selectTransactorByDeptId(Long deptId){
return userMapper.selectTransactorByDeptId(deptId);
}
}
package com.zehong.system.service.impl;
import com.zehong.common.core.domain.entity.SysRole;
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 com.zehong.system.service.impl.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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* 交易项目Service业务层处理
......@@ -47,6 +54,44 @@ public class TTradeProjectServiceImpl implements ITTradeProjectService
return tTradeProjectMapper.selectTTradeProjectList(tTradeProject);
}
/**
* 根据角色查询数据
* @param tTradeProject 交易实体
* @return
*/
@Override
public List<TTradeProject> selectTTradeProjectListByRoles(TTradeProject tTradeProject){
judgeRole(tTradeProject).setQueryParams();
List<TTradeProject> tradeProjectList = tTradeProjectMapper.selectTTradeProjectList(tTradeProject);
for(TTradeProject project :tradeProjectList){
judgeRole(project).setOperators();
}
return tradeProjectList;
}
/**
* 判断角色
* @param tTradeProject
* @return TradeRoles
*/
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("transactor") && roleKeys.contains("deptLeader")){
return new DoubleRoles(tTradeProject);
}
//经办人
if(roleKeys.contains("transactor")){
return new Transactor(tTradeProject);
}
//部长
if(roleKeys.contains("deptLeader")){
return new DeptLeader(tTradeProject);
}
return new OtherRoles(tTradeProject);
}
/**
* 新增交易项目
*
......
package com.zehong.system.service.impl.tradeRoles;
/**
* @author geng
* 交易角色
*/
public interface TradeRoles {
/**
* 设置查询权限
*/
void setQueryParams();
/**
* 设置操作权限
*/
void setOperators();
}
package com.zehong.system.service.impl.tradeRoles;
import com.zehong.system.domain.TTradeProject;
public abstract class TradeRolesAbstract implements TradeRoles{
/**交易实体*/
protected TTradeProject tTradeProject;
/**交易状态枚举类*/
protected enum TradeStatusEnum{
evaluate("0"),confirm("1"),approval("2"),complete("3"),reject("4");
private final String tradeStatus;
TradeStatusEnum(String tradeStatus) {
this.tradeStatus = tradeStatus;
}
public String getTradeStatus() {
return tradeStatus;
}
}
public TradeRolesAbstract(TTradeProject tTradeProject){
this.tTradeProject = tTradeProject;
}
}
package com.zehong.system.service.impl.tradeRoles.roles;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TTradeProject;
import com.zehong.system.service.impl.tradeRoles.TradeRolesAbstract;
/**
* @author geng
* 部门长
*/
public class DeptLeader extends TradeRolesAbstract {
public DeptLeader(TTradeProject tTradeProject) {
super(tTradeProject);
}
@Override
public void setQueryParams() {
SysUser user = SecurityUtils.getLoginUser().getUser();
if("myApply".equals(tTradeProject.getQueryType()) ||"all".equals(tTradeProject.getQueryType())){
this.tTradeProject.setApplyDeptId(user.getDeptId());
}
if("myApproval".equals(tTradeProject.getQueryType()) || "all".equals(tTradeProject.getQueryType())){
this.tTradeProject.setTradeDeptId(user.getDeptId());
}
}
@Override
public void setOperators() {
//判断买方还是卖方
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
//卖方部门
if(deptId.equals(this.tTradeProject.getApplyDeptId()) && TradeStatusEnum.approval.getTradeStatus().equals(this.tTradeProject.getTradeStatus())){
tTradeProject.getOperators().add("approval");
}
//买方部门
if(deptId.equals(this.tTradeProject.getTradeDeptId()) && TradeStatusEnum.confirm.getTradeStatus().equals(this.tTradeProject.getTradeStatus())){
tTradeProject.getOperators().add("confirm");
}
}
}
package com.zehong.system.service.impl.tradeRoles.roles;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TTradeProject;
import com.zehong.system.service.impl.tradeRoles.TradeRolesAbstract;
/**
*
* 部长和经办人双角色
*/
public class DoubleRoles extends TradeRolesAbstract {
public DoubleRoles(TTradeProject tTradeProject) {
super(tTradeProject);
}
/**
* 多权限以最高权限为准
*/
@Override
public void setQueryParams() {
SysUser user = SecurityUtils.getLoginUser().getUser();
if("myApply".equals(tTradeProject.getQueryType()) ||"all".equals(tTradeProject.getQueryType())){
this.tTradeProject.setApplyDeptId(user.getDeptId());
}
if("myApproval".equals(tTradeProject.getQueryType()) || "all".equals(tTradeProject.getQueryType())){
this.tTradeProject.setTradeDeptId(user.getDeptId());
}
}
@Override
public void setOperators() {
//判断买方还是卖方
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
//买方评价
if(deptId.equals(this.tTradeProject.getTradeDeptId()) && (TradeStatusEnum.evaluate.getTradeStatus().equals(this.tTradeProject.getTradeStatus())||TradeStatusEnum.reject.getTradeStatus().equals(this.tTradeProject.getTradeStatus()))){
tTradeProject.getOperators().add("evaluate");
}
//卖方部门
if(deptId.equals(this.tTradeProject.getApplyDeptId()) && TradeStatusEnum.approval.getTradeStatus().equals(this.tTradeProject.getTradeStatus())){
tTradeProject.getOperators().add("approval");
}
//买方部门
if(deptId.equals(this.tTradeProject.getTradeDeptId()) && TradeStatusEnum.confirm.getTradeStatus().equals(this.tTradeProject.getTradeStatus())){
tTradeProject.getOperators().add("confirm");
}
}
}
package com.zehong.system.service.impl.tradeRoles.roles;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TTradeProject;
import com.zehong.system.service.impl.tradeRoles.TradeRolesAbstract;
/**
* 其他角色
*/
public class OtherRoles extends TradeRolesAbstract {
public OtherRoles(TTradeProject tTradeProject) {
super(tTradeProject);
}
@Override
public void setQueryParams() {
SysUser user = SecurityUtils.getLoginUser().getUser();
if("myApply".equals(tTradeProject.getQueryType()) ||"all".equals(tTradeProject.getQueryType())){
this.tTradeProject.setApplyDeptId(user.getDeptId());
this.tTradeProject.setApplyId(user.getUserId());
}
if("myApproval".equals(tTradeProject.getQueryType()) || "all".equals(tTradeProject.getQueryType())){
this.tTradeProject.setTradeDeptId(user.getDeptId());
this.tTradeProject.setTradeTransactor(user.getUserId());
}
}
@Override
public void setOperators() {
}
}
package com.zehong.system.service.impl.tradeRoles.roles;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.system.domain.TTradeProject;
import com.zehong.system.service.impl.tradeRoles.TradeRolesAbstract;
/**
*@author geng
* 经办人
*/
public class Transactor extends TradeRolesAbstract {
public Transactor(TTradeProject tTradeProject) {
super(tTradeProject);
}
@Override
public void setQueryParams() {
SysUser user = SecurityUtils.getLoginUser().getUser();
if("myApply".equals(tTradeProject.getQueryType()) ||"all".equals(tTradeProject.getQueryType())){
this.tTradeProject.setApplyDeptId(user.getDeptId());
this.tTradeProject.setApplyId(user.getUserId());
}
if("myApproval".equals(tTradeProject.getQueryType()) || "all".equals(tTradeProject.getQueryType())){
this.tTradeProject.setTradeDeptId(user.getDeptId());
this.tTradeProject.setTradeTransactor(user.getUserId());
}
}
@Override
public void setOperators() {
//申请中
Long deptId = SecurityUtils.getLoginUser().getUser().getDeptId();
if(deptId.equals(this.tTradeProject.getTradeDeptId()) && (TradeStatusEnum.evaluate.getTradeStatus().equals(this.tTradeProject.getTradeStatus())||TradeStatusEnum.reject.getTradeStatus().equals(this.tTradeProject.getTradeStatus()))){
tTradeProject.getOperators().add("evaluate");
}
}
}
......@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="applyName" column="apply_name"/>
<result property="applyDeptName" column="apply_dept_name"/>
<result property="tradeDeptName" column="trade_dept_name"/>
<result property="tradeDeptManagerName" column="trade_dept_manager_name"/>
</resultMap>
<sql id="selectTTradeProjectVo">
......@@ -56,9 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time,
is_del,
remark,
(SELECT nick_name FROM sys_user WHERE user_id = apply_id) AS apply_name,
(SELECT user_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
(SELECT dept_name FROM sys_dept WHERE dept_id = trade_dept_id) AS trade_dept_name,
(SELECT user_name FROM sys_user WHERE user_id = trade_dept_manager_id) AS trade_dept_manager_name
FROM
t_trade_project
</sql>
......@@ -68,11 +70,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="queryType != 'all'">
<if test="applyId != null"> and apply_id = #{applyId}</if>
<if test="applyDeptId != null"> and apply_dept_id = #{applyDeptId}</if>
<if test="tradeTransactor != null"> and trade_transactor = #{tradeTransactor}</if>
<if test="tradeDeptId != null"> and trade_dept_id = #{tradeDeptId}</if>
</if>
<if test="queryType == 'all' and applyDeptId != null and tradeTransactor != null">
and (
(apply_dept_id = #{applyDeptId}
<if test="applyId != null"> and apply_id = #{applyId}</if>)
or(trade_dept_id = #{tradeDeptId}
<if test="tradeTransactor != null"> and trade_transactor = #{tradeTransactor}</if>)
)
</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>
......
......@@ -178,5 +178,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userId}
</foreach>
</delete>
<select id="selectTransactorByDeptId" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.dept_id = #{deptId} AND r.role_key = "transactor";
</select>
</mapper>
\ No newline at end of file
......@@ -38,7 +38,7 @@
"clipboard": "2.0.6",
"core-js": "^3.19.1",
"echarts": "4.9.0",
"element-ui": "2.15.0",
"element-ui": "2.15.6",
"file-saver": "2.0.4",
"fuse.js": "6.4.3",
"highlight.js": "9.18.5",
......
......@@ -125,3 +125,11 @@ export function importTemplate() {
method: 'get'
})
}
export function selectTransactorByDeptId(query){
return request({
url: '/system/user/selectTransactorByDeptId',
method: 'get',
params: query
})
}
......@@ -9,6 +9,15 @@ export function listProject(query) {
})
}
export function selectTTradeProjectListByRoles(query) {
return request({
url: '/trade/project/selectTTradeProjectListByRoles',
method: 'get',
params: query
})
}
// 查询交易项目详细
export function getProject(tradeId) {
return request({
......
......@@ -10,6 +10,7 @@ const user = {
permissions: [],
systemSetting:{},
deptId: '',
userId: ''
},
mutations: {
......@@ -19,6 +20,9 @@ const user = {
SET_NAME: (state, name) => {
state.name = name
},
SET_USER_ID: (state, userId) =>{
state.userId = userId;
},
SET_AVATAR: (state, avatar) => {
state.avatar = avatar
},
......@@ -68,6 +72,7 @@ const user = {
commit('SET_ROLES', ['ROLE_DEFAULT'])
}
commit('SET_NAME', user.userName)
commit('SET_USER_ID',user.userId)
commit('SET_AVATAR', avatar)
// 默认配置
commit('SET_SYSTEMSETTING', res.systemSetting)
......
<template>
<div>
<CommonInfo :tradeData="tradeData"/>
<div style="margin: 11px 30px;color: #1890ff;">买方审核</div>
<el-row style="margin-left:97px">
<el-col :span="5">
<el-row>
<el-col :span="6">评价</el-col>
<el-col :span="18">{{tradeData.tradeScore?tradeData.tradeScore:"-"}}</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="8">成交价</el-col>
<el-col :span="16">{{tradeData.dealPrice}}</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="8">审核人</el-col>
<el-col :span="16">{{tradeData.tradeDeptManagerName}}</el-col>
</el-row>
</el-col>
</el-row>
<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.name" style="width: 90px" disabled/></el-col>
</el-row>
</el-col>
</el-row>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "approval",
props:{
tradeData: {
type: Object
}
},
components:{
CommonInfo
},
watch:{
radio(newVal,oldVal){
if(newVal== "1"){
this.tradeStatus = "3";
}
if(newVal== "2"){
this.tradeStatus = "4";
}
}
},
data(){
return{
radio: "1",
tradeStatus: "3"
}
},
methods:{
checkParam(){
return false;
},
submitSuggestion(){
return {tradeId:this.tradeData.tradeId,tradeStatus:this.tradeStatus};
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="common">
<el-form label-width="100px">
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="项目名称">{{transactionProjectInfo.transactionProjectName}}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="卖方部门">{{tradeData.applyDeptName}}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-row>
<el-col :span="12">
<el-form-item label="内容说明">{{transactionProjectInfo.context}}</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="买方部门">{{tradeData.tradeDeptName}}</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="checkFile(tradeData.attachmentUrl)"
v-if="tradeData.attachmentUrl != null && tradeData.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="经办人">{{tradeData.applyName}}</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<el-form-item label="细项名称">
<div>{{transactionProjectInfo.transactionItemName}}</div>
<el-row>
<el-col :span="5">
<el-row>
<el-col :span="6">数量</el-col>
<el-col :span="18">{{tradeData.tradeCount}}</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="6">单价</el-col>
<el-col :span="18">{{tradeData.tradePrice}}</el-col>
</el-row>
</el-col>
<el-col :span="5">
<el-row>
<el-col :span="6">总计</el-col>
<el-col :span="18">{{tradeData.tradeTotal}}</el-col>
</el-row>
</el-col>
</el-row>
</el-form-item>
<el-divider></el-divider>
</el-form>
</div>
</template>
<script>
import { getProject } from "@/api/transaction/project";
export default {
name: "common-info",
props:{
tradeData: {
type: Object
}
},
data(){
return{
transactionProjectInfo: {}
}
},
created(){
this.getTransactionProjecInfo();
},
methods:{
getTransactionProjecInfo(){
getProject(this.tradeData.relationTransactionProjectId).then(res =>{
if(res.code == 200){
this.transactionProjectInfo = res.data;
}
})
},
checkFile(url) {
window.open(url,'_blank');
},
}
}
</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 :tradeData="tradeData"/>
<div style="margin: 11px 30px;color: #1890ff;">部门审核</div>
<el-row style="margin-left:95px">
<el-col :span="8" style="margin-top: 10px">
<el-checkbox v-model="checked">我已知晓</el-checkbox>
</el-col>
<el-col :span="8">
<span style="margin: 0px 5px;">审批人</span>
<el-input :value="$store.state.user.name" style="width: 130px" disabled/>
</el-col>
</el-row>
<el-divider></el-divider>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "confirm",
props:{
tradeData: {
type: Object
}
},
components:{
CommonInfo
},
data(){
return{
checked: false
}
},
methods:{
checkParam(){
if(!this.checked){
this.$message.error("请勾选须知!");
return true;
}
return false;
},
submitSuggestion(){
return {tradeId:this.tradeData.tradeId,tradeStatus:"2",tradeDeptManagerId:this.$store.state.user.userId};
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<CommonInfo :tradeData="tradeData"/>
<div style="margin: 11px 30px;color: #1890ff;">买方审核</div>
<el-row style="margin-left:95px">
<el-col :span="8">
<el-radio v-model="radio" label="1">
<span style="margin: 0px 5px;">议价</span>
<el-input v-model="price" placeholder="请输入价格" style="width: 130px" @blur="priceInput" :disabled="priceDisabled"/>
</el-radio>
</el-col>
<el-col :span="8">
<el-radio v-model="radio" label="2">
<span style="margin: 0px 5px;">评价</span>
<el-input v-model="socre"
placeholder="请输入评分"
style="width: 130px" @blur="socreInput"
oninput="if(!/^[0-9]+$/.test(value)) value=value.replace(/\D/g,'');if(value>100)value=100;if(value<0)value=null"
:disabled="socreDisabled"/>
</el-radio>
</el-col>
<el-col :span="8">
<span style="margin: 0px 5px">成交价</span>
<el-input v-model="dealPrice" disabled style="width: 130px"/>
</el-col>
</el-row>
<el-divider></el-divider>
</div>
</template>
<script>
import CommonInfo from "./CommonInfo";
export default {
name: "evaluate",
props:{
tradeData: {
type: Object
}
},
components:{
CommonInfo
},
data(){
return{
radio:"2",
priceDisabled: true,
socreDisabled: false,
socre: "",
price: "",
dealPrice: ""
}
},
watch:{
radio(newVal,oldVal){
this.price = "";
this.socre = "";
this.dealPrice = "";
if(newVal == '1'){
this.priceDisabled = false;
this.socreDisabled = true;
}
if(newVal == '2'){
this.priceDisabled = true;
this.socreDisabled = false;
}
}
},
methods:{
//议价
priceInput(){
this.dealPrice = this.price;
},
socreInput(){
this.dealPrice = this.tradeData.tradeTotal * this.socre / 100;
},
resetSuggestion(){
this.price = "";
this.socre = "";
this.dealPrice = "";
},
checkParam(){
if(!this.dealPrice){
this.$message.error("请检查评价信息!")
return true;
}
return false;
},
submitSuggestion(){
let param = {tradeId:this.tradeData.tradeId,tradeStatus:"1",dealPrice:this.dealPrice};
if(this.socre){
param.tradeScore = this.socre;
}
return param;
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<el-button type="text" @click="open=true" 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" :tradeData="tradeData" ref="currentCom"></component>
<div slot="footer" class="dialog-footer" style="text-align: center">
<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>
</el-dialog>
</div>
</template>
<script>
import { getProject, updateProject } from "@/api/transaction/tradeProject.js";
import evaluate from "./Evaluate";
import confirm from "./Confirm";
import approval from "./Approval";
export default {
name: "operator-button",
components:{
evaluate,
confirm,
approval
},
props:{
operatorName: {
type: String
},
tradeInfo: {
type: Object
}
},
created(){
this.currentTabComponent = this.operatorName;
this.getTradeInfo();
},
data(){
return{
open: false,
currentTabComponent: "",
tradeData: {}
}
},
methods:{
getOperatorName(){
switch(this.operatorName){
case "evaluate":
return "经办人评价";
case "confirm":
return "买方部门长确认";
case "approval":
return "卖方部门长审核";
default:
return "";
}
},
getTradeInfo(){
getProject(this.tradeInfo.tradeId).then(res =>{
if(res.code == 200){
this.tradeData = res.data;
}
})
},
//重置意见
resetSuggestion(){
this.$refs.currentCom.resetSuggestion();
},
//提交
submitSuggestion(){
if(this.$refs.currentCom.checkParam()){
return;
}
let that = this;
updateProject(this.$refs.currentCom.submitSuggestion()).then(res =>{
if(res.code == 200){
this.open = false;
this.$emit("getList");
that.$message.success("提交成功!");
}else{
that.$message.error("提交失败!");
}
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<el-table v-loading="loading" :data="projectList">
<el-table-column label="交易项目" align="center" prop="relationTransactionProjectId" :formatter="transactionProjectName" :show-overflow-tooltip="true"/>
<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
v-if="scope.row.tradeStatus=='0' || scope.row.tradeStatus=='4'"
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:project:edit']"
>修改</el-button>
<el-button
v-if="scope.row.tradeStatus=='0' || scope.row.tradeStatus=='4'"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:project:remove']"
>删除</el-button>
<OperatorButton v-for="item in scope.row.operators"
:operatorName="item"
:tradeInfo="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:{
projectList:{
type: Array
},
queryParams:{
type: Object
},
total:{
type: Number
},
loading:{
type: Boolean
}
},
components:{
OperatorButton
},
methods:{
getList(){
this.$emit("getList");
},
//获取项目名称
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);
}
}
}
</script>
<style scoped>
</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