企微助手 ,仓库名 短剧

publicTable.vue 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div>
  3. <!-- table -->
  4. <el-table v-loading="loading" ref="multipleTable"
  5. border
  6. :height='height'
  7. :data="tableData"
  8. tooltip-effect="dark"
  9. :header-cell-style="()=>{return { backgroundColor: '#f9f9f9 !important' }}"
  10. style="width: 100%">
  11. <template v-for="item in propsData.desCol">
  12. <el-table-column :key="item.prop" :label="item.label" align="center"
  13. :show-overflow-tooltip="item.showOverTooltip"
  14. :min-width="item.min_width?item.min_width:110">
  15. <template #header v-if="item.tooltip">
  16. {{item.label?item.label:'-'}}
  17. <el-tooltip class="disinblock" :content="item.tooltip" placement="top">
  18. <i class="el-icon-question"></i>
  19. </el-tooltip>
  20. </template>
  21. <template slot-scope="scope">
  22. <div v-if="item.prop=='type'">
  23. <span v-if="scope.row.type==1">链接</span>
  24. <span v-else-if="scope.row.type==2">PDF</span>
  25. <span v-else-if="scope.row.type==3">图片</span>
  26. <span v-else-if="scope.row.type==4">视频</span>
  27. <span v-else="scope.row.type==1">-</span>
  28. </div>
  29. <div v-else-if="item.prop=='tag_list'">
  30. <template v-if="scope.row.tag_list&&scope.row.tag_list.length==0 || !scope.row.tag_list">-</template>
  31. <div class="customerServiceTagBox biaoqian" v-else>
  32. <div class="customerServiceTag" v-for="(item,index) in scope.row.tag_list" :key="index+'biaoqian'">{{item}}</div>
  33. </div>
  34. </div>
  35. <div v-else>{{scope.row[item.prop] ||scope.row[item.prop]==0 ? scope.row[item.prop] : '-'}}</div>
  36. </template>
  37. </el-table-column>
  38. </template>
  39. <template v-if="propsData.source=='radarIndex'">
  40. <el-table-column label="操作" align="center" min-width="180px">
  41. <template slot-scope="scope">
  42. <div class="flex">
  43. <div class="c-00B38A pointer">编辑</div>
  44. <el-popconfirm @confirm="deleRadar(scope.row.radar_id)" :title="`确定删除【${scope.row.name}】渠道活码?`">
  45. <div slot="reference" class="c-00B38A pointer lMar8">删除</div>
  46. </el-popconfirm>
  47. <div class="c-00B38A pointer lMar8" @click="goDataAanlyse(scope.row.radar_id)">分析数据</div>
  48. </div>
  49. </template>
  50. </el-table-column>
  51. </template>
  52. </el-table>
  53. <div class="pagination" v-show="total>0">
  54. <el-pagination background :current-page="page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count='Number(pages)'>
  55. </el-pagination>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. export default {
  61. name: "publicTable",
  62. props:['propsData'],
  63. data(){
  64. return{
  65. loading: false,
  66. dataLoading: false,
  67. page: 1,
  68. pages: 0,
  69. total: 0,
  70. page_size: 20,
  71. height: '',
  72. tableData:[]
  73. }
  74. },
  75. watch:{
  76. 'propsData.initFlag'(){
  77. this.source_init()
  78. }
  79. },
  80. created() {
  81. this.height = document.documentElement.clientHeight - 300 > 400 ? document.documentElement.clientHeight - 300 : 400
  82. this.source_init()
  83. },
  84. methods:{
  85. source_init(val){
  86. val=val?val:1
  87. if(this.propsData.source=='radarIndex'){
  88. this.init(val)
  89. this.height = document.documentElement.clientHeight - 220 > 400 ? document.documentElement.clientHeight - 220 : 400
  90. }else if(this.propsData.source=='channelAnalyse'){
  91. this.tableData = this.propsData.tableData
  92. }
  93. },
  94. goDataAanlyse(id){
  95. this.$router.push('/radar_dataAnalyse/'+id)
  96. },
  97. deleRadar(id){
  98. this.loading = true
  99. this.$axios.post(this.URL.BASEURL + this.URL.radar_radarDele, {
  100. radar_id:id
  101. }).then((res) => {
  102. var res = res.data
  103. this.loading = false
  104. this.$message({
  105. message: res.err,
  106. type: "warning"
  107. })
  108. if (res && res.errno == 0) {
  109. this.init(1)
  110. }
  111. }).catch((err) => {
  112. this.loading = false
  113. });
  114. },
  115. init (page) {
  116. this.page = page ? page : this.page;
  117. this.loading = true
  118. this.$axios.get(this.URL.BASEURL + this.URL.radar_radarList, {
  119. params:{
  120. group_id:this.propsData.group_id,
  121. name:this.propsData.radar_val,
  122. page: this.page,
  123. pagesize: this.page_size,
  124. }
  125. }).then((res) => {
  126. var res = res.data
  127. this.loading = false
  128. if (res && res.errno == 0) {
  129. this.tableData = res.rst.data
  130. this.total = res.rst.pageInfo.total;
  131. this.pages = res.rst.pageInfo.pages;
  132. } else if (res.errno != 4002) {
  133. this.$message({
  134. message: res.err,
  135. type: "warning"
  136. })
  137. }
  138. }).catch((err) => {
  139. this.loading = false
  140. });
  141. },
  142. handleCurrentChange (val) {
  143. this.source_init(val)
  144. },
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. </style>