gaoxiong 2 rokov pred
rodič
commit
640e04cebc

+ 1 - 1
.env.development

@@ -10,7 +10,7 @@ ENV = 'development'
 #罗俊
 #VUE_APP_BASE_API = 'http://10.87.10.49:8080/'
 #罗伟
-VUE_APP_BASE_API = 'http://10.87.10.47:8080/'
+VUE_APP_BASE_API = 'http://10.87.11.94:8080/'
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true
 

+ 1 - 1
src/api/menu.js

@@ -68,7 +68,7 @@ export const json = {
           "hidden": false,
           "component": "system/dept/index",
           "meta": {
-            "title": "部门管理",
+            "title": "机构管理",
             "icon": "tree",
             "noCache": false,
             "link": null

+ 6 - 6
src/api/system/dept.js

@@ -1,6 +1,6 @@
 import request from '@/utils/request'
 
-// 查询部门列表
+// 查询机构列表
 export function listDept(query) {
   return request({
     url: '/system/dept/list',
@@ -9,7 +9,7 @@ export function listDept(query) {
   })
 }
 
-// 查询部门列表(排除节点)
+// 查询机构列表(排除节点)
 export function listDeptExcludeChild(deptId) {
   return request({
     url: '/system/dept/list/exclude/' + deptId,
@@ -17,7 +17,7 @@ export function listDeptExcludeChild(deptId) {
   })
 }
 
-// 查询部门详细
+// 查询机构详细
 export function getDept(deptId) {
   return request({
     url: '/system/dept/' + deptId,
@@ -25,7 +25,7 @@ export function getDept(deptId) {
   })
 }
 
-// 新增部门
+// 新增机构
 export function addDept(data) {
   return request({
     url: '/system/dept',
@@ -34,7 +34,7 @@ export function addDept(data) {
   })
 }
 
-// 修改部门
+// 修改机构
 export function updateDept(data) {
   return request({
     url: '/system/dept',
@@ -43,7 +43,7 @@ export function updateDept(data) {
   })
 }
 
-// 删除部门
+// 删除机构
 export function delDept(deptId) {
   return request({
     url: '/system/dept/' + deptId,

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

@@ -0,0 +1,8 @@
+import request from '@/utils/request'
+// 查询机构下拉树结构
+export function deptTreeSelect() {
+    return request({
+      url: '/system/dept/deptTree',
+      method: 'get'
+    })
+  }

+ 1 - 1
src/api/system/role.js

@@ -106,7 +106,7 @@ export function authUserSelectAll(data) {
   })
 }
 
-// 根据角色ID查询部门树结构
+// 根据角色ID查询机构树结构
 export function deptTreeSelect(id) {
   return request({
     url: '/system/role/deptTree/' + id,

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

@@ -119,11 +119,3 @@ export function updateAuthRole(data) {
     params: data
   })
 }
-
-// 查询部门下拉树结构
-export function deptTreeSelect() {
-  return request({
-    url: '/system/user/deptTree',
-    method: 'get'
-  })
-}

+ 2 - 2
src/views/business/checkNote/index.vue

@@ -1,12 +1,12 @@
 <template>
   <div class="app-container">
     <el-row :gutter="20">
-      <!--部门数据-->
+      <!--机构数据-->
       <el-col :span="5" :xs="24">
         <div class="search-container">
           <el-input
             v-model="filterText"
-            placeholder="请输入部门名称"
+            placeholder="请输入机构名称"
             clearable
             size="small"
             prefix-icon="el-icon-search"

+ 145 - 36
src/views/system/dept/index.vue

@@ -1,6 +1,40 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
+    <el-row :gutter="20">
+      <!--机构数据-->
+      <el-col :span="4" :xs="24">
+        <div class="head-container">
+          <el-input
+            v-model="deptName"
+            placeholder="请输入机构名称"
+            clearable
+            size="small"
+            prefix-icon="el-icon-search"
+            style="margin-bottom: 20px"
+          />
+        </div>
+        <div class="tree-container">
+          <div style="margin-bottom: 10px;">
+            <el-checkbox v-model="queryParams.checkSub" @change="changeCheckBox">是否关联下级机构</el-checkbox>
+          </div>
+          <el-tree
+            :data="deptOptions"
+            :props="defaultProps"
+            :expand-on-click-node="false"
+            :filter-node-method="filterNode"
+            ref="tree"
+            node-key="id"
+            :default-expanded-keys="defaultKeys"
+            :default-checked-keys="defaultKeys"
+            @node-click="handleNodeClick"
+          />
+        </div>
+      </el-col>
+      <!--用户数据-->
+      <el-col :span="20" :xs="24">
+
+        <!--    搜索条件    -->
+        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
       <el-form-item label="机构名称" prop="name">
         <el-input
           v-model="queryParams.name"
@@ -36,39 +70,24 @@
           v-hasPermi="['system:dept:add']"
         >新增</el-button>
       </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="info"
-          plain
-          icon="el-icon-sort"
-          size="mini"
-          @click="toggleExpandAll"
-        >展开/折叠</el-button>
-      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table
-      v-if="refreshTable"
-      v-loading="loading"
-      :data="deptList"
-      row-key="id"
-      :default-expand-all="isExpandAll"
-      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
-    >
-      <el-table-column prop="name" label="机构名称" width="260"></el-table-column>
-      <el-table-column prop="sort" label="排序" width="200"></el-table-column>
-      <el-table-column prop="isLock" label="状态" width="100">
-        <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
-        </template>
-      </el-table-column>
-      <el-table-column label="创建时间" align="center" prop="createTime" width="200">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createTime) }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <el-table v-loading="loading" :data="deptList" @selection-change="handleSelectionChange">
+          <el-table-column prop="name" label="机构名称" width="260"></el-table-column>
+          <el-table-column prop="sort" label="排序" width="200"></el-table-column>
+          <el-table-column prop="isLock" label="状态" width="100">
+            <template slot-scope="scope">
+              <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.isLock"/>
+            </template>
+          </el-table-column>
+          <el-table-column label="创建时间" align="center" prop="createTime" width="200">
+            <template slot-scope="scope">
+              <span>{{ parseTime(scope.row.createTime) }}</span>
+            </template>
+          </el-table-column>
+ 
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -94,7 +113,17 @@
           >删除</el-button>
         </template>
       </el-table-column>
-    </el-table>
+        </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>
@@ -159,7 +188,9 @@
 </template>
 
 <script>
-import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
+import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild} from "@/api/system/dept";
+import { deptTreeSelect } from "@/api/system/public";
+import { getToken } from "@/utils/auth";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 
@@ -175,6 +206,8 @@ export default {
       showSearch: true,
       // 表格树数据
       deptList: [],
+      // 总条数
+      total: 0,
       // 机构树选项
       deptOptions: [],
       // 弹出层标题
@@ -185,10 +218,21 @@ export default {
       isExpandAll: false,
       // 重新渲染表格状态
       refreshTable: true,
+      // 机构名称
+      deptName: undefined,
+      //是否关联下级
+      checked: false,
+      defaultProps: {
+        children: "children",
+        label: "name"
+      },
       // 查询参数
       queryParams: {
+        pageNum: 1,
+        pageSize: 10,
         name: undefined,
-        status: undefined
+        status: undefined,
+        parentId:undefined,
       },
       // 表单参数
       form: {},
@@ -217,18 +261,67 @@ export default {
             trigger: "blur"
           }
         ]
-      }
+      },
+      //默认选中节点
+      defaultKeys:[]
     };
   },
   created() {
+    this.getDeptTree();
     this.getList();
   },
   methods: {
+     //自定义数据
+     tenantIdnormalizer(node, instanceId) {
+      if (node.children && !node.children.length) {
+        delete node.children
+      }
+      return {
+        id: node.id,
+        label: node.name,
+        children: node.children
+      }
+    },
+    /** 下穿状态改变*/
+    changeCheckBox(){
+      this.getList();
+    },
+      /** 查询机构列表 */
+    getList() {
+      this.loading = true;
+      listDept(this.queryParams).then(response => {
+        this.deptList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    /** 查询机构下拉树结构 */
+    getDeptTree() {
+      deptTreeSelect().then(response => {
+        this.deptOptions = response.data;
+        console.log( this.deptOptions,' this.deptOptions')
+        this.defaultKeys.push(response.data[0].id);
+        this.queryParams.parentId = response.data[0].id;
+        this.handleQuery();
+      });
+    },
+    // 筛选节点
+    filterNode(value, data) {
+      if (!value) return true;
+      return data.name.indexOf(value) !== -1;
+    },
+    // 节点单击事件
+    handleNodeClick(data) {
+      this.queryParams.parentId = data.id;
+      this.handleQuery();
+    },
     /** 查询机构列表 */
     getList() {
       this.loading = true;
       listDept(this.queryParams).then(response => {
-        this.deptList = this.handleTree(response.data, "id");
+        // this.deptList = this.handleTree(response.data, "id");
+        this.deptList = response.rows;
+        this.total = response.total;
         this.loading = false;
       });
     },
@@ -334,7 +427,23 @@ export default {
         this.getList();
         this.$modal.msgSuccess("删除成功");
       }).catch(() => {});
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.userId);
+      this.single = selection.length != 1;
+      this.multiple = !selection.length;
+    },
+  },
+  watch: {
+     // 根据名称筛选机构树
+     deptName(val) {
+      this.$refs.tree.filter(val);
     }
   }
 };
 </script>
+
+<style lang="scss" scoped>
+
+</style>

+ 7 - 7
src/views/system/role/index.vue

@@ -302,11 +302,11 @@ export default {
         },
         {
           value: "3",
-          label: "本部门数据权限"
+          label: "本机构数据权限"
         },
         {
           value: "4",
-          label: "本部门及以下数据权限"
+          label: "本机构及以下数据权限"
         },
         {
           value: "5",
@@ -315,7 +315,7 @@ export default {
       ],
       // 菜单列表
       menuOptions: [],
-      // 部门列表
+      // 机构列表
       deptOptions: [],
       // 查询参数
       queryParams: {
@@ -374,11 +374,11 @@ export default {
       checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
       return checkedKeys;
     },
-    // 所有部门节点数据
+    // 所有机构节点数据
     getDeptAllCheckedKeys() {
-      // 目前被选中的部门节点
+      // 目前被选中的机构节点
       let checkedKeys = this.$refs.dept.getCheckedKeys();
-      // 半选中的部门节点
+      // 半选中的机构节点
       let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys();
       checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
       return checkedKeys;
@@ -390,7 +390,7 @@ export default {
         return response;
       });
     },
-    /** 根据角色ID查询部门树结构 */
+    /** 根据角色ID查询机构树结构 */
     // getDeptTree(userId) {
     //   let roleList;
     //   deptTreeSelect(userId).then(response => {

+ 1 - 1
src/views/system/user/profile/index.vue

@@ -24,7 +24,7 @@
                 <div class="pull-right">{{ user.email }}</div>
               </li> -->
               <li class="list-group-item">
-                <svg-icon icon-class="tree" />所属部门
+                <svg-icon icon-class="tree" />所属机构
                 <div class="pull-right" v-if="user.orgName">{{ user.orgName }} </div>
               </li>
               <li class="list-group-item">