123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <div class="div-box-new-margin">
- <div class="div-border-box" id="clueAddAnalysisFull">
- <div class="content-new-content">
- <div class="div-line"></div>
- <div class="title">近12月线索新增分析</div>
- <div style="float: right">
- <departmentSalesperson id="department" ref="departmentSalesperson" class="inline-16" @depSelect="depSelect" @personSelect="personSelect"></departmentSalesperson>
- <span class="search__label inline-16">分析日期:</span>
- <el-date-picker
- v-model="enddate"
- style="margin-right: 10px !important;"
- type="date"
- :clearable="false"
- @change="changeDate"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- size="small"
- range-separator="至"
- start-placeholder="开始月份"
- :append-to-body="false"
- end-placeholder="结束月份">
- </el-date-picker>
- <fullScreen class="inline-16" domId="clueAddAnalysisFull" @onFull="onFull" @backFull="backFull" :scrollHeight="scrollHeight"></fullScreen>
- </div>
- </div>
- <div class="chart">
- <div id="clueAddAnalysisChart" :style="{height: heightChart}"></div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import departmentSalesperson from "@/views/salesData/components/departmentSalesperson";
- import fullScreen from "@/views/salesData/components/fullScreen";
- import {Bar, DualAxes} from "@antv/g2plot";
- export default {
- name: "clueAdd",
- components:{departmentSalesperson,fullScreen},
- props:["dataid",'scrollHeight'],
- data(){
- return {
- chartDualAxes:null,
- param:{
- "id": 20231015123304,
- "content": {
- "type": 0,
- "dataid": '',
- "enddate": ""
- }
- },
- enddate:new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate(),
- histogram:[],
- lineChart:[],
- heightChart:'98%'
- }
- },
- methods:{
- async listData(val){
- this.renderPie(val)
- },
- async queryModel(val){
- this.param.content.dataid = val || this.dataid
- this.param.content.enddate = this.enddate
- const res = await this.$api.requested(this.param)
- this.histogram = res.data.histogram
- this.lineChart = res.data.lineChart.map(item=>{
- return {
- date: item.date,
- type:"同比增长率",
- value: item.value
- }
- })
- this.chartDualAxes.changeData([this.histogram,this.lineChart])
- },
- renderPie(val){
- this.chartDualAxes = new DualAxes('clueAddAnalysisChart', {
- data:[this.histogram,this.lineChart],
- xField: 'date',
- yField: ['value','value'],
- seriesField: 'type',
- geometryOptions: [
- {
- geometry: 'column',
- isGroup: true,
- seriesField: 'type',
- },
- {
- geometry: 'line',
- seriesField: 'type',
- lineStyle: {
- lineWidth: 2,
- },
- },
- ],
- tooltip: {
- formatter: (datum) => {
- return { name: datum.type, value: datum.type == '同比增长率'? datum.value + '%' : datum.value };
- },
- },
- });
- this.chartDualAxes.render();
- this.queryModel(val)
- },
- changeDate(){
- this.queryModel(this.param.content.dataid)
- },
- /*选择部门*/
- depSelect(val){
- this.param.content.type = 1
- this.param.content.dataid = val
- this.queryModel(val)
- },
- /*选择业务员*/
- personSelect(val){
- this.param.content.type = 0
- this.param.content.dataid = val
- this.queryModel(val)
- },
- /*全屏*/
- onFull(){
- this.heightChart = 'calc(100vh - 70px)'
- console.log(this.heightChart,'全屏')
- },
- /*退出全屏*/
- backFull(val){
- this.heightChart = '98%'
- this.$emit('backFull',val)
- }
- }
- }
- </script>
- <style scoped>
- </style>
|