companyTransferQwUserSelect.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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="companyId">
  5. <el-select v-model="queryParams.companyId" placeholder="销售公司" size="small">
  6. <el-option
  7. v-for="dict in companyList"
  8. :key="dict.dictValue"
  9. :label="dict.dictLabel"
  10. :value="dict.dictValue"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="员工昵称" prop="nickName">
  15. <el-input
  16. v-model="queryParams.nickName"
  17. placeholder="请输入员工昵称"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item>
  24. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  25. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">刷新/重置</el-button>
  26. </el-form-item>
  27. </el-form>
  28. <el-table v-loading="loading" :data="userList" ref="userList" border>
  29. <el-table-column label="归属销售公司" align="center" prop="companyName" />
  30. <el-table-column label="企微员工账号" align="center" prop="qwUserId" />
  31. <el-table-column label="员工昵称" align="center" prop="qwUserName" />
  32. <el-table-column label="员工部门" align="center" prop="departmentName" />
  33. <el-table-column label="员工昵称" align="center" prop="nickName"/>
  34. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120px" >
  35. <template slot-scope="scope">
  36. <el-button
  37. size="mini"
  38. type="text"
  39. icon="el-icon-edit"
  40. @click="handleSelectionChange(scope.row)"
  41. >选择此人</el-button>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. <pagination
  46. v-show="total>0"
  47. :total="total"
  48. :page.sync="queryParams.pageNum"
  49. :limit.sync="queryParams.pageSize"
  50. @pagination="handlePaginationChange"
  51. />
  52. </div>
  53. </template>
  54. <script>
  55. import { companyQwUserlist, listUser } from '@/api/qw/user'
  56. import { getCompanyListByCorId } from '@/api/company/company'
  57. export default {
  58. name: "companyTransferQwUserSelect",
  59. data() {
  60. return {
  61. // 遮罩层
  62. loading: false,
  63. // 显示搜索条件
  64. showSearch: true,
  65. // 总条数
  66. total: 0,
  67. // 企微用户表格数据
  68. userList: [],
  69. companyList: [],
  70. // 查询参数
  71. queryParams: {
  72. pageNum: 1,
  73. pageSize: 10,
  74. companyId: null,
  75. corpId: null,
  76. nickName: null
  77. },
  78. };
  79. },
  80. methods: {
  81. load(corpId, companyId) {
  82. getCompanyListByCorId(corpId).then(response => {
  83. this.companyList = response.data.filter(item => item.dictValue !== companyId)
  84. if (!Array.isArray(this.companyList) || this.companyList.length === 0) {
  85. this.userList = []
  86. return
  87. }
  88. this.queryParams.corpId = corpId;
  89. this.queryParams.companyId = this.companyList[0].dictValue;
  90. this.handleQuery();
  91. })
  92. },
  93. /** 查询企微用户列表 */
  94. getList() {
  95. this.loading = true;
  96. companyQwUserlist(this.queryParams).then(response => {
  97. this.userList = response.rows;
  98. this.total = response.total;
  99. this.loading = false;
  100. });
  101. },
  102. handlePaginationChange(row) {
  103. this.queryParams.pageNum = row.page;
  104. this.queryParams.pageSize = row.limit;
  105. this.getList();
  106. },
  107. /** 搜索按钮操作 */
  108. handleQuery() {
  109. this.queryParams.pageNum = 1;
  110. if (!Array.isArray(this.companyList) || this.companyList.length === 0) {
  111. this.userList = []
  112. return
  113. }
  114. this.getList();
  115. },
  116. /** 重置按钮操作 */
  117. resetQuery() {
  118. this.resetForm("queryForm");
  119. if (!Array.isArray(this.companyList) || this.companyList.length === 0) {
  120. return
  121. }
  122. this.queryParams.companyId = this.companyList[0].dictValue;
  123. this.handleQuery();
  124. },
  125. // 选中数据
  126. handleSelectionChange(selection) {
  127. this.$emit("selectUser",selection);
  128. },
  129. }
  130. };
  131. </script>