Ver Fonte

单位名称组件添加默认选中+ 修改角色授权的角色视角

林倩 há 3 anos atrás
pai
commit
9b7b2d4f73

+ 2 - 1
src/api/role-auth-info.js

@@ -32,10 +32,11 @@ export const getRoleListByAppid = `${base}/roleRoleList/_search`;
 
 // 角色视图 -- 人员列表
 export function persionListByOrgRole({page, size, searchCondition}) {
+    
   return request({
     url: `${base}/roleStaffList/_search`,
     method: 'POST',
-    data: handleSearchCondition({ page, size, searchCondition })
+    data: handleSearchCondition({ searchCondition })
   });
 }
 // 角色视图 --  勾选人员

+ 13 - 4
src/components/search-bar/index.vue

@@ -30,7 +30,9 @@
             :api-name="item.apiName || 'getOrgTree'"
             :nodeKey="item.nodeKey || 'id'"
             :type="item.type || 'APP'"
-            @orgTreeValue="getTreeValue"
+            :defaultSelectRoot="item.defaultSelectRoot"
+            @orgTreeValue="getOrgTreeValue"
+            @orgRootValue="getOrgRootValue"
           ></select-org-tree>
         </template>
         <!-- 应用系统下拉列表 -->
@@ -100,7 +102,7 @@ export default {
     }
   },
   methods: {
-    handleSearch() {
+    setCondition() {
       let condition = {};
       this.form.forEach((item) => {
         const { name, value, op, format, type } = item;
@@ -111,7 +113,10 @@ export default {
           type
         };
       });
-      this.$emit('submitSearch', condition);
+      return condition;
+    },
+    handleSearch() {
+      this.$emit('submitSearch', this.setCondition());
     },
     handleReset() {
       const vm = this;
@@ -127,10 +132,14 @@ export default {
       });
     },
     // 获取机构树选中值
-    getTreeValue(val, key = 'id') {
+    getOrgTreeValue(val, key = 'id') {
       const name = key == 'id' ? 'orgId' : 'orgCode';
       this.form.find((item) => item.name == name).value = val;
     },
+    getOrgRootValue(val, key) {
+      this.getOrgTreeValue(val, key);
+       this.$emit('submitDefaultSearch', this.setCondition());
+    },
     // 获取应用系统选中值
     getAppValue(val, name) {
       this.form.find((item) => item.name == name).value = val;

+ 5 - 3
src/components/select-org-tree/index.vue

@@ -131,9 +131,11 @@ export default {
       commonApi[apiName]({ id, type: this.type })
         .then((res) => {
           // 默认选中根节点
-          //  if (this.defaultSelectRoot && level === 0) { 
-              
-          //  }
+          if (this.defaultSelectRoot && level === 0) {
+            this.treeValue = res[0][this.nodeKey];
+            this.selectedNodeLabel = res[0].name;
+            this.$emit('orgRootValue', res[0][this.nodeKey], this.nodeKey);
+          }
           return resolve(res || []);
         })
         .catch(() => resolve([]));

+ 1 - 17
src/pages/admin-manage/index.vue

@@ -42,7 +42,7 @@ export default {
       conditionForm,
       tableHeader,
       pageOptList: ['新增'],
-      tableOptList: ['用户信息','修改', '删除']
+      tableOptList: ['修改', '删除']
     };
   },
   methods: {
@@ -51,8 +51,6 @@ export default {
         this.handleAddDialog();
       } else if (type == '修改') {
         this.handleEditor(row);
-      } else if (type == '用户信息') {
-        this.handleDetail(row);
       } else if (type == '删除') {
         this.handleDelete(row);
       }
@@ -76,20 +74,6 @@ export default {
         }
       });
     },
-    handleDetail(row) {
-      const layer = this.$dgLayer({
-        title: '详情',
-        shade: [0.4, '#FFF'],
-        content: row.userType == '10' ? PoliceDetail : AuxiliaryDetail,
-        area,
-        props: { sizeForm: row },
-        on: {
-          success() {
-            layer.close(layer.dialogIndex);
-          }
-        }
-      });
-    },
     handleDelete({ id }) {
       const that = this;
       that.$confirm('是否确定删除这条数据!', '提示').then(() => {

+ 51 - 8
src/pages/appfun-auth-manage/role-auth-manage/roleView.vue

@@ -27,12 +27,23 @@
     <dg-col :span="12">
       <dg-card shadow="never" header="人员列表">
         <!-- 角色搜索栏 -->
-        <search-bar :conditionForm="userConditionForm" @submitSearch="receiveUserSearch"></search-bar>
+        <search-bar
+          :conditionForm="userConditionForm"
+          @submitSearch="receiveUserSearch"
+          @submitDefaultSearch="receiveUserDefaultCondition"
+        ></search-bar>
         <!-- 角色操作栏 -->
         <operate-bar :pageOptList="userOptList" @submitPageOpt="receviceOpt"></operate-bar>
         <!-- 角色列表 -->
-        <dg-table ref="userConditionTable" :data="persionListData" row-key="id" @selection-change="handleSelectChange">
+        <dg-table
+          ref="userConditionTable"
+          :data="persionListData"
+          :pagination="false"
+          row-key="id"
+          @selection-change="handleSelectChange"
+        >
           <dg-table-column type="selection" width="50"></dg-table-column>
+          <dg-table-column type="index" label="序号" width="70"></dg-table-column>
           <dg-table-column prop="name" align="center" width="120" label="姓名"></dg-table-column>
           <dg-table-column prop="idcard" align="center" label="身份证号码"></dg-table-column>
           <dg-table-column prop="orgName" align="center" label="单位名称"></dg-table-column>
@@ -96,12 +107,35 @@ export default {
       roleTableHeader: [
         { label: '角色名称', prop: 'name' },
         { label: '角色层级', prop: 'roleLevel', code: 'DM_ROLE_LEVEL' },
-        { label: '应用系统名称', prop: '' },
+        { label: '应用系统名称', prop: 'appName' },
         { label: '警种', prop: 'policeCategory', code: 'T_MD_POLICE_TYPE' },
         { label: '业务域标签', prop: 'roleBusiness', code: 'DM_POLICE_BUSINESS' }
       ],
       roleTableUrl: roleAuthApi.getRoleListByAppid,
-      userConditionForm,
+      userConditionForm: [
+        {
+          label: '单位名称',
+          name: 'orgId',
+          op: '=',
+          value: '',
+          apiName: 'getTree',
+          nodeKey: 'id',
+          type: 'APP',
+          component: 'SelectOrgTree',
+          placeholder: '请选择单位名称',
+          defaultSelectRoot: true
+        },
+        {
+          label: '姓名',
+          name: 'name',
+          op: 'like',
+          value: '',
+          component: 'ElInput',
+          attr: {
+            style: 'width: 130px'
+          }
+        }
+      ],
       userOptList: ['保存'],
       persionListData: [],
       userCondition: {
@@ -132,7 +166,8 @@ export default {
         delStaffJson: ''
       },
       page: 0,
-      size: 10
+      size: 10,
+      total: 0
     };
   },
   // 计算属性
@@ -153,6 +188,12 @@ export default {
       this.saveRoleAuthParams.appOrgId = this.currentAppItem.appOrgId;
       this.saveRoleAuthParams.appId = this.currentAppItem.id;
     },
+    receiveUserDefaultCondition(val) {
+      for (const key in val) {
+        this.userCondition[key].value = val[key].value;
+      }
+      this.saveRoleAuthParams.orgId = this.userCondition.orgId.value;
+    },
     receiveUserSearch(val) {
       for (const key in val) {
         this.userCondition[key].value = val[key].value;
@@ -160,9 +201,9 @@ export default {
       this.saveRoleAuthParams.orgId = this.userCondition.orgId.value;
       this.handleUserSearch();
     },
-
-    handleRoleRowClick({ id }) {
+    handleRoleRowClick({ id, appId }) {
       this.saveRoleAuthParams.roleId = this.userCondition.roleId.value = id;
+      this.saveRoleAuthParams.appId = appId;
       // 如果选择机构
       if (this.saveRoleAuthParams.orgId) {
         this.handleUserSearch(); // 人员列表查询
@@ -209,7 +250,9 @@ export default {
       Promise.all([roleAuthApi.persionListByOrgRole(userParams), roleAuthApi.getChecked(queryCheckedParams)]).then(
         (res) => {
           // console.log(res);
-          that.persionListData = res[0].data.content;
+          const { content, totalElements } = res[0].data;
+          that.persionListData = content;
+          that.total = totalElements;
           that.persionListData.map((item) => {
             that.$set(item, 'activeTime', '长期');
             // item["activeTime"] = "长期"; //列表一开始写死