Commit ecb688e3 authored by wangxuelai's avatar wangxuelai

'多学员添加冲突检查'

parent 2234ddbd
......@@ -132,6 +132,9 @@ export default {
inviteCodeShow: false,
inviteCode: '',
Inviteloading: false,
queryRepeatStudentsLoading: false,
studentAddParams: {},
repeatStudentList: [],
},
subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line
......@@ -424,6 +427,58 @@ export default {
// message.error(studentsinfo.msg, 1);
}
},
* sureAddRepeatStudent({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const { studentAddParams } = yield select(state => state.students);
const newStudentAddParams = { ...studentAddParams };
newStudentAddParams.force = 1;
yield put({
type: 'studentsAdd',
payload: newStudentAddParams,
});
},
* queryRepeatStudents({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const { mobile } = payload;
const { queryRepeatStudentsLoading } = yield select(state => state.students);
if (queryRepeatStudentsLoading) {
return;
}
yield put({
type: 'updateState',
payload: {
queryRepeatStudentsLoading: true,
},
});
const studentListData = yield call(studentsAjax.studentsList, {
page: 1,
perPage: 50,
keyword_any: mobile,
school_id: sid,
extra: 'time,recently_course',
});
yield put({
type: 'updateState',
payload: {
queryRepeatStudentsLoading: false,
},
});
if (studentListData.code == 200) {
yield put({
type: 'updateState',
payload: {
repeatStudentList: studentListData.data.list,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
studentListData,
},
});
}
},
* studentsAdd({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp);
const { studentSubmiting, studentAvator, schoolUserInfo } = yield select(state => state.students);
......@@ -455,6 +510,7 @@ export default {
class_ids,
operator_id,
isBuycourse,
force,
} = payload;
const classids = new Array(class_ids).join(',');
const loadmessage = message.loading('资料保存中...', 0);
......@@ -469,6 +525,7 @@ export default {
gender,
grade,
operator_id,
force,
});
yield put({
type: 'updateState',
......@@ -479,9 +536,15 @@ export default {
setTimeout(loadmessage);
if (data.code == 200) {
if (isBuycourse) {
//
const { courseList } = yield select(state => state.students);
const renewCourses = courseList;
yield put({
type: 'studentsList',
payload: {
params: {
},
},
});
yield put({
type: 'updateState',
payload: {
......@@ -490,6 +553,7 @@ export default {
courseList,
renewCourses,
addOrUpdateDiaShow: false,
repeatStudentShow: false,
// operator: schoolUserInfo,
},
});
......@@ -499,6 +563,7 @@ export default {
type: 'updateState',
payload: {
addOrUpdateDiaShow: false,
repeatStudentShow: false,
operator: {
id: '',
nickname: '',
......@@ -526,6 +591,33 @@ export default {
},
});
}
} else if (data.code == 40203) {
yield put({
type: 'queryRepeatStudents',
payload: {
mobile,
},
});
yield put({
type: 'updateState',
payload: {
repeatStudentShow: true,
studentAddParams: {
school_id: sid,
name,
birthday,
avatar: studentAvator,
remark,
mobile,
reservemobile,
gender,
grade,
operator_id,
force,
isBuycourse,
},
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
......
......@@ -16,7 +16,13 @@ class RepeatStudent extends React.Component {
componentWillUnmount() { // 卸载
}
render() {
const { visible, onCancel, onOk } = this.props;
const {
visible,
onCancel,
onOk,
loading,
dataSource,
} = this.props;
const columns = [
{
title: '姓名',
......@@ -25,8 +31,16 @@ class RepeatStudent extends React.Component {
},
{
title: '性别',
dataIndex: 'sex',
key: 'sex',
dataIndex: 'gender',
key: 'gender',
render: (text, record) => {
return (
<div>
{record.gender == 1 && '男'}
{record.gender == 2 && '女'}
</div>
);
},
},
{
title: '手机号',
......@@ -37,16 +51,30 @@ class RepeatStudent extends React.Component {
title: '课程',
dataIndex: 'course',
key: 'course',
render: (text, record) => {
return (
<div>
{(record.recently_course && record.recently_course.title) || ''}
</div>
);
},
},
{
title: '班级',
dataIndex: 'class',
key: 'class',
render: (text, record) => {
return (
<div>
{(record.recently_class && record.recently_class.title) || ''}
</div>
);
},
},
{
title: '录入时间',
dataIndex: 'time',
key: 'time',
dataIndex: 'created_at',
key: 'created_at',
},
];
const courseModuleList = [{
......@@ -63,17 +91,16 @@ class RepeatStudent extends React.Component {
visible={visible}
title="发现可能重复的学员"
zIndex={110}
cancelText="是新学员,继续录入"
okText="和所选学员是同一人"
width={800}
bodyStyle={{ paddingBottom: 0 }}
onOk={onOk}
footer={<div><Button onClick={onOk}>是新学员,继续录入</Button><Button onClick={onCancel} type="primary">和所选学员是同一人</Button></div>}
onCancel={onCancel}
>
<Table
dataSource={courseModuleList}
dataSource={dataSource}
columns={columns}
pagination={false}
loading={loading}
className={`${pageStyle.repeatStudentTable} repeatStudentTable`}
/>
</Modal>
......
......@@ -42,7 +42,6 @@ class StudentAddForm extends React.Component {
}
handleSubmit = (e, flag) => {
const { dispatch, save } = this.props;
console.log(flag);
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
......
......@@ -530,6 +530,21 @@ class StudentMgt extends React.Component {
isExpendMore: !this.state.isExpendMore,
});
}
cancelAddRepeatStudent = () => {
const { dispatch } = this.props;
dispatch({
type: 'students/updateState',
payload: {
repeatStudentShow: false,
},
});
}
sureAddRepeatStudent = () => {
const { dispatch } = this.props;
dispatch({
type: 'students/sureAddRepeatStudent',
});
}
render() {
const { getFieldDecorator } = this.props.form;
const {
......@@ -578,6 +593,8 @@ class StudentMgt extends React.Component {
inviteCode,
Inviteloading,
repeatStudentShow,
queryRepeatStudentsLoading,
repeatStudentList,
} = this.props;
const { qrCodeTitle, isExpendMore } = this.state;
const columns = [
......@@ -936,9 +953,10 @@ class StudentMgt extends React.Component {
visible={repeatStudentShow}
onCancel={this.cancelAddRepeatStudent}
onOk={this.sureAddRepeatStudent}
loading={queryRepeatStudentsLoading}
dataSource={repeatStudentList}
/>
</div>
);
}
}
......@@ -994,6 +1012,8 @@ function mapStateToProps(state) {
Inviteloading,
// 续课的逻辑代码
repeatStudentShow,
queryRepeatStudentsLoading,
repeatStudentList,
} = state.students;
const {
schoolUserInfo,
......@@ -1044,6 +1064,8 @@ function mapStateToProps(state) {
Inviteloading,
// 续课的逻辑代码
repeatStudentShow,
queryRepeatStudentsLoading,
repeatStudentList,
};
}
export default connect(mapStateToProps)(ForgotPassword);
......
......@@ -137,14 +137,14 @@ class NewRenewEdit extends React.Component {
</Col>
</Row>
<Row>
<Col span={6} className={pageStyle.infoitem}>
<div className={pageStyle.infoitem}>姓名*{studentinfo && studentinfo.name}</div>
<Col span={9}>
<div className={pageStyle.infoitem}>姓名:{studentinfo && studentinfo.name}</div>
</Col>
<Col span={12} className={pageStyle.infoitem}>
<div className={pageStyle.infoitem}>手机*{studentinfo && studentinfo.mobile}</div>
<Col span={9}>
<div className={pageStyle.infoitem}>手机:{studentinfo && studentinfo.mobile}</div>
</Col>
<Col span={6} className={pageStyle.infoitem}>
<div className={pageStyle.infoitem}>性别*{studentinfo && studentinfo.gender == 1 ? '男' : ''}{studentinfo && studentinfo.gender == 2 ? '女' : ''}</div>
<Col span={6}>
<div className={pageStyle.infoitem}>性别:{studentinfo && studentinfo.gender == 1 ? '男' : ''}{studentinfo && studentinfo.gender == 2 ? '女' : ''}</div>
</Col>
</Row>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment