AdqAccountClaimList.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="24">
  7. <a-col :md="8" :sm="8">
  8. <a-form-item label="账户ID">
  9. <a-textarea placeholder="请输入账户ID,多个用逗号或换行分隔" v-model="queryParam.accountIds" :autoSize="{ minRows: 1, maxRows: 4 }"></a-textarea>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="8" :sm="8">
  13. <a-form-item label="客户名称">
  14. <a-input placeholder="请输入客户名称" v-model="queryParam.advertiserName"></a-input>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="8" :sm="8">
  18. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  19. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  20. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  21. </span>
  22. </a-col>
  23. </a-row>
  24. </a-form>
  25. </div>
  26. <!-- 操作按钮区域 -->
  27. <div class="table-operator" style="margin-top: 16px">
  28. <a-button type="primary" @click="showClaimModal" :disabled="selectedRowKeys.length === 0">
  29. <a-icon type="check-circle" />批量认领 ({{ selectedRowKeys.length }})
  30. </a-button>
  31. </div>
  32. <!-- table区域 -->
  33. <div>
  34. <a-table
  35. ref="table"
  36. size="middle"
  37. bordered
  38. rowKey="accountId"
  39. :columns="columns"
  40. :dataSource="dataSource"
  41. :pagination="ipagination"
  42. :loading="loading"
  43. :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
  44. @change="handleTableChange"
  45. >
  46. </a-table>
  47. </div>
  48. <!-- 认领弹窗 -->
  49. <a-modal
  50. title="账户认领 - 选择项目"
  51. v-model="claimVisible"
  52. @ok="handleClaim"
  53. :confirmLoading="claimLoading"
  54. :width="600"
  55. >
  56. <a-form layout="vertical">
  57. <a-form-item label="已选账户数">
  58. <span style="font-weight: bold; font-size: 16px">{{ selectedRowKeys.length }} 个</span>
  59. </a-form-item>
  60. <a-form-item label="选择项目" required>
  61. <a-select
  62. v-model="claimProjectId"
  63. placeholder="请选择项目"
  64. showSearch
  65. optionFilterProp="children"
  66. :filterOption="filterOption"
  67. @search="searchProjects"
  68. @focus="loadProjects"
  69. style="width: 100%"
  70. >
  71. <a-select-option :value="item.projectId" v-for="item of projectList" :key="item.projectId">
  72. {{ item.projectName }}
  73. </a-select-option>
  74. </a-select>
  75. </a-form-item>
  76. </a-form>
  77. </a-modal>
  78. </a-card>
  79. </template>
  80. <script>
  81. import { getAction, postAction } from '@/api/manage'
  82. export default {
  83. name: 'AdqAccountClaimList',
  84. data() {
  85. return {
  86. description: '腾讯账户认领',
  87. queryParam: {},
  88. dataSource: [],
  89. loading: false,
  90. selectedRowKeys: [],
  91. selectedRows: [],
  92. columns: [
  93. {
  94. title: '账户ID',
  95. align: 'center',
  96. dataIndex: 'accountId',
  97. },
  98. {
  99. title: '广告主名称',
  100. align: 'center',
  101. dataIndex: 'advertiserName',
  102. },
  103. {
  104. title: '客户名称',
  105. align: 'center',
  106. dataIndex: 'corporationName',
  107. },
  108. {
  109. title: '认证状态',
  110. align: 'center',
  111. dataIndex: 'systemStatus',
  112. },
  113. {
  114. title: '管家账户ID',
  115. align: 'center',
  116. dataIndex: 'adminAdvertiserId',
  117. },
  118. {
  119. title: '创建时间',
  120. align: 'center',
  121. dataIndex: 'createTime',
  122. },
  123. ],
  124. ipagination: {
  125. current: 1,
  126. pageSize: 10,
  127. pageSizeOptions: ['10', '20', '50', '100'],
  128. showTotal: (total, range) => {
  129. return range[0] + '-' + range[1] + ' 共' + total + '条'
  130. },
  131. showQuickJumper: true,
  132. showSizeChanger: true,
  133. total: 0,
  134. },
  135. // 认领相关
  136. claimVisible: false,
  137. claimLoading: false,
  138. claimProjectId: undefined,
  139. projectList: [],
  140. }
  141. },
  142. mounted() {
  143. this.loadData()
  144. },
  145. methods: {
  146. loadData(arg) {
  147. if (arg === 1) {
  148. this.ipagination.current = 1
  149. }
  150. this.loading = true
  151. let params = {
  152. pageNo: this.ipagination.current,
  153. pageSize: this.ipagination.pageSize,
  154. ...this.queryParam,
  155. }
  156. getAction('/ctop/adqAccountClaim/unclaimedList', params).then((res) => {
  157. this.loading = false
  158. if (res.success) {
  159. this.dataSource = res.result.records || []
  160. this.ipagination.total = res.result.total || 0
  161. } else {
  162. this.$message.error(res.message || '查询失败')
  163. }
  164. })
  165. },
  166. searchQuery() {
  167. this.loadData(1)
  168. },
  169. searchReset() {
  170. this.queryParam = {}
  171. this.loadData(1)
  172. },
  173. handleTableChange(pagination) {
  174. this.ipagination = pagination
  175. this.loadData()
  176. },
  177. onSelectChange(selectedRowKeys, selectedRows) {
  178. this.selectedRowKeys = selectedRowKeys
  179. this.selectedRows = selectedRows
  180. },
  181. showClaimModal() {
  182. if (this.selectedRowKeys.length === 0) {
  183. this.$message.warning('请至少选择一个账户')
  184. return
  185. }
  186. this.claimVisible = true
  187. this.claimProjectId = undefined
  188. this.loadProjects()
  189. },
  190. loadProjects() {
  191. getAction('/ctop/adqAccountClaim/projectList', {}).then((res) => {
  192. if (res.success) {
  193. this.projectList = res.result || []
  194. }
  195. })
  196. },
  197. searchProjects(value) {
  198. getAction('/ctop/adqAccountClaim/projectList', { projectName: value }).then((res) => {
  199. if (res.success) {
  200. this.projectList = res.result || []
  201. }
  202. })
  203. },
  204. filterOption(input, option) {
  205. return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  206. },
  207. handleClaim() {
  208. if (!this.claimProjectId) {
  209. this.$message.warning('请选择项目')
  210. return
  211. }
  212. this.claimLoading = true
  213. let accountIds = this.selectedRows.map((item) => ({
  214. accountId: item.accountId,
  215. advertiserName: item.advertiserName,
  216. adminAdvertiserId: item.adminAdvertiserId,
  217. }))
  218. let params = {
  219. projectId: this.claimProjectId,
  220. accountIds: accountIds,
  221. }
  222. postAction('/ctop/adqAccountClaim/batchClaim', params).then((res) => {
  223. this.claimLoading = false
  224. if (res.success) {
  225. this.$message.success('账户认领成功')
  226. this.claimVisible = false
  227. this.selectedRowKeys = []
  228. this.selectedRows = []
  229. this.loadData()
  230. } else {
  231. this.$message.error(res.message || '认领失败')
  232. }
  233. })
  234. },
  235. },
  236. }
  237. </script>
  238. <style scoped>
  239. @import '~@assets/less/common.less';
  240. </style>