소스 검색

用户选择控件实现可显示上级机构

jiawuxian 2 년 전
부모
커밋
3891ca42ba
3개의 변경된 파일22개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 0
      src/api/system/org.js
  2. 10 4
      src/components/userSelector/index.vue
  3. 4 0
      src/views/safetycheck/taskManager/components/register.vue

+ 8 - 0
src/api/system/org.js

@@ -16,4 +16,12 @@ export function listByTypes (args){
         orgType
       }
     })
+  }
+
+  
+  export function deptTreeWithSameTypeUp (){  
+    return request({
+      url: '/system/dept/deptTree/depttreewithsametypeup',
+      method: 'get'
+    })
   }

+ 10 - 4
src/components/userSelector/index.vue

@@ -17,13 +17,14 @@
             @defaultKey="getDefaultKey"
             @checkChange="checkChange"
             @click="clickTreeNode"
+            :customRequest="customTreeRequest"
             :defuaultCheckSub="search.checkSub"
           ></org-tree>
         </el-col>
         <el-col :span="18" :xs="24">
           <g-search-table
             ref="searchTable"
-            url="/system/user/list"
+            url="/system/user/userselector/list"
             method="get"
             :search-data="search"
             :manual="true"
@@ -136,6 +137,10 @@ export default {
       type: Number,
       default: 0,
     },
+    
+    customTreeRequest:{
+      type:Function
+    }
   },
   methods: {
     getLabel,
@@ -168,7 +173,7 @@ export default {
     onSelect(item) {
       this.selectList = item;
     },
-    refresh(){
+    refresh(){      
         this.$nextTick(()=>{
             this.$refs.searchTable.refresh();
         })
@@ -184,7 +189,8 @@ export default {
     },
     getDefaultKey(key) {
         // debugger
-      this.search.orgId = key;      
+      this.search.orgId = key;   
+      this.refresh();   
     },
     //单选框状态改变
     checkChange(state) {
@@ -197,7 +203,7 @@ export default {
     },
     emptySearch() {
       return {
-        orgId: this.orgId,
+        orgId: null,
         checkSub: false,
         username: null,
         name: null,

+ 4 - 0
src/views/safetycheck/taskManager/components/register.vue

@@ -182,6 +182,7 @@
     <UserSelector
       ref="UserSelector"
       @select="onUserSelect"
+      :customTreeRequest="deptTreeWithSameTypeUp"
       :selectLimit="1"
     ></UserSelector>
   </div>
@@ -195,6 +196,7 @@ import imgUpload from "@/components/ImageUpload/index.vue";
 import UserSelector from "@/components/userSelector/index.vue";
 import { getLabel } from "@/views/commonOption.js";
 import { checkPermi } from "@/utils/permission.js";
+import {deptTreeWithSameTypeUp} from "@/api/system/org.js"
 export default {
   name: "safetyCheckRegister",
   data() {
@@ -233,6 +235,7 @@ export default {
       return (
         this.isRegister &&
         this.taskInfo.status != 3 &&
+        this.taskInfo.checkOrgId == this.orgId &&
         userRoleIds.find((ur) => taskRoleIds.includes(ur))
       );
     },
@@ -276,6 +279,7 @@ export default {
   methods: {
     dayjs,
     getLabel,
+    deptTreeWithSameTypeUp,
     onAddPoint() {
       this.pointIdsWhenAdd = [];
       this.taskInfo.checkList.forEach((a) => {