猎羽广告

index.vue 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <div class="screenBox flex">
  3. <Input ref="InputRef_text" title="分组名称" placeholderTxt="分组名称" @changeEvent="init()" @clearEvent="init()"/>
  4. <Select ref="statusRef" title="状态" @changeEvent="init()" @clearEvent="init()"
  5. :options="statusList.list" />
  6. <el-button type="primary" class="lMarauto" @click="addEvent()">新增账号组</el-button>
  7. </div>
  8. <!-- 列表-->
  9. <TableList
  10. ref="tableListRef"
  11. :tableData="tableInfo.tableList"
  12. :descol="tableInfo.descolList"
  13. :total="total"
  14. @init="init"
  15. >
  16. <template v-slot:operate="slotProps">
  17. <div class="text-center">
  18. <span class="operate_text lMar8 pointer" @click="addEvent(slotProps.row)">编辑</span>
  19. <Popconfirm @confirm="deleEvent(slotProps.row)"/>
  20. </div>
  21. </template>
  22. </TableList>
  23. <!-- 添加分组-->
  24. <AddGroup ref="AddGroupRef" @init="init"></AddGroup>
  25. </template>
  26. <script setup lang="ts">
  27. import {nextTick, onMounted, reactive, ref, getCurrentInstance} from 'vue'
  28. import Input from '@/components/capsulationMoudle/_input.vue'
  29. import Popconfirm from '@/components/capsulationMoudle/_popconfirm.vue'
  30. import Select from '@/components/capsulationMoudle/_select.vue'
  31. import TableList from '@/components/capsulationMoudle/tableList.vue'
  32. import {adGroupParams, adqParam, departParams, reactiveTableAndAny} from "@/api/ApiModel";
  33. import {Api} from "@/api/api";
  34. import {ElMessage} from "element-plus";
  35. import { publicTableTs } from '@/components/businessMoudle/tableInfo'
  36. import AddGroup from '@/components/businessMoudle/adAccountGroup/dialog/addGroup.vue'
  37. const { proxy } = getCurrentInstance() as any;
  38. // 表格数据公共ts
  39. const descolParams = reactive([
  40. { name:'账号组名称',column:'name',},
  41. { name:'操作人',column:'admin',},
  42. { name:'所属投手',column:'promoter',},
  43. { name:'创建时间',column:'created_at',},
  44. { name:'更新时间',column:'updated_at',},
  45. { name:'操作',column:'operate',slotFlag: true},
  46. ])
  47. const { tableInfo,tableListRef,total } = publicTableTs(descolParams)
  48. const addEvent = (item?:any) => {
  49. console.log(item)
  50. nextTick(()=>{
  51. AddGroupRef.value!.switchShow(true,item||'')
  52. })
  53. }
  54. const AddGroupRef = ref<{switchShow:(val:boolean,info?:any)=>void}>()
  55. const InputRef_text = ref<{value:string}>()
  56. const statusRef = ref<{value:number}>()
  57. const statusList = reactive({
  58. list: [
  59. {value: 0, label: '已禁用' },
  60. {value: 1, label: '正常' },
  61. ]
  62. })
  63. //账号列表
  64. const init = async (page?:any,pageSize?:any) => {
  65. tableListRef.value!.loading = true
  66. const paramsModel = reactive({
  67. keyword:InputRef_text.value!.value,
  68. status: statusRef.value!.value,
  69. page: page ? page : 1,
  70. page_size: pageSize ? pageSize : 20,
  71. })
  72. let res:any = await proxy.$http.get(Api.ad_account_group_list,paramsModel)
  73. tableListRef.value!.loading = false
  74. if(res&&res.errNo=='0'){
  75. tableInfo.tableList = res.rst.data
  76. total.value = res.rst.pageInfo.total
  77. }else{
  78. ElMessage.error(res.errMsg)
  79. }
  80. }
  81. const deleEvent = async (item:any) => {
  82. tableListRef.value!.loading = true
  83. const paramsModel = reactive<adGroupParams>({
  84. group_id:item.id,
  85. status: 1-item.status
  86. })
  87. let res:any = await proxy.$http.get(Api.ad_account_group_convert,paramsModel)
  88. tableListRef.value!.loading = false
  89. ElMessage.info(res.errMsg)
  90. if(res&&res.errNo=='0'){
  91. await init()
  92. }
  93. }
  94. onMounted( async ()=>{
  95. await init()
  96. })
  97. </script>
  98. <style lang="scss" scoped>
  99. .dialogBox{
  100. :deep(.el-input__wrapper){
  101. background: #F9F9F9;
  102. border-radius: 5px;
  103. border: 1px solid #F1F1F1;
  104. height: 45px;
  105. box-shadow:none;
  106. }
  107. }
  108. .screenArea{
  109. margin-bottom: 8px;
  110. }
  111. </style>