diff --git a/Highways4Good b/Highways4Good new file mode 160000 index 00000000..cbdfefa3 --- /dev/null +++ b/Highways4Good @@ -0,0 +1 @@ +Subproject commit cbdfefa311b3a886f44cbc68f55bb6741655312b diff --git a/web/client/src/sections/fillion/components/maintenanceTable.js b/web/client/src/sections/fillion/components/maintenanceTable.js new file mode 100644 index 00000000..68397d78 --- /dev/null +++ b/web/client/src/sections/fillion/components/maintenanceTable.js @@ -0,0 +1,224 @@ +import { connect } from 'react-redux'; +import './protable.less' +import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input } from 'antd'; +import ProTable from '@ant-design/pro-table'; +// import { Badge, Button } from 'antd'; +import React, { useEffect, useState } from 'react'; +// @ts-ignore +import styles from './protable.less'; +const DetailList = (props) => { + const { patrolName } = props; + const [tableListDataSource, setTableListDataSource] = useState([]); + + const columns = [ + { + title: '问题编号', + key: 'num', + dataIndex: 'num', + align:'center' + }, { + title: '所属道路', + key: 'road', + dataIndex: 'road', + align:'center' + }, { + title: '所在路段', + key: 'address', + dataIndex: 'address', + align:'center' + }, { + title: '缺陷名称', + key: 'name', + dataIndex: 'name', + align:'center' + }, { + title: '巡查人', + width:100, + key: 'patrolName', + dataIndex: 'patrolName', + align:'center' + }, { + title: '上报时间', + key: 'createdAt', + dataIndex: 'createdAt', + valueType: 'dateTime', + align:'center' + }, { + title: '操作', + width:200, + key: 'option', + valueType: 'option', + align:'center', + render: () => [,] + }, + ]; + useEffect(() => { + const source = []; + for (let i = 0; i < 25; i += 1) { + source.push({ + num: `${i + 1}`, + road: `成华大道${i + 2}`, + address: `二仙桥${i + 3}`, + name: `缺失内容${i + 4}`, + patrolName: patrolName, + createdAt: Date.now() - Math.floor(Math.random() * 10000), + key: i, + }); + } + setTableListDataSource(source); + }, [patrolName]); + return ( + + ); +}; + + + + + + + +const patrolNameListDataSource = []; + +for (let i = 0; i < 10; i += 1) { + patrolNameListDataSource.push({ + patrolName: `老大爷${i}`, + }); +} + + + +const IPList = (props) => { + const { onChange, patrolName } = props; + + const columns = [ + { + title: '巡更人员', + key: 'patrolName', + dataIndex: 'patrolName', + align:'center' + }, + + ]; + return ( +
+ { + // 表单搜索项会从 params 传入,传递给后端接口。 + console.log(params, sorter, filter); + return Promise.resolve({ + data: patrolNameListDataSource, + success: true, + }); + }} + rowKey="patrolName" + rowClassName={(record) => { + return record.patrolName === patrolName ? styles['split-row-select-active'] : ''; + }} + // toolbar={{ + // search: { + // onSearch: (value) => { + // alert(value); + // }, + // }, + // }} + toolBarRender={()=>[ + + ]} + options={false} + pagination={false} + search={false} + onRow={(record) => { + return { + onClick: () => { + if (record.patrolName) { + onChange(record.patrolName); + } + }, + }; + }} + />
+ + ); +}; + + + +const MaintenanceTable = () => { + const [patrolName, setPatrolName] = useState('老大爷0'); + const { RangePicker } = DatePicker; + const tabList = [ + { + key: 'tab1', + tab: '养护', + }, + ]; + const contentList = { + tab1: [
+ + + +
] + }; + const [activeTabKey1, setActiveTabKey1] = useState('tab1'); + const onTab1Change = (key) => { + setActiveTabKey1(key); + }; + return ( +
+ + setPatrolName(searchPatrolName)} patrolName={patrolName} /> + + { + onTab1Change(key); + }} + > +
+ + + +
+ {contentList[activeTabKey1]} +
+
+ + ); +}; + +function mapStateToProps(state) { + const { auth, depMessage } = state; + const pakData = (dep) => { + return dep.map((d) => { + return { + title: d.name, + value: d.id, + // children: d.type >= 2 ? [] : pakData(d.subordinate) + children: pakData(d.subordinate) + } + }) + } + let depData = pakData(depMessage.data || []) + return { + user: auth.user, + depMessage: depMessage.data || [], + depLoading: depMessage.isRequesting, + depData, + }; +} +export default connect(mapStateToProps)(MaintenanceTable); \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js new file mode 100644 index 00000000..33e89b53 --- /dev/null +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -0,0 +1,229 @@ +import { connect } from 'react-redux'; +import './protable.less' +import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input } from 'antd'; +import ProTable from '@ant-design/pro-table'; +// import { Badge, Button } from 'antd'; +import React, { useEffect, useState } from 'react'; +// @ts-ignore +import styles from './protable.less'; +const DetailList = (props) => { + const { patrolName } = props; + const [tableListDataSource, setTableListDataSource] = useState([]); + + const columns = [ + { + title: '问题编号', + key: 'num', + dataIndex: 'num', + align: 'center' + }, { + title: '所属道路', + key: 'road', + dataIndex: 'road', + align: 'center' + }, { + title: '所在路段', + key: 'address', + dataIndex: 'address', + align: 'center' + }, { + title: '缺陷名称', + key: 'name', + dataIndex: 'name', + align: 'center' + }, { + title: '巡查人', + width: 100, + key: 'patrolName', + dataIndex: 'patrolName', + align: 'center' + }, { + title: '上报时间', + key: 'createdAt', + dataIndex: 'createdAt', + valueType: 'dateTime', + align: 'center' + }, { + title: '操作', + width: 200, + key: 'option', + valueType: 'option', + align: 'center', + render: () => [, ] + }, + ]; + useEffect(() => { + const source = []; + for (let i = 0; i < 25; i += 1) { + source.push({ + num: `${i + 1}`, + road: `成华大道${i + 2}`, + address: `二仙桥${i + 3}`, + name: `缺失内容${i + 4}`, + patrolName: patrolName, + createdAt: Date.now() - Math.floor(Math.random() * 10000), + key: i, + }); + } + setTableListDataSource(source); + }, [patrolName]); + return ( + + ); +}; + + + + + + + +const patrolNameListDataSource = []; + +for (let i = 0; i < 10; i += 1) { + patrolNameListDataSource.push({ + patrolName: `老大爷${i}`, + }); +} + + + +const IPList = (props) => { + const { onChange, patrolName } = props; + + const columns = [ + { + title: '巡更人员', + key: 'patrolName', + dataIndex: 'patrolName', + align: 'center' + }, + + ]; + return ( +
+ { + // 表单搜索项会从 params 传入,传递给后端接口。 + console.log(params, sorter, filter); + return Promise.resolve({ + data: patrolNameListDataSource, + success: true, + }); + }} + rowKey="patrolName" + rowClassName={(record) => { + return record.patrolName === patrolName ? styles['split-row-select-active'] : ''; + }} + // toolbar={{ + // search: { + // onSearch: (value) => { + // alert(value); + // }, + // }, + // }} + toolBarRender={() => [ + + ]} + options={false} + pagination={false} + search={false} + onRow={(record) => { + return { + onClick: () => { + if (record.patrolName) { + onChange(record.patrolName); + } + }, + }; + }} + />
+ + ); +}; + + + +const PatrolTable = () => { + const [patrolName, setPatrolName] = useState('老大爷0'); + const { RangePicker } = DatePicker; + const tabList = [ + { + key: 'tab1', + tab: '巡更', + }, { + key: 'tab2', + tab: '巡更轨迹查询', + }, + ]; + const contentList = { + tab1: [
+ + + +
] + }; + const [activeTabKey1, setActiveTabKey1] = useState('tab1'); + const onTab1Change = (key) => { + setActiveTabKey1(key); + }; + return ( +
+ + setPatrolName(searchPatrolName)} patrolName={patrolName} /> + + { + onTab1Change(key); + }} + > + { + activeTabKey1 == 'tab1' ?
+ + + +
: '' + } + {contentList[activeTabKey1]} +
+
+ + ); +}; + +function mapStateToProps(state) { + const { auth, depMessage } = state; + const pakData = (dep) => { + return dep.map((d) => { + return { + title: d.name, + value: d.id, + // children: d.type >= 2 ? [] : pakData(d.subordinate) + children: pakData(d.subordinate) + } + }) + } + let depData = pakData(depMessage.data || []) + return { + user: auth.user, + depMessage: depMessage.data || [], + depLoading: depMessage.isRequesting, + depData, + }; +} +export default connect(mapStateToProps)(PatrolTable); \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/protable.less b/web/client/src/sections/fillion/components/protable.less index 79869a9f..8379bd79 100644 --- a/web/client/src/sections/fillion/components/protable.less +++ b/web/client/src/sections/fillion/components/protable.less @@ -11,6 +11,9 @@ .split-row-select-active { background-color: #e6f7ff; } + th { + display: none; + } } .card-protable{display: flex; flex-direction:row; diff --git a/web/client/src/sections/fillion/containers/index.js b/web/client/src/sections/fillion/containers/index.js index 64a7add4..55870c0e 100644 --- a/web/client/src/sections/fillion/containers/index.js +++ b/web/client/src/sections/fillion/containers/index.js @@ -9,4 +9,6 @@ import Enforce from './enforce'; import Public from './public'; import Videois from './videois'; import PromoTional from './promotional'; -export { Infor,transportation,BridgeTable,HigHways,OperaTional,Enforce,Public,Videois,PromoTional }; \ No newline at end of file +import Maintenance from './maintenance'; +import Patrol from './patrol'; +export { Infor,transportation,BridgeTable,HigHways,OperaTional,Enforce,Public,Videois,PromoTional,Maintenance,Patrol }; \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/maintenance.js b/web/client/src/sections/fillion/containers/maintenance.js new file mode 100644 index 00000000..6a231dec --- /dev/null +++ b/web/client/src/sections/fillion/containers/maintenance.js @@ -0,0 +1,42 @@ +import React, { useEffect, useState } from 'react'; +import { connect } from 'react-redux'; +import '../style.less'; +import { getDepMessage, getReportStatistic } from "../actions/infor" +import MaintenanceTable from '../components/maintenanceTable'; +const superagent = require('superagent'); +const Maintenance = (props) => { + const { dispatch, user } = props + const [data, setData] = useState() + useEffect(() => { + // dispatch(getDepMessage()) + dispatch(getReportStatistic()) + setData(props) + }, []); + //批量导出 + const exports = (ids, counts) => { + // console.log(user); + let reportIds = []; + if (ids.length) + reportIds = ids + else + reportIds = (counts || {}).ids || []; + superagent.post('/_report/http') + .send({ id: reportIds.map(i => Number(i)) }).end((err, res) => { + const resTextIs = res.text.split('/').pop() + window.open( + '/_api/' + + `attachments?src=files/${resTextIs}&filename=${encodeURIComponent(resTextIs)}&token=${user.token}`) + }) + } + return ( + <> + + ) +} +function mapStateToProps(state) { + const { auth } = state + return { + user: auth.user, + } +} +export default connect(mapStateToProps)(Maintenance); \ No newline at end of file diff --git a/web/client/src/sections/fillion/containers/patrol.js b/web/client/src/sections/fillion/containers/patrol.js new file mode 100644 index 00000000..0e7b77c0 --- /dev/null +++ b/web/client/src/sections/fillion/containers/patrol.js @@ -0,0 +1,42 @@ +import React, { useEffect, useState } from 'react'; +import { connect } from 'react-redux'; +import '../style.less'; +import { getDepMessage, getReportStatistic } from "../actions/infor" +import PatrolTable from '../components/patrolTable'; +const superagent = require('superagent'); +const patrol = (props) => { + const { dispatch, user } = props + const [data, setData] = useState() + useEffect(() => { + // dispatch(getDepMessage()) + dispatch(getReportStatistic()) + setData(props) + }, []); + //批量导出 + const exports = (ids, counts) => { + // console.log(user); + let reportIds = []; + if (ids.length) + reportIds = ids + else + reportIds = (counts || {}).ids || []; + superagent.post('/_report/http') + .send({ id: reportIds.map(i => Number(i)) }).end((err, res) => { + const resTextIs = res.text.split('/').pop() + window.open( + '/_api/' + + `attachments?src=files/${resTextIs}&filename=${encodeURIComponent(resTextIs)}&token=${user.token}`) + }) + } + return ( + <> + + ) +} +function mapStateToProps(state) { + const { auth } = state + return { + user: auth.user, + } +} +export default connect(mapStateToProps)(patrol); \ No newline at end of file diff --git a/web/client/src/sections/fillion/nav-item.js b/web/client/src/sections/fillion/nav-item.js index 9f5f1cc7..650b5db8 100644 --- a/web/client/src/sections/fillion/nav-item.js +++ b/web/client/src/sections/fillion/nav-item.js @@ -23,6 +23,12 @@ export function getNavItem(user, dispatch) { 执法管理 + + 养护管理 + + + 巡查管理 + 公交管理 diff --git a/web/client/src/sections/fillion/routes.js b/web/client/src/sections/fillion/routes.js index a0b01d3a..a3410fd4 100644 --- a/web/client/src/sections/fillion/routes.js +++ b/web/client/src/sections/fillion/routes.js @@ -8,6 +8,8 @@ import { Enforce } from './containers'; import { Public } from './containers'; import { Videois } from './containers'; import { PromoTional } from './containers'; +import { Maintenance } from './containers' +import { Patrol } from './containers' export default [{ type: 'inner', route: { @@ -54,6 +56,18 @@ export default [{ menuSelectKeys: ['fillionenforce'], component: Enforce, breadcrumb: '执法管理', + }, { + path: '/maintenance', + key: 'fillionmaintenance', + menuSelectKeys: ['fillionmaintenance'], + component: Maintenance, + breadcrumb: '养护管理', + }, { + path: '/patrol', + key: 'fillionpatrol', + menuSelectKeys: ['fillionpatrol'], + component: Patrol, + breadcrumb: '巡查管理', }, { path: '/public', key: 'fillionpublic', diff --git a/web/package.json b/web/package.json index 9378e1d4..e6d11a96 100644 --- a/web/package.json +++ b/web/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "mocha", "start": "cross-env NODE_ENV=development npm run start-params", - "start-params": "npm run color && node server -p 5000 -u http://10.8.30.157:8439", + "start-params": "npm run color && node server -p 5000 -u https://3024-117-90-36-177.jp.ngrok.io", "deploy": "export NODE_ENV=production&&npm run color && npm run build && node server", "build-dev": "export NODE_ENV=development&&webpack --config webpack.config.js", "build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js",