index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <div>
  3. <basicLayout
  4. ref="basicLayout"
  5. :oldFormPath="{
  6. add:'HManagement/archives_ad/modules',
  7. }"
  8. tableName="listTable"
  9. idName="sat_sharematerialid"
  10. :apiId="{query:20221102143102,del:20221102143602}"
  11. :options="options"
  12. @listData="listData"
  13. >
  14. <div slot="custom">
  15. </div>
  16. <div slot="titleRight" style="display:flex;margin-left:10px">
  17. </div>
  18. <template v-slot:tbList="scope">
  19. <div v-if="scope.data.column.columnname === 'status'">
  20. <span :style="scope.data.column.data.status === '审核' ? 'color:#52C41A' : ''">{{
  21. scope.data.column.data.status == '审核' ? '发布' : scope.data.column.data.status
  22. }}</span>
  23. </div>
  24. <p v-else-if="scope.data.column.columnname === 'title'">
  25. 【{{ getType(scope.data.column.data.type) }}】{{ scope.data.column.data.title }}
  26. </p>
  27. <div v-else>
  28. {{scope.data.column.data[[scope.data.column.columnname]]}}
  29. </div>
  30. </template>
  31. <template v-slot:tbOpreation="scope">
  32. <el-button class="inline-16" type="text" size="mini" @click="openDetail(scope.data.data)">详 情</el-button>
  33. <release :data="scope.data.data" @onSuccess="$refs.basicLayout.listData()" />
  34. <el-button v-if="tool.checkAuth($route.name,'update')" type="text" size="mini" :disabled="scope.data.data.status == '发布' || scope.data.data.status == '审核'" @click="EditBtn(scope.data.data)">编 辑</el-button>
  35. <el-button v-if="tool.checkAuth($route.name,'data_analysis')" type="text" class="inline-16" size="mini" @click="dataCalc(scope.data.data)">数 据 统 计</el-button>
  36. <on-del v-if="tool.checkAuth($route.name,'delete')" :disabled="scope.data.data.status == '发布' || scope.data.data.status == '审核'" :data="scope.data.data" @onSuccess="$refs.basicLayout.listData()" />
  37. </template>
  38. </basicLayout>
  39. <detail ref="detail" v-if="currentFile && tool.checkAuth($route.name, 'read')" :currentSelectFile="currentFile">
  40. </detail>
  41. <!--抽屉面板-->
  42. <el-drawer
  43. title="我是标题"
  44. :visible.sync="drawer"
  45. :with-header="false"
  46. direction="rtl"
  47. size="90%"
  48. append-to-body
  49. @close="closeDrawer">
  50. <div class="detail__panel">
  51. <router-view/>
  52. </div>
  53. </el-drawer>
  54. </div>
  55. </template>
  56. <script>
  57. import detail from '@/SManagement/archives_ad/components/detail'
  58. import onDel from './modules/delete.vue'
  59. import release from './modules/release.vue'
  60. import {mapGetters} from 'vuex'
  61. import { log } from '@antv/g2plot/lib/utils'
  62. export default {
  63. components:{
  64. detail,
  65. onDel,
  66. release
  67. },
  68. data () {
  69. return {
  70. options:[
  71. ],
  72. currentFile: {},
  73. drawer:false
  74. }
  75. },
  76. watch: {
  77. $route (val) {
  78. if (val.path == '/archives_adlist') {
  79. this.$refs.basicLayout.listData()
  80. }
  81. },
  82. DrawerShow (val) {
  83. val ? this.drawer = true : this.drawer = false
  84. }
  85. },
  86. computed: {
  87. ...mapGetters({
  88. DrawerShow:'DrawerShow'
  89. })
  90. },
  91. methods:{
  92. closeDrawer () {
  93. this.$router.push('/archives_adlist')
  94. this.$store.dispatch('DrawerShowChange',false)
  95. },
  96. /* 新建的数据批量删除 */
  97. listData (data) {
  98. console.log(data);
  99. let initID = '9999' + JSON.parse(window.sessionStorage.getItem("active_account")).userid;
  100. let deleteList = [];
  101. data.forEach(v => (initID == v.sat_sharematerial_classid && v.title == '') ? deleteList.push(v.sat_sharematerialid) : '');
  102. if (deleteList.length != 0) this.handleDelete(deleteList);
  103. },
  104. /* 处理批量删除 */
  105. handleDelete(list) {
  106. this.$api.requested({
  107. "id": 20221102143602,
  108. "content": {
  109. "sat_sharematerialids": list
  110. }
  111. }).then(res => {
  112. console.log("处理删除", res);
  113. if (res.msg == '成功') this.$refs.basicLayout.listData()
  114. })
  115. },
  116. getType(type) {
  117. if (type == 1) {
  118. return '图片'
  119. } else if (type == 2) {
  120. return '视频'
  121. } else if (type == 3) {
  122. return '图文'
  123. }
  124. },
  125. /* 打开详情 */
  126. openDetail (data) {
  127. let param = {
  128. "classname": "saletool.sharematerial.sharematerial",
  129. "method": "selectDetail",
  130. "content": {
  131. "sat_sharematerialid": data.sat_sharematerialid
  132. }
  133. }
  134. this.$api.requested(param).then(res => {
  135. res.data.attinfos = this.fileType.fileList(res.data.attinfos)
  136. this.currentFile = res.data
  137. this.$nextTick(() => {
  138. this.$refs.detail.isFileInfoPanlShow = true
  139. })
  140. })
  141. },
  142. EditBtn (data) {
  143. this.$store.dispatch('pageOnlyRead',false)
  144. window.sessionStorage.setItem('newMaterial', JSON.stringify(data))
  145. this.$store.dispatch('DrawerShowChange',true)
  146. this.$router.push({path:'/upload_archives',query:{id:data.sat_sharematerialid}})
  147. },
  148. dataCalc (data) {
  149. window.sessionStorage.setItem('newMaterial', JSON.stringify(data))
  150. this.$store.dispatch('DrawerShowChange',true)
  151. this.$router.push({path:'/archives_ad_analysis',query:{id:data.sat_sharematerialid}})
  152. }
  153. }
  154. }
  155. </script>
  156. <style>
  157. </style>