dev01 2 years ago
parent
commit
c9ef557955

+ 6 - 8
src/pages/egressDetails/index.jsx

@@ -483,9 +483,8 @@ class EgressDetails extends Component {
                 </View>
               </View>
             ) : null}
-            {dtails.permission === 1 &&
-              dtails.status === 1 &&
-              current !== "2" ? (
+            {dtails.status === 1 &&
+              current === "审核" ? (
               <View className="item">
                 <View className="title">
                   填写审批意见
@@ -505,9 +504,8 @@ class EgressDetails extends Component {
                 />
               </View>
             ) : null}
-            {dtails.permission === 1 &&
-              dtails.status === 1 &&
-              current !== "2" ? (
+            {dtails.status === 1 &&
+              current === "审核" ? (
               <View className="operation">
                 <AtButton
                   type="secondary"
@@ -550,7 +548,7 @@ class EgressDetails extends Component {
                 </AtButton>
               </View>
             ) : null}
-            {dtails.permission === 0 && dtails.status !== 3 && dtails.type !== 3 ? (
+            {current !== "审核" && dtails.permission === 0 && dtails.status !== 3 && dtails.type !== 3 ? (
               <View className="item" id={"reasons"}>
                 <View className="title">修改/撤销</View>
                 <AtTextarea
@@ -566,7 +564,7 @@ class EgressDetails extends Component {
                 />
               </View>
             ) : null}
-            {dtails.permission === 0 && dtails.status !== 3 && dtails.type !== 3 ? (
+            {current !== "审核" && dtails.permission === 0 && dtails.status !== 3 && dtails.type !== 3 ? (
               <View className="operation">
                 <Button
                   type="warn"

+ 104 - 37
src/pages/examine/index.jsx

@@ -1,15 +1,17 @@
 import React, { Component } from 'react';
 import Taro from '@tarojs/taro';
-import { View, Picker, ScrollView } from '@tarojs/components'
-import { getPublicReleaseList } from '../../utils/servers/servers';
+import { View, Picker, ScrollView, Button } from '@tarojs/components'
+import { getPublicReleaseList, techReject } from '../../utils/servers/servers';
 import dayjs from 'dayjs';
 import {
   AtSearchBar,
   AtTabs,
   AtTabsPane,
-  AtList,
-  AtListItem,
-  AtIcon
+  AtIcon,
+  AtModal,
+  AtModalContent,
+  AtModalAction,
+  AtTextarea
 } from 'taro-ui';
 import { clockState } from '../../utils/tools/config';
 
@@ -47,6 +49,11 @@ class Examine extends Component {
       rangeStartVal: '',
       rangeEndMinuteVal: '',
       rangeStartMinuteVal: '',
+
+      id: "",
+      rmk: "",
+      isOpen: false,
+
     }
     this.getPublicReleaseList = this.getPublicReleaseList.bind(this);
     this.getMyList = this.getMyList.bind(this);
@@ -140,7 +147,7 @@ class Examine extends Component {
           listState: 'NO_DATA'
         })
       } else if (msg.data.totalCount === this.state.list.length && pageNo !== 1) {
-        Taro.showToast({ title: '没有更多数据了', icon: 'none' });
+        !this.state.isOpen && Taro.showToast({ title: '没有更多数据了', icon: 'none' });
         this.setState({
           listState: 'NO_MORE_DATA'
         })
@@ -153,7 +160,7 @@ class Examine extends Component {
       }
       this.setState({
         list: pageNo === 1 ? msg.data.list : this.state.list.concat(msg.data.list),
-        pageNo: msg.data.pageNo
+        pageNo: msg.data.list.length === 0 ? this.state.pageNo : msg.data.pageNo
       })
     } else {
       Taro.showToast({ title: msg.error[0].message, icon: 'none' });
@@ -177,6 +184,36 @@ class Examine extends Component {
     }
   }
 
+  submit() {
+    if (!this.state.rmk) {
+      Taro.showToast({ title: '请填写备注!', icon: 'none' });
+      return
+    }
+    Taro.showLoading({ title: '正在提交...' });
+    techReject({
+      id: this.state.id,
+      remarks: this.state.rmk,
+    }).then(v => {
+      Taro.hideLoading()
+      if (v.error.length === 0) {
+        Taro.showToast({ title: '提交成功', icon: 'none' });
+        this.getPublicReleaseList();
+        this.setState({
+          isOpen: false,
+          rmk: "",
+        })
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: 'none' })
+      }
+    }).catch(() => {
+      Taro.hideLoading()
+      Taro.showToast({
+        title: '系统错误,请稍后再试',
+        icon: 'none'
+      })
+    })
+  }
+
   render() {
     return (
       <View className='indexPage' >
@@ -294,7 +331,6 @@ class Examine extends Component {
                     </View> : null
                 }
               </View>
-              {/*  */}
               {/* 多选时间框 */}
               <View className='searchItem' onClick={() => {
                 this.setState({
@@ -334,38 +370,11 @@ class Examine extends Component {
                   </View>
                 }
               </View>
-              <timePicker
-                config={{
-                  endDate: true,
-                  column: "minute",
-                  dateLimit: false,
-                  limitStartTime: dayjs().subtract(3, 'year').format('YYYY-MM-DD '),
-                  limitEndTime: dayjs().add(3, 'year').format('YYYY-MM-DD ')
-                }}
-                isPartition
-                pickerShow={this.state.isPickerRender}
-                onconditionaljudgment={(v) => {
-                  // let a = dayjs(dayjs(v.detail.endTime).second(0).format('YYYY-MM-DD'));
-                  // let b = dayjs(dayjs().second(0).format('YYYY-MM-DD'))
-                  // if(a.isBefore(b)){
-                  //   Taro.showToast({
-                  //     title:'结束时间不能小于当前时间',
-                  //     icon:'none'
-                  //   })
-                  //   v.detail.setLv(false);
-                  // }
-                }}
-                onhidepicker={() => {
-                  this.onPickerHide()
-                }}
-                onsetpickertime={(v) => {
-                  this.onSetPickerTime(v)
-                }}>
-              </timePicker>
             </View>
           </ScrollView>
         </View>
         <AtTabs
+          swipeable={false}
           current={this.state.current || 0}
           tabList={this.state.typeList}
           onClick={(current) => {
@@ -385,17 +394,75 @@ class Examine extends Component {
               >
                 <MyList
                   type={item.type}
+                  title={item.title}
                   typelist={this.state.typeList}
                   seeView={this.state.current}
                   list={this.state.list}
                   listState={this.state.listState}
                   onRefresh={() => {
                     this.getPublicReleaseList(true);
-                  }} />
+                  }}
+                  opens={e => {
+                    this.setState({
+                      id: e,
+                      isOpen: true,
+                    })
+                  }}
+                />
               </AtTabsPane>
             )
           }
         </AtTabs>
+        <timePicker
+          config={{
+            endDate: true,
+            column: "minute",
+            dateLimit: false,
+            limitStartTime: dayjs().subtract(3, 'year').format('YYYY-MM-DD '),
+            limitEndTime: dayjs().add(3, 'year').format('YYYY-MM-DD ')
+          }}
+          isPartition
+          pickerShow={this.state.isPickerRender}
+          onconditionaljudgment={(v) => {
+            // let a = dayjs(dayjs(v.detail.endTime).second(0).format('YYYY-MM-DD'));
+            // let b = dayjs(dayjs().second(0).format('YYYY-MM-DD'))
+            // if(a.isBefore(b)){
+            //   Taro.showToast({
+            //     title:'结束时间不能小于当前时间',
+            //     icon:'none'
+            //   })
+            //   v.detail.setLv(false);
+            // }
+          }}
+          onhidepicker={() => {
+            this.onPickerHide()
+          }}
+          onsetpickertime={(v) => {
+            this.onSetPickerTime(v)
+          }}>
+        </timePicker>
+        {/* 驳回协单 */}
+        {
+          this.state.isOpen &&
+          <AtModal
+            isOpened={this.state.isOpen}
+          >
+            <AtModalContent>
+              <AtTextarea
+                value={this.state.rmk}
+                onChange={e => {
+                  this.setState({ rmk: e })
+                }}
+                maxLength={200}
+                placeholder='请填写备注~'
+              />
+            </AtModalContent>
+            <AtModalAction>
+              <Button type='secondary' onClick={() => { this.setState({ isOpen: false }) }}>取消</Button>
+              <Button type='primary' onClick={this.submit.bind(this)}>提交</Button>
+            </AtModalAction>
+          </AtModal>
+        }
       </View>
     )
   }

+ 4 - 4
src/pages/examine/myList.jsx

@@ -30,7 +30,7 @@ class MyList extends Component {
               className="item"
               onClick={() => {
                 Taro.navigateTo({
-                  url: "/pages/egressDetails/index?id=" + v.id + "&index=" + k + "&status=" + seeView,
+                  url: "/pages/egressDetails/index?id=" + v.id + "&index=" + k + "&status=" + title,
                 });
               }}
             >
@@ -49,7 +49,7 @@ class MyList extends Component {
                 <View className="userName">
                   公出企业:{v.nickname}
                   {
-                    (title == "我的协单" && v.status !== 3) &&
+                    (title == "我的协单" || title === "查看协单") && v.status === 2 &&
                     <View
                       className="reject"
                       onClick={e => {
@@ -77,7 +77,7 @@ class MyList extends Component {
                         });
                       }}
                     >
-                      {v.clockIn === 1 ? "更新打卡" : "去打卡"}
+                      {(v.clockIn === 1 || v.clockIn === 2) ? "更新打卡" : "去打卡"}
                     </View>
                   ) : null}
                 </View>
@@ -98,7 +98,7 @@ class MyList extends Component {
                     className="status"
                     style={{ color: getClockState(v.status).color, }}
                   >
-                    {!!v.rejectName && v.rejectName}{getClockState(v.status).title}
+                    {(v.status === 0 || v.status === 4) && v.rejectName}{getClockState(v.status).title}
                   </View>
                 </View>
               </View>

+ 52 - 48
src/pages/mybusiness/index.jsx

@@ -158,7 +158,7 @@ class Examine extends Component {
       }
       this.setState({
         list: pageNo === 1 ? msg.data.list : this.state.list.concat(msg.data.list),
-        pageNo: msg.data.pageNo
+        pageNo: msg.data.list.length === 0 ? this.state.pageNo : msg.data.pageNo
       })
     } else {
       Taro.showToast({ title: msg.error[0].message, icon: 'none' });
@@ -198,6 +198,7 @@ class Examine extends Component {
         this.getPublicReleaseList();
         this.setState({
           isOpen: false,
+          rmk: "",
         })
       } else {
         Taro.showToast({ title: v.error[0].message, icon: 'none' })
@@ -368,38 +369,11 @@ class Examine extends Component {
                   </View>
                 }
               </View>
-              <timePicker
-                config={{
-                  endDate: true,
-                  column: "minute",
-                  dateLimit: false,
-                  limitStartTime: dayjs().subtract(3, 'year').format('YYYY-MM-DD '),
-                  limitEndTime: dayjs().add(3, 'year').format('YYYY-MM-DD ')
-                }}
-                isPartition
-                pickerShow={this.state.isPickerRender}
-                onconditionaljudgment={(v) => {
-                  // let a = dayjs(dayjs(v.detail.endTime).second(0).format('YYYY-MM-DD'));
-                  // let b = dayjs(dayjs().second(0).format('YYYY-MM-DD'))
-                  // if(a.isBefore(b)){
-                  //   Taro.showToast({
-                  //     title:'结束时间不能小于当前时间',
-                  //     icon:'none'
-                  //   })
-                  //   v.detail.setLv(false);
-                  // }
-                }}
-                onhidepicker={() => {
-                  this.onPickerHide()
-                }}
-                onsetpickertime={(v) => {
-                  this.onSetPickerTime(v)
-                }}>
-              </timePicker>
             </View>
           </ScrollView>
         </View>
         <AtTabs
+          swipeable={false}
           current={this.state.current || 0}
           tabList={this.state.typeList}
           onClick={(current) => {
@@ -438,26 +412,56 @@ class Examine extends Component {
             )
           }
         </AtTabs>
+        <timePicker
+          config={{
+            endDate: true,
+            column: "minute",
+            dateLimit: false,
+            limitStartTime: dayjs().subtract(3, 'year').format('YYYY-MM-DD '),
+            limitEndTime: dayjs().add(3, 'year').format('YYYY-MM-DD ')
+          }}
+          isPartition
+          pickerShow={this.state.isPickerRender}
+          onconditionaljudgment={(v) => {
+            // let a = dayjs(dayjs(v.detail.endTime).second(0).format('YYYY-MM-DD'));
+            // let b = dayjs(dayjs().second(0).format('YYYY-MM-DD'))
+            // if(a.isBefore(b)){
+            //   Taro.showToast({
+            //     title:'结束时间不能小于当前时间',
+            //     icon:'none'
+            //   })
+            //   v.detail.setLv(false);
+            // }
+          }}
+          onhidepicker={() => {
+            this.onPickerHide()
+          }}
+          onsetpickertime={(v) => {
+            this.onSetPickerTime(v)
+          }}>
+        </timePicker>
         {/* 驳回协单 */}
-        <AtModal
-          style={{ position: 'fixed' }}
-          isOpened={this.state.isOpen}
-        >
-          <AtModalContent>
-            <AtTextarea
-              value={this.state.rmk}
-              onChange={e => {
-                this.setState({ rmk: e })
-              }}
-              maxLength={200}
-              placeholder='请填写备注~'
-            />
-          </AtModalContent>
-          <AtModalAction>
-            <Button type='secondary' onClick={() => { this.setState({ isOpen: false }) }}>取消</Button>
-            <Button type='primary' onClick={this.submit.bind(this)}>提交</Button>
-          </AtModalAction>
-        </AtModal>
+        {
+          this.state.isOpen &&
+          <AtModal
+            isOpened={this.state.isOpen}
+          >
+            <AtModalContent>
+              <AtTextarea
+                value={this.state.rmk}
+                onChange={e => {
+                  this.setState({ rmk: e })
+                }}
+                maxLength={200}
+                placeholder='请填写备注~'
+              />
+            </AtModalContent>
+            <AtModalAction>
+              <Button type='secondary' onClick={() => { this.setState({ isOpen: false }) }}>取消</Button>
+              <Button type='primary' onClick={this.submit.bind(this)}>提交</Button>
+            </AtModalAction>
+          </AtModal>
+        }
       </View>
     )
   }

+ 1 - 1
src/pages/punchClock/index.less

@@ -172,11 +172,11 @@
       width: 100px;
       height: 100px;
       box-shadow: 1px 1px 15px 1px red;
-      background: red;
       border-radius: 50px;
       display: flex;
       align-items: center;
       justify-content: center;
+      font-size: 20px;
       color: #FFFFFF;
       position: absolute;
       right: 30px;

+ 24 - 20
src/pages/punchClock/punchClocks.jsx

@@ -245,7 +245,7 @@ class PunchClocks extends Component {
       if (v.error.length === 0) {
         Taro.showToast({ title: '打卡成功', icon: 'none' });
         this.imagePicker.clear();
-        this.state.dtails.clockIn = 1;
+        this.state.dtails.clockIn = 2;
         this.setState({
           dtails: this.state.dtails,
           imgs: [],
@@ -484,9 +484,10 @@ class PunchClocks extends Component {
                 </View>
                 {
                   // dtails.type == 3 &&
-                  // false &&
+                  false &&
                   <View
                     className="photographUnusual"
+                    style={{ background: dtails.clockIn === 1 ? "#f69c9f" : "red" }}
                     onClick={() => {
                       if (this.state.imgs.length === 0) {
                         Taro.hideLoading()
@@ -497,7 +498,7 @@ class PunchClocks extends Component {
                         isAbnormalOpen: true
                       })
                     }}
-                  >异常</View>
+                  >{(dtails.clockIn === 1 && dtails.clockIn === 2) ? "刷新打卡" : "异常打卡"}</View>
                 }
                 <View className='punchClockContent'
                   onClick={() => {
@@ -530,18 +531,18 @@ class PunchClocks extends Component {
                         && this.state.distance <= this.wxConfig.clockInRange && this.state.distance >= 0 &&
                         !(dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds)) &&
                         dtails.status !== 3
-                        ? (dtails.clockIn === 1 ? '1px 1px 15px 1px #3f82e8' : '1px 1px 15px 1px #659268') : '1px 1px 15px 1px #828e83',
+                        ? ((dtails.clockIn === 1 && dtails.clockIn === 2) ? '1px 1px 15px 1px #3f82e8' : '1px 1px 15px 1px #659268') : '1px 1px 15px 1px #828e83',
                     background: (!isNaN(parseInt(this.state.distance)))
                       &&
                       this.state.distance <= this.wxConfig.clockInRange &&
                       this.state.distance >= 0 &&
                       !(dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds)) &&
                       dtails.status !== 3
-                      ? (dtails.clockIn === 1 ? '#3f82e8' : '#72cb78') : '#828e83'
+                      ? ((dtails.clockIn === 1 && dtails.clockIn === 2) ? '#3f82e8' : '#72cb78') : '#828e83'
                   }}>
                   <View className='punchClockTitle'>
                     {
-                      dtails.clockIn === 1 ?
+                      (dtails.clockIn === 1 && dtails.clockIn === 2) ?
                         '刷新打卡' : '公出打卡'
                     }
                   </View>
@@ -639,20 +640,23 @@ class PunchClocks extends Component {
           content='您拒绝了定位权限,请先前往设置打开定位权限'
         />
         {/* 异常打卡原因 */}
-        <AtModal isOpened={this.state.isAbnormalOpen}>
-          <AtModalContent>
-            <AtTextarea
-              value={this.state.clockInRemarks}
-              onChange={e => { this.setState({ clockInRemarks: e }) }}
-              maxLength={200}
-              placeholder='请填写异常打卡原因~'
-            />
-          </AtModalContent>
-          <AtModalAction>
-            <Button type='secondary' onClick={() => { this.setState({ isAbnormalOpen: false }) }}>取消</Button>
-            <Button type='primary' onClick={this.abnormalClockIn}>提交</Button>
-          </AtModalAction>
-        </AtModal>
+        {
+          this.state.isAbnormalOpen &&
+          <AtModal isOpened={this.state.isAbnormalOpen}>
+            <AtModalContent>
+              <AtTextarea
+                value={this.state.clockInRemarks}
+                onChange={e => { this.setState({ clockInRemarks: e }) }}
+                maxLength={200}
+                placeholder='请填写异常打卡原因~'
+              />
+            </AtModalContent>
+            <AtModalAction>
+              <Button type='secondary' onClick={() => { this.setState({ isAbnormalOpen: false }) }}>取消</Button>
+              <Button type='primary' onClick={this.abnormalClockIn}>提交</Button>
+            </AtModalAction>
+          </AtModal>
+        }
         {this.state.historicalIsOpened &&
           <HistoricalClock
             id={dtails.id}

+ 2 - 2
src/utils/config.js

@@ -1,7 +1,7 @@
 //
 // export const resourceAddress = 'http://172.16.0.255:3000/upload;'
 // 生产
-// export const resourceAddress = 'https://s.jishutao.com/upload';
+export const resourceAddress = 'https://s.jishutao.com/upload';
 // 测试
-export const resourceAddress = 'https://static.jishutao.com/upload';
+// export const resourceAddress = 'https://static.jishutao.com/upload';
 

+ 2 - 2
src/utils/servers/baseUrl.js

@@ -8,8 +8,8 @@ const getBaseUrl = (url) => {
   } else {
     // 生产环境
     // BASE_URL = 'http://172.16.0.255:8080'
-    BASE_URL = 'https://uat.jishutao.com'
-    // BASE_URL = 'https://bm.jishutao.com'
+    // BASE_URL = 'https://uat.jishutao.com'
+    BASE_URL = 'https://bm.jishutao.com'
   }
   return BASE_URL
 }

+ 12 - 1
src/utils/servers/utils.js

@@ -1,4 +1,4 @@
-import Taro,{getCurrentPages} from "@tarojs/taro";
+import Taro, { getCurrentPages } from "@tarojs/taro";
 import { login } from '../../utils/servers/servers'
 /**
  * @description 获取当前页url
@@ -43,3 +43,14 @@ export const pageToLogin = async () => {
   //
   // }
 }
+
+export const throttle = (cd, time = 2000) => {
+  var t = null;
+  return function () {
+    if (t) return;
+    t = setTimeout(() => {
+      cd.call(this);
+      t = null;
+    }, time);
+  }
+}