UserTreeSelectToResign.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div>
  3. <el-dialog :title="title" :close-on-click-modal="false" draggable width="500px" height="700px" @close="close"
  4. append-to-body v-model="visible">
  5. <div style="height: calc(100% - 80px);">
  6. <el-form :inline="true" class="query-form" ref="searchForm" :model="searchForm"
  7. @keyup.enter.native="refreshList()" @submit.native.prevent>
  8. <!-- 搜索框-->
  9. <el-form-item label="" prop="name">
  10. <el-input v-model="searchForm.name" placeholder="请输入用户名称" clearable></el-input>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" @click="list()" size="medium" icon="el-icon-search">查询</el-button>
  14. <el-button @click="resetSearch()" size="medium" icon="el-icon-refresh-right">重置</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <vxe-table border="inner" auto-resize resizable height="400px" :loading="loading" size="small" ref="userTable"
  18. show-header-overflow show-overflow highlight-hover-row :menu-config="{}" :sort-config="{ remote: true }"
  19. :data="dataList" :row-config="{ isCurrent: true }" :radio-config="{ trigger: 'row' }"
  20. :tree-config="{ transform: true, rowField: 'id', parentField: 'parentId', expandAll: false }"
  21. :checkbox-config="{}">
  22. <!-- <vxe-column type="seq" width="60" title="序号"></vxe-column>-->
  23. <vxe-column type="radio" width="50"></vxe-column>
  24. <vxe-column title="姓名" min-width="180" field="name" align="left" tree-node></vxe-column>
  25. </vxe-table>
  26. </div>
  27. <template #footer>
  28. <span class="dialog-footer">
  29. <el-button @click="close()" size="medium" icon="el-icon-circle-close">关闭</el-button>
  30. <el-button type="primary" size="medium" v-if="method != 'view'" @click="getProgramForUser()"
  31. icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
  32. </span>
  33. </template>
  34. </el-dialog>
  35. </div>
  36. </template>
  37. <script>
  38. import ReimbursementService from '@/api/cw/reimbursementApproval/ReimbursementApprovalService.js'
  39. import userService from "@/api/sys/userService";
  40. import officeService from "@/api/sys/officeService";
  41. export default {
  42. data() {
  43. return {
  44. title: '',
  45. method: '',
  46. visible: false,
  47. loading: false,
  48. dataList: [],
  49. searchForm: {
  50. name: ''
  51. }
  52. }
  53. },
  54. reimbursementService: null,
  55. created() {
  56. this.reimbursementService = new ReimbursementService()
  57. },
  58. components: {
  59. },
  60. methods: {
  61. init() {
  62. this.title = '人员选择'
  63. this.visible = true
  64. this.list()
  65. },
  66. // 表单提交
  67. getProgramForUser() {
  68. let rows = []
  69. if (this.commonJS.isEmpty(this.$refs.userTable.getRadioRecord())) {
  70. this.$message.error('请选择一条数据')
  71. return
  72. }
  73. // if (this.$refs.userTable.getCheckboxRecords().length > 1) {
  74. // this.$message.error('最多选择一条数据')
  75. // return
  76. // }
  77. let row = this.$refs.userTable.getRadioRecord()
  78. if (!row.isUser) {
  79. this.$message.error('请选择人员数据')
  80. return
  81. }
  82. this.close()
  83. rows.push(row)
  84. this.$emit('doSubmit', rows)
  85. },
  86. list() {
  87. this.loading = true
  88. this.reimbursementService.userTreeByTenantId(this.searchForm.name).then((data) => {
  89. this.dataList = data
  90. this.loading = false
  91. this.$nextTick(() => {
  92. this.$refs.userTable.setAllTreeExpand(true)
  93. })
  94. officeService.treeData({ tenantId: this.tenantId }).then(data1 => {
  95. userService
  96. .list({
  97. current: 1,
  98. size: 10,
  99. companyDTO: {
  100. id: data1[0].id
  101. },
  102. })
  103. .then((data2) => {
  104. let manager = data.filter(item => {
  105. return data2.records[0].id == item.id
  106. })
  107. this.$refs.userTable.setRadioRow(manager[0])
  108. });
  109. });
  110. })
  111. },
  112. // 当前页
  113. currentChangeHandle({ currentPage, pageSize }) {
  114. this.tablePage.currentPage = currentPage
  115. this.tablePage.pageSize = pageSize
  116. this.list()
  117. },
  118. resetSearch() {
  119. this.$refs.searchForm.resetFields()
  120. this.list()
  121. },
  122. close() {
  123. this.detail = ''
  124. this.visible = false
  125. }
  126. }
  127. }
  128. </script>
  129. <style>
  130. .messageZindex {
  131. z-index: 9999 !important;
  132. }
  133. </style>
  134. <style scoped>
  135. /deep/ .el-dialog__body {
  136. padding-top: 0px;
  137. }
  138. </style>