person-auth.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <!--
  2. 人员授权
  3. @Author: linqian
  4. @Date: 2021-04-06 14:30
  5. -->
  6. <template>
  7. <dg-row class="property-wapper" :gutter="2">
  8. <!-- 属性列表 -->
  9. <dg-col :span="5" class="property-wapper__left">
  10. <dg-card header="机构列表" class="org-card box-card">
  11. <org-tree
  12. ref="tree"
  13. class="u-pm__left"
  14. treeHeight="calc(100vh - 19rem)"
  15. paddingRight="15px"
  16. :search="true"
  17. :isClearSelectedNode="clearSelectedNode"
  18. @handleGetNode="handleGetNode"
  19. @submitRootNode="submitRootNode"
  20. @doClickSearchItem="handleGetNode"
  21. @setClearNodesFlag="getClearNodesFlag"
  22. ></org-tree>
  23. </dg-card>
  24. </dg-col>
  25. <!-- 人员列表区域 -->
  26. <dg-col :span="7" class="property-wapper__center">
  27. <dg-card class="box-card" header="人员列表">
  28. <!-- 搜索栏 -->
  29. <el-form :inline="true" class="search-form">
  30. <el-form-item label="类型">
  31. <dg-select
  32. style="width: 100px"
  33. v-model="searchPersonCondition.userType.value"
  34. code="DM_USER_TYPE"
  35. clearable
  36. ></dg-select>
  37. </el-form-item>
  38. <el-form-item label="姓名">
  39. <el-input
  40. style="width: 130px"
  41. v-model="searchPersonCondition.name.value"
  42. clearable
  43. @keyup.enter.native="handleSearch"
  44. ></el-input>
  45. </el-form-item>
  46. <el-form-item>
  47. <dg-button type="primary" @click="handleSearch" icon="el-icon-search">查询</dg-button>
  48. </el-form-item>
  49. </el-form>
  50. <!-- 人员列表 -->
  51. <dg-table
  52. ref="personTable"
  53. :url="personUrl"
  54. :condition="searchPersonCondition"
  55. border
  56. row-key="id"
  57. @row-click="handleTableRowClick"
  58. highlight-current-row
  59. :row-style="rowStyle"
  60. :lazyLoad="true"
  61. >
  62. <!-- <dg-table-column type="selection" reserve-selection width="55"></dg-table-column> -->
  63. <dg-table-column type="index" width="70" label="序号"></dg-table-column>
  64. <dg-table-column prop="name" label="姓名"></dg-table-column>
  65. <dg-table-column prop="idcard" label="身份证号码"></dg-table-column>
  66. <dg-table-column prop="userType" label="类型" code="DM_USER_TYPE"></dg-table-column>
  67. </dg-table>
  68. </dg-card>
  69. </dg-col>
  70. <!-- 权限设置 -->
  71. <dg-col :span="12" :key="key">
  72. <set-auth :subId="subId" subType="USER" saveApi="saveUserDataAuth"></set-auth>
  73. </dg-col>
  74. </dg-row>
  75. </template>
  76. <script>
  77. import orgTree from "@/pages/common/tree";
  78. import { staffUserPage } from "@/api/role-auth-info";
  79. import setAuth from "@/components/data-auth/set-auth"
  80. export default {
  81. components: { orgTree, setAuth },
  82. data() {
  83. return {
  84. // 激活的tab
  85. activeName: "tableAuth",
  86. rowStyle: {
  87. cursor: "pointer"
  88. },
  89. // 查询人员姓名
  90. personUrl: staffUserPage,
  91. searchPersonCondition: {
  92. orgId: { value: "", op: "=" },
  93. name: { value: "", op: "like" },
  94. userType: { value: "", op: "=" }
  95. },
  96. clearSelectedNode: false,
  97. key: 0,
  98. subId: ""
  99. };
  100. },
  101. computed: {},
  102. methods: {
  103. /**
  104. * @description: 搜索人员列表
  105. */
  106. handleSearch() {
  107. this.clearSelectedNode = true;
  108. this.searchPersonCondition.orgId.value = "";
  109. this.$refs.personTable.searchForm();
  110. this.subId = "";
  111. this.key++
  112. },
  113. /**
  114. * @description: 点击人员列表
  115. * @param {*} row
  116. */
  117. handleTableRowClick(row) {
  118. this.subId = row.idcard;
  119. this.key++
  120. },
  121. /**
  122. * @description: 获取机构节点
  123. * @param {*} node
  124. */
  125. handleGetNode({ id }) {
  126. const oldValue = this.searchPersonCondition.orgId.value;
  127. if (oldValue !== id) {
  128. this.searchPersonCondition.orgId.value = id;
  129. this.$refs.personTable.searchForm();
  130. this.subId = "";
  131. this.key++;
  132. }
  133. },
  134. // 默认获取根节点
  135. submitRootNode({ id }) {
  136. this.$nextTick(() => {
  137. this.handleGetNode({ id });
  138. });
  139. },
  140. handleSave() {},
  141. /**
  142. * @description: 设置清除选中节点标志
  143. * @param {*} val
  144. */
  145. getClearNodesFlag(val) {
  146. this.clearSelectedNode = val;
  147. }
  148. },
  149. created() {},
  150. mounted() {}
  151. };
  152. </script>
  153. <style lang='scss' scoped>
  154. /deep/ .el-card__header {
  155. display: block;
  156. }
  157. /deep/ .org-card {
  158. .el-card__body {
  159. padding: 20px 5px 20px 20px;
  160. }
  161. }
  162. .user-search {
  163. display: flex;
  164. align-items: center;
  165. }
  166. </style>