Просмотр исходного кода

deptList部门负责人获取方式调整:从指定角色改为部门最早设置的主负责人

cfort 11 месяцев назад
Родитель
Сommit
ca4e8914ca
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      src/store/modules/ibps/modules/user.js

+ 3 - 1
src/store/modules/ibps/modules/user.js

@@ -204,7 +204,9 @@ export default {
         getDeptList ({ state, dispatch }, { first, second }) {
         getDeptList ({ state, dispatch }, { first, second }) {
             const params = second ? ` and (pe.path_ like '%${second}%' or pe.id_ = '${first}')` : first ? ` and pe.path_ like '%${first}%'` : ''
             const params = second ? ` and (pe.path_ like '%${second}%' or pe.id_ = '${first}')` : first ? ` and pe.path_ like '%${first}%'` : ''
             // const sql = `select id_ as positionId, name_ as positionName, path_ as path, depth_ as depth, sn_ as sn from ibps_party_entity where party_type_ = 'position'${params} order by depth_ asc, sn_ asc`
             // const sql = `select id_ as positionId, name_ as positionName, path_ as path, depth_ as depth, sn_ as sn from ibps_party_entity where party_type_ = 'position'${params} order by depth_ asc, sn_ asc`
-            const sql = `select pe.id_ as positionId, pe.name_ as positionName, pe.path_ as path, pe.depth_ as depth, pe.party_alias_ as alias, pe.sn_ as sn, ifnull(r.name_, '') as manager, ifnull(r.id_, '') as managerId from ibps_party_entity as pe left join (select em.id_, em.positions_, em.name_ from ibps_party_employee as em left join ibps_party_user_role as ur on em.id_ = ur.user_id_ left join ibps_party_role as pr on pr.id_ = ur.role_id_ where role_alias_ in ('zhsfzr', 'syszr', 'zhglzzc')) as r on find_in_set(pe.id_, r.positions_) > 0 where pe.party_type_ = 'position'${params} group by pe.id_ order by pe.depth_ asc, pe.sn_ asc,pe.id_ asc`
+            // const sql = `select pe.id_ as positionId, pe.name_ as positionName, pe.path_ as path, pe.depth_ as depth, pe.party_alias_ as alias, pe.sn_ as sn, ifnull(r.name_, '') as manager, ifnull(r.id_, '') as managerId from ibps_party_entity as pe left join (select em.id_, em.positions_, em.name_ from ibps_party_employee as em left join ibps_party_user_role as ur on em.id_ = ur.user_id_ left join ibps_party_role as pr on pr.id_ = ur.role_id_ where role_alias_ in ('zhsfzr', 'syszr', 'zhglzzc')) as r on find_in_set(pe.id_, r.positions_) > 0 where pe.party_type_ = 'position'${params} group by pe.id_ order by pe.depth_ asc, pe.sn_ asc,pe.id_ asc`
+            // 部门负责人获取从指定角色改为部门最早设置的主负责人
+            const sql = `select pe.id_ as positionId, pe.name_ as positionName, pe.path_ as path, pe.depth_ as depth, pe.party_alias_ as alias, pe.sn_ as sn, ifnull(r.name_, '') as manager, ifnull(r.sub_pid_, '') as managerId from ibps_party_entity as pe left join (select pr.main_pid_, pr.sub_pid_, pr.create_time_, em.name_ from ibps_party_rel as pr join ibps_party_employee as em on em.id_ = pr.sub_pid_ join (select main_pid_, min(create_time_) as min_create_time from ibps_party_rel where biz_ = 'principal' and main_type_ = 'position' group by main_pid_) as earliest ON pr.main_pid_ = earliest.main_pid_ AND pr.create_time_ = earliest.min_create_time where pr.biz_ = 'principal' and pr.main_type_ = 'position') as r on pe.id_ = r.main_pid_ where pe.party_type_ = 'position'${params} group by pe.id_ order by pe.depth_ asc, pe.sn_ asc, pe.id_ asc`
             common.request('sql', sql).then(res => {
             common.request('sql', sql).then(res => {
                 const { data = [] } = res.variables || {}
                 const { data = [] } = res.variables || {}
                 dispatch('ibps/param/setDeptList', data, {
                 dispatch('ibps/param/setDeptList', data, {