|
|
@@ -7,6 +7,11 @@ import React, { Component } from 'react'
|
|
|
import { connect } from 'react-redux'
|
|
|
import CommonCharts from '../../../components/common/bizgoblin/CommonCharts'
|
|
|
import { isObjEmpty } from '../../../utils/common/common.util'
|
|
|
+import { fetchPostForm } from '../../../utils/common/fetchRequest'
|
|
|
+import { fetchGet } from '../../../utils/common/fetchRequest'
|
|
|
+import { API } from '../../../configs/api.config'
|
|
|
+import { Toast } from 'antd-mobile'
|
|
|
+import { message } from 'antd'
|
|
|
|
|
|
class KanBan extends Component {
|
|
|
|
|
|
@@ -14,160 +19,27 @@ class KanBan extends Component {
|
|
|
super()
|
|
|
|
|
|
this.state = {
|
|
|
- list: [{
|
|
|
- type: 'BarGraph',
|
|
|
- title: '销售趋势图',
|
|
|
- list: {
|
|
|
- data: [
|
|
|
- {
|
|
|
- year: '1951 年',
|
|
|
- sales: 38,
|
|
|
- }, {
|
|
|
- year: '1952 年',
|
|
|
- sales: 52,
|
|
|
- }, {
|
|
|
- year: '1956 年',
|
|
|
- sales: 61,
|
|
|
- }, {
|
|
|
- year: '1957 年',
|
|
|
- sales: 145,
|
|
|
- }, {
|
|
|
- year: '1958 年',
|
|
|
- sales: 48,
|
|
|
- }, {
|
|
|
- year: '1959 年',
|
|
|
- sales: 32,
|
|
|
- }, {
|
|
|
- year: '1960 年',
|
|
|
- sales: 39,
|
|
|
- }, {
|
|
|
- year: '1962 年',
|
|
|
- sales: 60,
|
|
|
- }, {
|
|
|
- year: '1951 年',
|
|
|
- sales: 38,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- }, {
|
|
|
- type: 'LineChart',
|
|
|
- title: '销售趋势图',
|
|
|
- list: {
|
|
|
- data: [
|
|
|
- { month: 'Jan', temperature: 7, city: 'Tokyo' },
|
|
|
- { month: 'Jan', temperature: 3.9, city: 'London' },
|
|
|
- { month: 'Feb', temperature: 6.9, city: 'Tokyo' },
|
|
|
- { month: 'Feb', temperature: 4.2, city: 'London' },
|
|
|
- { month: 'Mar', temperature: 9.5, city: 'Tokyo' },
|
|
|
- { month: 'Mar', temperature: 5.7, city: 'London' },
|
|
|
- { month: 'Apr', temperature: 14.5, city: 'Tokyo' },
|
|
|
- { month: 'Apr', temperature: 8.5, city: 'London' },
|
|
|
- { month: 'May', temperature: 18.4, city: 'Tokyo' },
|
|
|
- { month: 'May', temperature: 11.9, city: 'London' },
|
|
|
- { month: 'Jun', temperature: 21.5, city: 'Tokyo' },
|
|
|
- { month: 'Jun', temperature: 15.2, city: 'London' },
|
|
|
- { month: 'Jul', temperature: 25.2, city: 'Tokyo' },
|
|
|
- { month: 'Jul', temperature: 17, city: 'London' },
|
|
|
- { month: 'Aug', temperature: 26.5, city: 'Tokyo' },
|
|
|
- { month: 'Aug', temperature: 16.6, city: 'London' },
|
|
|
- { month: 'Sep', temperature: 23.3, city: 'Tokyo' },
|
|
|
- { month: 'Sep', temperature: 14.2, city: 'London' },
|
|
|
- { month: 'Oct', temperature: 18.3, city: 'Tokyo' },
|
|
|
- { month: 'Oct', temperature: 10.3, city: 'London' },
|
|
|
- { month: 'Nov', temperature: 13.9, city: 'Tokyo' },
|
|
|
- { month: 'Nov', temperature: 6.6, city: 'London' },
|
|
|
- { month: 'Dec', temperature: 9.6, city: 'Tokyo' },
|
|
|
- { month: 'Dec', temperature: 4.8, city: 'London' },
|
|
|
- ],
|
|
|
- },
|
|
|
- }, {
|
|
|
- type: 'PieChart',
|
|
|
- title: '销售分布图',
|
|
|
- list: {
|
|
|
- data: [
|
|
|
- {
|
|
|
- name: '芳华',
|
|
|
- percent: 0.4,
|
|
|
- a: '1',
|
|
|
- }, {
|
|
|
- name: '妖猫传',
|
|
|
- percent: 0.2,
|
|
|
- a: '1',
|
|
|
- }, {
|
|
|
- name: '机器之血',
|
|
|
- percent: 0.18,
|
|
|
- a: '1',
|
|
|
- }, {
|
|
|
- name: '心理罪',
|
|
|
- percent: 0.15,
|
|
|
- a: '1',
|
|
|
- }, {
|
|
|
- name: '寻梦环游记',
|
|
|
- percent: 0.05,
|
|
|
- a: '1',
|
|
|
- }, {
|
|
|
- name: '其他',
|
|
|
- percent: 0.02,
|
|
|
- a: '1',
|
|
|
- },
|
|
|
- ],
|
|
|
- map: {
|
|
|
- 芳华: '40%',
|
|
|
- 妖猫传: '20%',
|
|
|
- 机器之血: '18%',
|
|
|
- 心理罪: '15%',
|
|
|
- 寻梦环游记: '5%',
|
|
|
- 其他: '2%',
|
|
|
- },
|
|
|
- },
|
|
|
- }, {
|
|
|
- type: 'TableChart',
|
|
|
- title: '客户销售金额排行榜',
|
|
|
- list: {
|
|
|
- data: [{
|
|
|
- key: '1',
|
|
|
- name: '深爱半导体有限责任公司',
|
|
|
- rank: 1,
|
|
|
- money: '500',
|
|
|
- },
|
|
|
- {
|
|
|
- key: '2',
|
|
|
- name: '华商龙商务有限责任公司',
|
|
|
- rank: 2,
|
|
|
- money: '200',
|
|
|
- },
|
|
|
- {
|
|
|
- key: '3',
|
|
|
- name: '优软科技',
|
|
|
- rank: 3,
|
|
|
- money: '100',
|
|
|
- }],
|
|
|
- columns: [{
|
|
|
- title: '排名',
|
|
|
- dataIndex: 'rank',
|
|
|
- key: 'rank',
|
|
|
- align: 'center',
|
|
|
- width: 80,
|
|
|
- render: text => <a>{text}</a>,
|
|
|
- },
|
|
|
- {
|
|
|
- title: '客户名称',
|
|
|
- dataIndex: 'name',
|
|
|
- ellipsis: true,
|
|
|
- key: 'name',
|
|
|
- },
|
|
|
- {
|
|
|
- title: '销售额(万元)',
|
|
|
- dataIndex: 'money',
|
|
|
- key: 'money',
|
|
|
- align: 'center',
|
|
|
- }],
|
|
|
- },
|
|
|
- }],
|
|
|
+ subsData: [],
|
|
|
}
|
|
|
}
|
|
|
|
|
|
componentDidMount () {
|
|
|
+ Toast.loading('正在获取数据', 0)
|
|
|
+ fetchGet(API.COMMON_GETSUBSDATA)
|
|
|
+ .then(response => {
|
|
|
+ Toast.hide()
|
|
|
+ this.setState({
|
|
|
+ subsData: response.data.list,
|
|
|
+ })
|
|
|
+ message.success('请求成功')
|
|
|
+ }).catch(error => {
|
|
|
+ Toast.hide()
|
|
|
+ if (typeof error === 'string') {
|
|
|
+ message.error(error)
|
|
|
+ } else {
|
|
|
+ message.error('图表数据获取失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -176,9 +48,10 @@ class KanBan extends Component {
|
|
|
}
|
|
|
|
|
|
render () {
|
|
|
- let sourceData = this.state.list
|
|
|
const chartItem = []
|
|
|
- sourceData.forEach((item, index) => {
|
|
|
+ let { subsData } = this.state
|
|
|
+
|
|
|
+ subsData.forEach((item, index) => {
|
|
|
if (!isObjEmpty(item)) {
|
|
|
chartItem.push(
|
|
|
<CommonCharts chartData={item} key={index}/>,
|