Browse Source

技术公出逻辑

dev01 11 months ago
parent
commit
345c54656a

+ 2 - 2
src/app.jsx

@@ -87,9 +87,9 @@ class App extends Component {
         'token': token,
       },
       // 生产
-      // url: 'wss://bm.jishutao.com/webSocketServer',
+      url: 'wss://bm.jishutao.com/webSocketServer',
       // 本地
-      url: 'wss://172.16.0.255:8080/webSocketServer'
+      // url: 'wss://172.16.0.255:8080/webSocketServer'
       // 测试
       // url: 'wss://uat.jishutao.com/webSocketServer'
     })

+ 3 - 3
src/pages/applyDepart/publicContent.jsx

@@ -200,7 +200,7 @@ class PublicContent extends Component {
             isShow: this.props.enterpriseInfor.type == 0
               ? isTips(this.props.enterpriseInfor.list) : this.props.enterpriseInfor.type == 1
                 ? this.state.isNewshow : false,
-            list: getList(this.props.enterpriseInfor.list, "aname", true) || []
+            list: getList(this.props.enterpriseInfor.type, this.props.enterpriseInfor.list, "aname", true) || []
           }
         }
         if (v.error.length === 0) {
@@ -351,7 +351,7 @@ class PublicContent extends Component {
                     {["原则上技术人员不可下户", `本次申请,已超出${obj.durationMax}小时`, `本次公出申请,已超出${obj.durationMax}小时`, `本次公出申请,已超出${obj.durationMax}小时`, ""][obj.amountType]}
                   </Text>。
                 </View>
-                <View>如需公出,需<Text style={{ color: 'red' }}>{obj.adminName}</Text>同意后,方可公出。</View>
+                <View>如需公出,需<Text style={{ color: 'red' }}>{obj.adminName}</Text>审核。</View>
                 <View>请确定,是否发起公出申请!</View>
               </View>,
               inquiryFn: () => {
@@ -401,7 +401,7 @@ class PublicContent extends Component {
         {
           (this.props.enterpriseInfor.type == 0 && isTips(this.props.enterpriseInfor.list)) &&
           <View className="othersTips">您正在申请公出他人企业:需跟单员“
-            {getList(this.props.enterpriseInfor.list, "aname", true).toString()}
+            {getList(this.props.enterpriseInfor.type, this.props.enterpriseInfor.list, "aname", true).toString()}
             ”审核同意,您才可公出!</View>
         }
         <View className="formItem">

+ 3 - 3
src/pages/applyDepart/result.jsx

@@ -57,18 +57,18 @@ class Result extends Component {
             {this.props.tipList.toString()}
             ”审核同意,才可以打卡!!!</View>
         }
-        {
+        {/* {
           this.props.isShow && this.props.type == 1 &&
           <View className="resultTips">已发出公出申请!待“
             {this.props.tipList.toString()}
             ”审核通过,方可打卡!</View>
-        }
+        } */}
         <View className='resultOperation'>
           <AtButton circle onClick={this.determine}>
             再次发起
           </AtButton>
           {
-            !this.props.isShow &&
+            (!this.props.isShow || this.props.type == 1) &&
             <AtButton circle type='primary' onClick={this.punchClock}>
               前往打卡
             </AtButton>

+ 56 - 27
src/pages/egressDetails/publicContent.jsx

@@ -50,6 +50,7 @@ class PublicContent extends Component {
       popup: false,
       coorderList: [],
       cList: [],
+      isNewshow: false,
     };
     this.onSubmit = this.onSubmit.bind(this);
     this.selectArrder = this.selectArrder.bind(this);
@@ -514,9 +515,8 @@ class PublicContent extends Component {
       popup: !this.state.popup
     })
   }
-
   // 技术公出逻辑判断
-  checkOrderNoDuration() {
+  checkOrderNoDuration(type) {
     const _this = this
     if (this.state.totalDuration == 0) {
       Taro.showToast({ title: "请选择公出时间", icon: "none" });
@@ -544,11 +544,13 @@ class PublicContent extends Component {
                     {["原则上技术人员不可下户", `本次申请,已超出${obj.durationMax}小时`, `本次公出申请,已超出${obj.durationMax}小时`, `本次公出申请,已超出${obj.durationMax}小时`, ""][obj.amountType]}
                   </Text>。
                 </View>
-                <View>如需公出,需<Text style={{ color: 'red' }}>{obj.adminName}</Text>同意后,方可公出。</View>
+                <View>如需公出,需<Text style={{ color: 'red' }}>{obj.adminName}</Text>审核。</View>
                 <View>请确定,是否发起公出申请!</View>
               </View>,
               inquiryFn: () => {
-                _this.onSubmit();
+                type == 1
+                  ? _this.onSubmit() : type == 2
+                    ? _this.goAgain() : console.log("-")
               },
             })
           } else {
@@ -558,7 +560,9 @@ class PublicContent extends Component {
               inquiryTitle: "提醒",
               inquiryContent: "您确定要提交此申请吗?",
               inquiryFn: () => {
-                _this.onSubmit();
+                type == 1
+                  ? _this.onSubmit() : type == 2
+                    ? _this.goAgain() : console.log("-")
               },
             })
           }
@@ -573,8 +577,12 @@ class PublicContent extends Component {
 
   render() {
     const { dtails, type, again = false } = this.props;
-    const { cList, coorderList, popup } = this.state
+    const { cList, coorderList, popup } = this.state;
     const info = Taro.getStorageSync("userInfor");
+    const isShow = dtails.type == 0
+      ? isTips(dtails.peList) : dtails.type == 1
+        ? this.state.isNewshow : false;
+    const tipList = getList(dtails.type, dtails.peList, "aname", true) || [];
     return (
       <View className="publicContent">
         <View className="formItem">
@@ -591,7 +599,7 @@ class PublicContent extends Component {
         {
           (dtails.type == 0 && !!dtails.newList && isTips(dtails.newList)) &&
           <View className="othersTips">您正在申请公出他人企业:需跟单员“
-            {getList(dtails.newList, "aname", true).toString()}
+            {getList(dtails.type, dtails.newList, "aname", true).toString()}
             ”审核同意,您才可公出!</View>
         }
         <View className="formItem">
@@ -954,14 +962,16 @@ class PublicContent extends Component {
                 loading={this.state.loading}
                 circle
                 onClick={() => {
-                  this.setState({
-                    isInquiryOpened: true,
-                    inquiryTitle: "提醒",
-                    inquiryContent: "您确定要提交此申请吗?",
-                    inquiryFn: () => {
-                      this.goAgain();
-                    },
-                  });
+                  dtails.type == 1
+                    ? this.checkOrderNoDuration(2)
+                    : this.setState({
+                      isInquiryOpened: true,
+                      inquiryTitle: "提醒",
+                      inquiryContent: "您确定要提交此申请吗?",
+                      inquiryFn: () => {
+                        this.goAgain();
+                      },
+                    });
                 }}
               >
                 确定
@@ -994,7 +1004,7 @@ class PublicContent extends Component {
                 circle
                 onClick={() => {
                   dtails.type == 1
-                    ? this.checkOrderNoDuration()
+                    ? this.checkOrderNoDuration(1)
                     : this.setState({
                       isInquiryOpened: true,
                       inquiryTitle: "提醒",
@@ -1066,22 +1076,41 @@ class PublicContent extends Component {
           >
             <View className='result'>
               <View className='resultIcon'>
-                <Icon size='80' type='success' />
+                {
+                  isShow
+                    ? <Icon size='80' type='warn' color='#ff9900' />
+                    : <Icon size='80' type='success' />
+                }
               </View>
               <View className='resultTitle'>
-                <View>申请成功,可以打卡了!</View>
+                <View>申请成功{!isShow && ",可以打卡了!"}</View>
                 <View className='resultError'></View>
               </View>
+              {
+                isShow && dtails.type != 1 &&
+                <View className="resultTips">公出他人企业,需跟单人员“
+                  {tipList.toString()}
+                  ”审核同意,才可以打卡!!!</View>
+              }
+              {/* {
+                isShow && dtails.type == 1 &&
+                <View className="resultTips">已发出公出申请!待“
+                  {tipList.toString()}
+                  ”审核通过,方可打卡!</View>
+              } */}
               <View className='resultOperation'>
-                <AtButton circle type='primary' onClick={() => {
-                  this.props.onClose();
-                  Taro.eventCenter.trigger("GoPunchIn", this.state.goDatas);
-                  Taro.switchTab({
-                    url: '/pages/punchClock/index',
-                  })
-                }}>
-                  前往打卡
-                </AtButton>
+                {
+                  (!isShow || dtails.type == 1) &&
+                  <AtButton circle type='primary' onClick={() => {
+                    this.props.onClose();
+                    Taro.eventCenter.trigger("GoPunchIn", this.state.goDatas);
+                    Taro.switchTab({
+                      url: '/pages/punchClock/index',
+                    })
+                  }}>
+                    前往打卡
+                  </AtButton>
+                }
                 <AtButton type='secondary' circle onClick={() => {
                   this.props.onClose();
                   this.state.goId &&

+ 19 - 6
src/pages/egressDetails/publicContent.less

@@ -68,7 +68,7 @@
     }
   }
 
-  .othersTips{
+  .othersTips {
     font-size: 28px;
     text-align: center;
     color: #f00;
@@ -93,25 +93,38 @@
   }
 }
 
-.result{
+.result {
   display: flex;
   flex-flow: column nowrap;
   align-items: center;
   padding-top: 83px;
   height: 506px;
-  .resultIcon{
+
+  .resultIcon {
     padding-bottom: 20px;
   }
-  .resultTitle{
+
+  .resultTitle {
     padding: 0 30px 30px 30px;
     text-align: center;
-    .resultError{
+
+    .resultError {
       font-size: 20px;
       color: #969696;
       padding-top: 15px;
     }
   }
-  .resultOperation{
+
+  .resultTips {
+    font-size: 24px;
+    text-align: center;
+    color: #f00;
+    background: #c9c9c9;
+    padding: 20px 100px;
+    margin-bottom: 40px;
+  }
+
+  .resultOperation {
     display: flex;
     flex-flow: row nowrap;
     align-items: center;

+ 67 - 36
src/pages/punchClock/punchClocks.jsx

@@ -48,7 +48,9 @@ class PunchClocks extends Component {
       addressLongitude: '',
       distance: '',
       dtails: {},
-      data: {},
+      data: {
+        prdcList: []
+      },
       loading: true,
       isAbnormalOpen: false,
       clockInRemarks: "",//打卡说明
@@ -233,13 +235,13 @@ class PunchClocks extends Component {
 
   // 正常打卡
   publicReleaseClockIn(uid) {
-
-    if (this.state.dtails.status === 3) {
+    const { dtails } = this.state
+    if (dtails.status === 3) {
       Taro.hideLoading()
       Taro.showToast({ title: '申请已撤销,无法打卡', icon: 'none' });
       return;
     }
-    if (Object.keys(this.state.dtails).length === 0) {
+    if (Object.keys(dtails).length === 0) {
       Taro.hideLoading()
       Taro.showToast({ title: '暂无公出申请,无法打卡', icon: 'none' });
       return;
@@ -249,7 +251,7 @@ class PunchClocks extends Component {
       Taro.showToast({ title: '定位错误,请联系管理员', icon: 'none' })
       return;
     }
-    if (dayjs().isBefore(this.state.dtails.releaseStarts) || dayjs().isAfter(this.state.dtails.releaseEnds)) {
+    if (dayjs().isBefore(dtails.releaseStarts) || dayjs().isAfter(dtails.releaseEnds)) {
       Taro.hideLoading()
       Taro.showToast({ title: '当前时间不在打卡时间范围内,无法打卡', icon: 'none' })
       return;
@@ -259,6 +261,16 @@ class PunchClocks extends Component {
       Taro.showToast({ title: '当前位置未处于可打卡范围,无法打卡', icon: 'none' })
       return;
     }
+    // if (dtails.type == 0 && (dtails.publicType == 1 || dtails.publicType == 3)) {
+    //   Taro.hideLoading()
+    //   Taro.showToast({ title: '公出他人企业!需通过审核,才可打卡!', icon: 'none' });
+    //   return
+    // }
+    // if (dtails.type == 1 && (dtails.techStartProcess == 1 || dtails.techStartProcess == 3)) {
+    //   Taro.hideLoading()
+    //   Taro.showToast({ title: '已超过合同规定时限,需审核通过,才可打卡!', icon: 'none' });
+    //   return
+    // }
     if (this.state.imgs.length === 0) {
       Taro.hideLoading()
       Taro.showToast({ title: '请上传打卡照片', icon: 'none' })
@@ -266,16 +278,23 @@ class PunchClocks extends Component {
     }
 
     publicReleaseClockIn({
-      id: this.state.dtails.id,
+      id: dtails.id,
       photoUrl: this.state.imgs.join(','),
       clockIn: 1,
       uid: this.state.data.uid,
     }).then(v => {
       Taro.hideLoading()
       if (v.error.length === 0) {
-        Taro.showToast({ title: '打卡成功', icon: 'none' });
+        Taro.showToast({
+          title: dtails.type == 1
+            ? ((dtails.techStartProcess == 1 || dtails.techStartProcess == 3)
+              ? '打卡成功!此次公出未通过营销审核!'
+              : '打卡成功!')
+            : '打卡成功!',
+          icon: 'none'
+        });
         this.imagePicker.clear();
-        this.state.data.clockIn = 1;
+        this.state.data.prdcList[0].status = 1;
         this.setState({
           data: this.state.data,
           imgs: []
@@ -309,7 +328,7 @@ class PunchClocks extends Component {
       if (v.error.length === 0) {
         Taro.showToast({ title: '打卡成功', icon: 'none' });
         this.imagePicker.clear();
-        this.state.data.clockIn = 2;
+        this.state.data.prdcList[0].status = 2;
         this.setState({
           data: this.state.data,
           imgs: [],
@@ -423,6 +442,7 @@ class PunchClocks extends Component {
 
   render() {
     const { dtails, data } = this.state;
+    const newClockIn = !!data.prdcList && data.prdcList.length > 0 ? data.prdcList[0] : {};
     return (
       <View className='punchClock'>
         <View className='header'>
@@ -446,16 +466,6 @@ class PunchClocks extends Component {
                       dtails.aname
                   }
                 </View>
-                {/* <View className='address'>
-                  公出企业:
-                  <View className='nickname'>
-                    {
-                      Object.keys(dtails).length <= 0 ?
-                        '无' :
-                        dtails.userNames
-                    }
-                  </View>
-                </View> */}
                 <View className='types'
                   style={{ color: ["#1D4FEA", "#1E90FF", "#FF5500", "red"][dtails.type] }}
                 >
@@ -527,7 +537,7 @@ class PunchClocks extends Component {
                   <View className='userlist'>
                     <Text className='username'>
                       {data.userName}
-                      {(data.clockIn === 1 || data.clockIn === 2) && <Text style={{ color: "#72cb78" }}>(已打卡)</Text>}
+                      {(newClockIn.status === 1 || newClockIn.status === 2) && <Text style={{ color: "#72cb78" }}>(已打卡)</Text>}
                     </Text>
                     {
                       this.state.dtails.prdList?.length > 1 &&
@@ -572,7 +582,7 @@ class PunchClocks extends Component {
                   false &&
                   <View
                     className="photographUnusual"
-                    style={{ background: data.clockIn === 1 ? "#f69c9f" : "red" }}
+                    style={{ background: newClockIn.status === 1 ? "#f69c9f" : "red" }}
                     onClick={() => {
                       if (this.state.imgs.length === 0) {
                         Taro.hideLoading()
@@ -583,9 +593,8 @@ class PunchClocks extends Component {
                         isAbnormalOpen: true
                       })
                     }}
-                  >{(data.clockIn === 1 || data.clockIn === 2) ? "更新打卡" : "异常打卡"}</View>
+                  >{(newClockIn.status === 1 || newClockIn.status === 2) ? "更新打卡" : "异常打卡"}</View>
                 }
-
                 <View className='punchClockContent'
                   onClick={() => {
                     let _this = this;
@@ -613,22 +622,35 @@ class PunchClocks extends Component {
                   }}
                   style={{
                     boxShadow:
+                      // (dtails.type == 1 && (dtails.techStartProcess == 1 || dtails.techStartProcess == 3))
+                      //   ? '1px 1px 15px 1px #828e83'
+                      //   : (dtails.type == 0 && (dtails.publicType == 1 || dtails.publicType == 3))
+                      //     ? '1px 1px 15px 1px #828e83'
+                      //     : 
+                      (!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
+                        ? ((newClockIn.status === 1 || newClockIn.status === 2) ? '1px 1px 15px 1px #3f82e8' : '1px 1px 15px 1px #72cb78')
+                        : '1px 1px 15px 1px #828e83',
+                    background:
+                      // (dtails.type == 1 && (dtails.techStartProcess == 1 || dtails.techStartProcess == 3))
+                      //   ? '#828e83'
+                      //   : (dtails.type == 0 && (dtails.publicType == 1 || dtails.publicType == 3))
+                      //     ? '#828e83'
+                      //     : 
                       (!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
-                        ? ((data.clockIn === 1 || data.clockIn === 2) ? '1px 1px 15px 1px #3f82e8' : '1px 1px 15px 1px #72cb78') : '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
-                      ? ((data.clockIn === 1 || data.clockIn === 2) ? '#3f82e8' : '#72cb78') : '#828e83'
+                        && 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
+                        ? ((newClockIn.status === 1 || newClockIn.status === 2) ? '#3f82e8' : '#72cb78')
+                        : '#828e83'
                   }}>
                   <View className='punchClockTitle'>
                     {
-                      (data.clockIn === 1 || data.clockIn === 2) ?
+                      (newClockIn.status === 1 || newClockIn.status === 2) ?
                         '更新打卡' : '公出打卡'
                     }
                   </View>
@@ -655,7 +677,16 @@ class PunchClocks extends Component {
                     <Text className='stxt' onClick={this.selectArrder}>切换位置</Text>
                   </View>
                 }
-
+                {/* {
+                  !(this.state.distance <= this.wxConfig.clockInRange && this.state.distance >= 0) ?
+                    <View className='switchposition'>您不在打卡范围:
+                      <Text className='stxt' onClick={this.selectArrder}>切换位置</Text>
+                    </View> : (dtails.type == 0 && (dtails.publicType == 1 || dtails.publicType == 3)) ?
+                      <View className='switchposition'>公出他人企业!需通过审核,才可打卡!</View>
+                      : (dtails.type == 1 && (dtails.techStartProcess == 1 || dtails.techStartProcess == 3)) ?
+                        <View className='switchposition'>已超过合同规定时限,需审核通过,才可打卡!</View>
+                        : null
+                } */}
                 <View className='map'>
                   <View className='locationContent'>
                     <View className='location' onClick={() => {

+ 2 - 2
src/utils/config.js

@@ -1,7 +1,7 @@
 // 本地
-export const resourceAddress = 'http://172.16.0.255:3000/upload;'
+// 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';
 

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

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

+ 13 - 3
src/utils/tools/index.js

@@ -166,17 +166,27 @@ export const getNewList = (uids, unames) => {
 export const getNewOptions = (arr) => {
   let list = []
   for (var i = 0; i < arr.length; i++) {
-    list.push({ label: arr[i].userName, value: arr[i].uid, desc: arr[i].clockIn == 1 ? "(已打卡)" : "(未打卡)" })
+    list.push({
+      label: arr[i].userName,
+      value: arr[i].uid,
+      desc: arr[i].prdcList.length == 0
+        ? "(不在打卡时间范围)"
+        : (arr[i].prdcList[0].status == 1 ? "(今日已打卡)" : "(今日未打卡)")
+    })
   }
   return list
 }
 
 // 提取数组里的某一项组成新数组(公出他人企业限制)
-export const getList = (arr, name, isUnique = false) => {
+export const getList = (type, arr, name, isUnique = false) => {
   let list = []
   for (var i = 0; i < arr.length; i++) {
-    if (arr[i].status == 1) {
+    if (type == 1) {
       list.push(arr[i][name])
+    } else {
+      if (arr[i].status == 1) {
+        list.push(arr[i][name])
+      }
     }
   }
   // 去重