task.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="直播间ID" prop="liveId">
  5. <el-input
  6. v-model="queryParams.liveId"
  7. placeholder="请输入直播间ID"
  8. clearable
  9. :disabled="liveAbled"
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="任务名称" prop="taskName">
  15. <el-input
  16. v-model="queryParams.taskName"
  17. placeholder="请输入任务名称"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="任务类型" prop="taskType">
  24. <el-select v-model="queryParams.taskType" placeholder="请选择任务类型" clearable size="small">
  25. <el-option v-for="i in taskTypeOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
  26. </el-select>
  27. </el-form-item>
  28. <!-- <el-form-item label="触发类型" prop="triggerType">-->
  29. <!-- <el-select v-model="queryParams.triggerType" placeholder="请选择触发类型" clearable size="small">-->
  30. <!-- <el-option v-for="i in triggerTypeOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>-->
  31. <!-- </el-select>-->
  32. <!-- </el-form-item>-->
  33. <el-form-item label="状态" prop="status">
  34. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  35. <el-option v-for="i in statusOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  40. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  41. </el-form-item>
  42. </el-form>
  43. <el-row :gutter="10" class="mb8">
  44. <el-col :span="1.5">
  45. <el-button
  46. type="primary"
  47. plain
  48. icon="el-icon-plus"
  49. size="mini"
  50. @click="handleAdd"
  51. v-hasPermi="['live:task:add']"
  52. >新增</el-button>
  53. </el-col>
  54. <el-col :span="1.5">
  55. <el-button
  56. type="success"
  57. plain
  58. icon="el-icon-edit"
  59. size="mini"
  60. :disabled="single"
  61. @click="handleUpdate"
  62. v-hasPermi="['live:task:edit']"
  63. >修改</el-button>
  64. </el-col>
  65. <el-col :span="1.5">
  66. <el-button
  67. type="danger"
  68. plain
  69. icon="el-icon-delete"
  70. size="mini"
  71. :disabled="multiple"
  72. @click="handleDelete"
  73. v-hasPermi="['live:task:remove']"
  74. >删除</el-button>
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="warning"
  79. plain
  80. icon="el-icon-download"
  81. size="mini"
  82. :loading="exportLoading"
  83. @click="handleExport"
  84. v-hasPermi="['live:task:export']"
  85. >导出</el-button>
  86. </el-col>
  87. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  88. </el-row>
  89. <el-table border v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
  90. <el-table-column type="selection" width="55" align="center" />
  91. <el-table-column label="编号" align="center" prop="id" />
  92. <el-table-column label="任务名称" align="center" prop="taskName" />
  93. <el-table-column label="任务类型" align="center" prop="taskType" :formatter="taskTypeFormatter" />
  94. <el-table-column label="触发类型" align="center" prop="triggerType" :formatter="triggerTypeFormatter" />
  95. <el-table-column label="触发时间" align="center" prop="triggerValue" :formatter="triggerValueFormatter" />
  96. <el-table-column label="产品名称" align="center" prop="productName" :formatter="productNameFormatter" />
  97. <el-table-column label="状态" align="center" prop="status" :formatter="statusFormatter" />
  98. <el-table-column label="创建时间" align="center" prop="createdTime" width="180">
  99. <template slot-scope="scope">
  100. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="更新时间" align="center" prop="updatedTime" width="180">
  104. <template slot-scope="scope">
  105. <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  109. <template slot-scope="scope">
  110. <el-button
  111. size="mini"
  112. type="text"
  113. icon="el-icon-edit"
  114. @click="handleUpdate(scope.row)"
  115. v-hasPermi="['live:task:edit']"
  116. >修改</el-button>
  117. <el-button
  118. size="mini"
  119. type="text"
  120. icon="el-icon-delete"
  121. @click="handleDelete(scope.row)"
  122. v-hasPermi="['live:task:remove']"
  123. >删除</el-button>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. <pagination
  128. v-show="total>0"
  129. :total="total"
  130. :page.sync="queryParams.pageNum"
  131. :limit.sync="queryParams.pageSize"
  132. @pagination="getList"
  133. />
  134. <!-- 添加或修改直播间自动化任务配置对话框 -->
  135. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  136. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  137. <el-form-item label="直播间ID" prop="liveId">
  138. <el-input :disabled="liveAbled" v-model="form.liveId" placeholder="请输入直播间ID" />
  139. </el-form-item>
  140. <el-form-item label="任务名称" prop="taskName">
  141. <el-input v-model="form.taskName" placeholder="请输入任务名称" />
  142. </el-form-item>
  143. <el-form-item label="任务类型" prop="taskType">
  144. <el-select v-model="form.taskType" placeholder="请选择任务类型" @change="updateTaskType()">
  145. <el-option v-for="i in taskTypeOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
  146. </el-select>
  147. </el-form-item>
  148. <el-form-item label="商品选择" prop="content" v-if="form.taskType == 1">
  149. <el-select v-model="form.content" placeholder="请选择商品" ref="selectRef" >
  150. <el-option v-for="i in productOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
  151. <!-- 加载载中状态 -->
  152. <div v-if="isLoading" class="loading-indicator">
  153. <i class="el-icon-loading"></i>
  154. <span>加载中...</span>
  155. </div>
  156. <!-- 没有更多数据 -->
  157. <div v-if="!hasMore && !isLoading" class="no-more">
  158. 没有更多数据了
  159. </div>
  160. </el-select>
  161. </el-form-item>
  162. <el-form-item label="红包选择" prop="content" v-if="form.taskType == 2">
  163. <el-select v-model="form.content" placeholder="请选择红包" ref="selectRef" >
  164. <el-option v-for="i in redOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
  165. <!-- 加载载中状态 -->
  166. <div v-if="isLoading" class="loading-indicator">
  167. <i class="el-icon-loading"></i>
  168. <span>加载中...</span>
  169. </div>
  170. <!-- 没有更多数据 -->
  171. <div v-if="!hasMore && !isLoading" class="no-more">
  172. 没有更多数据了
  173. </div>
  174. </el-select>
  175. </el-form-item>
  176. <el-form-item label="抽奖选择" prop="content" v-if="form.taskType == 4">
  177. <el-select v-model="form.content" placeholder="请选择抽奖" ref="selectRef" >
  178. <el-option v-for="i in lotteryOptions" :key="i.value" :label="i.label" :value="i.value"></el-option>
  179. <!-- 加载载中状态 -->
  180. <div v-if="isLoading" class="loading-indicator">
  181. <i class="el-icon-loading"></i>
  182. <span>加载中...</span>
  183. </div>
  184. <!-- 没有更多数据 -->
  185. <div v-if="!hasMore && !isLoading" class="no-more">
  186. 没有更多数据了
  187. </div>
  188. </el-select>
  189. </el-form-item>
  190. <el-form-item label="触发时间" prop="content">
  191. <el-time-picker
  192. default-value="2025-01-01 00:00:00"
  193. v-model="form.triggerValue"
  194. :picker-options="{
  195. selectableRange: '00:00:00 - 23:59:59'
  196. }"
  197. placeholder="任意时间点">
  198. </el-time-picker>
  199. </el-form-item>
  200. <!-- <el-form-item label="触发类型" prop="triggerType">-->
  201. <!-- <el-select v-model="form.triggerType" placeholder="请选择触发类型">-->
  202. <!-- <el-option label="请选择字典生成" value="" />-->
  203. <!-- </el-select>-->
  204. <!-- </el-form-item>-->
  205. <!-- <el-form-item label="触发值" prop="triggerValue">-->
  206. <!-- <el-input v-model="form.triggerValue" placeholder="请输入触发值" />-->
  207. <!-- </el-form-item>-->
  208. <!-- <el-form-item label="任务内容">-->
  209. <!-- <editor v-model="form.content" :min-height="192"/>-->
  210. <!-- </el-form-item>-->
  211. <el-form-item label="状态">
  212. <el-radio-group v-model="form.status">
  213. <el-radio :label="1">启用</el-radio>
  214. <el-radio :label="0">禁用</el-radio>
  215. </el-radio-group>
  216. </el-form-item>
  217. </el-form>
  218. <div slot="footer" class="dialog-footer">
  219. <el-button type="primary" @click="submitForm">确 定</el-button>
  220. <el-button @click="cancel">取 消</el-button>
  221. </div>
  222. </el-dialog>
  223. </div>
  224. </template>
  225. <script>
  226. import { listTask, getTask, delTask, addTask, updateTask, exportTask } from "@/api/live/task";
  227. import {listLiveGoods} from "@/api/live/liveGoods";
  228. import {listLiveRedConfOn} from "@/api/live/liveRedConf";
  229. import {listLiveLotteryConfOn} from "@/api/live/liveLotteryConf";
  230. export default {
  231. name: "Task",
  232. data() {
  233. return {
  234. taskTypeOptions:[
  235. {
  236. value: 1,
  237. label: "定时卡片推荐商品"
  238. },
  239. {
  240. value: 2,
  241. label: "定时红包发送"
  242. },
  243. {
  244. value: 4,
  245. label: "定时抽奖"
  246. },
  247. ],
  248. statusOptions:[{
  249. value: "0",
  250. label: "禁用"
  251. },
  252. {
  253. value: "1",
  254. label: "启用"
  255. }
  256. ],
  257. haveData:{
  258. goods:false,
  259. red:false,
  260. lottery:false
  261. },
  262. redOptions:[],
  263. lotteryOptions:[],
  264. productOptions:[],
  265. // 遮罩层
  266. loading: true,
  267. // 导出遮罩层
  268. exportLoading: false,
  269. // 选中数组
  270. ids: [],
  271. // 非单个禁用
  272. single: true,
  273. // 非多个禁用
  274. multiple: true,
  275. // 显示搜索条件
  276. showSearch: true,
  277. // 总条数
  278. total: 0,
  279. liveAbled: false,
  280. // 直播间自动化任务配置表格数据
  281. taskList: [],
  282. // 弹出层标题
  283. title: "",
  284. // 是否显示弹出层
  285. open: false,
  286. // 查询参数
  287. queryParams: {
  288. pageNum: 1,
  289. pageSize: 10,
  290. liveId: null,
  291. taskName: null,
  292. taskType: null,
  293. triggerType: null,
  294. triggerValue: null,
  295. content: null,
  296. status: null,
  297. createdTime: null,
  298. updatedTime: null
  299. },
  300. // 表单参数
  301. form: {},
  302. // 表单校验
  303. rules: {
  304. liveId: [
  305. { required: true, message: "直播间ID不能为空", trigger: "blur" }
  306. ],
  307. taskName: [
  308. { required: true, message: "任务名称不能为空", trigger: "blur" }
  309. ],
  310. taskType: [
  311. { required: true, message: "任务类型:1-定时推送卡片商品 2-定时发送红包 ", trigger: "change" }
  312. ],
  313. triggerType: [
  314. { required: true, message: "触发类型:相对直播开始时间不能为空", trigger: "change" }
  315. ],
  316. triggerValue: [
  317. { required: true, message: "触发值:绝对时间用yyyy-MM-dd HH:mm:ss,相对时间用分钟数不能为空", trigger: "blur" }
  318. ],
  319. status: [
  320. { required: true, message: "状态:0-禁用 1-启用不能为空", trigger: "blur" }
  321. ],
  322. createdTime: [
  323. { required: true, message: "创建时间不能为空", trigger: "blur" }
  324. ],
  325. updatedTime: [
  326. { required: true, message: "更新时间不能为空", trigger: "blur" }
  327. ]
  328. },
  329. liveId: null,
  330. listParams: {
  331. pageNum: 1,
  332. pageSize: 10,
  333. liveId: null
  334. },
  335. isLoading: false, // 是否正在加载
  336. hasMore: true, // 是否还有更多数据
  337. socket:null ,
  338. };
  339. },
  340. watch: {
  341. // 监听路由的 query 参数变化
  342. '$route.query': {
  343. handler(newQuery) {
  344. if (this.$route.params.liveId) {
  345. this.liveId = this.$route.params.liveId;
  346. }else {
  347. this.liveId = this.$route.query.liveId;
  348. }
  349. if(this.liveId == null) {
  350. return;
  351. }
  352. this.liveAbled = true
  353. if(this.liveId == null) {
  354. return;
  355. }
  356. this.queryParams.liveId = this.liveId;
  357. this.getList();
  358. },
  359. // 初始化时立即执行一次
  360. immediate: true
  361. }
  362. },
  363. created() {
  364. this.socket = this.$store.state.liveWs[this.liveId]
  365. },
  366. methods: {
  367. statusFormatter(row, column, value){
  368. if (!value) return '--'; // 空值处理
  369. switch ( value){
  370. case 0:
  371. return "禁用";
  372. case 1:
  373. return "启用";
  374. default:
  375. return "--";
  376. }
  377. },
  378. taskTypeFormatter(row, column, value){
  379. if (!value) return '--'; // 空值处理
  380. switch (value) {
  381. case 1:
  382. return "定时推送卡片商品";
  383. case 2:
  384. return "定时发送红包";
  385. case 4:
  386. return "定时抽奖";
  387. default:
  388. return "--";
  389. }
  390. },
  391. triggerTypeFormatter(row, column, value){
  392. if (!value) return '--'; // 空值处理
  393. switch (value) {
  394. case 1:
  395. return "相对直播开始时间";
  396. case 2:
  397. return "相对时间";
  398. default:
  399. return "--";
  400. }
  401. },
  402. productNameFormatter(row, column, value){
  403. let content = JSON.parse(row.content)
  404. if(content.productName) {
  405. return content.productName
  406. }
  407. return "--";
  408. },
  409. triggerValueFormatter(row, column, value) {
  410. if (!value) return '--'; // 空值处理
  411. // 创建日期对象(兼容时间戳和字符串)
  412. let date;
  413. if (typeof value === 'number') {
  414. // 处理时间戳(注意:如果是10位时间戳需要乘以1000)
  415. date = new Date(value.toString().length === 10 ? value * 1000 : value);
  416. } else if (typeof value === 'string') {
  417. // 处理字符串格式(尝试直接转换)
  418. date = new Date(value);
  419. } else {
  420. return '格式错误';
  421. }
  422. // 检查日期是否有效
  423. if (isNaN(date.getTime())) {
  424. return '无效时间';
  425. }
  426. // 格式化日期为 "yyyy-MM-dd HH:mm:ss"
  427. const hours = String(date.getHours()).padStart(2, '0');
  428. const minutes = String(date.getMinutes()).padStart(2, '0');
  429. const seconds = String(date.getSeconds()).padStart(2, '0');
  430. return `${hours}:${minutes}:${seconds}`;
  431. },
  432. async updateTaskType(){
  433. this.hasMore = true;
  434. this.listParams = {
  435. pageNum: 1,
  436. pageSize: 10,
  437. liveId: null
  438. }
  439. if (this.isLoading || !this.hasMore) return;
  440. this.isLoading = true;
  441. this.listParams.liveId = this.liveId;
  442. if(this.listParams.liveId == null) {
  443. this.$message.error("页面错误,请联系管理员");
  444. return;
  445. }
  446. try{
  447. if (this.form.taskType == 1) {
  448. await this.addGoodsList();
  449. }else if (this.form.taskType == 2) {
  450. await this.addRedList();
  451. }else if (this.form.taskType == 4) {
  452. await this.addLotteryList();
  453. }
  454. }catch ( err){
  455. console.error('加载数据失败:', err);
  456. }finally {
  457. this.isLoading = false;
  458. }
  459. },
  460. addGoodsList() {
  461. if(this.haveData.goods) return
  462. listLiveGoods(this.listParams).then(res => {
  463. if(res.rows.length > 0) {
  464. res.rows.forEach(item => {
  465. // 根据productName和goodsId组装成为label和value
  466. this.productOptions.push({
  467. value: item.goodsId,
  468. label: item.productName
  469. })
  470. })
  471. this.listParams.pageNum++;
  472. // 判断是否还有更多数据
  473. this.hasMore = this.productOptions.length < res.total;
  474. if (this.hasMore) {
  475. this.addGoodsList();
  476. } else {
  477. this.haveData.goods = true;
  478. }
  479. } else {
  480. this.hasMore = false;
  481. this.haveData.goods = true;
  482. }
  483. });
  484. },
  485. addRedList() {
  486. if(this.haveData.red) return
  487. listLiveRedConfOn(this.listParams).then(res => {
  488. if(res.rows.length > 0) {
  489. res.rows.forEach(item => {
  490. // 根据productName和goodsId组装成为label和value
  491. this.redOptions.push({
  492. value: item.redId,
  493. label: item.desc
  494. })
  495. })
  496. this.listParams.pageNum++;
  497. // 判断是否还有更多数据
  498. this.hasMore = this.redOptions.length < res.total;
  499. if (this.hasMore) {
  500. this.addRedList();
  501. } else {
  502. this.haveData.red = true
  503. }
  504. } else {
  505. this.haveData.red = true
  506. this.hasMore = false;
  507. }
  508. });
  509. },
  510. addLotteryList() {
  511. if(this.haveData.lottery) return
  512. listLiveLotteryConfOn(this.listParams).then(res => {
  513. if(res.rows.length > 0) {
  514. res.rows.forEach(item => {
  515. // 根据productName和goodsId组装成为label和value
  516. this.lotteryOptions.push({
  517. value: item.lotteryId,
  518. label: item.desc
  519. })
  520. })
  521. this.listParams.pageNum++;
  522. // 判断是否还有更多数据
  523. this.hasMore = this.lotteryOptions.length < res.total;
  524. if (this.hasMore) {
  525. this.addRedList();
  526. } else {
  527. this.haveData.lottery = true
  528. }
  529. } else {
  530. this.haveData.lottery = true
  531. this.hasMore = false;
  532. }
  533. });
  534. },
  535. /** 查询直播间自动化任务配置列表 */
  536. getList() {
  537. if(this.liveId == null) {
  538. this.$message.error("页面错误,请联系管理员");
  539. return;
  540. }
  541. this.loading = true;
  542. listTask(this.queryParams).then(res => {
  543. this.taskList = res.rows;
  544. this.total = res.total;
  545. this.loading = false;
  546. });
  547. },
  548. // 取消按钮
  549. cancel() {
  550. this.open = false;
  551. this.reset();
  552. },
  553. // 表单重置
  554. reset() {
  555. this.form = {
  556. id: null,
  557. liveId: this.liveId,
  558. taskName: null,
  559. taskType: null,
  560. triggerType: null,
  561. triggerValue: null,
  562. content: null,
  563. status: 1,
  564. createdTime: null,
  565. updatedTime: null
  566. };
  567. this.listParams={
  568. pageNum: 1,
  569. pageSize: 10,
  570. liveId: this.liveId
  571. }
  572. this.hasMore = true;
  573. this.resetForm("form");
  574. },
  575. /** 搜索按钮操作 */
  576. handleQuery() {
  577. this.queryParams.pageNum = 1;
  578. this.getList();
  579. },
  580. /** 重置按钮操作 */
  581. resetQuery() {
  582. this.resetForm("queryForm");
  583. this.handleQuery();
  584. },
  585. // 多选框选中数据
  586. handleSelectionChange(selection) {
  587. this.ids = selection.map(item => item.id)
  588. this.single = selection.length!==1
  589. this.multiple = !selection.length
  590. },
  591. /** 新增按钮操作 */
  592. handleAdd() {
  593. this.reset();
  594. this.open = true;
  595. this.title = "添加直播间自动化任务配置";
  596. },
  597. /** 修改按钮操作 */
  598. async handleUpdate(row) {
  599. this.reset();
  600. if(row.taskType == 1){
  601. await this.addGoodsList();
  602. }else if(row.taskType == 2){
  603. await this.addRedList();
  604. }else if(row.taskType == 4){
  605. await this.addLotteryList();
  606. }
  607. const id = row.id || this.ids
  608. getTask(id).then(response => {
  609. this.form = response.data;
  610. let content = JSON.parse( response.data.content)
  611. if (this.form.taskType == 1) {
  612. this.form.content = content.goodsId;
  613. }else if (this.form.taskType == 2) {
  614. this.form.content = content.desc;
  615. }else if (this.form.taskType == 4) {
  616. this.form.content = content.desc;
  617. }
  618. this.open = true;
  619. this.title = "修改直播间自动化任务配置";
  620. });
  621. },
  622. /** 提交按钮 */
  623. submitForm() {
  624. this.form.liveId = this.liveId;
  625. if(this.liveId == null) {
  626. this.msgError("请选择直播间");
  627. return;
  628. }
  629. this.$refs["form"].validate(valid => {
  630. if (valid) {
  631. if (this.form.id != null) {
  632. updateTask(this.form).then(response => {
  633. this.msgSuccess("修改成功");
  634. this.open = false;
  635. this.getList();
  636. });
  637. } else {
  638. addTask(this.form).then(response => {
  639. this.msgSuccess("新增成功");
  640. this.open = false;
  641. this.getList();
  642. });
  643. }
  644. }
  645. });
  646. },
  647. /** 删除按钮操作 */
  648. handleDelete(row) {
  649. if(this.socket == null) {
  650. this.$message.error("请进入直播间后,在进行操作!")
  651. return;
  652. }
  653. const ids = row.id || this.ids;
  654. this.$confirm('是否确认删除直播间自动化任务配置编号为"' + ids + '"的数据项?', "警告", {
  655. confirmButtonText: "确定",
  656. cancelButtonText: "取消",
  657. type: "warning"
  658. }).then(function() {
  659. return delTask(ids);
  660. }).then(() => {
  661. this.getList();
  662. this.msgSuccess("删除成功");
  663. const msg={
  664. cmd:'delAutoTask',
  665. data:row.absValue,
  666. liveId:this.liveId,
  667. userType:1
  668. }
  669. this.socket.send(JSON.stringify( msg))
  670. }).catch(() => {});
  671. },
  672. /** 导出按钮操作 */
  673. handleExport() {
  674. const queryParams = this.queryParams;
  675. this.$confirm('是否确认导出所有直播间自动化任务配置数据项?', "警告", {
  676. confirmButtonText: "确定",
  677. cancelButtonText: "取消",
  678. type: "warning"
  679. }).then(() => {
  680. this.exportLoading = true;
  681. return exportTask(queryParams);
  682. }).then(response => {
  683. this.download(response.msg);
  684. this.exportLoading = false;
  685. }).catch(() => {});
  686. },
  687. }
  688. };
  689. </script>
  690. <style scoped>
  691. .loading-indicator {
  692. padding: 10px;
  693. text-align: center;
  694. color: #606266;
  695. font-size: 12px;
  696. display: flex;
  697. align-items: center;
  698. justify-content: center;
  699. }
  700. .loading-indicator .el-icon-loading {
  701. margin-right: 5px;
  702. animation: rotate 1s linear infinite;
  703. }
  704. .no-more {
  705. padding: 10px;
  706. text-align: center;
  707. color: #909399;
  708. font-size: 12px;
  709. }
  710. @keyframes rotate {
  711. from { transform: rotate(0deg); }
  712. to { transform: rotate(360deg); }
  713. }
  714. </style>