0
? targetData.map((item, i) => {
// let value = Math.round((item.kmxValue + item.kmxUnit) * 100) / 100
- // let value = item.kmxValue
- let value = Math.round(item.kmxValue * 100) / 100
- if (value > 10000 || value < -10000) {
- value = value.toExponential(2)
+ let value = item.kmxValue
+ if (!isNaN(item.kmxValue)) {
+ value = Math.round(item.kmxValue * 100) / 100
+ if (value > 10000 || value < -10000) {
+ value = value.toExponential(2)
+ }
}
let bgClass
const limitType = item.limitType
@@ -272,8 +320,9 @@ class ChannelData extends React.Component {
} else {
bgClass = styles['danger-normal']
}
+ const channel = [item.channelId + '__' + item.channelName]
return
+ onClick={function () { goToCondition(item, channel) }}>
{item.kmxVariableName}
diff --git a/src/components/ColumnDark/LineDark.css b/src/components/ColumnDark/LineDark.css
new file mode 100644
index 0000000000000000000000000000000000000000..e2ea724a9b6e8c0ad0518bb447c0de88700b9ee8
--- /dev/null
+++ b/src/components/ColumnDark/LineDark.css
@@ -0,0 +1,4 @@
+.container{
+ width: 100%;
+ height:100%
+}
diff --git a/src/components/ColumnDark/LineDark.js b/src/components/ColumnDark/LineDark.js
new file mode 100644
index 0000000000000000000000000000000000000000..5273b6777dea1c97c22d43ea409f985598b16dec
--- /dev/null
+++ b/src/components/ColumnDark/LineDark.js
@@ -0,0 +1,263 @@
+import React from 'react'
+import styles from './LineDark.css'
+import Highcharts from 'highcharts-release'
+import R from 'ramda'
+// import theme from './theme.js'
+
+type Props = {
+ xData: Array,
+ chartData: Array,
+ title: string,
+ xTitle: string,
+ yTitle: string
+}
+class LineDark extends React.Component {
+ props: Props
+
+ componentDidMount () {
+ this.draw(this.props)
+ }
+
+ componentWillReceiveProps (nextProps) {
+ if (!R.equals(nextProps, this.props)) {
+ this.draw(nextProps)
+ }
+ }
+
+ draw (props) {
+ const container = this.refs.container
+ let innerChart = Highcharts.chart(container, {
+ colors: ['#2b908f', '#90ee7e', '#f45b5b', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee',
+ '#55BF3B', '#DF5353', '#7798BF', '#aaeeee'
+ ],
+ chart: {
+ backgroundColor: {
+ stops: [
+ [0, '#2a2a2b']
+ ]
+ },
+ style: {
+ fontFamily: '\'Unica One\', sans-serif'
+ },
+ plotBorderColor: '#606063'
+ },
+ title: {
+ text: props.title,
+ x: -20,
+ style: {
+ color: '#E0E0E3',
+ textTransform: 'uppercase',
+ fontSize: '16px'
+ }
+ },
+ credits:{
+ enabled: false
+ },
+ legend: {
+ itemStyle: {
+ color: '#E0E0E3'
+ },
+ itemHoverStyle: {
+ color: '#FFF'
+ },
+ itemHiddenStyle: {
+ color: '#606063'
+ },
+ enabled: false
+ },
+ xAxis: {
+ gridLineColor: '#707073',
+ labels: {
+ style: {
+ color: '#E0E0E3'
+ }
+ },
+ lineColor: '#707073',
+ minorGridLineColor: '#505053',
+ tickColor: '#707073',
+ title: {
+ text: props.xTitle,
+ style: {
+ color: '#A0A0A3'
+ }
+ },
+ categories: props.xData
+ },
+ yAxis: {
+ gridLineColor: '#707073',
+ labels: {
+ style: {
+ color: '#E0E0E3'
+ }
+ },
+ lineColor: '#707073',
+ minorGridLineColor: '#505053',
+ tickColor: '#707073',
+ tickWidth: 1,
+ title: {
+ text: props.yTitle,
+ style: {
+ color: '#A0A0A3'
+ }
+ },
+ plotLines: [{
+ value: 0,
+ width: 1,
+ color: '#808080'
+ }],
+ stackLabels: {
+ enabled: true,
+ style: {
+ color: '#fff'
+ }
+ }
+ },
+ tooltip: {
+ backgroundColor: 'rgba(0, 0, 0, 0.85)',
+ style: {
+ color: '#F0F0F0'
+ },
+ formatter: function () {
+ return '
' + this.x + '
' + this.series.userOptions.stack + '' +
+ this.series.name + ': ' + this.y + '次
'
+ }
+ },
+ plotOptions: {
+ line: {
+ lineWidth: 1,
+ dataGrouping: {
+ enabled: false
+ }
+ },
+ column: {
+ stacking: 'normal',
+ maxPointWidth: 30,
+ dataLabels: {
+ enabled: true,
+ color: 'white',
+ style: {
+ textShadow: '0 0 2px black'
+ }
+ }
+ },
+ series: {
+ dataLabels: {
+ color: '#B0B0B3'
+ },
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ boxplot: {
+ fillColor: '#505053'
+ },
+ candlestick: {
+ lineColor: 'white'
+ },
+ errorbar: {
+ color: 'white'
+ }
+ },
+ labels: {
+ style: {
+ color: '#707073'
+ }
+ },
+ drilldown: {
+ activeAxisLabelStyle: {
+ color: '#F0F0F3'
+ },
+ activeDataLabelStyle: {
+ color: '#F0F0F3'
+ }
+ },
+ navigation: {
+ buttonOptions: {
+ symbolStroke: '#DDDDDD',
+ theme: {
+ fill: '#505053'
+ }
+ }
+ },
+ rangeSelector: {
+ buttonTheme: {
+ fill: '#505053',
+ stroke: '#000000',
+ style: {
+ color: '#CCC'
+ },
+ states: {
+ hover: {
+ fill: '#707073',
+ stroke: '#000000',
+ style: {
+ color: 'white'
+ }
+ },
+ select: {
+ fill: '#000003',
+ stroke: '#000000',
+ style: {
+ color: 'white'
+ }
+ }
+ }
+ },
+ inputBoxBorderColor: '#505053',
+ inputStyle: {
+ backgroundColor: '#333',
+ color: 'silver'
+ },
+ labelStyle: {
+ color: 'silver'
+ }
+ },
+
+ navigator: {
+ handles: {
+ backgroundColor: '#666',
+ borderColor: '#AAA'
+ },
+ outlineColor: '#CCC',
+ maskFill: 'rgba(255,255,255,0.1)',
+ series: {
+ color: '#7798BF',
+ lineColor: '#A6C7ED'
+ },
+ xAxis: {
+ gridLineColor: '#505053'
+ }
+ },
+
+ scrollbar: {
+ barBackgroundColor: '#808083',
+ barBorderColor: '#808083',
+ buttonArrowColor: '#CCC',
+ buttonBackgroundColor: '#606063',
+ buttonBorderColor: '#606063',
+ rifleColor: '#FFF',
+ trackBackgroundColor: '#404043',
+ trackBorderColor: '#404043'
+ },
+ legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
+ background2: '#505053',
+ dataLabelsColor: '#B0B0B3',
+ textColor: '#C0C0C0',
+ contrastTextColor: '#F0F0F3',
+ maskColor: 'rgba(255,255,255,0.3)',
+ series: props.chartData
+ })
+ setTimeout(() => {
+ if (innerChart) {
+ innerChart.reflow()
+ }
+ }, 5)
+ }
+
+ render () {
+ return (
+
+ )
+ }
+}
+export default LineDark
diff --git a/src/components/ColumnDark/index.js b/src/components/ColumnDark/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..b0c0f76d3c4e867c0bc7153d566cc2bc80b8e482
--- /dev/null
+++ b/src/components/ColumnDark/index.js
@@ -0,0 +1,3 @@
+import LineDark from './LineDark'
+
+export default LineDark
diff --git a/src/components/ConditionChart/ConditionChart.js b/src/components/ConditionChart/ConditionChart.js
index 2107a166fc854af889a7090f94352dde78ebb484..614e78d58901f4a2fd63d4c39349c5a91fe21469 100644
--- a/src/components/ConditionChart/ConditionChart.js
+++ b/src/components/ConditionChart/ConditionChart.js
@@ -227,7 +227,10 @@ class Condition extends React.Component {
start: start,
end: end
},
- size: 2000,
+ valueFilters: [
+ { '$default': { '$or': [{ '$gt': -1000000 }] } }
+ ],
+ size: 10000,
page: 1
})
return LoginFetch(`${__KMX_API__}data-streams`, {
diff --git a/src/components/Customer/Customer.js b/src/components/Customer/Customer.js
index 90dc15ba3480c8cbadb7bd00ba3af2367ab6e465..c5e26905e05052f1c82046f69a705be9a5f17900 100644
--- a/src/components/Customer/Customer.js
+++ b/src/components/Customer/Customer.js
@@ -5,7 +5,9 @@ import { Button, Form } from 'antd'
import CustomerGrid from './CustomerGrid'
import CustomerFillter from 'components/CustomerFillter'
import universalFetch, { handleFetchError } from 'store/modules/fetch'
+import { connect } from 'react-redux'
type Props = {
+ userId: string,
history: Object,
form: Object
}
@@ -36,7 +38,11 @@ class Customer extends Component {
}
handleSearch (searchQuery) {
this.queryUrl = searchQuery
- this.getCustomers(1, 20)
+ this.setState({
+ current: 1
+ }, () => {
+ this.getCustomers(this.state.current, this.state.pageSize)
+ })
}
componentDidMount () {
this.getCustomers(this.state.current, this.state.pageSize)
@@ -44,7 +50,7 @@ class Customer extends Component {
getCustomers (page: number, pageSize: number) {
let queryUrl = this.queryUrl || ``
- universalFetch(`${__SERVICE_API__}device/customers?pageNum=${page}&pageSize=${pageSize}${queryUrl}`)
+ universalFetch(`${__SERVICE_API__}device/customers?userId=${this.props.userId}&pageNum=${page}&pageSize=${pageSize}${queryUrl}`)
.then(res => res.json())
.then((json) => {
if (json.code !== 200000) {
@@ -89,4 +95,9 @@ class Customer extends Component {
}
}
-export default Form.create()(Customer)
+const mapStatesToProps = (state) => {
+ return {
+ userId: state.user.userId
+ }
+}
+export default connect(mapStatesToProps, {})(Form.create()(Customer))
diff --git a/src/components/Customer/CustomerActions.js b/src/components/Customer/CustomerActions.js
index 851f8098d2b809a3b0f9d3c5165065b4ab58fa12..6d9927c226b6ddea7c222241c67afd8ba3fbd756 100644
--- a/src/components/Customer/CustomerActions.js
+++ b/src/components/Customer/CustomerActions.js
@@ -1,7 +1,7 @@
// @flow
import React, { Component } from 'react'
import styles from './CustomerActions.css'
-import { Button, Popconfirm, message } from 'antd'
+import { Button, Popconfirm, message, Icon, Modal } from 'antd'
import universalFetch, { handleFetchError } from 'store/modules/fetch'
type Props = {
@@ -11,12 +11,35 @@ type Props = {
current: number,
pageSize: number
}
+type State = {
+ visible: boolean
+}
class CustomerActions extends Component {
props: Props
+ state: State
deleteCustomer: Function
+ handleCancel: Function
+ handleOk: Function
constructor (props: Props) {
super(props)
+ this.state = {
+ visible: false
+ }
this.deleteCustomer = this.deleteCustomer.bind(this)
+ this.handleCancel = this.handleCancel.bind(this)
+ this.handleOk = this.handleOk.bind(this)
+ }
+
+ handleOk () {
+ this.setState({
+ visible: true
+ })
+ }
+
+ handleCancel () {
+ this.setState({
+ visible: false
+ })
}
deleteCustomer () {
@@ -40,34 +63,75 @@ class CustomerActions extends Component {
}
render () {
const { history, data } = this.props
+ const fileList = data.fileList
+ let showFile = false // 文件是否显示
+ if (fileList.length > 0) {
+ showFile = true
+ }
+ // 编辑
+ let edit =
+ if (data.editPermission === 'no') {
+ edit = ''
+ }
+ // 删除
+ let delet =
+
+
+ if (data.delPermission === 'no') {
+ delet = ''
+ }
return (
-
-
-
-
+ {edit}
+ {delet}
+ {
+ showFile
+ ?
+
+
+ : ''
+ }
+
+ {
+ fileList.map((d, i) => {
+ return
+ {d.fileName}
+
+ })
+ }
+
)
}
diff --git a/src/components/Customer/CustomerGrid.js b/src/components/Customer/CustomerGrid.js
index 081eb0c2e8ffbea15a091103cd0e64eacd8305f9..baac558a804be958ecf15744fa950e123749c7f6 100644
--- a/src/components/Customer/CustomerGrid.js
+++ b/src/components/Customer/CustomerGrid.js
@@ -4,6 +4,7 @@ import { AgGridReact } from 'ag-grid-react'
import styles from './CustomerGrid.css'
import CustomerActions from './CustomerActions'
import LinkToDevice from './LinkToDevice'
+import LinkToDeviceCustomer from './LinkToDeviceCustomer'
import { TableResize } from 'ag-grid-addons'
import Pagination from 'components/Pagination'
@@ -24,6 +25,7 @@ class CustomerGrid extends Component {
gridOptions: Object
onGridReady: Function
goToDevice: Function
+ goToDeviceCustomer: Function
api: Object
TableResize: Function
constructor (props: Props) {
@@ -34,6 +36,12 @@ class CustomerGrid extends Component {
{
headerName: '客户编号',
field: 'customerNo',
+ maxWidth: 90,
+ minWidth: 90,
+ cellRendererParams: {
+ goToDeviceCustomer: component.goToDeviceCustomer.bind(this)
+ },
+ cellRendererFramework: LinkToDeviceCustomer,
cellStyle: {
'padding': '8px'
}
@@ -41,6 +49,7 @@ class CustomerGrid extends Component {
{
headerName: '客户名称',
field: 'name',
+ width: 300,
cellRendererParams: {
goToDevice: component.goToDevice.bind(this)
},
@@ -52,6 +61,7 @@ class CustomerGrid extends Component {
{
headerName: '所属行业',
field: 'industry',
+ width: 150,
cellStyle: {
padding: '8px'
}
@@ -59,6 +69,7 @@ class CustomerGrid extends Component {
{
headerName: '客户类型',
field: 'type',
+ width: 150,
cellStyle: {
padding: '8px'
}
@@ -66,6 +77,7 @@ class CustomerGrid extends Component {
{
headerName: '所属地区',
field: 'region.location',
+ width: 150,
cellStyle: {
padding: '8px'
}
@@ -105,6 +117,7 @@ class CustomerGrid extends Component {
{
headerName: '操作',
minWidth: 150,
+ maxWidth: 150,
cellRendererParams: {
history: this.props.history,
current: this.props.current,
@@ -114,7 +127,7 @@ class CustomerGrid extends Component {
cellRendererFramework: CustomerActions,
cellStyle: {
padding: '8px',
- 'text-align': 'center'
+ 'text-align': 'left'
}
}
]
@@ -122,8 +135,23 @@ class CustomerGrid extends Component {
this.gridOptions = {
localeText: {
loadingOoo: '数据加载中...',
- noRowsToShow: '暂无数据'
+ noRowsToShow: '暂无数据',
+ filterOoo: '搜索当前页面',
+ equals: '等于',
+ notEqual: '不等于',
+ contains: '包含',
+ startsWith: '开始于',
+ endsWith: '结束于',
+ copy: '复制',
+ paste: '粘贴',
+ copyWithHeaders: '带表头复制',
+ toolPanel: '工具栏',
+ export: '导出',
+ csvExport: '导出CSV',
+ excelExport: '导出Excel'
},
+ enableSorting: true,
+ enableFilter: true,
rowSelection: 'single',
rowDeselection: true,
enableColResize: true
@@ -131,6 +159,7 @@ class CustomerGrid extends Component {
this.onGridReady = this.onGridReady.bind(this)
this.TableResize = TableResize.bind(this)
this.goToDevice = this.goToDevice.bind(this)
+ this.goToDeviceCustomer = this.goToDeviceCustomer.bind(this)
}
goToDevice (data: Object) {
const { history } = this.props
@@ -142,6 +171,16 @@ class CustomerGrid extends Component {
}
history.push(location)
}
+ goToDeviceCustomer (data: Object) {
+ const { history } = this.props
+ const location = {
+ pathname: '/business/device-customer',
+ state: {
+ data: data
+ }
+ }
+ history.push(location)
+ }
onGridReady (params: Object) {
this.api = params.api
this.api.sizeColumnsToFit()
diff --git a/src/components/Customer/LinkToDeviceCustomer.js b/src/components/Customer/LinkToDeviceCustomer.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5ac9dd8767e8fd7bf728c6c5c49286efcdd4e4f
--- /dev/null
+++ b/src/components/Customer/LinkToDeviceCustomer.js
@@ -0,0 +1,30 @@
+// @flow
+import React, { Component } from 'react'
+
+type Props = {
+ data: Object,
+ goToDeviceCustomer: Function
+}
+class LinkToDevice extends Component {
+ props: Props
+ goToLink: Function
+ constructor (props: Props) {
+ super(props)
+ this.goToLink = this.goToLink.bind(this)
+ }
+
+ goToLink () {
+ const { data, goToDeviceCustomer } = this.props
+ goToDeviceCustomer(data)
+ }
+ render () {
+ const { customerNo } = this.props.data
+ return (
+
+ {customerNo}
+
+ )
+ }
+}
+
+export default LinkToDevice
diff --git a/src/components/ContactList/AddContact.js b/src/components/CustomerContactList/AddContact.js
similarity index 36%
rename from src/components/ContactList/AddContact.js
rename to src/components/CustomerContactList/AddContact.js
index d36e9e9c315cc7afc4ecea71ede07727a8b2882a..fda612a09bbbac8128422cf3b8385d80ed19ef94 100644
--- a/src/components/ContactList/AddContact.js
+++ b/src/components/CustomerContactList/AddContact.js
@@ -1,9 +1,9 @@
// @flow
import React, { Component } from 'react'
-import { Modal, Form, Input, message, Select, Switch } from 'antd'
-const Option = Select.Option
+import { Modal, Form, Input, Row, Col, Switch } from 'antd'
+// const Option = Select.Option
import R from 'ramda'
-import universalFetch, { handleFetchError } from 'store/modules/fetch'
+// import universalFetch, { handleFetchError } from 'store/modules/fetch'
const FormItem = Form.Item
const formItemLayout = {
labelCol: {
@@ -88,81 +88,92 @@ class EditContact extends Component {
const { visible, confirmLoading } = this.state
return (
-
)
diff --git a/src/components/ContactList/ContactList.css b/src/components/CustomerContactList/ContactList.css
similarity index 100%
rename from src/components/ContactList/ContactList.css
rename to src/components/CustomerContactList/ContactList.css
diff --git a/src/components/ContactList/ContactList.js b/src/components/CustomerContactList/ContactList.js
similarity index 97%
rename from src/components/ContactList/ContactList.js
rename to src/components/CustomerContactList/ContactList.js
index 2b7bb54e1d477a945c71107b608b41dc295658f0..dc3e00f5e0df26c7110ff7fde60d18cbd259585d 100644
--- a/src/components/ContactList/ContactList.js
+++ b/src/components/CustomerContactList/ContactList.js
@@ -7,7 +7,7 @@ import R from 'ramda'
import EditContact from './EditContact'
import AddContact from './AddContact'
import ReactDom from 'react-dom'
-import universalFetch, { handleFetchError } from 'store/modules/fetch'
+// import universalFetch, { handleFetchError } from 'store/modules/fetch'
message.config({
top: 100
})
@@ -62,6 +62,7 @@ class ContactList extends React.Component {
this.setState({
contactData: arr
})
+ this.props.getContact(arr)
}
}
editContact (item: Object) {
diff --git a/src/components/ContactList/EditContact.js b/src/components/CustomerContactList/EditContact.js
similarity index 33%
rename from src/components/ContactList/EditContact.js
rename to src/components/CustomerContactList/EditContact.js
index 4c0fe8365a0a27f4dc87061e151a5b84b9006c43..1de7d6876ab01d17153f5ad59f42d67f700371e4 100644
--- a/src/components/ContactList/EditContact.js
+++ b/src/components/CustomerContactList/EditContact.js
@@ -1,9 +1,9 @@
// @flow
import React, { Component } from 'react'
-import { Modal, Form, Input, message, Select, Switch } from 'antd'
-const Option = Select.Option
+import { Modal, Form, Input, Row, Col, Switch } from 'antd'
+// const Option = Select.Option
import R from 'ramda'
-import universalFetch, { handleFetchError } from 'store/modules/fetch'
+// import universalFetch, { handleFetchError } from 'store/modules/fetch'
const FormItem = Form.Item
const formItemLayout = {
labelCol: {
@@ -92,102 +92,112 @@ class EditContact extends Component {
return (
-
)
diff --git a/src/components/ContactList/index.js b/src/components/CustomerContactList/index.js
similarity index 100%
rename from src/components/ContactList/index.js
rename to src/components/CustomerContactList/index.js
diff --git a/src/components/CustomerEdit/CustomerEdit.js b/src/components/CustomerEdit/CustomerEdit.js
index 0c3a495b66fe72d132dd8fcce8530b7a071f3a4a..6afcb10a11a727aea6d4395e3ceb0a3d39ec3d43 100644
--- a/src/components/CustomerEdit/CustomerEdit.js
+++ b/src/components/CustomerEdit/CustomerEdit.js
@@ -3,6 +3,7 @@ import React, { Component } from 'react'
import styles from './CustomerEdit.css'
import { Form, Input, Button, Select, message, Upload, Icon } from 'antd'
import universalFetch, { handleFetchError } from 'store/modules/fetch'
+import CustomerContactList from 'components/CustomerContactList'
const FormItem = Form.Item
const Option = Select.Option
const Dragger = Upload.Dragger
@@ -43,12 +44,15 @@ type States = {
districts: Array