From 0ec802e93557b2b1422ddbd68aafa994fa68f455 Mon Sep 17 00:00:00 2001 From: Mr Ke <kelq@hugeinfo.com.cn> Date: Wed, 27 May 2020 10:04:29 +0800 Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/nsjcy/frontEnd/nsjcy --- SunshineIns/src/page/CareList.jsx | 101 ++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 73 insertions(+), 28 deletions(-) diff --git a/SunshineIns/src/page/CareList.jsx b/SunshineIns/src/page/CareList.jsx index 1fa8e21..4cb2b8d 100644 --- a/SunshineIns/src/page/CareList.jsx +++ b/SunshineIns/src/page/CareList.jsx @@ -3,7 +3,7 @@ import HeadView from '../view/HeadView'; import TableBtnView from '../view/TableBtnView'; import CommonSearchForm from '../view/CommonSearchForm'; -import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge } from 'antd'; +import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge, Breadcrumb } from 'antd'; import moment from 'moment'; import Fetch from '../fetch'; import TableView from '../view/TableView'; @@ -18,6 +18,8 @@ return "社会调查"; case 4: return "心理疏导"; + case 5: + return "法律援助"; } } @@ -26,24 +28,27 @@ 2: '合适成年人', 3: '社会调查', 4: '心理疏导', + 5: '法律援助', } const activityTypeList = [ 1, 2, 3, + 4, + 5 ] const activityStatusIds = { 0: '未开始', 1: '进行中', 2: '已结束', - 99: '结束', + 99: '暂停', } const activityStatusList = [ + 0, 1, - 2, - 3, + 2 ] export default class CareList extends React.Component { constructor(props) { @@ -61,7 +66,7 @@ } componentDidMount() { - document.title = '社会关护管理'; + document.title = '社会观护管理'; this.getData(); } @@ -77,12 +82,23 @@ this.setState({ formData: data, }); - this.getData(); + this.setState({ loading: true }) + Fetch.socialQuery({ ...data }) + .then(res => { + console.log(res) + for (var i = 0; i < res.rows.length; i++) { + res.rows[i]['index'] = i + 1; + } + this.setState({ + data: res.rows, + loading: false, + }); + }); } getData = () => { const { formData } = this.state; - this.setState({loading:true}) + this.setState({ loading: true }) Fetch.socialQuery({ ...formData }) .then(res => { console.log(res) @@ -91,7 +107,7 @@ } this.setState({ data: res.rows, - loading:false, + loading: false, }); }); } @@ -126,6 +142,22 @@ }, this.getData); } + reboot = (e,status) => { + this.setState({ loading: true }) + Fetch.socialUpdate(e, status).then(res => { + if (res.code == 0) { + console.log(res) + this.setState({ loading: false }) + message.success(status==0?'重启任务成功':'暂停任务成功'); + this.getData(); + } else { + this.setState({ loading: false }) + message.error('删除失败,请联系管理员', 2) + } + } + ) + } + confirm = (e) => { console.log(e); this.setState({ loading: true }) @@ -158,7 +190,7 @@ key: 'status', render: text => ( text == 0 ? - <Badge style={{ backgroundColor: '#6C757C' }} count={'已结束'} /> : text == 1 ? <Badge count={'进行中'} style={{ backgroundColor: '#6C757C' }} />: text == 2 ? <Badge count={'进行中'} style={{ backgroundColor: '#6C757C' }} /> : <Badge count={'已结束'} style={{ backgroundColor: '#2ECC71' }} /> + <Badge style={{ backgroundColor: '#6C757C' }} count={'未开始'} /> : text == 1 ? <Badge count={'进行中'} style={{ backgroundColor: '#F1C40F' }} /> : text == 2 ? <Badge count={'已结束'} style={{ backgroundColor: '#2ECC71' }} /> : <Badge count={'暂停'} style={{ backgroundColor: '#2ECC71' }} /> ) }, { title: '创建时间', @@ -175,28 +207,41 @@ dataIndex: 'endTime', key: 'endTime', render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span> - },{ + }, { title: '操作', key: 'action', render: (text, record) => ( <span> - <a onClick={() => this.showModal(record.id)}>编辑</a> - <Divider type="vertical" /> - <Popconfirm - title="确认删除任务吗?" - id={record.id} - onConfirm={e => this.confirm(record.id)} - okText="确定" - cancelText="取消" - > - <a href="#">删除</a> - </Popconfirm> { - record.status == 1 ? + record.status == 0 ? <React.Fragment> + <a onClick={() => this.showModal(record.id)}>编辑</a> <Divider type="vertical" /> - <a onClick={() => this.showModal(record.id)}>结束任务</a> - </React.Fragment> : '' + <Popconfirm + title="确认删除任务吗?" + id={record.id} + onConfirm={e => this.confirm(record.id)} + okText="确定" + cancelText="取消" + > + <a href="#">删除</a> + <Divider type="vertical" /> + </Popconfirm> + <a onClick={() => this.reboot(record.id, 99)}>暂停</a> + </React.Fragment> : + record.status == 1 ? + <React.Fragment> + <a onClick={() => this.showModal(record.id)}>查看</a> + <Divider type="vertical" /> + <a onClick={() => this.showModal(record.id)}>结束任务</a> + <Divider type="vertical" /> + <a onClick={() => this.reboot(record.id, 99)}>暂停</a> + </React.Fragment> : + <React.Fragment> + <a onClick={() => this.showModal(record.id)}>查看</a> + <Divider type="vertical" /> + <a onClick={() => this.reboot(record.id, 0)}>重启</a> + </React.Fragment> } </span> ), @@ -205,13 +250,13 @@ return ( <div className="app-page"> <HeadView history={this.props.history} /> - <div style={{ marginLeft: '90%', marginBottom: '20px', marginTop: '20px' }}> - <Button type="primary" size='large' onClick={() => this.showModal('new')}>新建任务</Button> - </div> {/* <Breadcrumb style={{ padding: '20px' }}> <Breadcrumb.Item><a href="">后台中心</a></Breadcrumb.Item> <Breadcrumb.Item>社会关护</Breadcrumb.Item> </Breadcrumb> */} + <div style={{ marginLeft: '90%', marginBottom: '20px', marginTop: '20px' }}> + <Button type="primary" size='large' onClick={() => this.showModal('new')}>新建任务</Button> + </div> <div style={{ background: '#fff', margin: 20 }}> <CommonSearchForm {...this.props} @@ -240,7 +285,7 @@ keylistName: 'rangeTimelist', }, ]} /> - <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading}/> + <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} /> </div> </div> ); -- Gitblit v1.8.0