roose před 2 roky
rodič
revize
deee6e1def

+ 5 - 4
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteDeptJlService.java

@@ -2,8 +2,6 @@ package com.ruoyi.system.api;
 
 
 import com.ruoyi.common.core.constant.ServiceNameConstants;
-import com.ruoyi.common.core.domain.R;
-import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.system.api.domain.SysDeptJl;
 import com.ruoyi.system.api.factory.RemoteDeptJlFallbackFactory;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -36,7 +34,10 @@ public interface RemoteDeptJlService {
     @GetMapping(value = "/jlDept/getInfoByCode/{code}")
     public SysDeptJl selectSysDeptJlByCode(@PathVariable("code") String code);
 
-    @GetMapping(value = "/jlDept/getDeptList/{parentId}")
-    public List<SysDeptJl> getDeptList(@PathVariable("parentId") String parentId);
+    @GetMapping(value = "/jlDept/getDeptListByPid/{parentId}")
+    public List<SysDeptJl> getDeptListByPid(@PathVariable("parentId") String parentId);
+
+    @PostMapping(value = "/jlDept/getLists")
+    public List<SysDeptJl> getLists(@RequestBody SysDeptJl sysDeptJl);
 
 }

+ 6 - 1
ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteDeptJlFallbackFactory.java

@@ -41,7 +41,12 @@ public class RemoteDeptJlFallbackFactory implements FallbackFactory<RemoteDeptJl
             }
 
             @Override
-            public List<SysDeptJl> getDeptList(String parentId){
+            public List<SysDeptJl> getDeptListByPid(String parentId){
+                return null;
+            }
+
+            @Override
+            public List<SysDeptJl> getLists(SysDeptJl sysDeptJl){
                 return null;
             }
 

+ 12 - 2
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysDeptJlController.java

@@ -60,6 +60,16 @@ public class SysDeptJlController extends BaseController
         return AjaxResult.success(list);
     }
 
+    @PostMapping("/getLists")
+    public List<SysDeptJl> getLists(@RequestBody SysDeptJl sysDeptJl)
+    {
+//        if(StringUtils.isEmpty(sysDeptJl.getParentId())){
+//            sysDeptJl.setParentId("479a446fce894740b373f9c4b356daac");
+//        }
+        List<SysDeptJl> list = sysDeptJlService.selectSysDeptJlList(sysDeptJl);
+        return list;
+    }
+
 
 //    /**
 //     * 导出吉林地区管理列表
@@ -98,8 +108,8 @@ public class SysDeptJlController extends BaseController
         return sysDeptJl;
     }
 
-    @GetMapping("/getDeptList/{parentId}")
-    public List<SysDeptJl> getDeptList(@PathVariable("parentId") String parentId)
+    @GetMapping("/getDeptListByPid/{parentId}")
+    public List<SysDeptJl> getDeptListByPid(@PathVariable("parentId") String parentId)
     {
         SysDeptJl sysDeptJl = new SysDeptJl();
         if(StringUtils.isEmpty(parentId)){

+ 2 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysDeptJlMapper.xml

@@ -37,7 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="code != null  and code != ''"> and a.code = #{code}</if>
             <if test="name != null  and name != ''"> and a.name like concat('%', #{name}, '%')</if>
             <if test="parentId != null  and parentId != ''"> and a.parent_id = #{parentId}</if>
-            <if test="level != null "> and level = #{level}</if>
+            <if test="level != null and level != ''"> and a.level = #{level}</if>
+            <if test="id != null and id != ''"> and a.id = #{id}</if>
         </where>
         order by a.code asc
     </select>

+ 40 - 13
ruoyi-modules/znyl-resource/src/main/java/com/ruoyi/resource/controller/ZnylXqdwController.java

@@ -7,6 +7,7 @@ import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 
 import com.ruoyi.common.core.utils.SecurityUtils;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.resource.domain.ZnylKhzh;
 import com.ruoyi.resource.domain.ZnylYgry;
 import com.ruoyi.resource.service.IZnylKhzhService;
@@ -86,13 +87,25 @@ public class ZnylXqdwController extends BaseController
     @GetMapping("/getXqdwList")
     public AjaxResult getXqdwList(ZnylXqdw znylXqdw)
     {
+        Long userId = SecurityUtils.getUserId();
+        if (userId != 1) {
+            Long accountId = Long.valueOf(0);
+            ZnylYgry ygry = znylYgryService.selectByAccountno(SecurityUtils.getUsername());
+            if (null != ygry) {
+                accountId = ygry.getAccountid();
+            } else {
+                ZnylKhzh khzh = znylKhzhService.selectByAccountno(SecurityUtils.getUsername());
+                accountId = khzh.getId();
+            }
+            znylXqdw.setAccountid(accountId);
+        }
         if(null != znylXqdw.getRegioncode()){
             SysDeptJl sysDeptJl = remoteDeptJlService.selectSysDeptJlByCode(znylXqdw.getRegioncode());
             String level = String.valueOf(sysDeptJl.getLevel());
             if (level.equals("1")) { //查全部
                 znylXqdw.setRegioncode("");
             } else if (level.equals("2")) { // 所有下级区划
-                List<SysDeptJl> childDept = remoteDeptJlService.getDeptList(sysDeptJl.getId());
+                List<SysDeptJl> childDept = remoteDeptJlService.getDeptListByPid(sysDeptJl.getId());
                 List<String> deptIdsList = new ArrayList<>();
                 for (int i = 0; childDept.size() > i; i++) {
                     deptIdsList.add(childDept.get(i).getCode());
@@ -110,10 +123,10 @@ public class ZnylXqdwController extends BaseController
      * 区划
      * @return
      */
-    @GetMapping("/getDeptListByCode")
-    public AjaxResult getDeptListByCode()
+    @PostMapping("/getDeptListByCode")
+    public AjaxResult getDeptListByCode(@RequestBody SysDeptJl sysDeptJl)
     {
-        List<SysDeptJl> list = new ArrayList<>();
+        SysDeptJl query = new SysDeptJl();
         Long userId = SecurityUtils.getUserId();
         if (userId != 1) {
             String code = "";
@@ -124,16 +137,30 @@ public class ZnylXqdwController extends BaseController
                 ZnylKhzh khzh = znylKhzhService.selectByAccountno(SecurityUtils.getUsername());
                 code = khzh.getRegioncode();
             }
-            SysDeptJl sysDeptJl = remoteDeptJlService.selectSysDeptJlByCode(code);
-//            List<SysDeptJl> list = remoteDeptJlService.getDeptList(sysDeptJl.getId());
-            list = remoteDeptJlService.getDeptList(sysDeptJl.getId());
-//            list.add(sysDeptJl);
-            return AjaxResult.success(list);
-        } else {
-            list = remoteDeptJlService.getDeptList(null);
-            return AjaxResult.success(list);
+//            用户的区划
+            SysDeptJl userDept = remoteDeptJlService.selectSysDeptJlByCode(code);
+            if(null == sysDeptJl.getLevel()){
+                query.setParentId("479a446fce894740b373f9c4b356daac");
+            } else{
+                if (userDept.getLevel() == 1) {
+                    query.setParentId(sysDeptJl.getParentId());
+                }else if (userDept.getLevel() == 2) {
+                    if (sysDeptJl.getLevel() == 1){ //查二级
+                        query.setId(userDept.getId());
+                    }else if(sysDeptJl.getLevel() == 2){
+                        query.setParentId(userDept.getId());
+                    }
+                }else if (userDept.getLevel() == 3) {
+                    if (sysDeptJl.getLevel() == 1){ //查二级
+                        query.setId(userDept.getParentId());
+                    }else if(sysDeptJl.getLevel() == 2){
+                        query.setId(userDept.getId());
+                    }
+                }
+            }
         }
-
+        List<SysDeptJl> list = remoteDeptJlService.getLists(query);
+        return AjaxResult.success(list);
     }
 
     /**

+ 3 - 2
ruoyi-ui/src/api/resource/xqdw.js

@@ -17,10 +17,11 @@ export function getXqdws(query) {
 }
 
 // 区划
-export function getDeptList() {
+export function getDeptList(data) {
   return request({
     url: '/resource/xqdw/getDeptListByCode',
-    method: 'get'
+    method: 'post',
+    data: data
   })
 }
 // 查询智能养老_小区单位信息详细

+ 3 - 2
ruoyi-ui/src/components/RegionCascaderSelect/index.vue

@@ -89,8 +89,9 @@ export default {
         checkStrictly: true,
         lazyLoad: async (node, resolve) => {
           const { level } = node;
-          let params = level === 0 ? '' : {parentId: node.data.nodeData.id};
-          let response= await CountryDeptList(params);
+          // let params = level === 0 ? '' : {parentId: node.data.nodeData.id,level:node.data.nodeData.level};
+          let params = level === 0 ? {parentId: null,level:null} : {parentId: node.data.nodeData.id,level:node.data.nodeData.level};
+          let response= await getDeptList(params);
           let code = response.code;
           let data = response.data || response.rows;
           if (code !== 200) {

+ 3 - 0
ruoyi-ui/src/views/resource/bjqz/index.vue

@@ -375,3 +375,6 @@ export default {
   }
 };
 </script>
+<style lang="scss" scoped>
+@import "@/assets/styles/dark/darkAll";
+</style>

+ 19 - 3
ruoyi-ui/src/views/resource/jhdx/index.vue

@@ -271,7 +271,7 @@
           <RegionCascaderSelect v-model="jhrxxform.regioncode"></RegionCascaderSelect>
         </el-form-item>
         <el-form-item label="小区单位" prop="communityid">
-          <el-select v-model="jhrxxform.communityid" placeholder="请选择小区单位">
+          <el-select v-model="jhrxxform.communityid" placeholder="请选择小区单位" @click.native="getJhrXqdwList()">
             <el-option
               v-for="community in communityOptions"
               :key="community.id+''"
@@ -584,14 +584,30 @@ export default {
           let data=JSON.parse(this.form.regioncode);
           xzqh=data[data.length - 1];
         }
-        console.log("getXqdwList",xzqh);
         getXqdws({regioncode:xzqh}).then(response => {
           this.communityOptions = response.data;
         });
       } else {
         alert("请选择所属区划!")
       }
-
+    },
+    getJhrXqdwList() {
+      if(null != this.jhrxxform.regioncode){
+        console.log(this.jhrxxform.regioncode);
+        // 获取最后级的行政区划code
+        let xzqh='';
+        if(Array.isArray(this.jhrxxform.regioncode)){
+          xzqh=this.jhrxxform.regioncode[this.jhrxxform.regioncode.length - 1]
+        }else{
+          let data=JSON.parse(this.jhrxxform.regioncode);
+          xzqh=data[data.length - 1];
+        }
+        getXqdws({regioncode:xzqh}).then(response => {
+          this.communityOptions = response.data;
+        });
+      } else {
+        alert("请选择所属区划!")
+      }
     },
     getKindList() {
       getYjqds().then(response => {

+ 25 - 6
ruoyi-ui/src/views/resource/ygry/index.vue

@@ -151,7 +151,7 @@
           <RegionCascaderSelect v-model="form.regioncode"></RegionCascaderSelect>
         </el-form-item>
         <el-form-item label="小区单位" prop="communityid">
-          <el-select v-model="form.communityid" placeholder="请选择小区单位">
+          <el-select v-model="form.communityid" placeholder="请选择小区单位" @click.native="getXqdwList()">
             <el-option
               v-for="community in communityOptions"
               :key="community.id+''"
@@ -192,7 +192,8 @@
 
 <script>
 import { listYgry, getYgry, delYgry, addYgry, updateYgry } from "@/api/resource/ygry";
-import { listXqdw } from "@/api/resource/xqdw";
+// import { listXqdw } from "@/api/resource/xqdw";
+import { getXqdws } from "@/api/resource/xqdw";
 import RegionCascaderSelect from '@/components/RegionCascaderSelect';
 export default {
   name: "Ygry",
@@ -276,7 +277,7 @@ export default {
   },
   created() {
     this.getList();
-    this.getXqdwList();
+    // this.getXqdwList();
     this.getDicts("znyl_status").then(response => {
       this.statusOptions = response.data;
     });
@@ -297,10 +298,28 @@ export default {
         this.loading = false;
       });
     },
+    // getXqdwList() {
+    //   listXqdw().then(response => {
+    //     this.communityOptions = response.rows
+    //   });
+    // },
     getXqdwList() {
-      listXqdw().then(response => {
-        this.communityOptions = response.rows
-      });
+      if(null != this.form.regioncode){
+        console.log(this.form.regioncode);
+        // 获取最后级的行政区划code
+        let xzqh='';
+        if(Array.isArray(this.form.regioncode)){
+          xzqh=this.form.regioncode[this.form.regioncode.length - 1]
+        }else{
+          let data=JSON.parse(this.form.regioncode);
+          xzqh=data[data.length - 1];
+        }
+        getXqdws({regioncode:xzqh}).then(response => {
+          this.communityOptions = response.data;
+        });
+      } else {
+        alert("请选择所属区划!")
+      }
     },
     // 字典状态字典翻译
     statusFormat(row, column) {

+ 3 - 0
ruoyi-ui/src/views/resource/yjjkxx/index.vue

@@ -329,3 +329,6 @@ export default {
   }
 };
 </script>
+<style lang="scss" scoped>
+@import "@/assets/styles/dark/darkAll";
+</style>