dev01 2 anni fa
parent
commit
47a01b3eab

+ 17 - 2
src/pages/applyDepart/publicContent.jsx

@@ -91,6 +91,16 @@ class PublicContent extends Component {
     });
   }
 
+  // 增加 省 市 区拼接,地址带区域的则把区域去掉
+  getArea() {
+    const { selectArrderLocation } = this.props
+    let pcd = selectArrderLocation.province + selectArrderLocation.city + selectArrderLocation.district
+    let str = selectArrderLocation.name
+    let index = str.lastIndexOf("区")
+    let name = str.substring(index + 1)
+    return pcd + name
+  }
+
   onSubmit() {
     if (!this.state.rangeStartMinuteVal) {
       Taro.showToast({ title: "请选择公出时间", icon: "none" });
@@ -131,6 +141,7 @@ class PublicContent extends Component {
     this.setState({
       loading: true,
     });
+    const { selectArrderLocation } = this.props
     let datas = {
       uid: this.props.enterpriseInfor.id,
       releaseStarts: this.state.rangeStartMinuteVal,
@@ -138,7 +149,11 @@ class PublicContent extends Component {
       remarks: this.state.reason,
       // plan: this.state.plan,
       // expectedEffect: this.state.expectedEffect,
-      userName: this.props.selectArrderLocation.name,
+      // userName: selectArrderLocation.province +
+      //   selectArrderLocation.city +
+      //   selectArrderLocation.district +
+      //   selectArrderLocation.name,
+      userName: this.getArea(),
       longitude: this.props.selectArrderLocation.longitude,
       latitude: this.props.selectArrderLocation.latitude,
       annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
@@ -537,7 +552,7 @@ class PublicContent extends Component {
         {
           this.props.enterpriseInfor.type === 0 &&
           <View className="tips">
-            技术协单,将统计相关的公出成本等
+            请与技术协商后,再发起协单,协单将统计公出成本等
           </View>
         }
         <View

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

@@ -574,7 +574,9 @@ class EgressDetails extends Component {
                     this.setState({
                       isInquiryOpened: true,
                       inquiryTitle: "提醒",
-                      inquiryContent: "您确定要撤销此申请吗?",
+                      inquiryContent: dtails.assist == 1
+                        ? "请与技术协单同事协商后再修改,因未协商就个人修改公出内容,产生的影响由个人承担!"
+                        : "您确定要撤销此申请吗?",
                       inquiryFn: () => {
                         this.oidApplication();
                       },
@@ -593,8 +595,9 @@ class EgressDetails extends Component {
                     this.setState({
                       isInquiryOpened: true,
                       inquiryTitle: "提醒",
-                      inquiryContent:
-                        "您确定修改此公出申请吗?确定修改,已完成的审核,将自动解除,重新转化为待审核状态!!!",
+                      inquiryContent: dtails.assist == 1
+                        ? "请与技术协单同事协商后再修改,因未协商就个人修改公出内容,产生的影响由个人承担!"
+                        : "您确定修改此公出申请吗?确定修改,已完成的审核,将自动解除,重新转化为待审核状态!!!",
                       inquiryFn: () => {
                         if (!this.state.reasonsInvalidation) {
                           Taro.showToast({

+ 17 - 0
src/pages/punchClock/index.less

@@ -91,6 +91,7 @@
     display: flex;
     flex-flow: column nowrap;
     align-items: center;
+    position: relative;
 
     .history {
       display: flex;
@@ -167,6 +168,22 @@
       align-self: flex-start;
     }
 
+    .photographUnusual {
+      width: 100px;
+      height: 100px;
+      box-shadow: 1px 1px 15px 1px red;
+      background: red;
+      border-radius: 50px;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      color: #FFFFFF;
+      position: absolute;
+      right: 30px;
+      top: 300px;
+
+    }
+
     .punchClockContent {
       width: 250px;
       height: 250px;

+ 138 - 62
src/pages/punchClock/punchClocks.jsx

@@ -1,8 +1,8 @@
 import React, { Component } from 'react'
 import { connect } from 'react-redux'
-import { Map, OpenData, View, Image, Text } from '@tarojs/components'
+import { Map, OpenData, View, Image, Text, Button } from '@tarojs/components'
 import Taro from '@tarojs/taro';
-import { AtIcon, AtModal } from "taro-ui";
+import { AtIcon, AtModal, AtModalContent, AtModalAction, AtTextarea, AtButton } from "taro-ui";
 import dayjs from 'dayjs';
 import Skeleton from 'taro-skeleton'
 
@@ -52,12 +52,15 @@ class PunchClocks extends Component {
       addressLongitude: '',
       distance: '',
       dtails: {},
-      loading: true
+      loading: true,
+      isAbnormalOpen: false,
+      clockInRemarks: "",//打卡说明
     }
     this.onChange = this.onChange.bind(this);
     this.getSpacing = this.getSpacing.bind(this);
     this.getData = this.getData.bind(this);
     this.publicReleaseClockIn = this.publicReleaseClockIn.bind(this);
+    this.abnormalClockIn = this.abnormalClockIn.bind(this);
     this.refresh = this.refresh.bind(this);
     this.getDtails = this.getDtails.bind(this);
   }
@@ -168,7 +171,7 @@ class PunchClocks extends Component {
     Taro.offLocationChange();
     this.nowTime && this.nowTime.clearTimeout();
   }
-
+  // 正常打卡
   publicReleaseClockIn() {
     if (this.state.dtails.status === 3) {
       Taro.hideLoading()
@@ -202,7 +205,8 @@ class PunchClocks extends Component {
     }
     publicReleaseClockIn({
       id: this.state.dtails.id,
-      photoUrl: this.state.imgs.join(',')
+      photoUrl: this.state.imgs.join(','),
+      clockIn: 1,
     }).then(v => {
       Taro.hideLoading()
       if (v.error.length === 0) {
@@ -224,7 +228,41 @@ class PunchClocks extends Component {
       })
     })
   }
-
+  // 异常打卡
+  abnormalClockIn() {
+    if (!this.state.clockInRemarks) {
+      Taro.showToast({ title: '请填写异常打卡原因!', icon: 'none' })
+      return;
+    }
+    Taro.showLoading({ title: '正在提交...' });
+    publicReleaseClockIn({
+      id: this.state.dtails.id,
+      photoUrl: this.state.imgs.join(','),
+      clockInRemarks: this.state.clockInRemarks,
+      clockIn: 2,
+    }).then(v => {
+      Taro.hideLoading()
+      if (v.error.length === 0) {
+        Taro.showToast({ title: '打卡成功', icon: 'none' });
+        this.imagePicker.clear();
+        this.state.dtails.clockIn = 1;
+        this.setState({
+          dtails: this.state.dtails,
+          imgs: [],
+          clockInRemarks: "",
+          isAbnormalOpen: false,
+        })
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: 'none' })
+      }
+    }).catch(() => {
+      Taro.hideLoading()
+      Taro.showToast({
+        title: '系统错误,请稍后再试',
+        icon: 'none'
+      })
+    })
+  }
   getData(fn) {
     this.setState({
       loading: true
@@ -377,7 +415,7 @@ class PunchClocks extends Component {
                     </View>
                     <View className='switchContent' onClick={() => {
                       Taro.switchTab({
-                        url: '/pages/examine/index',
+                        url: '/pages/mybusiness/index',
                       })
                     }}>
                       <View className='switchTitle'>切换打卡</View>
@@ -391,11 +429,13 @@ class PunchClocks extends Component {
         {
           Object.keys(this.state.dtails).length <= 0 ?
             <View className='content'>
-              <View className='punchClockContent' onClick={this.publicReleaseClockIn} style={{
-                boxShadow: '1px 1px 15px 1px #acb8ad',
-                background: '#828e83',
-                marginTop: '85px',
-              }}>
+              <View className='punchClockContent'
+                onClick={this.publicReleaseClockIn}
+                style={{
+                  boxShadow: '1px 1px 15px 1px #acb8ad',
+                  background: '#828e83',
+                  marginTop: '85px',
+                }}>
                 <View className='punchClockTitle'>公出打卡</View>
                 <View className='punchClockTime'>{this.state.nowTime}</View>
               </View>
@@ -442,44 +482,63 @@ class PunchClocks extends Component {
                 <View style={{ alignSelf: 'flex-start', width: '100%' }}>
                   <ImagePicker ref={ref => this.imagePicker = ref} url='/api/admin/release/upload' showAddBtn={false} onChange={this.onChange} />
                 </View>
-                <View className='punchClockContent' onClick={() => {
-                  let _this = this;
-                  Taro.showLoading({ title: '加载中...' })
-                  Taro.getSetting({
-                    success: (res) => {
-                      if (!res.authSetting['scope.userLocation']) {
-                        Taro.authorize({
-                          scope: 'scope.userLocation',
-                          success: () => {
-                            _this.publicReleaseClockIn();
-                          },
-                          fail: () => {
-                            Taro.hideLoading()
-                            this.setState({
-                              isOpened: true
-                            })
-                          }
-                        })
-                      } else {
-                        _this.publicReleaseClockIn();
+                {
+                  // dtails.type == 3 &&
+                  false &&
+                  <View
+                    className="photographUnusual"
+                    onClick={() => {
+                      if (this.state.imgs.length === 0) {
+                        Taro.hideLoading()
+                        Taro.showToast({ title: '请上传打卡照片', icon: 'none' })
+                        return;
                       }
-                    }
-                  })
-                }} style={{
-                  boxShadow:
-                    (!isNaN(parseInt(this.state.distance)))
-                      && this.state.distance <= this.wxConfig.clockInRange && this.state.distance >= 0 &&
+                      this.setState({
+                        isAbnormalOpen: true
+                      })
+                    }}
+                  >异常</View>
+                }
+                <View className='punchClockContent'
+                  onClick={() => {
+                    let _this = this;
+                    Taro.showLoading({ title: '加载中...' })
+                    Taro.getSetting({
+                      success: (res) => {
+                        if (!res.authSetting['scope.userLocation']) {
+                          Taro.authorize({
+                            scope: 'scope.userLocation',
+                            success: () => {
+                              _this.publicReleaseClockIn();
+                            },
+                            fail: () => {
+                              Taro.hideLoading()
+                              this.setState({
+                                isOpened: true
+                              })
+                            }
+                          })
+                        } else {
+                          _this.publicReleaseClockIn();
+                        }
+                      }
+                    })
+                  }}
+                  style={{
+                    boxShadow:
+                      (!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 ? '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 ? '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 ? '#3f82e8' : '#72cb78') : '#828e83'
+                  }}>
                   <View className='punchClockTitle'>
                     {
                       dtails.clockIn === 1 ?
@@ -495,12 +554,13 @@ class PunchClocks extends Component {
                     }}>
                       <Image src={Location} className='locationIcon' />
                     </View>
-                    <View className='punchRange' onClick={() => {
-                      this.mapCtx.moveToLocation({
-                        latitude: this.state.addressLatitude,
-                        longitude: this.state.addressLongitude,
-                      });
-                    }}>
+                    <View className='punchRange'
+                      onClick={() => {
+                        this.mapCtx.moveToLocation({
+                          latitude: this.state.addressLatitude,
+                          longitude: this.state.addressLongitude,
+                        });
+                      }}>
                       <Image src={PunchRange} className='punchRangeIcon' />
                     </View>
                   </View>
@@ -578,15 +638,31 @@ class PunchClocks extends Component {
           }}
           content='您拒绝了定位权限,请先前往设置打开定位权限'
         />
-        {this.state.historicalIsOpened ? <HistoricalClock
-          id={dtails.id}
-          isOpened={this.state.historicalIsOpened}
-          onClose={() => {
-            this.setState({
-              historicalIsOpened: false
-            })
-          }}
-        /> : null}
+        {/* 异常打卡原因 */}
+        <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}
+            isOpened={this.state.historicalIsOpened}
+            onClose={() => {
+              this.setState({
+                historicalIsOpened: false
+              })
+            }}
+          />}
       </View>
     )
   }