This commit is contained in:
Vinjor 2025-12-02 18:13:19 +08:00
parent 7a8ac4cfe6
commit ba3175055e
9 changed files with 471 additions and 177 deletions

View File

@ -222,14 +222,19 @@ public class CusMainServiceImpl extends ServiceImpl<CusMainMapper,CusMain> impl
List<CusContacts> contacts = cusContactsService.list(new LambdaQueryWrapper<CusContacts>().eq(CusContacts::getCusId, id).orderByDesc(CusContacts::getIfDefault).orderByAsc(DlBaseEntity::getCreateTime)); List<CusContacts> contacts = cusContactsService.list(new LambdaQueryWrapper<CusContacts>().eq(CusContacts::getCusId, id).orderByDesc(CusContacts::getIfDefault).orderByAsc(DlBaseEntity::getCreateTime));
cusMainVO.setContact(contacts); cusMainVO.setContact(contacts);
//3.查公司表 //3.查公司表
CusCompany company = cusCompanyService.list(new LambdaQueryWrapper<CusCompany>().eq(CusCompany::getCusId, id).orderByDesc(DlBaseEntity::getCreateTime)).get(0); List<CusCompany> companyList = cusCompanyService.list(new LambdaQueryWrapper<CusCompany>().eq(CusCompany::getCusId, id).orderByDesc(DlBaseEntity::getCreateTime));
CusCompany company = companyList.isEmpty() ? new CusCompany() : companyList.get(0);
cusMainVO.setCompanyInfo(company); cusMainVO.setCompanyInfo(company);
//4.查管理表 //4.查管理表
CusManager manager = cusManagerService.list(new LambdaQueryWrapper<CusManager>().eq(CusManager::getCusId, id).orderByDesc(DlBaseEntity::getCreateTime)).get(0); List<CusManager> managerList = cusManagerService.list(new LambdaQueryWrapper<CusManager>().eq(CusManager::getCusId, id).orderByDesc(DlBaseEntity::getCreateTime));
CusManager manager = managerList.isEmpty() ? new CusManager() : managerList.get(0);
cusMainVO.setManagementInfo(manager); cusMainVO.setManagementInfo(manager);
//5.查银行表 //5.查银行表
List<CusBank> bankList = cusBankService.list(new LambdaQueryWrapper<CusBank>().eq(CusBank::getCusId, id).orderByDesc(DlBaseEntity::getCreateTime)); List<CusBank> bankList = cusBankService.list(new LambdaQueryWrapper<CusBank>().eq(CusBank::getCusId, id).orderByDesc(DlBaseEntity::getCreateTime));
cusMainVO.setBankInfo(bankList); cusMainVO.setBankInfo(bankList.isEmpty() ? new ArrayList<>() : bankList);
//6.查唛头表 //6.查唛头表
List<CusMark> markList = cusMarkService.list(new LambdaQueryWrapper<CusMark>().eq(CusMark::getCusId, id).orderByDesc(DlBaseEntity::getCreateTime)); List<CusMark> markList = cusMarkService.list(new LambdaQueryWrapper<CusMark>().eq(CusMark::getCusId, id).orderByDesc(DlBaseEntity::getCreateTime));
MarkVO markVO = new MarkVO(); MarkVO markVO = new MarkVO();

View File

@ -250,8 +250,15 @@ public class SysUserController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('system:user:list')") @PreAuthorize("@ss.hasPermi('system:user:list')")
@GetMapping("/deptTree") @GetMapping("/deptTree")
public AjaxResult deptTree(SysDept dept) public AjaxResult deptTree(SysDept dept) {
{
return success(deptService.selectDeptTreeList(dept)); return success(deptService.selectDeptTreeList(dept));
} }
/**
* 获取部门树+客户列表客户左侧部门树
*/
@GetMapping("/deptAndUserTree")
public AjaxResult deptAndUserTree(SysDept dept) {
return success(deptService.selectDeptAndUserTreeList(dept));
}
} }

View File

@ -6,7 +6,7 @@ spring:
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://rm-bp1msd0a4kq4t7a66lo.mysql.rds.aliyuncs.com:3306/dl_crm_system?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://rm-bp1msd0a4kq4t7a66lo.mysql.rds.aliyuncs.com:3306/dl_crm_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: csd_rw username: csd_rw
password: Csd2025#123 password: Csd2025#123
# 从库数据源 # 从库数据源

View File

@ -63,6 +63,12 @@
<if test="entity.cusCode!=null and entity.cusCode!=''"> <if test="entity.cusCode!=null and entity.cusCode!=''">
AND cm.cus_code = #{entity.cusCode} AND cm.cus_code = #{entity.cusCode}
</if> </if>
<if test="entity.userId!=null and entity.userId!=''">
AND cm.user_id = #{entity.userId}
</if>
<if test="entity.deptId!=null and entity.deptId!=''">
AND cm.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = #{entity.deptId} or find_in_set( #{entity.deptId}, ancestors ) )
</if>
<if test="entity.fullName!=null and entity.fullName!=''"> <if test="entity.fullName!=null and entity.fullName!=''">
AND cm.full_name LIKE CONCAT('%',#{entity.fullName},'%') AND cm.full_name LIKE CONCAT('%',#{entity.fullName},'%')
</if> </if>

View File

@ -0,0 +1,112 @@
package com.ruoyi.common.core.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.StringUtils;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* Treeselect树结构实体类---点亮扩展
*
* @author ruoyi
*/
public class DlTreeSelect implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
/** 节点类型user用户|dept部门 */
private String type;
/** 节点禁用 */
private boolean disabled = false;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<DlTreeSelect> children;
public DlTreeSelect()
{
}
public DlTreeSelect(SysDept dept) {
this.id = dept.getDeptId();
this.type="dept";
this.label = dept.getDeptName();
this.disabled = StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus());
this.children = dept.getChildren().stream().map(DlTreeSelect::new).collect(Collectors.toList());
}
public DlTreeSelect(SysUser user) {
this.id = user.getUserId();
this.type="user";
this.label = user.getNickName();
}
public DlTreeSelect(SysMenu menu)
{
this.id = menu.getMenuId();
this.label = menu.getMenuName();
this.children = menu.getChildren().stream().map(DlTreeSelect::new).collect(Collectors.toList());
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public boolean isDisabled()
{
return disabled;
}
public void setDisabled(boolean disabled)
{
this.disabled = disabled;
}
public List<DlTreeSelect> getChildren()
{
return children;
}
public void setChildren(List<DlTreeSelect> children)
{
this.children = children;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@ -1,6 +1,9 @@
package com.ruoyi.system.service; package com.ruoyi.system.service;
import java.util.List; import java.util.List;
import java.util.Map;
import com.ruoyi.common.core.domain.DlTreeSelect;
import com.ruoyi.common.core.domain.TreeSelect; import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
@ -27,6 +30,14 @@ public interface ISysDeptService
*/ */
public List<TreeSelect> selectDeptTreeList(SysDept dept); public List<TreeSelect> selectDeptTreeList(SysDept dept);
/**
* 获取部门树+客户列表客户左侧部门树
*
* @param dept 部门信息
* @return 部门树信息集合
*/
public Map<String,Object> selectDeptAndUserTreeList(SysDept dept);
/** /**
* 构建前端所需要树结构 * 构建前端所需要树结构
* *

View File

@ -1,9 +1,11 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.ArrayList; import java.util.*;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.ruoyi.common.core.domain.DlTreeSelect;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.annotation.DataScope;
@ -27,13 +29,14 @@ import com.ruoyi.system.service.ISysDeptService;
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
public class SysDeptServiceImpl implements ISysDeptService public class SysDeptServiceImpl implements ISysDeptService {
{
@Autowired @Autowired
private SysDeptMapper deptMapper; private SysDeptMapper deptMapper;
@Autowired @Autowired
private SysRoleMapper roleMapper; private SysRoleMapper roleMapper;
@Autowired
private SysUserMapper userMapper;
/** /**
* 查询部门管理数据 * 查询部门管理数据
@ -55,12 +58,60 @@ public class SysDeptServiceImpl implements ISysDeptService
* @return 部门树信息集合 * @return 部门树信息集合
*/ */
@Override @Override
public List<TreeSelect> selectDeptTreeList(SysDept dept) public List<TreeSelect> selectDeptTreeList(SysDept dept) {
{
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept); List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
return buildDeptTreeSelect(depts); return buildDeptTreeSelect(depts);
} }
/**
* 获取部门树+客户列表客户左侧部门树
*
* @param dept 部门信息
* @return 部门树信息集合
*/
@Override
public Map<String,Object> selectDeptAndUserTreeList(SysDept dept) {
Map<String,Object> rtnMap = new HashMap<>();
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
//所有部门的Id
rtnMap.put("deptId",depts.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
List<DlTreeSelect> deptTreeSelects = buildDeptAndUserTreeSelect(depts);
//部门树处理完以后逐级查询用户
List<SysUser> userList = userMapper.selectAllUserList();
Map<Long, List<SysUser>> userMap = userList.stream().collect(Collectors.groupingBy(SysUser::getDeptId));
//树处理-添加每个部门的用户
dealDeptUser(deptTreeSelects,userMap);
rtnMap.put("deptTree",deptTreeSelects);
return rtnMap;
}
/**
* 组装每个部门的子级用户
* @author vinjor-M
* @date 16:47 2025/12/2
* @param deptTreeSelects TODO
* @param userMap TODO
**/
private void dealDeptUser(List<DlTreeSelect> deptTreeSelects,Map<Long, List<SysUser>> userMap){
for (DlTreeSelect deptTree : deptTreeSelects){
if("dept".equals(deptTree.getType())){
//只处理部门
List<DlTreeSelect> children = new ArrayList<>();
if(null!=deptTree.getChildren() && !deptTree.getChildren().isEmpty()){
children = deptTree.getChildren();
}
if(userMap.containsKey(deptTree.getId())){
//存在当前部门的用户添加到子级中
for(SysUser sysUser:userMap.get(deptTree.getId())){
children.add(new DlTreeSelect(sysUser));
}
}
//处理所有子级
this.dealDeptUser(children,userMap);
}
}
}
/** /**
* 构建前端所需要树结构 * 构建前端所需要树结构
* *
@ -68,8 +119,7 @@ public class SysDeptServiceImpl implements ISysDeptService
* @return 树结构列表 * @return 树结构列表
*/ */
@Override @Override
public List<SysDept> buildDeptTree(List<SysDept> depts) public List<SysDept> buildDeptTree(List<SysDept> depts) {
{
List<SysDept> returnList = new ArrayList<SysDept>(); List<SysDept> returnList = new ArrayList<SysDept>();
List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList()); List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
for (SysDept dept : depts) for (SysDept dept : depts)
@ -95,12 +145,23 @@ public class SysDeptServiceImpl implements ISysDeptService
* @return 下拉树结构列表 * @return 下拉树结构列表
*/ */
@Override @Override
public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) public List<TreeSelect> buildDeptTreeSelect(List<SysDept> depts) {
{
List<SysDept> deptTrees = buildDeptTree(depts); List<SysDept> deptTrees = buildDeptTree(depts);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
} }
/**
* 构建前端所需要下拉树结构--点亮扩展
* @author vinjor-M
* @date 16:33 2025/12/2
* @param depts
* @return java.util.List<com.ruoyi.common.core.domain.DlTreeSelect>
**/
private List<DlTreeSelect> buildDeptAndUserTreeSelect(List<SysDept> depts) {
List<SysDept> deptTrees = buildDeptTree(depts);
return deptTrees.stream().map(DlTreeSelect::new).collect(Collectors.toList());
}
/** /**
* 根据角色ID查询部门树信息 * 根据角色ID查询部门树信息
* *

View File

@ -134,3 +134,10 @@ export function deptTreeSelect() {
method: 'get' method: 'get'
}) })
} }
// 查询部门下拉树结构--带用户
export function deptAndUserTree() {
return request({
url: '/system/user/deptAndUserTree',
method: 'get'
})
}

View File

@ -88,174 +88,185 @@
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-row :gutter="10">
<el-table v-loading="loading" :data="mainList"> <el-col v-if="showTree" :span="4">
<el-table-column fixed label="客户编码" align="center" prop="cusCode" width="150"> <div class="head-container">
<template slot-scope="scope"> <el-input v-model="deptName" placeholder="请输入部门名称" clearable size="small" prefix-icon="el-icon-search" style="margin-bottom: 20px" />
</div>
<div class="head-container">
<el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" node-key="id" default-expand-all highlight-current @node-click="handleNodeClick" />
</div>
</el-col>
<el-col :span="showTree?20:24">
<el-table v-loading="loading" :data="mainList">
<el-table-column fixed label="客户编码" align="center" prop="cusCode" width="150">
<template slot-scope="scope">
<span class="clickable-code" @click="handleCodeClick(scope.row)"> <span class="clickable-code" @click="handleCodeClick(scope.row)">
{{ scope.row.cusCode }} {{ scope.row.cusCode }}
</span> </span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column fixed label="客户名称" align="center" prop="fullName" width="200"> <el-table-column fixed label="客户名称" align="center" prop="fullName" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip :content="scope.row.fullName" placement="top" effect="dark"> <el-tooltip :content="scope.row.fullName" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.fullName }}</div> <div class="text-ellipsis-single">{{ scope.row.fullName }}</div>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="星标" align="center" prop="ifStar"> <el-table-column label="星标" align="center" prop="ifStar">
<template slot-scope="scope"> <template slot-scope="scope">
<i v-if="scope.row.ifStar" title="取消星标" class="el-icon-star-on" <i v-if="scope.row.ifStar" title="取消星标" class="el-icon-star-on"
style="color: #ffba00;font-size: 18px;cursor: pointer" style="color: #ffba00;font-size: 18px;cursor: pointer"
@click="setIfStar(scope.row,false)"></i> @click="setIfStar(scope.row,false)"></i>
<i v-else class="el-icon-star-off" title="星标" style="cursor: pointer" @click="setIfStar(scope.row,true)"></i> <i v-else class="el-icon-star-off" title="星标" style="cursor: pointer" @click="setIfStar(scope.row,true)"></i>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="客户简称" align="center" prop="shortName" width="130"> <el-table-column label="客户简称" align="center" prop="shortName" width="130">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip :content="scope.row.shortName" placement="top" effect="dark"> <el-tooltip :content="scope.row.shortName" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.shortName }}</div> <div class="text-ellipsis-single">{{ scope.row.shortName }}</div>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="跟进阶段" align="center" prop="followStep" width="120"> <el-table-column label="跟进阶段" align="center" prop="followStep" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip :content="scope.row.followStep" placement="top" effect="dark"> <el-tooltip :content="scope.row.followStep" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.followStep }}</div> <div class="text-ellipsis-single">{{ scope.row.followStep }}</div>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="标签" align="center" prop="cusLabels" width="100"> <el-table-column label="标签" align="center" prop="cusLabels" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip <el-tooltip
placement="top-start" placement="top-start"
effect="light" effect="light"
:disabled="!scope.row.cusLabelList || scope.row.cusLabelList.length === 0" :disabled="!scope.row.cusLabelList || scope.row.cusLabelList.length === 0"
>
<!-- 单元格内容首个标签 + 编辑图标优化抖动问题 -->
<div class="tag-cell-container">
<!-- 默认显示第一个标签空时显示无标签 -->
<el-tag
v-if="scope.row.cusLabelList && scope.row.cusLabelList.length > 0"
:color="scope.row.cusLabelList[0].color"
size="mini"
effect="dark"
class="default-tag"
> >
{{ scope.row.cusLabelList[0].name }} <!-- 单元格内容首个标签 + 编辑图标优化抖动问题 -->
</el-tag> <div class="tag-cell-container">
<!-- 默认显示第一个标签空时显示无标签 -->
<el-tag
v-if="scope.row.cusLabelList && scope.row.cusLabelList.length > 0"
:color="scope.row.cusLabelList[0].color"
size="mini"
effect="dark"
class="default-tag"
>
{{ scope.row.cusLabelList[0].name }}
</el-tag>
<!-- 图标容器固定尺寸避免布局偏移 --> <!-- 图标容器固定尺寸避免布局偏移 -->
<i v-hasPermi="['cus:main:add']" class="el-icon-collection-tag edit-tag-icon" @click="setCusLabel(scope.row)"></i> <i v-hasPermi="['cus:main:add']" class="el-icon-collection-tag edit-tag-icon" @click="setCusLabel(scope.row)"></i>
</div> </div>
<div slot="content" class="tooltip-tag-list"> <div slot="content" class="tooltip-tag-list">
<el-tag <el-tag
v-for="(tag, index) in scope.row.cusLabelList" v-for="(tag, index) in scope.row.cusLabelList"
:key="index" :key="index"
:color="tag.color" :color="tag.color"
size="mini"
effect="dark"
class="tooltip-tag-item"
>
{{ tag.name }}
</el-tag>
</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="客户类型" align="center" prop="cusType" width="120"/>
<el-table-column label="客户来源" align="center" prop="cusFrom" width="120"/>
<el-table-column label="客户等级" align="center" prop="cusLevel" width="120"/>
<el-table-column label="国家/地区" align="center" prop="country" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.country" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.country }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="时区" align="center" prop="zoneName" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.zoneName" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.zoneName }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="主营产品" align="center" prop="mainProds" width="140">
<template slot-scope="scope">
<el-tooltip :content="scope.row.mainProds" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.mainProds }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="业务类型" align="center" prop="busiType" width="120"/>
<el-table-column label="企业网站" align="center" prop="siteUrl">
<template slot-scope="scope">
<el-tooltip :content="scope.row.siteUrl" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.siteUrl }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="联系地址" align="center" prop="contactAddress" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.contactAddress" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.contactAddress }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="联系人" align="center" prop="contactName" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.contactName" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.contactName }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="业务员" align="center" prop="userName" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.userName" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.userName }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="最近联系时间" align="center" prop="contactTime" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.contactTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200">
<template slot-scope="scope">
<el-button
size="mini" size="mini"
effect="dark" type="text"
class="tooltip-tag-item" @click="handleUpdate(scope.row)"
> v-hasPermi="['cus:main:add']"
{{ tag.name }} >修改
</el-tag> </el-button>
</div> <el-button
</el-tooltip> size="mini"
</template> type="text"
</el-table-column> @click="handleSendEmail(scope.row)"
<el-table-column label="客户类型" align="center" prop="cusType" width="120"/> v-hasPermi="['cus:main:email']"
<el-table-column label="客户来源" align="center" prop="cusFrom" width="120"/> >发邮件
<el-table-column label="客户等级" align="center" prop="cusLevel" width="120"/> </el-button>
<el-table-column label="国家/地区" align="center" prop="country" width="120"> <el-dropdown @command="handleOpt">
<template slot-scope="scope">
<el-tooltip :content="scope.row.country" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.country }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="时区" align="center" prop="zoneName" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.zoneName" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.zoneName }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="主营产品" align="center" prop="mainProds" width="140">
<template slot-scope="scope">
<el-tooltip :content="scope.row.mainProds" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.mainProds }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="业务类型" align="center" prop="busiType" width="120"/>
<el-table-column label="企业网站" align="center" prop="siteUrl">
<template slot-scope="scope">
<el-tooltip :content="scope.row.siteUrl" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.siteUrl }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="联系地址" align="center" prop="contactAddress" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.contactAddress" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.contactAddress }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="联系人" align="center" prop="contactName" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.contactName" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.contactName }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="业务员" align="center" prop="userName" width="120">
<template slot-scope="scope">
<el-tooltip :content="scope.row.userName" placement="top" effect="dark">
<div class="text-ellipsis-single">{{ scope.row.userName }}</div>
</el-tooltip>
</template>
</el-table-column>
<el-table-column label="最近联系时间" align="center" prop="contactTime" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.contactTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
v-hasPermi="['cus:main:add']"
>修改
</el-button>
<el-button
size="mini"
type="text"
@click="handleSendEmail(scope.row)"
v-hasPermi="['cus:main:email']"
>发邮件
</el-button>
<el-dropdown @command="handleOpt">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
更多<i class="el-icon-arrow-down el-icon--right"></i> 更多<i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-hasPermi="['cus:main:follow']" :command="beforeCommand(scope.row,'newFollow')">新建跟进</el-dropdown-item> <el-dropdown-item v-hasPermi="['cus:main:follow']" :command="beforeCommand(scope.row,'newFollow')">新建跟进</el-dropdown-item>
<el-dropdown-item v-hasPermi="['cus:main:change']" :command="beforeCommand(scope.row,'changeUser')">移交客户</el-dropdown-item> <el-dropdown-item v-hasPermi="['cus:main:change']" :command="beforeCommand(scope.row,'changeUser')">移交客户</el-dropdown-item>
<el-dropdown-item v-hasPermi="['cus:main:move']" :command="beforeCommand(scope.row,'goSea')">转入公海</el-dropdown-item> <el-dropdown-item v-hasPermi="['cus:main:move']" :command="beforeCommand(scope.row,'goSea')">转入公海</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-col>
</el-row>
<pagination <pagination
v-show="total>0" v-show="total>0"
@ -297,6 +308,7 @@
</template> </template>
<script> <script>
import { deptAndUserTree } from "@/api/system/user";
import { listMain, getMain, delMain, addMain, updateMain ,setIfStar,moveToSeas} from '@/api/cus/main' import { listMain, getMain, delMain, addMain, updateMain ,setIfStar,moveToSeas} from '@/api/cus/main'
import { updateUser} from '@/api/cus/main' import { updateUser} from '@/api/cus/main'
import DrawForm from './drawForm' import DrawForm from './drawForm'
@ -305,13 +317,21 @@ import FollowForm from '../follow/followForm'
import LabelForm from './labelForm' import LabelForm from './labelForm'
import SelectAllUser from '../../system/user/selectAllUser' import SelectAllUser from '../../system/user/selectAllUser'
import CheckCus from './checkCus' import CheckCus from './checkCus'
import { mapGetters } from 'vuex'
export default { export default {
name: 'Main', name: 'Main',
computed: {
// 使 getter computed
...mapGetters([
'roles'
])
},
components: { CheckCus, SelectAllUser, LabelForm, DrawForm, FollowForm }, components: { CheckCus, SelectAllUser, LabelForm, DrawForm, FollowForm },
dicts: ['cus_main_product', 'cus_label', 'cus_type', 'sys_user_sex', 'cus_from', 'cus_level', 'cus_busi_type', 'cus_follow_step'], dicts: ['cus_main_product', 'cus_label', 'cus_type', 'sys_user_sex', 'cus_from', 'cus_level', 'cus_busi_type', 'cus_follow_step'],
data() { data() {
return { return {
showTree:false,
// //
loading: true, loading: true,
// //
@ -326,6 +346,8 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
deptId:null,
userId:null,
cusLabels: null, cusLabels: null,
cusCode: null, cusCode: null,
fullName: null, fullName: null,
@ -343,6 +365,18 @@ export default {
fullName: '', fullName: '',
cusCode: '' cusCode: ''
}, },
//
deptName: undefined,
//
deptOptions: undefined,
//
enabledDeptOptions: undefined,
defaultProps: {
children: "children",
label: "label"
},
//Id
allDeptIdList:[],
// //
upload: { upload: {
// //
@ -360,15 +394,63 @@ export default {
} }
} }
}, },
watch: {
//
deptName(val) {
this.$refs.tree.filter(val);
}
},
activated() { activated() {
// //
this.getList() this.getList()
}, },
created() { created() {
this.getDeptTree();
//user
if(this.roles.indexOf('user') == -1){
this.showTree=true
}
this.getList() this.getList()
}, },
methods: { methods: {
/** 查询部门下拉树结构 */
getDeptTree() {
deptAndUserTree().then(response => {
this.deptOptions = response.data.deptTree;
this.enabledDeptOptions = this.filterDisabledDept(JSON.parse(JSON.stringify(response.data.deptTree)));
this.allDeptIdList = response.data.deptId
});
},
//
filterDisabledDept(deptList) {
return deptList.filter(dept => {
if (dept.disabled) {
return false;
}
if (dept.children && dept.children.length) {
dept.children = this.filterDisabledDept(dept.children);
}
return true;
});
},
//
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
//
handleNodeClick(data) {
if(this.allDeptIdList.indexOf(data.id)==-1){
//
this.queryParams.userId = data.id;
this.queryParams.deptId = null;
}else{
//
this.queryParams.userId = null;
this.queryParams.deptId = data.id;
}
this.handleQuery();
},
/** /**
* 下载导入模板 * 下载导入模板
*/ */
@ -650,5 +732,8 @@ export default {
z-index: 10; z-index: 10;
background-color: #fff; background-color: #fff;
} }
::v-deep .el-table__empty-block{
width: 100% !important;
}
</style> </style>