123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- // 各模块文件存储占比
- <template>
- <div class="container normal-panel">
- <div >
- <p class="title">销售漏斗图</p>
- <div id="containerFunnel"></div>
- </div>
- <div>
- <p class="title">表格数据</p>
- <el-table
- :data="tableData"
- style="width: 100%"
- size="small"
- border>
- <el-table-column
- prop="stagename"
- label="阶段"
- width="180">
- </el-table-column>
- <el-table-column
- prop="projectqty"
- label="项目数"
- width="180">
- </el-table-column>
- <el-table-column
- prop="signamount_due"
- label="签约金额(元)">
- </el-table-column>
- <el-table-column
- prop="totalinvestment"
- label="总计预计投资金额(万元)">
- </el-table-column>
- <el-table-column
- prop="budgetary"
- label="项目预算(万元)">
- </el-table-column>
- </el-table>
- </div>
- </div>
- </template>
- <script>
- import { Funnel } from '@antv/g2plot';
- export default {
- data () {
- return {
- chartPie:null,
- tableData:[],
- data:[{ stagename: '简历筛选', sequence1: 253 },]
- }
- },
- methods:{
- renderPie() {
- this.chartPie = new Funnel('containerFunnel', {
- data: this.data,
- width:800,
- xField: 'stagename',
- yField: 'sequence1',
- dynamicHeight: false,
- legend: false,
- label: {
- formatter: (datum) => {
- return `${datum.stagename}:${datum.projectqty}`;
- },
- },
- tooltip:{
- customContent: (title, items) => {
- // 构建自定义内容
- const content = `<div>
- <ul style="padding:10px">
- ${items.map((item) => `
- <li>
- <p style="margin-bottom:10px">${title}</p>
- <p>项目数:${item.data.projectqty}</p>
- </li>`).join('')}
- </ul>
- </div>`;
- return content;
- },
- },
- conversionTag: {
- formatter: (datum) => {
- console.log(datum,'conversionTag')
- return `${datum.stagename} 项目数:${datum.projectqty} 转化率:${((datum[Funnel.CONVERSATION_FIELD][1] / datum[Funnel.CONVERSATION_FIELD][0]) * 100).toFixed(2)}%`;
- },
- },
- // 关闭 conversionTag 转化率 展示
- // conversionTag: false,
- });
- this.chartPie.render();
- this.getProportionOfFileModel()
- },
- async getProportionOfFileModel () {
- let param = {
- "id": 20230630151504,
- "content": {
- "where": {
- "begindate": "",
- "enddate":"",
- "departmentid":""
- }
- }
- }
- const res = await this.$api.requested(param)
- this.tableData = res.data
- this.chartPie.changeData(res.data)
- }
- },
- mounted () {
- this.renderPie()
- }
- }
- </script>
- <style>
- </style>
- <style scoped>
- #containerFunnel{
- width:1000px;
- margin: 0 auto;
- }
- .title{
- height: 20px;
- line-height: 20px;
- font-size: 14px;
- text-indent: 7px;
- font-weight: bold;
- color: #333333;
- margin-bottom: 20px;
- border-left: .3rem solid #3874F6;
- }
- .container{
- height:calc(100vh - 200px)
- }
- </style>
|