From e29d2313a38c0278577e645b4bb110e677175e10 Mon Sep 17 00:00:00 2001
From: liuwh <liuwh@hugeinfo.com.cn>
Date: Sun, 23 Feb 2020 12:36:07 +0800
Subject: [PATCH] 提交
---
SunshineIns/src/page/PoliceSecurity.jsx | 96 +++--
SunshineIns/src/asset/image/sign.png | 0
SunshineIns/src/page/policeSecurityEdit.jsx | 6
SunshineIns/src/fetch/index.js | 4
SunshineIns/src/page/ActiveManage.jsx | 121 +++++-
SunshineIns/src/page/ApplyFor.jsx | 107 +++--
SunshineIns/src/page/SignIn.jsx | 82 ++++
SunshineIns/src/view/CommonSearchForm/style.scss | 13
SunshineIns/src/fetch/activeManage.js | 2
SunshineIns/src/view/CommonSearchForm/index.jsx | 253 ++++++++++++++
SunshineIns/src/index.jsx | 2
SunshineIns/src/page/ActiveManageEdit.jsx | 110 ++++++
SunshineIns/src/fetch/socialQuery.js | 2
SunshineIns/src/page/ApplyForEdit.jsx | 6
SunshineIns/src/fetch/entryQuery.js | 2
SunshineIns/src/page/ExamineEdit.jsx | 6
SunshineIns/src/page/Examine.jsx | 113 +++---
SunshineIns/src/page/CareList.jsx | 144 +++++--
SunshineIns/src/page/CareListEdit.jsx | 6
SunshineIns/src/fetch/signinfo.js | 5
20 files changed, 868 insertions(+), 212 deletions(-)
diff --git a/SunshineIns/src/asset/image/sign.png b/SunshineIns/src/asset/image/sign.png
new file mode 100644
index 0000000..152fd05
--- /dev/null
+++ b/SunshineIns/src/asset/image/sign.png
Binary files differ
diff --git a/SunshineIns/src/fetch/activeManage.js b/SunshineIns/src/fetch/activeManage.js
index 4dc87bf..1995e10 100644
--- a/SunshineIns/src/fetch/activeManage.js
+++ b/SunshineIns/src/fetch/activeManage.js
@@ -1,6 +1,6 @@
import fetch from './_fetch';
import { message } from 'antd';
-export default () => fetch(`api/activity/finds?`)
+export default ({ activityType, activityStatus, startTime, endTime }) => fetch(`api/activity/finds?activityType=${activityType||''}&activityStatus=${activityStatus || ''}&startTime=${startTime || ''}&endTime=${endTime || ''}`)
.then(
json => json.data
)
diff --git a/SunshineIns/src/fetch/entryQuery.js b/SunshineIns/src/fetch/entryQuery.js
index e6007cc..e6f9b1f 100644
--- a/SunshineIns/src/fetch/entryQuery.js
+++ b/SunshineIns/src/fetch/entryQuery.js
@@ -1,6 +1,6 @@
import fetch from './_fetch';
import { message } from 'antd';
-export default ({page,size, type}) => fetch(`api/entry/query?rows=${size}&page=${page}&type=${type}`)
+export default ({page,size, type, status,startTime,endTime,createrName}) => fetch(`api/entry/query?rows=${size||''}&page=${page||''}&type=${type||''}&status=${status||''}&startTime=${startTime||''}&endTime=${endTime||''}&createrName=${createrName||''}`)
.then(
json => json
)
diff --git a/SunshineIns/src/fetch/index.js b/SunshineIns/src/fetch/index.js
index a2756b1..251a0e1 100644
--- a/SunshineIns/src/fetch/index.js
+++ b/SunshineIns/src/fetch/index.js
@@ -80,6 +80,7 @@
import entryQuery from './entryQuery';
import attachmentDownload from './attachmentDownload';
import entryAudit from './entryAudit';
+import signinfo from './signinfo';
export default {
domain,
@@ -163,5 +164,6 @@
entrySave,
entryQuery,
attachmentDownload,
- entryAudit
+ entryAudit,
+ signinfo
};
\ No newline at end of file
diff --git a/SunshineIns/src/fetch/signinfo.js b/SunshineIns/src/fetch/signinfo.js
new file mode 100644
index 0000000..eb0409c
--- /dev/null
+++ b/SunshineIns/src/fetch/signinfo.js
@@ -0,0 +1,5 @@
+import fetch from './_fetch';
+import { message } from 'antd';
+
+export default (id) => fetch(`/api/activity/signInfo?id=${id}`)
+.catch(error => message.error('信息加载失败,请联系管理员', 2));
\ No newline at end of file
diff --git a/SunshineIns/src/fetch/socialQuery.js b/SunshineIns/src/fetch/socialQuery.js
index db25515..6fcae23 100644
--- a/SunshineIns/src/fetch/socialQuery.js
+++ b/SunshineIns/src/fetch/socialQuery.js
@@ -1,6 +1,6 @@
import fetch from './_fetch';
import { message } from 'antd';
-export default ({page,size}) => fetch(`api/social/query?size=${size}&page=${page}`)
+export default ({page,size, taskType, status, startTime,endTime}) => fetch(`api/social/query?size=${size}&page=${page}&taskType=${taskType}&status=${status}&startTime=${startTime}&endTime=${endTime}`)
.then(
json => json
)
diff --git a/SunshineIns/src/index.jsx b/SunshineIns/src/index.jsx
index 3c3d478..62b5c13 100644
--- a/SunshineIns/src/index.jsx
+++ b/SunshineIns/src/index.jsx
@@ -55,7 +55,7 @@
<Switch>
<Route path="/bus/attachment/:busId/:attachmentId" component={AttTree} />
<Route path="/bus/attachment/:busId" component={AttTree} />
- <Route path='/questionnaire/newly' component={null} />
+ <Route path='/signIn/:id' component={null} />
<Route component={Menu} />
</Switch>
<Switch>
diff --git a/SunshineIns/src/page/ActiveManage.jsx b/SunshineIns/src/page/ActiveManage.jsx
index c457ae4..bc789c1 100644
--- a/SunshineIns/src/page/ActiveManage.jsx
+++ b/SunshineIns/src/page/ActiveManage.jsx
@@ -1,15 +1,10 @@
-/**
- * 徐祥健<xuxj@hugeinfo.com.cn>
- * 2018年8月28日 10:41
- *
- */
-
import React from 'react';
import HeadView from '../view/HeadView';
import TableBtnView from '../view/TableBtnView';
-import { Divider, Modal, message, Tooltip, Progress } from 'antd'
+import CommonSearchForm from '../view/CommonSearchForm';
+import { Divider, Modal, message, Button, Progress } from 'antd'
import moment from 'moment'
import Fetch from '../fetch';
import { domain } from '../fetch/_fetch';
@@ -40,12 +35,48 @@
return "普法预约";
}
}
+
+const taskNodeIds = {
+ 'act_1': '南检活动',
+ 'act_2': '法治培训',
+ 'act_3': '普法预约',
+}
+
+const activityTypeList = [
+ 'act_1',
+ 'act_2',
+ 'act_3',
+]
+
+const activityStatusIds = {
+ 0: '未发布',
+ 1: '报名中',
+ 2: '活动中',
+ 3: '已结束',
+ 100: '已摇号',
+}
+
+const activityStatusList = [
+ 0,
+ 1,
+ 2,
+ 3,
+ 100,
+]
export default class ActiveManage extends React.Component {
constructor(props) {
super(props);
this.state = {
data: [],
- resetKey: Date.now()
+ resetKey: Date.now(),
+ loading:false,
+ formData: {
+ __key: Date.now(),
+ activityType: '',
+ activityStatus: '',
+ startTime: '',
+ endTime: '',
+ }
};
}
@@ -53,17 +84,35 @@
document.title = '活动管理';
this.getData();
}
+
+ setFormData = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
+ }
+
+ searchonClick = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
+ this.getData();
+ }
+
getData = () => {
// this.setState({
// data: []
// });
- Fetch.activeManage()
+ this.setState({loading:true})
+ Fetch.activeManage({ ...this.state.formData })
.then(res => {
for (var i = 0; i < res.length; i++) {
res[i]['index'] = i + 1;
}
this.setState({
- data: res
+ data: res,
+ loading:false
});
});
}
@@ -71,7 +120,7 @@
this.props.history.push("/activeManageEdit/" + id);
}
- signIn= (id) => {
+ signIn = (id) => {
window.open('index.html#/signIn/' + id);
}
@@ -162,26 +211,58 @@
<Divider type="vertical" />
<label className='theme-color' onClick={() => this.deleteItems(record.id)} style={{ cursor: 'pointer' }}>删除</label>
</span>
- :
- record.status == 2 ?
+ :
+ record.status == 2 ?
<span>
<label className='theme-color' onClick={() => this.showModal(record.id)} style={{ cursor: 'pointer' }}>查看</label>
<Divider type="vertical" />
<label className='theme-color' onClick={() => this.signIn(record.id)} style={{ cursor: 'pointer' }}>签到上墙</label>
</span>
- :
- <span><label className='theme-color' onClick={() => this.showModal(record.id)} style={{ cursor: 'pointer' }}>查看</label></span>
+ :
+ <span><label className='theme-color' onClick={() => this.showModal(record.id)} style={{ cursor: 'pointer' }}>查看</label></span>
)
),
}];
- const { data, resetKey } = this.state;
+ const { data, resetKey, formData, loading } = this.state;
return (
- <div className="app-page">
+ <div className="app-page" >
<HeadView history={this.props.history} />
- <TableBtnView key={-resetKey} type="infoManage" name='活动一览' btnName='活动发布' onClick={() => this.showModal('new')}>
- </TableBtnView>
- <TableView columns={columns} data={data} pageSize='10' size='default' />
+ <div style={{ marginLeft: '90%', marginBottom: '20px', marginTop: '20px' }}>
+ <Button type="primary" size='large' onClick={() => this.showModal('new')}>活动发布</Button>
+ </div>
+ {/* <TableBtnView key={-resetKey} type="infoManage" name='活动一览' btnName='活动发布' onClick={() => this.showModal('new')}>
+ </TableBtnView> */}
+ <div style={{ background: '#fff', margin: 20 }}>
+ <CommonSearchForm
+ {...this.props}
+ formData={formData}
+ setFormData={this.setFormData}
+ searchonClick={this.searchonClick}
+ pathName={this.props.location.pathname}
+ data={[
+ {
+ type: 'select', name: '活动类型', label: '活动类型', key: 'activityType', list: activityTypeList.map(key => ({
+ id: key,
+ name: taskNodeIds[key]
+ })),
+ },
+ {
+ type: 'select', name: '活动状态', label: '活动状态', key: 'activityStatus', list: activityStatusList.map(key => ({
+ id: key,
+ name: activityStatusIds[key]
+ })),
+ },
+ {
+ type: 'rangePicker',
+ label: '任务生成时间',
+ name: JSON.stringify(['开始时间', '结束时间']),
+ key: JSON.stringify(['startTime', 'endTime']),
+ keylistName: 'rangeTimelist',
+ },
+ ]} />
+ <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+ </div>
</div>
);
}
diff --git a/SunshineIns/src/page/ActiveManageEdit.jsx b/SunshineIns/src/page/ActiveManageEdit.jsx
index c1aa82a..534bf2e 100644
--- a/SunshineIns/src/page/ActiveManageEdit.jsx
+++ b/SunshineIns/src/page/ActiveManageEdit.jsx
@@ -5,13 +5,15 @@
*/
import React from 'react';
-import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd';
+import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin, Breadcrumb } from 'antd';
const { TextArea } = Input;
import HeadView from '../view/HeadView';
import BusDetailView from '../view/BusDetailView';
import TableView from '../view/TableView';
import ImageBoxView from '../view/ImageBoxView'
// 引入编辑器以及编辑器样式
+import BraftEditor from 'braft-editor'
+import 'braft-editor/dist/index.css'
import Fetch from '../fetch';
import moment from 'moment';
const format = 'HH:mm';
@@ -53,6 +55,8 @@
disabled: true,
status: '',
loading: false,
+ code: '',
+ editorState: BraftEditor.createEditorState(null)
};
}
@@ -73,6 +77,7 @@
if (endTime == null) {
endTime = Date.now();
}
+ console.log
this.setState({
savedate: {
...res.activity,
@@ -82,6 +87,8 @@
endHour: moment(endTime).format(format),
activityType: res.activity.activityType || 'act_1',
},
+ code: res.code || '',
+ editorState: BraftEditor.createEditorState(res.activity.course),
activityType: res.activity.activityType || 'act_1',
status: res.activity.activityStatus || '',
disabled: res.activity.activityStatus == 0 ? false : true,
@@ -225,9 +232,70 @@
)
}
+ uploadFn = (param) => {
+
+ const serverURL = domain + 'api/v1/attachment/upload'
+ const xhr = new XMLHttpRequest
+ const fd = new FormData()
+ const successFn = (response) => {
+ // 假设服务端直接返回文件上传后的地址
+ // 上传成功后调用param.success并传入上传后的文件地址
+ //Pz
+ const res = JSON.parse(xhr.responseText);
+ param.success({
+ url: domain + 'api/v1/attachment/image/' + res[0].id,
+ meta: {
+ id: res[0].id,
+ title: res[0].name,
+ alt: res[0].name,
+ loop: true, // 指定音视频是否循环播放
+ autoPlay: true, // 指定音视频是否自动播放
+ controls: true, // 指定音视频是否显示控制栏
+ poster: domain + 'api/v1/attachment/image/' + res[0].id, // 指定视频播放器的封面
+ }
+ })
+ }
+
+
+ const progressFn = (event) => {
+ // 上传进度发生变化时调用param.progress
+ param.progress(event.loaded / event.total * 100)
+ }
+
+ const errorFn = (response) => {
+ // 上传发生错误时调用param.error
+ param.error({
+ msg: 'unable to upload.'
+ })
+ }
+ xhr.upload.addEventListener("progress", progressFn, false)
+ xhr.addEventListener("load", successFn, false)
+ xhr.addEventListener("error", errorFn, false)
+ xhr.addEventListener("abort", errorFn, false)
+ fd.append('file', param.file)
+ xhr.open('POST', serverURL, true)
+ xhr.send(fd)
+ }
+
+ handleEditorChange = (editorState) => {
+ this.setState({ editorState })
+ }
+
+ submitContent = () => {
+ // 在编辑器获得焦点时按下ctrl+s会执行此方法
+ // 编辑器内容提交到服务端之前,可直接调用editorState.toHTML()来获取HTML格式的内容
+ const htmlContent = this.state.editorState.toHTML()
+ this.setState(({ savedate }) => ({
+ savedate: {
+ ...savedate,
+ course: htmlContent
+ }
+ }))
+ }
+
handleCancel = () => this.setState({ previewVisible: false })
render() {
- const { savedate, previewVisible, previewImage, fileList, dateSource, hitList, activityType, disabled, loading } = this.state;
+ const { savedate, previewVisible, previewImage,editorState, fileList, dateSource, code, hitList, activityType, disabled, loading } = this.state;
console.log('disabled', disabled)
const props = {
action: domain + 'api/v1/attachment/materials?entityId=' + savedate.id,
@@ -313,6 +381,10 @@
<div className="app-page">
<Spin spinning={loading}>
<HeadView history={this.props.history} />
+ <Breadcrumb style={{ padding: '20px' }}>
+ <Breadcrumb.Item><a href="index.html#/activeManage">活动管理</a></Breadcrumb.Item>
+ <Breadcrumb.Item>活动发布</Breadcrumb.Item>
+ </Breadcrumb>
<BusDetailView type='活动发布' >
<div style={divStyle}>
<Row type="flex" align='middle' justify="space-around">
@@ -395,6 +467,40 @@
</div>
{
+ code && <div style={divStyle}>
+ <Row type="flex" align='middle' justify="space-around">
+ <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>活动二维码</span></Col>
+ <Col span={18} push={0} ><img style={{ width: '150px', height: '150px' }} src={`data:image/png;base64,${code}`} /></Col>
+ </Row>
+ </div>
+
+ }
+
+ <div style={divStyle}>
+ <Row type="flex" align='top' justify="space-around">
+ <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>活动进程</span></Col>
+ <Col span={18} push={0} style={{ border: 'solid 1px rgba(0, 0, 0, 0.25)', borderRadius: '5PX' }} >
+ <BraftEditor
+ value={editorState}
+ disabled={disabled}
+ placeholder='请输入活动进程'
+ media={{
+ allowPasteImage: true, // 是否允许直接粘贴剪贴板图片(例如QQ截图等)到编辑器
+ image: true, // 开启图片插入功能
+ video: false, // 开启视频插入功能
+ audio: false, // 开启音频插入功能
+ uploadFn: this.uploadFn
+ }}
+ excludeControls={['emoji']}
+ onChange={this.handleEditorChange}
+ onSave={this.submitContent}
+ onBlur={this.submitContent}
+ />
+ </Col>
+ </Row>
+ </div>
+
+ {
activityType == 'act_1' ? (dateSource.length > 0 ?
<div style={divStyle}>
<Divider orientation="left" style={{ margin: '20px', width: '97%' }}>报名人员信息</Divider>
diff --git a/SunshineIns/src/page/ApplyFor.jsx b/SunshineIns/src/page/ApplyFor.jsx
index 43d5dc3..2eab1b3 100644
--- a/SunshineIns/src/page/ApplyFor.jsx
+++ b/SunshineIns/src/page/ApplyFor.jsx
@@ -2,10 +2,11 @@
import HeadView from '../view/HeadView';
import TableBtnView from '../view/TableBtnView';
+import CommonSearchForm from '../view/CommonSearchForm';
+import TableView from '../view/TableView';
import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge, Tooltip } from 'antd';
import moment from 'moment';
import Fetch from '../fetch';
-import TableView from '../view/TableView';
const Option = Select.Option;
function typeOfName(type) {
switch (type) {
@@ -17,15 +18,27 @@
return "已反馈";
}
}
+
+const activityStatusIds = {
+ 1: '待处理',
+ 2: '已受理',
+ 3: '已反馈',
+}
+
+const activityStatusList = [
+ 1,
+ 2,
+ 3,
+]
export default class ApplyFor extends React.Component {
constructor(props) {
super(props);
this.state = {
data: [],
- formdata: {
+ formData: {
+ __key: Date.now(),
page: 1,
size: 10,
- type:1,
},
resetKey: Date.now(),
loading: false
@@ -38,10 +51,20 @@
this.getData();
}
- getData = () => {
- const { formdata } = this.state;
+ setFormData = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
+ }
+
+ searchonClick = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
this.setState({ loading: true })
- Fetch.entryQuery({ ...formdata })
+ Fetch.entryQuery({ ...data,type:1 })
.then(res => {
console.log(res)
for (var i = 0; i < res.rows.length; i++) {
@@ -49,7 +72,22 @@
}
this.setState({
data: res.rows,
- loading:false
+ loading: false
+ });
+ });
+ }
+
+ getData = () => {
+ this.setState({ loading: true })
+ Fetch.entryQuery({ ...this.state.formData,type:1 })
+ .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
});
});
}
@@ -143,42 +181,37 @@
</span>
),
}];
- const { data, loading, resetKey } = this.state;
+ const { data, loading, resetKey, formData } = this.state;
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> */}
- <TableBtnView name={''} key={resetKey}>
- <Select
- style={{ width: 200 }}
- placeholder="根据举报性质查询"
- onChange={(value) => this.onInputChange({ target: { name: 'nature', value } })}
- >
- <Option value="1">涉黑涉恶违法犯罪行为</Option>
- <Option value="2">涉黑涉恶违法犯罪保护伞</Option>
- <Option value="3">其他</Option>
- </Select>
- <Input placeholder="根据内容模糊查询" style={{ width: "200px" }} name='content' onChange={this.onInputChange} />
- <Select
- style={{ width: 200 }}
- placeholder="根据状态查询"
- onChange={(value) => this.onInputChange({ target: { name: 'status', value } })}
- >
- <Option value="2">已回复</Option>
- <Option value="1">待回复</Option>
- </Select>
-
- <DatePicker onChange={(_, value) => this.onInputChange({ target: { name: 'createTime', value } })} placeholder="根据创建时间查询" />
- <Button type="primary" onClick={this.Seaech}>查询</Button>
- <Button onClick={this.Reset}>重置</Button>
- </TableBtnView>
- <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+ <div style={{ background: '#fff', margin: 20 }}>
+ <CommonSearchForm
+ {...this.props}
+ formData={formData}
+ setFormData={this.setFormData}
+ searchonClick={this.searchonClick}
+ pathName={this.props.location.pathname}
+ data={[
+ {
+ type: 'select', name: '状态', label: '活动状态', key: 'status', list: activityStatusList.map(key => ({
+ id: key,
+ name: activityStatusIds[key]
+ })),
+ },
+ {
+ type: 'rangePicker',
+ label: '申请时间',
+ name: JSON.stringify(['开始时间', '结束时间']),
+ key: JSON.stringify(['startTime', 'endTime']),
+ keylistName: 'rangeTimelist',
+ },
+ ]} />
+ <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+ </div>
</div>
);
}
diff --git a/SunshineIns/src/page/ApplyForEdit.jsx b/SunshineIns/src/page/ApplyForEdit.jsx
index 75bf9d6..7589c31 100644
--- a/SunshineIns/src/page/ApplyForEdit.jsx
+++ b/SunshineIns/src/page/ApplyForEdit.jsx
@@ -1,7 +1,7 @@
import React from 'react';
-import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd';
+import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, Breadcrumb, Badge, Select, Popconfirm, Spin } from 'antd';
const { TextArea } = Input;
import HeadView from '../view/HeadView';
import BusDetailView from '../view/BusDetailView';
@@ -268,6 +268,10 @@
<div className="app-page">
<Spin spinning={loading}>
<HeadView history={this.props.history} />
+ <Breadcrumb style={{ padding: '20px' }}>
+ <Breadcrumb.Item><a href="index.html#/entry/applyFor">入职查询</a></Breadcrumb.Item>
+ <Breadcrumb.Item>入职申请</Breadcrumb.Item>
+ </Breadcrumb>
<BusDetailView type='入职申请' >
<div style={divStyle}>
<Row type="flex" align='middle' justify="space-around">
diff --git a/SunshineIns/src/page/CareList.jsx b/SunshineIns/src/page/CareList.jsx
index bac86f5..1fa8e21 100644
--- a/SunshineIns/src/page/CareList.jsx
+++ b/SunshineIns/src/page/CareList.jsx
@@ -2,6 +2,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 moment from 'moment';
import Fetch from '../fetch';
@@ -19,12 +20,38 @@
return "心理疏导";
}
}
+
+const taskNodeIds = {
+ 1: '跟踪帮教',
+ 2: '合适成年人',
+ 3: '社会调查',
+ 4: '心理疏导',
+}
+
+const activityTypeList = [
+ 1,
+ 2,
+ 3,
+]
+const activityStatusIds = {
+ 0: '未开始',
+ 1: '进行中',
+ 2: '已结束',
+ 99: '结束',
+}
+
+const activityStatusList = [
+ 1,
+ 2,
+ 3,
+]
export default class CareList extends React.Component {
constructor(props) {
super(props);
this.state = {
data: [],
- formdata: {
+ formData: {
+ __key: Date.now(),
page: 1,
size: 10,
},
@@ -34,28 +61,44 @@
}
componentDidMount() {
-
document.title = '社会关护管理';
this.getData();
}
+ setFormData = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
+ }
+
+ searchonClick = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
+ this.getData();
+ }
+
getData = () => {
- const { formdata } = this.state;
- Fetch.socialQuery({ ...formdata })
+ const { formData } = this.state;
+ this.setState({loading:true})
+ Fetch.socialQuery({ ...formData })
.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
+ data: res.rows,
+ loading:false,
});
});
}
onInputChange = ({ target: { value, name } }) => {
- this.setState(({ formdata }) => ({
- formdata: {
- ...formdata,
+ this.setState(({ formData }) => ({
+ formData: {
+ ...formData,
[name]: value
}
}))
@@ -65,8 +108,8 @@
}
Seaech = () => {
- const { formdata } = this.state;
- Fetch.getSweeping(formdata)
+ const { formData } = this.state;
+ Fetch.getSweeping(formData)
.then(res => {
for (var i = 0; i < res.length; i++) {
res[i]['index'] = i + 1;
@@ -79,7 +122,7 @@
Reset = () => {
this.setState({
resetKey: Date.now(),
- formdata: {}
+ formData: {}
}, this.getData);
}
@@ -115,7 +158,7 @@
key: 'status',
render: text => (
text == 0 ?
- <Badge style={{ backgroundColor: '#6C757C' }} count={'未开始'} /> :text == 1 ? <Badge count={'F1C40F'} style={{ backgroundColor: '#6C757C' }} /> : <Badge count={'已结束'} style={{ backgroundColor: '#2ECC71' }} />
+ <Badge style={{ backgroundColor: '#6C757C' }} count={'已结束'} /> : text == 1 ? <Badge count={'进行中'} style={{ backgroundColor: '#6C757C' }} />: text == 2 ? <Badge count={'进行中'} style={{ backgroundColor: '#6C757C' }} /> : <Badge count={'已结束'} style={{ backgroundColor: '#2ECC71' }} />
)
}, {
title: '创建时间',
@@ -123,6 +166,16 @@
key: 'createTime',
render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span>
}, {
+ title: '开始时间',
+ dataIndex: 'startTime',
+ key: 'startTime',
+ render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span>
+ }, {
+ title: '结束时间',
+ dataIndex: 'endTime',
+ key: 'endTime',
+ render: text => <span>{moment(text).format("YYYY-MM-DD HH:mm")}</span>
+ },{
title: '操作',
key: 'action',
render: (text, record) => (
@@ -139,16 +192,16 @@
<a href="#">删除</a>
</Popconfirm>
{
- record.status==1?
- <React.Fragment>
- <Divider type="vertical" />
- <a onClick={() => this.showModal(record.id)}>结束任务</a>
- </React.Fragment>:''
+ record.status == 1 ?
+ <React.Fragment>
+ <Divider type="vertical" />
+ <a onClick={() => this.showModal(record.id)}>结束任务</a>
+ </React.Fragment> : ''
}
</span>
),
}];
- const { data, loading, resetKey } = this.state;
+ const { data, loading, resetKey, formData } = this.state;
return (
<div className="app-page">
<HeadView history={this.props.history} />
@@ -159,31 +212,36 @@
<Breadcrumb.Item><a href="">后台中心</a></Breadcrumb.Item>
<Breadcrumb.Item>社会关护</Breadcrumb.Item>
</Breadcrumb> */}
- <TableBtnView name={''} key={resetKey}>
- <Select
- style={{ width: 200 }}
- placeholder="根据举报性质查询"
- onChange={(value) => this.onInputChange({ target: { name: 'nature', value } })}
- >
- <Option value="1">涉黑涉恶违法犯罪行为</Option>
- <Option value="2">涉黑涉恶违法犯罪保护伞</Option>
- <Option value="3">其他</Option>
- </Select>
- <Input placeholder="根据内容模糊查询" style={{ width: "200px" }} name='content' onChange={this.onInputChange} />
- <Select
- style={{ width: 200 }}
- placeholder="根据状态查询"
- onChange={(value) => this.onInputChange({ target: { name: 'status', value } })}
- >
- <Option value="2">已回复</Option>
- <Option value="1">待回复</Option>
- </Select>
-
- <DatePicker onChange={(_, value) => this.onInputChange({ target: { name: 'createTime', value } })} placeholder="根据创建时间查询" />
- <Button type="primary" onClick={this.Seaech}>查询</Button>
- <Button onClick={this.Reset}>重置</Button>
- </TableBtnView>
- <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+ <div style={{ background: '#fff', margin: 20 }}>
+ <CommonSearchForm
+ {...this.props}
+ formData={formData}
+ setFormData={this.setFormData}
+ searchonClick={this.searchonClick}
+ pathName={this.props.location.pathname}
+ data={[
+ {
+ type: 'select', name: '任务类型', label: '任务类型', key: 'taskType', list: activityTypeList.map(key => ({
+ id: key,
+ name: taskNodeIds[key]
+ })),
+ },
+ {
+ type: 'select', name: '状态', label: '状态', key: 'status', list: activityStatusList.map(key => ({
+ id: key,
+ name: activityStatusIds[key]
+ })),
+ },
+ {
+ type: 'rangePicker',
+ label: '创建时间',
+ name: JSON.stringify(['开始时间', '结束时间']),
+ key: JSON.stringify(['startTime', 'endTime']),
+ keylistName: 'rangeTimelist',
+ },
+ ]} />
+ <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading}/>
+ </div>
</div>
);
}
diff --git a/SunshineIns/src/page/CareListEdit.jsx b/SunshineIns/src/page/CareListEdit.jsx
index 2ed56ab..25c60e4 100644
--- a/SunshineIns/src/page/CareListEdit.jsx
+++ b/SunshineIns/src/page/CareListEdit.jsx
@@ -1,7 +1,7 @@
import React from 'react';
-import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd';
+import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Breadcrumb, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd';
const { TextArea } = Input;
import HeadView from '../view/HeadView';
import BusDetailView from '../view/BusDetailView';
@@ -360,6 +360,10 @@
<div className="app-page">
<Spin spinning={loading}>
<HeadView history={this.props.history} />
+ <Breadcrumb style={{ padding: '20px' }}>
+ <Breadcrumb.Item><a href="index.html#/entry/applyFor">社会关护管理</a></Breadcrumb.Item>
+ <Breadcrumb.Item>社会关护管理活动</Breadcrumb.Item>
+ </Breadcrumb>
<BusDetailView type='社会关护管理活动' >
<div style={divStyle}>
<Row type="flex" align='middle' justify="space-around">
diff --git a/SunshineIns/src/page/Examine.jsx b/SunshineIns/src/page/Examine.jsx
index ce5607f..e380587 100644
--- a/SunshineIns/src/page/Examine.jsx
+++ b/SunshineIns/src/page/Examine.jsx
@@ -2,6 +2,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, Tooltip } from 'antd';
import moment from 'moment';
import Fetch from '../fetch';
@@ -22,10 +23,10 @@
super(props);
this.state = {
data: [],
- formdata: {
+ formData: {
+ __key: Date.now(),
page: 1,
size: 10,
- type:2,
},
resetKey: Date.now(),
loading: false
@@ -38,48 +39,57 @@
this.getData();
}
- getData = () => {
- const { formdata } = this.state;
- Fetch.entryQuery({ ...formdata })
+ setFormData = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
+ }
+
+ searchonClick = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
+ this.setState({ loading: true })
+ Fetch.entryQuery({ ...data, type: 2 })
.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
+ data: res.rows,
+ loading: false
+ });
+ });
+ }
+
+ getData = () => {
+ this.setState({ loading: true })
+ console.log(this.state.formData)
+ Fetch.entryQuery({ ...this.state.formData, type: 2 })
+ .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
});
});
}
onInputChange = ({ target: { value, name } }) => {
- this.setState(({ formdata }) => ({
- formdata: {
- ...formdata,
+ this.setState(({ formData }) => ({
+ formData: {
+ ...formData,
[name]: value
}
}))
}
showModal = (id) => {
this.props.history.push("/entry/ExamineEdit/" + id);
- }
-
- Seaech = () => {
- const { formdata } = this.state;
- Fetch.getSweeping(formdata)
- .then(res => {
- for (var i = 0; i < res.length; i++) {
- res[i]['index'] = i + 1;
- }
- this.setState({
- data: res
- });
- });
- }
- Reset = () => {
- this.setState({
- resetKey: Date.now(),
- formdata: {}
- }, this.getData);
}
confirm = (e) => {
@@ -131,35 +141,30 @@
</span>
),
}];
- const { data, loading, resetKey } = this.state;
+ const { data, loading, resetKey, formData } = this.state;
+ console.log(formData)
return (
<div className="app-page">
<HeadView history={this.props.history} />
- <TableBtnView name={''} key={resetKey} style={{marginTop:"20px"}}>
- <Select
- style={{ width: 200 }}
- placeholder="根据举报性质查询"
- onChange={(value) => this.onInputChange({ target: { name: 'nature', value } })}
- >
- <Option value="1">涉黑涉恶违法犯罪行为</Option>
- <Option value="2">涉黑涉恶违法犯罪保护伞</Option>
- <Option value="3">其他</Option>
- </Select>
- <Input placeholder="根据内容模糊查询" style={{ width: "200px" }} name='content' onChange={this.onInputChange} />
- <Select
- style={{ width: 200 }}
- placeholder="根据状态查询"
- onChange={(value) => this.onInputChange({ target: { name: 'status', value } })}
- >
- <Option value="2">已回复</Option>
- <Option value="1">待回复</Option>
- </Select>
-
- <DatePicker onChange={(_, value) => this.onInputChange({ target: { name: 'createTime', value } })} placeholder="根据创建时间查询" />
- <Button type="primary" onClick={this.Seaech}>查询</Button>
- <Button onClick={this.Reset}>重置</Button>
- </TableBtnView>
- <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+ <div style={{ background: '#fff', margin: 20 }}>
+ <CommonSearchForm
+ {...this.props}
+ formData={formData}
+ setFormData={this.setFormData}
+ searchonClick={this.searchonClick}
+ pathName={this.props.location.pathname}
+ data={[
+ { type: 'input', name: '申请人', label: '申请人', key: 'createrName' },
+ {
+ type: 'rangePicker',
+ label: '申请时间',
+ name: JSON.stringify(['开始时间', '结束时间']),
+ key: JSON.stringify(['startTime', 'endTime']),
+ keylistName: 'rangeTimelist',
+ },
+ ]} />
+ <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+ </div>
</div>
);
}
diff --git a/SunshineIns/src/page/ExamineEdit.jsx b/SunshineIns/src/page/ExamineEdit.jsx
index b4452a2..ea11120 100644
--- a/SunshineIns/src/page/ExamineEdit.jsx
+++ b/SunshineIns/src/page/ExamineEdit.jsx
@@ -1,7 +1,7 @@
import React from 'react';
-import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd';
+import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, Breadcrumb, Badge, Select, Popconfirm, Spin } from 'antd';
const { TextArea } = Input;
import HeadView from '../view/HeadView';
import BusDetailView from '../view/BusDetailView';
@@ -261,6 +261,10 @@
<div className="app-page">
<Spin spinning={loading}>
<HeadView history={this.props.history} />
+ <Breadcrumb style={{ padding: '20px' }}>
+ <Breadcrumb.Item><a href="index.html#/entry/applyFor">检察院审核</a></Breadcrumb.Item>
+ <Breadcrumb.Item>检察院审核详情</Breadcrumb.Item>
+ </Breadcrumb>
<BusDetailView type='检察院审核' >
<div style={divStyle}>
<Row type="flex" align='middle' justify="space-around">
diff --git a/SunshineIns/src/page/PoliceSecurity.jsx b/SunshineIns/src/page/PoliceSecurity.jsx
index dbb8f47..91dffde 100644
--- a/SunshineIns/src/page/PoliceSecurity.jsx
+++ b/SunshineIns/src/page/PoliceSecurity.jsx
@@ -2,6 +2,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, Tooltip } from 'antd';
import moment from 'moment';
import Fetch from '../fetch';
@@ -22,10 +23,10 @@
super(props);
this.state = {
data: [],
- formdata: {
+ formData: {
+ __key: Date.now(),
page: 1,
size: 10,
- type:3,
},
resetKey: Date.now(),
loading: false
@@ -37,10 +38,20 @@
this.getData();
}
- getData = () => {
- const { formdata } = this.state;
+ setFormData = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
+ }
+
+ searchonClick = data => {
+ console.log('form', data);
+ this.setState({
+ formData: data,
+ });
this.setState({ loading: true })
- Fetch.entryQuery({ ...formdata })
+ Fetch.entryQuery({ ...data, type: 3 })
.then(res => {
console.log(res)
for (var i = 0; i < res.rows.length; i++) {
@@ -48,14 +59,29 @@
}
this.setState({
data: res.rows,
- loading: false
+ loading: false
+ });
+ });
+ }
+
+ getData = () => {
+ this.setState({ loading: true })
+ Fetch.entryQuery({ ...this.state.formData, type: 3 })
+ .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
});
});
}
onInputChange = ({ target: { value, name } }) => {
- this.setState(({ formdata }) => ({
- formdata: {
- ...formdata,
+ this.setState(({ formData }) => ({
+ formData: {
+ ...formData,
[name]: value
}
}))
@@ -65,8 +91,8 @@
}
Seaech = () => {
- const { formdata } = this.state;
- Fetch.getSweeping(formdata)
+ const { formData } = this.state;
+ Fetch.getSweeping(formData)
.then(res => {
for (var i = 0; i < res.length; i++) {
res[i]['index'] = i + 1;
@@ -79,7 +105,7 @@
Reset = () => {
this.setState({
resetKey: Date.now(),
- formdata: {}
+ formData: {}
}, this.getData);
}
@@ -132,35 +158,29 @@
</span>
),
}];
- const { data, loading, resetKey } = this.state;
+ const { data, loading, resetKey, formData } = this.state;
return (
<div className="app-page">
<HeadView history={this.props.history} />
- <TableBtnView key={resetKey} style={{marginTop:"20px"}}>
- <Select
- style={{ width: 200 }}
- placeholder="根据举报性质查询"
- onChange={(value) => this.onInputChange({ target: { name: 'nature', value } })}
- >
- <Option value="1">涉黑涉恶违法犯罪行为</Option>
- <Option value="2">涉黑涉恶违法犯罪保护伞</Option>
- <Option value="3">其他</Option>
- </Select>
- <Input placeholder="根据内容模糊查询" style={{ width: "200px" }} name='content' onChange={this.onInputChange} />
- <Select
- style={{ width: 200 }}
- placeholder="根据状态查询"
- onChange={(value) => this.onInputChange({ target: { name: 'status', value } })}
- >
- <Option value="2">已回复</Option>
- <Option value="1">待回复</Option>
- </Select>
-
- <DatePicker onChange={(_, value) => this.onInputChange({ target: { name: 'createTime', value } })} placeholder="根据创建时间查询" />
- <Button type="primary" onClick={this.Seaech}>查询</Button>
- <Button onClick={this.Reset}>重置</Button>
- </TableBtnView>
- <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+ <div style={{ background: '#fff', margin: 20 }}>
+ <CommonSearchForm
+ {...this.props}
+ formData={formData}
+ setFormData={this.setFormData}
+ searchonClick={this.searchonClick}
+ pathName={this.props.location.pathname}
+ data={[
+ { type: 'input', name: '申请人', label: '申请人', key: 'createrName' },
+ {
+ type: 'rangePicker',
+ label: '申请时间',
+ name: JSON.stringify(['开始时间', '结束时间']),
+ key: JSON.stringify(['startTime', 'endTime']),
+ keylistName: 'rangeTimelist',
+ },
+ ]} />
+ <TableView columns={columns} data={data} pageSize='10' size='default' loading={loading} />
+ </div>
</div>
);
}
diff --git a/SunshineIns/src/page/SignIn.jsx b/SunshineIns/src/page/SignIn.jsx
index 1e22ab1..539dd09 100644
--- a/SunshineIns/src/page/SignIn.jsx
+++ b/SunshineIns/src/page/SignIn.jsx
@@ -1,31 +1,95 @@
import React from 'react';
-import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge } from 'antd';
+import { Icon, Button, DatePicker, Divider, Affix, Spin, Card, Row, Col } from 'antd';
+import Fetch from '../fetch';
+import sign from './../asset/image/sign.png';
+import moment from 'moment';
+
+
+const format = 'YYYY-MM-DD HH:mm';
+
+const list = [
+ { name: '一号' },
+ { name: '二号' },
+ { name: '三号' },
+ { name: '四号' },
+ { name: '五号' },
+ { name: '六号' },
+ { name: '七号' },
+]
export default class SignIn extends React.Component {
constructor(props) {
super(props);
this.state = {
- data: [],
-
+ personList: [],
+ activityName: '',
+ code: '',
+ loading: false,
};
}
componentDidMount() {
document.title = '签到上墙';
- // this.getData();
+ this.getData();
}
getData = () => {
-
+ // signinfo
+ const { id } = this.props.match.params;
+ this.setState({ loading: true })
+ Fetch.signinfo(id)
+ .then(res => {
+ console.log(res)
+ this.setState({
+ code: res.data.code,
+ personList: res.data.personList,
+ activityName: res.data.activityName,
+ loading: false,
+ });
+ })
}
-
+
render() {
-
- const { data, loading, resetKey } = this.state;
+
+ const { code, loading, personList, activityName } = this.state;
return (
<div className="app-page">
- 签到上墙
+ <Spin spinning={loading}>
+ <Affix style={{ position: 'absolute', top: 520, right: 20 }}>
+ <Card>
+ < img style={{ width: '150px', height: '150px' }} src={`data:image/png;base64,${code}`} alt=""></img>
+ </Card>
+ </Affix>
+ <Card style={{ margin: "8%" }}>
+ <div>
+ <Row type="flex" justify="center" align="middle" style={{ borderBottom: '1px solid #D8D8D8' }}>
+ <Col style={{ color: '#3D444D', fontSize: 26, fontWeight: 'bold', lineHeight: '75px' }}>
+ {activityName}
+ </Col>
+ </Row>
+ </div>
+
+ <div style={{ display: 'flex' }}>
+ {
+ personList.length > 0 ? personList.map((item, index) => (
+ <div style={{ display: 'flex', flexWrap: 'wrap', flexDirection: 'column', width: '168px', height: '168px', justifyContent: 'center', alignItems: 'center',color:'#fff',textAlign:'center',lineHeight:'150px' }} key={index}>
+ <img src={item.imgUrl} style={{ width: '150px', height: '150px' }} />
+ {
+ item.signStatus !== 3 ?
+ <div style={{ width: '150px', height: '150px', backgroundColor: '#000', opacity: '0.2', position: 'absolute' }}>未签到</div> : ''
+ }
+ {
+ item.signStatus == 3 ?
+ // <div style={{ width: '150px', height: '50px', color:'#000', position: 'absolute' }}>签到时间:{moment(item.updateTime).format(format)}</div> : ''
+ <div style={{ width: '150px', height: '150px', color:'#000', position: 'absolute', display:'flex',justifyContent:'flex-end' }}><Icon type="check-circle" style={{fontSize:'32px'}} theme="twoTone" twoToneColor="#52c41a" /></div> : ''
+ }
+ </div>
+ )) : <span>暂无数据</span>
+ }
+ </div>
+ </Card>
+ </Spin>
</div>
);
}
diff --git a/SunshineIns/src/page/policeSecurityEdit.jsx b/SunshineIns/src/page/policeSecurityEdit.jsx
index 480cf99..1939bc1 100644
--- a/SunshineIns/src/page/policeSecurityEdit.jsx
+++ b/SunshineIns/src/page/policeSecurityEdit.jsx
@@ -1,7 +1,7 @@
import React from 'react';
-import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd';
+import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, Breadcrumb, Badge, Select, Popconfirm, Spin } from 'antd';
const { TextArea } = Input;
import HeadView from '../view/HeadView';
import BusDetailView from '../view/BusDetailView';
@@ -261,6 +261,10 @@
<div className="app-page">
<Spin spinning={loading}>
<HeadView history={this.props.history} />
+ <Breadcrumb style={{ padding: '20px' }}>
+ <Breadcrumb.Item><a href="index.html#/entry/applyFor">检察院审核</a></Breadcrumb.Item>
+ <Breadcrumb.Item>检察院审核详情</Breadcrumb.Item>
+ </Breadcrumb>
<BusDetailView type='公安审核' >
<div style={divStyle}>
<Row type="flex" align='middle' justify="space-around">
diff --git a/SunshineIns/src/view/CommonSearchForm/index.jsx b/SunshineIns/src/view/CommonSearchForm/index.jsx
new file mode 100644
index 0000000..4dda63c
--- /dev/null
+++ b/SunshineIns/src/view/CommonSearchForm/index.jsx
@@ -0,0 +1,253 @@
+import React from 'react';
+import './style.scss';
+import {
+ Row,
+ Col,
+ Form,
+ Input,
+ Button,
+ Select,
+ DatePicker,
+
+} from 'antd';
+const { RangePicker } = DatePicker;
+import { FormComponentProps } from 'antd/lib/form';
+import { RouteComponentProps } from 'react-router-dom';
+import moment from 'moment';
+
+class CommonSearchForm extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ showModal: false,
+ };
+ }
+
+ componentDidMount() {
+ // 回车事件
+ // document.addEventListener('keydown', this.onkeydown);
+ }
+
+ componentWillUnmount() {
+ // window.removeEventListener("keydown", this.onkeydown.bind(this));
+ }
+
+ onkeydown = (e) => {
+ if (e.keyCode === 13) {
+ this.onClick('search');
+ }
+ }
+
+ onClick = type => {
+ const { pathName } = this.props;
+ let data;
+ switch (type) {
+ case 'search':
+ data = { ...this.props.formData, __key: Date.now() };
+ this.props.searchonClick(data);
+ // if (pathName) {
+ // this.props.history.push(pathName + '?' + Object.entries(data)
+ // .map(([k, v]) => `${k}=${v}`)
+ // .join('&'));
+ // }
+ return;
+ case 'reset':
+ data = { __key: Date.now(), page: 1, size: 10 };
+ this.props.searchonClick(data);
+ if (pathName) {
+ this.props.history.push(pathName + '?' + Object.entries(data)
+ .map(([k, v]) => `${k}=${v}`)
+ .join('&'));
+ }
+ return;
+ case 'build':
+ return;
+ }
+ };
+
+ handleInput = ({ target: { name, value } }) => {
+ this.props.setFormData({ ...this.props.formData, [name]: value });
+ };
+
+ handleSelectChange = name => {
+ return value => {
+ this.handleInput({ target: { name, value } });
+ };
+ };
+
+ rangePickerChange = (name, key, m, d) => {
+ if (m.length > 0) {
+ this.props.setFormData({
+ ...this.props.formData,
+ [name]: d.join(','),
+ [JSON.parse(key)[0]]: d[0],
+ [JSON.parse(key)[1]]: d[1],
+ });
+ } else {
+ this.props.setFormData({
+ ...this.props.formData,
+ [name]: undefined,
+ [JSON.parse(key)[0]]: '',
+ [JSON.parse(key)[1]]: '',
+ });
+ }
+ };
+
+ datePickerChange = (name, v) => {
+ this.props.setFormData({
+ ...this.props.formData,
+ [name]: v,
+ });
+ };
+
+
+
+ render() {
+ const { formData, data, children } = this.props;
+console.log(formData)
+console.log(data)
+ return (
+ <div className="common-search-form-main">
+ <Row type="flex" align="middle" gutter={20}>
+ {/* <Row type="flex" align="bottom"> */}
+ {/* <Col span={20}>
+ <Row gutter={20}> */}
+ {data.length > 0 &&
+ data.map(item => (
+ <React.Fragment>
+ {(() => {
+ switch (item.type) {
+ case 'select':
+ return (
+ <Col span={4}>
+ <Form.Item label={item.label}>
+ <Select
+ style={{ width: '100%' }}
+ placeholder={item.name}
+ value={formData[item.key]}
+ allowClear
+ onChange={this.handleSelectChange(item.key)}>
+ {item.list &&
+ item.list.map(item => (
+ <Select.Option
+ value={item.id}
+ key={item.id}>
+ {item.name}
+ </Select.Option>
+ ))}
+ </Select>
+ </Form.Item>
+ </Col>
+ );
+ case 'input':
+ return (
+ <Col span={4}>
+ <Form.Item label={item.label}>
+ <Input
+ placeholder={item.name}
+ name={item.key}
+ value={formData[item.key]}
+ onChange={this.handleInput}
+ />
+ </Form.Item>
+ </Col>
+ );
+ case 'datePicker':
+ return (
+ <Col span={4}>
+ <Form.Item label={item.label}>
+ <DatePicker
+ style={{ width: '100%' }}
+ placeholder={item.name}
+ onChange={(date, dateString) => {
+ this.datePickerChange(item.key, dateString);
+ }}
+ value={formData[item.key] ? moment(formData[item.key], 'YYYY-MM-DD') : undefined}
+ />
+ </Form.Item>
+ </Col>
+ );
+ case 'rangePicker':
+ return (
+ <Col span={6}>
+ <Form.Item label={item.label}>
+ <RangePicker
+ ranges={{
+ Today: [moment(), moment()],
+ 'This Month': [
+ moment().startOf('month'),
+ moment().endOf('month'),
+ ],
+ }}
+ // defaultValue={[moment(monthStartDate, 'YYYY/MM/DD'), moment(monthEndDate, 'YYYY/MM/DD')]}
+ value={
+ item.keylistName &&
+ formData[item.keylistName] &&
+ typeof formData[item.keylistName] == 'string'
+ ? formData[item.keylistName]
+ .split(',')
+ .map(item => moment(item, 'YYYY-MM-DD'))
+ : []
+ }
+ onChange={(date, dateString) => {
+ this.rangePickerChange(
+ item.keylistName,
+ item.key,
+ date,
+ dateString
+ );
+ }}
+ placeholder={JSON.parse(item.name)}
+ />
+ </Form.Item>
+ </Col>
+ );
+ case 'br':
+ return (
+ <Col span={24} style={{ marginBottom: '10px' }} />
+ );
+ default:
+ return null;
+ }
+ })()}
+ </React.Fragment>
+ ))}
+ {/* </Row> */}
+ {/* </Col> */}
+
+ <Col>
+ <Row type="flex" gutter={20} align="middle" style={{ marginBottom: 5 }}>
+ <Col>
+ <Button
+ type="primary"
+ onClick={() => {
+ this.onClick('search');
+ }}>
+ 查询
+ </Button>
+ </Col>
+ <Col>
+ <Button
+ onClick={() => {
+ this.onClick('reset');
+ }}>
+ 重置
+ </Button>
+ </Col>
+ {
+ children &&
+ <Col>
+ {children}
+ </Col>
+ }
+ </Row>
+ </Col>
+ </Row>
+ </div >
+ );
+ }
+}
+
+export default Form.create({
+ onValuesChange: (props, changed, values) => { },
+})(CommonSearchForm);
diff --git a/SunshineIns/src/view/CommonSearchForm/style.scss b/SunshineIns/src/view/CommonSearchForm/style.scss
new file mode 100644
index 0000000..d178d90
--- /dev/null
+++ b/SunshineIns/src/view/CommonSearchForm/style.scss
@@ -0,0 +1,13 @@
+.common-search-form-main {
+ padding: 15px;
+ .ant-form-item {
+ margin-bottom: 0 !important;
+ display: flex;
+ }
+ .ant-form-item-control-wrapper {
+ flex: 1;
+ }
+ // .ant-form-item-label{
+ // width: 70px !important;
+ // }
+}
--
Gitblit v1.8.0