客户关系添加分配功能

This commit is contained in:
sk1551
2021-03-23 17:20:14 +08:00
parent a3c0acfadb
commit b2f173c054
10 changed files with 1317 additions and 1161 deletions

View File

@ -26,6 +26,14 @@ export function getUsersByRoleId() {
}) })
} }
// 根据roleid查询用户列表
export function getUserOnlyByRoleId(roleId) {
return request({
url: '/system/user/onlybyroleid/' + roleId,
method: 'get'
})
}
// 新增用户 // 新增用户
export function addUser(data) { export function addUser(data) {

View File

@ -122,6 +122,15 @@
v-hasPermi="['benyi:customer:export']" v-hasPermi="['benyi:customer:export']"
>导出</el-button >导出</el-button
> >
<el-button
type="success"
icon="el-icon-s-custom"
size="mini"
:disabled="single"
@click="handleUpdate_fp"
v-hasPermi="['benyi:customer:edit']"
>分配</el-button
>
</div> </div>
<el-table <el-table
@ -191,6 +200,7 @@
/> />
<el-table-column label="录入时间" align="center" prop="createTime" /> <el-table-column label="录入时间" align="center" prop="createTime" />
<el-table-column label="过保时间" align="center" prop="gbtime" /> <el-table-column label="过保时间" align="center" prop="gbtime" />
<el-table-column label="已分配给" align="center" prop="fpid" :formatter="userByRoleFormat" />
<el-table-column <el-table-column
label="转换跟进" label="转换跟进"
show-overflow-tooltip show-overflow-tooltip
@ -350,6 +360,30 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 添加或修改本一-客户关系管理对话框 -->
<el-dialog :title="title" :visible.sync="open_fp" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row :gutter="15">
<el-col :span="12">
<el-form-item label="分配给" prop="fpid">
<el-select v-model="form.fpid" placeholder="请选择分配给哪个管理员">
<el-option
v-for="dict in customerUserOptions"
:key="dict.userId"
:label="dict.nickName"
:value="dict.userId"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -362,7 +396,7 @@ import {
updateCustomer, updateCustomer,
exportCustomer, exportCustomer,
} from "@/api/benyi/customer"; } from "@/api/benyi/customer";
import { listUser } from "@/api/system/user"; import { listUser, getUserOnlyByRoleId } from "@/api/system/user";
import { provinceAndCityDataPlus, CodeToText } from "element-china-area-data"; import { provinceAndCityDataPlus, CodeToText } from "element-china-area-data";
export default { export default {
@ -386,10 +420,16 @@ export default {
customerList: [], customerList: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
// roleId
roleId: 108,
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
open_fp: false,
gxOptions: [], gxOptions: [],
lyOptions: [], lyOptions: [],
roleId: 108,
// 角色找人选项
customerUserOptions: [],
// 用户选项 // 用户选项
userOptions: [], userOptions: [],
@ -401,6 +441,8 @@ export default {
pageSize: 50, pageSize: 50,
}, },
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -430,6 +472,7 @@ export default {
xfxm: undefined, xfxm: undefined,
xfjz: undefined, xfjz: undefined,
gbtime: undefined, gbtime: undefined,
fpid: undefined,
}, },
// 表单参数 // 表单参数
form: {}, form: {},
@ -456,6 +499,7 @@ export default {
this.lyOptions = response.data; this.lyOptions = response.data;
}); });
this.getUserList(); this.getUserList();
this.getUsersByRole();
}, },
methods: { methods: {
//排序 //排序
@ -477,6 +521,24 @@ export default {
this.userOptions = response.rows; this.userOptions = response.rows;
}); });
}, },
/** 根据roleid查询用户列表 */
getUsersByRole() {
getUserOnlyByRoleId(this.roleId).then((response) => {
this.customerUserOptions = response.data;
});
},
// 通过roleid查询的教师字典翻译
userByRoleFormat(row, column) {
var actions = [];
var datas = this.customerUserOptions;
Object.keys(datas).map((key) => {
if (datas[key].userId == "" + row.fpid) {
actions.push(datas[key].nickName);
return false;
}
});
return actions.join("");
},
// 教师字典翻译 // 教师字典翻译
userFormat(row, column) { userFormat(row, column) {
var actions = []; var actions = [];
@ -516,6 +578,7 @@ export default {
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false; this.open = false;
this.open_fp = false;
this.reset(); this.reset();
}, },
// 表单重置 // 表单重置
@ -544,6 +607,7 @@ export default {
createTime: undefined, createTime: undefined,
createTime: undefined, createTime: undefined,
gbtime: undefined, gbtime: undefined,
fpid: undefined,
}; };
this.selectedOptions = new Array(); this.selectedOptions = new Array();
this.resetForm("form"); this.resetForm("form");
@ -582,6 +646,16 @@ export default {
this.title = "修改本一-客户关系管理"; this.title = "修改本一-客户关系管理";
}); });
}, },
/** 修改按钮操作 */
handleUpdate_fp(row) {
this.reset();
const id = row.id || this.ids;
getCustomer(id).then((response) => {
this.form = response.data;
this.open_fp = true;
this.title = "分配客户";
});
},
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
@ -591,6 +665,7 @@ export default {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
this.open_fp = false;
this.getList(); this.getList();
} }
}); });

View File

@ -43,6 +43,7 @@ public class ByCustomerController extends BaseController {
@PreAuthorize("@ss.hasPermi('benyi:customer:list')") @PreAuthorize("@ss.hasPermi('benyi:customer:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ByCustomer byCustomer) { public TableDataInfo list(ByCustomer byCustomer) {
byCustomer.setCreateUserid(SecurityUtils.getLoginUser().getUser().getUserId());
startPage(); startPage();
List<ByCustomer> list = byCustomerService.selectByCustomerList(byCustomer); List<ByCustomer> list = byCustomerService.selectByCustomerList(byCustomer);
return getDataTable(list); return getDataTable(list);
@ -112,15 +113,25 @@ public class ByCustomerController extends BaseController {
@Log(title = "本一-客户关系管理", businessType = BusinessType.UPDATE) @Log(title = "本一-客户关系管理", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody ByCustomer byCustomer) { public AjaxResult edit(@RequestBody ByCustomer byCustomer) {
if (byCustomer.getZhgj().equals("") || byCustomer.getZhgj().equals(null)) {
if (byCustomer.getZhgj() != null) {
byCustomer.setZhgj(byCustomer.getZhgj());
}else {
byCustomer.setZhgj(""); byCustomer.setZhgj("");
} }
if (byCustomer.getBz().equals("") || byCustomer.getBz().equals(null)) {
byCustomer.setBz(""); if (byCustomer.getXfxm() != null) {
} byCustomer.setXfxm(byCustomer.getXfxm());
if (byCustomer.getXfxm().equals("") || byCustomer.getXfxm().equals(null)) { }else {
byCustomer.setXfxm(""); byCustomer.setXfxm("");
} }
if (byCustomer.getBz() != null) {
byCustomer.setBz(byCustomer.getBz());
}else {
byCustomer.setBz("");
}
return toAjax(byCustomerService.updateByCustomer(byCustomer)); return toAjax(byCustomerService.updateByCustomer(byCustomer));
} }

View File

@ -107,6 +107,9 @@ public class ByCustomer extends BaseEntity {
//@Excel(name = "创建人", type = Excel.Type.EXPORT, targetAttr = "user_name") //@Excel(name = "创建人", type = Excel.Type.EXPORT, targetAttr = "user_name")
private Long createUserid; private Long createUserid;
// 被分配者
private Long fpid;
/** /**
* 备注 * 备注
*/ */
@ -336,6 +339,7 @@ public class ByCustomer extends BaseEntity {
.append("xfjz", getXfjz()) .append("xfjz", getXfjz())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("gbtime", getGbtime()) .append("gbtime", getGbtime())
.append("fpid", getFpid())
.toString(); .toString();
} }
@ -355,4 +359,12 @@ public class ByCustomer extends BaseEntity {
public void setGbtime(Date gbtime) { public void setGbtime(Date gbtime) {
this.gbtime = gbtime; this.gbtime = gbtime;
} }
public Long getFpid() {
return fpid;
}
public void setFpid(Long fpid) {
this.fpid = fpid;
}
} }

View File

@ -170,6 +170,18 @@ public class SysUserController extends BaseController {
return ajax; return ajax;
} }
/**
* 根据roleId获取用户信息列表
*/
//@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = {"/onlybyroleid/{roleId}"})
public AjaxResult getUserOnlyByRoleId(@PathVariable Long roleId) {
AjaxResult ajax = AjaxResult.success();
List<SysUser> list = userService.selectUserOnlyByRoleId(roleId);
ajax.put(AjaxResult.DATA_TAG, list);
return ajax;
}
/** /**
* 新增用户 * 新增用户
*/ */

View File

@ -56,11 +56,19 @@ public interface SysUserMapper
/** /**
* 根据roleId查询用户列表 * 根据roleId查询用户列表
* *
* @param sysUser 用户信息 * @param user 用户信息
* @return 用户信息集合信息 * @return 用户信息集合信息
*/ */
public List<SysUser> selectUserListByRoleId(SysUser user); public List<SysUser> selectUserListByRoleId(SysUser user);
/**
* 根据roleId查询用户列表
*
* @param roleId 用户信息
* @return 用户信息集合信息
*/
public List<SysUser> selectUserOnlyByRoleId(Long roleId);
/** /**
* 新增用户信息 * 新增用户信息
* *

View File

@ -59,6 +59,14 @@ public interface ISysUserService
*/ */
public List<SysUser> selectUserListByRoleId(SysUser user); public List<SysUser> selectUserListByRoleId(SysUser user);
/**
* 根据roleId查询用户列表
*
* @param roleId 用户信息
* @return 用户信息集合信息
*/
public List<SysUser> selectUserOnlyByRoleId(Long roleId);
/** /**
* 根据用户ID查询用户所属角色组 * 根据用户ID查询用户所属角色组
* *

View File

@ -114,6 +114,19 @@ public class SysUserServiceImpl implements ISysUserService {
return userMapper.selectUserListByRoleId(sysUser); return userMapper.selectUserListByRoleId(sysUser);
} }
/**
* 根据roleId查询用户列表
*
* @param roleId 用户信息
* @return 用户信息集合信息
*/
@Override
public List<SysUser> selectUserOnlyByRoleId(Long roleId) {
return userMapper.selectUserOnlyByRoleId(roleId);
}
/** /**
* 查询用户所属角色组 * 查询用户所属角色组
* *

View File

@ -20,6 +20,7 @@
<result property="shiid" column="shiid"/> <result property="shiid" column="shiid"/>
<result property="khly" column="khly"/> <result property="khly" column="khly"/>
<result property="createUserid" column="create_userid"/> <result property="createUserid" column="create_userid"/>
<result property="fpid" column="fpid"/>
<result property="bz" column="bz"/> <result property="bz" column="bz"/>
<result property="zhgj" column="zhgj"/> <result property="zhgj" column="zhgj"/>
<result property="state" column="state"/> <result property="state" column="state"/>
@ -30,7 +31,7 @@
</resultMap> </resultMap>
<sql id="selectByCustomerVo"> <sql id="selectByCustomerVo">
select id, name, sflx, lxdh, wx, dy, qt, schoolname, rs, sheng, shengid, shi, shiid, khly, create_userid, bz, zhgj, state, xfxm, xfjz, gbtime, create_time from by_customer select id, name, sflx, lxdh, wx, dy, qt, fpid, schoolname, rs, sheng, shengid, shi, shiid, khly, create_userid, bz, zhgj, state, xfxm, xfjz, gbtime, create_time from by_customer
</sql> </sql>
<select id="selectByCustomerList" parameterType="ByCustomer" resultMap="ByCustomerResult"> <select id="selectByCustomerList" parameterType="ByCustomer" resultMap="ByCustomerResult">
@ -49,7 +50,8 @@
<if test="shi != null and shi != ''">and shi = #{shi}</if> <if test="shi != null and shi != ''">and shi = #{shi}</if>
<if test="shiid != null and shiid != ''">and shiid = #{shiid}</if> <if test="shiid != null and shiid != ''">and shiid = #{shiid}</if>
<if test="khly != null and khly != ''">and khly = #{khly}</if> <if test="khly != null and khly != ''">and khly = #{khly}</if>
<if test="createUserid != null ">and create_userid = #{createUserid}</if> <if test="createUserid != null ">and create_userid = #{createUserid} or fpid = #{createUserid}</if>
<if test="fpid != null ">and fpid = #{fpid}</if>
<if test="bz != null and bz != ''">and bz = #{bz}</if> <if test="bz != null and bz != ''">and bz = #{bz}</if>
<if test="zhgj != null and zhgj != ''">and zhgj = #{zhgj}</if> <if test="zhgj != null and zhgj != ''">and zhgj = #{zhgj}</if>
<if test="state != null and state != ''">and state = #{state}</if> <if test="state != null and state != ''">and state = #{state}</if>
@ -83,6 +85,7 @@
<if test="shiid != null and shiid != ''">shiid,</if> <if test="shiid != null and shiid != ''">shiid,</if>
<if test="khly != null and khly != ''">khly,</if> <if test="khly != null and khly != ''">khly,</if>
<if test="createUserid != null ">create_userid,</if> <if test="createUserid != null ">create_userid,</if>
<if test="fpid != null ">fpid,</if>
<if test="bz != null and bz != ''">bz,</if> <if test="bz != null and bz != ''">bz,</if>
<if test="zhgj != null and zhgj != ''">zhgj,</if> <if test="zhgj != null and zhgj != ''">zhgj,</if>
<if test="state != null and state != ''">state,</if> <if test="state != null and state != ''">state,</if>
@ -107,6 +110,7 @@
<if test="shiid != null and shiid != ''">#{shiid},</if> <if test="shiid != null and shiid != ''">#{shiid},</if>
<if test="khly != null and khly != ''">#{khly},</if> <if test="khly != null and khly != ''">#{khly},</if>
<if test="createUserid != null ">#{createUserid},</if> <if test="createUserid != null ">#{createUserid},</if>
<if test="fpid != null ">#{fpid},</if>
<if test="bz != null and bz != ''">#{bz},</if> <if test="bz != null and bz != ''">#{bz},</if>
<if test="zhgj != null and zhgj != ''">#{zhgj},</if> <if test="zhgj != null and zhgj != ''">#{zhgj},</if>
<if test="state != null and state != ''">#{state},</if> <if test="state != null and state != ''">#{state},</if>
@ -134,6 +138,7 @@
<if test="shiid != null and shiid != ''">shiid = #{shiid},</if> <if test="shiid != null and shiid != ''">shiid = #{shiid},</if>
<if test="khly != null and khly != ''">khly = #{khly},</if> <if test="khly != null and khly != ''">khly = #{khly},</if>
<if test="createUserid != null ">create_userid = #{createUserid},</if> <if test="createUserid != null ">create_userid = #{createUserid},</if>
<if test="fpid != null ">fpid = #{fpid},</if>
<if test="bz != null and bz != ''">bz = #{bz},</if> <if test="bz != null and bz != ''">bz = #{bz},</if>
<if test="zhgj != null and zhgj != ''">zhgj = #{zhgj},</if> <if test="zhgj != null and zhgj != ''">zhgj = #{zhgj},</if>
<if test="state != null and state != ''">state = #{state},</if> <if test="state != null and state != ''">state = #{state},</if>

View File

@ -137,6 +137,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectUserOnlyByRoleId" parameterType="Long" resultMap="SysUserResult">
select * FROM sys_user where del_flag = '0' and user_id in (select user_id from sys_user_role where role_id = #{roleId});
</select>
<select id="checkUserNameUnique" parameterType="String" resultType="int"> <select id="checkUserNameUnique" parameterType="String" resultType="int">
select count(1) from sys_user where user_name = #{userName} select count(1) from sys_user where user_name = #{userName}
</select> </select>