orgPeople.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div style="display:flex;width:100%;">
  3. <div style="width:100%;">
  4. <a-form layout="inline" style="margin-bottom: 10px;">
  5. <a-row type="flex">
  6. <a-form-item
  7. label="姓名"
  8. name="name"
  9. >
  10. <a-input v-model="queryParam.name" placeholder="请输入"/>
  11. </a-form-item>
  12. <a-form-item
  13. label="工号"
  14. name="userNo"
  15. >
  16. <a-input v-model="queryParam.userNo" placeholder="请输入"/>
  17. </a-form-item>
  18. <div style="flex:1;display:flex;justify-content: flex-end;">
  19. <a-button type="primary" style="margin-right: 8px;" @click="search">查询</a-button>
  20. <a-button @click="reset">重置</a-button>
  21. </div>
  22. </a-row>
  23. </a-form>
  24. <rx-grid
  25. ref="mapRef"
  26. style="height:90%!important"
  27. :allowRowSelect="true"
  28. :multiSelect="true"
  29. :columns="columns"
  30. :defaultPageSize="10"
  31. :url="api.queryGroupUsers"
  32. :queryParam="queryParam"
  33. data-field="result.data"
  34. :pageSizeOptions="[10,30,40]"
  35. id-field="userId"
  36. :showPageJump="false"
  37. :rowSelection="{selectedRowKeys: selectedRowKeys}"
  38. @selectChange="onSelectChange">
  39. <template slot="groupSummary" slot-scope="{text}">
  40. <div style="white-space: pre-line">{{ text }}</div>
  41. </template>
  42. </rx-grid>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import api from '@/api/knowledge/map/api'
  48. import OsUserApi from '@/api/user/org/osUser'
  49. import OsGroupApi from '@/api/user/org/osGroup'
  50. import {BaseList,Util, RxLayout, RxFit, RxGrid, RxTree} from 'jpaas-common-lib'
  51. import { getParentNode } from '@/views/modules/knowledge/aJs/getClassifyTree'
  52. export default {
  53. name: 'OsUserList',
  54. mixins: [BaseList],
  55. components: {
  56. RxLayout,
  57. RxFit,
  58. RxGrid,
  59. RxTree
  60. },
  61. props: {
  62. groupIds: {
  63. type: String,
  64. default: ''
  65. }
  66. },
  67. created() {
  68. this.queryParam.groupIds = this.groupIds
  69. },
  70. data() {
  71. return {
  72. api,
  73. queryParam: {
  74. groupIds: '',
  75. name: "",
  76. userNo: ""
  77. },
  78. table: 'table',
  79. orgData: [],
  80. userId: '',
  81. visible: false,
  82. quitUserIds: [],
  83. confirmLoading: false,
  84. quitTime: "",
  85. osUserTypes:[],
  86. selectedRowKeys: [],
  87. // 表头
  88. columns: [
  89. {
  90. title: '员工ID',
  91. align: 'center',
  92. dataIndex: 'userId',
  93. width: 100
  94. },
  95. {
  96. title: '工号',
  97. align: 'center',
  98. dataIndex: 'userNo',
  99. width: 100
  100. },
  101. {
  102. title: '员工姓名',
  103. align: 'center',
  104. dataIndex: 'fullName',
  105. width: 80
  106. },
  107. {
  108. title: '所属组织',
  109. align: 'center',
  110. dataIndex: 'groupSummary',
  111. scopedSlots: {customRender: 'groupSummary'}
  112. },
  113. {
  114. title: '职位',
  115. align: 'center',
  116. dataIndex: 'positionGrade',
  117. width: 150
  118. }
  119. ],
  120. // 组织架构
  121. checkedTarget: {},
  122. // 职系
  123. sequencesInfo: {
  124. gradeId: undefined,
  125. gradeName: ''
  126. },
  127. // 职等
  128. gradesInfo: {
  129. gradeLevelId: undefined,
  130. gradeLevelName: ''
  131. }
  132. }
  133. },
  134. methods: {
  135. reset() {
  136. this.queryParam.name = ""
  137. this.queryParam.userNo = ""
  138. this.search()
  139. },
  140. search(){
  141. this.$refs.mapRef.loadData()
  142. },
  143. resetQueryParam() {
  144. this.queryParam = Object.assign({},this.$options.data().queryParam)
  145. },
  146. close(){
  147. //关闭按钮
  148. this.fitSearch = false ;
  149. },
  150. delById(ids) {
  151. return OsUserApi.delOsUser({ids: ids.join(',')});
  152. },
  153. dimissionByIds(ids) {
  154. this.visible = true;
  155. this.quitUserIds = ids;
  156. },
  157. getListByParams(parameter) {
  158. return OsUserApi.getOsUserList(parameter)
  159. },
  160. //加载部门树
  161. loadAdminDeps() {
  162. OsGroupApi.getAdminOrg().then(resp => {
  163. let data = resp.data;
  164. let temp = [];
  165. for (let i = 0; i < data.length; i++) {
  166. var rs = data[i];
  167. var _isLeaf = rs.childAmount == 0 ? true : false;
  168. temp.push({title: rs.name, groupId: rs.groupId, key: rs.key, isLeaf: _isLeaf})
  169. }
  170. this.orgData = [...temp];
  171. })
  172. },
  173. //加载左树下的子节点
  174. onLoadGroupTree(treeNode) {
  175. if (treeNode.dataRef.children) {
  176. return;
  177. }
  178. console.log(treeNode)
  179. return OsGroupApi.getParentGroup(treeNode.dataRef.groupId).then(data => {
  180. let treeData = []
  181. for (let i = 0; i < data.length; i++) {
  182. var rs = data[i]
  183. var _isLeaf = rs.childAmount == 0 ? true : false;
  184. treeData.push({title: rs.name, groupId: rs.groupId, key: rs.key,isLeaf: _isLeaf})
  185. }
  186. var orgData = this.getGroupTree(this.orgData, treeNode.dataRef.groupId, treeData);
  187. this.orgData = [...orgData];
  188. console.info("onLoadGroupTree")
  189. console.info(this.orgData)
  190. })
  191. },
  192. getGroupTree(orgData, groupId, treeData) {
  193. if (treeData.length > 0) {
  194. for (var i = 0; i < orgData.length; i++) {
  195. if (orgData[i].groupId == groupId) {
  196. orgData[i].children = treeData;
  197. break;
  198. }
  199. if (orgData[i].children) {
  200. this.getGroupTree(orgData[i].children, groupId, treeData);
  201. }
  202. }
  203. }
  204. return orgData;
  205. },
  206. //选中树节点
  207. selectGroupNode(selKeys, e) {
  208. let node = e.node.dataRef
  209. if(this.isOnlyOrg) {
  210. this.checkedTarget['approverId'] = node.groupId
  211. this.checkedTarget['approverName'] = node.title
  212. this.$emit('transCheckedTarget',this.checkedTarget)
  213. } else {
  214. let organizationTree = getParentNode(e.node)
  215. this.checkedTarget['organizationId'] = node.groupId
  216. this.checkedTarget['organizationName'] = node.title
  217. this.checkedTarget['organizationTree'] = organizationTree
  218. this.$emit('transCheckedTarget',this.checkedTarget)
  219. }
  220. if(this.isOnlyOrg) {
  221. //this.selectGroupId=node.groupId;
  222. //查询左树用户
  223. if(selKeys.length==0){
  224. delete this.queryParam.groupId;
  225. }else {
  226. this.queryParam.groupId = node.groupId;
  227. }
  228. this.$refs.table.loadData()
  229. }
  230. },
  231. onSelectChange(keys,rows) {
  232. this.checkedTarget['approverId'] = rows[0].userNo
  233. this.checkedTarget['approverName'] = rows[0].fullName
  234. console.log(this.checkedTarget)
  235. this.$emit('transCheckedTarget',this.checkedTarget)
  236. },
  237. // 选择职系
  238. handleSequencesChange(arg) {
  239. if(arg) {
  240. this.sequencesInfo.gradeName = this.sequencesList.find(item => item.value == arg).label
  241. } else {
  242. this.sequencesInfo = {}
  243. }
  244. this.$emit('returnSequencesInfo',this.sequencesInfo)
  245. },
  246. // 选择职级
  247. handleGradeChange(arg) {
  248. if(arg) {
  249. this.gradesInfo.gradeLevelName = arg
  250. } else {
  251. this.gradesInfo = {}
  252. }
  253. this.$emit('returnGradeInfo',this.gradesInfo)
  254. }
  255. },
  256. }
  257. </script>
  258. <style scoped>
  259. /deep/ .ant-card-head-title {
  260. padding: 0;
  261. }
  262. </style>