qwUserSelectOne.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="员工昵称" prop="nickName">
  5. <el-input
  6. v-model="queryParams.nickName"
  7. placeholder="请输入员工昵称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">刷新/重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-table v-loading="loading" :data="userList" ref="userList">
  19. <el-table-column label="企微员工账号" align="center" prop="qwUserId" />
  20. <el-table-column label="员工昵称" align="center" prop="qwUserName" />
  21. <el-table-column label="员工部门" align="center" prop="departmentName" />
  22. <el-table-column label="员工昵称" align="center" prop="nickName"/>
  23. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" >
  24. <template slot-scope="scope">
  25. <el-button
  26. size="mini"
  27. type="text"
  28. icon="el-icon-edit"
  29. @click="handleSelectionChange(scope.row)"
  30. >选择此人</el-button>
  31. </template>
  32. </el-table-column>
  33. </el-table>
  34. <pagination
  35. v-show="total>0"
  36. :total="total"
  37. :page.sync="queryParams.pageNum"
  38. :limit.sync="queryParams.pageSize"
  39. @pagination="handlePaginationChange"
  40. />
  41. <div style="margin-top: 30px;display: flex;justify-content: center;gap: 12px">
  42. <el-button plain @click="handleClear">不选(清空发送人)</el-button>
  43. <el-button type="warning" icon="el-icon-check" @click="confirmSelect">确定选择</el-button>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import { listUser } from "@/api/qw/user";
  49. export default {
  50. name: "qwUserSelectOne",
  51. data() {
  52. return {
  53. // 遮罩层
  54. loading: true,
  55. // 导出遮罩层
  56. exportLoading: false,
  57. // 选中数组
  58. selectUsers: null,
  59. // 非单个禁用
  60. single: true,
  61. // 非多个禁用
  62. multiple: true,
  63. // 显示搜索条件
  64. showSearch: true,
  65. // 总条数
  66. total: 0,
  67. // 企微用户表格数据
  68. userList: [],
  69. // 弹出层标题
  70. title: "",
  71. // 是否显示弹出层
  72. open: false,
  73. // 查询参数
  74. queryParams: {
  75. pageNum: 1,
  76. pageSize: 10,
  77. qwUserId: null,
  78. companyId: null,
  79. companyUserId: null,
  80. corpId: null,
  81. nickName: null
  82. },
  83. // 表单参数
  84. form: {},
  85. // 表单校验
  86. rules: {
  87. }
  88. };
  89. },
  90. created() {
  91. },
  92. methods: {
  93. /** 查询企微用户列表 */
  94. getList() {
  95. this.loading = true;
  96. listUser(this.queryParams).then(response => {
  97. // 如果 companyUserId 为 null,移除列
  98. this.userList = response.rows.filter(column => column.companyUserId !=null);
  99. this.total = response.total;
  100. this.loading = false;
  101. });
  102. },
  103. getDetails(corpId){
  104. this.queryParams.corpId=corpId;
  105. this.getList()
  106. },
  107. handlePaginationChange(row) {
  108. this.queryParams.pageNum = row.page;
  109. this.queryParams.pageSize = row.limit;
  110. this.getList();
  111. },
  112. // 取消按钮
  113. cancel() {
  114. this.open = false;
  115. this.reset();
  116. },
  117. // 表单重置
  118. reset() {
  119. this.form = {
  120. id: null,
  121. qwUserId: null,
  122. companyId: null,
  123. companyUserId: null,
  124. corpId: null
  125. };
  126. this.resetForm("form");
  127. },
  128. //确定选择
  129. confirmSelect(){
  130. this.$emit("selectUserList",this.selectUsers);
  131. this.resetSelect();
  132. },
  133. //重置选择
  134. resetSelect(){
  135. //重置
  136. this.queryParams={
  137. pageNum: 1,
  138. pageSize: 10,
  139. qwUserId: null,
  140. companyId: null,
  141. companyUserId: null,
  142. corpId: null,
  143. nickName: null
  144. },
  145. this.getList();
  146. },
  147. /** 搜索按钮操作 */
  148. handleQuery() {
  149. this.queryParams.pageNum = 1;
  150. this.getList();
  151. },
  152. /** 重置按钮操作 */
  153. resetQuery() {
  154. this.resetForm("queryForm");
  155. this.handleQuery();
  156. },
  157. // 选中数据
  158. handleSelectionChange(selection) {
  159. this.$emit("selectUser",selection);
  160. },
  161. // 用户点击“不选”
  162. handleClear() {
  163. this.$emit("selectUser",{}); // 传空对象,表示清空
  164. },
  165. }
  166. };
  167. </script>