materialRank.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <div class="materialRank">
  3. <div class="optionLine">
  4. <span class="timedate">日期选择:</span>
  5. <a-range-picker :disabled-date="disabledDate" format="YYYY-MM-DD" style="width: 250px;" @change="dateChange"
  6. v-model="dateRange" />
  7. <span class="caozuoxitong">指标选择:</span>
  8. <a-select default-value="cost" style="width: 150px" @change="indexSelect">
  9. <a-select-option value="cost">消耗</a-select-option>
  10. <a-select-option value="click">点击数</a-select-option>
  11. <a-select-option value="showNum">展示数</a-select-option>
  12. <a-select-option value="convertRate">转化率</a-select-option>
  13. <a-select-option value="play3s">3s播放数</a-select-option>
  14. <a-select-option value="play10s">10s播放数</a-select-option>
  15. <a-select-option value="active">行为数</a-select-option>
  16. <a-select-option value="pay">支付数</a-select-option>
  17. <a-select-option value="residue">次留数</a-select-option>
  18. <a-select-option value="register">注册数</a-select-option>
  19. </a-select>
  20. <span class="caozuoxitong">排序规则:</span>
  21. <a-radio-group name="radioGroup" default-value="desc" @change="radioChange">
  22. <a-radio key="asc" value="asc">升序</a-radio>
  23. <a-radio key="desc" value="desc">降序</a-radio>
  24. </a-radio-group>
  25. <div class="btn">
  26. <a-button type='primary' @click="getData">查询</a-button>
  27. </div>
  28. </div>
  29. <a-table :columns="columns" :data-source="dataSource" tableLayout='auto' bordered :pagination='false' :loading='loading'>
  30. <div slot="videoU" slot-scope="test,records">
  31. <img :src="records.coverUrl" alt="" style="width:140px"
  32. @click="openVideo(records.url)">
  33. </div>
  34. <span slot="convertRate" slot-scope="convertRate">{{ convertRate | toPercentage }}</span>
  35. <span slot="operation" slot-scope="text,record">
  36. <a href="javascript:;" @click.stop="showRelevantPeople(record)">查看相关人员</a>
  37. </span>
  38. </a-table>
  39. <div class="fenye" :v-show="pageShow">
  40. <a-pagination showQuickJumper :default-current="pageNo" :total="total" size="small" style="float:right"
  41. @change="getDataSource" v-if="dataSource.length > 0" />
  42. <!-- <a-pagination size="small" :showTotal="ipagination.showTotal" style="float:right" v-if="dataSource.length > 0"
  43. showQuickJumper :pageSize.sync="ipagination.pageSize" :total="ipagination.total" v-model="ipagination.current"
  44. @change="getDataSource" /> -->
  45. </div>
  46. <a-modal v-model="Videovisible" title="视频详情" @ok="videoOk" :footer="null" width='50%'>
  47. <video @click.stop class="video" :src="videoUrl" controls="controls" style="height:600px;width:100%">您的浏览器不支持
  48. video 标签。</video>
  49. </a-modal>
  50. <a-modal v-model="relevantPeopleVisible" title="相关人员" :footer="null" :centered='true'>
  51. <p>编导:{{relevantPeopleData.planName || '暂无数据'}}</p>
  52. <p>剪辑:{{relevantPeopleData.clipName || '暂无数据'}}</p>
  53. <p>拍摄:{{relevantPeopleData.shotName || '暂无数据'}}</p>
  54. </a-modal>
  55. </div>
  56. </template>
  57. <script>
  58. import moment from 'moment'
  59. import {
  60. getAction,
  61. postAction,
  62. downFile,
  63. downFilePost
  64. } from '@/api/manage'
  65. let columns = [
  66. {
  67. title: '视频',
  68. dataIndex: 'videoU',
  69. align: 'center',
  70. width: 150,
  71. fixed: 'left',
  72. key: 'videoU',
  73. scopedSlots: {
  74. customRender: 'videoU'
  75. }
  76. },
  77. {
  78. title: '素材名',
  79. dataIndex: 'name',
  80. key: 'name',
  81. scopedSlots: {
  82. customRender: 'name'
  83. },
  84. align: 'center',
  85. },
  86. {
  87. title: '消耗',
  88. dataIndex: 'cost',
  89. key: 'cost',
  90. scopedSlots: {
  91. customRender: 'cost'
  92. },
  93. align: 'center',
  94. },
  95. {
  96. title: '点击数',
  97. dataIndex: 'click',
  98. key: 'click',
  99. scopedSlots: {
  100. customRender: 'click'
  101. },
  102. align: 'center',
  103. },
  104. {
  105. title: '展示数',
  106. dataIndex: 'showNum',
  107. key: 'showNum',
  108. scopedSlots: {
  109. customRender: 'showNum'
  110. },
  111. align: 'center',
  112. },
  113. {
  114. title: '3s播放数',
  115. dataIndex: 'play3s',
  116. key: 'play3s',
  117. scopedSlots: {
  118. customRender: 'play3s'
  119. },
  120. align: 'center',
  121. },
  122. {
  123. title: '10s播放数',
  124. dataIndex: 'play10s',
  125. key: 'play10s',
  126. scopedSlots: {
  127. customRender: 'play10s'
  128. },
  129. align: 'center',
  130. },
  131. {
  132. title: '行为数',
  133. dataIndex: 'active',
  134. key: 'active',
  135. scopedSlots: {
  136. customRender: 'active'
  137. },
  138. align: 'center',
  139. },
  140. {
  141. title: '支付数',
  142. dataIndex: 'pay',
  143. key: 'pay',
  144. scopedSlots: {
  145. customRender: 'pay'
  146. },
  147. align: 'center',
  148. },
  149. {
  150. title: '次留数',
  151. dataIndex: 'residue',
  152. key: 'residue',
  153. scopedSlots: {
  154. customRender: 'residue'
  155. },
  156. align: 'center',
  157. },
  158. {
  159. title: '注册数',
  160. dataIndex: 'register',
  161. key: 'register',
  162. scopedSlots: {
  163. customRender: 'register'
  164. },
  165. align: 'center',
  166. },
  167. {
  168. title:'相关人员',
  169. dataIndex:'operation',
  170. key:'operation',
  171. scopedSlots: { customRender: 'operation' },
  172. align: 'center',
  173. }
  174. ]
  175. export default {
  176. data() {
  177. return {
  178. columns,
  179. relevantPeopleVisible:false,
  180. relevantPeopleData:{},
  181. dataSource: [],
  182. ipagination: {
  183. current: 1,
  184. pageSize: 4,
  185. // pageSizeOptions: ['10', '20', '30'],
  186. showTotal: (total, range) => {
  187. return range[0] + '-' + range[1] + ' 共' + total + '条'
  188. },
  189. showQuickJumper: true,
  190. // showSizeChanger: true,
  191. total: 0,
  192. onChange: current => {
  193. // 切换分页时的回调,
  194. // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
  195. this.ipagination.current = current
  196. }
  197. },
  198. pageNo: 1,
  199. pageSize: 10,
  200. target: 'cost',
  201. order: 'desc',
  202. dateStr: [],
  203. dateRange: [],
  204. optionArr: [],
  205. total: 0,
  206. pageShow: false,
  207. loading:false,
  208. //是否打开视频
  209. Videovisible:false,
  210. videoUrl:'',
  211. }
  212. },
  213. methods: {
  214. moment,
  215. // 查看相关人员
  216. showRelevantPeople(record){
  217. this.relevantPeopleVisible=true;
  218. console.log(record)
  219. getAction('/ctop/materialAscription/getDetail',{
  220. code:record.code
  221. }).then(res=>{
  222. console.log(res);
  223. if(res.result&&res.success){
  224. this.relevantPeopleData=res.result
  225. }
  226. })
  227. },
  228. getDataSource(page, pageSize) {
  229. this.pageNo = page
  230. this.HttpPost()
  231. },
  232. openVideo(val) {
  233. this.Videovisible = true;
  234. this.videoUrl = val
  235. },
  236. videoOk() {
  237. this.Videovisible = false
  238. },
  239. disabledDate(current) {
  240. // console.log(current)
  241. return current && current > moment().subtract(1, 'day')
  242. },
  243. radioChange(e) {
  244. this.order = e.target.value
  245. },
  246. indexSelect(key) {
  247. console.log(key)
  248. this.target = key
  249. },
  250. //日期改变事件
  251. dateChange(data, dataString) {
  252. this.dateStr = dataString
  253. },
  254. //确定按钮的事件
  255. getData() {
  256. this.HttpPost()
  257. },
  258. //请求事件
  259. HttpPost() {
  260. this.loading = true;
  261. this.dataSource = [];
  262. this.pageShow = false
  263. postAction(
  264. `/ctop/material/top/cost?pageSize=${this.pageSize}&pageNo=${this.pageNo}&target=${this.target}&order=${this.order}`, {
  265. startDate: this.dateStr[0],
  266. endDate: this.dateStr[1],
  267. }).then(res => {
  268. this.loading = false;
  269. console.log(res)
  270. if (res.success) {
  271. if (res.result.records.length > 0) {
  272. this.pageShow = true
  273. }
  274. res.result.records.map((item, index) => {
  275. item.key = index
  276. })
  277. this.total = res.result.total
  278. this.dataSource = res.result.records;
  279. }
  280. })
  281. }
  282. },
  283. mounted() {
  284. this.dateStr = [moment().subtract(1, 'days').format('YYYY-MM-DD'), moment().subtract(1, 'days').format(
  285. 'YYYY-MM-DD')]
  286. this.dateRange = [moment().subtract(1, 'days'), moment().subtract(1, 'days')]
  287. this.HttpPost();
  288. },
  289. filters: {
  290. toPercentage(val) {
  291. return (val * 100).toFixed(2) + '%'
  292. // return val
  293. },
  294. tofixed(val) {
  295. return Number(val).toFixed(2)
  296. }
  297. },
  298. }
  299. </script>
  300. <style lang="scss" scoped>
  301. .materialRank {
  302. width: 100%;
  303. height: 100%;
  304. background: #fff;
  305. padding: 10px 15px;
  306. }
  307. .optionLine {
  308. padding: 30px 5px;
  309. position: relative;
  310. margin-top: 20px;
  311. ;
  312. margin-bottom: 15px;
  313. border: 1px solid #ccc;
  314. span {
  315. display: inline-block;
  316. padding: 0 3px;
  317. }
  318. .timedate,
  319. .caozuoxitong {
  320. margin-left: 30px;
  321. ;
  322. }
  323. .btn {
  324. position: absolute;
  325. right: 10px;
  326. top: 30px;
  327. }
  328. }
  329. .fenye {
  330. margin: 30px 15px 10px;
  331. overflow: hidden;
  332. }
  333. </style>