Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/uas-office-integration into dev

RaoMeng 5 years ago
parent
commit
9214c04fc2

+ 1 - 2
uas-office-web/uas-mobile/src/components/common/bizgoblin/BarGraph.jsx

@@ -29,8 +29,7 @@ export default class BarGraph extends Component {
   }
 
   render () {
-    let { chartData } = this.props
-    let { SONTITLE_, FORMULA_VALUEDISPLAY_, FORMULA_KEYDISPLAY_, FORMULA_UNIT_ } = chartData
+    let { chartData: { SONTITLE_, FORMULA_VALUEDISPLAY_, FORMULA_KEYDISPLAY_, FORMULA_UNIT_ } } = this.props
     let data = []
     let { detailData } = this.state
     if (!isObjEmpty(detailData)) {

+ 7 - 2
uas-office-web/uas-mobile/src/components/common/bizgoblin/CommonCharts.jsx

@@ -8,6 +8,7 @@ import BarGraph from './BarGraph'
 import LineChart from './LineChart'
 import PieChart from './PieChart'
 import TableChart from './TableChart'
+import SumChart from './SumChart'
 import LazyLoad from 'react-lazyload'
 import { forceCheck } from 'react-lazyload'
 
@@ -33,7 +34,7 @@ export default class CommonCharts extends Component {
 
   render () {
     //BarGraph柱状 LineChart折线 PieChart圆饼 TableChart表格
-    let { TYPE_ } = this.props.chartData
+    let { chartData: { TYPE_ }, setOverflow } = this.props
     let chartItem = null
     switch (TYPE_) {
       case 'column':
@@ -48,6 +49,9 @@ export default class CommonCharts extends Component {
       case 'list':
         chartItem = <TableChart chartData={this.props.chartData}/>
         break
+      case 'sum':
+        chartItem = <SumChart chartData={this.props.chartData}/>
+        break
       default:
         chartItem = null
         break
@@ -58,7 +62,8 @@ export default class CommonCharts extends Component {
           once
           height={400}
           resize={true}
-          overflow={true}>
+          overflow={setOverflow}
+        >
           {chartItem}
         </LazyLoad>
       </div>

+ 1 - 2
uas-office-web/uas-mobile/src/components/common/bizgoblin/LineChart.jsx

@@ -29,8 +29,7 @@ export default class LineChart extends Component {
   }
 
   render () {
-    let { chartData } = this.props
-    let { SONTITLE_, FORMULA_VALUEDISPLAY_, FORMULA_KEYDISPLAY_, FORMULA_UNIT_ } = chartData
+    let { chartData: { SONTITLE_, FORMULA_VALUEDISPLAY_, FORMULA_KEYDISPLAY_, FORMULA_UNIT_ } } = this.props
     let data = []
     let { detailData } = this.state
     if (!isObjEmpty(detailData)) {

+ 1 - 2
uas-office-web/uas-mobile/src/components/common/bizgoblin/PieChart.jsx

@@ -33,8 +33,7 @@ export default class PieChart extends Component {
   }
 
   render () {
-    let { chartData } = this.props
-    let { SONTITLE_, FORMULA_VALUEDISPLAY_, FORMULA_KEYDISPLAY_, FORMULA_UNIT_ } = chartData
+    let { chartData: { SONTITLE_, FORMULA_VALUEDISPLAY_, FORMULA_KEYDISPLAY_, FORMULA_UNIT_ } } = this.props
     let data = []
     let { detailData } = this.state
     if (!isObjEmpty(detailData)) {

+ 62 - 0
uas-office-web/uas-mobile/src/components/common/bizgoblin/SumChart.jsx

@@ -0,0 +1,62 @@
+/**
+ * Created by hujs on 2020/12/24
+ * Desc: 汇总信息
+ */
+
+import React, { Component } from 'react'
+import { fetchPostObj } from '../../../utils/common/fetchRequest'
+import { API } from '../../../configs/api.config'
+import { isObjEmpty } from '../../../utils/common/common.util'
+import { message } from 'antd'
+import './bizcharts.less'
+
+export default class SumChart extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {
+      detailData: [],
+    }
+  }
+
+  componentDidMount () {
+    this.getChartData()
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    let { detailData: { DATA_, SONTITLE_ } } = this.state
+
+    return (
+      <div className='charts-line' style={{ width: '100%', backgroundColor: '#fff' }}>
+        <div className="ant-table-title">
+          <span className='sum_title'>{SONTITLE_}:</span>
+          <span className='sum-detail'>{DATA_}</span>
+        </div>
+      </div>
+    )
+  }
+
+  getChartData = () => {
+    let { chartData: { INSTANCE_ID_, FORMULA_ID_ } } = this.props
+    fetchPostObj(API.COMMON_GETSUBSDATA, {
+      INSTANCE_ID_: INSTANCE_ID_,
+      FORMULA_ID_: FORMULA_ID_,
+    }).then(response => {
+      this.setState({
+        detailData: response.data.list[0],
+      })
+    }).catch(error => {
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('图表数据获取失败')
+      }
+    })
+  }
+
+}

+ 1 - 2
uas-office-web/uas-mobile/src/components/common/bizgoblin/TableChart.jsx

@@ -29,8 +29,7 @@ export default class TableChart extends Component {
   }
 
   render () {
-    let { chartData } = this.props
-    let { SONTITLE_ } = chartData
+    let { chartData: { SONTITLE_ } } = this.props
     let data = []
     let columns = []
     let { detailData, detailColumn } = this.state

+ 15 - 0
uas-office-web/uas-mobile/src/components/common/bizgoblin/bizcharts.less

@@ -0,0 +1,15 @@
+.charts-line {
+  .ant-table-title {
+    .sum_title {
+      padding: 0px 0px 0px 5px;
+      font-size: 14px;
+      color: #030303;
+    }
+
+    .sum_detail {
+      padding: 0px 0px 0px 5px;
+      font-size: 14px;
+      color: #707070;
+    }
+  }
+}

+ 1 - 1
uas-office-web/uas-mobile/src/components/private/kanban/KanBan.jsx

@@ -38,7 +38,7 @@ class KanBan extends Component {
     subsData.forEach((item, index) => {
       if (!isObjEmpty(item)) {
         chartItem.push(
-          <CommonCharts chartData={item} key={index}/>,
+          <CommonCharts chartData={item} key={index} setOverflow={true}/>,
         )
       }
     })

+ 3 - 0
uas-office-web/uas-mobile/src/configs/api.config.js

@@ -103,4 +103,7 @@ export const API = {
   //加到首页
   SUBSCRIBE_ADDSUBSCRIBETOMAIN: _baseURL +
     '/mobile/appweb/subscribe/addSubscribeToMain.action',
+  //订阅图表
+  SUBSCRIBE_GETCHARTTYPE: _baseURL +
+    '/mobile/appcommon/getSingleAllType.action',
 }

+ 5 - 0
uas-office-web/uas-mobile/src/configs/router.config.js

@@ -35,6 +35,8 @@ const SubscribeList = PageLoadable(
   import(/* webpackChunkName:'subscribe' */'@/pages/private/subscribe/SubscribeList'))
 const SubscribeManage = PageLoadable(
   import(/* webpackChunkName:'subscribe' */'@/pages/private/subscribe/SubscribeManage'))
+const SubscribeChart = PageLoadable(
+  import(/* webpackChunkName:'subscribe' */'@/pages/private/subscribe/SubscribeChart'))
 
 /**************************************************待办**************************************************/
 const TaskTodo = PageLoadable(
@@ -116,6 +118,9 @@ class Routes extends React.Component {
           <Route path='/subscribeList' component={SubscribeList}/>
           {/*订阅管理*/}
           <Route path='/subscribeManage' component={SubscribeManage}/>
+          {/* 订阅图表 */}
+          <Route path='/subscribeChart/:id/:num_id/:ins_id'
+                 component={SubscribeChart}/>
 
           {/***************************************待办******************************************/}
           {/*待办列表*/}

+ 76 - 0
uas-office-web/uas-mobile/src/pages/private/subscribe/SubscribeChart.jsx

@@ -0,0 +1,76 @@
+/**
+ * Created by Hujs on 2020/12/23
+ * Desc: 订阅图表
+ */
+
+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 { fetchGet, fetchPostObj } from '../../../utils/common/fetchRequest'
+import { API } from '../../../configs/api.config'
+import { message } from 'antd'
+
+class SubscribeChart extends Component {
+
+  constructor () {
+    super()
+
+    this.state = {
+      subsData: [],
+    }
+  }
+
+  componentDidMount () {
+    this.getChartData()
+  }
+
+  componentWillUnmount () {
+
+  }
+
+  render () {
+    const chartItem = []
+    const { subsData } = this.state
+
+    subsData.forEach((item, index) => {
+      if (!isObjEmpty(item)) {
+        chartItem.push(
+          <CommonCharts chartData={item} key={index} setOverflow={false}/>,
+        )
+      }
+    })
+
+    return (
+      <div style={{ background: '#f5f5f9' }}>
+        {chartItem}
+      </div>
+    )
+  }
+
+  getChartData = () => {
+    let { id, num_id, ins_id } = this.props.match.params
+    fetchPostObj(API.SUBSCRIBE_GETCHARTTYPE, {
+      ID_: id,
+      NUM_ID_: num_id,
+      INSTANCE_ID_: ins_id,
+    }).then(response => {
+      this.setState({
+        subsData: response.data.list,
+      })
+    }).catch(error => {
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('图表类型获取失败')
+      }
+    })
+  }
+
+}
+
+let mapStateToProps = (state) => ({
+  chartState: state.chartState,
+})
+
+export default connect(mapStateToProps)(SubscribeChart)

+ 7 - 6
uas-office-web/uas-mobile/src/pages/private/subscribe/SubscribeList.jsx

@@ -179,12 +179,13 @@ class SubscribeList extends Component {
         pageIndex: mPageIndex,
         listData: mSubscribeList,
       })
-      window.open(
-        _baseURL + '/common/charts/mobileCharts.action?numId=' + subObj.NUM_ID_
-        + '&mainId=' + subObj.INSTANCE_ID_
-        + '&insId=' + subObj.ID_
-        + '&title=' + subObj.TITLE_, '_self',
-      )
+      // window.open(
+      //   _baseURL + '/common/charts/mobileCharts.action?numId=' + subObj.NUM_ID_
+      //   + '&mainId=' + subObj.INSTANCE_ID_
+      //   + '&insId=' + subObj.ID_
+      //   + '&title=' + subObj.TITLE_, '_self',
+      // )
+      this.props.history.push('/subscribeChart/' + subObj.ID_ + '/' + subObj.NUM_ID_ + '/' + subObj.INSTANCE_ID_)
     }
   }
 }