|
|
@@ -5,7 +5,7 @@
|
|
|
|
|
|
import React,{Component} from 'react';
|
|
|
import './LeaveAddPage.css';
|
|
|
-import {getOrganization} from "../../utils/api.request";
|
|
|
+// import {getOrganization} from "../../utils/api.request";
|
|
|
import {connect} from 'react-redux';
|
|
|
import {getIntValue, getStrValue, isObjEmpty} from "../../utils/common";
|
|
|
import {ORGANIZATION_TEACHER} from "../../utils/api.constants";
|
|
|
@@ -35,7 +35,7 @@ class LeaveAddPage extends Component{
|
|
|
}
|
|
|
componentDidMount() {
|
|
|
this.node.scrollIntoView();
|
|
|
- getOrganization(ORGANIZATION_TEACHER, this.props.userInfo.stuId, false)
|
|
|
+ /*getOrganization(ORGANIZATION_TEACHER, this.props.userInfo.stuId, false)
|
|
|
.then(organization => {
|
|
|
this.setState({
|
|
|
targetData: organization.teachers,
|
|
|
@@ -47,7 +47,8 @@ class LeaveAddPage extends Component{
|
|
|
} else {
|
|
|
Toast.fail('请求异常', 2)
|
|
|
}
|
|
|
- })
|
|
|
+ })*/
|
|
|
+ this.getOrganization()
|
|
|
}
|
|
|
render(){
|
|
|
const targetProps = {
|
|
|
@@ -76,7 +77,7 @@ class LeaveAddPage extends Component{
|
|
|
<img class="img-circle" id="margin_top_bottom_15"
|
|
|
src={"http://img5.imgtn.bdimg.com/it/u=1494163297,265276102&fm=26&gp=0.jpg"} width={60}
|
|
|
height={60}/>
|
|
|
- <span class="span_17 text_bold " id="row_margin">{this.props.userInfo.stuName}的请假条</span>
|
|
|
+ <span class="span_17 text_bold " id="row_margin">{this.props.userInfo.user.student.stuName}的请假条</span>
|
|
|
</div>
|
|
|
<div className="comhline_sty"></div>
|
|
|
|
|
|
@@ -164,14 +165,19 @@ class LeaveAddPage extends Component{
|
|
|
approveFiles.push(value.picUrl)
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
const params = {
|
|
|
- lvProposer:this.props.userInfo.stuId,
|
|
|
- lvName:this.props.userInfo.stuName+"的请假条",
|
|
|
- lvNotifier:JSON.stringify(this.state.votePerson),
|
|
|
- lvFiles:approveFiles,
|
|
|
+ lvTitle: "学生请假",
|
|
|
lvDetails:this.state.leaveReason,
|
|
|
+ lvType: 1,
|
|
|
+ lvProposer:this.props.userInfo.user.student.stuId,
|
|
|
+ lvStatus:1,
|
|
|
startDate: moment(this.state.startDate).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
endDate: moment(this.state.endDate).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ lvRemarks: "备注",
|
|
|
+ lvNotifier:JSON.stringify(this.state.votePerson),
|
|
|
+ lvFiles:approveFiles,
|
|
|
}
|
|
|
console.log('param', params)
|
|
|
fetchPost(API.leaveCreate, {
|
|
|
@@ -195,17 +201,57 @@ class LeaveAddPage extends Component{
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
- onTargetFocus = (e) => {
|
|
|
- if (isObjEmpty(this.state.targetData)) {
|
|
|
- getOrganization(ORGANIZATION_TEACHER, this.props.userInfo.stuId, false)
|
|
|
- .then(organization => {
|
|
|
- this.setState({
|
|
|
- targetData: organization.teachers,
|
|
|
+ getOrganization = () => {
|
|
|
+ Toast.loading('', 0)
|
|
|
+ fetchGet(API.getAllTeacher, {
|
|
|
+ schoolId: this.props.userInfo.user.schoolId,
|
|
|
+ }).then(response => {
|
|
|
+ Toast.hide()
|
|
|
+ const {targetData} = this.state
|
|
|
+ targetData.length = 0
|
|
|
+ if (response && response.data) {
|
|
|
+ // const schoolArray = response.data.schools
|
|
|
+ const teacherArray = response.data
|
|
|
+
|
|
|
+ if (!isObjEmpty(teacherArray)) {
|
|
|
+ const teacherData = []
|
|
|
+ teacherArray.forEach((teacherObj, index) => {
|
|
|
+ if (teacherObj) {
|
|
|
+ teacherData.push({
|
|
|
+ title: getStrValue(teacherObj, 'teacherName'),
|
|
|
+ userId: getIntValue(teacherObj, 'teacherId'),
|
|
|
+ userPhone: getStrValue(teacherObj, 'userPhone'),
|
|
|
+ value: getStrValue(teacherObj, 'teacherName') + `-1-${index}`,
|
|
|
+ key: `1-${index}`,
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
- }).catch(error => {
|
|
|
|
|
|
+ targetData.push({
|
|
|
+ title: `全体老师`,
|
|
|
+ value: `1`,
|
|
|
+ key: `1`,
|
|
|
+ children: teacherData,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log('targetData', targetData)
|
|
|
+ this.setState({
|
|
|
+ targetData,
|
|
|
})
|
|
|
+ }).catch(error => {
|
|
|
+ Toast.hide()
|
|
|
+
|
|
|
+ if (typeof error === 'string') {
|
|
|
+ Toast.fail(error, 2)
|
|
|
+ } else {
|
|
|
+ Toast.fail('请求异常', 2)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ onTargetFocus = (e) => {
|
|
|
+ if (isObjEmpty(this.state.targetData)) {
|
|
|
+ this.getOrganization()
|
|
|
}
|
|
|
}
|
|
|
onTargetChange = (value, label, checkNodes, count) => {
|
|
|
@@ -236,18 +282,6 @@ class LeaveAddPage extends Component{
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
let mapStateToProps = (state) => ({
|