Bladeren bron

再次公出

dev01 2 jaren geleden
bovenliggende
commit
9656b7a633

+ 6 - 2
src/components/common/inquiryModal/index.jsx

@@ -10,12 +10,16 @@ class InquiryModal extends Component {
   }
 
   render() {
-    const { color = "black", isNo = true } = this.props;
+    const { color = "black", isNo = true, isChildren = false } = this.props;
     return (
       <AtModal isOpened={this.props.isOpened}>
         <AtModalHeader>{this.props.title || "提示"}</AtModalHeader>
         <AtModalContent>
-          <View style={{ color: color }}>{this.props.content || ""}</View>
+          {
+            isChildren
+              ? this.props.children
+              : <View style={{ color: color }}>{this.props.content || ""}</View>
+          }
         </AtModalContent>
         <AtModalAction>
           {isNo && <Button onClick={this.props.onClose}>取消</Button>}

+ 271 - 63
src/pages/egressDetails/publicContent.jsx

@@ -1,6 +1,6 @@
 import React, { Component } from "react";
 import Taro from "@tarojs/taro";
-import { Text, View, Button } from "@tarojs/components";
+import { Text, View, Button, Icon } from "@tarojs/components";
 import dayjs from "dayjs";
 import "./index.less";
 
@@ -11,6 +11,7 @@ import { AtButton, AtTextarea, AtIcon, AtCalendar } from "taro-ui";
 import {
   updatePublicRelease,
   getWorkingHoursList,
+  addPublicRelease,
 } from "../../utils/servers/servers";
 
 import { getHours, getNumHourse, getUserWordTimes } from "../../utils/tools";
@@ -60,7 +61,7 @@ class PublicContent extends Component {
   }
 
   componentDidMount() {
-    const { dtails } = this.props
+    const { dtails, again = false } = this.props
     let arr = [];
     for (let i of this.props.dtails.annexUrl) {
       arr.push(i.url.split(resourceAddress).join(""));
@@ -78,26 +79,40 @@ class PublicContent extends Component {
         })
       }
     }
-    this.setState({
-      imgs: arr,
-      totalDuration: this.props.dtails.duration,
-      reason: this.props.dtails.remarks,
-      validDates: JSON.parse(this.props.dtails.validDate),
-      rangeEndVal: dayjs(this.props.dtails.releaseEnds).format("YYYY-MM-DD"),
-      rangeEndMinuteVal: dayjs(this.props.dtails.releaseEnds).format(
-        "YYYY-MM-DD HH:mm:ss"
-      ),
-      rangeStartVal: dayjs(this.props.dtails.releaseStarts).format(
-        "YYYY-MM-DD"
-      ),
-      rangeStartMinuteVal: dayjs(this.props.dtails.releaseStarts).format(
-        "YYYY-MM-DD HH:mm:ss"
-      ),
-      plan: this.props.dtails.plan || "",
-      expectedEffect: this.props.dtails.expectedEffect || "",
-      cList: list,
-      coorderList: !dtails.assistAid ? [] : dtails.assistAid.split(","),
-    });
+    if (again) {
+      // 再次公出详情
+      this.setState({
+        imgs: arr,
+        totalDuration: 0,
+        reason: this.props.dtails.remarks,
+        validDates: [],
+        rangeEndVal: '',
+        rangeEndMinuteVal: '',
+        rangeStartVal: '',
+        rangeStartMinuteVal: '',
+        plan: this.props.dtails.plan || "",
+        expectedEffect: this.props.dtails.expectedEffect || "",
+        cList: list,
+        coorderList: !dtails.assistAid ? [] : dtails.assistAid.split(","),
+      })
+    } else {
+      // 编辑详情
+      this.setState({
+        imgs: arr,
+        totalDuration: this.props.dtails.duration,
+        reason: this.props.dtails.remarks,
+        validDates: JSON.parse(this.props.dtails.validDate),
+        rangeEndVal: dayjs(this.props.dtails.releaseEnds).format("YYYY-MM-DD"),
+        rangeEndMinuteVal: dayjs(this.props.dtails.releaseEnds).format("YYYY-MM-DD HH:mm:ss"),
+        rangeStartVal: dayjs(this.props.dtails.releaseStarts).format("YYYY-MM-DD"),
+        rangeStartMinuteVal: dayjs(this.props.dtails.releaseStarts).format("YYYY-MM-DD HH:mm:ss"),
+        plan: this.props.dtails.plan || "",
+        expectedEffect: this.props.dtails.expectedEffect || "",
+        cList: list,
+        coorderList: !dtails.assistAid ? [] : dtails.assistAid.split(","),
+      });
+    }
+
     this.getWorkingHoursList();
   }
 
@@ -153,7 +168,7 @@ class PublicContent extends Component {
       ),
     });
   }
-
+  // 修改公出提交
   onSubmit() {
     const { isVerify = false } = this.props;
     if (!this.state.rangeStartMinuteVal) {
@@ -290,6 +305,111 @@ class PublicContent extends Component {
         });
       });
   }
+  // 再次公出提交
+  goAgain() {
+    if (!this.state.rangeStartMinuteVal) {
+      Taro.showToast({ title: "请选择公出时间", icon: "none" });
+      return;
+    }
+    if (!this.state.rangeEndMinuteVal) {
+      Taro.showToast({ title: "请选择公出时间", icon: "none" });
+      return;
+    }
+    if (
+      !(
+        this.props.locationInfor.longitude &&
+        this.props.locationInfor.latitude
+      )
+    ) {
+      Taro.showToast({ title: "请选择公出地点", icon: "none" });
+      return;
+    }
+    if (!this.state.reason) {
+      Taro.showToast({ title: "请输入公出目标", icon: "none" });
+      return;
+    }
+    if (!this.state.plan && this.props.dtails.type != 2) {
+      Taro.showToast({ title: "请输入公出计划", icon: "none" });
+      return;
+    }
+    if (!this.state.expectedEffect && this.props.dtails.type != 2) {
+      Taro.showToast({ title: "请输入预计效果", icon: "none" });
+      return;
+    }
+    if (this.state.totalDuration === 0) {
+      Taro.showToast({
+        title: "请选择公出时间,目前设置公出时间不足0.5小时",
+        icon: "none",
+      });
+      return;
+    }
+    this.setState({
+      loading: true,
+    });
+    let datas = {
+      publicAgain: 1,
+      uid: this.props.dtails.uid,
+      releaseStarts: this.state.rangeStartMinuteVal,
+      releaseEnds: this.state.rangeEndMinuteVal,
+      remarks: this.state.reason,
+      userName: this.props.locationInfor.name,
+      longitude: this.props.locationInfor.longitude,
+      latitude: this.props.locationInfor.latitude,
+      annexUrl: this.state.imgs.length === 0 ? "" : this.state.imgs.join(","),
+      duration: this.state.totalDuration,
+      type: this.props.dtails.type,
+      validDate: JSON.stringify(this.state.validDates),
+      assist: this.state.coorderList.length === 0 ? 0 : 1,
+      assistAid: this.state.coorderList.length === 0 ? "" : this.state.coorderList.join(","),
+    };
+    if (this.props.dtails.type == 0) {
+      datas = {
+        ...datas,
+        ...{
+          plan: this.state.plan,
+          expectedEffect: this.state.expectedEffect,
+        }
+      };
+    } else if (this.props.dtails.type == 2) {
+      datas = datas;
+    } else {
+      datas = {
+        ...datas,
+        ...{
+          plan: this.state.plan,
+          expectedEffect: this.state.expectedEffect,
+          orderNo: this.props.dtails.orderNo,
+        }
+      };
+    }
+    addPublicRelease(datas)
+      .then((v) => {
+        this.setState({
+          loading: false,
+        });
+        if (v.error.length === 0) {
+          Taro.showToast({
+            title: "申请成功",
+          });
+          // this.props.onClose();
+          this.setState({
+            isAgains: true,
+            goId: v.data.data.id,
+            goDatas: v.data.data,
+          })
+        } else {
+          Taro.showToast({
+            title: v.error[0].message,
+            icon: "none",
+          });
+        }
+      })
+      .catch(() => {
+        this.setState({
+          loading: false,
+        });
+      });
+  }
 
   selectArrder() {
     const key = "AWBBZ-GRAC2-JFYUO-CLA7I-JAHXK-YFFGT"; //使用在腾讯位置服务申请的key
@@ -375,7 +495,7 @@ class PublicContent extends Component {
   }
 
   render() {
-    const { dtails, type } = this.props;
+    const { dtails, type, again = false } = this.props;
     const { cList, coorderList, popup } = this.state
     return (
       <View className="publicContent">
@@ -711,45 +831,78 @@ class PublicContent extends Component {
             ) : null}
           </View>
         </View>
-        <View className="operation">
-          <AtButton
-            disabled={this.state.loading}
-            type="primary"
-            circle
-            onClick={() => {
-              this.props.onBack();
-            }}
-          >
-            上一步
-          </AtButton>
-          <AtButton
-            disabled={this.state.loading}
-            type="secondary"
-            circle
-            onClick={() => {
-              this.props.onClose();
-            }}
-          >
-            取消
-          </AtButton>
-          <AtButton
-            type="primary"
-            loading={this.state.loading}
-            circle
-            onClick={() => {
-              this.setState({
-                isInquiryOpened: true,
-                inquiryTitle: "提醒",
-                inquiryContent: "您确定要修改此申请吗?",
-                inquiryFn: () => {
-                  this.onSubmit();
-                },
-              });
-            }}
-          >
-            确定修改
-          </AtButton>
-        </View>
+        {/* again为再次公出按钮显示 */}
+        {
+          again
+            ? <View className="operation">
+              <AtButton
+                disabled={this.state.loading}
+                type="secondary"
+                circle
+                onClick={() => {
+                  this.props.onClose();
+                }}
+              >
+                取消
+              </AtButton>
+              <AtButton
+                type="primary"
+                loading={this.state.loading}
+                circle
+                onClick={() => {
+                  this.setState({
+                    isInquiryOpened: true,
+                    inquiryTitle: "提醒",
+                    inquiryContent: "您确定要提交此申请吗?",
+                    inquiryFn: () => {
+                      this.goAgain();
+                    },
+                  });
+                }}
+              >
+                确定
+              </AtButton>
+            </View>
+            : <View className="operation">
+              <AtButton
+                disabled={this.state.loading}
+                type="primary"
+                circle
+                onClick={() => {
+                  this.props.onBack();
+                }}
+              >
+                上一步
+              </AtButton>
+              <AtButton
+                disabled={this.state.loading}
+                type="secondary"
+                circle
+                onClick={() => {
+                  this.props.onClose();
+                }}
+              >
+                取消
+              </AtButton>
+              <AtButton
+                type="primary"
+                loading={this.state.loading}
+                circle
+                onClick={() => {
+                  this.setState({
+                    isInquiryOpened: true,
+                    inquiryTitle: "提醒",
+                    inquiryContent: "您确定要修改此申请吗?",
+                    inquiryFn: () => {
+                      this.onSubmit();
+                    },
+                  });
+                }}
+              >
+                确定修改
+              </AtButton>
+            </View>
+        }
         <InquiryModal
           isOpened={this.state.isInquiryOpened}
           title={this.state.inquiryTitle}
@@ -781,6 +934,61 @@ class PublicContent extends Component {
             setList={this.setList.bind(this)}
           />
         }
+        {/* 再次公出申请成功 */}
+        {
+          this.state.isAgains &&
+          <InquiryModal
+            isOpened={this.state.isAgains}
+            isNo={false}
+            isChildren={true}
+            onDetermine={() => {
+              this.props.onClose();
+              this.setState({
+                isAgains: false,
+                goId: "",
+                goDatas: {},
+              })
+            }}
+            onClose={() => {
+              this.props.onClose();
+              this.setState({
+                isAgains: false,
+                goId: "",
+                goDatas: {},
+              })
+            }}
+          >
+            <View className='result'>
+              <View className='resultIcon'>
+                <Icon size='80' type='success' />
+              </View>
+              <View className='resultTitle'>
+                <View>申请成功,可以打卡了!</View>
+                <View className='resultError'></View>
+              </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>
+                <AtButton type='secondary' circle onClick={() => {
+                  this.props.onClose();
+                  this.state.goId &&
+                    Taro.navigateTo({
+                      url: '/pages/egressDetails/index?id=' + this.state.goId
+                    })
+                }}>
+                  前往分享
+                </AtButton>
+              </View>
+            </View>
+          </InquiryModal>
+        }
       </View>
     );
   }

+ 28 - 0
src/pages/egressDetails/publicContent.less

@@ -82,4 +82,32 @@
   .at-image-picker__remove-btn {
     display: block !important;
   }
+}
+
+.result{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  padding-top: 83px;
+  height: 506px;
+  .resultIcon{
+    padding-bottom: 20px;
+  }
+  .resultTitle{
+    padding: 0 30px 30px 30px;
+    text-align: center;
+    .resultError{
+      font-size: 20px;
+      color: #969696;
+      padding-top: 15px;
+    }
+  }
+  .resultOperation{
+    display: flex;
+    flex-flow: row nowrap;
+    align-items: center;
+    justify-content: space-between;
+    margin-top: auto;
+    width: 100%;
+  }
 }

+ 27 - 5
src/pages/examine/index.less

@@ -166,6 +166,19 @@
       position: relative;
       overflow: hidden;
 
+      .itype {
+        font-size: 20px;
+        color: #fff;
+        text-align: center;
+        transform: rotate(-45deg);
+        background: #6190E8;
+        padding: 5px 30px;
+        position: absolute;
+        top: 5px;
+        left: -30px;
+
+      }
+
       .revoke {
         position: absolute;
         top: 0;
@@ -222,23 +235,32 @@
         }
 
         .userName {
-          width: 540px;
           font-size: 25px;
           color: #999999;
           padding-bottom: 15px;
-          overflow: hidden;
-          white-space: nowrap;
-          text-overflow: ellipsis;
+          display: flex;
+          flex-flow: row nowrap;
+          align-items: center;
+          justify-content: space-between;
+          position: relative;
+
+          .uNtext {
+            width: 540px;
+            overflow: hidden;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+          }
 
           .reject {
             position: absolute;
             right: -31px;
-            top: 60px;
+            top: 0px;
             border-bottom-left-radius: 100px;
             border-top-left-radius: 100px;
             padding: 20px 20px;
             color: white;
             background: rgba(22, 155, 213, 1);
+
           }
 
         }

+ 19 - 2
src/pages/examine/myList.jsx

@@ -34,6 +34,7 @@ class MyList extends Component {
                 });
               }}
             >
+              {v.publicAgain == 1 && <View className="itype">再次</View>}
               {v.status === 3 &&
                 <View className="revoke">
                   <Image src={RevokeWhite} className="revokeImg" />
@@ -47,7 +48,21 @@ class MyList extends Component {
                   <View className="createTimes">{v.createTimes}</View>
                 </View>
                 <View className="userName">
-                  公出企业:{v.nickname}
+                  <View className="uNtext">
+                    公出企业:{v.nickname}
+                  </View>
+                  {
+                    (v.type === 0 || v.type === 1 || v.type === 2) && v.status !== 3 &&
+                    <View
+                      className="reject"
+                      onClick={e => {
+                        e.stopPropagation();
+                        this.props.again(v)
+                      }}
+                    >
+                      再次公出
+                    </View>
+                  }
                   {
                     (title == "我的协单" || title === "查看协单") && v.status === 2 && v.type === 3 &&
                     <View
@@ -62,7 +77,9 @@ class MyList extends Component {
                   }
                 </View>
                 <View className="userName">
-                  公出地点:{v.userName}
+                  <View className="uNtext">
+                    公出地点:{v.userName}
+                  </View>
                 </View>
                 <View className="releaseStarts">
                   开始时间:{v.releaseStarts}

+ 1 - 1
src/pages/mybusiness/index.config.js

@@ -3,6 +3,6 @@ export default {
   enablePullDownRefresh: true,
   onReachBottomDistance: 50,
   usingComponents: {
-    timePicker: '../../components/common/PickerReduce/timePicker'
+    timePicker: '../../components/common/timePicker/timePicker'
   }
 }

+ 115 - 4
src/pages/mybusiness/index.jsx

@@ -1,7 +1,7 @@
 import React, { Component } from 'react';
 import Taro from '@tarojs/taro';
 import { View, Picker, ScrollView, Button } from '@tarojs/components'
-import { getPublicReleaseList, techReject } from '../../utils/servers/servers';
+import { getPublicReleaseList, techReject, getReleasetDails } from '../../utils/servers/servers';
 import dayjs from 'dayjs';
 import {
   AtSearchBar,
@@ -16,7 +16,6 @@ import {
 import { clockState } from '../../utils/tools/config';
 
 import './index.less';
-
 import 'taro-ui/dist/style/components/tabs.scss';
 import "taro-ui/dist/style/components/flex.scss";
 import "taro-ui/dist/style/components/action-sheet.scss";
@@ -27,6 +26,9 @@ import "taro-ui/dist/style/components/modal.scss";
 
 import MyList from '../examine/myList';
 import MessageNoticebar from "../../components/common/messageNoticebar";
+import InquiryModal from "../../components/common/inquiryModal";
+import PublicContent from "../egressDetails/publicContent";
+import { resourceAddress } from "../../utils/config";
 
 class Examine extends Component {
 
@@ -61,7 +63,8 @@ class Examine extends Component {
     this.getPublicReleaseList = this.getPublicReleaseList.bind(this);
     this.getMyList = this.getMyList.bind(this);
     this.onSetPickerTime = this.onSetPickerTime.bind(this);
-    this.onPickerHide = this.onPickerHide.bind(this)
+    this.onPickerHide = this.onPickerHide.bind(this);
+    this.getReleasetDails = this.getReleasetDails.bind(this);
   }
 
   componentDidShow() {
@@ -77,6 +80,14 @@ class Examine extends Component {
         })
       }
     })
+    //获取地区选定数据
+    const chooseLocation = requirePlugin("chooseLocation");
+    const location = chooseLocation.getLocation();
+    if (location) {
+      this.setState({
+        selectArrderLocation: location,
+      });
+    }
   }
 
   async componentDidMount() {
@@ -102,6 +113,36 @@ class Examine extends Component {
       isPickerRender: false,
     });
   }
+  // 公出详情
+  getReleasetDails(id) {
+    getReleasetDails({
+      id: id
+    }).then((v) => {
+      if (v.error.length === 0) {
+        if (v.data) {
+          let list = [];
+          for (let i of v.data.annexUrl.split(",")) {
+            if (i) {
+              list.push({ url: resourceAddress + i });
+            }
+          }
+          v.data.annexUrl = list;
+          this.setState({
+            dtails: v.data,
+            selectArrderLocation: {
+              longitude: parseFloat(v.data.longitude),
+              latitude: parseFloat(v.data.latitude),
+              name: v.data.userName,
+            },
+          })
+        }
+      } else {
+        Taro.showToast({ title: v.error[0].message, icon: "none" });
+      }
+    }).catch((err) => {
+      // Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
+    });
+  }
 
   async onSetPickerTime(val) {
     let data = val.detail;
@@ -432,6 +473,17 @@ class Examine extends Component {
                       isOpen: true,
                     })
                   }}
+                  again={e => {
+                    this.getReleasetDails(e.id)
+                    this.setState({
+                      isInquiryOpened: true,
+                      inquiryTitle: "温馨提示",
+                      inquiryContent: "您确定需再次公出拜访同一家企业吗?",
+                      inquiryFn: () => {
+
+                      },
+                    });
+                  }}
                 />
               </AtTabsPane>
             )
@@ -440,7 +492,7 @@ class Examine extends Component {
         <timePicker
           config={{
             endDate: true,
-            column: "minute",
+            column: "day",
             dateLimit: false,
             limitStartTime: dayjs().subtract(3, 'year').format('YYYY-MM-DD '),
             limitEndTime: dayjs().add(3, 'year').format('YYYY-MM-DD ')
@@ -487,6 +539,65 @@ class Examine extends Component {
             </AtModalAction>
           </AtModal>
         }
+        {/* 再次公出申请 */}
+        {
+          this.state.isInquiryOpened &&
+          <InquiryModal
+            isOpened={this.state.isInquiryOpened}
+            title={this.state.inquiryTitle}
+            content={this.state.inquiryContent}
+            color="black"
+            isNo={this.state.isNo}
+            onClose={() => {
+              this.setState({
+                isInquiryOpened: false,
+                dtails: {},
+                inquiryTitle: "",
+                inquiryContent: "",
+                isNo: true,
+              });
+            }}
+            onDetermine={() => {
+              this.setState({
+                isModifyOpened: true,
+
+                isInquiryOpened: false,
+                inquiryTitle: "",
+                inquiryContent: "",
+                isNo: true,
+                inquiryFn: () => { },
+              });
+            }}
+          />
+        }
+        {/* 再次公出详情 */}
+        {
+          this.state.isModifyOpened &&
+          <AtModal
+            isOpened={this.state.isModifyOpened}
+            onClose={() => {
+              this.setState({
+                isModifyOpened: false,
+                dtails: {},
+              })
+            }}
+          >
+            <AtModalContent>
+              <PublicContent
+                again={true}
+                onClose={() => {
+                  this.setState({
+                    isModifyOpened: false,
+                    dtails: {},
+                  })
+                }}
+                locationInfor={this.state.selectArrderLocation}
+                dtails={this.state.dtails}
+                isOpened={this.state.isModifyOpened}
+              />
+            </AtModalContent>
+          </AtModal>
+        }
       </View>
     )
   }

+ 4 - 0
src/pages/mybusiness/index.less

@@ -318,4 +318,8 @@
     border-radius: 11px;
     margin-bottom: 20px;
   }
+}
+
+.at-modal__container {
+  width: 718px;
 }

+ 1 - 0
src/pages/punchClock/punchClocks.jsx

@@ -482,6 +482,7 @@ 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>
+                {/* 异常打卡 */}
                 {
                   // dtails.type == 3 &&
                   false &&