vMonth.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  1. <template>
  2. <div class="vsummary">
  3. <div class="xiangmuxuanze">
  4. <span>项目选择:</span>
  5. <Treeselect :appId.sync="appId" request="1,3" reqUrl="/ctop/projectMember/bytedanceProjectParticipateInList" style="display: inline-block;position: relative;top: 10px;"/>
  6. </div>
  7. <div class="timeDiv">
  8. <div>
  9. <span>时间范围:</span>
  10. <a-button type="default" @click="lastWeekHandle">过去一月</a-button>
  11. <a-range-picker
  12. :disabled-date="disabledDate"
  13. format="YYYY-MM-DD"
  14. style="width: 250px;"
  15. @change="dateChange"
  16. v-model="dateRange"
  17. />
  18. <span v-show="daysFlag">共{{totalSelect}}天</span>
  19. </div>
  20. <div>
  21. <span>消耗:</span>
  22. <a-input-number id="inputNumber" v-model="consumeValue" :min="0" @change="consumeOnChange" />
  23. <span>视频ID:</span>
  24. <a-input class="myinput" v-model="videoID" style="width:250px" />
  25. </div>
  26. <a-button type="primary" @click="searchRes">查询</a-button>
  27. </div>
  28. <div style="display:flex;margin-bottom:15px" class="btndiv">
  29. <a-button type="primary" @click="customColumns">自定义列</a-button>
  30. </div>
  31. <a-modal v-model="visible" title="自定义列" on-ok="handleOk" width="65%">
  32. <template slot="footer">
  33. <a-button key="back" @click="handleCancel">取消</a-button>
  34. <a-button key="submit" type="primary" :loading="loading" @click="handleOk">应用</a-button>
  35. </template>
  36. <!-- <a-input-search placeholder="输入要添加的列的名称" style="width: 40%" enter-button @search="onSearch" /> -->
  37. <div class="zhuti">
  38. <div class="addlist">
  39. <p>可添加的列</p>
  40. <div class="selectionList">
  41. <!-- v-for="(item,index) in addColumns" :key="index" -->
  42. <selectComponent :showCol="listNum" @getshowlist="getshowlist" :fixedCol='columnsFixd'/>
  43. </div>
  44. </div>
  45. <div class="listNum">
  46. <p>已选{{listNum.length}}列</p>
  47. <a-button id="btn" type="link" @click="clearAllList">清空全部</a-button>
  48. <ul class="selectlist">
  49. <li v-for="(item,index) in listNum" :key="index">
  50. <span v-if=" index <6">
  51. <a-icon type="lock" />
  52. <span class="listText">{{item.title}}</span>
  53. </span>
  54. <span v-else-if=" index >=6">
  55. <a-icon type="menu" style="color:#ccc" />
  56. <span class="listText">{{item.title}}</span>
  57. <a-icon
  58. type="close"
  59. @click="deleteCol(item,index)"
  60. id="closeStyle"
  61. style="fontSize:12px;"
  62. />
  63. </span>
  64. </li>
  65. </ul>
  66. </div>
  67. </div>
  68. </a-modal>
  69. <a-table
  70. size="middle"
  71. :columns="columns"
  72. :dataSource="data"
  73. bordered
  74. id="outTable"
  75. :pagination="ipagination"
  76. :scroll="{ x: scrollX }"
  77. :loading="loading"
  78. tableLayout="auto"
  79. ref="vSummaryTable"
  80. style="word-break: break-all;"
  81. :width='tableWidth'
  82. @change="sort"
  83. >
  84. <span slot="operation" slot-scope="text, record">
  85. <a href="javascript:;" @click="opendetail(text, record)" style="margin-right:5px">查看明细</a>
  86. |
  87. <a href="javascript:;" @click.stop="showRelevantPeople(record)" style="margin-left:5px">查看相关人员</a>
  88. </span>
  89. <div slot="videoU" slot-scope="test,records">
  90. <img :src="records.coverUrl" alt="" style="width:140px" @click="openVideo(records.url)" @load="loadShow">
  91. </div>
  92. <span slot="ctr" slot-scope="ctr">{{ ctr | toPercentage }}</span>
  93. <span
  94. slot="play25FeedBreakRate"
  95. slot-scope="play25FeedBreakRate"
  96. >{{ play25FeedBreakRate | toPercentage }}</span>
  97. <span slot="playOverRate" slot-scope="playOverRate">{{ playOverRate | toPercentage }}</span>
  98. <span slot="convertRate" slot-scope="convertRate">{{ convertRate | toPercentage }}</span>
  99. <span
  100. slot="downloadStartRate"
  101. slot-scope="downloadStartRate"
  102. >{{ downloadStartRate | toPercentage }}</span>
  103. <span
  104. slot="downloadFinishRate"
  105. slot-scope="downloadFinishRate"
  106. >{{ downloadFinishRate | toPercentage }}</span>
  107. <span slot="activeRate" slot-scope="activeRate">{{ activeRate | toPercentage }}</span>
  108. <span
  109. slot="activeRegisterRate"
  110. slot-scope="activeRegisterRate"
  111. >{{ activeRegisterRate | toPercentage }}</span>
  112. <span
  113. slot="gameAddictionRate"
  114. slot-scope="gameAddictionRate"
  115. >{{ gameAddictionRate | toPercentage }}</span>
  116. <span slot="nextDayOpenRate" slot-scope="nextDayOpenRate">{{ nextDayOpenRate | toPercentage }}</span>
  117. <span slot="statDatetime" slot-scope="">{{ timedata[0]+'~'+timedata[1]}}</span>
  118. <span slot="convertRate" slot-scope="convertRate">{{ convertRate | toPercentage }}</span>
  119. <span slot="nextDayOpenRate" slot-scope="nextDayOpenRate">{{ nextDayOpenRate | toPercentage }}</span>
  120. <span slot="ctr" slot-scope="ctr">{{ ctr | toPercentage }}</span>
  121. <span slot="cpc" slot-scope="cpm">{{ cpm | tofixed }}</span>
  122. <span slot="cpm" slot-scope="cpm">{{ cpm | tofixed }}</span>
  123. <span slot="activeRate" slot-scope="activeRate">{{ activeRate | toPercentage }}</span>
  124. <span slot="installFinishRate" slot-scope="installFinishRate">{{ installFinishRate | toPercentage }}</span>
  125. <span slot="validPlayRate" slot-scope="validPlayRate">{{ validPlayRate | tofixed }}</span>
  126. <span slot="activePayCost" slot-scope="activePayCost">{{ activePayCost | tofixed }}</span>
  127. <span slot="nextDayOpenCost" slot-scope="nextDayOpenCost">{{ nextDayOpenCost | tofixed }}</span>
  128. <span slot="validPlayCost" slot-scope="validPlayCost">{{ validPlayCost | tofixed }}</span>
  129. <span slot="activeCost" slot-scope="activeCost">{{ activeCost | tofixed }}</span>
  130. <span slot="gameAddictionCost" slot-scope="gameAddictionCost">{{ gameAddictionCost | tofixed }}</span>
  131. <span slot="downloadFinishCost" slot-scope="downloadFinishCost">{{ downloadFinishCost | tofixed }}</span>
  132. <span slot="downloadStartCost" slot-scope="downloadStartCost">{{ downloadStartCost | tofixed }}</span>
  133. <span slot="installFinishCost" slot-scope="installFinishCost">{{ installFinishCost | tofixed }}</span>
  134. <span slot="convertCost" slot-scope="convertCost">{{ convertCost | tofixed }}</span>
  135. </a-table>
  136. <a-modal v-model="relevantPeopleVisible" title="相关人员" :footer="null" :centered='true'>
  137. <p>编导:{{relevantPeopleData.planName || '暂无数据'}}</p>
  138. <p>剪辑:{{relevantPeopleData.clipName || '暂无数据'}}</p>
  139. <p>拍摄:{{relevantPeopleData.shotName || '暂无数据'}}</p>
  140. </a-modal>
  141. <!-- 明细表 -->
  142. <a-modal v-model="visibleDetail" title="详细信息" width="60%" :footer="null" >
  143. <a-button type="default" @click="exportExcel" id="mybtn">导出报表</a-button>
  144. <a-table
  145. :columns="detailConsum"
  146. :data-source="detailData"
  147. bordered
  148. tableLayout="auto"
  149. :pagination="false"
  150. style="word-break: break-all;"
  151. >
  152. <span slot="huanbi" slot-scope="huanbi">{{ huanbi | toPercentage }}</span>
  153. </a-table>
  154. </a-modal>
  155. <a-modal v-model="Videovisible" title="视频详情" @ok="videoOk" :footer="null" width='50%'>
  156. <video
  157. @click.stop
  158. class="video"
  159. :src="videoUrl"
  160. controls="controls"
  161. style="height:600px;width:100%"
  162. >您的浏览器不支持 video 标签。</video>
  163. </a-modal>
  164. </div>
  165. </template>
  166. <script>
  167. import moment from 'moment'
  168. import { JeecgListMixin } from '@/mixins/ipagination'
  169. import { getAction, postAction, downFile, downFilePost } from '@/api/manage'
  170. import selectComponent from './selectComponent'
  171. import Treeselect from '../components/Treeselect'
  172. const columnsFixd = [
  173. {
  174. title: '时间',
  175. dataIndex: 'statDatetime',
  176. align: 'center',
  177. width: 120,
  178. fixed: 'left',
  179. scopedSlots: { customRender: 'statDatetime' }
  180. },
  181. {
  182. title: '视频',
  183. dataIndex: 'videoU',
  184. align: 'center',
  185. width: 150,
  186. fixed: 'left',
  187. key: 'videoU',
  188. scopedSlots: { customRender: 'videoU' }
  189. },
  190. {
  191. title: '视频ID',
  192. dataIndex: 'signature',
  193. align: 'center',
  194. width: 100,
  195. fixed: 'left'
  196. },
  197. {
  198. title: '项目名称',
  199. dataIndex: 'projectName',
  200. align: 'center',
  201. width: 100,
  202. fixed: 'left'
  203. },
  204. // {
  205. // title: '视频链接',
  206. // dataIndex: 'videoUrl',
  207. // align: 'center',
  208. // width: 150,
  209. // fixed: 'left'
  210. // },
  211. {
  212. title: '操作',
  213. dataIndex: 'operation',
  214. align: 'center',
  215. scopedSlots: { customRender: 'operation' },
  216. width: 180,
  217. fixed: 'left'
  218. }
  219. ]
  220. let variableCol = [
  221. {
  222. title: '上传时间',
  223. dataIndex: 'materialUploadTime',
  224. scopedSlots: { customRender: 'materialUploadTime' },
  225. align: 'center',
  226. sorter: () => {}
  227. },
  228. {
  229. title: '消耗',
  230. dataIndex: 'cost',
  231. scopedSlots: { customRender: 'cost' },
  232. align: 'center',
  233. sorter: (a, b) => a.cost - b.cost
  234. },
  235. {
  236. title: '点击数',
  237. dataIndex: 'clickMaterial',
  238. align: 'center',
  239. scopedSlots: { customRender: 'clickMaterial' },
  240. sorter: (a, b) => a.clickMaterial - b.clickMaterial
  241. },
  242. {
  243. title: '点击率',
  244. dataIndex: 'ctr',
  245. align: 'center',
  246. scopedSlots: { customRender: 'ctr' },
  247. sorter: (a, b) => a.ctr - b.ctr
  248. },
  249. {
  250. title: '展示数',
  251. dataIndex: 'showMaterial',
  252. align: 'center',
  253. scopedSlots: { customRender: 'showMaterial' },
  254. sorter: (a, b) => a.showMaterial - b.showMaterial
  255. },
  256. {
  257. title: '25%进度播放率',
  258. dataIndex: 'play25FeedBreakRate',
  259. align: 'center',
  260. scopedSlots: { customRender: 'play25FeedBreakRate' },
  261. sorter: (a, b) => a.play25FeedBreakRate - b.play25FeedBreakRate
  262. },
  263. {
  264. title: '播完率',
  265. dataIndex: 'playOverRate',
  266. align: 'center',
  267. tip: '表示广告在投放期内的预估花费金额。当天数据可能会有波动,次日稳定',
  268. scopedSlots: { customRender: 'playOverRate' },
  269. sorter: (a, b) => a.playOverRate - b.playOverRate
  270. },
  271. {
  272. title: '转化数',
  273. dataIndex: 'convertMaterial',
  274. align: 'center',
  275. scopedSlots: { customRender: 'convertMaterial' },
  276. sorter: (a, b) => a.convertMaterial - b.convertMaterial
  277. },
  278. {
  279. title: '转化率',
  280. dataIndex: 'convertRate',
  281. align: 'center',
  282. scopedSlots: { customRender: 'convertRate' },
  283. sorter: (a, b) => a.convertRate - b.convertRate
  284. }
  285. ]
  286. let length=0
  287. let show=0
  288. let detailConsum = [
  289. {
  290. title: '客户',
  291. dataIndex: 'advertiserName',
  292. align: 'center',
  293. customRender: (value, row, index) => {
  294. const obj = {
  295. children: value,
  296. attrs: {}
  297. }
  298. if(length){
  299. console.log(length)
  300. if (index === 0) {
  301. obj.attrs.rowSpan = length
  302. } else {
  303. obj.attrs.rowSpan = 0
  304. }
  305. }
  306. return obj
  307. }
  308. },
  309. {
  310. title: '项目名称',
  311. dataIndex: 'projectName',
  312. align: 'center',
  313. width:150,
  314. customRender: (value, row, index) => {
  315. const obj = {
  316. children: value,
  317. attrs: {}
  318. }
  319. if (index === 0) {
  320. obj.attrs.rowSpan = length
  321. } else {
  322. obj.attrs.rowSpan = 0
  323. }
  324. return obj
  325. }
  326. },
  327. {
  328. title: '时间',
  329. dataIndex: 'statDatetime',
  330. align: 'center',
  331. width: 120
  332. },
  333. {
  334. title: '消耗',
  335. dataIndex: 'cost',
  336. scopedSlots: { customRender: 'cost' },
  337. align: 'center'
  338. },
  339. {
  340. title: '环比',
  341. dataIndex: 'huanbi',
  342. align: 'center',
  343. scopedSlots: { customRender: 'huanbi' },
  344. }
  345. ]
  346. export default {
  347. data() {
  348. return {
  349. relevantPeopleVisible:false,
  350. relevantPeopleData:{},
  351. roleCode: localStorage.getItem('roleCode'),
  352. //下拉选择框的数据
  353. projectArr:[],
  354. selectValue:'',
  355. //gudinglie
  356. columnsFixd:columnsFixd,
  357. //设置表格的列宽
  358. tableWidth:'',
  359. columnsFixd,
  360. //是否打开视频
  361. Videovisible:false,
  362. videoUrl:'',
  363. //明细的表头
  364. detailConsum,
  365. //明细里的数据
  366. detailData: [],
  367. consumeValue: 1000,
  368. //视频ID
  369. videoID: null,
  370. columns: [...columnsFixd, ...variableCol],
  371. data: [],
  372. totalSelect: 0,
  373. daysFlag: false,
  374. dateRange: [],
  375. dataElse: [],
  376. loading: false,
  377. visible: false,
  378. //自定义列的搜索框
  379. searchInput: '',
  380. //弹出框中现实的选中列数
  381. scrollX: 0,
  382. listNum: [],
  383. value: this.text,
  384. editable: false,
  385. //详细信息的开关
  386. visibleDetail: false,
  387. //时间选择 字符串类型
  388. timedata: [],
  389. //记录点开的视频的md5
  390. signature:null,
  391. appId:[]
  392. }
  393. },
  394. components: {
  395. selectComponent,
  396. Treeselect
  397. },
  398. props: {
  399. text: String
  400. },
  401. mixins: [JeecgListMixin],
  402. watch:{
  403. 'ipagination.current':function(n,o){
  404. console.log(n,o)
  405. this.HttpPost()
  406. }
  407. },
  408. methods: {
  409. // 查看相关人员
  410. showRelevantPeople(record){
  411. this.relevantPeopleVisible=true;
  412. console.log(record)
  413. getAction('/ctop/materialAscription/getDetail',{
  414. code:record.signature
  415. }).then(res=>{
  416. console.log(res);
  417. if(res.result&&res.success){
  418. this.relevantPeopleData=res.result
  419. }
  420. })
  421. },
  422. sort(pagination, filters, sorter, { currentDataSource }){
  423. console.log(pagination, filters, sorter)
  424. if(sorter.order == 'ascend'){
  425. this.HttpPost(sorter.columnKey+'+')
  426. }else if(sorter.order == 'descend'){
  427. this.HttpPost(sorter.columnKey+'-')
  428. }else{
  429. this.HttpPost("")
  430. }
  431. },
  432. moment,
  433. //select切换---项目
  434. selectChange(key){
  435. this.selectValue=key;
  436. },
  437. //打开视频
  438. openVideo(val){
  439. this.Videovisible=true;
  440. this.videoUrl=val
  441. },
  442. videoOk(){
  443. this.Videovisible=false
  444. },
  445. disabledDate(current) {
  446. // console.log(current)
  447. return current && current > moment().subtract(1, 'day')
  448. },
  449. //过去一个月按钮事件
  450. lastWeekHandle() {
  451. let lastStart =
  452. moment()
  453. .subtract(1, 'months')
  454. .format('YYYY-MM-DD')
  455. let lastEnd = moment()
  456. .subtract(1, 'days')
  457. .format('YYYY-MM-DD')
  458. this.loading = true
  459. this.dateRange=[moment(lastStart),moment(lastEnd)]
  460. console.log(this.dateRange)
  461. this.totalSelect = (this.dateRange[1]._d - this.dateRange[0]._d) / (24 * 60 * 60 * 1000) + 1;
  462. this.timedata=[this.dateRange[0]._i,this.dateRange[1]._i]
  463. this.daysFlag = true
  464. this.HttpPost()
  465. },
  466. consumeOnChange() {},
  467. //获取table数据请求
  468. HttpPost(sort){
  469. this.loading=true;
  470. this.date=[];
  471. show = 0
  472. postAction('/toutiao/videoReportDaily/bytedanceVideoInfoListMonth', {
  473. startDate: this.timedata[0],
  474. endDate: this.timedata[1],
  475. cost: this.consumeValue,
  476. signature: this.videoID,
  477. pageNo:this.ipagination.current,
  478. pageSize:this.ipagination.pageSize,
  479. accountIds:this.appId,
  480. sort:sort?sort:''
  481. }).then(res => {
  482. let resArr = []
  483. this.loading = false
  484. console.log(res)
  485. if (res.success) {
  486. let result = res.result
  487. this.data = result.list.map((item,index)=>{
  488. return {
  489. ...item,
  490. key:index
  491. }
  492. })
  493. this.ipagination.total = result.total
  494. }
  495. })
  496. },
  497. //查询按钮
  498. searchRes() {
  499. this.HttpPost()
  500. },
  501. //导出报表
  502. exportExcel() {
  503. // var params = {}
  504. // params.projectId = this.projectId
  505. // params.disCount = this.discount
  506. // params.statDate = this.statDate.format('YYYY-MM-DD')
  507. var name = this.data.filter(item => {
  508. return item.signature == this.signature
  509. })[0].projectName
  510. downFilePost('/toutiao/videoReportDaily/bytedanceVideoInfoListDetailExportExcel', {
  511. startDate: this.timedata[0],
  512. endDate: this.timedata[1],
  513. signature: this.signature
  514. }).then(res => {
  515. let blob = new Blob([res], {
  516. type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  517. })
  518. let downloadElement = document.createElement('a')
  519. let href = window.URL.createObjectURL(blob) //创建下载的链接
  520. downloadElement.href = href
  521. downloadElement.download = name + '-' +this.timedata[0] + '-' + this.timedata[1]+'.xlsx' //下载后文件名
  522. document.body.appendChild(downloadElement)
  523. downloadElement.click() //点击下载
  524. document.body.removeChild(downloadElement) //下载完成移除元素
  525. window.URL.revokeObjectURL(href) //释放掉blob对象
  526. })
  527. },
  528. //日期选择回调
  529. dateChange(data, dataString) {
  530. // console.log(data[1]._d - data[0]._d, dataString)
  531. if(data.length){
  532. this.timedata = dataString
  533. this.dateRange[0] = data[0]
  534. this.totalSelect = (data[1]._d - data[0]._d) / (24 * 60 * 60 * 1000) + 1
  535. this.daysFlag = true
  536. if (this.totalSelect > 31) {
  537. this.$message.error('时间跨度太长啦,选小一点好嘛?')
  538. this.daysFlag = false
  539. this.dateRange = []
  540. }
  541. }else{
  542. this.daysFlag=false
  543. this.dateRange=[]
  544. }
  545. },
  546. //弹出框打开,自定义列
  547. customColumns() {
  548. this.visible = true
  549. this.listNum = [...this.columns]
  550. },
  551. tableHandle(){
  552. // this.listNum = [...this.columns]
  553. console.log(this.listNum.length,this.columns)
  554. this.scrollX=0;
  555. if(this.listNum.length >= 9|| this.columns.length>=9){
  556. this.tableWidth=120;
  557. this.scrollX=this.columns.length*140
  558. console.log(this.scrollX)
  559. }else{
  560. this.scrollX = 0
  561. }
  562. },
  563. loadShow(){
  564. show++
  565. if(this.data.length>0){
  566. if(show == (this.data.length*2)){
  567. this.data = [...this.data]
  568. }
  569. }
  570. },
  571. //弹出框确定
  572. handleOk(e) {
  573. this.loading = false
  574. this.visible = false
  575. this.tableHandle()
  576. if(this.listNum.length>=10){
  577. let newlist=this.listNum.slice(columnsFixd.length)
  578. console.log(newlist)
  579. this.columns = [...columnsFixd,...newlist]
  580. }else{
  581. this.columns = [...this.listNum]
  582. }
  583. if (this.listNum.length == 6) {
  584. this.columns.map((item, index) => {
  585. item.width = 300
  586. })
  587. } else {
  588. this.columns.map((item, index) => {
  589. if (index == 1||index==3) {
  590. item.width = 150
  591. } else if (index >= 2 && index < 6 || index == 0) {
  592. item.width = 100
  593. }
  594. })
  595. // console.log(2)
  596. }
  597. },
  598. //弹出框取消按钮
  599. handleCancel(e) {
  600. this.visible = false
  601. },
  602. //弹出框里的搜索框
  603. onSearch(value) {
  604. console.log(value)
  605. },
  606. //清空全部按钮的事件
  607. clearAllList() {
  608. this.listNum = [...columnsFixd]
  609. console.log(this.$refs.vSummaryTable)
  610. },
  611. //li展示里的关闭按钮 删除当前被选中的这一个列
  612. deleteCol(item, index) {
  613. this.listNum = this.listNum.filter((item1, num) => {
  614. return num != index
  615. })
  616. },
  617. //表格里的操作 打开明细
  618. showModal() {
  619. this.visibleDetail = true
  620. },
  621. //从自定义列拿选择的项
  622. getshowlist(val) {
  623. // console.log(val)
  624. if (val.length) {
  625. // console.log(val);
  626. this.listNum = [...this.listNum,...val]
  627. } else {
  628. var arr
  629. arr = this.listNum.filter((item, index) => {
  630. return item.dataIndex == val.dataIndex
  631. })
  632. }
  633. if (arr.length > 0) {
  634. var index
  635. this.listNum.map((item,ind) => {
  636. if(item.dataIndex == val.dataIndex){
  637. index=ind
  638. }
  639. })
  640. console.log(index)
  641. this.listNum.splice(index, 1)
  642. } else {
  643. this.listNum.push(val)
  644. }
  645. },
  646. //点击查看明细按钮的事件
  647. opendetail(text, record) {
  648. console.log(text, record)
  649. this.visibleDetail = true
  650. this.detailData = []
  651. this.signature=record.signature
  652. console.log(this.signature)
  653. postAction('/toutiao/videoReportDaily/bytedanceVideoInfoListDetail', {
  654. startDate: this.timedata[0],
  655. endDate: this.timedata[1],
  656. signature: record.signature,
  657. accountIds:this.appId
  658. }).then(res => {
  659. let resArr = []
  660. console.log(res)
  661. if (res.success) {
  662. let result = res.result
  663. this.detailData.push({ ...result, key: 1 })
  664. result.map((item, index) => {
  665. item.key = index
  666. })
  667. this.detailData = result
  668. length =this.detailData.length
  669. }
  670. })
  671. }
  672. },
  673. activated() {
  674. console.log('activated')
  675. // this.getParticipateList()
  676. this.statDate = moment().subtract(1, 'day')
  677. moment().format('YYYY-MM-DD_HH:mm')
  678. postAction('/toutiao/videoReportDaily/getColumnJson', {
  679. columnType:4,
  680. }).then((res)=>{
  681. // console.log(res)
  682. if(res.success){
  683. // console.log(JSON.parse(res.result))
  684. if(res.result){
  685. let columns=JSON.parse(res.result)
  686. if(columns.length){
  687. if(columns.length>=columnsFixd.length){
  688. columns.map((item,index)=>{
  689. if(index>columnsFixd.length-1){
  690. item.sorter=function(a,b){ return a[item.dataIndex]-b[item.dataIndex]}
  691. }})
  692. columns=columns.slice(columnsFixd.length);
  693. this.columns=[...columnsFixd,...columns]
  694. this.tableHandle()
  695. }
  696. // console.log(this.columns)
  697. }
  698. }
  699. }
  700. })
  701. this.tableHandle();
  702. },
  703. deactivated() {
  704. let arr = JSON.stringify(this.columns)
  705. // console.log(arr)
  706. postAction('/toutiao/videoReportDaily/saveOrUpdateColumnJson', {
  707. json: arr,
  708. columnType: 4
  709. }).then(res => {
  710. // console.log(res)
  711. })
  712. },
  713. filters: {
  714. toPercentage(val) {
  715. return (val * 100).toFixed(2) + '%'
  716. // return val
  717. },
  718. tofixed(val){
  719. return Number(val).toFixed(2)
  720. }
  721. },
  722. mounted() {
  723. let lastStart =
  724. moment()
  725. .subtract(1, 'months')
  726. .format('YYYY-MM-DD')
  727. let lastEnd = moment()
  728. .subtract(1, 'days')
  729. .format('YYYY-MM-DD')
  730. this.dateRange=[moment(lastStart),moment(lastEnd)]
  731. // console.log(this.dateRange)
  732. this.totalSelect = (this.dateRange[1]._d - this.dateRange[0]._d) / (24 * 60 * 60 * 1000) + 1;
  733. this.timedata=[this.dateRange[0]._i,this.dateRange[1]._i]
  734. this.daysFlag = true
  735. this.HttpPost()
  736. },
  737. }
  738. </script>
  739. <style lang="less">
  740. // .ant-table .ant-table-fixed-left .ant-table-thead {
  741. // height: 108px !important ;
  742. // }
  743. .ant-table .ant-table-thead .ant-table-header-column .ant-table-column-title{
  744. // display:block;
  745. white-space:normal;
  746. word-break: break-all;
  747. }
  748. </style>
  749. <style lang="less" scoped>
  750. .vsummary {
  751. width: 100%;
  752. height: 100%;
  753. }
  754. .xiangmuxuanze{
  755. margin-bottom: 20px;;
  756. }
  757. .timeDiv {
  758. display: flex;
  759. justify-content: space-between;
  760. }
  761. span {
  762. margin-left: 5px;
  763. }
  764. .myinput {
  765. width: 40%;
  766. }
  767. .addlist {
  768. float: left;
  769. width: 70%;
  770. border: 1px solid #eee;
  771. }
  772. .listNum {
  773. float: right;
  774. width: 28%;
  775. border: 1px solid #eee;
  776. position: relative;
  777. }
  778. .zhuti {
  779. margin-top: 15px;
  780. overflow: hidden;
  781. p {
  782. height: 40px;
  783. line-height: 20px;
  784. padding: 10px 15px;
  785. background: rgb(249, 250, 253);
  786. border-bottom: 1px solid #eee;
  787. }
  788. #btn {
  789. position: absolute;
  790. right: 0;
  791. top: 5px;
  792. }
  793. .selectlist {
  794. width:100%;
  795. list-style: none;
  796. margin: 0;
  797. height: 450px;
  798. padding: 0 15px 10px;
  799. overflow: auto;
  800. li {
  801. width: 100%;
  802. padding: 5px 8px;
  803. margin: 6px 0;
  804. border-radius: 10px;
  805. background: rgb(248, 248, 248);
  806. height: 32px;
  807. position: relative;
  808. span {
  809. width: 80%;
  810. height: 100%;
  811. display: inline-block;
  812. margin: 0 10px;
  813. // overflow:hidden;
  814. // text-overflow:ellipsis;
  815. // white-space: nowrap;
  816. }
  817. .listText{
  818. position: absolute;
  819. top: 2;
  820. left: 10;
  821. width: 40%;
  822. overflow: hidden;
  823. white-space: nowrap;
  824. text-overflow: ellipsis;
  825. }
  826. #closeStyle {
  827. position: absolute;
  828. top: 9px;
  829. right: 7px;
  830. }
  831. }
  832. }
  833. }
  834. .addlist {
  835. float: left;
  836. width: 70%;
  837. border: 1px solid #eee;
  838. .selectionList {
  839. padding: 10px 15px;
  840. height: 450px;
  841. overflow: auto;
  842. .leibie {
  843. .leiName {
  844. font-size: 26px;
  845. text-align: left;
  846. }
  847. }
  848. .jutixiang {
  849. display: inline-block;
  850. width: 32%;
  851. box-sizing: border-box;
  852. padding: 10px 3px;
  853. }
  854. }
  855. }
  856. #mybtn {
  857. margin: 0 10px 15px 0;
  858. }
  859. </style>