Browse Source

Merge branch 'dev' of ssh://10.10.100.21/source/uas-office-integration into dev

RaoMeng 5 years ago
parent
commit
6a2ce642ae

+ 44 - 46
uas-office-web/uas-mobile/src/pages/private/taskTodo/TaskTodo.jsx

@@ -9,7 +9,7 @@ import './task-todo.less'
 import TaskTodoItem from '../../../components/private/tasktodo/TaskTodoItem'
 import { isObjEmpty } from '../../../utils/common/common.util'
 import { message } from 'antd'
-import { Toast, SearchBar } from 'antd-mobile'
+import { Toast, SearchBar, PullToRefresh } from 'antd-mobile'
 import { fetchPostObj, fetchGet } from '../../../utils/common/fetchRequest'
 import { API } from '../../../configs/api.config'
 
@@ -20,54 +20,12 @@ class TaskTodo extends Component {
 
     this.state = {
       data: [],
+      refreshing: false,
     }
   }
 
   componentDidMount () {
-    const dataArr = [{
-      recorder: '李剑辉',
-      taskName: '费用报销单111111111111111111111111111111111111111111111111111',
-      statDate: '2020-09-32 15:34:32',
-      status: '进行中',
-      TaskId: 2665939,
-    }, {
-      recorder: '李剑辉',
-      taskName: '费用报销单',
-      statDate: '2020-09-38 15:34:38',
-      status: '进行中',
-      TaskId: 2665941,
-    }, {
-      recorder: '李剑辉',
-      taskName: '费用报销单',
-      statDate: '2020-09-37 15:34:37',
-      status: '进行中',
-      TaskId: 2665940,
-    }, {
-      recorder: '詹国胜',
-      taskName: '采购物料',
-      statDate: '2020-10-31 16:23:31',
-      status: '已结案',
-      TaskId: 2666002,
-    }]
-    // Toast.loading('正在获取数据', 0)
-    // fetchGet(API.APPCOMMON_TASKTODO)
-    //   .then(response => {
-    //     Toast.hide()
-    //     // console.log('123', response)
-    //     //message.success('保存成功')
-    //   }).catch(error => {
-    //     Toast.hide()
-    //     if (typeof error === 'string') {
-    //       message.error(error)
-    //     } else {
-    //       message.error('待办事项获取失败')
-    //     }
-    //   })
-
-    this.setState({
-      data: dataArr,
-    })
-
+    this.getListData()
   }
 
   componentWillUnmount () {
@@ -81,11 +39,51 @@ class TaskTodo extends Component {
       <div className="task-todo-page">
         <SearchBar placeholder='搜索'
                    onSubmit={value => this.onSubmit(value)}/>
-        <TaskTodoItem rowList={data}/>
+
+        <PullToRefresh
+          refreshing={this.state.refreshing}
+          onRefresh={this.refreshFunc}
+          className='report-func-root'
+        >
+          <TaskTodoItem rowList={data}/>
+        </PullToRefresh>
+
       </div>
     )
   }
 
+  getListData = () => {
+    Toast.loading('正在获取数据', 0)
+    fetchGet(API.APPCOMMON_TASKTODO)
+      .then(response => {
+        Toast.hide()
+        this.setState({
+          data: response.data.list,
+          refreshing: false,
+        })
+        message.success('请求成功')
+      }).catch(error => {
+      Toast.hide()
+      this.setState({
+        refreshing: false,
+      })
+      if (typeof error === 'string') {
+        message.error(error)
+      } else {
+        message.error('待办事项获取失败')
+      }
+    })
+  }
+
+  //下拉刷新
+  refreshFunc = () => {
+    this.setState({
+      refreshing: true,
+    })
+    this.getListData()
+  }
+
+  //回车搜索事件
   onSubmit = (value) => {
     //console.log(value)
   }

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

@@ -1,5 +1,5 @@
 .task-todo-page {
-  min-height: 500px;
+  height: 100vh;
   padding: 8px;
   background: @com-bg-color-lightGray;
 }