作者 RuoYi

优化没有权限的用户编辑部门缺少数据(I5OF3O)

@@ -59,8 +59,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -59,8 +59,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
59 </select> 59 </select>
60 60
61 <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult"> 61 <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
62 - <include refid="selectDeptVo"/>  
63 - where dept_id = #{deptId} 62 + select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
  63 + (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
  64 + from sys_dept d
  65 + where d.dept_id = #{deptId}
64 </select> 66 </select>
65 67
66 <select id="checkDeptExistUser" parameterType="Long" resultType="int"> 68 <select id="checkDeptExistUser" parameterType="Long" resultType="int">
@@ -297,9 +297,13 @@ export default { @@ -297,9 +297,13 @@ export default {
297 this.form = response.data; 297 this.form = response.data;
298 this.open = true; 298 this.open = true;
299 this.title = "修改部门"; 299 this.title = "修改部门";
300 - });  
301 - listDeptExcludeChild(row.deptId).then(response => {  
302 - this.deptOptions = this.handleTree(response.data, "deptId"); 300 + listDeptExcludeChild(row.deptId).then(response => {
  301 + this.deptOptions = this.handleTree(response.data, "deptId");
  302 + if (this.deptOptions.length == 0) {
  303 + const noResultsOptions = { deptId: this.form.parentId, deptName: this.form.parentName, children: [] };
  304 + this.deptOptions.push(noResultsOptions);
  305 + }
  306 + });
303 }); 307 });
304 }, 308 },
305 /** 提交按钮 */ 309 /** 提交按钮 */