Browse Source

uas手机版
我的日程对接

samhoo 5 years ago
parent
commit
97dded7aea

+ 23 - 21
uas-office-web/uas-mobile/src/components/common/calendar/CommonCalendar.jsx

@@ -47,28 +47,30 @@ export default class CommonCalendar extends Component {
     let clickDate = this.dateformat(value),
       { calendarData } = this.props,
       listData
-    for (let i = 0; i < calendarData.length; i++) {
-      let date = calendarData[i].date
-      if (clickDate === date) {
-        switch (calendarData[i].status) {
-          case 0:
-            listData = [
-              { color: 'no' },
-            ]
-            break
-          case 1:
-            listData = [
-              { color: 'red' },
-            ]
-            break
-          case 2:
-            listData = [
-              { color: 'gray' },
-            ]
-            break
-          default:
-        }
+    if (calendarData && calendarData.length >= 0) {
+      for (let i = 0; i < calendarData.length; i++) {
+        let date = calendarData[i].date
+        if (clickDate === date) {
+          switch (calendarData[i].status) {
+            case 0:
+              listData = [
+                { color: 'no' },
+              ]
+              break
+            case 1:
+              listData = [
+                { color: 'red' },
+              ]
+              break
+            case 2:
+              listData = [
+                { color: 'gray' },
+              ]
+              break
+            default:
+          }
 
+        }
       }
     }
     return listData || []

+ 9 - 6
uas-office-web/uas-mobile/src/components/private/noticematter/NoticeMatter.jsx

@@ -6,6 +6,7 @@
 import React, { Component } from 'react'
 import './notice-matter.less'
 import { Steps, Divider } from 'antd'
+import { isObjEmpty } from '../../../utils/common/common.util'
 
 const { Step } = Steps
 
@@ -28,12 +29,14 @@ export default class NoticeMatter extends Component {
   render () {
     let { noticeMatterData } = this.props
     let MeetingList = []
-    noticeMatterData.forEach((item, index) => {
-      MeetingList.push(
-        <Step className="step-icon" key={index} status="finish" title={item.time}
-              description={item.meetingName + '来自(' + item.meetingFrom + ')'} onClick={this.onCancelClick}/>,
-      )
-    })
+    if (!isObjEmpty(noticeMatterData)) {
+      noticeMatterData.forEach((item, index) => {
+        MeetingList.push(
+          <Step className="step-icon" key={index} status="finish" title={item.TIME}
+                description={item.MEETINGNAME + '来自(' + item.MEETINGFROM + ')'} onClick={this.onCancelClick}/>,
+        )
+      })
+    }
 
     return (
       <div className='notice-matter'>

+ 1 - 1
uas-office-web/uas-mobile/src/components/private/punchclock/ClockRecord.jsx

@@ -34,7 +34,7 @@ export default class ClockRecord extends Component {
         </div>
         <div className="clock-record-right">
           <div
-            className={onTime.type == '未打卡' || onTime.type == '迟到打卡' ? 'punch-clock-on-time punch-clock-box punch-clock-box-delay' : 'punch-clock-on-time punch-clock-box punch-clock-box-normal'}>
+            className={onTime.type == '未打卡' || onTime.type == '迟到' ? 'punch-clock-on-time punch-clock-box punch-clock-box-delay' : 'punch-clock-on-time punch-clock-box punch-clock-box-normal'}>
             <div className="on-work">上班{onTime.auto ? '·自动' : ''}</div>
             <div
               className="on-work-time">{onTime.type == '未打卡' ? '未打卡' : onTime.type + '(' + onTime.punchTime + ')'}</div>

+ 8 - 2
uas-office-web/uas-mobile/src/components/private/punchclock/PunchClock.jsx

@@ -7,7 +7,7 @@ import React, { Component } from 'react'
 import './punch-clock.less'
 import ClockDesc from './ClockDesc'
 import ClockRecord from './ClockRecord'
-import { isEmptyObject } from '../../../utils/common/common.util'
+import { isEmptyObject, isObjEmpty } from '../../../utils/common/common.util'
 
 export default class PunchClock extends Component {
 
@@ -27,6 +27,12 @@ export default class PunchClock extends Component {
 
   render () {
     let { companyRule, clockRecord } = this.props.punchClockData
+    const rowItems = []
+    if (!isObjEmpty(clockRecord)) {
+      clockRecord.forEach((item, index) => {
+        rowItems.push(<ClockRecord key={index} clockRecord={item}/>)
+      })
+    }
 
     return (
       isEmptyObject(this.props.punchClockData)
@@ -35,7 +41,7 @@ export default class PunchClock extends Component {
         :
         <div className='punch-clock'>
           <ClockDesc companyRule={companyRule}/>
-          <ClockRecord clockRecord={clockRecord}/>
+          {rowItems}
         </div>
     )
   }

+ 8 - 0
uas-office-web/uas-mobile/src/configs/api.config.js

@@ -33,6 +33,14 @@ export const API = {
   //待办事项目列表
   APPCOMMON_TASKTODO: _baseURL + '/mobile/appcommon/list/taskToDo.action',
 
+  /*******************************日程*************************************/
+  //日程主界面
+  APPCOMMON_DAILYTASKTOTAL: _baseURL + '/mobile/appweb/schedule/getCurrentScheduleList.action',
+  //日程具体日期
+  APPCOMMON_DAILYTASK: _baseURL + '/mobile/appweb/schedule/getSchedule.action',
+  //日程月份状态
+  APPCOMMON_MONTHLYTASKSTATUS: _baseURL + '/mobile/appweb/schedule/getScheduleList.action',
+
   /*******************************订阅*************************************/
   //获取可订阅列表
   SUBSCRIBE_GETSUBSCRIBELIST: _baseURL +

+ 73 - 77
uas-office-web/uas-mobile/src/pages/private/schedulePage/SchedulePage.jsx

@@ -4,10 +4,14 @@
  */
 import React, { Component } from 'react'
 import { connect } from 'react-redux'
-import { PullToRefresh, ListView, Toast } from 'antd-mobile'
 import CommonCalendar from '../../../components/common/calendar/CommonCalendar'
 import PunchClock from '../../../components/private/punchclock/PunchClock'
 import NoticeMatter from '../../../components/private/noticematter/NoticeMatter'
+import { isObjEmpty } from '../../../utils/common/common.util'
+import { fetchPostObj, fetchGet } from '../../../utils/common/fetchRequest'
+import { message } from 'antd'
+import { Toast } from 'antd-mobile'
+import { API } from '../../../configs/api.config'
 
 import './schedule-page.less'
 
@@ -17,57 +21,19 @@ class SchedulePage extends Component {
     super()
 
     this.state = {
-      punchClockData: {
-        companyRule: '优软班次',
-        clockRecord: {
-          onTime: {
-            time: '8:30',
-            punchTime: '08:45',
-            auto: false,
-            type: '迟到打卡',
-          },
-          offTime: {
-            time: '18:00',
-            punchTime: '19:00',
-            auto: true,
-            type: '正常打卡',
-          },
-        },
-      },
-      noticeMatterData: [{
-        time: '9:30-10:30',
-        meetingName: '部门例会',
-        meetingFrom: '会议',
-        id: '',
-      }, {
-        time: '14:00-16:30',
-        meetingName: '深爱半导体(业务办理)',
-        meetingFrom: '外勤',
-        id: '',
-      }],
-
-      calendarData: [{
-        date: '2020-11-12',
-        status: 0,//正常 无
-      },
-        {
-          date: '2020-11-13',
-          status: 1,//迟到 red
-        },
-        {
-          date: '2020-11-14',
-          status: 2,//有事项 gray
-        }],
+      punchClockData: {},
+      noticeMatterData: [],
+      calendarData: [],
     }
   }
 
   componentWillMount () {
-    //发起请求
-    // Toast.loading('加载中...', 0)
+
   }
 
   componentDidMount () {
     document.title = '我的日程'
+    this.getdailyData()
   }
 
   componentWillUnmount () {
@@ -91,44 +57,74 @@ class SchedulePage extends Component {
     if (nowDate == date) {
       return false
     }
-    let testData1 = {
-      companyRule: '测试班次',
-      clockRecord: {
-        onTime: {
-          time: '9:30',
-          punchTime: '08:45',
-          auto: false,
-          type: '正常打卡',
-        },
-        offTime: {
-          time: '19:00',
-          punchTime: '19:00',
-          auto: false,
-          type: '未打卡',
-        },
-      },
-    }
-    let testData2 = [{
-      time: '9:30-10:30',
-      meetingName: '部门例会',
-      meetingFrom: '会议',
-    }, {
-      time: '11:30-13:30',
-      meetingName: '部门例会',
-      meetingFrom: '会议',
-    }, {
-      time: '13:30-17:30',
-      meetingName: '部门例会',
-      meetingFrom: '会议',
-    }]
-    this.setState({
-      punchClockData: testData1,
-      noticeMatterData: testData2,
+
+    Toast.loading('加载中', 0)
+    fetchPostObj(API.APPCOMMON_DAILYTASK, {
+      data: date,
+    }).then(response => {
+      Toast.hide()
+      this.setState({
+        noticeMatterData: response.data.noticeMatterData,
+        punchClockData: response.data.punchClockData,
+      })
+      if (!isObjEmpty(response.data.calendarData)) {
+        this.setState({
+          calendarData: response.data.calendarData,
+        })
+      }
+      message.success('加载成功')
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('数据加载失败')
+      }
     })
   }
 
   clickBlankPanel = (date) => {
     //发送请求重新渲染日历上的点数
+    Toast.loading('加载中', 0)
+    fetchPostObj(API.APPCOMMON_MONTHLYTASKSTATUS, {
+      data: date,
+    }).then(response => {
+      Toast.hide()
+      this.setState({
+        calendarData: response.data.calendarData,
+        noticeMatterData: response.data.noticeMatterData,
+        punchClockData: response.data.punchClockData,
+      })
+      message.success('加载成功')
+    }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('数据加载失败')
+      }
+    })
+  }
+
+  getdailyData = () => {
+    Toast.loading('正在获取数据', 0)
+    fetchGet(API.APPCOMMON_DAILYTASKTOTAL)
+      .then(response => {
+        Toast.hide()
+        this.setState({
+          calendarData: response.data.calendarData,
+          noticeMatterData: response.data.noticeMatterData,
+          punchClockData: response.data.punchClockData,
+        })
+        message.success('请求成功')
+      }).catch(error => {
+      Toast.hide()
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('待办事项获取失败')
+      }
+    })
   }
 
 }

+ 4 - 0
uas-office-web/uas-mobile/src/pages/private/taskTodo/task-todo.less

@@ -2,4 +2,8 @@
   height: 100vh;
   padding: 8px;
   background: @com-bg-color-lightGray;
+
+  .report-func-root {
+    height: 90vh;
+  }
 }