Commit 1b0439ce authored by sujie@126.com's avatar sujie@126.com

dd

parent f6e9754e
...@@ -87,6 +87,7 @@ export default { ...@@ -87,6 +87,7 @@ export default {
common: `${dakaapi}member/erp/plans`, common: `${dakaapi}member/erp/plans`,
}, },
classroomMgt: `${dakaapi}member/erp/rooms`, classroomMgt: `${dakaapi}member/erp/rooms`,
schedulestimeMgt: `${dakaapi}member/erp/schedules_time`,
officaialweb: { officaialweb: {
schoolDetail: `${dakaapi}member/website/school/detail`, schoolDetail: `${dakaapi}member/website/school/detail`,
courseDetail: `${dakaapi}member/website/course/detail`, courseDetail: `${dakaapi}member/website/course/detail`,
......
...@@ -1105,6 +1105,29 @@ export default { ...@@ -1105,6 +1105,29 @@ export default {
}); });
} }
}, },
* delTime({ payload }, { call, put, select }) {
const { timeArr } = yield select(state => state.classdetail);
const { sid } = yield select(state => state.webapp);
const { time } = payload;
const timeArrtdata = yield call(classroommgtAjax.schedulestimeDelete, {
id: time.id,
});
if (timeArrtdata.code == 200) {
yield put({
type: 'updateState',
payload: {
timeArr: [...timeArr.filter(ele => ele.id != time.id)],
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data: timeArrtdata,
},
});
}
},
* queryClassDetail({ payload }, { call, put, select }) { * queryClassDetail({ payload }, { call, put, select }) {
const { sid } = yield select(state => state.webapp); const { sid } = yield select(state => state.webapp);
const { classId } = yield select(state => state.classdetail); const { classId } = yield select(state => state.classdetail);
...@@ -1255,12 +1278,13 @@ export default { ...@@ -1255,12 +1278,13 @@ export default {
timeArr.push({ timeArr.push({
start_time: value.start_time, start_time: value.start_time,
end_time: value.end_time, end_time: value.end_time,
id: timePutData.data.id,
}); });
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
timeArr: [...timeArr], timeArr: [...timeArr],
addCourseTimeShow: false, // addCourseTimeShow: false,
}, },
}); });
} else { } else {
......
...@@ -120,12 +120,13 @@ export default { ...@@ -120,12 +120,13 @@ export default {
timeArr.push({ timeArr.push({
start_time: value.start_time, start_time: value.start_time,
end_time: value.end_time, end_time: value.end_time,
id: timePutData.data.id,
}); });
yield put({ yield put({
type: 'updateState', type: 'updateState',
payload: { payload: {
timeArr: [...timeArr], timeArr: [...timeArr],
addCourseTimeShow: false, // addCourseTimeShow: false,
}, },
}); });
} else { } else {
...@@ -266,6 +267,30 @@ export default { ...@@ -266,6 +267,30 @@ export default {
}); });
} }
}, },
* delTime({ payload }, { call, put, select }) {
const { timeArr } = yield select(state => state.indexstaic);
const { sid } = yield select(state => state.webapp);
const { time } = payload;
console.log(time, 'time');
const timeArrtdata = yield call(classroommgtAjax.schedulestimeDelete, {
id: time.id,
});
if (timeArrtdata.code == 200) {
yield put({
type: 'updateState',
payload: {
timeArr: [...timeArr.filter(ele => ele.id != time.id)],
},
});
} else {
yield put({
type: 'webapp/errorrequestresolve',
payload: {
data: timeArrtdata,
},
});
}
},
* queryClassroomList({ payload }, { call, put, select }) { * queryClassroomList({ payload }, { call, put, select }) {
const { classroomList } = yield select(state => state.indexstaic); const { classroomList } = yield select(state => state.indexstaic);
const { sid } = yield select(state => state.webapp); const { sid } = yield select(state => state.webapp);
......
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
* addClassRoom({ payload }, { call, put, select }) { * addClassRoom({ payload }, { call, put, select }) {
const { value, callBack } = payload; const { value, callBack } = payload;
const { sid } = yield select(state => state.webapp); const { sid } = yield select(state => state.webapp);
const { classRoomSubmitting, classroomList } = yield select(state => state.classmgt); const { classRoomSubmitting, classroomList } = yield select(state => state.studentclass);
if (classRoomSubmitting) { if (classRoomSubmitting) {
return; return;
} }
......
import { connect } from 'dva'; import { connect } from 'dva';
import React from 'react'; import React from 'react';
import { TimePicker, Row, Col, Input, Modal, Form, message } from 'antd'; import { TimePicker, Row, Col, Input, Modal, Form, message, Button, Icon } from 'antd';
import { pageIn } from '../../utils/index'; import { pageIn } from '../../utils/index';
import pageStyle from './AddCourseTime.less';
class AddCourseTime extends React.Component { class AddCourseTime extends React.Component {
componentDidMount() { // 挂载 componentDidMount() { // 挂载
pageIn('班级管理'); pageIn('班级管理');
...@@ -23,6 +24,7 @@ class AddCourseTime extends React.Component { ...@@ -23,6 +24,7 @@ class AddCourseTime extends React.Component {
message.error('开始时间必须小于结束时间', 1); message.error('开始时间必须小于结束时间', 1);
return; return;
} }
console.log(22222);
saveCourseTime({ saveCourseTime({
start_time: start_time.format('HH:mm'), start_time: start_time.format('HH:mm'),
end_time: end_time.format('HH:mm'), end_time: end_time.format('HH:mm'),
...@@ -34,27 +36,31 @@ class AddCourseTime extends React.Component { ...@@ -34,27 +36,31 @@ class AddCourseTime extends React.Component {
visible, visible,
close, close,
addTimeSubmitting, addTimeSubmitting,
timeArr,
delTime,
} = this.props; } = this.props;
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
console.log(timeArr, 'timeArr');
return ( return (
<Modal <Modal
visible={visible} visible={visible}
centered centered
title="配置时间段" title="配置时间段"
onCancel={close} onCancel={close}
onOk={this.submit} footer={null}
width={300} width={500}
zIndex={111} zIndex={111}
className="modifyclassModal" className="modifyclassModal"
maskClosable={false} maskClosable={false}
bodyStyle={{ paddingLeft: '0', paddingRight: '0' }}
confirmLoading={addTimeSubmitting} confirmLoading={addTimeSubmitting}
> >
<Row> <Row style={{ paddingLeft: '20px', paddingBottom: '20px' }}>
<Col style={{ lineHeight: '40px', paddingBottom: '22px' }} lg={{ span: 8 }} md={{ span: 8 }} xs={{ span: 24 }}> <Col style={{ lineHeight: '40px' }} lg={{ span: 4 }} md={{ span: 8 }} xs={{ span: 24 }}>
<span>上课时间:</span> <span>上课时间:</span>
</Col> </Col>
<Col lg={{ span: 16 }} md={{ span: 16 }} xs={{ span: 24 }} style={{ paddingBottom: '22px' }}> <Col lg={{ span: 16 }} md={{ span: 10 }} xs={{ span: 24 }} >
<Form className="modalform"> <Form className="modalform" layout="inline">
<Form.Item> <Form.Item>
{getFieldDecorator('start_time', { {getFieldDecorator('start_time', {
rules: [{ required: true, message: '请选择上课时间' }], rules: [{ required: true, message: '请选择上课时间' }],
...@@ -77,6 +83,28 @@ class AddCourseTime extends React.Component { ...@@ -77,6 +83,28 @@ class AddCourseTime extends React.Component {
</Form.Item> </Form.Item>
</Form> </Form>
</Col> </Col>
<Col style={{ lineHeight: '40px' }} lg={{ span: 2 }} md={{ span: 8 }} xs={{ span: 24 }}>
<Button type="primary" onClick={this.submit}>添加</Button>
</Col>
</Row>
<Row
style={{
paddingLeft: '20px',
paddingTop: '20px',
borderTop: '1px solid rgba(0,0,0,.1)',
}}
>
<Col style={{ lineHeight: '40px' }} lg={{ span: 5 }} md={{ span: 8 }} xs={{ span: 24 }}>
<span style={{ color: '#000' }}>已配置时间段:</span>
</Col>
<Col lg={{ span: 19 }} md={{ span: 20 }} xs={{ span: 24 }} style={{ }}>
{timeArr && timeArr.map(ele => (
<div className={pageStyle.timeitem}>
<span className={pageStyle.itemContent}>{ele.start_time}{ele.end_time}</span>
<Icon onClick={() => delTime(ele)} type="close-circle" theme="twoTone" style={{ color: '#FF5252', fontSize: '12px' }} twoToneColor="#FF5252" />
</div>
))}
</Col>
</Row> </Row>
</Modal> </Modal>
); );
......
...@@ -4,4 +4,17 @@ ...@@ -4,4 +4,17 @@
padding-left: 0; padding-left: 0;
} }
} }
} }
\ No newline at end of file .timeitem {
width:160px;
height:32px;
background:rgba(255,255,255,1);
border-radius:4px;
border:1px solid rgba(217,217,217,1);
display: inline-block;
padding: 5px 12px;
margin: 10px;
}
.itemContent {
padding-right: 40px;
}
\ No newline at end of file
...@@ -857,6 +857,30 @@ class ClassDetailForm extends React.Component { ...@@ -857,6 +857,30 @@ class ClassDetailForm extends React.Component {
}, },
}); });
} }
delTime = (ele) => {
const { dispatch } = this.props;
Modal.confirm({
title: `确定删除时间【${ele.start_time}${ele.end_time}】吗`,
okButtonProps: {
type: 'danger',
style: {
color: '#fff',
backgroundColor: '#ff4d4f',
borderColor: '#ff4d4f',
},
},
centered: true,
icon: <Icon type="close-circle" style={{ color: 'red' }} />,
onOk: () => {
dispatch({
type: 'classdetail/delTime',
payload: {
time: ele,
},
});
},
});
}
render() { render() {
const { getFieldDecorator } = this.props.form; const { getFieldDecorator } = this.props.form;
const { const {
...@@ -1374,6 +1398,8 @@ class ClassDetailForm extends React.Component { ...@@ -1374,6 +1398,8 @@ class ClassDetailForm extends React.Component {
saveCourseTime={this.saveCourseTime} saveCourseTime={this.saveCourseTime}
close={this.closeAddCourseTime} close={this.closeAddCourseTime}
addTimeSubmitting={addTimeSubmitting} addTimeSubmitting={addTimeSubmitting}
delTime={this.delTime}
timeArr={timeArr}
/> />
<div className={pageStyle.classDetail}> <div className={pageStyle.classDetail}>
<div className={pageStyle.classdetailheader}> <div className={pageStyle.classdetailheader}>
......
...@@ -165,6 +165,30 @@ class StaticCenter extends React.Component { ...@@ -165,6 +165,30 @@ class StaticCenter extends React.Component {
}, },
}); });
} }
delTime = (ele) => {
const { dispatch } = this.props;
Modal.confirm({
title: `确定删除时间【${ele.start_time}${ele.end_time}】吗`,
okButtonProps: {
type: 'danger',
style: {
color: '#fff',
backgroundColor: '#ff4d4f',
borderColor: '#ff4d4f',
},
},
centered: true,
icon: <Icon type="close-circle" style={{ color: 'red' }} />,
onOk: () => {
dispatch({
type: 'indexstaic/delTime',
payload: {
time: ele,
},
});
},
});
}
addCourseTime = () => { addCourseTime = () => {
const { dispatch } = this.props; const { dispatch } = this.props;
dispatch({ dispatch({
...@@ -519,6 +543,7 @@ class StaticCenter extends React.Component { ...@@ -519,6 +543,7 @@ class StaticCenter extends React.Component {
close={this.closeAddCourseTime} close={this.closeAddCourseTime}
timeArr={timeArr} timeArr={timeArr}
addTimeSubmitting={addTimeSubmitting} addTimeSubmitting={addTimeSubmitting}
delTime={this.delTime}
/> />
</div> </div>
); );
......
...@@ -25,3 +25,10 @@ export function classroomDelete(params) { ...@@ -25,3 +25,10 @@ export function classroomDelete(params) {
method: 'DELETE', method: 'DELETE',
}); });
} }
export function schedulestimeDelete(params) {
return request({
url: `${api.schedulestimeMgt}/${params.id}`,
method: 'DELETE',
});
}
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