企微助手 ,仓库名 短剧

pitcherList.vue 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div v-loading="loading" class="container">
  3. <el-table ref="multipleTable" :data="infoList" tooltip-effect="dark" style="width: 100%" :header-cell-style="headerColor">
  4. <el-table-column prop="drama_name" label="短剧" show-overflow-tooltip align="center"></el-table-column>
  5. <el-table-column prop="user_name" min-width="160" label="推手" show-overflow-tooltip align="center"></el-table-column>
  6. <el-table-column min-width="200" label="日期" align="center">
  7. <template slot-scope="scope">
  8. <div>{{scope.row.start_date + ' - ' + scope.row.end_date}}</div>
  9. </template>
  10. </el-table-column>
  11. <el-table-column label="状态" align="center">
  12. <template slot-scope="scope">
  13. <span v-if="scope.row.enable==1" class="c-448AFF">启用</span>
  14. <span v-else class="c-F03F5C">禁用</span>
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="操作" min-width="160" align="center">
  18. <template slot-scope="scope">
  19. <el-button type="primary" size="mini" @click="editEvent(scope.row)">编辑</el-button>
  20. <el-button type="danger" size="mini" v-if="scope.row.enable==1" @click="enableEvent(scope.row,0)">禁用</el-button>
  21. <el-button type="primary" size="mini" v-else @click="enableEvent(scope.row,1)">启用</el-button>
  22. </template>
  23. </el-table-column>
  24. </el-table>
  25. <div class="pagination" v-show="total>0">
  26. <el-pagination background :current-page="page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count='Number(pages)'>
  27. </el-pagination>
  28. </div>
  29. <!-- 编辑投手 -->
  30. <el-dialog class="dialogCon_permission" title="编辑投手" :visible.sync="editTsFlag" :append-to-body="true" width="400px">
  31. <addPitcher :gzhData='gzhData' :editPitcher='editPitcher' v-if="editTsFlag" @returnAddPitcher="returnAddPitcher"></addPitcher>
  32. </el-dialog>
  33. </div>
  34. </template>
  35. <script>
  36. import addPitcher from './addPitcher.vue'
  37. export default {
  38. props: ['gzhData'],
  39. components: { addPitcher },
  40. data () {
  41. return {
  42. infoList: [],
  43. loading: false,
  44. page: 1,
  45. pages: 0,
  46. total: 0,
  47. page_size: 40,
  48. editTsFlag: false,
  49. editPitcher: {}
  50. }
  51. },
  52. created () {
  53. this.init(1)
  54. },
  55. methods: {
  56. async enableEvent ({ drama_id, user_id, start_date, end_date, rela_id }, type) {//启用/禁用
  57. try {
  58. const params = { drama_id, user_id, start_date, end_date, rela_id, enable: type }
  59. this.loading = true
  60. const { data: res = {} } = await this.$axios.post(this.URL.BASEURL + this.URL.adqAccount_adqEditPitcher, params)
  61. if (res && res.errno == 0) {
  62. this.init(this.page)
  63. this.$message.success('操作成功')
  64. } else if (res.errno != 4002) {
  65. this.$message.warning(res.err)
  66. }
  67. } catch (error) {
  68. console.log('error => ', error)
  69. } finally {
  70. this.loading = false
  71. }
  72. },
  73. editEvent (data) {
  74. this.editPitcher = data;
  75. this.editTsFlag = true
  76. },
  77. returnAddPitcher (val) {//编辑投手回调
  78. this.editTsFlag = false
  79. if (val == 'update') {
  80. this.init(this.page)
  81. }
  82. },
  83. async init(page) {
  84. try {
  85. this.page = page ? page : this.page;
  86. this.loading = true
  87. const { data: res = {} } = await this.$axios.get(this.URL.BASEURL + this.URL.adqAccount_adqPitcherIndex, {
  88. params: {
  89. account_id: this.gzhData.account_id,
  90. page: this.page,
  91. page_size: this.page_size
  92. }
  93. })
  94. if (res && res.errno == 0) {
  95. this.infoList = res.rst.data;
  96. this.total = res.rst.pageInfo.total;
  97. this.pages = res.rst.pageInfo.pages;
  98. } else if (res.errno != 4002) {
  99. this.$message.warning(res.err)
  100. }
  101. } catch (error) {
  102. console.log('error => ', error)
  103. } finally {
  104. this.loading = false
  105. }
  106. },
  107. handleCurrentChange (val) {
  108. this.init(val)
  109. },
  110. headerColor (rowIndex) {
  111. if (rowIndex === 0) {
  112. return { background: "#ebeef5", };
  113. } else {
  114. return { background: "#ebeef5", };
  115. }
  116. },
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .container {
  122. padding: 0 10px;
  123. }
  124. </style>