HW 3 年之前
父节点
当前提交
125a37c7f7

+ 1 - 1
src/app.config.js

@@ -1,8 +1,8 @@
 export default {
   pages: [
+    'pages/applyDepart/index',//申请公出
     'pages/punchClock/index',//打卡
     'pages/egressDetails/index',//公出详情
-    'pages/applyDepart/index',//申请公出
     'pages/login/index',//登录
     'pages/examine/index',//审核
     // 'pages/staffDistribution/index',//员工分布

+ 15 - 1
src/components/common/DateTimePicker/index.jsx

@@ -82,6 +82,14 @@ export default class DateTimePicker extends Component {
           Taro.showToast({title:'不能选择17:30之后的时间',icon:'none'})
           return ;
         }
+      if(
+        dayjs(dayjs(current).format('YYYY-MM-DD HH:mm')).isAfter(dayjs(dayjs(current).format('YYYY-MM-DD')+' 12:00'))
+        &&
+        dayjs(dayjs(current).format('YYYY-MM-DD HH:mm')).isBefore(dayjs(dayjs(current).format('YYYY-MM-DD')+' 13:30'))
+      ){
+        Taro.showToast({title:'不能选择12:00到13:30之间的时间',icon:'none'})
+        return ;
+      }
 
         this.setState({
             current,
@@ -127,8 +135,14 @@ export default class DateTimePicker extends Component {
         });
         this.props.onClear && this.props.onClear({ current: '' });
     };
+    // 设值
+    setInitialState(state) {
+      this.setState({
+        ...state
+      })
+    }
 
-    componentDidMount() {
+  componentDidMount() {
         const { initValue } = this.props;
         const fmtInitValue = getDate(initValue);
         this.setState({ fmtInitValue });

+ 3 - 2
src/components/common/imagePicker/index.jsx

@@ -29,14 +29,15 @@ class ImagePicker extends Component{
     const BASE_URL = getBaseUrl(this.props.url);
     let token = Taro.getStorageSync('token');
     let _this = this;
-    let filesArr = files.concat([]);
     if(operationType === 'remove'){
+      let filesArr = files.concat([]);
       this.props.onChange(index,'remove');
       this.setState({
         files:filesArr
       })
     }else{
       let fileArr = this.state.files.concat([]);
+      console.log(fileArr.length,files.length - fileArr.length)
       let arr = type === 'camera' ? files : files.splice(fileArr.length,files.length - fileArr.length)
       this.setState({
         loading:true
@@ -55,7 +56,7 @@ class ImagePicker extends Component{
             let dataJson = JSON.parse(res.data)
             if(dataJson.error.length === 0){
               _this.props.onChange(dataJson.data,'add');
-              _this.state.files.push(filesArr[i]);
+              _this.state.files.push(arr[i]);
               _this.setState({
                 files:_this.state.files
               })

+ 1 - 1
src/pages/applyDepart/index.jsx

@@ -40,7 +40,7 @@ class ApplyDepart extends Component {
   constructor(props) {
     super(props);
     this.state={
-      current:0,
+      current:1,
       enterpriseInfor:{},
       selectArrderLocation:{},
       resultState:0

+ 1 - 0
src/pages/applyDepart/index.less

@@ -26,6 +26,7 @@
 
 .at-calendar__list.flex .flex__item--blur{
   background: #fff;
+  color: #e1e4e7 !important;
 }
 
 .result{

+ 8 - 11
src/pages/applyDepart/publicContent.jsx

@@ -71,7 +71,11 @@ class PublicContent extends Component{
       a1.isAfter(dayjs(a1.format('YYYY-MM-DD')+' 12:00'))
     ){
       this.getHours(dayjs(a1.format('YYYY-MM-DD')+' 13:30'),endTime);
-    }else if(a1.isBefore(dayjs(a1.format('YYYY-MM-DD')+' 13:30'))){
+    }else if(
+      a1.isBefore(dayjs(a1.format('YYYY-MM-DD')+' 12:00'))
+      &&
+      b1.isAfter(dayjs(a1.format('YYYY-MM-DD')+' 13:30'))
+    ){
       return hourse+minutes1-1.5
     }else{
       return hourse+minutes1
@@ -115,14 +119,6 @@ class PublicContent extends Component{
       Taro.showToast({title:'公出时间不足0小时',icon:'none'})
       return ;
     }
-    let annexUrl = '';
-    for(let i in this.state.imgs){
-      if(i === 0){
-        annexUrl+=this.state.imgs[i];
-      }else{
-        annexUrl+=','+this.state.imgs[i];
-      }
-    }
     this.setState({
       loading:true
     })
@@ -134,8 +130,9 @@ class PublicContent extends Component{
       userName: this.props.selectArrderLocation.name,
       longitude: this.props.selectArrderLocation.longitude,
       latitude: this.props.selectArrderLocation.latitude,
-      annexUrl: annexUrl || '',
-      duration: this.state.totalDuration
+      annexUrl: this.state.imgs.length === 0 ? '' : this.state.imgs.join(','),
+      duration: this.state.totalDuration,
+      validDate: JSON.stringify(this.state.validDates)
     }).then(v=>{
       this.setState({
         loading:false

+ 136 - 0
src/pages/egressDetails/enterprise.jsx

@@ -0,0 +1,136 @@
+import React,{Component} from 'react';
+import {View,Icon} from '@tarojs/components'
+import {getUserByName} from '../../utils/servers/servers';
+
+import {AtSearchBar, AtListItem} from 'taro-ui'
+
+import 'taro-ui/dist/style/components/search-bar.scss';
+import 'taro-ui/dist/style/components/button.scss';
+import 'taro-ui/dist/style/components/icon.scss';
+import 'taro-ui/dist/style/components/list.scss';
+import 'taro-ui/dist/style/components/icon.scss';
+
+import ListBottomStart from '../../components/common/listBottomStart';
+
+import Taro from '@tarojs/taro';
+
+class Enterprise extends Component{
+  constructor(props) {
+    super(props);
+    this.state={
+      value:'',
+      loading:false,
+      data:[],
+      listState:'NO_DATA',
+      selectId:0,
+    }
+    this.onChange = this.onChange.bind(this);
+  }
+
+  componentDidMount() {
+
+  }
+
+  onChange (value) {
+    this.setState({
+      value,
+    })
+    if(value.length < 4){return}
+    this.setState({
+      listState: 'LOADING'
+    })
+    getUserByName({
+      name:value
+    }).then((data)=>{
+      if(data.error.length === 0){
+        if(data.data.length === 0){
+          this.setState({
+            listState: 'NO_DATA'
+          })
+        }else{
+          this.setState({
+            listState: 'NO_MORE_DATA'
+          })
+        }
+        this.setState({
+          data:data.data
+        })
+      }else{
+        this.setState({
+          listState: data.error[0].field === '403' ? 'NO_DATA' : 'RELOAD'
+        })
+        Taro.showToast({
+          title:data.error[0].message,
+          icon:'none'
+        })
+      }
+    }).catch(()=>{
+      this.setState({
+        listState: 'RELOAD'
+      })
+    })
+  }
+
+  componentWillReceiveProps(props){
+    if(!props.isOpened){
+      this.setState({
+        value:'',
+        data:[],
+        listState:'NO_DATA',
+        selectId:0
+      })
+    }
+  }
+
+  render() {
+    return (
+      <>
+        <AtSearchBar
+          showActionButton
+          value={this.state.value}
+          onChange={this.onChange}
+          onActionClick={()=>{this.onChange(this.state.value)}}
+          onClear={()=>{
+            this.setState({
+              value:'',
+              data:[],
+              listState:'NO_DATA',
+              selectId:0
+            },()=>{
+              this.props.onChange({});
+            })
+          }}
+        />
+        <View>
+          {
+            this.state.data.map((v,k)=>(
+              <View style={{
+                padding:'10px',
+                display:'flex',
+                flexFlow:'row',
+                alignItems:'center',
+                justifyContent:'space-between',
+                borderBottom:'1px #ece6e6 solid'
+              }} key={k} onClick={()=>{
+                this.setState({
+                  selectId:v.id
+                })
+                this.props.onChange({uid:v.id});
+              }}>
+                <View style={{fontSize:'15px'}}>{v.name}</View>
+                {this.state.selectId === v.id ? <Icon size='20' type='success_no_circle' /> : null}
+              </View>
+            ))
+          }
+          <ListBottomStart
+            state={this.state.listState}
+            reload={()=>{
+              this.onChange(this.state.value)
+            }}/>
+        </View>
+      </>
+    )
+  }
+}
+
+export default Enterprise;

+ 86 - 11
src/pages/egressDetails/index.jsx

@@ -1,10 +1,11 @@
 import React,{Component} from "react";
 import { View,Image,Button } from '@tarojs/components'
 import Taro, { getCurrentInstance } from "@tarojs/taro";
-import {AtButton, AtIcon, AtTextarea} from 'taro-ui'
+import {AtButton, AtCalendar, AtIcon, AtTextarea} from 'taro-ui'
 import {examinePublicRelease,getReleasetDails,getListPublicReleaseLog} from '../../utils/servers/servers';
 import {resourceAddress} from '../../utils/config';
-import { AtModal, AtTimeline, AtModalContent, AtModalAction } from "taro-ui"
+import { AtModal, AtTimeline, AtModalContent, AtModalAction } from "taro-ui";
+import Modify from './modify';
 import './index.less';
 
 import 'taro-ui/dist/style/components/icon.scss';
@@ -12,12 +13,15 @@ import 'taro-ui/dist/style/components/textarea.scss'
 import 'taro-ui/dist/style/components/modal.scss';
 import 'taro-ui/dist/style/components/timeline.scss';
 import 'taro-ui/dist/style/components/icon.scss';
+import 'taro-ui/dist/style/components/calendar.scss';
 
 import Rejected from '../../image/rejected.png';
 import Passed from '../../image/passed.png';
 import Reviewed from '../../image/reviewed.png';
 import ImagePicker from "../../components/common/imagePicker";
 
+import switchIocn from '../../image/switch.png';
+
 class EgressDetails extends Component{
 
   $instance = getCurrentInstance()
@@ -27,20 +31,36 @@ class EgressDetails extends Component{
     this.state={
       dtails:{},
       opinion:'',
-      publicReleaseLog:[]
+      publicReleaseLog:[],
+      isDetailedOpened:false,
+      isOpened:false,
+      isModifyOpened:false,
+      modifyType:0,
+      selectArrderLocation:{}
     }
     this.examinePublicRelease= this.examinePublicRelease.bind(this);
     this.getReleasetDails= this.getReleasetDails.bind(this);
     this.getListPublicReleaseLog= this.getListPublicReleaseLog.bind(this);
   }
 
-  componentDidShow() {
+  componentDidMount() {
     this.getReleasetDails();
   }
 
+  componentDidShow() {
+    //获取地区选定数据
+    const chooseLocation = requirePlugin('chooseLocation');
+    const location = chooseLocation.getLocation();
+    if(location){
+      this.setState({
+        selectArrderLocation: location
+      })
+    }
+  }
+
   getReleasetDails(){
     getReleasetDails({
-      id:21
+      id:this.$instance.router.params.id
     }).then(v=>{
       if(v.error.length === 0){
         let list = [];
@@ -52,6 +72,11 @@ class EgressDetails extends Component{
         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'})
@@ -88,7 +113,7 @@ class EgressDetails extends Component{
 
   getListPublicReleaseLog(){
     getListPublicReleaseLog({
-      id:21
+      id:this.$instance.router.params.id
     }).then(v=>{
       if(v.error.length === 0){
         let arr = [];
@@ -124,8 +149,14 @@ class EgressDetails extends Component{
         <View className='titleContent'>
           <View className='title'>{dtails.aname}提交的公出申请</View>
           <View className='address'>
-            <AtIcon value='map-pin' size='15' color='#767272'/>
-            公出企业:{dtails.nickname}
+            {/*<AtIcon value='map-pin' size='15' color='#767272'/>*/}
+            公出企业: {dtails.nickname}
+            <Image src={switchIocn} className='switchItem' onClick={()=>{
+              this.setState({
+                isModifyOpened:true,
+                modifyType:1,
+              })
+            }}/>
           </View>
           <View className='state' style={{
             color:dtails.status === 0 ? '#f31212' :
@@ -157,12 +188,24 @@ class EgressDetails extends Component{
           {/*  <View className='value'>营销经理</View>*/}
           {/*</View>*/}
           <View className='item'>
-            <View className='title'>公出地点:</View>
+            <View className='title'>
+              公出地点:
+              <AtIcon value='edit' size='18' color='#3864ef' onClick={()=>{
+                this.setState({
+                  isModifyOpened:true,
+                  modifyType:2,
+                })
+              }}/>
+            </View>
             <View className='value'>{dtails.userName}</View>
             <View className='timeContent'>
               <View className='time'>
                 <View className='num'>公出{dtails.duration}小时</View>
-                <View className='journal'>明细</View>
+                <View className='journal' onClick={()=>{
+                  this.setState({
+                    isDetailedOpened:true
+                  })
+                }}>明细</View>
               </View>
               <View className='timeAxis'>
                 <View className='startTime'>
@@ -177,8 +220,26 @@ class EgressDetails extends Component{
               </View>
             </View>
           </View>
+          <AtModal isOpened={this.state.isDetailedOpened}>
+           <AtModalContent>
+             {dtails.validDate ?  <AtCalendar
+                  isSwiper={false}
+                  validDates={JSON.parse(dtails.validDate)}
+                /> : null
+             }
+            </AtModalContent>
+            <AtModalAction>
+              <Button onClick={()=>{
+                this.setState({
+                  isDetailedOpened:false
+                })
+              }}>确定</Button>
+            </AtModalAction>
+          </AtModal>
           <View className='item'>
-            <View className='title'>申请时间</View>
+            <View className='title'>
+              申请时间
+            </View>
             <View className='value'>{dtails.createTimes}</View>
           </View>
           <View className='item'>
@@ -246,6 +307,20 @@ class EgressDetails extends Component{
             }}>确定</Button>
           </AtModalAction>
         </AtModal>
+        <Modify
+          dtails={dtails}
+          locationInfor={this.state.selectArrderLocation}
+          id={this.$instance.router.params.id}
+          isOpened={this.state.isModifyOpened}
+          modifyType={this.state.modifyType}
+          onClose={()=>{
+          this.setState({
+            isModifyOpened:false,
+            dtails:{}
+          },()=>{
+            this.getReleasetDails();
+          })
+        }}/>
       </View>
     )
   }

+ 37 - 0
src/pages/egressDetails/index.less

@@ -15,6 +15,14 @@
       font-size: 25px;
       color: #767272;
       padding-bottom: 20px;
+      display: flex;
+      flex-flow: row;
+      align-items: center;
+      .switchItem{
+        width: 30px;
+        height: 30px;
+        margin-left: 20px;
+      }
     }
     .state{
       font-size: 30px;
@@ -36,6 +44,10 @@
     .item{
       padding-bottom: 30px;
       .title{
+        display: flex;
+        flex-flow: row nowrap;
+        align-items: center;
+        justify-content: space-between;
         color: #b7acac;
         font-size: 27px;
         padding-bottom: 10px;
@@ -112,4 +124,29 @@
   .at-image-picker__remove-btn{
     display: none;
   }
+  .at-calendar__list.flex .flex__item--selected{
+    color: white;
+    border: 0 !important;
+    border-radius: 0 !important;
+    background: #6eb173 !important;
+  }
+
+  .at-calendar__list.flex  .flex__item{
+    background: #6eb173;
+    color: #FFFFFF;
+  }
+
+  .at-calendar__list.flex .flex__item--selected-head.flex__item--selected-tail .flex__item-container {
+    background-color: rgba(0,0,0,0);
+    color: #FFFFFF;
+  }
+
+  .at-calendar__list.flex .flex__item--blur{
+    background: #fff;
+    color: #e1e4e7 !important;
+  }
+
+  .at-modal__container{
+    width: 718px;
+  }
 }

+ 95 - 0
src/pages/egressDetails/modify.jsx

@@ -0,0 +1,95 @@
+import React,{Component} from "react";
+import {AtCalendar, AtModal, AtModalAction, AtModalContent} from "taro-ui";
+import {Button} from "@tarojs/components";
+import Enterprise from './enterprise';
+import PublicContent from './publicContent';
+
+import {updatePublicRelease} from '../../utils/servers/servers';
+
+import 'taro-ui/dist/style/components/modal.scss';
+import Taro from "@tarojs/taro";
+
+class Modify extends Component{
+  constructor(props) {
+    super(props);
+    this.state={
+      data:{}
+    }
+    this.submit = this.submit.bind(this);
+    this.onChange = this.onChange.bind(this);
+  }
+
+  submit(){
+    if(Object.keys(this.state.data).length === 0){
+      this.props.onClose();
+      return;
+    }
+    updatePublicRelease({
+      id:this.props.id,
+      ...this.state.data
+    }).then(v=>{
+      if(v.error.length === 0){
+        Taro.showToast({title:'修好成功'})
+        this.props.onClose();
+      }else{
+        Taro.showToast({title:v.error[0].message,icon:'none'})
+      }
+    }).catch(err=>{
+      Taro.showToast({title:'系统错误.请稍后重试',icon:'none'})
+      console.log(err)
+    })
+
+  }
+
+  componentWillReceiveProps(props){
+    if(!props.isOpened){
+      this.setState({
+        data:{}
+      })
+    }
+  }
+
+  onChange(value){
+    this.setState({
+      data:value
+    })
+  }
+
+  render() {
+    return (
+      <AtModal isOpened={this.props.isOpened}>
+        <AtModalContent>
+          {
+            this.props.modifyType === 1 ?
+              <Enterprise isOpened={this.props.isOpened} onChange={this.onChange}/> :
+              <PublicContent
+                onClose={()=>{
+                  this.props.onClose();
+                }}
+                locationInfor={this.props.locationInfor}
+                dtails={this.props.dtails}
+                isOpened={this.props.isOpened}
+                onChange={this.onChange}
+              />
+          }
+        </AtModalContent>
+        {
+          this.props.modifyType === 1 ?
+            <AtModalAction>
+              <Button onClick={()=>{
+                this.props.onClose();
+              }}>
+                取消
+              </Button>
+              <Button onClick={this.submit}>
+                确定
+              </Button>
+            </AtModalAction>:
+            null
+        }
+      </AtModal>
+    )
+  }
+}
+
+export default Modify;

+ 386 - 0
src/pages/egressDetails/publicContent.jsx

@@ -0,0 +1,386 @@
+import React,{Component} from 'react';
+import Taro,{getCurrentInstance } from '@tarojs/taro';
+import {Text, View} from '@tarojs/components'
+import dayjs from 'dayjs';
+import './index.less';
+import DateTimePicker from '../../components/common/DateTimePicker';
+
+import ImagePicker from '../../components/common/imagePicker'
+import {resourceAddress} from '../../utils/config';
+
+import { AtButton,AtTextarea ,AtIcon,AtCalendar   } from 'taro-ui'
+import {updatePublicRelease} from '../../utils/servers/servers';
+
+import 'taro-ui/dist/style/components/form.scss';
+import 'taro-ui/dist/style/components/button.scss';
+import 'taro-ui/dist/style/components/loading.scss';
+import 'taro-ui/dist/style/components/icon.scss';
+import 'taro-ui/dist/style/components/icon.scss';
+import 'taro-ui/dist/style/components/textarea.scss';
+import 'taro-ui/dist/style/components/calendar.scss';
+
+import './publicContent.less';
+
+class PublicContent extends Component{
+  constructor(props) {
+    super(props);
+    this.state={
+      rangeStartVal:'',
+      rangeEndVal:'',
+      rangeEndMinuteVal:'',
+      rangeStartMinuteVal:'',
+      reason:'',
+      imgs:[],
+      validDates:[],
+      totalDuration:0,
+      loading:false,
+    }
+    this.onSubmit = this.onSubmit.bind(this);
+    this.selectArrder = this.selectArrder.bind(this);
+    this.onChange = this.onChange.bind(this);
+  }
+
+  componentWillReceiveProps(props){
+    if(props.isOpened){
+      this.rangeStartRef.setInitialState({current:props.dtails.releaseStarts})
+      this.rangeEndRef.setInitialState({current:props.dtails.releaseEnds});
+      let arr = [];
+      console.log(props.dtails.annexUrl,'props.dtails.annexUrl')
+      for(let i of props.dtails.annexUrl){
+        arr.push(i.url.split(resourceAddress).join(""))
+      }
+      this.setState({
+        imgs:arr,
+        totalDuration:props.dtails.duration,
+        reason:props.dtails.remarks,
+        validDates:JSON.parse(props.dtails.validDate),
+        rangeEndVal:dayjs(props.dtails.releaseEnds).format('YYYY-MM-DD'),
+        rangeEndMinuteVal: dayjs(props.dtails.releaseEnds).format('YYYY-MM-DD HH:mm:ss'),
+        rangeStartVal:dayjs(props.dtails.releaseStarts).format('YYYY-MM-DD'),
+        rangeStartMinuteVal: dayjs(props.dtails.releaseStarts).format('YYYY-MM-DD HH:mm:ss'),
+      })
+    }else{
+      this.rangeEndRef && this.rangeEndRef.clear();
+      this.rangeStartRef && this.rangeStartRef.clear();
+      this.imagePickerRef && this.imagePickerRef.clear();
+      this.setState({
+        rangeStartVal:'',
+        rangeEndVal:'',
+        rangeEndMinuteVal:'',
+        rangeStartMinuteVal:'',
+        reason:'',
+        imgs:[],
+        validDates:[],
+        totalDuration:0,
+        loading:false,
+      })
+    }
+  }
+
+  componentDidMount() {
+
+  }
+
+  getHours(startTime,endTime){
+    let a1 = dayjs(startTime);
+    let b1 = dayjs(endTime);
+    let c1 = b1.diff(a1,'minutes');
+    let hourse = parseInt(c1/60);
+    let minutes = c1%60
+    let minutes1 = parseInt(minutes / 30)*0.5
+    if(
+      a1.isBefore(dayjs(a1.format('YYYY-MM-DD')+' 13:30'))
+      &&
+      a1.isAfter(dayjs(a1.format('YYYY-MM-DD')+' 12:00'))
+    ){
+      this.getHours(dayjs(a1.format('YYYY-MM-DD')+' 13:30'),endTime);
+    }else if(
+      a1.isBefore(dayjs(a1.format('YYYY-MM-DD')+' 12:00'))
+      &&
+      b1.isAfter(dayjs(a1.format('YYYY-MM-DD')+' 13:30'))
+    ){
+      return hourse+minutes1-1.5
+    }else{
+      return hourse+minutes1
+    }
+  }
+
+  getNumHourse(startTime,endTime){
+    if(dayjs(dayjs(startTime).format('YYYY-MM-DD')).isSame(dayjs(dayjs(endTime).format('YYYY-MM-DD')))){
+      this.setState({
+        totalDuration:this.getHours(startTime,endTime)
+      })
+    }else{
+      let a = this.getHours(startTime,dayjs(startTime.format('YYYY-MM-DD')+' 17:30'));
+      let b = this.getHours(dayjs(endTime.format('YYYY-MM-DD')+' 8:30'),endTime);
+      let c = (this.state.validDates.length-2)*7.5;
+      this.setState({
+        totalDuration:a+b+c
+      })
+    }
+  }
+
+
+  onSubmit(){
+    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.totalDuration === 0){
+      Taro.showToast({title:'公出时间不足0小时',icon:'none'})
+      return ;
+    }
+    this.setState({
+      loading:true
+    })
+    updatePublicRelease({
+      id:this.props.dtails.id,
+      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,
+      validDate: JSON.stringify(this.state.validDates)
+    }).then(v=>{
+      this.setState({
+        loading:false
+      })
+      if(v.error.length === 0){
+        Taro.showToast({
+          title:'修改成功',
+        })
+        this.props.onClose();
+      }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
+    const referer = '科德打卡定位'; //调用插件的app的名称
+    const location = JSON.stringify({
+      latitude: 39.89631551,
+      longitude: 116.323459711
+    });
+    const category = '生活服务,娱乐休闲';
+
+    Taro.navigateTo({
+      url: 'plugin://chooseLocation/index?key=' + key + '&referer=' + referer + '&location=' + location + '&category=' + category
+    });
+  }
+
+  onChange(value,type){
+    let arr = this.state.imgs.concat([]);
+    if(type === 'add'){
+      arr.push(value)
+    }else if(type === 'remove'){
+      arr.splice(value,1)
+    }
+    this.setState({
+      imgs: arr,
+    })
+  }
+
+  render() {
+    const {dtails} = this.props;
+    return (
+      <View className='publicContent'>
+          <View className='formItem'>
+            <View className='formName'>公出企业:</View>
+            <View className='formValue'>{dtails.nickname}</View>
+          </View>
+        <View className='formItem'>
+          <View className='formName'>公出开始时间:</View>
+          <View className='formValue'>
+            <DateTimePicker ref={ref=>this.rangeStartRef = ref} onOk={(current)=>{
+              let arr = [];
+              if(this.state.rangeEndVal){
+                let str = dayjs(current.current).format('YYYY-MM-DD');
+                arr.push({value:str});
+                let a = dayjs(this.state.rangeEndVal.split('-'));
+                let b = dayjs(str.split('-'));
+                let num = a.diff(b, 'days');
+                let strAdd = str;
+                for(let i = 0;i<num;i++){
+                  let time = dayjs(strAdd).add(1, 'days').format('YYYY-MM-DD');
+                  strAdd = time
+                  arr.push({value:time});
+                }
+              }
+              this.setState({
+                rangeStartVal:dayjs(current.current).format('YYYY-MM-DD'),
+                rangeStartMinuteVal: dayjs(current.current).format('YYYY-MM-DD HH:mm:ss'),
+                validDates:arr
+              },()=>{
+                if(this.state.rangeEndVal){
+                  let a1 = dayjs(dayjs(current.current).format('YYYY-MM-DD HH:mm:ss'));
+                  let b1 = dayjs(dayjs(this.state.rangeEndMinuteVal).format('YYYY-MM-DD  HH:mm:ss'));
+                  this.getNumHourse(a1,b1)
+                }
+              })
+            }} onClear={()=>{
+              this.setState({
+                rangeStartVal:'',
+                rangeStartMinuteVal: '',
+                validDates:[],
+                totalDuration:0
+              })
+            }} initValue={dayjs().format('YYYY-MM-DD HH:mm:ss')} wrap-class="my-class"  select-item-class="mySelector" />
+          </View>
+        </View>
+        <View className='formItem'>
+          <View className='formName'>公出结束时间:</View>
+          <View className='formValue'>
+            <DateTimePicker ref={ref=>this.rangeEndRef = ref} onOk={(current)=>{
+              let arr = [];
+              if(this.state.rangeStartVal){
+                let str = dayjs(current.current).format('YYYY-MM-DD');
+                arr.push({value:this.state.rangeStartVal});
+                let a = dayjs(this.state.rangeStartVal.split('-'));
+                let b = dayjs(str.split('-'));
+                let num = b.diff(a, 'days');
+                let strAdd = this.state.rangeStartVal;
+                for(let i = 0;i<num;i++){
+                  let time = dayjs(strAdd).add(1, 'days').format('YYYY-MM-DD');
+                  strAdd = time
+                  arr.push({value:time});
+                }
+              }
+              this.setState({
+                rangeEndVal:dayjs(current.current).format('YYYY-MM-DD'),
+                rangeEndMinuteVal: dayjs(current.current).format('YYYY-MM-DD HH:mm:ss'),
+                validDates:arr,
+              },()=>{
+                if(this.state.rangeStartVal){
+                  let a1 = dayjs(dayjs(current.current).format('YYYY-MM-DD HH:mm:ss'));
+                  let b1 = dayjs(dayjs(this.state.rangeStartMinuteVal).format('YYYY-MM-DD  HH:mm:ss'));
+                  this.getNumHourse(b1,a1)
+                }
+              })
+            }} onClear={()=>{
+              this.setState({
+                rangeEndVal:'',
+                rangeEndMinuteVal: '',
+                validDates:[],
+                totalDuration:0
+              })
+            }} initValue={dayjs().format('YYYY-MM-DD HH:mm:ss')} wrap-class="my-class"  select-item-class="mySelector" />
+          </View>
+        </View>
+        <View className='formItem'>
+          <View className='formName'>总时长:</View>
+          <View className='formValue'>
+            {this.state.totalDuration}小时
+          </View>
+        </View>
+        {this.state.validDates.length !== 0? <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
+          <View className='formName'>去除放假时间:</View>
+          <AtCalendar
+            minDate={this.state.rangeStartVal}
+            maxDate={this.state.rangeEndVal}
+            isSwiper={false}
+            validDates={this.state.validDates}
+            onDayLongClick={(item)=>{
+              if(!(dayjs(item.value.split('-')).isSame(this.state.rangeStartVal.split('-')) || dayjs(item.value.split('-')).isSame(this.state.rangeEndVal.split('-')))){
+                if(!(dayjs(item.value.split('-')).isAfter(this.state.rangeStartVal.split('-')) && dayjs(item.value.split('-')).isBefore(this.state.rangeEndVal.split('-')))){
+                  return;
+                }
+              }else{
+                Taro.showToast({title:'开始结束时间不能取消',icon:'none'})
+                return
+              }
+              let index = this.state.validDates.findIndex(v=>{
+                let lv = dayjs(v.value.split('-')).isSame(item.value.split('-'));
+                return lv
+              })
+              if(index<0){
+                let arr = item.value.split('-');
+                this.state.validDates.push({value:arr.join('-')})
+                this.setState({
+                  validDates:this.state.validDates,
+                  totalDuration: this.state.totalDuration + 7.5
+                })
+              }else{
+                this.state.validDates.splice(index,1)
+                this.setState({
+                  validDates:this.state.validDates,
+                  totalDuration: this.state.totalDuration - 7.5
+                })
+              }
+            }}
+          />
+        </View> : null}
+        <View className='formItem'>
+          <View className='formName'>公出地点:</View>
+          <View className='formValue' onClick={this.selectArrder}>
+              <Text className='formValueText'>{this.props.locationInfor.name}</Text>
+              <AtIcon value='chevron-right' size='30' color='#bbbbbb'/>
+          </View>
+        </View>
+        <View className='tips'>地址选择错误,将影响打卡定位,选择后请认真核对</View>
+        <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
+          <View className='formName'>公出事由:</View>
+          <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
+            <AtTextarea
+              value={this.state.reason}
+              onChange={(v)=>{
+                this.setState({
+                  reason:v
+                })
+              }}
+              maxLength={200}
+              placeholder='请输入公出事由'
+            />
+          </View>
+        </View>
+        <View className='formItem' style={{display:'block'}}>
+          <View className='formName'>附件:</View>
+          <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
+            {dtails.annexUrl && this.props.isOpened ? <ImagePicker
+              files={dtails.annexUrl}
+              showAddBtn={true}
+              ref={ref => this.imagePickerRef = ref}
+              url='/api/admin/release/upload'
+              onChange={this.onChange}
+            /> : null }
+          </View>
+        </View>
+        <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.onSubmit}>
+            提交申请
+          </AtButton>
+        </View>
+      </View>
+    )
+  }
+}
+
+export default PublicContent;

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

@@ -0,0 +1,39 @@
+.publicContent{
+  padding: 20px;
+  .formItem{
+    display: flex;
+    align-items: center;
+    font-size: 30px;
+    padding-bottom: 25px;
+    .formName{
+      white-space: nowrap;
+    }
+    .formValue{
+      text-align: right;
+      flex: 1;
+      display: flex;
+      flex-flow: row nowrap;
+      align-items: center;
+      justify-content: flex-end;
+      .formValueText{
+        display: block;
+        width: 452px;
+        text-overflow: ellipsis;
+        overflow: hidden;
+        white-space: nowrap;
+      }
+    }
+  }
+  .tips{
+    font-size: 20px;
+    text-align: left;
+    color: #f00;
+  }
+  .operation{
+    display: flex;
+    flex-flow: row nowrap;
+  }
+  .at-image-picker__remove-btn{
+    display: block !important;
+  }
+}

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

@@ -35,9 +35,8 @@ class MyList extends Component {
           {
             this.props.list.map((v,k)=>(
               <View key={k} className='item' onClick={()=>{
-                console.log('/pages/egressDetails/index?type='+this.props.type+'&id='+v.id)
                 Taro.navigateTo({
-                  url:'/pages/egressDetails/index?type='+this.props.type+'&dtails='+JSON.stringify(v)
+                  url:'/pages/egressDetails/index?type='+this.props.type+'&id='+v.id
                 })
               }}>
                 <View className='infor'>

+ 2 - 2
src/pages/login/index.less

@@ -52,9 +52,9 @@
       margin-top: auto;
     }
   }
-  #_n_9{
+  .lxy-nav-bar__center{
     position: absolute;
-    left: -160px;
+    left: 50px;
     font-family: cursive;
     font-size: 38px;
     letter-spacing: 6px;

+ 27 - 27
src/pages/punchClock/index.jsx

@@ -130,33 +130,33 @@ class PunchClock extends Component {
       })
     })
 
-    // let token = Taro.getStorageSync('token');
-    //   //建立连接
-    //   Taro.connectSocket({
-    //     header:{
-    //       'token': token,
-    //     },
-    //     url: "wss://uat.jishutao.com/websocket",
-    //   //  172.16.0.188:8080
-    //   //  uat.jishutao.com
-    //   })
-    //
-    //   //连接成功
-    //   Taro.onSocketOpen(function() {
-    //     Taro.sendSocketMessage({
-    //       data: 'stock',
-    //     })
-    //   })
-    //
-    //   //接收数据
-    //   Taro.onSocketMessage(function(data) {
-    //     console.log(data,'接收数据')
-    //   })
-    //
-    //   //连接失败
-    //   Taro.onSocketError(function() {
-    //     console.log('websocket连接失败!');
-    //   })
+    let token = Taro.getStorageSync('token');
+      //建立连接
+      Taro.connectSocket({
+        header:{
+          'token': token,
+        },
+        url: "wss://uat.jishutao.com/webSocketServer",
+      //  172.16.0.188:8080
+      //  uat.jishutao.com
+      })
+
+      //连接成功
+      Taro.onSocketOpen(function() {
+        Taro.sendSocketMessage({
+          data: 'stock',
+        })
+      })
+
+      //接收数据
+      Taro.onSocketMessage(function(data) {
+        console.log(data,'接收数据')
+      })
+
+      //连接失败
+      Taro.onSocketError(function() {
+        console.log('websocket连接失败!');
+      })
   }
 
   publicReleaseClockIn(){

+ 2 - 2
src/utils/config.js

@@ -1,3 +1,3 @@
-// export const resourceAddress = 'http://172.16.0.188:3000/upload'
-export const resourceAddress = 'https://static.jishutao.com//upload'
+export const resourceAddress = 'http://172.16.0.188:3000/upload'
+// export const resourceAddress = 'https://static.jishutao.com/upload'
 

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

@@ -2,10 +2,10 @@ const getBaseUrl = (url) => {
   let BASE_URL = '';
   if (process.env.NODE_ENV === 'development') {
     //开发环境 - 根据请求不同返回不同的BASE_URL
-    BASE_URL = 'https://uat.jishutao.com'
+    BASE_URL = 'http://172.16.0.188:8080'
   } else {
     // 生产环境
-    BASE_URL = 'https://uat.jishutao.com'
+    BASE_URL = 'http://172.16.0.188:8080'
   }
   return BASE_URL
 }

+ 5 - 0
src/utils/servers/servers.js

@@ -66,6 +66,11 @@ export const getListPublicReleaseLog = (postData = {}) => {
   return HTTPREQUEST.get('/api/admin/release/listPublicReleaseLog', postData)
 }
 
+//修改公出申请
+export const updatePublicRelease = (postData = {}) => {
+  return HTTPREQUEST.post('/api/admin/release/updatePublicRelease', postData)
+}
+
 //测试
 export const test = (postData = {}) => {
   return HTTPREQUEST.get('/open/getVCode', postData)