修改产品推荐

master
username 7 months ago
parent b73b00bfaa
commit 7f0800beb3

@ -75,6 +75,23 @@ public class DfProductInfoController extends BaseController {
@GetMapping("/pageList")
public TableDataInfo pageList(DfProductInfo dfProductInfo) {
SysUser sysUser = sysUserMapper.selectById(getUserId());
List<DfProductInfo> list = selectInfo(dfProductInfo,sysUser,false);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("分页查询产品信息列表")
@GetMapping("/pageListVo")
@Anonymous
public TableDataInfo pageListVo(DfProductInfo dfProductInfo) {
SysUser sysUser = sysUserMapper.selectById(dfProductInfo.getUserId());
List<DfProductInfo> list = selectInfo(dfProductInfo,sysUser,true);
return getDataTable(list);
}
private List<DfProductInfo> selectInfo(DfProductInfo dfProductInfo,SysUser sysUser,boolean isAnonymous) {
String reviewStatus = sysUser.getReviewStatus();
if ("1".equals(reviewStatus)) {
return null;
@ -100,21 +117,43 @@ public class DfProductInfoController extends BaseController {
if (productIdsByBrokerIdByUserId == null || productIdsByBrokerIdByUserId.isEmpty()) {
productIdsByBrokerIdByUserId.add(0L);
}
queryWrapper.inSql(DfProductInfo::getId,"select product_id from df_broker_product where user_id in (" + userId + ") and del_flag = '0' and staus = '1'");
if ("1".equals(dfProductInfo.getIsRecommend())) {
queryWrapper.and(wrapper ->
wrapper.in(DfProductInfo::getId, productIdsByBrokerIdByUserId)
.or()
.inSql(DfProductInfo::getId, "select product_id from df_broker_product where user_id in (" + dfProductInfo.getUserId() + ") and del_flag = '0' and staus = '1'")
);
queryWrapper.inSql(DfProductInfo::getId,"select product_id from df_product_recommend where user_id in (" + userId + ") and del_flag = '0'");
} else {
queryWrapper.inSql(DfProductInfo::getId,"select product_id from df_broker_product where user_id in (" + userId + ") and del_flag = '0' and staus = '1'");
}
}
} else {
queryWrapper.inSql(DfProductInfo::getId,"select product_id from df_broker_product where broker_id in (" + brokerIds + ") and del_flag = '0' and staus = '1'");
}
}
if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
List<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId();
if (productIdsByBrokerId.size() == 0) {
productIdsByBrokerId.add(0L);
}
if (!"1".equals(dfProductInfo.getSelectByBroker())) {
queryWrapper.in(DfProductInfo::getId, productIdsByBrokerId)
.or()
.in(DfProductInfo::getCreateDept, SecurityUtils.getDeptId());
if (!SecurityUtils.isAdmin(sysUser.getUserId())) {
if (isAnonymous) {
List<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerIdByUserId(sysUser.getUserId());
if (productIdsByBrokerId.size() == 0) {
productIdsByBrokerId.add(0L);
}
if (!"1".equals(dfProductInfo.getSelectByBroker())) {
queryWrapper.in(DfProductInfo::getId, productIdsByBrokerId)
.or()
.in(DfProductInfo::getCreateDept, SecurityUtils.getDeptId());
}
} else {
List<Long> productIdsByBrokerId = dfBrokerService.getProductIdsByBrokerId();
if (productIdsByBrokerId.size() == 0) {
productIdsByBrokerId.add(0L);
}
if (!"1".equals(dfProductInfo.getSelectByBroker())) {
queryWrapper.in(DfProductInfo::getId, productIdsByBrokerId)
.or()
.in(DfProductInfo::getCreateDept, SecurityUtils.getDeptId());
}
}
}
startPage();
@ -185,7 +224,8 @@ public class DfProductInfoController extends BaseController {
}
}
}
return getDataTable(list);
return list;
}
/**
@ -215,8 +255,10 @@ public class DfProductInfoController extends BaseController {
List<Long> productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(dfProductInfo.getUserId()));
queryWrapper.notInSql(DfProductInfo::getId,
"select product_id from df_broker_product where del_flag = '0' and user_id = " + dfProductInfo.getUserId() + "")
.eq(DfProductInfo::getStatus, "1")
.or()
.eq(DfProductInfo::getId,dfProductInfo.getId());
.eq(DfProductInfo::getId,dfProductInfo.getId())
.eq(DfProductInfo::getStatus, "1");
condition(queryWrapper,dfProductInfo);
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
Set<Long> idsToRemove = productIdsByBrokerIdByUserId.stream().collect(Collectors.toSet());
@ -226,6 +268,32 @@ public class DfProductInfoController extends BaseController {
return success(filteredList);
}
/**
* userId
*/
@ApiOperation("根据userId查询产品信息列表")
@GetMapping("/listByRecommend")
public AjaxResult listByRecommend(DfProductInfo dfProductInfo) {
LambdaQueryWrapper<DfProductInfo> queryWrapper = new LambdaQueryWrapper();
List<Long> productIdsByBrokerIdByUserId = dfBrokerService.getProductIdsByBrokerIdByUserId(Long.valueOf(dfProductInfo.getUserId()));
if (productIdsByBrokerIdByUserId.isEmpty()) {
productIdsByBrokerIdByUserId.add(0L);
}
queryWrapper.notInSql(DfProductInfo::getId,
"select product_id from df_product_recommend where del_flag = '0' and user_id = " + dfProductInfo.getUserId() + "");
queryWrapper.and(wrapper ->
wrapper.in(DfProductInfo::getId, productIdsByBrokerIdByUserId)
.or()
.inSql(DfProductInfo::getId, "select product_id from df_broker_product where user_id in (" + dfProductInfo.getUserId() + ") and del_flag = '0' and staus = '1'")
);
queryWrapper.or()
.eq(DfProductInfo::getId,dfProductInfo.getId());
condition(queryWrapper,dfProductInfo);
List<DfProductInfo> list = dfProductInfoService.list(queryWrapper);
return success(list);
}
/**
* id
@ -638,7 +706,6 @@ public class DfProductInfoController extends BaseController {
}
}
}
System.out.println(dfProductInfo);
return toAjax(true);
}

@ -0,0 +1,175 @@
package com.bs.df.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bs.common.annotation.Anonymous;
import com.bs.df.domain.DfBrokerProduct;
import com.bs.df.domain.DfProductInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.bs.common.annotation.Log;
import com.bs.common.core.controller.BaseController;
import com.bs.common.core.domain.AjaxResult;
import com.bs.common.core.page.TableDataInfo;
import com.bs.common.enums.BusinessType;
import com.bs.common.utils.poi.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.core.lang.Validator;
import com.bs.df.domain.DfProductRecommend;
import com.bs.df.service.IDfProductRecommendService;
import javax.annotation.Resource;
/**
* Controller
*
* @author bs
* @date 2024-09-16
*/
@Api(tags = "代理产品推荐")
@RestController
@RequestMapping("/product/recommend")
public class DfProductRecommendController extends BaseController {
@Resource
private IDfProductRecommendService dfProductRecommendService;
/**
*
*/
@ApiOperation("分页查询代理产品推荐列表")
@GetMapping("/pageList")
public TableDataInfo pageList(DfProductRecommend dfProductRecommend) {
startPage();
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductRecommend);
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
return getDataTable(list);
}
/**
*
*/
@ApiOperation("查询代理产品推荐列表")
@GetMapping("/list")
public AjaxResult list(DfProductRecommend dfProductRecommend) {
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductRecommend);
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
return success(list);
}
/**
*
*/
@ApiOperation("导出代理产品推荐列表")
@Log(title = "代理产品推荐导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DfProductRecommend dfProductRecommend) {
LambdaQueryWrapper<DfProductRecommend> queryWrapper = new LambdaQueryWrapper();
condition(queryWrapper,dfProductRecommend);
List<DfProductRecommend> list = dfProductRecommendService.list(queryWrapper);
ExcelUtil<DfProductRecommend> util = new ExcelUtil<DfProductRecommend>(DfProductRecommend. class);
util.exportExcel(response, list, "代理产品推荐数据");
}
/**
*
*/
@ApiOperation("获取代理产品推荐详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(dfProductRecommendService.getById(id));
}
/**
*
*/
@ApiOperation("修改代理产品推荐")
@Log(title = "代理产品推荐修改", businessType = BusinessType.UPDATE)
@PutMapping("/editByProducts")
public AjaxResult editByProducts(@RequestBody DfProductRecommend dfProductRecommend) {
for (Long productId : dfProductRecommend.getIds()) {
DfProductRecommend productRecommend = new DfProductRecommend();
productRecommend.setProductId(String.valueOf(productId));
productRecommend.setUserId(dfProductRecommend.getUserId());
dfProductRecommendService.save(productRecommend);
}
return toAjax(true);
}
/**
*
*/
@ApiOperation("新增代理产品推荐")
@Log(title = "代理产品推荐新增", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DfProductRecommend dfProductRecommend) {
return toAjax(dfProductRecommendService.save(dfProductRecommend));
}
/**
*
*/
@ApiOperation("修改代理产品推荐")
@Log(title = "代理产品推荐修改", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DfProductRecommend dfProductRecommend) {
return toAjax(dfProductRecommendService.updateById(dfProductRecommend));
}
/**
*
*/
@ApiOperation("删除代理产品推荐")
@Log(title = "代理产品推荐删除", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(dfProductRecommendService.removeBatchByIds(ids));
}
/**
*
*/
@ApiOperation("移除代理产品推荐")
@Log(title = "代理产品推荐移除", businessType = BusinessType.DELETE)
@PostMapping("/delInfoByRecommend")
public AjaxResult delInfoByRecommend(@RequestBody DfProductRecommend dfProductRecommend) {
boolean remove = dfProductRecommendService.remove(new LambdaQueryWrapper<DfProductRecommend>().in(DfProductRecommend::getProductId, dfProductRecommend.getIds())
.eq(DfProductRecommend::getUserId, dfProductRecommend.getUserId()));
return toAjax(remove);
}
/**
*
*/
private void condition (LambdaQueryWrapper<DfProductRecommend> queryWrapper,DfProductRecommend dfProductRecommend){
//主键
if(Validator.isNotEmpty(dfProductRecommend.getId())){
queryWrapper.eq(DfProductRecommend::getId,dfProductRecommend.getId());
}
//用户id
if(Validator.isNotEmpty(dfProductRecommend.getUserId())){
queryWrapper.eq(DfProductRecommend::getUserId,dfProductRecommend.getUserId());
}
//产品id
if(Validator.isNotEmpty(dfProductRecommend.getProductId())){
queryWrapper.eq(DfProductRecommend::getProductId,dfProductRecommend.getProductId());
}
}
}

@ -202,4 +202,7 @@ public class DfProductInfo extends BaseEntity{
@TableField(exist = false)
private String orderByColumn;
@TableField(exist = false)
private String isRecommend;
}

@ -0,0 +1,48 @@
package com.bs.df.domain;
import com.bs.common.annotation.Excel;
import com.bs.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
/**
* df_product_recommend
*
* @author bs
* @date 2024-09-16
*/
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("df_product_recommend")
@Data
public class DfProductRecommend extends BaseEntity{
private static final long serialVersionUID = 1L;
/** 主键 */
@TableId(value = "id",type = IdType.AUTO)
@ApiModelProperty(value = "主键")
private Long id;
/** 用户id */
@Excel(name = "用户id")
@ApiModelProperty(value = "用户id")
private String userId;
/** 产品id */
@Excel(name = "产品id")
@ApiModelProperty(value = "产品id")
private String productId;
@TableField(exist = false)
private Long[] ids;
}

@ -0,0 +1,14 @@
package com.bs.df.mapper;
import com.bs.common.mybatis.mapper.BaseMapperX;
import com.bs.df.domain.DfProductRecommend;
/**
* Mapper
*
* @author bs
* @date 2024-09-16
*/
public interface DfProductRecommendMapper extends BaseMapperX<DfProductRecommend> {
}

@ -0,0 +1,14 @@
package com.bs.df.service;
import com.github.yulichang.base.MPJBaseService;
import com.bs.df.domain.DfProductRecommend;
/**
* Service
*
* @author bs
* @date 2024-09-16
*/
public interface IDfProductRecommendService extends MPJBaseService<DfProductRecommend>{
}

@ -0,0 +1,19 @@
package com.bs.df.service.impl;
import com.bs.df.mapper.DfProductRecommendMapper;
import com.bs.df.domain.DfProductRecommend;
import com.bs.df.service.IDfProductRecommendService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
*
* @author bs
* @date 2024-09-16
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class DfProductRecommendServiceImpl extends MPJBaseServiceImpl<DfProductRecommendMapper, DfProductRecommend> implements IDfProductRecommendService {
}

@ -129,6 +129,8 @@ public class SysLoginController
}
AjaxResult ajax = AjaxResult.success();
SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserId, user.getUserId()));
user.setLabel(sysUser.getLabel());
user.setUserDesc(sysUser.getUserDesc());
user.setAddress(sysUser.getAddress());
user.setCompany(sysUser.getCompany());
ajax.put("user", user);

@ -82,6 +82,15 @@ public class SysUserController extends BaseController {
public TableDataInfo list(SysUser user) {
startPage();
List<SysUser> list = userService.selectUserList(user);
List<DfBroker> dfBrokers = dfBrokerService.list();
Map<Long, String> map = dfBrokers.stream().collect(Collectors.toMap(DfBroker::getId, DfBroker::getBrokerName));
for (SysUser sysUser : list) {
sysUser.setUserDesc(HtmlUtils.stripHtmlTags(sysUser.getUserDesc()));
String deptName = map.get(sysUser.getDeptId());
if (Validator.isNotEmpty(deptName)) {
sysUser.setDeptName(deptName);
}
}
return getDataTable(list);
}
@ -91,6 +100,29 @@ public class SysUserController extends BaseController {
return success(list);
}
@PostMapping("/removeDepts")
public AjaxResult removeDepts(@RequestBody SysUser user) {
for (Long userId : user.getUserIds()) {
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
sysUser.setDeptId(0L);
userService.updateById(sysUser);
}
return success(true);
}
@PostMapping("/updateDepts")
public AjaxResult updateDepts(@RequestBody SysUser user) {
for (Long userId : user.getUserIds()) {
SysUser sysUser = new SysUser();
sysUser.setUserId(userId);
sysUser.setDeptId(user.getDeptId());
userService.updateById(sysUser);
}
return success(true);
}
@GetMapping("/listByType")
public TableDataInfo listByType(SysUser user) {
if (!"1".equals(user.getSelectAll())) {
@ -316,6 +348,9 @@ public class SysUserController extends BaseController {
dfUserBrokerService.updateById(dfUserBroker);
}
user.setPassword(null);
if (null == user.getDeptId()) {
user.setDeptId(0L);
}
return toAjax(userService.updateUser(user));
}

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bs.df.mapper.DfProductRecommendMapper">
</mapper>

@ -93,6 +93,11 @@ public class SysUser extends BaseEntity
@ApiModelProperty(value = "真实姓名")
private String realName;
@Excel(name = "标签")
@ApiModelProperty(value = "标签")
private String label;
/** 用户昵称 */
@Excel(name = "用户昵称")
@Xss(message = "用户昵称不能包含脚本字符")
@ -197,6 +202,9 @@ public class SysUser extends BaseEntity
@TableField(exist = false)
private String[] deptIds;
@TableField(exist = false)
private Long[] userIds;
//1为查询所有
@TableField(exist = false)
private String selectAll;

@ -101,13 +101,18 @@ public class SysUserServiceImpl extends MPJBaseServiceImpl<SysUserMapper, SysUse
}
if ("1".equals(user.getHasBroker())) {
queryWrapper.isNotNull(SysUser::getDeptId);
List<Long> deptIds = Arrays.asList(116L,117L,0L);
queryWrapper.notIn(SysUser::getDeptId,deptIds);
} else if ("0".equals(user.getHasBroker())) {
queryWrapper.isNull(SysUser::getDeptId);
List<Long> deptIds = Arrays.asList(116L,117L,0L);
queryWrapper.in(SysUser::getDeptId,deptIds);
}
queryWrapper.orderByAsc(SysUser::getCreateTime);
return userMapper.selectList(queryWrapper);
}
/**
*
*

@ -26,6 +26,14 @@ export function listByUserId(query) {
params: query
})
}
// 根据userId查询推荐产品信息列表
export function listByRecommend(query) {
return request({
url: '/product/info/listByRecommend',
method: 'get',
params: query
})
}
// 根据代理商经纪id查询产品信息列表
export function listByBroker(query) {

@ -0,0 +1,81 @@
import request from '@/utils/request'
// 分页查询代理产品推荐列表
export function pageListRecommend(query) {
return request({
url: '/product/recommend/pageList',
method: 'get',
params: query
})
}
// 查询代理产品推荐列表
export function listRecommend(query) {
return request({
url: '/product/recommend/list',
method: 'get',
params: query
})
}
// 查询代理产品推荐详细
export function getRecommend(id) {
return request({
url: '/product/recommend/' + id,
method: 'get'
})
}
// 新增代理产品推荐
export function addRecommend(data) {
return request({
url: '/product/recommend',
method: 'post',
data: data
})
}
// 修改代理产品推荐
export function updateRecommend(data) {
return request({
url: '/product/recommend',
method: 'put',
data: data
})
}
// 修改代理产品推荐
export function editByProducts(data) {
return request({
url: '/product/recommend/editByProducts',
method: 'put',
data: data
})
}
// 移除代理产品推荐
export function delInfoByRecommend(data) {
return request({
url: '/product/recommend/delInfoByRecommend',
method: 'post',
data: data
})
}
// delInfoByRecommend
// 删除代理产品推荐
export function delRecommend(id) {
return request({
url: '/product/recommend/' + id,
method: 'delete'
})
}
// 导出代理产品推荐
export function exportRecommend(query) {
return request({
url: '/product/recommend/' + 'export',
method: 'post',
params: query
})
}

@ -66,7 +66,7 @@
@click="handleAdd"
:disabled="!deptId"
v-hasPermi="['system:user:add']"
>新增
>选择
</el-button>
</el-col>
<el-col :span="1.5">
@ -211,7 +211,7 @@
<el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
@ -671,7 +671,7 @@ export default {
break;
}
},
/** 新增按钮操作 */
/** 选择按钮操作 */
handleAdd() {
this.$refs.noBrokerUser.show(this.deptId);
// this.getbrokerList();
@ -751,7 +751,7 @@ export default {
});
} else {
addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.$modal.msgSuccess("选择成功");
this.open = false;
this.getList();
});

@ -0,0 +1,942 @@
<template>
<div ref="list">
<el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="产品名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入产品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="产品类型" prop="productType">
<el-select v-model="queryParams.productType" placeholder="选择产品类型" clearable @keyup.enter.native="handleQuery">
<el-option v-for="dict in dict.type.product_type" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="选择状态" clearable @keyup.enter.native="handleQuery">
<el-option v-for="dict in dict.type.product_status" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
<!-- <el-form-item label="上架时间" prop="listBegin">-->
<!-- <el-date-picker clearable-->
<!-- style="width: 170px"-->
<!-- v-model="queryParams.listBegin"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择上架时间起">-->
<!-- </el-date-picker>-->
<!-- - -->
<!-- <el-date-picker clearable-->
<!-- style="width: 170px"-->
<!-- v-model="queryParams.listEnd"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择上架时间止">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item label="上架时间">
<el-date-picker
v-model="dateRange"
style="width: 200px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
:disabled="!brokerId && !userId"
v-hasPermi="['product:info:add']"
>选择
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['product:info:remove']"
>移除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @sort-change="handleSortChange" :height="tableHeight - 150"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="排序" prop="serialNumber" fixed="left" width="100"/>
<el-table-column label="产品名称" prop="productName" sortable='custom' fixed="left" width="100"/>
<el-table-column label="产品简称" prop="simpleName" sortable='custom' width="100"/>
<el-table-column label="产品类型" prop="productType" sortable='custom' width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.product_type" :value="scope.row.productType"/>
</template>
</el-table-column>
<!-- <el-table-column label="产品细类" align="center" prop="productSubtype" sortable='custom' width="100"/> -->
<el-table-column label="最高额度(万)" prop="maxAmount" sortable='custom' width="120"/>
<el-table-column label="年利率(单利)" prop="interestRate" width="120"/>
<!-- <el-table-column label="产品简介" align="center" prop="productIntro" sortable='custom' show-overflow-tooltip
width="100"/> -->
<!-- <el-table-column label="产品详情" align="center" prop="productDetail" sortable='custom' show-overflow-tooltip
width="100"/> -->
<el-table-column label="还款周期" prop="repaymentCycle" sortable='custom' width="100"/>
<el-table-column label="还款方式" prop="repaymentMethod" sortable='custom' width="100"/>
<el-table-column label="展业城市" prop="businessCity" sortable='custom' width="100"
show-overflow-tooltip/>
<el-table-column label="综合费率" prop="combinedRates" sortable='custom' width="100"/>
<el-table-column label="上架时间起" prop="listBegin" width="150" sortable='custom'>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.listBegin, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="上架时间止" prop="listEnd" width="150" sortable='custom'>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.listEnd, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" sortable='custom'>
<template slot-scope="scope">
<dict-tag :options="dict.type.product_status" :value="scope.row.status"/>
</template>
</el-table-column>
<!-- <el-table-column label="备注" align="center" prop="remark" sortable='custom' show-overflow-tooltip/> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleRead(scope.row)"
>查看
</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['product:info:edit']"-->
<!-- >修改-->
<!-- </el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['product:info:remove']"
>移除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" :visible.sync="open" width="70%" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="115px">
<el-row>
<el-col :span="8">
<el-form-item label="所属代理商" prop="brokerId">
<treeselect v-model="form.brokerId" :options="brokerList" props="lable" :show-count="true"
:disabled="readonly"
:defaultExpandLevel="Infinity" disabled
placeholder="请选择归属部门" :normalizer="tenantIdnormalizer"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品名称" prop="id">
<el-select style="width: 100%;" filterable v-model="form.id" placeholder="请选择产品名称" @change="handleChange"
:disabled="readonly"
clearable>
<el-option v-for="info in infoListAll" :key="info.id" :label="info.productName"
:value="info.id"/>
</el-select>
<!-- <el-input v-model="form.productName" placeholder="请输入产品名称"/>-->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品简称" prop="simpleName">
<el-input v-model="form.simpleName" placeholder="请输入产品简称" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="产品类型" prop="productType">
<el-select style="width: 100%;" v-model="form.productType" placeholder="选择产品类型" clearable disabled>
<el-option v-for="dict in dict.type.product_type" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品细类" prop="productSubtype">
<el-input v-model="form.productSubtype" placeholder="请输入产品细类" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="最高额度(万)" prop="maxAmount">
<el-input-number v-model="form.maxAmount" placeholder="请输入最高额度(万)" style="width: 100%;" :min="0"
disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="还款周期" prop="repaymentCycle">
<el-input v-model="form.repaymentCycle" placeholder="请输入还款周期" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="还款方式" prop="repaymentMethod">
<el-input v-model="form.repaymentMethod" placeholder="请输入还款方式" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="综合费率" prop="combinedRates">
<el-input v-model="form.combinedRates" placeholder="请输入综合费率" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="上架时间起" prop="listBegin">
<el-date-picker clearable
disabled
v-model="form.listBegin"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择上架时间起"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="上架时间止" prop="listEnd">
<el-date-picker clearable
disabled
v-model="form.listEnd"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择上架时间止"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="状态" prop="status">
<el-select style="width: 100%;" v-model="form.status" placeholder="选择状态" clearable disabled>
<el-option v-for="dict in dict.type.product_status" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="展业城市" prop="businessCityByName">
<el-input v-model="form.businessCityByName" placeholder="选择展业城市" style="width: 100%;" readonly>
<el-button slot="append" icon="el-icon-arrow-down" @click="openModal"></el-button>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="年利率(单利%)" prop="interestRateBegin">
<el-input-number v-model="form.interestRateBegin" style="width: 150px;" :min="0" :precision="2" disabled/>
-
<el-input-number v-model="form.interestRateEnd" style="width: 150px;" :min="0" :precision="2" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="产品简介" prop="productIntro">
<editor v-model="form.productIntro" :min-height="92" disabled/>
<!-- <el-input v-model="form.productIntro" type="textarea" placeholder="请输入内容"/>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="产品详情" prop="productDetail">
<editor v-model="form.productDetail" :min-height="152" disabled/>
<!-- <el-input v-model="form.productDetail" type="textarea" placeholder="请输入内容"/>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" disabled/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" v-if="!readonly"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改代理商经纪对话框 -->
<el-dialog :title="title" :visible.sync="openByAdd" width="70%" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="115px">
<el-row>
<el-col :span="8" v-show="userId">
<el-form-item label="所属经纪人" prop="userId" >
<el-select style="width: 100%;" v-model="form.userId" clearable disabled>
<el-option v-for="info in userInfoList" :key="info.userId" :label="info.userName"
:value="info.userId"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品名称" prop="ids">
<el-select style="width: 100%;" filterable multiple v-model="form.ids" placeholder="请选择产品名称"
:disabled="readonly"
clearable>
<el-option v-for="info in infoListAll" :key="info.id" :label="info.productName"
:value="info.id"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormByAdd" v-if="!readonly"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改代理商经纪对话框 -->
<el-dialog :visible.sync="showModal" title="选择城市" @close="closeModal">
<el-row>
<el-col :span="12">
<h3 class="section-title">城市列表</h3>
<el-input v-model="searchText" placeholder="请输入城市名称" clearable></el-input>
<div class="city-tree-container">
<el-tree
:data="filteredCities"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
:default-expand-all="false"
highlight-current
>
<template v-slot="{ node, data }">
<div class="city-item">
<span>{{ node.label }}</span>
<!-- <el-button @click="selectCity(data)" type="text" size="mini" class="add-button">添加</el-button>-->
</div>
</template>
</el-tree>
</div>
</el-col>
<el-col :span="12">
<h3 class="section-title">已选择城市</h3>
<ul class="selected-city-list">
<li v-for="(city, index) in selectedCities" :key="index">
<div class="selected-city-item">
{{ city.name }}
<!-- <el-button @click="removeCity(index)" type="text" size="mini">移除</el-button>-->
</div>
</li>
</ul>
</el-col>
</el-row>
<div slot="footer">
<el-button @click="confirmSelection"></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import AutoTableHeight from '@/views/broker/AutoTableHeight';
import {
pageListInfo,
getInfo,
editByBroker,
delInfoByBroker,
listByBroker,
getInfoByBroker,
listByUserId,
listByRecommend
} from "@/api/product/info";
import {
editByProducts,
delInfoByRecommend
} from "@/api/product/recommend";
import {listArea} from "@/api/system/area";
import {listBrokerByTree} from "@/api/broker/broker";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getUser} from "@/api/system/user";
import {
listUserAll
} from "@/api/system/user";
export default {
name: "BrokerUser",
mixins: [AutoTableHeight],
dicts: ['product_type', "product_status"],
components: {Treeselect},
props: {
rowData: {
type: Object,
default: () => ({})
}
},
data() {
return {
openByAddAndUser: false,
readonly:false,
// isReadOnly: false,
brokerList: [],
userInfoList: [],
infoListAll: [],
brokerId: null,
userId: null,
//
dateRange: [],
rowDataNew: {},
defaultProps: {
children: "children",
label: "name"
},
searchText: '',
showModal: false,
selectedCities: [],
cityList: [],
//
loading: true,
//
ids: [],
//
names: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
infoList: [],
//
title: "",
//
open: false,
openByAdd: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
productName: null,
simpleName: null,
productType: null,
productSubtype: null,
maxAmount: null,
interestRate: null,
productIntro: null,
productDetail: null,
listBegin: null,
listEnd: null,
status: null,
maxAmountBegin: undefined,
maxAmountEnd: undefined,
},
//
form: {},
//
rules: {
id: [
{required: true, message: "产品名称不能为空", trigger: "blur"}
],
ids: [
{required: true, message: "产品名称不能为空", trigger: "blur"}
],
simpleName: [
{required: true, message: "产品简称不能为空", trigger: "blur"}
],
productType: [
{required: true, message: "产品类型不能为空", trigger: "change"}
],
// productSubtype: [
// {required: true, message: "", trigger: "change"}
// ],
maxAmount: [
{required: true, message: "最高额度(万)不能为空", trigger: "blur"}
],
interestRateBegin: [
{required: true, message: "年利率(单利)不能为空", trigger: "blur"}
],
// productIntro: [
// {required: true, message: "", trigger: "blur"}
// ],
// productDetail: [
// {required: true, message: "", trigger: "blur"}
// ],
// listBegin: [
// {required: true, message: "", trigger: "blur"}
// ],
// listEnd: [
// {required: true, message: "", trigger: "blur"}
// ],
status: [
{required: true, message: "状态不能为空", trigger: "change"}
],
// remark: [
// {required: true, message: "", trigger: "blur"}
// ],
}
};
},
mounted() {
// rowData row
this.rowDataNew = this.rowData;
},
watch: {
// rowData
rowData: function (newVal, oldVal) {
// rowData row
this.rowDataNew = newVal;
this.brokerId = this.rowDataNew.id;
this.userId = this.rowDataNew.userId;
this.queryParams.brokerIds = this.brokerId;
this.queryParams.userId = this.rowDataNew.userId;
this.getList();
},
},
computed: {
filteredCities() {
//
return this.cityList.filter(city => city.name.includes(this.searchText));
}
},
created() {
this.getList();
this.getAreaList();
},
methods: {
tenantIdnormalizer(node, instanceId) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.id,
label: node.brokerName,
children: node.children
}
},
getbrokerList() {
listBrokerByTree().then(response => {
this.brokerList = response.data;
});
},
handleChange() {
getInfo(this.form.id).then(response => {
var brokerId = this.form.brokerId;
this.form = response.data;
this.form.brokerId = brokerId;
this.getAllInfo();
this.getList();
});
},
getUserInfoList() {
var params = {
userType:"jj"
}
listUserAll(params).then(response => {
this.userInfoList = response.data;
});
},
getAllInfo(id) {
var params = {
selectByBroker: "1",
brokerId: this.rowData.id,
id: id
}
listByBroker(params).then(response => {
this.infoListAll = response.data;
});
},
getAllInfoByUser(id) {
// selectByBroker: "1",
var params = {
selectByBroker: "1",
userId: this.rowData.userId,
id: id
}
listByRecommend(params).then(response => {
this.infoListAll = response.data;
});
},
getAllIds(data) {
let ids = [];
ids.push(data.id);
if (data.children && Array.isArray(data.children)) {
// children
data.children.forEach(child => {
// getAllIds id ids
ids = ids.concat(this.getAllIds(child));
});
}
return ids.join(',');
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
openModal() {
this.showModal = true;
let selectedCities = [];
let businessCities = this.form.businessCity.split(',');
businessCities.forEach(cityId => {
let matchedCity = this.cityList.find(city => city.areaId == cityId);
if (matchedCity) {
selectedCities.push({
areaId: matchedCity.areaId,
name: matchedCity.name
});
}
});
this.selectedCities = selectedCities;
},
closeModal() {
//
this.showModal = false;
this.searchText = '';
this.selectedCities = [];
},
selectCity(city) {
//
if (this.isCitySelected(city)) {
this.$message.warning('该城市已经添加过了!');
} else {
this.selectedCities.push(city);
this.$message.success('成功添加城市!');
}
},
isCitySelected(city) {
//
return this.selectedCities.some(selectedCity => selectedCity.areaId == city.areaId);
},
removeCity(index) {
//
this.selectedCities.splice(index, 1);
},
confirmSelection() {
//
this.form.businessCity = this.selectedCities.map(city => city.areaId).join(',');
this.form.businessCityByName = this.selectedCities.map(city => city.name).join(',');
this.showModal = false;
},
getAreaList() {
listArea().then(response => {
this.cityList = this.buildTree(response.data);
});
},
buildTree(data) {
let tree = [];
let map = {};
data.forEach(node => {
map[node.areaId] = node;
node.children = [];
});
//
if (map[0]) {
tree.push(map[0]);
delete map[0];
}
data.forEach(node => {
if (node.parentId != 0) {
const parent = map[node.parentId];
if (parent) {
parent.children.push(node);
}
} else if (node.areaId != 0) {
tree.push(node);
}
});
return tree;
},
/** 查询产品信息列表 */
getList() {
this.loading = true;
this.queryParams.selectByBroker = "1";
this.queryParams.isRecommend = "1";
pageListInfo(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.infoList = response.rows;
this.total = response.total;
this.loading = false;
}).catch(e => {
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.openByAdd = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
productName: null,
simpleName: null,
productType: null,
productSubtype: null,
maxAmount: null,
interestRateBegin: null,
interestRateEnd: null,
productIntro: null,
productDetail: null,
listBegin: null,
listEnd: null,
status: null,
remark: null,
userId: null,
maxAmountBegin: null,
maxAmountEnd: null,
};
this.resetForm("form");
},
//
handleSortChange(col) {
this.$sortBy(col, this.queryParams);
this.getList();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.queryParams.maxAmountBegin = undefined;
this.queryParams.maxAmountEnd = undefined;
this.queryParams.interestRateEnd = undefined;
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.names = selection.map(item => item.productName);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
if (this.brokerId) {
this.getAllInfo();
this.getbrokerList();
this.readonly = false;
this.form.brokerId = this.brokerId;
this.openByAdd = true;
// this.isReadOnly = false;
this.title = "添加产品信息";
} else {
this.getAllInfoByUser();
this.getUserInfoList();
this.readonly = false;
this.form.userId = this.userId;
// this.form.brokerId = this.brokerId;
this.openByAdd = true;
// this.isReadOnly = false;
this.title = "添加产品信息";
}
},
handleRead(row) {
this.reset();
this.getbrokerList();
const id = row.id || this.ids;
var param = {
id: id,
brokerId: this.brokerId
};
getInfoByBroker(param).then(response => {
this.form = response.data;
if (this.userId) {
this.getAllInfoByUser(id);
} else {
this.getAllInfo(id);
}
this.open = true;
this.readonly = true;
this.title = "查看产品信息";
// this.isReadOnly = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getbrokerList();
const id = row.id || this.ids;
var param = {
id: id,
brokerId: this.brokerId,
userId: this.userId
};
getInfoByBroker(param).then(response => {
this.form = response.data;
if (this.userId) {
this.getAllInfoByUser(id);
} else {
this.getAllInfo(id);
}
this.open = true;
this.readonly = false;
this.title = "修改产品信息";
// this.isReadOnly = true;
});
// getInfo(id).then(response => {
// this.form = response.data;
// this.form.brokerId = this.brokerId;
// this.getAllInfo(id);
// this.open = true;
// this.title = "";
// });
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
editByBroker(this.form).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.openByAdd = false;
this.getList();
} else {
this.$modal.msgError(response.msg);
}
});
}
});
},
submitFormByAdd() {
this.$refs["form"].validate(valid => {
if (valid) {
editByProducts(this.form).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.openByAdd = false;
this.getList();
} else {
this.$modal.msgError(response.msg);
}
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const rowIds = Array.isArray(row.id) ? row.id : [row.id];
const ids = [...rowIds, ...this.ids];
const names = row.id || this.names;
var param = {
ids: ids,
brokerId: this.brokerId,
userId: this.userId
};
this.$modal.confirm('是否确认移除产品信息为"' + names + '"的数据项?').then(function () {
return delInfoByRecommend(param);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('product/info/export', {
...this.queryParams
}, `产品信息数据_${new Date().getTime()}.xlsx`)
}
}
}
;
</script>
<style scoped>
.add-button {
margin-left: 10px; /* 将添加按钮向右移动 */
}
.section-title {
font-size: 16px;
margin-bottom: 10px;
}
.city-tree-container {
flex: 1;
overflow-y: auto;
max-height: 400px; /* 设置最大高度 */
}
.city-item {
display: flex;
align-items: center;
justify-content: space-between;
margin-right: 10px;
}
.city-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
}
.selected-city-list {
list-style: none;
padding: 0;
margin: 0;
max-height: 440px; /* 设置最大高度 */
flex: 1;
overflow-y: auto;
}
.selected-city-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
}
</style>

@ -0,0 +1,869 @@
<template>
<div ref="list">
<p style="margin: 10px 0; border-bottom: 1px solid #eee; padding-bottom: 5px;">经纪人</p>
<el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="产品名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入产品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
:disabled="!brokerId && !userId"
v-hasPermi="['product:info:add']"
>选择
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['product:info:remove']"
>移除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @sort-change="handleSortChange" :height="tableHeight - 150"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="产品归属" prop="brokerName" fixed="left" />
<el-table-column label="产品名称" prop="productName" sortable='custom' fixed="left" />
<!-- <el-table-column label="备注" align="center" prop="remark" sortable='custom' show-overflow-tooltip/> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleRead(scope.row)"
>查看
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['product:info:remove']"
>移除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" :visible.sync="open" width="70%" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="115px">
<el-row>
<el-col :span="8">
<el-form-item label="所属代理商" prop="brokerId">
<treeselect v-model="form.brokerId" :options="brokerList" props="lable" :show-count="true"
:disabled="readonly"
:defaultExpandLevel="Infinity" disabled
placeholder="请选择归属部门" :normalizer="tenantIdnormalizer"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品名称" prop="id">
<el-select style="width: 100%;" filterable v-model="form.id" placeholder="请选择产品名称" @change="handleChange"
:disabled="readonly"
clearable>
<el-option v-for="info in infoListAll" :key="info.id" :label="info.productName"
:value="info.id"/>
</el-select>
<!-- <el-input v-model="form.productName" placeholder="请输入产品名称"/>-->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品简称" prop="simpleName">
<el-input v-model="form.simpleName" placeholder="请输入产品简称" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="产品类型" prop="productType">
<el-select style="width: 100%;" v-model="form.productType" placeholder="选择产品类型" clearable disabled>
<el-option v-for="dict in dict.type.product_type" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品细类" prop="productSubtype">
<el-input v-model="form.productSubtype" placeholder="请输入产品细类" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="最高额度(万)" prop="maxAmount">
<el-input-number v-model="form.maxAmount" placeholder="请输入最高额度(万)" style="width: 100%;" :min="0"
disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="还款周期" prop="repaymentCycle">
<el-input v-model="form.repaymentCycle" placeholder="请输入还款周期" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="还款方式" prop="repaymentMethod">
<el-input v-model="form.repaymentMethod" placeholder="请输入还款方式" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="综合费率" prop="combinedRates">
<el-input v-model="form.combinedRates" placeholder="请输入综合费率" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="上架时间起" prop="listBegin">
<el-date-picker clearable
disabled
v-model="form.listBegin"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择上架时间起"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="上架时间止" prop="listEnd">
<el-date-picker clearable
disabled
v-model="form.listEnd"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择上架时间止"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="状态" prop="status">
<el-select style="width: 100%;" v-model="form.status" placeholder="选择状态" clearable disabled>
<el-option v-for="dict in dict.type.product_status" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="展业城市" prop="businessCityByName">
<el-input v-model="form.businessCityByName" placeholder="选择展业城市" style="width: 100%;" readonly>
<el-button slot="append" icon="el-icon-arrow-down" @click="openModal"></el-button>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="年利率(单利%)" prop="interestRateBegin">
<el-input-number v-model="form.interestRateBegin" style="width: 150px;" :min="0" :precision="2" disabled/>
-
<el-input-number v-model="form.interestRateEnd" style="width: 150px;" :min="0" :precision="2" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="产品简介" prop="productIntro">
<editor v-model="form.productIntro" :min-height="92" disabled/>
<!-- <el-input v-model="form.productIntro" type="textarea" placeholder="请输入内容"/>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="产品详情" prop="productDetail">
<editor v-model="form.productDetail" :min-height="152" disabled/>
<!-- <el-input v-model="form.productDetail" type="textarea" placeholder="请输入内容"/>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" disabled/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" v-if="!readonly"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改代理商经纪对话框 -->
<el-dialog :title="title" :visible.sync="openByAdd" width="70%" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="115px">
<el-row>
<el-col :span="8" v-show="brokerId">
<el-form-item label="所属代理商" prop="brokerId" >
<treeselect v-model="form.brokerId" :options="brokerList" props="lable" :show-count="true"
:disabled="readonly"
:defaultExpandLevel="Infinity" disabled
placeholder="请选择归属部门" :normalizer="tenantIdnormalizer"/>
</el-form-item>
</el-col>
<el-col :span="8" v-show="userId">
<el-form-item label="所属经纪人" prop="userId" >
<el-select style="width: 100%;" v-model="form.userId" clearable disabled>
<el-option v-for="info in userInfoList" :key="info.userId" :label="info.userName"
:value="info.userId"/>
</el-select>
<!-- <el-input v-model="form.userId" placeholder="请输入所属经纪人" disabled/>-->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品名称" prop="ids">
<el-select style="width: 100%;" filterable multiple v-model="form.ids" placeholder="请选择产品名称"
:disabled="readonly"
clearable>
<el-option v-for="info in infoListAll" :key="info.id" :label="info.productName"
:value="info.id"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormByAdd" v-if="!readonly"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改代理商经纪对话框 -->
<el-dialog :visible.sync="showModal" title="选择城市" @close="closeModal">
<el-row>
<el-col :span="12">
<h3 class="section-title">城市列表</h3>
<el-input v-model="searchText" placeholder="请输入城市名称" clearable></el-input>
<div class="city-tree-container">
<el-tree
:data="filteredCities"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
:default-expand-all="false"
highlight-current
>
<template v-slot="{ node, data }">
<div class="city-item">
<span>{{ node.label }}</span>
<!-- <el-button @click="selectCity(data)" type="text" size="mini" class="add-button">添加</el-button>-->
</div>
</template>
</el-tree>
</div>
</el-col>
<el-col :span="12">
<h3 class="section-title">已选择城市</h3>
<ul class="selected-city-list">
<li v-for="(city, index) in selectedCities" :key="index">
<div class="selected-city-item">
{{ city.name }}
<!-- <el-button @click="removeCity(index)" type="text" size="mini">移除</el-button>-->
</div>
</li>
</ul>
</el-col>
</el-row>
<div slot="footer">
<el-button @click="confirmSelection"></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import AutoTableHeight from '@/views/broker/AutoTableHeight';
import {
pageListInfo,
getInfo,
delInfo,
addInfo,
updateInfo,
listInfo,
editByBroker,
editByBrokers,
delInfoByBroker,
listByBroker,
getInfoByBroker,
listByUserId,
} from "@/api/product/info";
import {listArea} from "@/api/system/area";
import {listBrokerByTree} from "@/api/broker/broker";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getUser} from "@/api/system/user";
import {
listUserAll
} from "@/api/system/user";
export default {
name: "BrokerUser",
mixins: [AutoTableHeight],
dicts: ['product_type', "product_status"],
components: {Treeselect},
props: {
rowData: {
type: Object,
default: () => ({})
}
},
data() {
return {
openByAddAndUser: false,
readonly:false,
// isReadOnly: false,
brokerList: [],
userInfoList: [],
infoListAll: [],
brokerId: null,
userId: null,
//
dateRange: [],
rowDataNew: {},
defaultProps: {
children: "children",
label: "name"
},
searchText: '',
showModal: false,
selectedCities: [],
cityList: [],
//
loading: true,
//
ids: [],
//
names: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
infoList: [],
//
title: "",
//
open: false,
openByAdd: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
productName: null,
simpleName: null,
productType: null,
productSubtype: null,
maxAmount: null,
interestRate: null,
productIntro: null,
productDetail: null,
listBegin: null,
listEnd: null,
status: null,
maxAmountBegin: undefined,
maxAmountEnd: undefined,
},
//
form: {},
//
rules: {
id: [
{required: true, message: "产品名称不能为空", trigger: "blur"}
],
ids: [
{required: true, message: "产品名称不能为空", trigger: "blur"}
],
simpleName: [
{required: true, message: "产品简称不能为空", trigger: "blur"}
],
productType: [
{required: true, message: "产品类型不能为空", trigger: "change"}
],
// productSubtype: [
// {required: true, message: "", trigger: "change"}
// ],
maxAmount: [
{required: true, message: "最高额度(万)不能为空", trigger: "blur"}
],
interestRateBegin: [
{required: true, message: "年利率(单利)不能为空", trigger: "blur"}
],
// productIntro: [
// {required: true, message: "", trigger: "blur"}
// ],
// productDetail: [
// {required: true, message: "", trigger: "blur"}
// ],
// listBegin: [
// {required: true, message: "", trigger: "blur"}
// ],
// listEnd: [
// {required: true, message: "", trigger: "blur"}
// ],
status: [
{required: true, message: "状态不能为空", trigger: "change"}
],
// remark: [
// {required: true, message: "", trigger: "blur"}
// ],
}
};
},
mounted() {
// rowData row
this.rowDataNew = this.rowData;
},
watch: {
// rowData
rowData: function (newVal, oldVal) {
this.rowDataNew = newVal;
this.brokerId = this.rowDataNew.id;
this.userId = this.rowDataNew.userId;
this.queryParams.brokerIds = this.brokerId;
this.queryParams.userId = this.rowDataNew.userId;
this.getList();
},
},
computed: {
filteredCities() {
//
return this.cityList.filter(city => city.name.includes(this.searchText));
}
},
created() {
this.getList();
this.getAreaList();
},
methods: {
tenantIdnormalizer(node, instanceId) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.id,
label: node.brokerName,
children: node.children
}
},
getbrokerList() {
listBrokerByTree().then(response => {
this.brokerList = response.data;
});
},
handleChange() {
getInfo(this.form.id).then(response => {
var brokerId = this.form.brokerId;
this.form = response.data;
this.form.brokerId = brokerId;
this.getAllInfo();
this.getList();
});
},
getUserInfoList() {
var params = {
userType:"jj"
}
listUserAll(params).then(response => {
this.userInfoList = response.data;
});
},
getAllInfo(id) {
var params = {
selectByBroker: "1",
brokerId: this.rowData.id,
id: id
}
listByBroker(params).then(response => {
this.infoListAll = response.data;
});
},
getAllInfoByUser(id) {
// selectByBroker: "1",
var params = {
selectByBroker: "1",
userId: this.rowData.userId,
id: id
}
listByUserId(params).then(response => {
this.infoListAll = response.data;
});
},
getAllIds(data) {
let ids = [];
ids.push(data.id);
if (data.children && Array.isArray(data.children)) {
// children
data.children.forEach(child => {
// getAllIds id ids
ids = ids.concat(this.getAllIds(child));
});
}
return ids.join(',');
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
openModal() {
this.showModal = true;
let selectedCities = [];
let businessCities = this.form.businessCity.split(',');
businessCities.forEach(cityId => {
let matchedCity = this.cityList.find(city => city.areaId == cityId);
if (matchedCity) {
selectedCities.push({
areaId: matchedCity.areaId,
name: matchedCity.name
});
}
});
this.selectedCities = selectedCities;
},
closeModal() {
//
this.showModal = false;
this.searchText = '';
this.selectedCities = [];
},
selectCity(city) {
//
if (this.isCitySelected(city)) {
this.$message.warning('该城市已经添加过了!');
} else {
this.selectedCities.push(city);
this.$message.success('成功添加城市!');
}
},
isCitySelected(city) {
//
return this.selectedCities.some(selectedCity => selectedCity.areaId == city.areaId);
},
removeCity(index) {
//
this.selectedCities.splice(index, 1);
},
confirmSelection() {
//
this.form.businessCity = this.selectedCities.map(city => city.areaId).join(',');
this.form.businessCityByName = this.selectedCities.map(city => city.name).join(',');
this.showModal = false;
},
getAreaList() {
listArea().then(response => {
this.cityList = this.buildTree(response.data);
});
},
buildTree(data) {
let tree = [];
let map = {};
data.forEach(node => {
map[node.areaId] = node;
node.children = [];
});
//
if (map[0]) {
tree.push(map[0]);
delete map[0];
}
data.forEach(node => {
if (node.parentId != 0) {
const parent = map[node.parentId];
if (parent) {
parent.children.push(node);
}
} else if (node.areaId != 0) {
tree.push(node);
}
});
return tree;
},
/** 查询产品信息列表 */
getList() {
this.loading = true;
this.queryParams.selectByBroker = "1";
pageListInfo(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.infoList = response.rows;
this.total = response.total;
this.loading = false;
}).catch(e => {
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.openByAdd = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
productName: null,
simpleName: null,
productType: null,
productSubtype: null,
maxAmount: null,
interestRateBegin: null,
interestRateEnd: null,
productIntro: null,
productDetail: null,
listBegin: null,
listEnd: null,
status: null,
remark: null,
userId: null,
maxAmountBegin: null,
maxAmountEnd: null,
};
this.resetForm("form");
},
//
handleSortChange(col) {
this.$sortBy(col, this.queryParams);
this.getList();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.queryParams.maxAmountBegin = undefined;
this.queryParams.maxAmountEnd = undefined;
this.queryParams.interestRateEnd = undefined;
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.names = selection.map(item => item.productName);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
if (this.brokerId) {
this.getAllInfo();
this.getbrokerList();
this.readonly = false;
this.form.brokerId = this.brokerId;
this.openByAdd = true;
// this.isReadOnly = false;
this.title = "添加产品信息";
} else {
this.getAllInfoByUser();
this.getUserInfoList();
this.readonly = false;
this.form.userId = this.userId;
// this.form.brokerId = this.brokerId;
this.openByAdd = true;
// this.isReadOnly = false;
this.title = "添加产品信息";
}
},
handleRead(row) {
this.reset();
this.getbrokerList();
const id = row.id || this.ids;
var param = {
id: id,
brokerId: this.brokerId
};
getInfoByBroker(param).then(response => {
this.form = response.data;
if (this.userId) {
this.getAllInfoByUser(id);
} else {
this.getAllInfo(id);
}
this.open = true;
this.readonly = true;
this.title = "查看产品信息";
// this.isReadOnly = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getbrokerList();
const id = row.id || this.ids;
var param = {
id: id,
brokerId: this.brokerId,
userId: this.userId
};
getInfoByBroker(param).then(response => {
this.form = response.data;
if (this.userId) {
this.getAllInfoByUser(id);
} else {
this.getAllInfo(id);
}
this.open = true;
this.readonly = false;
this.title = "修改产品信息";
// this.isReadOnly = true;
});
// getInfo(id).then(response => {
// this.form = response.data;
// this.form.brokerId = this.brokerId;
// this.getAllInfo(id);
// this.open = true;
// this.title = "";
// });
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
editByBroker(this.form).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.openByAdd = false;
this.getList();
} else {
this.$modal.msgError(response.msg);
}
});
}
});
},
submitFormByAdd() {
this.$refs["form"].validate(valid => {
if (valid) {
editByBrokers(this.form).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.openByAdd = false;
this.getList();
} else {
this.$modal.msgError(response.msg);
}
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const rowIds = Array.isArray(row.id) ? row.id : [row.id];
const ids = [...rowIds, ...this.ids];
const names = row.id || this.names;
var param = {
ids: ids,
brokerId: this.brokerId,
userId: this.userId
};
this.$modal.confirm('是否确认移除产品信息为"' + names + '"的数据项?').then(function () {
return delInfoByBroker(param);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('product/info/export', {
...this.queryParams
}, `产品信息数据_${new Date().getTime()}.xlsx`)
}
}
}
;
</script>
<style scoped>
.add-button {
margin-left: 10px; /* 将添加按钮向右移动 */
}
.section-title {
font-size: 16px;
margin-bottom: 10px;
}
.city-tree-container {
flex: 1;
overflow-y: auto;
max-height: 400px; /* 设置最大高度 */
}
.city-item {
display: flex;
align-items: center;
justify-content: space-between;
margin-right: 10px;
}
.city-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
}
.selected-city-list {
list-style: none;
padding: 0;
margin: 0;
max-height: 440px; /* 设置最大高度 */
flex: 1;
overflow-y: auto;
}
.selected-city-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
}
</style>

@ -0,0 +1,853 @@
<template>
<div ref="list">
<p style="margin: 10px 0; border-bottom: 1px solid #eee; padding-bottom: 5px;">代理商</p>
<el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="产品名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入产品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- :disabled="!brokerId && !userId"-->
<!-- v-hasPermi="['product:info:add']"-->
<!-- >选择-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['product:info:remove']"-->
<!-- >移除-->
<!-- </el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="infoList" @sort-change="handleSortChange" :height="tableHeight - 150"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="产品归属" prop="brokerName" fixed="left" />
<el-table-column label="产品名称" prop="productName" sortable='custom' fixed="left" />
<!-- <el-table-column label="备注" align="center" prop="remark" sortable='custom' show-overflow-tooltip/> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleRead(scope.row)"
>查看
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="title" :visible.sync="open" width="70%" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="115px">
<el-row>
<el-col :span="8">
<el-form-item label="所属代理商" prop="brokerId">
<treeselect v-model="form.brokerId" :options="brokerList" props="lable" :show-count="true"
:disabled="readonly"
:defaultExpandLevel="Infinity" disabled
placeholder="请选择归属部门" :normalizer="tenantIdnormalizer"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品名称" prop="id">
<el-select style="width: 100%;" filterable v-model="form.id" placeholder="请选择产品名称" @change="handleChange"
:disabled="readonly"
clearable>
<el-option v-for="info in infoListAll" :key="info.id" :label="info.productName"
:value="info.id"/>
</el-select>
<!-- <el-input v-model="form.productName" placeholder="请输入产品名称"/>-->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品简称" prop="simpleName">
<el-input v-model="form.simpleName" placeholder="请输入产品简称" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="产品类型" prop="productType">
<el-select style="width: 100%;" v-model="form.productType" placeholder="选择产品类型" clearable disabled>
<el-option v-for="dict in dict.type.product_type" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品细类" prop="productSubtype">
<el-input v-model="form.productSubtype" placeholder="请输入产品细类" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="最高额度(万)" prop="maxAmount">
<el-input-number v-model="form.maxAmount" placeholder="请输入最高额度(万)" style="width: 100%;" :min="0"
disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="还款周期" prop="repaymentCycle">
<el-input v-model="form.repaymentCycle" placeholder="请输入还款周期" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="还款方式" prop="repaymentMethod">
<el-input v-model="form.repaymentMethod" placeholder="请输入还款方式" disabled/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="综合费率" prop="combinedRates">
<el-input v-model="form.combinedRates" placeholder="请输入综合费率" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="上架时间起" prop="listBegin">
<el-date-picker clearable
disabled
v-model="form.listBegin"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择上架时间起"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="上架时间止" prop="listEnd">
<el-date-picker clearable
disabled
v-model="form.listEnd"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择上架时间止"
style="width: 100%;">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="状态" prop="status">
<el-select style="width: 100%;" v-model="form.status" placeholder="选择状态" clearable disabled>
<el-option v-for="dict in dict.type.product_status" :key="dict.value" :label="dict.label"
:value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="展业城市" prop="businessCityByName">
<el-input v-model="form.businessCityByName" placeholder="选择展业城市" style="width: 100%;" readonly>
<el-button slot="append" icon="el-icon-arrow-down" @click="openModal"></el-button>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="年利率(单利%)" prop="interestRateBegin">
<el-input-number v-model="form.interestRateBegin" style="width: 150px;" :min="0" :precision="2" disabled/>
-
<el-input-number v-model="form.interestRateEnd" style="width: 150px;" :min="0" :precision="2" disabled/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="产品简介" prop="productIntro">
<editor v-model="form.productIntro" :min-height="92" disabled/>
<!-- <el-input v-model="form.productIntro" type="textarea" placeholder="请输入内容"/>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="产品详情" prop="productDetail">
<editor v-model="form.productDetail" :min-height="152" disabled/>
<!-- <el-input v-model="form.productDetail" type="textarea" placeholder="请输入内容"/>-->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" disabled/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" v-if="!readonly"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改代理商经纪对话框 -->
<el-dialog :title="title" :visible.sync="openByAdd" width="70%" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="115px">
<el-row>
<el-col :span="8" v-show="brokerId">
<el-form-item label="所属代理商" prop="brokerId" >
<treeselect v-model="form.brokerId" :options="brokerList" props="lable" :show-count="true"
:disabled="readonly"
:defaultExpandLevel="Infinity" disabled
placeholder="请选择归属部门" :normalizer="tenantIdnormalizer"/>
</el-form-item>
</el-col>
<el-col :span="8" v-show="userId">
<el-form-item label="所属经纪人" prop="userId" >
<el-select style="width: 100%;" v-model="form.userId" clearable disabled>
<el-option v-for="info in userInfoList" :key="info.userId" :label="info.userName"
:value="info.userId"/>
</el-select>
<!-- <el-input v-model="form.userId" placeholder="请输入所属经纪人" disabled/>-->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产品名称" prop="ids">
<el-select style="width: 100%;" filterable multiple v-model="form.ids" placeholder="请选择产品名称"
:disabled="readonly"
clearable>
<el-option v-for="info in infoListAll" :key="info.id" :label="info.productName"
:value="info.id"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormByAdd" v-if="!readonly"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改代理商经纪对话框 -->
<el-dialog :visible.sync="showModal" title="选择城市" @close="closeModal">
<el-row>
<el-col :span="12">
<h3 class="section-title">城市列表</h3>
<el-input v-model="searchText" placeholder="请输入城市名称" clearable></el-input>
<div class="city-tree-container">
<el-tree
:data="filteredCities"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
:default-expand-all="false"
highlight-current
>
<template v-slot="{ node, data }">
<div class="city-item">
<span>{{ node.label }}</span>
<!-- <el-button @click="selectCity(data)" type="text" size="mini" class="add-button">添加</el-button>-->
</div>
</template>
</el-tree>
</div>
</el-col>
<el-col :span="12">
<h3 class="section-title">已选择城市</h3>
<ul class="selected-city-list">
<li v-for="(city, index) in selectedCities" :key="index">
<div class="selected-city-item">
{{ city.name }}
<!-- <el-button @click="removeCity(index)" type="text" size="mini">移除</el-button>-->
</div>
</li>
</ul>
</el-col>
</el-row>
<div slot="footer">
<el-button @click="confirmSelection"></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import AutoTableHeight from '@/views/broker/AutoTableHeight';
import {
pageListInfo,
getInfo,
delInfo,
addInfo,
updateInfo,
listInfo,
editByBroker,
editByBrokers,
delInfoByBroker,
listByBroker,
getInfoByBroker,
listByUserId,
} from "@/api/product/info";
import {listArea} from "@/api/system/area";
import {listBrokerByTree} from "@/api/broker/broker";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getUser} from "@/api/system/user";
import {
listUserAll
} from "@/api/system/user";
export default {
name: "BrokerUser",
mixins: [AutoTableHeight],
dicts: ['product_type', "product_status"],
components: {
Treeselect,
},
props: {
rowData: {
type: Object,
default: () => ({})
}
},
data() {
return {
openByAddAndUser: false,
readonly:false,
// isReadOnly: false,
brokerList: [],
userInfoList: [],
infoListAll: [],
brokerId: null,
userId: null,
//
dateRange: [],
rowDataNew: {},
defaultProps: {
children: "children",
label: "name"
},
searchText: '',
showModal: false,
selectedCities: [],
cityList: [],
//
loading: true,
//
ids: [],
//
names: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
infoList: [],
//
title: "",
//
open: false,
openByAdd: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
productName: null,
simpleName: null,
productType: null,
productSubtype: null,
maxAmount: null,
interestRate: null,
productIntro: null,
productDetail: null,
listBegin: null,
listEnd: null,
status: null,
maxAmountBegin: undefined,
maxAmountEnd: undefined,
},
//
form: {},
//
rules: {
id: [
{required: true, message: "产品名称不能为空", trigger: "blur"}
],
ids: [
{required: true, message: "产品名称不能为空", trigger: "blur"}
],
simpleName: [
{required: true, message: "产品简称不能为空", trigger: "blur"}
],
productType: [
{required: true, message: "产品类型不能为空", trigger: "change"}
],
// productSubtype: [
// {required: true, message: "", trigger: "change"}
// ],
maxAmount: [
{required: true, message: "最高额度(万)不能为空", trigger: "blur"}
],
interestRateBegin: [
{required: true, message: "年利率(单利)不能为空", trigger: "blur"}
],
status: [
{required: true, message: "状态不能为空", trigger: "change"}
],
// remark: [
// {required: true, message: "", trigger: "blur"}
// ],
}
};
},
mounted() {
// rowData row
this.rowDataNew = this.rowData;
},
watch: {
// rowData
rowData: function (newVal, oldVal) {
// rowData row
this.rowDataNew = newVal;
this.brokerId = this.rowDataNew.id;
this.userId = this.rowDataNew.userId;
// const allIds = this.getAllIds(this.rowDataNew);
this.queryParams.brokerIds = this.brokerId;
this.queryParams.userId = this.rowDataNew.userId;
this.getList();
},
},
computed: {
filteredCities() {
//
return this.cityList.filter(city => city.name.includes(this.searchText));
}
},
created() {
this.getList();
this.getAreaList();
},
methods: {
tenantIdnormalizer(node, instanceId) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.id,
label: node.brokerName,
children: node.children
}
},
getbrokerList() {
listBrokerByTree().then(response => {
this.brokerList = response.data;
});
},
handleChange() {
getInfo(this.form.id).then(response => {
var brokerId = this.form.brokerId;
this.form = response.data;
this.form.brokerId = brokerId;
this.getAllInfo();
this.getList();
});
},
getUserInfoList() {
var params = {
userType:"jj"
}
listUserAll(params).then(response => {
this.userInfoList = response.data;
});
},
getAllInfo(id) {
// var params = {
// selectByBroker: "1",
// id: id
// }
listInfo().then(response => {
this.infoListAll = response.data;
});
},
getAllInfoByUser(id) {
// selectByBroker: "1",
// var params = {
// selectByBroker: "1",
// id: id
// }
listInfo().then(response => {
this.infoListAll = response.data;
});
},
getAllIds(data) {
let ids = [];
ids.push(data.id);
if (data.children && Array.isArray(data.children)) {
// children
data.children.forEach(child => {
// getAllIds id ids
ids = ids.concat(this.getAllIds(child));
});
}
return ids.join(',');
},
filterNode(value, data) {
if (!value) return true;
return data.name.indexOf(value) !== -1;
},
openModal() {
this.showModal = true;
let selectedCities = [];
let businessCities = this.form.businessCity.split(',');
businessCities.forEach(cityId => {
let matchedCity = this.cityList.find(city => city.areaId == cityId);
if (matchedCity) {
selectedCities.push({
areaId: matchedCity.areaId,
name: matchedCity.name
});
}
});
this.selectedCities = selectedCities;
},
closeModal() {
//
this.showModal = false;
this.searchText = '';
this.selectedCities = [];
},
selectCity(city) {
//
if (this.isCitySelected(city)) {
this.$message.warning('该城市已经添加过了!');
} else {
this.selectedCities.push(city);
this.$message.success('成功添加城市!');
}
},
isCitySelected(city) {
//
return this.selectedCities.some(selectedCity => selectedCity.areaId == city.areaId);
},
removeCity(index) {
//
this.selectedCities.splice(index, 1);
},
confirmSelection() {
//
this.form.businessCity = this.selectedCities.map(city => city.areaId).join(',');
this.form.businessCityByName = this.selectedCities.map(city => city.name).join(',');
this.showModal = false;
},
getAreaList() {
listArea().then(response => {
this.cityList = this.buildTree(response.data);
});
},
buildTree(data) {
let tree = [];
let map = {};
data.forEach(node => {
map[node.areaId] = node;
node.children = [];
});
//
if (map[0]) {
tree.push(map[0]);
delete map[0];
}
data.forEach(node => {
if (node.parentId != 0) {
const parent = map[node.parentId];
if (parent) {
parent.children.push(node);
}
} else if (node.areaId != 0) {
tree.push(node);
}
});
return tree;
},
/** 查询产品信息列表 */
getList() {
this.loading = true;
this.queryParams.selectByBroker = "1";
this.queryParams.isSelectBroker = "1";
pageListInfo(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.infoList = response.rows;
this.total = response.total;
this.loading = false;
}).catch(e => {
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.openByAdd = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
productName: null,
simpleName: null,
productType: null,
productSubtype: null,
maxAmount: null,
interestRateBegin: null,
interestRateEnd: null,
productIntro: null,
productDetail: null,
listBegin: null,
listEnd: null,
status: null,
remark: null,
userId: null,
maxAmountBegin: null,
maxAmountEnd: null,
};
this.resetForm("form");
},
//
handleSortChange(col) {
this.$sortBy(col, this.queryParams);
this.getList();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.queryParams.maxAmountBegin = undefined;
this.queryParams.maxAmountEnd = undefined;
this.queryParams.interestRateEnd = undefined;
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.names = selection.map(item => item.productName);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
if (this.brokerId) {
this.getAllInfo();
this.getbrokerList();
this.readonly = false;
this.form.brokerId = this.brokerId;
this.openByAdd = true;
// this.isReadOnly = false;
this.title = "添加产品信息";
} else {
this.getAllInfoByUser();
this.getUserInfoList();
this.readonly = false;
this.form.userId = this.userId;
// this.form.brokerId = this.brokerId;
this.openByAdd = true;
// this.isReadOnly = false;
this.title = "添加产品信息";
}
},
handleRead(row) {
this.reset();
this.getbrokerList();
const id = row.id || this.ids;
var param = {
id: id,
brokerId: this.brokerId
};
getInfoByBroker(param).then(response => {
this.form = response.data;
if (this.userId) {
this.getAllInfoByUser(id);
} else {
this.getAllInfo(id);
}
this.open = true;
this.readonly = true;
this.title = "查看产品信息";
// this.isReadOnly = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getbrokerList();
const id = row.id || this.ids;
var param = {
id: id,
brokerId: this.brokerId,
userId: this.userId
};
getInfoByBroker(param).then(response => {
this.form = response.data;
if (this.userId) {
this.getAllInfoByUser(id);
} else {
this.getAllInfo(id);
}
this.open = true;
this.readonly = false;
this.title = "修改产品信息";
// this.isReadOnly = true;
});
// getInfo(id).then(response => {
// this.form = response.data;
// this.form.brokerId = this.brokerId;
// this.getAllInfo(id);
// this.open = true;
// this.title = "";
// });
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
editByBroker(this.form).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.openByAdd = false;
this.getList();
} else {
this.$modal.msgError(response.msg);
}
});
}
});
},
submitFormByAdd() {
this.$refs["form"].validate(valid => {
if (valid) {
editByBrokers(this.form).then(response => {
if (response.code === 200) {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.openByAdd = false;
this.getList();
} else {
this.$modal.msgError(response.msg);
}
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const rowIds = Array.isArray(row.id) ? row.id : [row.id];
const ids = [...rowIds, ...this.ids];
const names = row.id || this.names;
var param = {
ids: ids,
brokerId: this.brokerId,
userId: this.userId
};
this.$modal.confirm('是否确认移除产品信息为"' + names + '"的数据项?').then(function () {
return delInfoByBroker(param);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('product/info/export', {
...this.queryParams
}, `产品信息数据_${new Date().getTime()}.xlsx`)
}
}
}
;
</script>
<style scoped>
.add-button {
margin-left: 10px; /* 将添加按钮向右移动 */
}
.section-title {
font-size: 16px;
margin-bottom: 10px;
}
.city-tree-container {
flex: 1;
overflow-y: auto;
max-height: 400px; /* 设置最大高度 */
}
.city-item {
display: flex;
align-items: center;
justify-content: space-between;
margin-right: 10px;
}
.city-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
}
.selected-city-list {
list-style: none;
padding: 0;
margin: 0;
max-height: 440px; /* 设置最大高度 */
flex: 1;
overflow-y: auto;
}
.selected-city-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
}
</style>

@ -0,0 +1,178 @@
<template>
<div ref="list">
<el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch" label-width="60px" >
<el-form-item label="经纪人" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入经纪人"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="userList" @sort-change="handleSortChange" :height="340" ref="table"
@selection-change="handleSelectionChange" row-key="id" :highlight-current-row="true" @row-click="handleRowClick" >
<el-table-column label="经纪人" prop="userName" sortable='custom' min-width="200px"/>
</el-table>
<pagination
size="small"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
layout=" prev, pager,next"
@pagination="getList"
/>
</div>
</template>
<script>
import {
listUser
} from "@/api/system/user";
import AutoTableHeight from '@/views/broker/AutoTableHeight';
import {changeUserStatus} from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "DfBrokerUser",
mixins: [AutoTableHeight],
dicts: ["df_broker_staus","sys_yes_no"],
components: {Treeselect},
data() {
return {
readonly:false,
//
loading: true,
//
ids: [],
//
names: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
userList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
userName: undefined,
phonenumber: undefined,
status: undefined,
deptId: undefined,
userType: "jj",
},
//
form: {},
//
rules: {
brokerName: [
{required: true, message: "代理商名称不能为空", trigger: "blur"}
],
isInstitution: [
{required: true, message: "是否机构不能为空", trigger: "blur"}
],
staus: [
{required: true, message: "状态不能为空", trigger: "blur"}
],
}
};
},
created() {
this.getList();
},
methods: {
clearSelection() {
this.resetQuery();
},
tenantIdnormalizer(node, instanceId) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.id,
label: node.brokerName,
children: node.children
}
},
//
handleRowClick(row) {
this.$emit('row-click', row);
},
/** 查询代理商经纪列表 */
getList() {
this.loading = true;
this.queryParams.isBroker = "Y";
listUser(this.queryParams).then(response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
}).catch(e => {
this.loading = false;
});
// listBrokerByTree().then(response => {
// this.brokerOptions = response.data;
// });
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
parentId: null,
brokerName: null,
brokerAddress: null,
brokerDesc: null,
orderNum: null,
chargePerson: null,
contactPhone: null,
email: null,
isInstitution: null,
staus: null,
remark: null,
};
this.resetForm("form");
},
//
handleSortChange(col) {
this.$sortBy(col, this.queryParams);
this.getList();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id);
this.names = selection.map(item => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
}
};
</script>

@ -0,0 +1,51 @@
<template>
<my-page :left-style="{width: '20vw'}">
<template slot="left">
<DfBrokerUser ref="dfBrokerUser" :extraHeight="100" @row-click="handleRowClick"></DfBrokerUser>
</template>
<BrokerProduct ref="brokerUser" :extraHeight="100" style="height: 97%;margin-left: 8px;"
:rowData="rowData"></BrokerProduct>
</my-page>
</template>
<script>
import BrokerProduct from './components/BrokerProduct.vue';
import BrokerProductTwo from './components/BrokerProductTwo.vue';
import BrokerProductByUserId from './components/BrokerProductByUserId';
// import DfBroker from './components/DfBroker.vue';
import DfBrokerUser from './components/DfBrokerUser.vue';
export default {
name: "Recommend",
components: {
BrokerProduct,
BrokerProductTwo,
BrokerProductByUserId,
DfBrokerUser,
},
data() {
return {
isUser: false,
activeName: '1',
rowData: null
};
},
methods: {
handleCollapseChange(newActiveName) {
this.isUser = newActiveName === '2';
if (this.$refs.dfBrokerUser) {
this.$refs.dfBrokerUser.clearSelection();
}
if (this.$refs.dfBroker) {
this.$refs.dfBroker.clearSelection();
}
},
handleRowClick(row) {
this.rowData = null;
this.rowData = row;
}
}
};
</script>
Loading…
Cancel
Save