lookAccountButton.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <el-button size="mini" type="text" icon="el-icon-view" @click="lookHangdle()">
  3. <span>查看账号</span>
  4. <el-dialog :title="'查看 ' + authUserId" :visible.sync="visible" width="900px" append-to-body v-if="visible">
  5. <el-row :gutter="10" class="mb8" align="middle">
  6. <el-col :span="10">
  7. <el-input type="textarea" autosize v-model="queryParams.accountIds" placeholder="输入账号ID(多个,,)" />
  8. </el-col>
  9. <el-col :span="1.5">
  10. <el-button type="cyan" icon="el-icon-search" @click="getList">搜索</el-button>
  11. </el-col>
  12. <el-col :span="1.5">
  13. <el-button type="primary" icon="el-icon-sort" @click="putuser"
  14. :disabled="adAccountList.length === 0">批量指派</el-button>
  15. </el-col>
  16. </el-row>
  17. <el-table :data="accountList" ref="multipleTable" :loading="loading" @selection-change="handleSelectionChange">
  18. <el-table-column type="selection" width="50" align="center" />
  19. <el-table-column label="账号ID" prop="accountId" align="center" fixed width="150"
  20. :show-overflow-tooltip="true" />
  21. <el-table-column label="账号名称" prop="accountName" align="center" :show-overflow-tooltip="true" width="300" />
  22. <el-table-column label="投手" prop="putUser" align="center" width="120" :show-overflow-tooltip="true">
  23. <template slot-scope="scope">
  24. <span v-if="scope.row.putUser">{{ scope.row.putUser.nickName }}</span>
  25. </template>
  26. </el-table-column>
  27. <el-table-column label="投手ID" prop="putUserId" align="center" width="120" :show-overflow-tooltip="true" />
  28. <el-table-column label="运营账号" prop="operationUserList" align="center" width="120"
  29. :show-overflow-tooltip="true">
  30. <template slot-scope="scope">
  31. <span>{{ scope.row.operationUserList | filterUser }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="所属组" prop="groupName" align="center" width="120" :show-overflow-tooltip="true" />
  35. <el-table-column label="Enabled?" prop="enabled" align="center" width="80">
  36. <template slot-scope="scope">
  37. <span>{{ scope.row.enabled ? '可用' : '禁用' }}</span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="90">
  41. <template slot-scope="scope">
  42. <!-- 指派 -->
  43. <put-user-button :accountId="scope.row.accountId" :authUserId="scope.row.authUserId"
  44. :putUserId="scope.row.putUserId" @onChange="getList()" />
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
  49. :limit.sync="queryParams.pageSize" @pagination="getList" />
  50. <putUser :visible="putuserVisible" :adAccountList="adAccountList" @onChange="getList()" @onClose="onClose()" />
  51. </el-dialog>
  52. </el-button>
  53. </template>
  54. <script>
  55. import { getAdAccountList } from "@/api/accounts/ttAdapi";
  56. import putUserButton from "./putUserButton.vue"
  57. import putUser from "./putUser.vue"
  58. export default {
  59. components: { putUserButton, putUser },
  60. data() {
  61. return {
  62. visible: false,
  63. loading: false,
  64. queryParams: {
  65. pageNum: 1,
  66. pageSize: 10,
  67. },
  68. accountList: [],
  69. total: 0,
  70. ids: [],
  71. adAccountList: [],
  72. putuserVisible: false
  73. }
  74. },
  75. filters: {
  76. filterUser(val) {
  77. if (val && val.length > 0) {
  78. return val.map(item => item.nickname).toString()
  79. }
  80. return '-1'
  81. }
  82. },
  83. props: {
  84. adAppId: {
  85. type: Number,
  86. default: null,
  87. },
  88. authUserId: {
  89. type: Number,
  90. default: null,
  91. }
  92. },
  93. methods: {
  94. onClose() {
  95. this.putuserVisible = false
  96. // this.$nextTick(() => {
  97. // this.adAccountList = []
  98. // this.ids = []
  99. // this.$refs.multipleTable.clearSelection();
  100. // })
  101. },
  102. // 批量指派
  103. putuser() {
  104. this.putuserVisible = true
  105. },
  106. handleSelectionChange(selection) {
  107. console.log(selection)
  108. this.adAccountList = selection.map(item => ({ accountId: item.accountId, authUserId: this.authUserId }));
  109. this.ids = selection.map(item => item.accountId);
  110. },
  111. lookHangdle() {
  112. this.visible = true
  113. this.queryParams.pageNum = 1
  114. this.getList()
  115. },
  116. getList() {
  117. this.$nextTick(() => {
  118. this.adAccountList = []
  119. this.ids = []
  120. this.$refs.multipleTable.clearSelection();
  121. })
  122. if (this.adAppId && this.authUserId) {
  123. let params = { ...this.queryParams, adAppId: this.adAppId, authUserId: this.authUserId, accountIds: this.queryParams.accountIds ? this.queryParams.accountIds.split(/[,,\n\s]+/ig) : [] }
  124. this.loading = true
  125. getAdAccountList(params).then(res => {
  126. this.loading = false
  127. this.accountList = res.data.records
  128. this.total = res.data.total
  129. }).catch(() => this.loading = false)
  130. }
  131. }
  132. }
  133. }
  134. </script>