中扬CRM客户关系管理系统
#
luxiaotao1123
2022-11-08 e7a01b236a9f6bee3616ddf2d1d88ada738490a9
#
2个文件已修改
73 ■■■■ 已修改文件
src/main/java/com/zy/crm/manager/controller/CstmrController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/cstmr/cstmr_more.html 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/manager/controller/CstmrController.java
@@ -30,6 +30,7 @@
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -304,7 +305,7 @@
    @RequestMapping(value = "/cstmr/followers/table/auth")
    @ManagerAuth
    public R get(@RequestParam("cstmrId") Long cstmrId) {
    public R cstmrFollowersTable(@RequestParam("cstmrId") Long cstmrId) {
        List<CstmrFoll> cstmrFolls = cstmrFollService.selectList(new EntityWrapper<CstmrFoll>().eq("cstmr_id", cstmrId));
        List<CstmrFollowerTableVo> result = new ArrayList<>();
        for (CstmrFoll cstmrFoll : cstmrFolls) {
@@ -317,5 +318,26 @@
        return R.ok().add(result);
    }
    @RequestMapping(value = "/cstmr/followers/add/auth")
    @ManagerAuth
    @Transactional
    public R cstmrFollowersAdd(@RequestParam("cstmrId") Long cstmrId,
                               @RequestParam("followerIds[]") Long[] followerIds) {
        if (Cools.isEmpty(cstmrId, followerIds)) {
            return R.parse(BaseRes.PARAM);
        }
        for (Long userId : followerIds) {
            if (cstmrFollService.selectCount(new EntityWrapper<CstmrFoll>().eq("cstmr_id", cstmrId).eq("user_id", userId)) == 0) {
                CstmrFoll cstmrFoll = new CstmrFoll();
                cstmrFoll.setCstmrId(cstmrId);
                cstmrFoll.setUserId(userId);
                if (!cstmrFollService.insert(cstmrFoll)) {
                    throw new CoolException("添加失败,请联系管理员");
                }
            }
        }
        return R.ok("添加成功");
    }
}
src/main/webapp/views/cstmr/cstmr_more.html
@@ -328,26 +328,37 @@
                    // 表单提交事件
                    form.on('submit(followerSubmit)', function (data) {
                        let selectList = xmSelectIdx.getValue();
                        for (let i = 0; i<selectList.length; i++) {
                            let item = selectList[i];
                            // 查询物料详情
                            // $.ajax({
                            //     url: baseUrl+"/mat/covert/"+item.value+"/auth",
                            //     headers: {'token': localStorage.getItem('token')},
                            //     method: 'GET',
                            //     async: false,
                            //     success: function (res) {
                            //         if (res.code === 200){
                            //             xxDataList.push(res.data);
                            //             insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                            //         } else if (res.code === 403){
                            //             top.location.href = baseUrl+"/";
                            //         }else {
                            //             layer.msg(res.msg, {icon: 2})
                            //         }
                            //     }
                            // })
                        if (selectList.length === 0) {
                            layer.msg("请选择至少一条数据", {icon: 3});
                            return false;
                        }
                        console.log(JSON.stringify({
                            cstmrId: cstmrId,
                            followerIds: selectList.map(function (d) {
                                return d.value;
                            })
                        }))
                        $.ajax({
                            url: baseUrl+"/cstmr/followers/add/auth",
                            headers: {'token': localStorage.getItem('token')},
                            data: {
                                cstmrId: cstmrId,
                                followerIds: selectList.map(function (d) {
                                    return d.value;
                                })
                            },
                            method: 'POST',
                            success: function (res) {
                                if (res.code === 200){
                                    layer.msg(res.msg, {icon: 1})
                                    // insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                                } else if (res.code === 403){
                                    top.location.href = baseUrl+"/";
                                }else {
                                    layer.msg(res.msg, {icon: 2})
                                }
                            }
                        })
                        layer.close(dIndex);
                        return false;
                    });