Commit b7d73d48 authored by baixian's avatar baixian

优化

parent f95af854
...@@ -208,4 +208,7 @@ export default { ...@@ -208,4 +208,7 @@ export default {
}, },
deployschool: `${dakaapi}member/one_key_deploy`, deployschool: `${dakaapi}member/one_key_deploy`,
selectdeployschool: `${dakaapi}member/one_key_deploy_status`, selectdeployschool: `${dakaapi}member/one_key_deploy_status`,
leaves: {
leaveList: `${dakaapi}member/erp/student/leaves`,
},
}; };
This diff is collapsed.
...@@ -22,3 +22,45 @@ ...@@ -22,3 +22,45 @@
margin-top: 15px; margin-top: 15px;
} }
} }
.inform {
width: 303px;
height: 32px;
border-radius: 16px;
background:rgba(255,53,53,0.1);
border:1px solid rgba(255,53,53,1);
font-size:14px;
font-family:PingFang SC;
font-weight:400;
color:rgba(0,0,0,1);
margin-left: 10px;
display: flex;
align-items: center;
cursor: pointer;
&>img {
width: 26px;
height: 26px;
margin: 0 9px 0 3px;
}
&>span {
color: #FF3535;
display: inline-block;
min-width: 25px;
text-align: center;
}
}
.tableScroll {
:global {
.ant-table-body {
overflow-y: scroll;
max-height: 550px;
}
}
}
.detailtitle {
&>img {
width: 16px;
height: 16px;
margin-right: 5px;
vertical-align: -12%;
}
}
import React from 'react'; import React from 'react';
import { Modal, Icon, Form, Descriptions, Button, Table } from 'antd'; import { Modal, Empty, Form, Descriptions, Button, Table, Select, InputNumber } from 'antd';
import moment from 'moment';
import { imagify } from '../utils/index'; import { imagify } from '../utils/index';
import pageStyle from './LeaveDetailModal.less'; import pageStyle from './LeaveDetailModal.less';
const FormItem = Form.Item;
class LeaveDetailModal extends React.Component { class LeaveDetailModal extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
status: '',
}; };
} }
componentDidMount() { // 挂载 componentDidMount() { // 挂载
...@@ -13,64 +16,164 @@ class LeaveDetailModal extends React.Component { ...@@ -13,64 +16,164 @@ class LeaveDetailModal extends React.Component {
} }
componentWillUnmount() { // 卸载 componentWillUnmount() { // 卸载
}
close = () => {
const { close } = this.props;
close();
}
checkData = (value) => {
let str = value.replace(/[^\d\.]/g, '');
const pointIndex = str.search(/\./);
if (pointIndex !== -1) {
str = str.substr(0, pointIndex + 1).replace(/\./, '.5');
}
return str;
}
expendChange = (e) => {
this.props.form.validateFields((err, values) => {
if (!err) {
let value = 0;
value = this.checkData(e.target.value);
this.props.form.setFieldsValue({
expend: value,
});
}
});
}
handleSubmit = (e) => {
e.preventDefault();
const { status } = this.state;
const {
detail, save, form, close,
} = this.props;
form.validateFields((err, values) => {
if (!err) {
const {
expend,
} = values;
save({
expend,
status,
id: detail.id,
callBack: () => {
form.resetFields();
close();
},
});
}
});
}
handleStatus = (status) => {
this.setState({
status,
});
} }
render() { render() {
const { const {
visible, visible,
detail,
form: { getFieldDecorator, getFieldValue },
leaveSubmitLoading,
} = this.props; } = this.props;
return ( return (
<Modal <Modal
visible={visible} visible={visible}
title="请假详情" title="请假详情"
cancelText="关闭" cancelText="关闭"
zIndex={110} zIndex={120}
onCancel={this.cancelLeaveModal} onCancel={this.close}
maskClosable={false} maskClosable={false}
width={700} width={700}
footer={null} footer={null}
bodyStyle={{ padding: '20px 0' }} bodyStyle={{ padding: '20px 0' }}
> >
<div className={pageStyle.modalBox}> {
<div className={pageStyle.modalHead}> detail ?
<div className={pageStyle.left}> <div className={pageStyle.modalBox}>
<img className={pageStyle.avatar} src="" alt="" /> <div className={pageStyle.modalHead}>
<div className={pageStyle.leftInfo}> <div className={pageStyle.left}>
<div className={pageStyle.infoline} style={{ marginBottom: 10 }}><img src={`${__IMGCDN__}teacher/people_icon.png`} alt="" />余瑞剑</div> <img className={pageStyle.avatar} src={imagify(detail.student.avatar)} alt="" />
<div className={pageStyle.infoline}><img src={`${__IMGCDN__}teacher/phone_icon.png`} alt="" />18735113246</div> <div className={pageStyle.leftInfo}>
<div className={pageStyle.infoline} style={{ marginBottom: 10 }}><img src={`${__IMGCDN__}teacher/people_icon.png`} alt="" />{detail.student.name}</div>
<div className={pageStyle.infoline}><img src={`${__IMGCDN__}teacher/phone_icon.png`} alt="" />{detail.student.mobile}</div>
</div>
</div>
<div className={pageStyle.right}>
<div className={pageStyle.rightNum}>{detail.student.leave_count}</div>
<div className={pageStyle.rightTip}>历史请假(次)</div>
</div>
</div> </div>
</div> <div className={pageStyle.modalBody}>
<div className={pageStyle.right}> <Descriptions>
<div className={pageStyle.rightNum}>8</div> <Descriptions.Item label="请假课次" className={pageStyle.size}>{detail.course.title}{moment(detail.schedule.start_time).format('YYYY-MM-DD HH:mm')}~{moment(detail.schedule.end_time).format('HH:mm')}</Descriptions.Item>
<div className={pageStyle.rightTip}>历史请假(次)</div> </Descriptions>
</div> <Descriptions>
</div> <Descriptions.Item label="请假原因" className={pageStyle.size}>{detail.content}</Descriptions.Item>
<div className={pageStyle.modalBody}> </Descriptions>
<Descriptions> </div>
<Descriptions.Item label="请假课次" className={pageStyle.size}>小星星英语培训(2019.12.05 14:48~15.20</Descriptions.Item> <div className={pageStyle.modalFooter}>
</Descriptions> {detail.status === 1 &&
<Descriptions> <div className={pageStyle.formBox}>
<Descriptions.Item label="请假原因" className={pageStyle.size}>家里有事情</Descriptions.Item> <Form layout="inline" labelAlign="right" onSubmit={this.handleSubmit}>
</Descriptions> <FormItem label="额外扣除课时">
</div> {getFieldDecorator('expend',
<div className={pageStyle.modalFooter}> {
<Descriptions> rules: [{ required: true, message: '请输入额外扣除课时' }],
<Descriptions.Item label="申请时间" className={pageStyle.size1}>2019.12.05 1450</Descriptions.Item> },
</Descriptions> )(
<Descriptions> <InputNumber
<Descriptions.Item label="撤销时间" className={pageStyle.size1}>2019.12.05 1450</Descriptions.Item> min={0}
</Descriptions> onBlur={e => this.expendChange(e)}
</div> style={{ width: 200 }}
<div className={pageStyle.triangle}> placeholder="请输入额外扣除课时"
<div className={pageStyle.text}>已通过</div> />,
</div> )}
</div> </FormItem>
<div className={pageStyle.btnList}>
<Button htmlType="submit" loading={leaveSubmitLoading} onClick={() => this.handleStatus(4)}>驳回申请</Button>
<Button htmlType="submit" loading={leaveSubmitLoading} onClick={() => this.handleStatus(3)} type="primary" style={{ marginLeft: 20 }}>通过申请</Button>
</div>
</Form>
</div>
}
{(detail.status === 3 || detail.status === 4) &&
<Descriptions>
<Descriptions.Item label="额外扣除课时" className={pageStyle.size1}>{detail.expend}</Descriptions.Item>
</Descriptions>
}
<Descriptions>
<Descriptions.Item label="申请时间" className={pageStyle.size1}>{detail.created_at}</Descriptions.Item>
</Descriptions>
{detail.status === 2 &&
<Descriptions>
<Descriptions.Item label="撤销时间" className={pageStyle.size1}>{detail.handled_at}</Descriptions.Item>
</Descriptions>
}
{(detail.status === 3 || detail.status === 4) &&
<Descriptions>
<Descriptions.Item label="审批人" className={pageStyle.size1}>{detail.operator && detail.operator.nickname}</Descriptions.Item>
</Descriptions>
}
</div>
{ detail.status === 2 &&
<div className={pageStyle.triangle}>
<div className={pageStyle.text}>已撤销</div>
</div>}
{detail.status === 3 &&
<div className={pageStyle.triangle1}>
<div className={pageStyle.text}>已通过</div>
</div>
}
{detail.status === 4 &&
<div className={pageStyle.triangle2}>
<div className={pageStyle.text}>已驳回</div>
</div>
}
</div> : <Empty />
}
</Modal> </Modal>
); );
} }
} }
LeaveDetailModal.propTypes = {
};
const LeaveDetail = Form.create()(LeaveDetailModal); const LeaveDetail = Form.create()(LeaveDetailModal);
export default LeaveDetail; export default LeaveDetail;
...@@ -4,6 +4,39 @@ ...@@ -4,6 +4,39 @@
position: relative; position: relative;
right: 0; right: 0;
bottom: 0; bottom: 0;
.text {
z-index: 11;
font-size: 20px;
font-family: PingFang SC;
font-weight: bold;
color: rgba(255, 255, 255, 1);
position: absolute;
right: 0;
bottom: 0;
transform: rotate(-50deg);
letter-spacing: 2px;
}
&:after {
content: '';
width: 0;
height: 0;
overflow: hidden;
font-size: 0;
line-height: 0;
border-color: transparent #FFAD1F transparent transparent;
border-style: solid solid dashed dashed;
border-width: 100px 100px 0 0;
bottom: -20px;
right: 0;
position: absolute;
}
}
.triangle1 {
position: relative;
right: 0;
bottom: 0;
.text { .text {
z-index: 11; z-index: 11;
font-size:20px; font-size:20px;
...@@ -27,7 +60,38 @@ ...@@ -27,7 +60,38 @@
border-style:solid solid dashed dashed; border-style:solid solid dashed dashed;
border-width:100px 100px 0 0 ; border-width:100px 100px 0 0 ;
bottom: -20px; bottom: -20px;
right: 0px; right: 0;
position: absolute;
}
}
.triangle2 {
position: relative;
right: 0;
bottom: 0;
.text {
z-index: 11;
font-size:20px;
font-family:PingFang SC;
font-weight:bold;
color:#929292;
position: absolute;
right: 0;
bottom: 0;
transform: rotate(-50deg);
letter-spacing: 2px;
}
&:after {
content: '';
width: 0;
height: 0;
overflow: hidden;
font-size: 0;
line-height: 0;
border-color:transparent #EBEBEB transparent transparent;
border-style:solid solid dashed dashed;
border-width:100px 100px 0 0 ;
bottom: -20px;
right: 0;
position: absolute; position: absolute;
} }
} }
...@@ -92,6 +156,20 @@ ...@@ -92,6 +156,20 @@
} }
.modalFooter { .modalFooter {
padding: 25px 25px 0; padding: 25px 25px 0;
height: 203px;
.expendInput {
&>span {
display: inline-block;
margin-right: 15px;
font-size: 14px;
color: #575757;
}
}
.btnList {
position: absolute;
right: 20px;
bottom: 0;
}
.size1 { .size1 {
font-size:14px; font-size:14px;
font-family:PingFang SC; font-family:PingFang SC;
...@@ -104,3 +182,6 @@ ...@@ -104,3 +182,6 @@
} }
} }
} }
.formBox {
margin-bottom: 10px;
}
import { routerRedux } from 'dva/router'; import { routerRedux } from 'dva/router';
import { message, Modal } from 'antd'; import { message, Modal } from 'antd';
import { delay } from 'redux-saga';
import { import {
LocalStorage, LocalStorage,
SessionStorage, SessionStorage,
...@@ -9,6 +10,7 @@ import { ...@@ -9,6 +10,7 @@ import {
import errorcode from '../common/errorcode'; import errorcode from '../common/errorcode';
import * as classMgtAjax from '../services/classmgt'; import * as classMgtAjax from '../services/classmgt';
import * as schedulemgtAjax from '../services/schedulemgt'; import * as schedulemgtAjax from '../services/schedulemgt';
import * as leaveAjax from '../services/leaves';
export default { export default {
namespace: 'callstudents', namespace: 'callstudents',
...@@ -70,6 +72,14 @@ export default { ...@@ -70,6 +72,14 @@ export default {
canAddStudent: true, canAddStudent: true,
classDetail: {}, classDetail: {},
searchCallStudentValue: '', searchCallStudentValue: '',
leaveParams: {
status: 1,
page: 1,
perPage: 10,
},
leaveList: [],
leaveTotal: 0,
leaveSubmitLoading: false,
}, },
subscriptions: { subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line setup({ dispatch, history }) { // eslint-disable-line
...@@ -181,6 +191,7 @@ export default { ...@@ -181,6 +191,7 @@ export default {
const { const {
queryCallStudentListParams, callStudentTotal, callStudentListLoading, expend, classId, courseId, queryCallStudentListParams, callStudentTotal, callStudentListLoading, expend, classId, courseId,
} = yield select(state => state.callstudents); } = yield select(state => state.callstudents);
const { sid } = yield select(state => state.webapp);
const { callStudentSchedule, callType } = payload; const { callStudentSchedule, callType } = payload;
if (callStudentListLoading) { if (callStudentListLoading) {
return; return;
...@@ -193,7 +204,6 @@ export default { ...@@ -193,7 +204,6 @@ export default {
callType, callType,
}, },
}); });
const { sid } = yield select(state => state.webapp);
let newcallStudentTotal = callStudentTotal; let newcallStudentTotal = callStudentTotal;
let newqueryScheduleStudentListParams = {}; let newqueryScheduleStudentListParams = {};
if (callType == 1 || callType == 3) { // 正常点名 if (callType == 1 || callType == 3) { // 正常点名
...@@ -238,6 +248,7 @@ export default { ...@@ -238,6 +248,7 @@ export default {
ELE.mobile = ele.mobile; ELE.mobile = ele.mobile;
ELE.surplus = (callCourse && callCourse.course_mode == 1 && callCourse.surplus_buy !== undefined && callCourse.surplus_buy) || '-'; ELE.surplus = (callCourse && callCourse.course_mode == 1 && callCourse.surplus_buy !== undefined && callCourse.surplus_buy) || '-';
ELE.mobile = ele.mobile; ELE.mobile = ele.mobile;
ELE.leave = ele.leave;
callStudentOperateList.push(ELE); callStudentOperateList.push(ELE);
}); });
yield put({ yield put({
...@@ -488,7 +499,11 @@ export default { ...@@ -488,7 +499,11 @@ export default {
callStudentOperateList.forEach((ele) => { callStudentOperateList.forEach((ele) => {
const ELE = ele; const ELE = ele;
ELE.expend = expend; ELE.expend = expend;
ELE.type = 1; if (ELE.leave != null && Number(ELE.leave.status) === 3) {
ELE.type = 3;
} else {
ELE.type = 1;
}
}); });
yield put({ yield put({
type: 'updateState', type: 'updateState',
...@@ -627,6 +642,111 @@ export default { ...@@ -627,6 +642,111 @@ export default {
data: studentCallsDate, data: studentCallsDate,
}, },
}); });
yield delay(300);
yield put({
type: 'updateState',
payload: {
leaveListVisible: true,
},
});
}
},
* queryLeaveList({ payload }, { call, put, select }) {
const { params } = payload;
const { sid } = yield select(state => state.webapp);
const { leaveParams, leaveTotal } = yield select(state => state.callstudents);
const newParams = Object.assign(leaveParams, params, {
school_id: sid,
});
const data = yield call(leaveAjax.getLeaveList, newParams);
let newTotal = leaveTotal;
if (data.code === 200) {
if (data.data.total != undefined) {
newTotal = data.data.total;
}
yield put({
type: 'updateState',
payload: {
leaveList: data.data.list,
leaveTotal: newTotal,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* queryLeaveDetail({ payload }, { call, put, select }) {
const { id } = payload;
const data = yield call(leaveAjax.getDetail, {
id,
});
if (data.code === 200) {
yield put({
type: 'updateState',
payload: {
leaveDetail: data.data,
},
});
}
},
* saveLeave({ payload }, { call, put, select }) {
const {
expend, status, id, callBack,
} = payload;
const { leaveSubmitLoading, callStudentSchedule } = yield select(state => state.callstudents);
if (leaveSubmitLoading) {
return;
}
yield put({
type: 'updateState',
payload: {
leaveSubmitLoading: true,
},
});
const loadmessage = message.loading('数据保存中...', 0);
const data = yield call(leaveAjax.saveLeave, {
expend,
status,
id,
});
yield put({
type: 'updateState',
payload: {
leaveSubmitLoading: false,
},
});
setTimeout(loadmessage);
if (data.code === 200) {
message.success('操作成功', 1);
if (callBack && (typeof callBack == 'function')) {
callBack();
}
yield put({
type: 'queryLeaveList',
payload: {
params: {
},
},
});
yield put({
type: 'queryCallStudentList',
payload: {
callStudentSchedule,
callType: 3,
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
} }
}, },
* pageInit({ payload }, { call, put, select }) { * pageInit({ payload }, { call, put, select }) {
...@@ -690,6 +810,14 @@ export default { ...@@ -690,6 +810,14 @@ export default {
canAddStudent: true, canAddStudent: true,
classDetail: {}, classDetail: {},
searchCallStudentValue: '', searchCallStudentValue: '',
leaveParams: {
status: 1,
page: 1,
perPage: 10,
},
leaveList: [],
leaveTotal: 0,
leaveSubmitLoading: false,
}, },
}); });
}, },
......
...@@ -17,6 +17,7 @@ import * as courseAjax from '../services/course'; ...@@ -17,6 +17,7 @@ import * as courseAjax from '../services/course';
import * as classroommgtAjax from '../services/classroommgt'; import * as classroommgtAjax from '../services/classroommgt';
import * as classMgtAjax from '../services/classmgt'; import * as classMgtAjax from '../services/classmgt';
import * as commonAjax from '../services/common'; import * as commonAjax from '../services/common';
import * as leaveAjax from '../services/leaves';
import errorcode from '../common/errorcode'; import errorcode from '../common/errorcode';
export default { export default {
namespace: 'indexstaic', namespace: 'indexstaic',
...@@ -69,6 +70,15 @@ export default { ...@@ -69,6 +70,15 @@ export default {
changeScheduleShow: false, changeScheduleShow: false,
selectScheduleinfo: {}, selectScheduleinfo: {},
changeScheduleIndex: 1, changeScheduleIndex: 1,
leaveParams: {
status: 1,
page: 1,
perPage: 10,
name: '',
},
leaveList: [],
leaveTotal: 0,
leaveSubmitLoading: false,
}, },
subscriptions: { subscriptions: {
setup({ dispatch, history }) { // eslint-disable-line setup({ dispatch, history }) { // eslint-disable-line
...@@ -588,6 +598,90 @@ export default { ...@@ -588,6 +598,90 @@ export default {
// message.error(clockCharts.msg, 1); // message.error(clockCharts.msg, 1);
} }
}, },
* queryLeaveList({ payload }, { call, put, select }) {
const { params } = payload;
const { sid } = yield select(state => state.webapp);
const { leaveParams, leaveTotal } = yield select(state => state.indexstaic);
const newParams = Object.assign(leaveParams, params, {
school_id: sid,
});
const data = yield call(leaveAjax.getLeaveList, newParams);
let newTotal = leaveTotal;
if (data.code === 200) {
if (data.data.total != undefined) {
newTotal = data.data.total;
}
yield put({
type: 'updateState',
payload: {
leaveList: data.data.list,
leaveTotal: newTotal,
},
});
}
},
* queryLeaveDetail({ payload }, { call, put, select }) {
const { id } = payload;
const data = yield call(leaveAjax.getDetail, {
id,
});
if (data.code === 200) {
yield put({
type: 'updateState',
payload: {
leaveDetail: data.data,
},
});
}
},
* saveLeave({ payload }, { call, put, select }) {
const {
expend, status, id, callBack,
} = payload;
const { leaveSubmitLoading } = yield select(state => state.indexstaic);
if (leaveSubmitLoading) {
return;
}
yield put({
type: 'updateState',
payload: {
leaveSubmitLoading: true,
},
});
const loadmessage = message.loading('数据保存中...', 0);
const data = yield call(leaveAjax.saveLeave, {
expend,
status,
id,
});
yield put({
type: 'updateState',
payload: {
leaveSubmitLoading: false,
},
});
setTimeout(loadmessage);
if (data.code === 200) {
message.success('操作成功', 1);
if (callBack && (typeof callBack == 'function')) {
callBack();
}
yield put({
type: 'queryLeaveList',
payload: {
params: {
},
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data,
},
});
}
},
* pageInit({ payload }, { call, put, select }) { * pageInit({ payload }, { call, put, select }) {
yield put({ yield put({
type: 'updateState', type: 'updateState',
...@@ -637,6 +731,15 @@ export default { ...@@ -637,6 +731,15 @@ export default {
end_time: '', end_time: '',
courseTimeListShow: false, courseTimeListShow: false,
}, },
leaveParams: {
status: 1,
page: 1,
perPage: 10,
name: '',
},
leaveList: [],
leaveTotal: 0,
leaveSubmitLoading: false,
}); });
}, },
}, },
......
...@@ -161,6 +161,13 @@ export default { ...@@ -161,6 +161,13 @@ export default {
dispatch({ dispatch({
type: 'indexstaic/todoSchedule', type: 'indexstaic/todoSchedule',
}); });
dispatch({
type: 'indexstaic/queryLeaveList',
payload: {
params: {
},
},
});
dispatch({ dispatch({
type: 'updateState', type: 'updateState',
payload: { payload: {
......
...@@ -781,6 +781,7 @@ class ClassDetailForm extends React.Component { ...@@ -781,6 +781,7 @@ class ClassDetailForm extends React.Component {
}); });
} }
toCallStudents = (schedule) => { toCallStudents = (schedule) => {
console.log(schedule, 'schedule');
const { const {
dispatch, datetime, classDetail, classStudentTotal, dispatch, datetime, classDetail, classStudentTotal,
} = this.props; } = this.props;
...@@ -815,6 +816,14 @@ class ClassDetailForm extends React.Component { ...@@ -815,6 +816,14 @@ class ClassDetailForm extends React.Component {
callType: 1, callType: 1,
}, },
}); });
dispatch({
type: 'callstudents/queryLeaveList',
payload: {
params: {
schedule_id: schedule.id,
},
},
});
} }
toEditCallStudents = (schedule) => { toEditCallStudents = (schedule) => {
const { dispatch, classDetail } = this.props; const { dispatch, classDetail } = this.props;
......
...@@ -195,6 +195,14 @@ class StaticCenter extends React.Component { ...@@ -195,6 +195,14 @@ class StaticCenter extends React.Component {
callType: 1, callType: 1,
}, },
}); });
dispatch({
type: 'callstudents/queryLeaveList',
payload: {
params: {
schedule_id: schedule.id,
},
},
});
} }
toEditCallStudents = (schedule) => { toEditCallStudents = (schedule) => {
const { dispatch } = this.props; const { dispatch } = this.props;
......
import React from 'react'; import React from 'react';
import { connect } from 'dva'; import { connect } from 'dva';
import { Row, Col, Modal, Form, Input, Button, Table, Alert, Select } from 'antd'; import { Row, Col, Modal, Form, Input, Button, Table, Alert, Select, Pagination } from 'antd';
import moment from 'moment';
import pageStyles from './StudentLeaveModal.less'; import pageStyles from './StudentLeaveModal.less';
import { pageIn, imagify } from '../../utils/index'; import { pageIn, imagify } from '../../utils/index';
import LeaveDetailModal from '../../components/LeaveDetailModal'; import LeaveDetailModal from '../../components/LeaveDetailModal';
...@@ -16,7 +17,6 @@ class StudentLeaveModal extends React.Component { ...@@ -16,7 +17,6 @@ class StudentLeaveModal extends React.Component {
componentDidMount() { componentDidMount() {
} }
componentWillUnmount() { componentWillUnmount() {
const { dispatch } = this.props;
} }
cancelLeaveModal = () => { cancelLeaveModal = () => {
const { dispatch } = this.props; const { dispatch } = this.props;
...@@ -29,6 +29,12 @@ class StudentLeaveModal extends React.Component { ...@@ -29,6 +29,12 @@ class StudentLeaveModal extends React.Component {
} }
goDetail = (record) => { goDetail = (record) => {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch({
type: 'indexstaic/queryLeaveDetail',
payload: {
id: record.id,
},
});
dispatch({ dispatch({
type: 'indexstaic/updateState', type: 'indexstaic/updateState',
payload: { payload: {
...@@ -36,54 +42,147 @@ class StudentLeaveModal extends React.Component { ...@@ -36,54 +42,147 @@ class StudentLeaveModal extends React.Component {
}, },
}); });
} }
detailClose = () => {
const { dispatch } = this.props;
dispatch({
type: 'indexstaic/updateState',
payload: {
detailVisible: false,
leaveDetail: null,
},
});
}
handleSearch = (e) => {
const { dispatch, form } = this.props;
e.preventDefault();
this.props.form.validateFields((err, values) => {
if (!err) {
const {
name,
status,
} = values;
dispatch({
type: 'indexstaic/queryLeaveList',
payload: {
params: {
page: 1,
name,
status,
},
},
});
}
});
}
handleSearchReset = () => {
const { dispatch, form } = this.props;
form.resetFields();
dispatch({
type: 'indexstaic/queryLeaveList',
payload: {
params: {
perPage: 10,
page: 1,
name: '',
status: '',
},
},
});
}
changeSizeChange = (page, perPage) => {
const { dispatch } = this.props;
dispatch({
type: 'indexstaic/queryLeaveList',
payload: {
params: {
page: 1,
perPage,
},
},
});
}
changePage = (page, perPage) => {
const { dispatch } = this.props;
dispatch({
type: 'indexstaic/queryLeaveList',
payload: {
params: {
page,
perPage,
},
},
});
}
detailSave = (values) => {
const { dispatch } = this.props;
dispatch({
type: 'indexstaic/saveLeave',
payload: values,
});
}
render() { render() {
const { const {
visible, visible,
detailVisible, detailVisible,
leaveParams,
leaveList,
leaveTotal,
leaveDetail,
leaveSubmitLoading,
} = this.props; } = this.props;
const dataSource = [
{
key: '1',
name: '胡彦斌',
age: 32,
address: '西湖区湖底公园1号',
},
{
key: '2',
name: '胡彦祖',
age: 42,
address: '西湖区湖底公园1号',
},
];
const columns = [ const columns = [
{ {
title: '申请学员', title: '申请学员',
dataIndex: 'name', dataIndex: 'student.name',
key: 'name', key: 'name',
render: (text, record) => {
return (
<div>
<span>{text}</span> <br />
<span>{record.student.mobile}</span>
</div>
);
},
}, },
{ {
title: '请假课次', title: '请假课次',
dataIndex: 'age', dataIndex: 'course.title',
key: 'age', key: 'course',
render: (text, record) => {
return (
<div>
<span>{text}</span> <br />
<span> {moment(record.schedule.start_time).format('YYYY-MM-DD HH:mm')}~{moment(record.schedule.end_time).format('HH:mm')}</span>
</div>
);
},
}, },
{ {
title: '申请时间', title: '申请时间',
dataIndex: 'address', dataIndex: 'created_at',
key: 'address', key: 'created_at',
}, },
{ {
title: '处理时间', title: '处理时间',
dataIndex: 'address', dataIndex: 'handled_at',
key: 'address', key: 'handled_at',
render: (text) => {
return (
<div>{text || '-'}</div>
);
},
}, },
{ {
title: '处理状态', title: '处理状态',
dataIndex: 'address', dataIndex: 'status',
render: (text, record) => { render: (text, record) => {
return ( return (
<div className={pageStyles.typeColor}> <div className={pageStyles.typeColor}>
<div className={pageStyles.typeColor1}>到课</div> {text === 1 && <div className={pageStyles.typeColor1}>待处理</div>}
{text === 3 && <div className={pageStyles.typeColor2}>已通过</div>}
{text === 2 && <div className={pageStyles.typeColor4}>已撤销</div>}
{text === 4 && <div className={pageStyles.typeColor3}>已驳回</div>}
</div> </div>
); );
}, },
...@@ -115,8 +214,8 @@ class StudentLeaveModal extends React.Component { ...@@ -115,8 +214,8 @@ class StudentLeaveModal extends React.Component {
> >
<Form layout="inline" labelAlign="right" onSubmit={this.handleSearch}> <Form layout="inline" labelAlign="right" onSubmit={this.handleSearch}>
<FormItem label="学员姓名"> <FormItem label="学员姓名">
{getFieldDecorator('class_id', { {getFieldDecorator('name', {
initialValue: '', initialValue: leaveParams.name,
})( })(
<Search <Search
placeholder="请输入学员姓名" placeholder="请输入学员姓名"
...@@ -125,15 +224,15 @@ class StudentLeaveModal extends React.Component { ...@@ -125,15 +224,15 @@ class StudentLeaveModal extends React.Component {
)} )}
</FormItem> </FormItem>
<FormItem label="状态"> <FormItem label="状态">
{getFieldDecorator('class_id', { {getFieldDecorator('status', {
initialValue: '', initialValue: leaveParams.status,
})( })(
<Select style={{ width: 130 }}> <Select style={{ width: 130 }}>
<Option value="">全部</Option> <Option value="">全部</Option>
<Option value={1}>待处理</Option> <Option value={1}>待处理</Option>
<Option value={2}>已通过</Option> <Option value={3}>已通过</Option>
<Option value={3}>已驳回</Option> <Option value={4}>已驳回</Option>
<Option value={4}>已撤销</Option> <Option value={2}>已撤销</Option>
</Select>, </Select>,
)} )}
</FormItem> </FormItem>
...@@ -149,13 +248,33 @@ class StudentLeaveModal extends React.Component { ...@@ -149,13 +248,33 @@ class StudentLeaveModal extends React.Component {
<div className={pageStyles.tableBox}> <div className={pageStyles.tableBox}>
<Table <Table
rowKey="id" rowKey="id"
dataSource={dataSource} dataSource={leaveList}
columns={columns} columns={columns}
pagination={false}
scroll={{ x: 'max-content' }}
footer={() => (
<div className="tablefooterbox">
<span className="tablefooterstatic">{leaveTotal}条数据</span>
<Pagination
pageSize={leaveParams.perPage}
total={Number(leaveTotal)}
onChange={this.changePage}
showSizeChanger
showQuickJumper
onShowSizeChange={this.changeSizeChange}
current={Number(leaveParams.page) || 1}
/>
</div>
)}
/> />
</div> </div>
</Modal> </Modal>
<LeaveDetailModal <LeaveDetailModal
visible={detailVisible} visible={detailVisible}
close={this.detailClose}
detail={leaveDetail}
save={this.detailSave}
leaveSubmitLoading={leaveSubmitLoading}
/> />
</div> </div>
); );
...@@ -171,10 +290,20 @@ function mapStateToProps(state) { ...@@ -171,10 +290,20 @@ function mapStateToProps(state) {
const { const {
leaveVisible, leaveVisible,
detailVisible, detailVisible,
leaveParams,
leaveList,
leaveTotal,
leaveDetail,
leaveSubmitLoading,
} = state.indexstaic; } = state.indexstaic;
return { return {
leaveVisible, leaveVisible,
detailVisible, detailVisible,
leaveParams,
leaveList,
leaveTotal,
leaveDetail,
leaveSubmitLoading,
}; };
} }
export default connect(mapStateToProps)(StudentLeave); export default connect(mapStateToProps)(StudentLeave);
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
} }
.typeColor3 { .typeColor3 {
color: #929292; color: #929292;
background:rgba(233,233,233,0.1); background:rgba(233,233,233,0.9);
} }
.typeColor4 { .typeColor4 {
color: #FFAD1F; color: #FFAD1F;
......
...@@ -468,6 +468,14 @@ class StaticCenter extends React.Component { ...@@ -468,6 +468,14 @@ class StaticCenter extends React.Component {
callType: 3, callType: 3,
}, },
}); });
dispatch({
type: 'callstudents/queryLeaveList',
payload: {
params: {
schedule_id: schedule.id,
},
},
});
} }
toEditCallStudents = (schedule) => { toEditCallStudents = (schedule) => {
const { dispatch } = this.props; const { dispatch } = this.props;
...@@ -649,7 +657,11 @@ class StaticCenter extends React.Component { ...@@ -649,7 +657,11 @@ class StaticCenter extends React.Component {
} }
// 请假弹框 // 请假弹框
goLeaveShow = () => { goLeaveShow = () => {
const { dispatch } = this.props; const { dispatch, leaveTotal } = this.props;
if (leaveTotal === 0) {
message.warning('当前暂无学员请假喔');
return;
}
dispatch({ dispatch({
type: 'indexstaic/updateState', type: 'indexstaic/updateState',
payload: { payload: {
...@@ -695,6 +707,7 @@ class StaticCenter extends React.Component { ...@@ -695,6 +707,7 @@ class StaticCenter extends React.Component {
studentChangeScheduleListTotal, studentChangeScheduleListTotal,
studentChangeScheduleListQueryParams, studentChangeScheduleListQueryParams,
leaveVisible, leaveVisible,
leaveTotal,
} = this.props; } = this.props;
const studentChangeScheduleColumns = [ const studentChangeScheduleColumns = [
{ {
...@@ -946,7 +959,7 @@ class StaticCenter extends React.Component { ...@@ -946,7 +959,7 @@ class StaticCenter extends React.Component {
<Col xs={{ span: 8, offset: 0 }} sm={{ span: 8, offset: 0 }} md={{ span: 4, offset: 0 }} lg={{ span: 4, offset: 0 }} xl={{ span: 4, offset: 0 }}> <Col xs={{ span: 8, offset: 0 }} sm={{ span: 8, offset: 0 }} md={{ span: 4, offset: 0 }} lg={{ span: 4, offset: 0 }} xl={{ span: 4, offset: 0 }}>
<div className={pageStyle.informItem} onClick={this.goLeaveShow}> <div className={pageStyle.informItem} onClick={this.goLeaveShow}>
<div className={pageStyle.informImg} id="index_paywarn"><img src={`${__IMGCDN__}index/inform_icon6.png`} alt="" /> <div className={pageStyle.informImg} id="index_paywarn"><img src={`${__IMGCDN__}index/inform_icon6.png`} alt="" />
<Badge className={pageStyle.informNum} overflowCount={999} count={renew.total}> <Badge className={pageStyle.informNum} overflowCount={999} count={leaveTotal}>
</Badge> </Badge>
</div> </div>
<div className={pageStyle.informTip}>请假提醒</div> <div className={pageStyle.informTip}>请假提醒</div>
...@@ -1056,6 +1069,7 @@ function mapStateToProps(state) { ...@@ -1056,6 +1069,7 @@ function mapStateToProps(state) {
courseTimeListShow, courseTimeListShow,
datetime, datetime,
leaveVisible, leaveVisible,
leaveTotal,
} = state.indexstaic; } = state.indexstaic;
// eslint-disable-next-line no-empty-pattern // eslint-disable-next-line no-empty-pattern
const {} = state.createtheme; const {} = state.createtheme;
...@@ -1139,6 +1153,7 @@ function mapStateToProps(state) { ...@@ -1139,6 +1153,7 @@ function mapStateToProps(state) {
schoolUserInfo, schoolUserInfo,
guideShow, guideShow,
leaveVisible, leaveVisible,
leaveTotal,
}; };
} }
export default connect(mapStateToProps)(StaticCenter); export default connect(mapStateToProps)(StaticCenter);
......
import qs from 'qs';
import request from '../utils/request';
import api from '../common/api';
export function getLeaveList(params) {
const data = qs.stringify(params);
return request({
url: `${api.leaves.leaveList}?${data}`,
method: 'GET',
});
}
export function getDetail(params) {
const data = qs.stringify(params);
return request({
url: `${api.leaves.leaveList}/${params.id}`,
method: 'GET',
data,
});
}
export function saveLeave(params) {
const data = qs.stringify(params);
return request({
url: `${api.leaves.leaveList}/${params.id}`,
method: 'PUT',
data,
});
}
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