123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <style>
- .admin-info .ant-list-item-content {
- display: flex;
- justify-content: space-around;
- }
- .admin-info .ant-table-middle tr.ant-table-expanded-row td > .ant-table-wrapper {
- margin: -12px -9px -13px;
- }
- </style>
- <template>
- <div class="admin-info">
- <a-row :gutter="10" style="margin-top:10px">
- <a-col :span="24">
- <a-card
- style="width:100%;"
- :tabList="tabListNoTitle"
- :activeTabKey="noTitleKey"
- @tabChange="key => onTabChange(key, 'noTitleKey')"
- >
- 季度选择:
- <a-select style="width:100px;margin-bottom:30px" placeholder="选择年" v-model="year">
- <a-select-option :value="item" v-for="item of options" :key="item">{{ item }}</a-select-option>
- </a-select>
- <a-select style="width:100px;margin-bottom:30px" placeholder="选择季度" v-model="dateRange">
- <a-select-option :value="item" v-for="item of 4" :key="item">{{ item }}</a-select-option>
- </a-select>
- <a-button type="primary" style="margin-left:10px" @click="addUser">搜索</a-button>
- <a-table :columns="columns" :dataSource="dataList" bordered :loading="loading" size="middle">
- <span slot-scope="text" slot="videoUrl">
- <video class="video" :src="text" controls="controls" style="height:200px">
- 您的浏览器不支持 video 标签。
- </video>
- </span>
- <span slot="action" slot-scope="text, record">
- <a :disabled="record.totalCost == 0 || record.totalCost == null" @click="toDetail(record)">查看详情</a>
- </span>
- </a-table>
- </a-card>
- </a-col>
- </a-row>
- </div>
- </template>
- <script>
- import ChartCard from '@/components/ChartCard'
- import ACol from 'ant-design-vue/es/grid/Col'
- import ATooltip from 'ant-design-vue/es/tooltip/Tooltip'
- import MiniArea from '@/components/chart/MiniArea'
- import MiniBar from '@/components/chart/MiniBar'
- import MiniProgress from '@/components/chart/MiniProgress'
- import RankList from '@/components/chart/RankList'
- import Bar from '@/components/chart/Bar'
- import LineChartMultid from '@/components/chart/LineChartMultid'
- import HeadInfo from '@/components/tools/HeadInfo.vue'
- import Trend from '@/components/Trend'
- import moment from 'moment'
- import { getAction, postAction } from '@/api/manage'
- import { mapGetters } from 'vuex'
- import qs from 'qs'
- const barData = []
- for (let i = 0; i < 12; i += 1) {
- barData.push({
- x: `${i + 1}月`,
- y: Math.floor(Math.random() * 1000) + 200
- })
- }
- const columns = [
- {
- title: '项目名称',
- dataIndex: 'projectName',
- key: 'projectName',
- align: 'center'
- },
- {
- title: '广告主名称',
- dataIndex: 'advertiserName',
- key: 'advertiserName',
- align: 'center'
- },
- {
- title: '运营负责人',
- dataIndex: 'responsibleName',
- key: 'responsibleName',
- align: 'center'
- },
- {
- title: '设计负责人',
- dataIndex: 'designResponsibleName',
- key: 'designResponsibleName',
- align: 'center'
- },
- {
- title: '总消耗',
- dataIndex: 'totalCost',
- key: 'totalCost',
- align: 'center'
- },
- {
- title: '操作',
- dataIndex: 'action',
- key: 'action',
- align: 'center',
- scopedSlots: { customRender: 'action' }
- }
- ]
- export default {
- name: 'admin-info',
- components: {
- ATooltip,
- ACol
- },
- data: function() {
- return {
- type: 1,
- title: '工作台',
- loginfo: {},
- barData,
- visitInfo: [],
- visitFields: ['ip', 'visit'],
- loading: false,
- rankList: [],
- options: [],
- dateRange: null,
- year: new Date().getFullYear(),
- tabListNoTitle: [
- {
- key: 'kuaishou',
- tab: '快手'
- },
- {
- key: 'toutiao',
- tab: '头条'
- }
- ],
- noTitleKey: 'kuaishou',
- a: '',
- columns: columns,
- dataList: []
- }
- },
- methods: {
- disabledDate(current) {
- // Can not select days before today and today
- return current && current > moment().endOf('day')
- },
- ...mapGetters(['nickname', 'avatar', 'userInfo']),
- clearData() {
- this.dataList = []
- },
- addUser() {
- this.loading = true
- this.getKuaishouList()
- },
- onTabChange(key, type) {
- console.log(key, type)
- this.type = 1
- this.dateRange = null
- this.year = '2020'
- this.options = []
- this.dataList = []
- this.columns = columns
- this[type] = key
- },
- toDetail(item) {
- // {"year":2020,"quarter":1,"appType":2,"projectId":47}
- localStorage.setItem('projectStatisticsId', item.projectId)
- localStorage.setItem('projectAppType', this.noTitleKey)
- localStorage.setItem('projectYear', this.year)
- localStorage.setItem('projectQuarter', this.dateRange)
- this.$router.replace({
- path: '/Statistics/projectDetail'
- })
- },
- getKuaishouList() {
- var params = {}
- params.year = this.year
- params.quarter = this.dateRange
- params.appType = this.noTitleKey == 'kuaishou' ? 2 : 1
- postAction('/ctop/performance2/getProjcetListByMediaType', params).then(res => {
- console.log(res)
- if (res.success) {
- this.loading = false
- this.dataList = res.result.map((item, index) => {
- return {
- ...item,
- key: index
- }
- })
- } else {
- this.loading = false
- this.$message.error(res.message)
- }
- })
- }
- },
- created() {
- // this.getKuaishouList()
- var myDate = new Date()
- var startYear = myDate.getFullYear() - 5 //起始年份
- var endYear = myDate.getFullYear() + 5 //结束年份
- for (var i = startYear; i <= endYear; i++) {
- this.options.push(i)
- }
- }
- }
- </script>
|