Procházet zdrojové kódy

Merge branch 'feature/work-test'

朱鑫波 před 3 roky
rodič
revize
41d599d060

+ 1 - 1
.env.production

@@ -7,7 +7,7 @@ VUE_APP_BASE_REPORT_URL = http://api.tjyourong.com.cn/reportModule
 # 线上地址 http://api.tjyourong.com.cn
 
 #脚本视频接口
-VUE_APP_BASE_SCRIPT_URL = http://114.117.193.186:31013
+VUE_APP_BASE_SCRIPT_URL = http://192.168.0.195:31013
 # 线上地址 http://114.117.193.186:31013
 # 测试地址 http://139.186.134.115:31013
 # 新测试地址 http://192.168.0.195:31013

+ 336 - 67
src/views/modules/script/index.vue

@@ -242,6 +242,7 @@
             <a-tabs v-model="tabKey" @change="tabChange">
                 <a-tab-pane :key="1" tab="脚本配置列表"> </a-tab-pane>
                 <a-tab-pane :key="2" tab="脚本数据导出列表"> </a-tab-pane>
+                <a-tab-pane :key="3" tab="脚本评分"> </a-tab-pane>
                 <a-button slot="tabBarExtraContent" type="primary" @click="newCreat(null)" v-if="tabKey == 1">
                     新建
                 </a-button>
@@ -261,7 +262,7 @@
                                 <a-range-picker
                                     v-decorator="[
                                         'timeRange',
-                                        { initialValue: [moment().subtract(1, 'months'), moment()] }
+                                        { initialValue: [moment().subtract(1, 'months'), moment()] },
                                     ]"
                                     :ranges="dateRanges"
                                     :disabled-date="disabledDate"
@@ -278,10 +279,10 @@
                             </span>
                         </a-col>
                     </a-row>
-                    <a-row :gutter="24" v-else>
+                    <a-row :gutter="24" v-else-if="tabKey === 2">
                         <a-col :md="6" :sm="6" :xxl="6">
                             <a-form-item label="选择来源">
-                                <a-select v-decorator="['source_code']" mode="multiple" style="width: 100%;">
+                                <a-select v-decorator="['source_code']" mode="multiple" style="width: 100%">
                                     <a-select-option value="1">内部创意</a-select-option
                                     ><a-select-option value="2">巨量创意</a-select-option
                                     ><a-select-option value="3">开眼快创</a-select-option>
@@ -298,7 +299,7 @@
                                 <a-range-picker
                                     v-decorator="[
                                         'timeRange',
-                                        { initialValue: [moment().subtract(1, 'months'), moment()] }
+                                        { initialValue: [moment().subtract(1, 'months'), moment()] },
                                     ]"
                                     :ranges="dateRanges"
                                     :disabled-date="disabledDateThen"
@@ -330,13 +331,68 @@
                             </a-form-item>
                         </a-col> -->
                     </a-row>
+                    <a-row :gutter="24" v-else-if="tabKey === 3">
+                        <a-col :md="6" :sm="6" :xxl="6">
+                            <a-form-item label="时间选择">
+                                <a-range-picker
+                                    v-decorator="[
+                                        'timeRange',
+                                        { initialValue: [moment().subtract(1, 'months'), moment()] },
+                                    ]"
+                                    :ranges="dateRanges"
+                                    :disabled-date="disabledDate"
+                                />
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="6" :xxl="6">
+                            <a-form-item label="关键字">
+                                <a-input v-decorator="['search_word']" placeholder="请输入关键字" />
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="6" :xxl="6">
+                            <a-form-item label="上传人">
+                                <a-input v-decorator="['user_name']" placeholder="请输入上传人" />
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="6" :sm="6" :xxl="6">
+                            <a-form-item label="评分">
+                                <a-select v-decorator="['script_level']" mode="multiple" style="width: 100%">
+                                    <a-select-option :value="1">优</a-select-option
+                                    ><a-select-option :value="2">良</a-select-option
+                                    ><a-select-option :value="3">低质</a-select-option>
+                                </a-select>
+                            </a-form-item>
+                        </a-col>
+
+                        <a-col :md="6" :sm="6" :xxl="6">
+                            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
+                                <a-button type="primary" icon="search" @click="handleQueryList">查询</a-button>
+                                <a-button type="primary" @click="handleResetForm" icon="reload" class="middle-button"
+                                    >重置</a-button
+                                >
+                            </span>
+                        </a-col>
+                    </a-row>
                 </a-form>
             </div>
         </a-card>
 
-        <a-row style="margin-bottom:15px;margin-top:12px">
+        <a-row style="margin-bottom: 15px; margin-top: 12px">
             <a-col :span="24">
-                <div class="tableBody" style="min-height:200px;padding-bottom: 50px">
+                <div class="tableBody" style="min-height: 200px; padding-bottom: 50px">
+                    <div style="width: 100%; display: flex; justify-content: flex-end; margin-bottom: 10px">
+                        <a-button
+                            type="primary"
+                            @click="
+                                scoreVisible = true
+                                scoreResults = undefined
+                                scoreValue = undefined
+                            "
+                            v-if="tabKey === 3"
+                            >去评分</a-button
+                        >
+                    </div>
+
                     <a-table
                         :columns="columns"
                         :dataSource="dataSource"
@@ -344,12 +400,14 @@
                         :loading="dataLoading"
                         bordered
                         size="middle"
-                        style="word-break: break-all;font-size:16px;font-weight:600"
+                        style="word-break: break-all; font-size: 16px; font-weight: 600"
                         id="outTable"
                         ref="accountTable"
                         rowKey="number"
                         :customRow="rowClick"
-                        :rowSelection="tabKey == 1 ? null : { selectedRowKeys, onChange: onSelectChange }"
+                        :rowSelection="
+                            tabKey == 1 || tabKey == 3 ? null : { selectedRowKeys, onChange: onSelectChange }
+                        "
                     >
                         <span slot="query_word" slot-scope="text, record">
                             {{ Array.isArray(text) ? text.join() : text }}
@@ -363,11 +421,31 @@
                         <span slot="action" slot-scope="text, record">
                             <a @click.stop="deleteScript(record)">删除</a>
                         </span>
+                        <span slot="start_time" slot-scope="text, record">
+                            {{ text.split('T').join('   ') }}
+                        </span>
+                        <span slot="script_text" slot-scope="text, record">
+                            {{ text.slice(0, 15) + '......' }}
+                        </span>
+                        <span slot="scriptActive" slot-scope="text, record">
+                            <a
+                                @click.stop="
+                                    detailsVisible = true
+                                    detailsData = record
+                                "
+                                :disabled="userInfo().id != record.user_id"
+                                >查看详情</a
+                            >
+                            <a-divider type="vertical" />
+                            <a @click.stop="deleteScriptScore(record)" :disabled="userInfo().id != record.user_id"
+                                >删除</a
+                            >
+                        </span>
                     </a-table>
                     <a-pagination
                         size="small"
                         :showTotal="ipagination.showTotal"
-                        style="float: right;margin-top:10px"
+                        style="float: right; margin-top: 10px"
                         v-if="dataSource.length > 0"
                         showQuickJumper
                         show-size-changer
@@ -406,6 +484,93 @@
                 </div>
             </div> -->
         </a-modal>
+        <a-modal
+            v-if="scoreVisible"
+            title="脚本评分"
+            :visible="scoreVisible"
+            dialog-class="web-url-modal"
+            :footer="null"
+            @cancel="scoreVisible = false"
+            :width="1000"
+        >
+            <h3>评分规则:</h3>
+            <a-table ref="table" size="middle" bordered :dataSource="scoreData" :pagination="false">
+                <a-table-column key="score" data-index="score" title="评分" align="center" />
+                <a-table-column key="you" data-index="you" title="评分<=85" align="center" />
+                <a-table-column key="liang" data-index="liang" title="85<评分<=95" align="center" />
+                <a-table-column key="cha" data-index="cha" title="95<评分<=100" align="center" />
+            </a-table>
+            <span style="color: red; margin: 10px 0; display: block"
+                >注意事项:该打分模型适用于淘特产品,其他产品使用效果未知</span
+            >
+            <h3>脚本输入区:</h3>
+            <a-textarea
+                v-model="scoreValue"
+                placeholder="请输入脚本内容,多于100字的脚本评分会更有价值"
+                :auto-size="{ minRows: 3, maxRows: 5 }"
+                @change="scoreResults = undefined"
+            />
+            <div style="width: 100%; display: flex; justify-content: flex-end; margin-top: 10px">
+                <a-button type="primary" @click="getScore" v-if="!scoreResults" :loading="scoreLoading">评分</a-button>
+            </div>
+            <div v-if="!!scoreResults">
+                <h3>评分结果展示:</h3>
+                <div style="width: 100%; border: 1px solid #d9d9d9; border-radius: 4px; display: flex; padding: 5px">
+                    <span style="font-size: 30px; font-weight: 700; margin-right: 20px">
+                        {{ scoreResults.script_level == 1 ? '优' : scoreResults.script_level == 2 ? '良' : '低质' }}
+                    </span>
+                    <div>
+                        <p style="margin-bottom: 0px">
+                            该脚本评分为:{{ scoreResults.script_score ? scoreResults.script_score : '-' }}分
+                        </p>
+                        <p>
+                            使用该脚本后,素材累计消耗达到2W+概率为:{{
+                                (scoreResults.high_quality_prob * 100).toFixed(2) + '%'
+                            }}
+                        </p>
+                    </div>
+                </div>
+            </div>
+        </a-modal>
+        <a-modal
+            v-if="detailsVisible"
+            title="脚本详情"
+            :visible="detailsVisible"
+            dialog-class="web-url-modal"
+            :footer="null"
+            @cancel="detailsVisible = false"
+            :width="1000"
+        >
+            <div v-if="!!detailsData">
+                <h3>脚本内容:</h3>
+                <a-textarea
+                    disabled
+                    v-model="detailsData.script_text"
+                    placeholder="请输入脚本内容,多于100字的脚本评分会更有价值"
+                    :auto-size="{ minRows: 3, maxRows: 5 }"
+                />
+                <div style="margin-top: 10px">
+                    <h3>评分结果展示:</h3>
+                    <div
+                        style="width: 100%; border: 1px solid #d9d9d9; border-radius: 4px; display: flex; padding: 5px"
+                    >
+                        <span style="font-size: 30px; font-weight: 700; margin-right: 20px">
+                            {{ detailsData.script_level == 1 ? '优' : detailsData.script_level == 2 ? '良' : '低质' }}
+                        </span>
+                        <div>
+                            <p style="margin-bottom: 0px">
+                                该脚本评分为:{{ detailsData.script_score ? detailsData.script_score : '-' }}分
+                            </p>
+                            <p>
+                                使用该脚本后,素材累计消耗达到2W+概率为:{{
+                                    (detailsData.high_quality_prob * 100).toFixed(2) + '%'
+                                }}
+                            </p>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </a-modal>
     </div>
 </template>
 
@@ -442,36 +607,36 @@ let TTcolumns = [
         dataIndex: 'query_word',
         scopedSlots: { customRender: 'query_word' },
         align: 'center',
-        key: 'query_word'
+        key: 'query_word',
     },
     {
         title: '推荐词',
         dataIndex: 'recommended_word',
         scopedSlots: { customRender: 'recommended_word' },
         align: 'center',
-        key: 'recommended_word'
+        key: 'recommended_word',
     },
     {
         title: '创建时间',
         dataIndex: 'create_time',
         scopedSlots: { customRender: 'create_time' },
         align: 'center',
-        key: 'create_time'
+        key: 'create_time',
     },
     {
         title: '创建人',
         dataIndex: 'operator',
         scopedSlots: { customRender: 'operator' },
         align: 'center',
-        key: 'operator'
+        key: 'operator',
     },
     {
         title: '操作',
         dataIndex: 'action',
         scopedSlots: { customRender: 'action' },
         align: 'center',
-        key: 'action'
-    }
+        key: 'action',
+    },
 ]
 
 let KScolumns = [
@@ -480,36 +645,91 @@ let KScolumns = [
         dataIndex: 'source_name',
         scopedSlots: { customRender: 'source_name' },
         align: 'center',
-        key: 'source_name'
+        key: 'source_name',
     },
     {
         title: '关键字',
         dataIndex: 'query_word',
         scopedSlots: { customRender: 'query_word' },
         align: 'center',
-        key: 'query_word'
+        key: 'query_word',
     },
     {
         title: '时间',
         dataIndex: 'stat_date',
         scopedSlots: { customRender: 'stat_date' },
         align: 'center',
-        key: 'stat_date'
+        key: 'stat_date',
     },
     {
         title: '数据量级',
         dataIndex: 'script_num',
         scopedSlots: { customRender: 'script_num' },
         align: 'center',
-        key: 'script_num'
+        key: 'script_num',
     },
     {
         title: '状态',
         dataIndex: 'task_status',
         scopedSlots: { customRender: 'task_status' },
         align: 'center',
-        key: 'task_status'
-    }
+        key: 'task_status',
+    },
+]
+
+let scriptColumns = [
+    {
+        title: '脚本id',
+        dataIndex: 'script_hash',
+        scopedSlots: { customRender: 'script_hash' },
+        align: 'center',
+        key: 'script_hash',
+    },
+    {
+        title: '时间',
+        dataIndex: 'start_time',
+        scopedSlots: { customRender: 'start_time' },
+        align: 'center',
+        key: 'start_time',
+    },
+    {
+        title: '脚本内容',
+        dataIndex: 'script_text',
+        scopedSlots: { customRender: 'script_text' },
+        align: 'center',
+        key: 'script_text',
+        // width: 500,
+    },
+    {
+        title: '上传人',
+        dataIndex: 'user_name',
+        scopedSlots: { customRender: 'user_name' },
+        align: 'center',
+        key: 'user_name',
+    },
+    {
+        title: '评分等级',
+        dataIndex: 'script_level',
+        // scopedSlots: { customRender: 'script_level' },
+        align: 'center',
+        key: 'script_level',
+        customRender: function (text) {
+            if (text === 1) {
+                return '优'
+            } else if (text === 2) {
+                return '良'
+            } else {
+                return '低质'
+            }
+        },
+    },
+    {
+        title: '操作',
+        dataIndex: 'scriptActive',
+        scopedSlots: { customRender: 'scriptActive' },
+        align: 'center',
+        key: 'scriptActive',
+    },
 ]
 
 export default {
@@ -519,7 +739,7 @@ export default {
         checkBoxGroup,
         selectCheckAll,
         selectTreeAccount,
-        keyWord
+        keyWord,
     },
 
     data() {
@@ -547,23 +767,34 @@ export default {
             exportloading: false,
             dateRange: [moment().subtract(1, 'weeks'), moment()],
             noImg: require('@/assets/noImg.png'),
+            scoreData: [
+                {
+                    score: '素材消耗达到2W+的概率',
+                    you: '19.05%',
+                    liang: '43.30%',
+                    cha: '69.16%',
+                },
+            ],
+            scoreValue: undefined,
+            scoreResults: undefined,
+            scoreLoading: false,
             validationRules: {
                 bid: [
                     {
                         required: true,
-                        message: '出价信息必须填写'
+                        message: '出价信息必须填写',
                         // validator: this.validateBid,
-                    }
-                ]
+                    },
+                ],
             },
             dateRanges: {
                 昨天: [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                 近三天: [moment().subtract(2, 'days'), moment()],
                 近一周: [moment().subtract(6, 'days'), moment()],
                 近14天: [moment().subtract(13, 'days'), moment()],
-                近一月: [moment().subtract(1, 'months'), moment()]
+                近一月: [moment().subtract(1, 'months'), moment()],
             },
-            rowClick: record => {
+            rowClick: (record) => {
                 return {
                     on: {
                         click: () => {
@@ -572,8 +803,8 @@ export default {
                                 this.config_id = record.config_id
                                 this.tabChange(this.tabKey)
                             }
-                        }
-                    }
+                        },
+                    },
                 }
             },
             ipagination: {
@@ -592,7 +823,7 @@ export default {
                     // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
                     this.ipagination.current = current
                     this.ipagination.pageSize = pageSize
-                }
+                },
             },
             value: 'valid',
             KSaccountList: [],
@@ -619,6 +850,7 @@ export default {
             loading: false,
             TTcolumns,
             KScolumns,
+            scriptColumns,
             columns: [...TTcolumns],
             dataSource: [],
 
@@ -647,7 +879,10 @@ export default {
             againLoading: false,
             accountProjectDetail: null,
             regionData: [{ label: '不限', value: 'unlimited' }],
-            ageData: [{ label: '不限', value: 'unlimited' }]
+            ageData: [{ label: '不限', value: 'unlimited' }],
+            scoreVisible: false,
+            detailsVisible: false,
+            detailsData: undefined,
         }
     },
     methods: {
@@ -664,7 +899,30 @@ export default {
                     params.user_id = item.user_id
                     params.operator = item.operator
                     that.postDataAction(process.env.VUE_APP_BASE_SCRIPT_URL + '/delete_script_config/', params).then(
-                        res => {
+                        (res) => {
+                            if (res.success) {
+                                const paramsData = that.form.getFieldsValue()
+                                that.handleGetTableList(paramsData)
+                            }
+                        }
+                    )
+                },
+                onCancel() {},
+            })
+        },
+        deleteScriptScore(item) {
+            let that = this
+            this.$confirm({
+                title: '确定要删除此条脚本评分信息?',
+                content: '',
+                onOk() {
+                    var params = {}
+                    params.unique_id = item.unique_id
+                    params.user_id = item.user_id
+                    params.user_name = item.user_name
+
+                    that.postDataAction(process.env.VUE_APP_BASE_SCRIPT_URL + '/delete_script_score', params).then(
+                        (res) => {
                             if (res.success) {
                                 const paramsData = that.form.getFieldsValue()
                                 that.handleGetTableList(paramsData)
@@ -672,25 +930,25 @@ export default {
                         }
                     )
                 },
-                onCancel() {}
+                onCancel() {},
             })
         },
         handleOkDownLoad() {
             this.selectionRows = tqFun(this.selectionRowsAll)
             if (this.selectionRows.length > 0) {
                 this.downLoading = true
-                let params = this.selectionRows.map(item => {
+                let params = this.selectionRows.map((item) => {
                     return {
                         source_code: item.source_name == '内部创意' ? 1 : item.source_name == '巨量创意' ? 2 : 3,
                         query_word: item.query_word,
-                        stat_date: item.stat_date
+                        stat_date: item.stat_date,
                     }
                 })
 
-                downFilePost(process.env.VUE_APP_BASE_SCRIPT_URL + '/export_script_file/', params).then(res => {
+                downFilePost(process.env.VUE_APP_BASE_SCRIPT_URL + '/export_script_file/', params).then((res) => {
                     this.downLoading = false
                     let blob = new Blob([res], {
-                        type: 'application/vnd.openxmlformats-officedocument.spre1adsheetml.sheet'
+                        type: 'application/vnd.openxmlformats-officedocument.spre1adsheetml.sheet',
                     })
                     let downloadElement = document.createElement('a')
                     let href = window.URL.createObjectURL(blob) //创建下载的链接
@@ -746,7 +1004,7 @@ export default {
                 params.query_word_pair = this.creativeTag
                 params.operator = this.userInfo().realname
                 params.user_id = this.userInfo().id
-                this.postDataAction(process.env.VUE_APP_BASE_SCRIPT_URL + '/add_script_config/', params).then(res => {
+                this.postDataAction(process.env.VUE_APP_BASE_SCRIPT_URL + '/add_script_config/', params).then((res) => {
                     if (res.success) {
                         this.handleCancelAll()
                         this.creativeTag = []
@@ -758,7 +1016,7 @@ export default {
             }
         },
         handleTagsClose(removedTag) {
-            const tags = this.creativeTag.filter(tag => tag !== removedTag)
+            const tags = this.creativeTag.filter((tag) => tag !== removedTag)
             this.creativeTag = tags
         },
         getData(className) {
@@ -777,7 +1035,7 @@ export default {
             }
             this.selectedRowKeysAll[this.ipagination.current - 1] = selectedRowKeys
             this.selectionRowsAll[this.ipagination.current - 1] = selectionRows
-            console.log(this.selectedRowKeysAll,this.selectionRowsAll)
+            console.log(this.selectedRowKeysAll, this.selectionRowsAll)
         },
         getDataSource(current, pageSize) {
             console.log(pageSize)
@@ -837,7 +1095,7 @@ export default {
                         ? moment(data.timeRange[1]).format('YYYY-MM-DD')
                         : null,
                 page_num: this.ipagination.current,
-                page_size: this.ipagination.pageSize
+                page_size: this.ipagination.pageSize,
                 // userId: this.userInfo().id
             }
             if (this.tabKey == 2 && this.config_id) {
@@ -846,7 +1104,7 @@ export default {
             this.dataSource = []
             this.dataLoading = true
             this.postDataAction(this.url, paramsData)
-                .then(result => {
+                .then((result) => {
                     this.dataLoading = false
                     if (result.success) {
                         this.dataSource = result.result || []
@@ -861,11 +1119,29 @@ export default {
                         this.$message.error(result.message)
                     }
                 })
-                .catch(error => {
+                .catch((error) => {
                     this.dataLoading = false
                     console.log(error, 'eeee')
                 })
         },
+        score() {},
+        getScore() {
+            if (!!this.scoreValue) {
+                this.scoreLoading = true
+                var params = {}
+                params.user_name = this.userInfo().realname
+                params.user_id = this.userInfo().id
+                params.script = this.scoreValue
+                this.postDataAction(process.env.VUE_APP_BASE_SCRIPT_URL + '/get_script_score', params).then((res) => {
+                    this.scoreLoading = false
+                    if (res.success) {
+                        this.scoreResults = res.result
+                    }
+                })
+            } else {
+                this.$message.error('请输入脚本')
+            }
+        },
         getAccountNoProject() {
             this.projectId = undefined
             const paramsData = this.form.getFieldsValue()
@@ -884,18 +1160,20 @@ export default {
         tabChange(key) {
             this.ipagination.current = 1
             this.ipagination.pageSize = 10
-
-            this.columns = this.tabKey == 1 ? [...TTcolumns] : [...KScolumns]
+            this.form.resetFields()
+            this.columns = this.tabKey == 1 ? [...TTcolumns] : this.tabKey == 2 ? [...KScolumns] : [...scriptColumns]
             this.url =
                 this.tabKey == 1
                     ? process.env.VUE_APP_BASE_SCRIPT_URL + '/get_script_config_lst/'
-                    : process.env.VUE_APP_BASE_SCRIPT_URL + '/get_query_word_task_info_lst/'
+                    : this.tabKey == 2
+                    ? process.env.VUE_APP_BASE_SCRIPT_URL + '/get_query_word_task_info_lst/'
+                    : process.env.VUE_APP_BASE_SCRIPT_URL + '/get_script_score_lst/'
             if (this.tabKey == 1) {
                 this.config_id = null
             }
             this.selectedRowKeys = []
             this.selectionRows = []
-            this.form.resetFields()
+
             const paramsData = this.form.getFieldsValue()
             this.handleGetTableList(paramsData)
         },
@@ -908,22 +1186,16 @@ export default {
                 this.accountDisabled = false
             }
         },
-
-        // table区域的tab切换
-        tableTabChange(key) {
-            if (key == 1) {
-                this.columns = this.tabKey == 1 ? [...TTcolumns] : [...KScolumns]
-                this.target = 'new'
-            } else {
-                this.columns = this.tabKey == 1 ? [...TTcolumns] : [...KScolumns]
-                this.target = 'valid'
-            }
-        }
     },
     watch: {
         dateValue(newName, oldName) {
             this.search()
-        }
+        },
+        scoreVisible(n, o) {
+            if (!n) {
+                this.tabChange(3)
+            }
+        },
     },
     computed: {
         newDate() {
@@ -934,13 +1206,13 @@ export default {
             var d = myDate.getDate() //获取当前日(1-31)
             var day = myDate.getHours()
             return day
-        }
+        },
     },
     mounted() {
         const paramsData = this.form.getFieldsValue()
         this.handleGetTableList(paramsData)
     },
-    activated: function() {},
+    activated: function () {},
 
     filters: {
         toPercentage(val) {
@@ -976,10 +1248,7 @@ export default {
                     let numberStr = val.toString()
                     let str = numberStr.split('.')
 
-                    let str0 = str[0]
-                        .substr(1)
-                        .split('')
-                        .reverse()
+                    let str0 = str[0].substr(1).split('').reverse()
                     for (let i = 0; i < str0.length; i++) {
                         if ((i + 1) % 4 === 0) {
                             str0.splice(i, 0, ',')
@@ -1018,7 +1287,7 @@ export default {
             } else {
                 return '-'
             }
-        }
-    }
+        },
+    },
 }
 </script>

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 339 - 266
src/views/modules/stockWatch/modules/new-keepManage/account-newkeepManage.vue


+ 170 - 3
src/views/modules/stockWatch/modules/new-keepManage/acountProjectData.js

@@ -1070,12 +1070,12 @@ export const KScustomFields= [
       specificFields: [
         {
           title: '消耗(元)',
-          dataIndex: 'totalCost',
+          dataIndex: 'charge',
           width:150,
           tip: '广告在投放期间的花费总额',
           align: 'center',
-          scopedSlots: { customRender: 'totalCost' },
-          
+          scopedSlots: { customRender: 'charge' },
+          sorter:(a, b) => a.activation - b.activation,
         },{
             title: '激活数',
             dataIndex: 'activation',
@@ -1232,5 +1232,172 @@ export const KScustomFields= [
    
   ]
 
+  export const indexCustomIndicator = [
+    {
+      id: 0,
+      title: '展现数据',
+      checkall: false,
+      form:[],
+      specificFields: [
+        {
+          title: '消耗(元)',
+          dataIndex: 'cost',
+          width:150,
+          tip: '广告在投放期间的花费总额',
+          align: 'center',
+          scopedSlots: { customRender: 'cost' },
+          
+        },{
+            title: '激活数',
+            dataIndex: 'activation',
+            width:150,
+            tip: '广告主回传的应用激活次数',
+            align: 'center',
+            scopedSlots: { customRender: 'activation' },
+            sorter:(a, b) => a.activation - b.activation,
+          },{
+            title: '激活单价',
+            dataIndex: 'activationPrice',
+            width:150,
+            tip: '花费/激活数',
+            align: 'center',
+            scopedSlots: { customRender: 'activationPrice' },
+            sorter:(a, b) => a.activationPrice - b.activationPrice,
+          }, {
+            title: '次留率',
+            dataIndex: 'leave',
+            tip: '次留数/激活数',
+            align: 'center',    
+            scopedSlots: { customRender: 'leave' },
+            sorter:(a, b) => a.leave - b.leave,
+          },{
+            title: '付费数',
+            dataIndex: 'eventPay',
+            tip: '当如回传的付费行为次数',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventPay' },
+            sorter:(a, b) => a.eventPay - b.eventPay,
+          },
+          {
+            title: '付费率',
+            dataIndex: 'eventPayRate',
+            tip: '付费数/(激活数+表单数)',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventPayRate' },
+            sorter:(a, b) => a.eventPayRate - b.eventPayRate,
+          },
+          {
+            title: '付费成本',
+            dataIndex: 'eventPayCost',
+            tip: '消耗/付费次数',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventPayCost' },
+            sorter:(a, b) => a.eventPayCost - b.eventPayCost,
+          }, {
+            title: '新增付费数',
+            dataIndex: 'eventNewUserPay',
+            tip: '历史30天内首次产生付费的人数',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventNewUserPay' },
+            sorter:(a, b) => a.eventNewUserPay - b.eventNewUserPay,
+          },{
+            title: '新增付费成本',
+            dataIndex: 'eventNewUserPayCost',
+            tip: '当日消耗/当日新增付费人数',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventNewUserPayCost' },
+            sorter:(a, b) => a.eventNewUserPayCost - b.eventNewUserPayCost,
+          },{
+            title: '新增付费率',
+            dataIndex: 'eventNewUserPayRate',
+            tip: '当日新增付费人数/(当日激活数+表单数)',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventNewUserPayRate' },
+            sorter:(a, b) => a.eventNewUserPayRate - b.eventNewUserPayRate,
+          },{
+            title: '唤起应用数',
+            dataIndex: 'eventAppInvoked',
+            tip: '广告主当日回传的唤起应用次数',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventAppInvoked' },
+            sorter:(a, b) => a.eventAppInvoked - b.eventAppInvoked,
+          },{
+            title: '唤起应用成本',
+            dataIndex: 'eventAppInvokedCost',
+            tip: '当日消耗/唤起应用数',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventAppInvokedCost' },
+            sorter:(a, b) => a.eventAppInvokedCost - b.eventAppInvokedCost,
+          },{
+            title: '注册数',
+            dataIndex: 'eventRegister',
+            tip: '当日回传注册数',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventRegister' },
+            sorter:(a, b) => a.eventRegister - b.eventRegister,
+          },{
+            title: '注册成本',
+            dataIndex: 'eventRegisterCost',
+            tip: '当日消耗/当日回传注册数',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventRegisterCost' },
+            sorter:(a, b) => a.eventRegisterCost - b.eventRegisterCost,
+          },{
+            title: '关键行为数',
+            dataIndex: 'keyAction',
+            tip: '广告主回传的关键行为数',
+            align: 'center',    
+            scopedSlots: { customRender: 'keyAction' },
+            sorter:(a, b) => a.keyAction - b.keyAction,
+          },{
+            title: '关键行为成本',
+            dataIndex: 'keyActionCost',
+            tip: '筛选时间内累计消耗/关键行为数',
+            align: 'center',    
+            scopedSlots: { customRender: 'keyActionCost' },
+            sorter:(a, b) => a.keyActionCost - b.keyActionCost,
+          },{
+            title: '关键行为率',
+            dataIndex: 'keyActionRate',
+            tip: '关键行为数/激活数',
+            align: 'center',    
+            scopedSlots: { customRender: 'keyActionRate' },
+            sorter:(a, b) => a.keyActionRate - b.keyActionRate,
+          },{
+            title: '首日付费金额',
+            dataIndex: 'eventPayPurchaseAmountFirstDay',
+            tip: '当日激活的用户在当天产生的付费行为所带来的付费金额',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventPayPurchaseAmountFirstDay' },
+            sorter:(a, b) => a.eventPayPurchaseAmountFirstDay - b.eventPayPurchaseAmountFirstDay,
+          },{
+            title: '首日ROI',
+            dataIndex: 'eventPayFirstDayRoi',
+            tip: '首日付费金额/当日消耗',
+            align: 'center',    
+            scopedSlots: { customRender: 'eventPayFirstDayRoi' },
+            sorter:(a, b) => a.eventPayFirstDayRoi - b.eventPayFirstDayRoi,
+          },{
+                title: '表单提交数',
+                dataIndex: 'formCount',
+                tip: '当日回传表单数',
+                align: 'center',
+                scopedSlots: { customRender: 'formCount' },
+                sorter:(a, b) => a.formCount - b.formCount,
+            },{
+                title: '表单提交单价',
+                dataIndex: 'formCountPrice',         
+                tip: '当日消耗/当日回传表单数',
+                align: 'center',
+                scopedSlots: { customRender: 'formCountPrice' },
+                sorter: (a, b) => a.formCountPrice - b.formCountPrice,
+              }
 
+
+
+
+ 
+      ]
+      },
+    ]
 //  export default { TTcustomFields, KScustomFields }

+ 1 - 0
src/views/modules/stockWatch/modules/new-keepManage/customColumnProject.vue

@@ -130,6 +130,7 @@
         this.visibleOk = false
         this.$emit('closeCustomColumn', false)
         this.$emit('changeColumn', this.mylistNum)
+        this.$emit('changeColumnIndex',this.mylistNum)
       },
       //取消按钮
       handleCancel() {

+ 7 - 5
src/views/modules/stockWatch/modules/new-keepManage/group-keepManage.vue

@@ -452,10 +452,9 @@
                 })
             },
             projectNameClick(row) {
-                this.echartsLoading = true;
+                this.titleList = '账户列表'
                 this.columnsFixd = keepPersonData.setNoDeleteProjectColumns();
                 this.listNum = keepPersonData.setNoDeleteProjectColumns();
-                this.titleList = '账户列表列表'
                 this.columnsProject = [
                     {
                         title: '账户名称',
@@ -507,10 +506,11 @@
                         dataIndex: 'photoClick',
                     },
                 ],
+                this.projectAccount = 'b';
                     this.projectId = row.projectId;
                 this.echartsIpaginationProject.current = 1;
                 this.getAccountData();
-                this.projectAccount = 'b';
+                this.showColumn();
             },
             projectAccountChange(ent) {
                 this.echartsLoading = true;
@@ -634,10 +634,12 @@
                 this.showColumn();
             },
             accountNameClick(row) {
-                // this.$router.push({ path: '/modules/stockWatch/modules/new-keepManage/account-newkeepManage', query: { accountId: row.accountId } })
+                // sessionStorage.setItem("personalaccountId",row.accountId)
+                // this.$router.push({ path: '/modules/stockWatch/modules/new-keepManage/account-newkeepManage'})
             },
             userNameClick(row) {
-                // this.$router.push({ path: '/modules/stockWatch/modules/new-keepManage/personal-keepManage', query: { userId: row.userId } })
+                sessionStorage.setItem("personalUserId",row.userId)
+                this.$router.push({ path: '/modules/stockWatch/modules/new-keepManage/personal-keepManage' })
             },
             // 运营组数据
             getOperationGroupData() {

+ 82 - 6
src/views/modules/stockWatch/modules/new-keepManage/new-keep-data.js

@@ -34,7 +34,7 @@
                  fixed: 'left',
              },
              {
-                 title: '花费',
+                 title: '消耗(元)',
                  dataIndex: 'totalCost',
                  align: 'center',
                  width: 100,
@@ -99,7 +99,7 @@
                 fixed: 'left',
             },
             {
-                title: '花费',
+                title: '消耗(元)',
                 dataIndex: 'totalCost',
                 scopedSlots: { customRender: 'totalCost' },
                 align: 'center',
@@ -123,6 +123,82 @@
             
         ]
     }
+    setNoActionProjectColumns() {
+        return [
+            {
+                title: '账户名称',
+                dataIndex: 'accountName',
+                scopedSlots: { customRender: 'accountName' },
+                align: 'center',
+                key: 'date',
+                width: 200,
+                fixed: 'left',
+            },{
+                title: '账户ID',
+                dataIndex: 'accountId',
+                scopedSlots: { customRender: 'accountId' },
+                align: 'center',
+                width: 100,
+                fixed: 'left',
+            },{
+                title: '预算',
+                dataIndex: 'warningAmount',
+                scopedSlots: { customRender: 'warningAmount' },
+                align: 'center',
+                width: 100,
+                fixed: 'left',
+            },{
+                title: '余额',
+                dataIndex: 'balance',
+                scopedSlots: { customRender: 'balance' },
+                align: 'center',
+                width: 100,
+                fixed: 'left',
+            },
+            {
+                title: '运营人员',
+                dataIndex: 'userName',
+                align: 'center',
+                width: 100,
+                fixed: 'left',
+            },
+            {
+                title: '消耗(元)',
+                dataIndex: 'totalCost',
+                scopedSlots: { customRender: 'totalCost' },
+                align: 'center',
+                width: 100,
+                fixed: 'left',
+                sorter: (a, b) => a.totalCost - b.totalCost,
+            },
+            {
+                title: '花费环比',
+                dataIndex: 'yearOnYear',
+                align: 'center',
+                width: 100,
+                fixed: 'left',
+            },{
+                title: '花费同比',
+                dataIndex: 'equallyRate',
+                align: 'center',
+                width: 100,
+                fixed: 'left',
+            },
+            
+        ]
+    }
+    groupDeliveryIndexShow(){
+        return[
+            {
+                title: '消耗(元)',
+                dataIndex: 'cost',
+                align: 'center',
+                scopedSlots: { customRender: 'cost' },
+                
+            }
+        ]
+    }
+    
     groupDelivery(){
         return [
             {
@@ -137,7 +213,7 @@
                 align: 'center',
                 width:350,
                 },{
-                title: '花费',
+                title: '消耗(元)',
                 dataIndex: 'charge',
                 align: 'center',
                 sorter: (a, b) => a.charge - b.charge,
@@ -153,15 +229,15 @@
                 sorter: (a, b) => a.activation - b.activation,
                 },{
                 title: '激活成本',
-                dataIndex: 'activationCost',
+                dataIndex: 'actionCost',
                 align: 'center',
-                sorter: (a, b) => a.activationCost - b.activationCost,
+                sorter: (a, b) => a.actionCost - b.actionCost,
                 },{
                     title: '操作建议',
                     dataIndex: 'operationAgree',
                     key: 'operationAgree',
                     align: 'center',
-                     
+                    scopedSlots: { customRender: 'operationAgree' },
                     },{
                     title: '操作',
                     dataIndex: 'operator',

+ 689 - 93
src/views/modules/stockWatch/modules/new-keepManage/personal-keepManage.vue

@@ -1,71 +1,105 @@
+<style lang="less" scoped>
+    @import "../keep-manage/keep-manage.less";
+   .group-keep-ul li{
+   margin-bottom: 15px;
+   font-size: 16px;
+}
+</style>
+
 <template>
     <div>
         <a-row :gutter="24" style="margin-bottom: 20px;">
             <a-col :sm="18" :md="18" :xl="18" class="keep-manage-col">
                 <a-card class="card-content echarts-card">
                     <div slot="title">
-                        数据总览 更新时间:{{updateAccountEchart||'-'}}
+                        <span style="font-weight: bolder;">数据总览</span> 
                     </div>
                     <div class="person-content-title" slot="extra">
 
                         <div class="content-title-acount"></div>
                         <div class="content-title-checkout">
                             <span class="title-checkout-time">
-                                <a-range-picker v-model="dateEchart" :range="dateRanges" />
+                                <a-range-picker v-model="dateEchart" :range="dateRanges" @change="dateRangesChange"/>
                             </span>
                         </div>
                     </div>
-
-                    <div id="accountIndexEchart" ref="accountIndexEchart"
+                    <div v-if="yestadyNum == 1" id="accountIndexEchartDay" ref="accountIndexEchartDay"
+                    style="width: 90%;height: 315px;margin: 0 auto;">
+                    <a-empty />
+                    </div>
+                    <div v-else id="accountIndexEchart" ref="accountIndexEchart"
                     style="width: 90%;height: 315px;margin: 0 auto;">
                     <a-empty />
                     </div>
 
+                    
+                   
                 </a-card>
             </a-col>
 
             <a-col :sm="6" :md="6" :xl="6"  class="keep-manage-col">
-                <a-card title="运营个人数据" class="card-content">
-                    <div style="width: 100%;height: 315px;">
+                <a-card  class="card-content">
+                    <div slot="title">
+                        <span style="font-weight: bolder;">运营个人数据</span><span>({{userName}})</span>
+                    </div>
+                    <div style="width: 100%;height: 315px;margin-left: 50px;">
                         <ul class="group-keep-ul">
                             <li>
-                                今日消耗: <span style="font-weight: bold;">21,233.958</span> 
+                                今日消耗: <span style="font-weight: bold;">{{todayCost | formatNum}}</span> 
                             </li>
                             <li>
-                                <span  style="margin-left:20%;" v-if="personData  < 0">
-                                    <img style=" width: 25px;height: 25px;" class="title-radio-img" src="@/assets/up.png" alt="">
-                                    <span style="color: green;">10%</span>
+                                <span style="margin-left:20%;" v-if="todayCompare.indexOf('-') == 0">
+                                    <img style=" width: 25px;height: 25px;" class="title-radio-img"
+                                        src="@/assets/greendown.png" alt="">
+                                    <span style="color: green;">{{todayCompare}}</span>
+
                                 </span>
-                                <span style="margin-left:20%;" v-else-if="personData>= 0">
-                                    <img style=" width: 25px;height: 25px;" class="title-radio-img" src="@/assets/down.png" alt="">
-                                    <span style="color: red;">10%</span>
+                                <span style="margin-left:20%;" v-else-if="todayCompare.indexOf('-') == -1">
+                                    <img style=" width: 25px;height: 25px;" class="title-radio-img"
+                                        src="@/assets/upred.png" alt="">
+                                    <span style="color: red;">{{todayCompare}}</span>
                                 </span>
+                                <a-tooltip placement="top">
+                                    <template slot="title">
+                                        <span>截止此时今日消耗与昨日同时刻消耗的对比</span>
+                                    </template>
+                                    <a-icon style="margin-left: 10px;" type="question-circle" />
+                                </a-tooltip>
                             </li>
                             <li>
-                                消耗:118,2335.112
+                               <span style="margin-left: 28px;">消耗: </span>{{timeCost  | formatNum}}
                             </li>
                             <li>
-                                <span>环比:</span>
-                                <span style="margin-left: 10%;" v-if="personData  < 0">
-                                    <img style=" width: 25px;height: 25px;" class="title-radio-img" src="@/assets/up.png" alt="">
-                                    <span style="color: green;">10%</span>
+                                <span style="margin-left: 28px;">环比:</span>
+                                <span  v-if="timeCompare.indexOf('-') == 0">
+                                    <img style=" width: 25px;height: 25px;" class="title-radio-img"
+                                        src="@/assets/greendown.png" alt="">
+                                    <span style="color: green;">{{timeCompare}}</span>
+
                                 </span>
-                                <span style="margin-left: 10%;" v-else-if="personData>= 0">
-                                    <img style=" width: 25px;height: 25px;" class="title-radio-img" src="@/assets/down.png" alt="">
-                                    <span style="color: red;">10%</span>
+                                <span v-else-if="timeCompare.indexOf('-') == -1">
+                                    <img style=" width: 25px;height: 25px;" class="title-radio-img"
+                                        src="@/assets/upred.png" alt="">
+                                    <span style="color: red;">{{timeCompare}}</span>
                                 </span>
+                                <a-tooltip placement="top">
+                                    <template slot="title">
+                                        <span>所选时间段内的消耗与相邻的同长度的时间段对比</span>
+                                    </template>
+                                    <a-icon style="margin-left: 10px;" type="question-circle" />
+                                </a-tooltip>
                             </li>
                             <li>
-                                月消耗:12,520.525
+                                <span style="margin-left: 15px;">月消耗: </span>{{monthCost | formatNum}}
                             </li>
                             <li>
-                                月激励:12,520.525
+                                <span style="margin-left: -16px;">月激励消耗: </span>{{directCharged  | formatNum}}
                             </li>
                             <li>
-                                月框返:12,520.525
+                                <span style="margin-left: -16px;">月框返消耗: </span>{{contractCharged  | formatNum}}
                             </li>
                             <li>
-                                团队内排名:1/86
+                                <span style="margin-left: -16px;">团队内排名: {{userIdRank}}/{{userRankTotalNum}}</span>
                             </li>
                         </ul>
                         
@@ -77,12 +111,15 @@
 
         <a-row :gutter="24">
             <a-col>
-                <a-card title="项目列表" >
+                <a-card >
+                    <div slot="title">
+                        <span style="font-weight: bolder;">{{titleName}}</span> 
+                    </div>
                     <div class="person-content-title" slot="extra">
                         <div class="content-title-acount"></div>
                         <div class="content-title-checkout">
                             <span style="margin-right: 20px;">
-                                <a-button type="link">
+                                <a-button type="link" @click="customColumn">
                                     自定义列
                                   </a-button>
                             </span>
@@ -90,10 +127,11 @@
                                 <a-range-picker
                                 v-model="dateMiddleProject"
                                 :ranges="dateRanges"
+                                @change="dateMiddleProjectChange"
                                 />
                             </span>
                             <span>
-                                <a-radio-group v-model="projectAccount" >
+                                <a-radio-group v-model="projectAccount" @change="projectAccountChange">
                                     <a-radio-button value="a">
                                       项目
                                     </a-radio-button>
@@ -114,17 +152,32 @@
                     :pagination="echartsIpaginationProject"
                     :loading="echartsLoading"
                     ref="accountTable"
-                    ></a-table>
+                    :scroll="{ x: scrollX }"
+                    @change="sort"
+                    >
+                    <span slot="leave" slot-scope="leave">{{leave | removalPercentage}}</span>
+                    <a slot="projectName" slot-scope="text,record" @click="projectNameClick(record)">{{ text }}</a>
+                    <a slot="accountName" slot-scope="text,record" @click="accountNameClick(record)">{{ text }}</a>
+                </a-table>
 
                 </a-card>
             </a-col>
         </a-row>
+        <customColumnProject
+        :visible="visible"
+        :listNum="listNum"
+        :fiexColumn="columnsFixd"
+        :mediaType="2"
+        @closeCustomColumn="closeCustomColumn"
+        @changeColumn="changeColumn"
+    />
     </div>
 </template>
 
 
 <script>
-    import keepPersonData from '../keep-manage/keep-manage-data.js';
+    import keepPersonData from './new-keep-data.js';
+    import customColumnProject from './customColumnProject.vue'
     import moment from 'moment';
     // 引入基本模板
     var echarts = require('echarts');
@@ -136,20 +189,36 @@
     require('echarts/lib/component/graphic');
     require('echarts/lib/component/toolbox');
     require('echarts/lib/component/legend');
+    import { mapGetters } from 'vuex'
     export default{
+        components:{customColumnProject},
         data() {
             return {
+                visible:false,
                 updateAccountEchart:'2021-12-22 8:00:00',
                 dateEchart:[moment(), moment()],
+                scrollX:1500,
                 dateRanges: keepPersonData.setTimeRange(),
                 personData:0,
+                columnsFixd:keepPersonData.setNoDeleteColumns(),
+                listNum:[],
                 dateMiddleProject:[moment(), moment()],
                 echartsDataProject:[],
+                queryUserId:'',
                 echartsLoading: false,
                 projectAccount:'a',
+                target: 'cost',
+                order: 'descend',
+                compare:'',
+                todayList:[],
+                yesterdayList:[],
+                timeData:[],
+                lengthData:[],
+                yestadyNum:1,
+                titleName:'项目列表',
                 echartsIpaginationProject:{
                 current: 1,
-                pageSize: 5,
+                pageSize: 10,
                 //   pageSizeOptions: ['10', '20', '30'],
                 showTotal: (total, range) => {
                 return range[0] + '-' + range[1] + ' 共' + total + '条'
@@ -169,62 +238,567 @@
                     {
                     title: '项目名称',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'projectName',
+                    scopedSlots: { customRender: 'projectName' },
                     },{
                     title: '账户数量',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'accountNum'
                     },{
-                    title: '运营人员',
+                    title: '运营人员数量',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'userNum'
                     },{
-                    title: '花费',
+                    title: '消耗(元)',
                     align: "center",
-                    dataIndex: '',
-                    sorter: true,
+                    dataIndex: 'totalCost',
+                    sorter: (a, b) => a.totalCost - b.totalCost,
                     },{
                     title: '花费环比',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'rate'
                     },{
                     title: '花费同比',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'equallyRate'
                     },{
                     title: '上新素材数',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'newVideoNum'
                     },{
                     title: '有效素材数',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'newEffectNum'
                     },{
                     title: '爆款素材数',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'newHotNum'
                     },{
                     title: '激活数',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'activation'
                     },{
                     title: '激活单价',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'activationPrice'
                     },{
                     title: '行为数',
                     align: "center",
-                    dataIndex: ''
+                    dataIndex: 'keyActionCost'
                     },
-                ]
+                ],
+                todayCost:'',
+                timeCost:'',
+                todayCompare:'',
+                timeCompare:'',
+                directCharged:'',
+                contractCharged:'',
+                userRankTotalNum:'',
+                userIdRank:'',
+                monthCost:'',
+                userName:'',
             }
         },
+        filters:{
+            formatNum: function (value) {
+                if (!value) {
+                    return '暂无数据'
+                } else if (value == '暂无数据') {
+                    return '暂无数据'
+                }
+                return Number(value).toFixed(3).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
+            },
+        },
         mounted() {
+            if (sessionStorage.getItem('personalUserId')) {
+                this.queryUserId = sessionStorage.getItem('personalUserId')
+            }
+            this.showColumn()
             this.getQueryNewlyData();
+            this.personalData();
+            this.getItemList();
+            
         },
         methods: {
+            ...mapGetters([ 'userInfo']),
+            // 个人数据
+            personalData(){
+                let params = {
+                    mediaType:2,
+                    userId:'',
+                    startTime: this.dateEchart[0].format('YYYY-MM-DD'),
+                    endTime: this.dateEchart[1].format('YYYY-MM-DD'),
+                }
+                if (this.queryUserId) {
+                    params.userId = this.queryUserId
+                }else{
+                    params.userId = this.userInfo().id
+                }
+                this.getAction(process.env.VUE_APP_BASE_STARE_URL+'/kuaiShouOpreate/kuaiShouMaterialStareController/kuaiShouOperateDateTotalPersonal',params).then(res=>{
+                    if (res.code == 0) {
+                        // 今日消耗
+                        console.log(res.result.todayCost);
+                        if (res.result.todayCost) {
+                            this.todayCost = res.result.todayCost
+                        }else{
+                            this.todayCost = '暂无数据'
+                        }
+                        // 今日环比
+                        if (res.result.todayCompare) {
+                            this.todayCompare = res.result.todayCompare;
+                        }else{
+                            this.todayCompare = '暂无数据'
+                        }
+                        // 时间段环比
+                        if(res.result.timeCompare){
+                            this.timeCompare = res.result.timeCompare;
+                        }else{
+                            this.timeCompare = '暂无数据'
+                        }
+                        // 框返
+                        if (res.result.contractCharged) {
+                            this.contractCharged = res.result.contractCharged
+                        }else{
+                            this.contractCharged = '暂无数据'
+                        }
+                        // 月激励
+                        if (res.result.directCharged) {
+                            this.directCharged = res.result.directCharged
+                        }else{
+                            this.directCharged = '暂无数据'
+                        }
+                        // 时间段消耗
+                        if(res.result.timeCost){
+                            this.timeCost = res.result.timeCost
+                        }else{
+                            this.timeCost = '暂无数据'
+                        }
+                        // 排名总数
+                        if(res.result.userRankTotalNum){
+                            this.userRankTotalNum = res.result.userRankTotalNum
+                        }else{
+                            this.userRankTotalNum = '暂无数据'
+                        }
+                        // 排名
+                        if(res.result.userIdRank){
+                            this.userIdRank = res.result.userIdRank;
+                        }else{
+                            this.userIdRank = '暂无数据'
+                        }
+                        if(res.result.monthCost){
+                            this.monthCost = res.result.monthCost
+                        }else{
+                            this.monthCost = '暂无数据'
+                        }
+                        if(res.result.userName){
+                            this.userName = res.result.userName
+                        }else{
+                            this.userName = '暂无数据'
+                        }
+                    }
+                })
+            },
+            // 项目列表
+            getItemList(){
+                this.echartsLoading = true;
+                let params = {
+                    startTime: this.dateMiddleProject[0].format('YYYY-MM-DD'),
+                    endTime: this.dateMiddleProject[1].format('YYYY-MM-DD'),
+                    userId:'',
+                    pageNum:this.echartsIpaginationProject.current,
+                    pageSize:this.echartsIpaginationProject.pageSize,
+                }
+                if (this.queryUserId) {
+                    params.userId = this.queryUserId
+                }else{
+                    params.userId = this.userInfo().id
+                }
+                this.getAction(process.env.VUE_APP_BASE_STARE_URL+'/kuaiShouOpreate/kuaiShouMaterialStareController/getKuaiShouOperateProjectInfo',params).then(res=>{
+                    if (res.code == 0) {
+                        this.echartsDataProject = res.result.list;
+                        this.echartsIpaginationProject.total = res.result.total;
+                        this.echartsLoading = false;
+                    }
+                })
+            },
+            getAccountData(){
+                let params = {
+                    startTime: this.dateMiddleProject[0].format('YYYY-MM-DD'),
+                    endTime: this.dateMiddleProject[1].format('YYYY-MM-DD'),
+                    userId:'',
+                    pageNum:this.echartsIpaginationProject.current,
+                    pageSize:this.echartsIpaginationProject.pageSize,
+                    projectId:this.projectId
+                }
+                if (this.queryUserId) {
+                    params.userId = this.queryUserId
+                }else{
+                    params.userId = this.userInfo().id
+                }
+                this.getAction(process.env.VUE_APP_BASE_STARE_URL+'/kuaiShouOpreate/kuaiShouMaterialStareController/getKuaiShouOperateAccountInfo',params).then(res=>{
+                    if (res.code == 0) {
+                        this.echartsDataProject = res.result.list;
+                        this.echartsIpaginationProject.total = res.result.total;
+                        this.echartsLoading = false;
+                    }
+                })
+            },
+            projectNameClick(row){
+                this.titleName = '账户列表'
+                this.echartsLoading = true;
+                this.columnsFixd = keepPersonData.setNoActionProjectColumns();
+                this.listNum = keepPersonData.setNoActionProjectColumns();
+                this.columnsProject=[
+                {
+                    title: '账户名称',
+                    align: "center",
+                    dataIndex: 'accountName',
+                    scopedSlots: { customRender: 'accountName' },
+                    },{
+                        title: '账户ID',
+                        dataIndex: 'accountId',
+                        scopedSlots: { customRender: 'accountId' },
+                        align: 'center',
+                    }, {
+                    title: '运营人员名称',
+                    align: "center",
+                    dataIndex: 'userName'
+                    },{
+                title: '预算',
+                dataIndex: 'warningAmount',
+                scopedSlots: { customRender: 'warningAmount' },
+                align: 'center',
+            },{
+                title: '余额',
+                dataIndex: 'balance',
+                scopedSlots: { customRender: 'balance' },
+                align: 'center',
+            }, {
+                    title: '消耗(元)',
+                    align: "center",
+                    dataIndex: 'totalCost'
+                    }, {
+                    title: '花费环比',
+                    align: "center",
+                    dataIndex: 'yearOnYear',
+                    }, {
+                    title: '花费同比',
+                    align: "center",
+                    dataIndex: 'equallyRate',
+                    },
+                    
+                ],
+                this.projectId = row.projectId;
+                this.echartsIpaginationProject.current = 1;
+                this.getAccountData();
+                this.projectAccount = 'b';
+                this.showColumn();
+            },
+            accountNameClick(row){
+                // this.$router.push({path:'/modules/stockWatch/modules/new-keepManage/account-newkeepManage',query:{accountId:row.accountId}})
+            },
+            sort(pagination, filters, sorter, { currentDataSource }){
+                this.echartsLoading = true;
+                
+            // console.log(pagination, filters, sorter)          
+            this.echartsIpaginationProject.current=pagination.current
+            this.echartsIpaginationProject.pageSize=pagination.pageSize
+            if (this.projectAccount == 'a') {
+            //     if (sorter.order) {
+            //     this.order = sorter.order ? sorter.order : 'descend'
+            //     this.target = sorter.columnKey
+            //     this.getItemList({ target: sorter.columnKey, order: sorter.order ? sorter.order : 'descend' })
+            // }
+            this.getItemList();
+                console.log(sorter);
+            }else{
+                this.getAccountData();
+            }
+            
+            
+        },
+        dateMiddleProjectChange(){
+                this.echartsLoading = true;
+                this.echartsIpaginationProject.current = 1;
+                if (this.projectAccount == 'a') {
+                    this.getItemList()
+                }else{
+                    this.getAccountData();
+                }
+            },
+        projectAccountChange(ent){
+                this.echartsLoading = true;
+                if (ent.target.value == 'a') {
+                    this.titleName = '项目列表'
+                    this.columnsFixd = keepPersonData.setNoDeleteColumns();
+                    this.listNum = keepPersonData.setNoDeleteColumns();
+                    this.projectId = '';
+                    this.columnsProject = [
+                {
+                    title: '项目名称',
+                    align: "center",
+                    dataIndex: 'projectName',
+                    scopedSlots: { customRender: 'projectName' },
+                    }, {
+                    title: '账户数量',
+                    align: "center",
+                    dataIndex: 'accountNum'
+                    }, {
+                    title: '运营人员数量',
+                    align: "center",
+                    dataIndex: 'userNum',
+                    }, {
+                    title: '消耗(元)',
+                    align: "center",
+                    dataIndex: 'totalCost'
+                    }, {
+                    title: '花费环比',
+                    align: "center",
+                    dataIndex: 'yearOnYear',
+                    }, {
+                    title: '花费同比',
+                    align: "center",
+                    dataIndex: 'equallyRate',
+                    }, {
+                    title: '上新素材数',
+                    align: "center",
+                    dataIndex: 'newVideoNum',
+                    },{
+                    title: '爆款素材数',
+                    align: "center",
+                    dataIndex: 'newHotNum',
+                    },{
+                    title: '有效素材数',
+                    align: "center",
+                    dataIndex: 'newEffectNum',
+                    },{
+                    title: '激活数',
+                    align: "center",
+                    dataIndex: 'activation',
+                    },
+                    {
+                    title: '激活单价',
+                    align: "center",
+                    dataIndex: 'activationPrice',
+                    },{
+                    title: '行为数',
+                    align: "center",
+                    dataIndex: 'keyActionCost'
+                    },
+                ],
+                this.echartsIpaginationProject.current = 1;
+                    this.getItemList()
+                }else{
+                    this.titleName = '账户列表';
+                    this.columnsFixd = keepPersonData.setNoActionProjectColumns();
+                    this.listNum = keepPersonData.setNoActionProjectColumns();
+                    console.log(this.columnsFixd);
+                    this.columnsProject=[
+                {
+                    title: '账户名称',
+                    align: "center",
+                    dataIndex: 'accountName',
+                    scopedSlots: { customRender: 'accountName' },
+                    }, {
+                    title: '运营人员名称',
+                    align: "center",
+                    dataIndex: 'userName'
+                    },{
+                title: '预算',
+                dataIndex: 'warningAmount',
+                scopedSlots: { customRender: 'warningAmount' },
+                align: 'center',
+            },{
+                title: '余额',
+                dataIndex: 'balance',
+                scopedSlots: { customRender: 'balance' },
+                align: 'center',
+            }, {
+                    title: '消耗(元)',
+                    align: "center",
+                    dataIndex: 'totalCost'
+                    }, {
+                    title: '花费环比',
+                    align: "center",
+                    dataIndex: 'yearOnYear',
+                    }, {
+                    title: '花费同比',
+                    align: "center",
+                    dataIndex: 'equallyRate',
+                    },
+                    
+                ],
+                this.echartsIpaginationProject.current = 1;
+                    this.getAccountData();
+                }
+                this.showColumn();
+            },
+                        // 自定义列
+                customColumn(){
+                this.visible = true;
+                this.listNum = [...this.columnsProject]
+            },
+             //自定义列相关
+             closeCustomColumn() {
+            this.visible = false
+            },
+            showColumn() {
+            this.postDataAction('/toutiao/videoReportDaily/getColumnJson', {
+                columnType: this.projectAccount === 'a' ? 104 : 105,
+            }).then((res) => {
+                // console.log(res)
+                if (res.success) {
+                // console.log(JSON.parse(res.result))
+                if (res.result) {
+                    let columns = JSON.parse(res.result)
+                    console.log(columns);
+                    if (columns.length) {
+                    if (columns.length >= this.columnsFixd.length) {
+                        columns.map((item, index) => {
+                        if (index > this.columnsFixd.length - 1) {
+                            item.sorter = function (a, b) {}
+                        }
+                        })
+                        columns = columns.slice(this.columnsFixd.length)
+                        this.columnsProject = [...this.columnsFixd, ...columns]
+                    }
+
+                    // console.log(this.columns)
+                    }
+                }
+
+                this.changeColumn(this.columnsProject)
+                }
+            })
+        },
+        changeColumn(val) {
+            this.columnsProject = [...val]
+            if (this.columnsProject.length > this.columnsFixd.length && this.columnsProject.length < 8) {
+                this.columnsProject.forEach((element, index) => {
+                if (index < this.columnsProject.length - 1) {
+                   
+                    element.width = 'auto'
+                    element.fixed = false
+                    
+                }
+                })
+
+                this.scrollX = 0
+            } 
+            else if (this.columnsProject.length > 8) {
+                this.columnsProject.forEach((element, index) => {
+                        if (index < this.columnsFixd.length) {
+                            if (element.dataIndex == 'accountNum') {
+                                element.width = 100
+                                element.fixed = 'left'
+                            } else if (element.dataIndex == 'userNum') {
+                                element.width = 100
+                                element.fixed = 'left'
+                            } else if (element.dataIndex == 'yearOnYear') {
+                                element.width = 100
+                                element.fixed = 'left'
+                            } else if (element.dataIndex == 'equallyRate') {
+                                element.width = 100
+                                element.fixed = 'left'
+                            } else {
+                                element.width = 150
+                                element.fixed = 'left'
+                            }
+
+                        }else if (this.columnsProject.length == this.columnsFixd.length) {
+                    this.columnsProject.forEach((element, index) => {
+                        element.width = 'auto';
+                        element.fixed = false;
+                    })
+                    this.scrollX = false
+                }else{
+                            element.width = 'auto';
+                            element.fixed = false
+                        }
+                    })
+                    
+                    this.scrollX = 1000 + 150 * (this.columnsProject.length - this.columnsFixd.length)
+            } 
+            else {
+                this.scrollX = 0
+                this.columnsProject.forEach((element) => {
+
+                    element.width = 'auto'
+                    element.fixed = false
+                    
+                })
+            }
+
+            let arr = JSON.stringify(this.columnsProject)
+            this.postDataAction('/toutiao/videoReportDaily/saveOrUpdateColumnJson', {
+                json: arr,
+                columnType: this.projectAccount === 'a' ? 104 : 105,
+            }).then((res) => {
+                // console.log(res)
+            })
+        },
             getQueryNewlyData(){
-                this.initEchart('accountIndexEchart',this.initAccountIndexEchart())
+                let params = {
+                    startTime: this.dateEchart[0].format('YYYY-MM-DD'),
+                    endTime: this.dateEchart[1].format('YYYY-MM-DD'),
+                    mediaType:2,
+                    userId:''
+                }
+                if (this.queryUserId) {
+                    params.userId = this.queryUserId
+                }else{
+                    params.userId = this.userInfo().id
+                }
+                this.getAction(process.env.VUE_APP_BASE_STARE_URL+'/kuaiShouOpreate/kuaiShouMaterialStareController/kuaiShousumDataPersonal',params).then(res=>{
+                    if (res.code == 0) {
+                        if (res.message == '查询运营个人-时报-汇总。') {
+                            
+                            this.todayList = res.result.todayList.map((item) => {
+                                return item.totalCost
+                            })
+                            this.yesterdayList = res.result.yesterdayList.map((item) => {
+                                return item.totalCost
+                            })
+
+                           
+                            this.timeData = res.result.yesterdayList.map((itemdate) => {
+                                return itemdate.hour
+                            })
+                            this.lengthData = ['今天', '昨天'];
+                            this.initEchart('accountIndexEchartDay', this.initAccountIndexEchartDay(this.todayList, this.yesterdayList, this.timeData,this.lengthData))
+                        }else if(res.message == '查询运营个人-日报-汇总成功。'){
+                           
+                            this.todayList = res.result.map((item) => {
+                                return item.totalCost
+                            })
+                            this.timeData = res.result.map((itemdate) => {
+                                return itemdate.dateTime
+                            })
+                            this.yesterdayList = [];
+                            this.lengthData = ['消耗汇总'];
+                           
+                            let series = {
+                                    name: '消耗汇总',
+                                    type: 'line',
+                                    smooth: true,
+                                    symbol: 'circle',
+                                    data: this.todayList
+                                };
+                            this.initEchart('accountIndexEchart', this.initAccountIndexEchart(this.todayList, this.yesterdayList, this.timeData,this.lengthData,series))
+                        }
+                       
+                    }
+                })
+                // this.initEchart('accountIndexEchart',this.initAccountIndexEchart())
+            },
+            dateRangesChange(e){
+                if (this.dateEchart[0].format('YYYY-MM-DD') ==this.dateEchart[1].format('YYYY-MM-DD')) {
+                    this.yestadyNum = 1
+                }else{
+                    this.yestadyNum = 2
+                }
+                this.getQueryNewlyData();
+                this.personalData();
             },
                //获取echart的值
             initEchart(idName, optionName) {
@@ -246,7 +820,7 @@
                 }
             },
              //趋势图echarts配置
-             initAccountIndexEchart() {
+             initAccountIndexEchart(todayList,yesterdayList, timeData,lengthData,series) {
                 // this.clientWidth  =  document.documentElement.clientWidth - 224
                 // var myChart = echarts.init(document.getElementById('accountIndexEchart'))
                 let option = {
@@ -255,7 +829,7 @@
                         trigger: 'axis'
                     },
                     legend: {
-                        data: ['today','yesterday']
+                        data: lengthData
                     },
                     grid: {
                         left: '3%',
@@ -272,56 +846,78 @@
                     xAxis: {
                         type: 'category',
                         boundaryGap: false,
-                        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+                        data: timeData
                     },
                     yAxis: {
                         type: 'value'
                     },
-                    series: [
-                        {
-                            name: 'today',
-                            type: 'line',
-                            smooth: true,
-                            symbol: 'circle',
-                            data: [120, 132, 101, 134, 90, 230, 210],
-                            lineStyle: {                               
-                            color: '#00BFFF',   
-                            width: 2,
-                            },
-                            itemStyle:{
-                            color:'#00BFFF',
-                            borderWidth:2,
-                            borderColor:'#00BFFF'
-                            },
-                        },
-                        {
-                            name: 'yesterday',
-                            type: 'line',
-                            smooth: true,
-                            symbol: 'circle',
-                            data: [220, 182, 191, 234, 290, 330, 310],
-                            lineStyle: {                               
-                            color: '#00FF7F',   
-                            width: 2,
-                            },
-                            itemStyle:{
-                            color:'#00FF7F',
-                            borderWidth:2,
-                            borderColor:'#00FF00'
-                            },
-                        },
-                       
-                    ]
+                    series:series
                 };
                 return option
             },
+            initAccountIndexEchartDay(todayList,yesterdayList, timeData,lengthData){
+                let option = {
+                  
+                  tooltip: {
+                      trigger: 'axis'
+                  },
+                  legend: {
+                      data: lengthData
+                  },
+                  grid: {
+                      left: '3%',
+                      right: '4%',
+                      bottom: '3%',
+                      containLabel: true
+
+                  },
+                  // toolbox: {
+                  //     feature: {
+                  //         saveAsImage: {}
+                  //     }
+                  // },
+                  xAxis: {
+                      type: 'category',
+                      boundaryGap: false,
+                      data: timeData
+                  },
+                  yAxis: {
+                      type: 'value'
+                  },
+                  series:[{
+                                    name: '今天',
+                                    type: 'line',
+                                    smooth: true,
+                                    symbol: 'circle',
+                                    data: todayList,
+                                    lineStyle: {
+                                        color: '#00BFFF',
+                                        width: 2,
+                                    },
+                                    itemStyle: {
+                                        color: '#00BFFF',
+                                        borderWidth: 2,
+                                        borderColor: '#00BFFF'
+                                    },
+                                },{
+                                    name: '昨天',
+                                    type: 'line',
+                                    smooth: true,
+                                    symbol: 'circle',
+                                    data: yesterdayList,
+                                    lineStyle: {
+                                        color: '#00FF7F',
+                                        width: 2,
+                                    },
+                                    itemStyle: {
+                                        color: '#00FF7F',
+                                        borderWidth: 2,
+                                        borderColor: '#00FF00'
+                                    },
+                                }]
+              };
+              return option
+            },
         },
     }
 </script>
-<style lang="less" scoped>
-     @import "../keep-manage/keep-manage.less";
-    .group-keep-ul li{
-    margin-bottom: 15px;
-    font-size: 16px;
-}
-</style>

+ 3 - 1
src/views/modules/stockWatch/modules/new-keepManage/selectComponentPrject.vue

@@ -31,7 +31,7 @@
   </template>
   
   <script>
-  import  {customFieldsSource ,KScustomFields}  from './acountProjectData.js'
+  import  {customFieldsSource ,KScustomFields,indexCustomIndicator}  from './acountProjectData.js'
   // let customFields=customFields
   export default {
     props: ['showCol','fixedCol','mediaType'],
@@ -95,6 +95,8 @@
       }else if(this.mediaType==2){
         //快手自定义列
         this.customFields=KScustomFields
+      }else if(this.mediaType == 3){
+        this.customFields = indexCustomIndicator
       }
       for (let i = 0; i < this.customFields.length; i++) {
         this.customFields[i].form=[]