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

dd

parent f6e9754e
......@@ -87,6 +87,7 @@ export default {
common: `${dakaapi}member/erp/plans`,
},
classroomMgt: `${dakaapi}member/erp/rooms`,
schedulestimeMgt: `${dakaapi}member/erp/schedules_time`,
officaialweb: {
schoolDetail: `${dakaapi}member/website/school/detail`,
courseDetail: `${dakaapi}member/website/course/detail`,
......
......@@ -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 }) {
const { sid } = yield select(state => state.webapp);
const { classId } = yield select(state => state.classdetail);
......@@ -1255,12 +1278,13 @@ export default {
timeArr.push({
start_time: value.start_time,
end_time: value.end_time,
id: timePutData.data.id,
});
yield put({
type: 'updateState',
payload: {
timeArr: [...timeArr],
addCourseTimeShow: false,
// addCourseTimeShow: false,
},
});
} else {
......
......@@ -120,12 +120,13 @@ export default {
timeArr.push({
start_time: value.start_time,
end_time: value.end_time,
id: timePutData.data.id,
});
yield put({
type: 'updateState',
payload: {
timeArr: [...timeArr],
addCourseTimeShow: false,
// addCourseTimeShow: false,
},
});
} else {
......@@ -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 }) {
const { classroomList } = yield select(state => state.indexstaic);
const { sid } = yield select(state => state.webapp);
......
......@@ -118,7 +118,7 @@ export default {
* addClassRoom({ payload }, { call, put, select }) {
const { value, callBack } = payload;
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) {
return;
}
......
import { connect } from 'dva';
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 pageStyle from './AddCourseTime.less';
class AddCourseTime extends React.Component {
componentDidMount() { // 挂载
pageIn('班级管理');
......@@ -23,6 +24,7 @@ class AddCourseTime extends React.Component {
message.error('开始时间必须小于结束时间', 1);
return;
}
console.log(22222);
saveCourseTime({
start_time: start_time.format('HH:mm'),
end_time: end_time.format('HH:mm'),
......@@ -34,27 +36,31 @@ class AddCourseTime extends React.Component {
visible,
close,
addTimeSubmitting,
timeArr,
delTime,
} = this.props;
const { getFieldDecorator } = this.props.form;
console.log(timeArr, 'timeArr');
return (
<Modal
visible={visible}
centered
title="配置时间段"
onCancel={close}
onOk={this.submit}
width={300}
footer={null}
width={500}
zIndex={111}
className="modifyclassModal"
maskClosable={false}
bodyStyle={{ paddingLeft: '0', paddingRight: '0' }}
confirmLoading={addTimeSubmitting}
>
<Row>
<Col style={{ lineHeight: '40px', paddingBottom: '22px' }} lg={{ span: 8 }} md={{ span: 8 }} xs={{ span: 24 }}>
<Row style={{ paddingLeft: '20px', paddingBottom: '20px' }}>
<Col style={{ lineHeight: '40px' }} lg={{ span: 4 }} md={{ span: 8 }} xs={{ span: 24 }}>
<span>上课时间:</span>
</Col>
<Col lg={{ span: 16 }} md={{ span: 16 }} xs={{ span: 24 }} style={{ paddingBottom: '22px' }}>
<Form className="modalform">
<Col lg={{ span: 16 }} md={{ span: 10 }} xs={{ span: 24 }} >
<Form className="modalform" layout="inline">
<Form.Item>
{getFieldDecorator('start_time', {
rules: [{ required: true, message: '请选择上课时间' }],
......@@ -77,6 +83,28 @@ class AddCourseTime extends React.Component {
</Form.Item>
</Form>
</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>
</Modal>
);
......
......@@ -4,4 +4,17 @@
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 {
},
});
}
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() {
const { getFieldDecorator } = this.props.form;
const {
......@@ -1374,6 +1398,8 @@ class ClassDetailForm extends React.Component {
saveCourseTime={this.saveCourseTime}
close={this.closeAddCourseTime}
addTimeSubmitting={addTimeSubmitting}
delTime={this.delTime}
timeArr={timeArr}
/>
<div className={pageStyle.classDetail}>
<div className={pageStyle.classdetailheader}>
......
......@@ -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 = () => {
const { dispatch } = this.props;
dispatch({
......@@ -519,6 +543,7 @@ class StaticCenter extends React.Component {
close={this.closeAddCourseTime}
timeArr={timeArr}
addTimeSubmitting={addTimeSubmitting}
delTime={this.delTime}
/>
</div>
);
......
......@@ -25,3 +25,10 @@ export function classroomDelete(params) {
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