From a0ec2242677dced1e6e098c114460da3d56be157 Mon Sep 17 00:00:00 2001
From: liuwh <hugeinfo123>
Date: Tue, 31 Mar 2020 05:48:24 +0800
Subject: [PATCH] 提交
---
SunshineIns/src/page/QuestionDetail.jsx | 49 +++++++
SunshineIns/src/fetch/questionFindPersonById.js | 9 +
SunshineIns/src/fetch/index.js | 4
SunshineIns/src/fetch/_fetch.js | 4
SunshineIns/src/view/QuestionnairEditor/index.js | 135 +++++++++++----------
SunshineIns/src/view/QuestionnairAnswer/index.js | 1
SunshineIns/src/index.jsx | 11 +
SunshineIns/src/page/QuestionPersonDetail.jsx | 146 ++++++++++++++++++++++++
8 files changed, 283 insertions(+), 76 deletions(-)
diff --git a/SunshineIns/src/fetch/_fetch.js b/SunshineIns/src/fetch/_fetch.js
index 059c54a..0bf32a9 100644
--- a/SunshineIns/src/fetch/_fetch.js
+++ b/SunshineIns/src/fetch/_fetch.js
@@ -2,8 +2,8 @@
// export const base = 'http://xnwj.gznsjc.gov.cn';
// export const base = 'http://1p885086k1.iok.la';
-export const base = 'http://nsjcy.hugeinfo.com.cn';
-// export const base = 'http://1p885086k1.iok.la';
+// export const base = 'http://nsjcy.hugeinfo.com.cn';
+export const base = 'http://1p885086k1.iok.la';
// export const base = 'http://localhost:8080';
diff --git a/SunshineIns/src/fetch/index.js b/SunshineIns/src/fetch/index.js
index f69802e..6d84652 100644
--- a/SunshineIns/src/fetch/index.js
+++ b/SunshineIns/src/fetch/index.js
@@ -99,6 +99,7 @@
import searchLawFind from './searchLawFind';
import searchLawSave from './searchLawSave';
import searchLawDelete from './searchLawDelete';
+import questionFindPersonById from './questionFindPersonById';
export default {
domain,
@@ -201,5 +202,6 @@
searchLaw,
searchLawFind,
searchLawSave,
- searchLawDelete
+ searchLawDelete,
+ questionFindPersonById
};
\ No newline at end of file
diff --git a/SunshineIns/src/fetch/questionFindPersonById.js b/SunshineIns/src/fetch/questionFindPersonById.js
new file mode 100644
index 0000000..fff74df
--- /dev/null
+++ b/SunshineIns/src/fetch/questionFindPersonById.js
@@ -0,0 +1,9 @@
+import fetch from './_fetch';
+import { message } from 'antd';
+export default (id, userId) => fetch(`api/question/find/${id}?${userId || null}`)
+ .then(
+ json => json.data
+ )
+ .catch(
+ error => message.error('详情加载失败,请联系管理员', 2)
+ );
diff --git a/SunshineIns/src/index.jsx b/SunshineIns/src/index.jsx
index e18b46a..b7a2ee3 100644
--- a/SunshineIns/src/index.jsx
+++ b/SunshineIns/src/index.jsx
@@ -48,6 +48,7 @@
import Newly from './page/Newly';
import SignIn from './page/SignIn';
import QuestionDetail from './page/QuestionDetail';
+import QuestionPersonDetail from './page/QuestionPersonDetail';
import NoInspectionReportList from './page/NoInspectionReportList';
import NoInspectionReportDetail from './page/NoInspectionReportDetail';
@@ -69,8 +70,8 @@
{/* <Route path='/questionnaire/newly' component={AttTree} /> */}
{/* 问卷详情 */}
<Route path='/activeManageEditquestionnaire/:id' component={null} />
- {/* 签到墙 */}
- <Route path='/signIn/:id' component={null} />
+ {/* 签到墙 */}
+ <Route path='/signIn/:id' component={null} />
<Route component={Menu} />
</Switch>
<Switch>
@@ -119,8 +120,10 @@
<Route path='/questionnaire/newly/:id' component={Newly} />
{/* 问卷详情 */}
<Route path='/questionnaire/detail/:id' component={QuestionDetail} />
+ {/* 小程序提交的任务详情 */}
+ <Route path='/questionnaire/persondetail/:id/:userId' component={QuestionPersonDetail} />
-
+
{/* 公安审核 */}
<Route path='/entry/policeSecurity' component={PoliceSecurity} />
<Route path='/entry/policeSecurityEdit/:id' component={policeSecurityEdit} />
@@ -133,7 +136,7 @@
<Route path='/noInspectionReportDetail/:id/:flag' component={NoInspectionReportDetail} />
-
+
<Route path='/' component={Index} />
</Switch>
</Layout>
diff --git a/SunshineIns/src/page/QuestionDetail.jsx b/SunshineIns/src/page/QuestionDetail.jsx
index 709e7e8..90c9703 100644
--- a/SunshineIns/src/page/QuestionDetail.jsx
+++ b/SunshineIns/src/page/QuestionDetail.jsx
@@ -2,8 +2,13 @@
import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge, Spin, Breadcrumb } from 'antd';
import Questionnair from '../page/Questionnair'
import Fetch from '../fetch'
+import TableView from '../view/TableView';
import HeadView from '../view/HeadView';
+import moment from 'moment';
+const divStyle = {
+ margin: '20px'
+}
export default class QuestionDetail extends React.Component {
constructor(props) {
super(props);
@@ -11,8 +16,8 @@
loading: false,
data: [],
initData: null,
- btnLoading: false
-
+ btnLoading: false,
+ dateSource: []
};
}
@@ -26,11 +31,20 @@
});
Fetch.questionFindById(id).then(res => {
console.log('res', res);
+ console.log('res.mps', res.submitMaps);
this.setState({
loading: false,
- initData: res
+ initData: res,
+ dateSource: res.submitMaps || [],
})
})
+ }
+
+
+ showModal = (userId) => {
+ const { id } = this.props.match.params;
+ console.log(id)
+ this.props.history.push("/questionnaire/persondetail/" + id + '/' + userId);
}
submitQuestionTemp = (questionDtos, extraData) => {
@@ -69,7 +83,26 @@
render() {
- const { data, loading, resetKey, initData, btnLoading } = this.state;
+ const { data, loading, resetKey, initData, btnLoading, dateSource } = this.state;
+ console.log(dateSource)
+ const act2columns = [{
+ title: '提交人昵称',
+ dataIndex: 'userName',
+ key: 'userName'
+ },
+ {
+ title: '提交时间',
+ dataIndex: 'createTime',
+ key: 'createTime',
+ render: text => <span>{text || ''}</span>
+ }, {
+ title: '操作',
+ dataIndex: 'isHit',
+ key: 'isHit',
+ render: (text, record) => (
+ <label className='theme-color' onClick={() => this.showModal(record.userId)} style={{ cursor: 'pointer' }}>查看</label>
+ )
+ }];
return (
<div className="app-page">
<HeadView history={this.props.history} />
@@ -115,6 +148,14 @@
{initData && initData.questionDtos.map((item, index) => (
<Questionnair.Editor editor={item} acitveAnswer={true} key={item.questionId} index={index} />
))}
+
+ {
+ dateSource.length > 0 ?
+ <div style={divStyle}>
+ <Divider orientation="left" style={{ margin: '20px', width: '97%' }}>问卷提交记录</Divider>
+ <TableView columns={act2columns} data={dateSource} pageSize='6' size='small' />
+ </div> : null
+ }
</React.Fragment>
}
diff --git a/SunshineIns/src/page/QuestionPersonDetail.jsx b/SunshineIns/src/page/QuestionPersonDetail.jsx
new file mode 100644
index 0000000..d4c4475
--- /dev/null
+++ b/SunshineIns/src/page/QuestionPersonDetail.jsx
@@ -0,0 +1,146 @@
+import React from 'react';
+import { Input, Button, DatePicker, Divider, message, Popconfirm, Select, Badge, Spin, Breadcrumb } from 'antd';
+import Questionnair from './Questionnair'
+import Fetch from '../fetch'
+import TableView from '../view/TableView';
+import HeadView from '../view/HeadView';
+
+export default class QuestionPersonDetail extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ loading: false,
+ data: [],
+ initData: null,
+ btnLoading: false,
+ dateSource: []
+ };
+ }
+
+ componentDidMount() {
+
+ document.title = '问卷详情';
+ const { id } = this.props.match.params;
+ const { userId } = this.props.match.params;
+ console.log(id)
+ console.log(userId)
+ this.setState({
+ loading: true
+ });
+ Fetch.questionFindPersonById(id, userId).then(res => {
+ console.log('res', res);
+ this.setState({
+ loading: false,
+ initData: res
+ })
+ })
+ }
+
+
+ showModal = (id) => {
+ this.props.history.push("/activeManageEdit/" + id);
+ }
+
+ submitQuestionTemp = (questionDtos, extraData) => {
+ const { initData } = this.state;
+ console.log('questionDtos', questionDtos);
+ console.log('initData', initData);
+ if (!extraData.questionnairTitle) {
+ return message.error('请填写问卷标题');
+ }
+ questionDtos = questionDtos.map(({ type, title, required, remarkText, options, scores, warnFlag }) => ({
+ type, title, required, remarkText, options, scores, warnFlag
+ }));
+ this.setState({
+ btnLoading: true
+ })
+ Fetch.saveQuestionTemp({
+ ...initData,
+ title: extraData.questionnairTitle,
+ content: extraData.questionnairDescription,
+ businessType: extraData.questionnairBusinessType,
+ questionDtos
+ }).then(res => {
+ console.log('res', res);
+ this.setState({
+ btnLoading: false
+ })
+ if (res.code == 0) {
+ message.success('问卷提交成功');
+ }
+ })
+ }
+
+ getData = () => {
+
+ }
+
+ render() {
+
+ const { data, loading, resetKey, initData, btnLoading, dateSource } = this.state;
+ return (
+ <div className="app-page">
+ <HeadView history={this.props.history} />
+ <div style={{
+ margin: 10
+ }}>
+ <Breadcrumb>
+ <Breadcrumb.Item>
+ <a onClick={() => {
+ this.props.history.goBack();
+ }}>问卷管理</a>
+ </Breadcrumb.Item>
+
+ <Breadcrumb.Item>
+ 问卷详情
+ </Breadcrumb.Item>
+ </Breadcrumb>
+ </div>
+ {
+ loading ?
+ <div style={{ height: 200, width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
+ <Spin spinning={loading} />
+ </div> :
+ <React.Fragment>
+ {/* <Questionnair submitQuestionTemp={this.submitQuestionTemp} btnLoading={btnLoading} /> */}
+ {
+ initData &&
+ <div style={{ background: '#fff', marginTop: 10 }}>
+ <div style={{ width: 700, margin: '0 auto', padding: '20px 0 0 0 ' }}>
+ <h3>
+ 问卷标题:{initData.title || '暂无'}
+ </h3>
+ <h4 style={{ marginBottom: 0 }}>
+ 问卷描述:{initData.content || '暂无'}
+ </h4>
+ <h4 style={{ marginBottom: 0 }}>
+ 业务类型:{typeStatus(initData.businessType) || '暂无'}
+ </h4>
+ </div>
+ </div>
+ }
+
+ {initData && initData.questionDtos.map((item, index) => (
+ <Questionnair.Editor editor={item} acitveAnswer={true} data={initData} key={item.questionId} index={index} />
+ ))}
+ </React.Fragment>
+ }
+
+ </div>
+ );
+ }
+
+}
+
+function typeStatus(type) {
+ switch (type) {
+ case 1:
+ return "企业体检";
+ case 2:
+ return "培训活动";
+ case 3:
+ return "未检调查";
+ case 4:
+ return "刑执监督";
+ }
+}
diff --git a/SunshineIns/src/view/QuestionnairAnswer/index.js b/SunshineIns/src/view/QuestionnairAnswer/index.js
index 1e75f8a..8454b92 100644
--- a/SunshineIns/src/view/QuestionnairAnswer/index.js
+++ b/SunshineIns/src/view/QuestionnairAnswer/index.js
@@ -3,6 +3,7 @@
const QuestionnairAnswer = ({
answer
}) => {
+ console.log(answer)
return (
<div style={{ minHeight: 60 }}>
<div style={{ color: '#666' }}>{`${index + 1}.${answer.type === 'input' ? answer.completionForwards : answer.title + ':'}`}</div>
diff --git a/SunshineIns/src/view/QuestionnairEditor/index.js b/SunshineIns/src/view/QuestionnairEditor/index.js
index 734af73..b535f71 100644
--- a/SunshineIns/src/view/QuestionnairEditor/index.js
+++ b/SunshineIns/src/view/QuestionnairEditor/index.js
@@ -19,7 +19,12 @@
this.temp = '';
this.otherOptionInput = '';
- this.answer = {};
+ this.answer = {
+ radio: {
+ optionIndex: "0",
+ optionValue: "大于10小于50"
+ }
+ };
}
// static defaultProps = {
@@ -416,9 +421,9 @@
answer,
warnFlag
} = editor;
- this.answer = answer ? JSON.parse(JSON.stringify(answer)) : {};
- this.otherOptionValue = answer ? this.answer[type].otherOptionValue : [];
-
+ console.log(this.answer)
+ // this.answer = answer ? JSON.parse(JSON.stringify(answer)) : {};
+ // this.otherOptionValue = answer ? this.answer[type].otherOptionValue : [];
/*
*
* 以下元素为编辑状态下的元素
@@ -681,8 +686,8 @@
<span>{otherOptionBackwards}</span>
</div>
) : (
- data
- )}
+ data
+ )}
</span>
</label>
);
@@ -733,8 +738,8 @@
<span>{otherOptionBackwards}</span>
</div>
) : (
- data
- )}
+ data
+ )}
</span>
</label>
);
@@ -760,8 +765,8 @@
type === 'dropdown'
? subDropdownEl
: type === 'radio'
- ? subRadioEl
- : subCheckboxEl;
+ ? subRadioEl
+ : subCheckboxEl;
//填写状态下的单行文本、多行文本
const subTextEl = (
<input
@@ -919,69 +924,69 @@
</div>
</ShakeTransition>
) : (
- <div
- className="questionnair-subject"
- style={{
- background: drag ? '' : hover ? '#F5F5F5' : '#fff',
- borderTopColor: drag && index === 0 ? '#dbdbdb' : '',
- borderBottomColor: drag ? '#dbdbdb' : '',
- cursor: acitveAnswer ? '' : 'move',
- display: 'flex',
- justifyContent: 'center'
- }}
- onMouseEnter={this.mouseEnter}
- onMouseLeave={this.mouseLeave}
- >
<div
- className="questionnair-subject-inner"
- style={{ margin: acitveAnswer ? '' : '0 auto' }}
+ className="questionnair-subject"
+ style={{
+ background: drag ? '' : hover ? '#F5F5F5' : '#fff',
+ borderTopColor: drag && index === 0 ? '#dbdbdb' : '',
+ borderBottomColor: drag ? '#dbdbdb' : '',
+ cursor: acitveAnswer ? '' : 'move',
+ display: 'flex',
+ justifyContent: 'center'
+ }}
+ onMouseEnter={this.mouseEnter}
+ onMouseLeave={this.mouseLeave}
>
- <div className="subject-row">
- <span>{index + 1}.</span>
- {'input' === type ? subCompletionEl : <span>{title}</span>}
- {required == 'true' && (
- <span className="subject-title-require">*</span>
- )}
-
- {type == 'checkbox' && <span>(多选题)</span>}
- {type == 'radio' && <span>(单选题)</span>}
- </div>
- {remark && (
- <div className="subject-row subject-remarks">{remarkText}</div>
- )}
- <div className="subject-row">
- {['radio', 'dropdown', 'checkbox'].includes(type) && optionsEl}
- {type === 'text' && subTextEl}
- {type === 'textarea' && subTextareaEl}
- </div>
- </div>
- {!acitveAnswer && (
<div
- className="subject-control-mask"
- style={{
- background:
- curMoveItem === index ? 'rgba(245,245,245,0.3)' : ''
- }}
- ></div>
- )}
- <div
- className="subject-control-bar"
- style={{ transform: drag ? '' : hover ? 'translateX(0)' : '' }}
- >
- <div className="control-bar-inner">
- <div className="control-bar-button" onClick={this.edit}>
- <i className="iconfont icon-grey_bianji"></i>
+ className="questionnair-subject-inner"
+ style={{ margin: acitveAnswer ? '' : '0 auto' }}
+ >
+ <div className="subject-row">
+ <span>{index + 1}.</span>
+ {'input' === type ? subCompletionEl : <span>{title}</span>}
+ {required == 'true' && (
+ <span className="subject-title-require">*</span>
+ )}
+
+ {type == 'checkbox' && <span>(多选题)</span>}
+ {type == 'radio' && <span>(单选题)</span>}
</div>
- <div className="control-bar-button" onClick={this.copy}>
- <i className="iconfont icon-grey_fuzhi"></i>
+ {remark && (
+ <div className="subject-row subject-remarks">{remarkText}</div>
+ )}
+ <div className="subject-row">
+ {['radio', 'dropdown', 'checkbox'].includes(type) && optionsEl}
+ {type === 'text' && subTextEl}
+ {type === 'textarea' && subTextareaEl}
</div>
- <div className="control-bar-button" onClick={this.remove}>
- <i className="iconfont icon-grey_shanchu"></i>
+ </div>
+ {!acitveAnswer && (
+ <div
+ className="subject-control-mask"
+ style={{
+ background:
+ curMoveItem === index ? 'rgba(245,245,245,0.3)' : ''
+ }}
+ ></div>
+ )}
+ <div
+ className="subject-control-bar"
+ style={{ transform: drag ? '' : hover ? 'translateX(0)' : '' }}
+ >
+ <div className="control-bar-inner">
+ <div className="control-bar-button" onClick={this.edit}>
+ <i className="iconfont icon-grey_bianji"></i>
+ </div>
+ <div className="control-bar-button" onClick={this.copy}>
+ <i className="iconfont icon-grey_fuzhi"></i>
+ </div>
+ <div className="control-bar-button" onClick={this.remove}>
+ <i className="iconfont icon-grey_shanchu"></i>
+ </div>
</div>
</div>
</div>
- </div>
- )}
+ )}
</div>
);
}
--
Gitblit v1.8.0