叶君翔 3 lat temu
rodzic
commit
2c193c2502

+ 3 - 0
lb-module/src/main/java/com/ydd/module/mapper/AgentMapper.java

@@ -61,4 +61,7 @@ public interface AgentMapper extends BaseMapper<Agent> {
     BaseConfgMinDto getBaseConfigMin(Integer type);
 
     BigDecimal getMinBindFee(String cityId);
+
+    List<Agent> queryFirstLevelList();
+
 }

+ 1 - 3
lb-module/src/main/java/com/ydd/module/service/IAgentService.java

@@ -110,10 +110,8 @@ public interface IAgentService extends IService<Agent> {
 
     /**
      * 获取一级代理商
-     * @param agent 参数
-     * @param user 登录用户
      * @return 代理商列表
      */
-    List<Agent> queryFirstLevelList(Agent agent, SysUser user);
+    List<Agent> queryFirstLevelList();
 
 }

+ 2 - 3
lb-module/src/main/java/com/ydd/module/service/impl/AgentServiceImpl.java

@@ -602,9 +602,8 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
     }
 
     @Override
-    public List<Agent> queryFirstLevelList(Agent agent, SysUser user) {
-//        List<Agent> list = this.list(lqw);
-        return Lists.newArrayList();
+    public List<Agent> queryFirstLevelList() {
+        return baseMapper.queryFirstLevelList();
     }
 
 }

+ 10 - 0
lb-module/src/main/resources/mapper/module/agentMapper.xml

@@ -140,4 +140,14 @@
         </foreach>
         OR id = #{id}
     </select>
+
+    <select id="queryFirstLevelList" resultType="com.ydd.module.domain.Agent">
+        SELECT
+            id, name
+        FROM lb_agent
+        WHERE deleted = 0
+        AND status = 1
+        AND pid IS NULL
+    </select>
+
 </mapper>

+ 3 - 4
lb-web/src/main/java/com/ydd/web/controller/UserBindAgentController.java

@@ -41,16 +41,15 @@ public class UserBindAgentController extends BaseController {
     @Autowired
     private ISysUserBindAgentService userBindAgentService;
 
+    @Autowired
     private IAgentService iAgentService;
 
     /**
      * 一级代理商列表(不分页)
      */
     @GetMapping("/agentList")
-    public Result getAgentList(Agent agent){
-        SysUser user = getSysUser();
-        List<Agent> list = iAgentService.queryList(agent, user);
-        List<Agent> lists = iAgentService.queryFirstLevelList(agent, user);
+    public Result getAgentList() {
+        List<Agent> list = iAgentService.queryFirstLevelList();
         return Result.success(list);
     }
 

+ 36 - 0
web-ui/src/api/module/bindAgent.js

@@ -0,0 +1,36 @@
+import request from '@/utils/request'
+
+// 查询代理商列表
+export function agentList(query) {
+  return request({
+    url: '/module/agent/getAgentList',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询用户列表
+export function listUser(query) {
+  return request({
+    url: '/module/userBindAgent/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询用户绑定代理商明细
+export function getAgentBindInfo(id) {
+  return request({
+    url:  '/module/userBindAgent/info?id=' + id,
+    method: 'get'
+  })
+}
+
+// 用户关联代理商
+export function agentBindUser(data) {
+  return request({
+    url: '/module/userBindAgent/bind',
+    method: 'post',
+    data: data
+  })
+}

+ 1 - 1
web-ui/src/api/system/user.js

@@ -22,7 +22,7 @@ export function dspList(query) {
 // 查询代理商列表
 export function agentList(query) {
   return request({
-    url: '/module/agent/getAgentList',
+    url: '/module/userBindAgent/agentList',
     method: 'get',
     params: query
   })

+ 440 - 0
web-ui/src/views/module/bindAgent/index.vue

@@ -0,0 +1,440 @@
+<template>
+  <div class="app-container">
+    <el-row :gutter="20">
+      <!--部门数据-->
+      <!-- <el-col :span="4" :xs="24">
+        <div class="head-container">
+          <el-input v-model="deptName" placeholder="请输入部门名称" clearable  prefix-icon="el-icon-search" style="margin-bottom: 20px" />
+        </div>
+        <div class="head-container">
+          <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree"
+            default-expand-all @node-click="handleNodeClick" />
+        </div>
+      </el-col> -->
+      <!--用户数据-->
+      <el-col :span="24" :xs="24">
+        <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+          <el-form-item label="用户名称" prop="userName">
+            <el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable  style="width: 240px"
+              @keyup.enter.native="handleQuery" />
+          </el-form-item>
+          <el-form-item label="手机号码" prop="phonenumber">
+            <el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable  style="width: 240px"
+              @keyup.enter.native="handleQuery" />
+          </el-form-item>
+          <!-- <el-form-item label="状态" prop="status">
+            <el-select v-model="queryParams.status" placeholder="用户状态" clearable  style="width: 240px">
+              <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="创建时间">
+            <el-date-picker v-model="dateRange"  style="width: 240px" 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"  @click="handleQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh"  @click="resetQuery">重置</el-button>
+          </el-form-item>
+        </el-form>
+
+        <el-row :gutter="10" class="mb8">
+          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
+        </el-row>
+
+        <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" stripe border highlight-current-row style="width: 100%">
+          <el-table-column label="用户编号" align="center" key="userId" prop="userId" />
+          <el-table-column label="用户名称" align="center" key="userName" prop="userName" :show-overflow-tooltip="true" />
+          <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" :show-overflow-tooltip="true" />
+          <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" />
+          <el-table-column label="所属角色" align="center" key="roleName" prop="roleName" />
+          <el-table-column label="关联代理商" align="center" key="agentName" prop="agentName" width="300" />
+          <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">关联代理商</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
+      </el-col>
+    </el-row>
+
+    <!-- 添加或修改参数配置对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="用户名称:" prop="userName" label-width="120px">
+            <el-input style="width:300px" v-model="form.userName" :readonly="true"/>
+        </el-form-item>
+        <el-form-item label="代理商名称:" prop="agentIdList" label-width="120px">
+             <el-select v-model="form.agentIdList" multiple collapse-tags placeholder="请选择" style="width:300px">
+                <el-option v-for="item in agentOption" :key="item.id" :label="item.name" :value="item.id" ></el-option>
+            </el-select>
+            <div class="showOptions">
+              <div class="showOptions-name" v-for="item in form.agentIdList" :key="item" style="width:220px">
+                <span >{{ getAgentName(item) }}</span>
+              </div>
+            </div>
+        </el-form-item>
+      </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>
+</template>
+
+<script>
+import { listUser, getAgentBindInfo, agentBindUser,agentList } from "@/api/module/bindAgent";
+import { getToken } from "@/utils/auth";
+import { treeselect } from "@/api/system/dept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+
+export default {
+  name: "User",
+  components: { Treeselect },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 用户表格数据
+      userList: null,
+      type: undefined,
+      // 弹出层标题
+      title: "",
+      // 部门树选项
+      deptOptions: undefined,
+      // 是否显示弹出层
+      open: false,
+      // 部门名称
+      deptName: undefined,
+      // 默认密码
+      initPassword: undefined,
+      // 日期范围
+      dateRange: [],
+      // 状态数据字典
+      statusOptions: [],
+      // 性别状态字典
+      sexOptions: [],
+      // 岗位选项
+      postOptions: [],
+      // 角色选项
+      roleOptions: [],
+      // 已选择
+      agentIds: [],
+       // 表单参数
+      form: {
+        userId: '',
+        userName: '',
+        agentList: [],
+        agentIdList: []
+      },
+      defaultProps: {
+        children: "children",
+        label: "label"
+      },
+      // 用户导入参数
+      upload: {
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/system/user/importData"
+      },
+      // 查询参数
+      dspOption: [],
+      agentOption: [],
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        userName: undefined,
+        phonenumber: undefined,
+        status: undefined,
+        deptId: undefined,
+        dspId: undefined,
+        agentId: undefined
+      },
+      // 列信息
+      columns: [
+        { key: 0, label: `用户编号`, visible: true },
+        { key: 1, label: `用户名称`, visible: true },
+        { key: 2, label: `用户昵称`, visible: true },
+        { key: 3, label: `部门`, visible: true },
+        { key: 4, label: `手机号码`, visible: true },
+        { key: 5, label: `状态`, visible: true },
+        { key: 6, label: `创建时间`, visible: true }
+      ],
+      // 表单校验
+      rules: {
+        userName: [
+          { required: true, message: "用户名称不能为空", trigger: "blur" }
+        ],
+        dspId: [
+          { required: true, message: "绑定渠道商不能为空", trigger: "blur" }
+        ],
+        agentId: [
+          { required: true, message: "绑定代理商不能为空", trigger: "blur" }
+        ],
+        nickName: [
+          { required: true, message: "用户昵称不能为空", trigger: "blur" }
+        ],
+        password: [
+          { required: true, message: "用户密码不能为空", trigger: "blur" }
+        ],
+        roleId: [
+          { required: true, message: "角色不能为空", trigger: "blur" }
+        ],
+        email: [
+          {
+            type: "email",
+            message: "'请输入正确的邮箱地址",
+            trigger: ["blur", "change"]
+          }
+        ],
+        phonenumber: [
+          {
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+            message: "请输入正确的手机号码",
+            trigger: "blur"
+          }
+        ]
+      }
+    };
+  },
+  watch: {
+    // 根据名称筛选部门树
+    deptName(val) {
+      this.$refs.tree.filter(val);
+    }
+  },
+  created() {
+    this.type = localStorage.getItem("SYS_USER_TYPE")
+    console.log('type', this.type)
+    if(this.type != undefined && this.type == 3) {
+      this.queryParams.deptId = this.$store.state.user.deptId
+    }
+
+    this.getList();
+    // this.getTreeselect();
+    this.getAgentList();
+    this.getDicts("sys_normal_disable").then(response => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("sys_user_sex").then(response => {
+      this.sexOptions = response.data;
+    });
+    this.getConfigKey("sys.user.initPassword").then(response => {
+      this.initPassword = response.data;
+    });
+  },
+  methods: {
+    getAgentList(query) {
+      agentList().then(response => {
+        this.agentOption = response.data
+      });
+      if (query !== '' && query != undefined) {
+          this.agentOption = this.agentOption.filter(item => {
+              return item.name.indexOf(query) > -1;
+            });
+        }
+    },
+
+    /** 查询用户列表 */
+    getList() {
+      this.loading = true;
+      listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+        this.userList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      }
+      );
+    },
+    /** 查询部门下拉树结构 */
+    getTreeselect() {
+      treeselect().then(response => {
+        this.deptOptions = response.data;
+      });
+    },
+    // 筛选节点
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.label.indexOf(value) !== -1;
+    },
+    // 节点单击事件
+    handleNodeClick(data) {
+      this.queryParams.deptId = data.id;
+      this.getList();
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        userId: undefined,
+        deptId: undefined,
+        userName: undefined,
+        nickName: undefined,
+        password: undefined,
+        phonenumber: undefined,
+        email: undefined,
+        sex: undefined,
+        status: "0",
+        remark: undefined,
+        postIds: [],
+        roleIds: [],
+        roleId: ''
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.page = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.userId);
+      this.single = selection.length != 1;
+      this.multiple = !selection.length;
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const userId = row.userId || this.ids;
+      getAgentBindInfo(userId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "关联代理商";
+      });
+    },
+    /** 提交按钮 */
+    submitForm: function () {
+      this.form.roleIds = []
+      this.form.roleIds.push(this.form.roleId)
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          agentBindUser(this.form).then(response => {
+              this.msgSuccess("关联成功");
+              this.open = false;
+              this.getList();
+            });
+        }
+      });
+    },
+     getAgentName(item) {
+      var t = this.agentOption.filter(function(obj) {
+        return obj.id === item;
+      })
+
+      if(t[0]) {
+        return t[0].name;
+      }else {
+        return '';
+      }
+    },
+    /** 删除按钮操作 */
+    // handleDelete(row) {
+    //   const userIds = row.userId || this.ids;
+    //   this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
+    //     confirmButtonText: "确定",
+    //     cancelButtonText: "取消",
+    //     type: "warning"
+    //   }).then(function () {
+    //     return delUser(userIds);
+    //   }).then(() => {
+    //     this.getList();
+    //     this.msgSuccess("删除成功");
+    //   })
+    // },
+    /** 导出按钮操作 */
+    // handleExport() {
+    //   const queryParams = this.queryParams;
+
+    //   console.log('exportParams', queryParams)
+    //   this.$confirm('是否确认导出所有用户数据项?', "警告", {
+    //     confirmButtonText: "确定",
+    //     cancelButtonText: "取消",
+    //     type: "warning"
+    //   }).then(function () {
+    //     return exportUser(queryParams);
+    //   }).then(response => {
+    //     this.download(response.data);
+    //   })
+    // },
+    // /** 导入按钮操作 */
+    // handleImport() {
+    //   this.upload.title = "用户导入";
+    //   this.upload.open = true;
+    // },
+    /** 下载模板操作 */
+    // importTemplate() {
+    //   importTemplate().then(response => {
+    //     this.download(response.msg);
+    //   });
+    // },
+    // // 文件上传中处理
+    // handleFileUploadProgress(event, file, fileList) {
+    //   this.upload.isUploading = true;
+    // },
+    // // 文件上传成功处理
+    // handleFileSuccess(response, file, fileList) {
+    //   this.upload.open = false;
+    //   this.upload.isUploading = false;
+    //   this.$refs.upload.clearFiles();
+    //   this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+    //   this.getList();
+    // },
+    // // 提交上传文件
+    // submitFileForm() {
+    //   this.$refs.upload.submit();
+    // }
+  }
+};
+</script>
+<style lang="scss" scoped>
+
+.showOptions{
+  background-color: #f2f2f2;
+  height: 70px;
+  width: 100%;
+  margin-top: 10px;
+  display: inline;
+  flex-wrap: wrap;
+  margin-right: 20px;
+  margin-bottom: 10px;
+}
+
+.showOptions-name{
+  width: 150px;;
+  flex: 1;
+  background-color: #ccffff;
+  text-align: center;
+}
+</style>