From d7004986135c0885c1b9a92fb48919179732c00d Mon Sep 17 00:00:00 2001 From: xuxj <hugeinfo123> Date: Sat, 09 May 2020 09:20:13 +0800 Subject: [PATCH] BUG修改 --- SunshineIns/src/page/BusList.jsx | 129 +++++++++++++++++++++--------------------- 1 files changed, 65 insertions(+), 64 deletions(-) diff --git a/SunshineIns/src/page/BusList.jsx b/SunshineIns/src/page/BusList.jsx index 8763c32..3872f6c 100644 --- a/SunshineIns/src/page/BusList.jsx +++ b/SunshineIns/src/page/BusList.jsx @@ -10,7 +10,7 @@ import HeadView from '../view/HeadView'; import TableBtnView from '../view/TableBtnView'; import LinkView from '../view/LinkView'; -import { Input, Button, DatePicker, Divider, Row, Col, message, Modal, Popconfirm, Badge, Select } from 'antd'; +import { Input, Button, DatePicker, Divider, Row, Col, message, Modal, Popconfirm, Badge, Select } from 'antd'; import moment from 'moment'; import Fetch from '../fetch'; import TableView from '../view/TableView'; @@ -32,7 +32,7 @@ componentDidMount() { const { type } = this.state; var businessType; - switch(type){ + switch (type) { case 'onlineAppeal': businessType = 12; document.title = '在线申诉'; @@ -54,12 +54,12 @@ document.title = '案件进度'; break; default: - break; - } - this.setState({ loading: true,businessType }); - Fetch.getBusinessQuery({businessType}).then( res => { - for(var i=0;i<res.length;i++){ - res[i]['index'] = i+1; + break; + } + this.setState({ loading: true, businessType }); + Fetch.getBusinessQuery({ businessType }).then(res => { + for (var i = 0; i < res.length; i++) { + res[i]['index'] = i + 1; } this.setState({ data: res, @@ -92,7 +92,7 @@ ...this.state.formdata, status: value }; - this.setState({ formdata }); + this.setState({ formdata }); } onReset = () => { this.setState(prev => ({ @@ -111,33 +111,34 @@ onTableChange = () => { this.setState({ loading: true }); const { businessType } = this.state; - Fetch.getBusinessQuery({businessType,...this.state.formdata}).then( res => { - for(var i=0;i<res.length;i++){ - res[i]['index'] = i+1; + Fetch.getBusinessQuery({ businessType, ...this.state.formdata }).then(res => { + for (var i = 0; i < res.length; i++) { + res[i]['index'] = i + 1; } this.setState({ data: res, loading: false }) }) + } - onDetail = (_text, _record) =>{ - this.props.history.push('/busDetail/' + _text.businessType + '/' + _text.businessId + '/' + _text.createId + '/' + 'detail'); + onDetail = (_text, _record) => { + this.props.history.push('/busDetail/' + _text.businessType + '/' + _text.businessId + '/' + _text.createId + '/' + 'detail'); } - onDo = (_text, _record) =>{ - this.props.history.push('/busDetail/' + _text.businessType + '/' + _text.businessId + '/' + _text.createId + '/' + 'bus'); + onDo = (_text, _record) => { + this.props.history.push('/busDetail/' + _text.businessType + '/' + _text.businessId + '/' + _text.createId + '/' + 'bus'); } - + onDel = (_text, _record) => { - Fetch.businessDel({businessId: _text.businessId}).then( res => { - if(res.code == 0){ - message.warning('正在更新列表'); + Fetch.businessDel({ businessId: _text.businessId }).then(res => { + if (res.code == 0) { + message.success('删除成功'); this.onTableChange(); } - }, err => { - message.error(err); + }, err => { + message.error(err); }); } @@ -148,51 +149,51 @@ dataIndex: 'index', key: 'index', }, { - title: '申请人', - dataIndex: 'userName', - key: 'userName', - }, { - title: '详细内容', - dataIndex: 'content', - key: 'content', - }, { - title: '创建时间', - dataIndex: 'createTime', - key: 'createTime', - render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span> - }, { - title: '状态', - dataIndex: 'status', - key: 'status', - render: text => ( - text == "待审" ? - <Badge count={text} /> : <Badge count={text} style={{ backgroundColor: '#52c41a' }} /> - ) - }, { - title: '操作', - key: 'action', - render: (text, record) => ( - <span style={{cursor : 'pointer'}}> - { - text.status == '待审' ? <span><label onClick={()=>{this.onDo(text, record)}} className="theme-color"> 处理</label><Divider type="vertical" /></span> : null - } - <label onClick={()=>{this.onDetail(text, record)}} className="theme-color">详情</label> - <Divider type="vertical" /> - <Popconfirm placement="topRight" title={'你确定要删除该条记录吗'} onConfirm={()=>{this.onDel(text, record)}} okText="确定" cancelText="取消" > - <label className="theme-color">删除</label> - </Popconfirm> - </span> - ), - }]; + title: '申请人', + dataIndex: 'userName', + key: 'userName', + }, { + title: '详细内容', + dataIndex: 'content', + key: 'content', + }, { + title: '创建时间', + dataIndex: 'createTime', + key: 'createTime', + render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span> + }, { + title: '状态', + dataIndex: 'status', + key: 'status', + render: text => ( + text == "待审" ? + <Badge count={text} /> : <Badge count={text} style={{ backgroundColor: '#52c41a' }} /> + ) + }, { + title: '操作', + key: 'action', + render: (text, record) => ( + <span style={{cursor : 'pointer'}}> + { + text.status == '待审' ? <span><label onClick={()=>{this.onDo(text, record)}} className="theme-color"> 处理</label><Divider type="vertical" /></span> : null + } + <label onClick={()=>{this.onDetail(text, record)}} className="theme-color">详情</label> + <Divider type="vertical" /> + <Popconfirm placement="topRight" title={'你确定要删除该条记录吗'} onConfirm={()=>{this.onDel(text, record)}} okText="确定" cancelText="取消" > + <label className="theme-color">删除</label> + </Popconfirm> + </span> + ), + }]; const { data, loading } = this.state; - const { local, sed } = this.props; + const { local, sed } = this.props; return ( <div className="app-page"> <HeadView history={this.props.history} /> <LinkView local={local} sed={sed} /> <TableBtnView name={local} btnName='新建人员' key={this.state.key}> - <Input placeholder="根据申请人模糊查询" style={{ width: "200px" }} name='userName' onChange={this.onInputChange} onPressEnter={this.onSubmit}/> - <Input placeholder="根据详细内容模糊查询" style={{ width: "200px" }} name='content' onChange={this.onInputChange} onPressEnter={this.onSubmit}/> + <Input placeholder="根据申请人模糊查询" style={{ width: "200px" }} name='userName' onChange={this.onInputChange} onPressEnter={this.onSubmit} /> + <Input placeholder="根据详细内容模糊查询" style={{ width: "200px" }} name='content' onChange={this.onInputChange} onPressEnter={this.onSubmit} /> <Select showSearch style={{ width: 200 }} @@ -203,12 +204,12 @@ <Option value="2">已审</Option> <Option value="1">待审</Option> </Select> - - <DatePicker onChange={this.onTimeChange} placeholder="创建日期"/> + + <DatePicker onChange={this.onTimeChange} placeholder="创建日期" /> <Button type="primary" onClick={this.onSubmit}>查询</Button> <Button name="reset" onClick={this.onInputChange}>重置</Button> </TableBtnView> - <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading}/> + <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} /> {/* <FormSearch /> */} </div> ); -- Gitblit v1.8.0