猎羽广告

index.vue 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <!-- 筛选 -->
  3. <div class="screenBox_mini">
  4. <Input ref="InputRef_text" title="关键词" placeholderTxt="关键词" @changeEvent="() => init()" @clearEvent="() => init()" />
  5. <Select ref="acRef" title="账号" selectWidth="160px" @changeEvent="() => init()" @clearEvent="() => init()"
  6. :optObj="{ k: 'account_id', la: 'account_id', val: 'account_id' }" :options="pageInfo.acList" />
  7. <Select ref="statusRef" title="状态" selectWidth="160px" @changeEvent="() => init()" @clearEvent="() => init()"
  8. :options="pageInfo.statusList" />
  9. <TimeScreen title="时间" selectWidth="260px" :haveQuick="false" :clearFlag="true" :valueIsKong="true" ref="timeRef"
  10. @init="() => init()"></TimeScreen>
  11. <span class="pointer c-theme lMar10" @click="()=>{clearEvent();init()}">清空</span>
  12. </div>
  13. <!-- 表格 -->
  14. <el-table v-loading="loading" ref="tableRef" :data="tableInfo.tableList" :header-cell-style="tableHeaderStyle"
  15. style="width: 100%;" border empty-text="暂无数据" row-key="campaign_id" max-height="calc(100vh - 294px)">
  16. <template v-for="item in tableInfo.descol">
  17. <el-table-column :fixed="item.fixed" :prop="item.prop" :min-width="item.width ? item.width : '80px'">
  18. <template #header>
  19. <div class="flex">
  20. <span>{{ item.label }}</span>
  21. <el-tooltip v-if="item.note" placement="top" effect="dark">
  22. <template #content><span v-html="item.note"></span></template>
  23. <i-ep-QuestionFilled class="c-999 f14 pointer" />
  24. </el-tooltip>
  25. </div>
  26. </template>
  27. <template #default="scope">
  28. <!-- 任务 -->
  29. <div v-if="item.prop == 'name'" class="flex_start">
  30. <span>{{ scope.row[item.prop] }}</span>
  31. <el-icon color="#3173FF" class="tMar3 pointer lMarauto f16 icon" @click="editNameEvent(scope.row)"><i-ep-Edit /></el-icon>
  32. </div>
  33. <!-- 提交规则 -->
  34. <div v-else-if="item.prop == 'comtype'">
  35. {{ scope.row[item.prop] == 1 ? '立即提交' : scope.row[item.prop] == 2 ? '定时提交' : '' }}
  36. <p v-if="scope.row[item.prop] == 2">{{ scope.row.dotime }}</p>
  37. </div>
  38. <!-- 提交状态 -->
  39. <div v-else-if="item.prop == 'status'">
  40. <span
  41. :class="['task-status', 'rMar10', scope.row.status == 2 && (scope.row.fail_num == 0 ? 'success' : 'fail')]">
  42. <span class="icon task-status--finish-icon"></span>
  43. <span class="task-status--finish-font">{{ scope.row.status == 0 ? '待提交' : scope.row.status == 1 ? '提交中' :
  44. scope.row.status == 2 ? '提交完成' : '' }} </span>
  45. </span>
  46. <span class="opt-link" v-if="scope.row.status == 2"> 成功:{{ scope.row.success_num }} 失败:{{ scope.row.fail_num
  47. }} </span>
  48. </div>
  49. <div v-else-if="item.prop == 'operate'">
  50. <span class="opt-link rMar10 pointer" @click="goDetail(scope.row.id)"> 详情 </span>
  51. <el-popconfirm title="确定要删除该任务?" @confirm="deleteTask(scope.row.id)">
  52. <template #reference>
  53. <span class="opt-link pointer"> 删除 </span>
  54. </template>
  55. </el-popconfirm>
  56. </div>
  57. <!-- 其他 -->
  58. <div class="cellDiv" v-else>
  59. <el-tooltip :disabled="!(scope.row[item.prop] && scope.row[item.prop].length > 30)" effect="dark"
  60. :content="scope.row[item.prop] + ''">
  61. <div class="clampTwo line21" style="flex: 1">
  62. {{ scope.row[item.prop] || scope.row[item.prop] == 0 ? scope.row[item.prop] : '-' }}
  63. </div>
  64. </el-tooltip>
  65. </div>
  66. </template>
  67. </el-table-column>
  68. </template>
  69. </el-table>
  70. <div class="paginationBox flex" style="justify-content: center" v-if="Number(tableInfo.total) > 0">
  71. <el-pagination v-model:currentPage="tableInfo.currentPage" v-model:page-size="tableInfo.pageSize" background
  72. :total="tableInfo.total" @current-change="handleCurrentChange" />
  73. </div>
  74. <!-- 修改任务名称 -->
  75. <EditTaskName ref="EditTaskNameRef" @confirm="EditTaskNameConfig"></EditTaskName>
  76. <!-- 任务详情 -->
  77. <Detail ref="DetailRef"></Detail>
  78. </template>
  79. <script setup lang="ts">
  80. import Input from '@/components/capsulationMoudle/_input.vue'
  81. import Select from '@/components/capsulationMoudle/_select.vue'
  82. import TimeScreen from '@/components/capsulationMoudle/timeScreen.vue'
  83. import { exportDefine } from './ts/define'
  84. import { onBeforeMount } from 'vue'
  85. import { getTaskList, adTaskDel, adTaskEdit } from './ts/api'
  86. import { ElMessage } from 'element-plus'
  87. import EditTaskName from './dialog/editTaskName.vue'
  88. import Detail from './detail/index.vue'
  89. const {
  90. DetailRef,
  91. EditTaskNameRef,
  92. InputRef_text,
  93. acRef,
  94. statusRef,
  95. timeRef,
  96. loading,
  97. tableInfo,
  98. pageInfo,
  99. init_acList,
  100. clearEvent,
  101. tableHeaderStyle,
  102. } = exportDefine()
  103. onBeforeMount(async () => {
  104. await init_acList()
  105. await init()
  106. })
  107. /**init */
  108. const init = (page?: number) => {
  109. loading.value = true
  110. const paramsModel = {
  111. account_id: acRef.value!.value,
  112. keyword: InputRef_text.value!.value,
  113. status: statusRef.value!.value,
  114. start: timeRef.value!.dateVal && timeRef.value!.dateVal[0],
  115. end: timeRef.value!.dateVal && timeRef.value!.dateVal[1],
  116. page: page ? page : 1,
  117. pageSize: tableInfo.pageSize
  118. }
  119. getTaskList(paramsModel).then((res: any) => {
  120. loading.value = false
  121. tableInfo.tableList = res.data;
  122. tableInfo.total = res.pageInfo.total;
  123. tableInfo.totalPages = res.pageInfo.totalPages;
  124. }).catch(() => { loading.value = false })
  125. }
  126. /**分页 */
  127. const handleCurrentChange = (val) => {
  128. tableInfo.currentPage = val
  129. init(val)
  130. }
  131. /**详情 */
  132. const goDetail = (id) => {
  133. DetailRef.value?.switchShow(true,id)
  134. }
  135. /**删除任务 */
  136. const deleteTask = (id) => {
  137. loading.value = true
  138. adTaskDel({ task_id: id }).then(() => {
  139. ElMessage.success('删除成功!')
  140. init(tableInfo.currentPage)
  141. }).catch(() => { loading.value = false })
  142. }
  143. /**修改任务名称 */
  144. const editNameEvent = (info) => {
  145. EditTaskNameRef.value?.switchShow(true, {
  146. task_id: info.id,
  147. name: info.name
  148. })
  149. }
  150. const EditTaskNameConfig = (info) => {
  151. loading.value = true
  152. adTaskEdit({
  153. task_id: info.task_id,
  154. name: info.name
  155. }).then(()=>{
  156. ElMessage.success('修改成功!')
  157. init(tableInfo.currentPage)
  158. }).catch(() => { loading.value = false })
  159. }
  160. </script>
  161. <style scoped lang="scss">
  162. .task-status {
  163. .icon {
  164. display: inline-block;
  165. width: 7px;
  166. height: 7px;
  167. margin-right: 8px;
  168. border-radius: 50%;
  169. }
  170. &.success {
  171. .icon {
  172. background-color: #28ba52;
  173. }
  174. color: #28ba52;
  175. }
  176. &.fail {
  177. .icon {
  178. background-color: #ec5f2e;
  179. }
  180. color: #ec5f2e;
  181. }
  182. }
  183. .opt-link {
  184. color: #197afb;
  185. text-decoration: none;
  186. }</style>