KSvideoStatics.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. <template>
  2. <div class="vsummary">
  3. <div class="xiangmuxuanze" >
  4. <span >项目选择:</span>
  5. <Treeselect :appId.sync="appId" request="2,4" style="display: inline-block;position: relative;margin-left: 0px;"/>
  6. </div>
  7. <div class="timeDiv">
  8. <div style='display:flex;align-items: center;'>
  9. <span>时间范围:</span>
  10. <span @click="opendate">
  11. <DatePicker :openOptions='openOptions' :parentDate='dateValue' left='-100px'></DatePicker>
  12. </span>
  13. <span style="margin-left:15px">剪辑:</span>
  14. <span >
  15. <!-- <a-input placeholder="请输入剪辑的名字" v-model="clip" style="width:140px" /> -->
  16. <a-select v-model="clip" style="width: 140px" allowClear show-search :filter-option="filterOption">
  17. <a-select-option v-for="item in designList" :key="item.userId" :value='item.userId'>
  18. {{item.companyName +'_'+item.userName }}
  19. </a-select-option>
  20. </a-select>
  21. </span>
  22. <span style="margin-left:15px">拍摄:</span>
  23. <span >
  24. <!-- <a-input placeholder="请输入拍摄的名字" v-model="shot" style="width:140px" /> -->
  25. <a-select v-model="shot" style="width: 140px" allowClear show-search :filter-option="filterOption">
  26. <a-select-option v-for="item in designList" :key="item.userId" :value='item.userId'>
  27. {{item.companyName +'_'+item.userName }}
  28. </a-select-option>
  29. </a-select>
  30. </span>
  31. <span style="margin-left:15px">编导:</span>
  32. <span >
  33. <!-- <a-input placeholder="请输入编导的名字" v-model="plan" style="width:140px" /> -->
  34. <a-select v-model="plan" style="width: 140px" allowClear show-search :filter-option="filterOption">
  35. <a-select-option v-for="item in designList" :key="item.userId" :value='item.userId'>
  36. {{item.companyName +'_'+item.userName }}
  37. </a-select-option>
  38. </a-select>
  39. </span>
  40. </div>
  41. <a-button type="primary" @click="searchRes" :loading='searchLoading'>查询</a-button>
  42. </div>
  43. <!-- <div style="margin:15px 0" class="btndiv">
  44. <a-button type="primary" @click="customColumns">自定义列</a-button>
  45. <a-button type="default" style="float:right" @click="exportExcel" id="mybtn" v-show="exportExcelIsOk">导出报表</a-button>
  46. </div> -->
  47. <!-- <a-modal v-model="visible" title="自定义列" on-ok="handleOk" width="65%">
  48. <template slot="footer">
  49. <a-button key="back" @click="handleCancel">取消</a-button>
  50. <a-button key="submit" type="primary" :loading="loading" @click="handleOk">应用</a-button>
  51. </template>
  52. <a-input-search placeholder="输入要添加的列的名称" style="width: 40%" enter-button @search="onSearch" />
  53. <div class="zhuti">
  54. <div class="addlist">
  55. <p>可添加的列</p>
  56. <div class="selectionList">
  57. <selectComponent
  58. :showCol="listNum"
  59. @getshowlist="getshowlist"
  60. :fixedCol="columnsFixd"
  61. />
  62. </div>
  63. </div>
  64. <div class="listNum">
  65. <p>已选{{listNum.length}}列</p>
  66. <a-button id="btn" type="link" @click="clearAllList">清空全部</a-button>
  67. <ul class="selectlist">
  68. <li v-for="(item,index) in listNum" :key="index">
  69. <span v-if=" index <4">
  70. <a-icon type="lock" />
  71. <span class="listText">{{item.title}}</span>
  72. </span>
  73. <span v-else-if=" index >=4">
  74. <a-icon type="menu" style="color:#ccc" />
  75. <span class="listText">{{item.title}}</span>
  76. <a-icon
  77. type="close"
  78. @click="deleteCol(item,index)"
  79. id="closeStyle"
  80. style="fontSize:12px;"
  81. />
  82. </span>
  83. </li>
  84. </ul>
  85. </div>
  86. </div>
  87. </a-modal> -->
  88. <a-modal v-model="relevantPeopleVisible" title="相关人员" :footer="null" :centered='true'>
  89. <p>编导:{{relevantPeopleData.planName || '暂无数据'}}</p>
  90. <p>剪辑:{{relevantPeopleData.clipName || '暂无数据'}}</p>
  91. <p>拍摄:{{relevantPeopleData.shotName || '暂无数据'}}</p>
  92. </a-modal>
  93. <a-modal v-model="Videovisible" title="视频详情" @ok="videoOk" :footer="null" width="50%">
  94. <video
  95. @click.stop
  96. class="video"
  97. :src="videoUrl"
  98. controls="controls"
  99. style="height:600px;width:100%"
  100. >您的浏览器不支持 video 标签。</video>
  101. </a-modal>
  102. <!-- 报表区域 -->
  103. <div class="tableBox">
  104. <div class="tableTop">
  105. <a-button type="primary" @click="customColumns">自定义列</a-button>
  106. <a-button type="default" style="float:right" @click="exportExcel('exportTable')" id="mybtn" :loading='exportLoading'>导出报表</a-button>
  107. </div>
  108. <a-table
  109. size="middle"
  110. :columns="columns"
  111. :dataSource="data"
  112. bordered
  113. id="outTable"
  114. :pagination="ipagination"
  115. :scroll="{ x: scrollX }"
  116. :loading="loading"
  117. ref="accountTable"
  118. :width="tableWidth"
  119. @change="sort"
  120. style="word-break: break-all;font-size:16px;font-weight:600"
  121. @customHeaderCell="customHeaderCell(columns)"
  122. >
  123. <div slot="coverUrl" slot-scope="test,records">
  124. <!-- {{test}} -->
  125. <img
  126. :src="test"
  127. alt
  128. style="width:80px"
  129. @click="openVideo(records.url)"
  130. />
  131. </div>
  132. <span slot="operation" slot-scope="text, record">
  133. <a href="javascript:;" @click="opendetail(text, record)" style="margin-right:5px">查看明细</a>
  134. </span>
  135. <span slot="ctr" slot-scope="ctr">{{ ctr | toPercentage }}</span>
  136. <span slot="cost" slot-scope="cost">{{ cost | decimalsHandle }}</span>
  137. <span slot="clickMaterial" slot-scope="clickMaterial">{{ clickMaterial | formatCurrency }}</span>
  138. <span slot="showMaterial" slot-scope="showMaterial">{{ showMaterial | formatCurrency }}</span>
  139. <span slot="convertMaterial" slot-scope="convertMaterial">{{ convertMaterial | formatCurrency }}</span>
  140. <span slot="play25FeedBreak" slot-scope="play25FeedBreak">{{ play25FeedBreak | formatCurrency }}</span>
  141. <span slot="play50FeedBreak" slot-scope="play50FeedBreak">{{ play50FeedBreak | formatCurrency }}</span>
  142. <span slot="play75FeedBreak" slot-scope="play75FeedBreak">{{ play75FeedBreak | formatCurrency }}</span>
  143. <span slot="play100FeedBreak" slot-scope="play100FeedBreak">{{ play100FeedBreak | formatCurrency }}</span>
  144. <span slot="nextDayOpen" slot-scope="nextDayOpen">{{ nextDayOpen | formatCurrency }}</span>
  145. <span slot="downloadFinish" slot-scope="downloadFinish">{{ downloadFinish | formatCurrency }}</span>
  146. <span slot="downloadStart" slot-scope="downloadStart">{{ downloadStart | formatCurrency }}</span>
  147. <span slot="likeMaterial" slot-scope="likeMaterial">{{ likeMaterial | formatCurrency }}</span>
  148. <span slot="shareMaterial" slot-scope="shareMaterial">{{ shareMaterial | formatCurrency }}</span>
  149. <span slot="register" slot-scope="register">{{ register | formatCurrency }}</span>
  150. <span slot="follow" slot-scope="follow">{{ follow | formatCurrency }}</span>
  151. <span slot="formCount" slot-scope="formCount">{{ formCount | formatCurrency }}</span>
  152. <span slot="formCountCost" slot-scope="formCountCost">{{ formCountCost | decimalsHandle }}</span>
  153. <span slot="aClick" slot-scope="aClick">{{ aClick | formatCurrency }}</span>
  154. <span slot="photoShow" slot-scope="photoShow">{{ photoShow | formatCurrency }}</span>
  155. <span slot="photoClick" slot-scope="photoClick">{{ photoClick | formatCurrency }}</span>
  156. <span slot="bClick" slot-scope="bClick">{{ bClick | formatCurrency }}</span>
  157. <span slot="active" slot-scope="active">{{ active | formatCurrency }}</span>
  158. <span slot="submit" slot-scope="submit">{{ submit | formatCurrency }}</span>
  159. <span slot="eventCreditGrantLandingPage" slot-scope="eventCreditGrantLandingPage">{{ eventCreditGrantLandingPage | formatCurrency }}</span>
  160. <span slot="submitCost" slot-scope="submitCost">{{ submitCost | decimalsHandle }}</span>
  161. <span slot="eventCreditGrantLandingPageCost" slot-scope="eventCreditGrantLandingPageCost">{{ eventCreditGrantLandingPageCost | decimalsHandle }}</span>
  162. <span slot="submitRate" slot-scope="submitRate">{{ submitRate | toPercentage }}</span>
  163. <span slot="eventCreditGrantLandingPageRate" slot-scope="eventCreditGrantLandingPageRate">{{ eventCreditGrantLandingPageRate | toPercentage }}</span>
  164. <span
  165. slot="play25FeedBreakRate"
  166. slot-scope="play25FeedBreakRate"
  167. >{{ play25FeedBreakRate | toPercentage }}</span>
  168. <span slot="playOverRate" slot-scope="playOverRate">{{ playOverRate | toPercentage }}</span>
  169. <span slot="convertRate" slot-scope="convertRate">{{ convertRate | toPercentage }}</span>
  170. <span slot="nextDayOpenRate" slot-scope="nextDayOpenRate">{{ nextDayOpenRate | toPercentage }}</span>
  171. <span slot="ctr" slot-scope="ctr">{{ ctr | toPercentage }}</span>
  172. <span slot="cpc" slot-scope="cpc">{{ cpc | decimalsHandle }}</span>
  173. <span slot="cpm" slot-scope="cpm">{{ cpm | decimalsHandle }}</span>
  174. <span slot="activeRate" slot-scope="activeRate">{{ activeRate | toPercentage }}</span>
  175. <span
  176. slot="installFinishRate"
  177. slot-scope="installFinishRate"
  178. >{{ installFinishRate | toPercentage }}</span>
  179. <span slot="validPlayRate" slot-scope="validPlayRate">{{ validPlayRate | toPercentage }}</span>
  180. <span slot="activePayCost" slot-scope="activePayCost">{{ activePayCost | decimalsHandle }}</span>
  181. <span slot="nextDayOpenCost" slot-scope="nextDayOpenCost">{{ nextDayOpenCost | decimalsHandle }}</span>
  182. <span slot="validPlayCost" slot-scope="validPlayCost">{{ validPlayCost | decimalsHandle }}</span>
  183. <span slot="activeCost" slot-scope="activeCost">{{ activeCost | decimalsHandle }}</span>
  184. <span
  185. slot="gameAddictionCost"
  186. slot-scope="gameAddictionCost"
  187. >{{ gameAddictionCost | decimalsHandle }}</span>
  188. <span
  189. slot="downloadFinishCost"
  190. slot-scope="downloadFinishCost"
  191. >{{ downloadFinishCost | decimalsHandle }}</span>
  192. <span
  193. slot="downloadStartCost"
  194. slot-scope="downloadStartCost"
  195. >{{ downloadStartCost | decimalsHandle }}</span>
  196. <span
  197. slot="installFinishCost"
  198. slot-scope="installFinishCost"
  199. >{{ installFinishCost | decimalsHandle }}</span>
  200. <span slot="convertCost" slot-scope="convertCost">{{ convertCost | decimalsHandle }}</span>
  201. <span
  202. slot="activeRegisterCost"
  203. slot-scope="activeRegisterCost"
  204. >{{ activeRegisterCost | decimalsHandle }}</span>
  205. <span
  206. slot="downloadStartRate"
  207. slot-scope="downloadStartRate"
  208. >{{ downloadStartRate | toPercentage }}</span>
  209. <!-- <span
  210. slot="downloadFinishRate"
  211. slot-scope="downloadFinishRate"
  212. >{{ downloadFinishRate | toPercentage }}</span>
  213. <span slot="activeRate" slot-scope="activeRate">{{ activeRate | toPercentage }}</span>
  214. <span
  215. slot="activeRegisterRate"
  216. slot-scope="activeRegisterRate"
  217. >{{ activeRegisterRate | toPercentage }}</span> -->
  218. <span
  219. slot="gameAddictionRate"
  220. slot-scope="gameAddictionRate"
  221. >{{ gameAddictionRate | toPercentage }}</span>
  222. <!-- <span slot="nextDayOpenRate" slot-scope="nextDayOpenRate">{{ nextDayOpenRate | toPercentage }}</span> -->
  223. <span slot="relativePeople" slot-scope="text,record">
  224. <!-- <a href="javascript:;" @click.stop="showRelevantPeople(record)">查看相关人员</a> -->
  225. <p>剪辑:{{record.clip || '无'}}</p>
  226. <p>拍摄:{{record.shot || '无'}}</p>
  227. <p>编导:{{record.plan || '无'}}</p>
  228. </span>
  229. </a-table>
  230. </div>
  231. <customColumn :visible='visible' :listNum='listNum' :fiexColumn='columnsFixd' :mediaType='2' @closeCustomColumn='closeCustomColumn' @changeColumn='changeColumn' />
  232. <!-- 明细表 -->
  233. <a-modal v-model="visibleDetail" title="详细信息" width="50%" :footer="null" >
  234. <a-button type="default" @click="exportExcel('exportDetail')" id="mybtn" >导出报表</a-button>
  235. <a-table
  236. :columns="detailColumn"
  237. :data-source="detailData"
  238. bordered
  239. tableLayout="auto"
  240. :pagination="false"
  241. :loading='detailLoading'
  242. style="word-break: break-all;"
  243. >
  244. <!-- <span slot="huanbi" slot-scope="huanbi">{{ huanbi | toPercentage }}</span> -->
  245. <span slot="advertiserName" slot-scope="text">{{ text || '暂未填写该数据' }}</span>
  246. <span slot="cost" slot-scope="cost">{{ cost | decimalsHandle }}</span>
  247. </a-table>
  248. </a-modal>
  249. </div>
  250. </template>
  251. <script>
  252. import moment from 'moment'
  253. import { JeecgListMixin } from '@/mixins/ipagination'
  254. import { getAction, postAction, downFile, downFilePost } from '@/api/manage'
  255. import selectComponent from './selectComponent'
  256. import Treeselect from '../components/Treeselect'
  257. import DatePicker from '@/components/DatePicker'
  258. import customColumn from '../components/customColumn.vue'
  259. const columnsFixd = [
  260. {
  261. title: '视频',
  262. dataIndex: 'coverUrl',
  263. align: 'center',
  264. width: 100,
  265. fixed: 'left',
  266. key: 'coverUrl',
  267. scopedSlots: { customRender: 'coverUrl' }
  268. },
  269. {
  270. title: '视频名称',
  271. dataIndex: 'materialName',
  272. align: 'center',
  273. width: 130,
  274. fixed: 'left'
  275. },
  276. {
  277. title: '视频ID',
  278. dataIndex: 'signature',
  279. align: 'center',
  280. width: 150,
  281. fixed: 'left'
  282. },
  283. {
  284. title: '项目名称',
  285. dataIndex: 'projectName',
  286. align: 'center',
  287. width: 150,
  288. fixed: 'left'
  289. },
  290. {
  291. title: '渠道',
  292. dataIndex: 'channel',
  293. align: 'center',
  294. width: 150,
  295. fixed: 'left'
  296. },
  297. {
  298. title:'相关人员',
  299. dataIndex:'relativePeople',
  300. key:'relativePeople',
  301. scopedSlots: { customRender: 'relativePeople' },
  302. align: 'center',
  303. width:120,
  304. fixed: 'left'
  305. },
  306. // {
  307. // title:'操作',
  308. // dataIndex:'operation',
  309. // key:'operation',
  310. // scopedSlots: { customRender: 'operation' },
  311. // align: 'center',
  312. // width:90,
  313. // fixed: 'left'
  314. // },
  315. {
  316. title: '创建时间',
  317. dataIndex: 'createTime',
  318. scopedSlots: { customRender: 'createTime' },
  319. align: 'center',
  320. sorter: () => {}
  321. },
  322. ]
  323. let show = 0
  324. const initVariableColimns=[
  325. {
  326. title: '消耗(元)',
  327. dataIndex: 'cost',
  328. tip: '广告在投放期间的花费总额',
  329. align: 'center',
  330. scopedSlots: { customRender: 'cost' },
  331. sorter: () => {}
  332. },
  333. // {
  334. // title: '折后消耗(元)',
  335. // dataIndex: 'discountCost',
  336. // width:150,
  337. // tip: '广告在投放期间的花费总额',
  338. // align: 'center',
  339. // scopedSlots: { customRender: 'discountCost' },
  340. // sorter: () => {}
  341. // },
  342. {
  343. title: '封面曝光数',
  344. dataIndex: 'photoShow',
  345. tip: '广告在瀑布流被观看次数',
  346. align: 'center',
  347. scopedSlots: { customRender: 'photoShow' },
  348. sorter:() => {}
  349. },
  350. {
  351. title: '封面点击数',
  352. dataIndex: 'photoClick',
  353. tip: '用户点击封面进入视频播放页的次数(数据会进行反作弊去重)',
  354. align: 'center',
  355. scopedSlots: { customRender: 'photoClick' },
  356. sorter: () => {}
  357. },
  358. {
  359. title: '封面点击率',
  360. dataIndex: 'clickRate',
  361. tip: '封面点击数占封面展示数百分比',
  362. align: 'center',
  363. scopedSlots: { customRender: 'clickRate' },
  364. sorter:() => {}
  365. },
  366. {
  367. title: '素材曝光数',
  368. dataIndex: 'aClick',
  369. tip: '用户进入视频播放页观看的次数(数据会进行反作弊去重)',
  370. align: 'center',
  371. scopedSlots: { customRender: 'aClick' },
  372. sorter:() => {}
  373. },
  374. {
  375. title: '行为数',
  376. dataIndex: 'bClick',
  377. tip: '用户在视频播放页单击转化按钮的次数/展示数*100%',
  378. align: 'center',
  379. scopedSlots: { customRender: 'bClick' },
  380. sorter:() => {}
  381. },
  382. {
  383. title: '行为率',
  384. dataIndex: 'bClickRate',
  385. tip: '行为数占素材曝光数百分比',
  386. align: 'center',
  387. scopedSlots: { customRender: 'bClickRate' },
  388. sorter:() => {}
  389. },
  390. {
  391. title: '平均千次封面曝光花费(元)',
  392. dataIndex: 'cpm',
  393. tip: '花费/封面曝光数*1000',
  394. align: 'center',
  395. scopedSlots: { customRender: 'cpm' },
  396. sorter:() => {}
  397. },
  398. {
  399. title: '平均封面点击单价(元)',
  400. dataIndex: 'cpc',
  401. tip: '花费/封面点击数',
  402. align: 'center',
  403. scopedSlots: { customRender: 'cpc' },
  404. sorter:() => {}
  405. },
  406. {
  407. title: '平均行为单价(元)',
  408. dataIndex: 'cpb',
  409. tip: '总花费/行为数',
  410. align: 'center',
  411. scopedSlots: { customRender: 'cpb' },
  412. sorter:() => {}
  413. },
  414. {
  415. title: '3s播放数',
  416. dataIndex: 'play3sCount',
  417. tip: '总花费/行为数',
  418. align: 'center',
  419. scopedSlots: { customRender: 'play3sCount' },
  420. sorter:() => {}
  421. },
  422. {
  423. title: '3s播放率',
  424. dataIndex: 'play3sRate',
  425. tip: '总花费/行为数',
  426. align: 'center',
  427. scopedSlots: { customRender: 'play3sRate' },
  428. sorter:() => {}
  429. },
  430. ]
  431. let detailColumn=[
  432. {
  433. title: '客户',
  434. dataIndex: 'advertiserName',
  435. align: 'center',
  436. scopedSlots: { customRender: 'advertiserName' },
  437. },
  438. {
  439. title: '项目名称',
  440. dataIndex: 'projectName',
  441. align: 'center',
  442. width: 150,
  443. },
  444. {
  445. title: '时间',
  446. dataIndex: 'statDate',
  447. align: 'center',
  448. width: 120
  449. },
  450. {
  451. title: '消耗',
  452. dataIndex: 'cost',
  453. scopedSlots: { customRender: 'cost' },
  454. align: 'center',
  455. },
  456. ]
  457. export default {
  458. data() {
  459. return {
  460. searchLoading:false,
  461. designList:[],
  462. detailLoading:false,
  463. clip:undefined,
  464. shot:undefined,
  465. plan:undefined,
  466. //明细数据
  467. visibleDetail:false,
  468. detailColumn,
  469. detailData: [],
  470. exportLoading:false,
  471. target:'cost',
  472. order:'desc',
  473. type:0,
  474. dateValue:[moment().subtract(1,'days'),moment().subtract(1,'days')],
  475. openOptions:false,
  476. relevantPeopleVisible:false,
  477. relevantPeopleData:{},
  478. roleCode: localStorage.getItem('roleCode'),
  479. //下拉选择框的数据
  480. projectArr:[],
  481. selectValue:'',
  482. appId:[],
  483. //设置表格的列宽
  484. tableWidth: '',
  485. //gudinglie
  486. columnsFixd: columnsFixd,
  487. //是否打开视频
  488. Videovisible: false,
  489. videoUrl: '',
  490. //是否显示导出按钮
  491. exportExcelIsOk: true,
  492. consumeValue: 0,
  493. columns:[...columnsFixd,...initVariableColimns] ,//table的表头
  494. addColumns: [],
  495. data: [],
  496. totalSelect: 0,
  497. daysFlag: false,
  498. dateRange: [],
  499. dataElse: [],
  500. loading: false,
  501. visible: false,
  502. //自定义列的搜索框
  503. searchInput: '',
  504. //弹出框中现实的选中列数
  505. scrollX: 0,
  506. listNum: [],
  507. //
  508. form: [],
  509. videoID: '',
  510. timedata: [],
  511. ipagination: {
  512. current: 1,
  513. pageSize: 10,
  514. showTotal: (total, range) => {
  515. return range[0] + "-" + range[1] + " 共" + total + "条"
  516. },
  517. showQuickJumper: true,
  518. showSizeChanger:true,
  519. pageSizeOptions: ['10', '30', '50'],
  520. total: 0,
  521. onChange: (current, pageSize) => {
  522. // 切换分页时的回调,
  523. // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
  524. this.ipagination.current = current;
  525. this.ipagination.pageSize= pageSize;
  526. }
  527. },
  528. }
  529. },
  530. mixins: [JeecgListMixin],
  531. components: {
  532. selectComponent,
  533. Treeselect,
  534. DatePicker,
  535. customColumn,
  536. },
  537. watch:{
  538. },
  539. methods: {
  540. filterOption(input, option) {
  541. return (
  542. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  543. );
  544. },
  545. //点击查看明细按钮的事件
  546. opendetail(text, record) {
  547. console.log(text, record)
  548. this.visibleDetail = true
  549. this.detailData = []
  550. this.detailLoading=true;
  551. this.signature=record.signature
  552. // console.log(this.signature)
  553. postAction('/ctop/kuaishou/videoReport/detail', {
  554. startDate: this.dateValue[0].format('YYYY-MM-DD'),
  555. endDate: this.dateValue[1].format('YYYY-MM-DD'),
  556. signature: record.signature,
  557. accountIds:this.appId
  558. }).then(res => {
  559. console.log(res)
  560. this.detailLoading=false;
  561. if (res.success) {
  562. let result = res.result
  563. // this.detailData.push({ ...result, key: 1 })
  564. result.map((item, index) => {
  565. item.key = index
  566. })
  567. this.detailData = result
  568. }
  569. })
  570. },
  571. closeCustomColumn(){
  572. this.visible=false;
  573. },
  574. //自定义之后修改父元素表头
  575. changeColumn(val){
  576. console.log(val)
  577. this.columns=[...val];
  578. if(this.columns.length> this.columnsFixd.length&&this.columns.length<9){
  579. this.scrollX=0;
  580. this.columns.forEach((element,index) => {
  581. if(index<this.columnsFixd.length){
  582. element.width='auto'
  583. element.fixed=false
  584. }
  585. });
  586. // this.scrollX=2000+200*(this.columns.length-this.columnsFixd.length)
  587. }else if(this.columns.length>=9){
  588. this.columns.forEach((element,index) => {
  589. if(index<this.columnsFixd.length-1){
  590. element.width=120
  591. element.fixed='left'
  592. }
  593. });
  594. this.scrollX=1000+200*(this.columns.length-this.columnsFixd.length)
  595. } else{
  596. this.scrollX=0;
  597. this.columns.forEach(element => {
  598. element.width='auto'
  599. element.fixed=false
  600. });
  601. }
  602. },
  603. // 日期的开关
  604. //打开日期框
  605. opendate(){
  606. this.openOptions=!this.openOptions;
  607. // console.log(this.openOptions)
  608. },
  609. opendateClose(){
  610. this.openOptions=false;
  611. // console.log(this.openOptions)
  612. },
  613. // 查看相关人员
  614. showRelevantPeople(record){
  615. this.relevantPeopleVisible=true;
  616. console.log(record)
  617. getAction('/ctop/materialAscription/getDetail',{
  618. code:record.signature
  619. }).then(res=>{
  620. console.log(res);
  621. this.relevantPeopleData=[];
  622. if(res.result&&res.success){
  623. this.relevantPeopleData=res.result
  624. }
  625. })
  626. },
  627. sort(pagination, filters, sorter, { currentDataSource }){
  628. console.log(pagination, filters, sorter)
  629. this.ipagination.current=pagination.current;
  630. this.ipagination.pageSize=pagination.pageSize
  631. if(sorter.order == 'ascend'){
  632. this.order='asc'
  633. this.target=sorter.columnKey;
  634. }else if(sorter.order == 'descend'){
  635. this.order='desc'
  636. this.target=sorter.columnKey;
  637. }else{
  638. this.target='cost',
  639. this.order='desc'
  640. }
  641. this.HttpPost();
  642. },
  643. moment,
  644. //select切换---项目
  645. selectChange(key){
  646. this.selectValue=key;
  647. },
  648. //打开视频
  649. openVideo(val) {
  650. this.Videovisible = true
  651. this.videoUrl = val
  652. },
  653. videoOk() {
  654. this.Videovisible = false
  655. },
  656. disabledDate(current) {
  657. // console.log(current)
  658. return current && current > moment().subtract(1, 'day')
  659. },
  660. consumeOnChange() {},
  661. //查询按钮
  662. searchRes() {
  663. this.date = []
  664. this.ipagination.current=1
  665. this.HttpPost()
  666. },
  667. //网络请求table数据函数
  668. HttpPost(){
  669. this.loading=true;
  670. this.searchLoading=true
  671. show = 0
  672. postAction('/ctop/kuaishou/videoReport/list', {
  673. startDate: this.dateValue[0].format('YYYY-MM-DD'),
  674. endDate: this.dateValue[1].format('YYYY-MM-DD'),
  675. pageNo:this.ipagination.current,
  676. pageSize:this.ipagination.pageSize,
  677. accountIds:this.appId,
  678. target:this.target,
  679. order:this.order,
  680. clipId:this.clip?this.clip:'',
  681. shotId:this.shot?this.shot:'',
  682. planId:this.plan?this.plan:'',
  683. }).then(res => {
  684. let resArr = []
  685. this.data=[];
  686. this.loading = false;
  687. this.searchLoading=false;
  688. if (res.success) {
  689. // let result = res.result
  690. // this.data.push({ ...result, key: 1 })
  691. // result.map((item, index) => {
  692. // item.key = index
  693. // })
  694. this.data = res.result.list.map((item,index)=>{
  695. return {
  696. ...item,
  697. key:index
  698. }
  699. })
  700. this.ipagination.total = res.result.total
  701. this.loading = false
  702. }else{
  703. this.loading = false
  704. }
  705. })
  706. },
  707. //导出报表
  708. exportExcel(exportType) {
  709. this.exportLoading=true;
  710. let columns=[]
  711. if(exportType=='exportTable'){
  712. let column = this.columns.map((item, index) => {
  713. return item.dataIndex
  714. })
  715. columns=column.splice(this.columnsFixd.length)
  716. }
  717. downFilePost('/ctop/kuaishou/videoReport/excelV2', {
  718. columns,
  719. target:this.target,
  720. order:this.order,
  721. startDate: this.dateValue[0].format('YYYY-MM-DD'),
  722. endDate: this.dateValue[1].format('YYYY-MM-DD'),
  723. accountIds:this.appId,
  724. exportType,
  725. signature: this.signature,
  726. signature: this.signature,
  727. clip:this.clip?this.clip:'',
  728. shot:this.shot?this.shot:'',
  729. plan:this.plan?this.plan:'',
  730. }).then(res => {
  731. this.exportLoading=false;
  732. let blob = new Blob([res], {
  733. type:'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  734. })
  735. let downloadElement = document.createElement('a')
  736. let href = window.URL.createObjectURL(blob) //创建下载的链接
  737. downloadElement.href = href
  738. downloadElement.download = `${this.dateValue[0].format('YYYY-MM-DD')}~${this.dateValue[1].format('YYYY-MM-DD')}视频汇总.xlsx` //下载后文件名
  739. document.body.appendChild(downloadElement)
  740. downloadElement.click() //点击下载
  741. document.body.removeChild(downloadElement) //下载完成移除元素
  742. window.URL.revokeObjectURL(href) //释放掉blob对象
  743. })
  744. },
  745. //日期选择回调
  746. dateChange(data, dataString) {
  747. if (data.length) {
  748. this.timedata = dataString
  749. this.dateRange[0] = data[0]
  750. this.totalSelect = (data[1]._d - data[0]._d) / (24 * 60 * 60 * 1000) + 1
  751. this.daysFlag = true
  752. if (this.totalSelect > 92) {
  753. this.$message.error('时间跨度太长啦,选小一点好嘛?')
  754. this.daysFlag = false
  755. this.dateRange = []
  756. }
  757. } else {
  758. this.daysFlag = false
  759. this.dateRange = []
  760. }
  761. },
  762. //弹出框打开,自定义列
  763. customColumns() {
  764. this.visible = true
  765. this.listNum = [...this.columns]
  766. },
  767. tableHandle() {
  768. // this.listNum = [...this.columns]
  769. // console.log(this.listNum.length, this.columns)
  770. // if (this.listNum.length >= 9 || this.columns.length >= 9) {
  771. // this.tableWidth = 160
  772. // this.scrollX = this.columns.length * 160
  773. // // console.log(this.scrollX)
  774. // } else {
  775. // this.scrollX = 2000
  776. // }
  777. },
  778. //弹出框确定
  779. handleOk(e) {
  780. this.loading = false
  781. this.visible = false
  782. if (this.listNum.length >= 10) {
  783. let newlist = this.listNum.slice(columnsFixd.length)
  784. console.log(newlist)
  785. this.columns = [...columnsFixd, ...newlist]
  786. } else {
  787. this.columns = [...this.listNum]
  788. }
  789. if (this.listNum.length == 4) {
  790. // console.log(this.listNum.length)
  791. this.scrollX = 0
  792. this.columns.map((item, index) => {
  793. item.width = 500
  794. })
  795. // console.log(1)
  796. } else {
  797. this.columns.map((item, index) => {
  798. if (index == 2 || index == 0) {
  799. item.width = 150
  800. } else if (index == 1 || index == 2) {
  801. item.width = 100
  802. }
  803. })
  804. // console.log(2)
  805. }
  806. this.tableHandle()
  807. },
  808. //弹出框取消按钮
  809. handleCancel(e) {
  810. this.visible = false
  811. },
  812. loadShow(){
  813. show++
  814. if(this.data.length>0){
  815. if(show == (this.data.length*2)){
  816. this.data = [...this.data]
  817. }
  818. }
  819. },
  820. // 获取设计人员
  821. getDesignList(){
  822. postAction('/ctop/kuaishou/videoReport/getDesignList').then(res=>{
  823. console.log(res);
  824. if(res.success){
  825. this.designList=res.result
  826. }
  827. })
  828. }
  829. },
  830. activated() {
  831. console.log('activated')
  832. // this.getParticipateList()
  833. this.statDate = moment().subtract(1, 'day')
  834. moment().format('YYYY-MM-DD_HH:mm')
  835. postAction('/toutiao/videoReportDaily/getColumnJson', {
  836. columnType: 4
  837. }).then(res => {
  838. // console.log(res)
  839. if (res.success) {
  840. // console.log(JSON.parse(res.result))
  841. if(res.result){
  842. let columns = JSON.parse(res.result)
  843. if (columns.length) {
  844. if (columns.length >= columnsFixd.length) {
  845. columns.map((item, index) => {
  846. if (index > columnsFixd.length - 1) {
  847. item.sorter = function(a, b) {
  848. }
  849. }
  850. })
  851. columns = columns.slice(columnsFixd.length)
  852. this.columns = [...columnsFixd, ...columns]
  853. // this.tableHandle()
  854. }
  855. // console.log(this.columns)
  856. }
  857. }
  858. this.changeColumn(this.columns)
  859. }
  860. })
  861. },
  862. deactivated() {
  863. let arr = JSON.stringify(this.columns)
  864. console.log(arr)
  865. postAction('/toutiao/videoReportDaily/saveOrUpdateColumnJson', {
  866. json: arr,
  867. columnType: 4
  868. }).then(res => {
  869. // console.log(res)
  870. })
  871. },
  872. beforeDestroy() {
  873. let arr = JSON.stringify(this.columns)
  874. console.log(arr)
  875. postAction('/toutiao/videoReportDaily/saveOrUpdateColumnJson', {
  876. json: arr,
  877. columnType: 4
  878. }).then(res => {
  879. // console.log(res)
  880. })
  881. },
  882. filters: {
  883. toshowTime(val) {
  884. // console.log(val, this.timedata)
  885. // return this.timedata[0] + '~' + this.timedata[1]
  886. return val
  887. },
  888. toPercentage(val) {
  889. if(val){
  890. if(typeof val != 'string'){
  891. return (val * 100).toFixed(2) + '%'
  892. }else{
  893. return val
  894. }
  895. }else if(typeof val =='string'){
  896. return val
  897. }
  898. else{
  899. return 0
  900. }
  901. },
  902. //保留两位小数并且变成货币格式
  903. decimalsHandle(val){
  904. // console.log(val)
  905. if(val && typeof val !='string'){
  906. if(val>=0){
  907. val=parseFloat(val).toFixed(2);
  908. let numberStr = val.toString()
  909. let str = numberStr.split('.')
  910. let str0=str[0].split('').reverse();
  911. for (let i = 0; i < str0.length; i++) {
  912. if ((i + 1) % 4 === 0) {
  913. str0.splice(i, 0, ',')
  914. }
  915. }
  916. str0.reverse()
  917. let handleResult = ''
  918. for (let j = 0; j < str0.length; j++) {
  919. handleResult += str0[j]
  920. }
  921. return handleResult+'.'+str[1]
  922. }else{
  923. val=parseFloat(val).toFixed(2);
  924. let numberStr = val.toString()
  925. let str = numberStr.split('.')
  926. let str0=str[0].substr(1).split('').reverse();
  927. for (let i = 0; i < str0.length; i++) {
  928. if ((i + 1) % 4 === 0) {
  929. str0.splice(i, 0, ',')
  930. }
  931. }
  932. str0.reverse()
  933. let handleResult = ''
  934. for (let j = 0; j < str0.length; j++) {
  935. handleResult += str0[j]
  936. }
  937. return '-'+handleResult+'.'+str[1]
  938. }
  939. }else if(typeof val =='string'){
  940. return val
  941. }
  942. else{
  943. return 0
  944. }
  945. },
  946. //变成货币格式
  947. formatCurrency(val){
  948. if((val||val==0)&& typeof val !='string'){
  949. let numberStr = val.toString()
  950. let str = numberStr.split('').reverse()
  951. for (let i = 0; i < str.length; i++) {
  952. if ((i + 1) % 4 === 0) {
  953. str.splice(i, 0, ',')
  954. }
  955. }
  956. str.reverse()
  957. let handleResult = ''
  958. for (let j = 0; j < str.length; j++) {
  959. handleResult += str[j]
  960. }
  961. return handleResult
  962. }else if(typeof val =='string'){
  963. return val
  964. }
  965. else{
  966. return '-'
  967. }
  968. }
  969. },
  970. mounted() {
  971. this.getDesignList()
  972. //请求自定义列的数据
  973. postAction('/toutiao/videoReportDaily/videoInfoListTotalExportExcelPermission').then(res => {
  974. console.log(res)
  975. if (res.success) {
  976. if (res.result) {
  977. this.exportExcelIsOk = true
  978. } else {
  979. this.exportExcelIsOk = false
  980. }
  981. }
  982. })
  983. //进入页面默认展示昨天到今天的数据
  984. this.dateRange=[moment().subtract(7,'days'),moment()]
  985. this.timedata=[moment().subtract(7,'days').format('YYYY-MM-DD'),moment().format('YYYY-MM-DD')]
  986. // this.loading=true;
  987. this.HttpPost()
  988. postAction('/toutiao/videoReportDaily/getColumnJson', {
  989. columnType: 4
  990. }).then(res => {
  991. // console.log(res)
  992. if (res.success) {
  993. // console.log(JSON.parse(res.result))
  994. if(res.result){
  995. let columns = JSON.parse(res.result)
  996. if (columns.length) {
  997. if (columns.length >= columnsFixd.length) {
  998. columns.map((item, index) => {
  999. if (index > columnsFixd.length - 1) {
  1000. item.sorter = function(a, b) {
  1001. }
  1002. }
  1003. })
  1004. columns = columns.slice(columnsFixd.length)
  1005. this.columns = [...columnsFixd, ...columns]
  1006. // this.tableHandle()
  1007. }
  1008. // console.log(this.columns)
  1009. }
  1010. }
  1011. this.changeColumn(this.columns)
  1012. }
  1013. })
  1014. }
  1015. }
  1016. </script>
  1017. <style lang="less">
  1018. // .ant-table .ant-table-fixed-left .ant-table-thead {
  1019. // height: 108px !important ;
  1020. // }
  1021. .vsummary{
  1022. .ant-table .ant-table-thead .ant-table-header-column .ant-table-column-title {
  1023. // display:block;
  1024. white-space: normal;
  1025. word-break: break-all;
  1026. }
  1027. }
  1028. </style>
  1029. <style lang="scss" scoped>
  1030. .vsummary {
  1031. width: 100%;
  1032. height: 100%;
  1033. background: white;
  1034. padding: 15px 30px;
  1035. .tableBox{
  1036. background-color: #fff;
  1037. margin: 15px 0px;
  1038. padding: 15px 0px;
  1039. .tableTop{
  1040. position: relative;
  1041. padding-bottom: 15px;
  1042. border-bottom: 1px solid #e0e0e0;
  1043. .selectTime{
  1044. margin-right: 20px;
  1045. }
  1046. .add{
  1047. position: absolute;
  1048. top: 0;
  1049. right: 0;
  1050. }
  1051. }
  1052. }
  1053. }
  1054. .xiangmuxuanze{
  1055. margin-bottom: 20px;
  1056. display: flex;
  1057. align-items: center;
  1058. }
  1059. .timeDiv {
  1060. display: flex;
  1061. justify-content: space-between;
  1062. }
  1063. span {
  1064. margin-left: 5px;
  1065. }
  1066. .myinput {
  1067. width: 40%;
  1068. }
  1069. .addlist {
  1070. float: left;
  1071. width: 70%;
  1072. border: 1px solid #eee;
  1073. .selectionList {
  1074. padding: 10px 15px;
  1075. height: 450px;
  1076. overflow: auto;
  1077. .leibie {
  1078. .leiName {
  1079. font-size: 26px;
  1080. text-align: left;
  1081. }
  1082. }
  1083. .jutixiang {
  1084. display: inline-block;
  1085. width: 32%;
  1086. box-sizing: border-box;
  1087. padding: 10px 3px;
  1088. }
  1089. }
  1090. }
  1091. .listNum {
  1092. float: right;
  1093. width: 28%;
  1094. border: 1px solid #eee;
  1095. position: relative;
  1096. }
  1097. .zhuti {
  1098. margin-top: 15px;
  1099. overflow: hidden;
  1100. p {
  1101. height: 40px;
  1102. line-height: 20px;
  1103. padding: 10px 15px;
  1104. background: rgb(249, 250, 253);
  1105. border-bottom: 1px solid #eee;
  1106. }
  1107. #btn {
  1108. position: absolute;
  1109. right: 0;
  1110. top: 5px;
  1111. }
  1112. .selectlist {
  1113. width: 100%;
  1114. list-style: none;
  1115. margin: 0;
  1116. height: 450px;
  1117. padding: 0 15px 10px;
  1118. overflow: auto;
  1119. li {
  1120. width: 100%;
  1121. padding: 5px 8px;
  1122. margin: 6px 0;
  1123. border-radius: 10px;
  1124. background: rgb(248, 248, 248);
  1125. height: 32px;
  1126. position: relative;
  1127. span {
  1128. width: 80%;
  1129. height: 100%;
  1130. display: inline-block;
  1131. margin: 0 10px;
  1132. // overflow:hidden;
  1133. // text-overflow:ellipsis;
  1134. // white-space: nowrap;
  1135. }
  1136. .listText {
  1137. position: absolute;
  1138. top: 2;
  1139. left: 10;
  1140. width: 40%;
  1141. overflow: hidden;
  1142. white-space: nowrap;
  1143. text-overflow: ellipsis;
  1144. }
  1145. #closeStyle {
  1146. position: absolute;
  1147. top: 9px;
  1148. right: 7px;
  1149. }
  1150. }
  1151. }
  1152. }
  1153. #mybtn {
  1154. margin: 0 10px 15px 0;
  1155. }
  1156. </style>