Преглед изворни кода

增加询问
修改公出详情修改

HW пре 3 година
родитељ
комит
8c962725f2

+ 28 - 0
src/components/common/inquiryModal/index.jsx

@@ -0,0 +1,28 @@
+import React,{Component} from "react";
+import { Button } from '@tarojs/components'
+import { AtModal, AtModalHeader, AtModalContent, AtModalAction } from "taro-ui"
+
+import "taro-ui/dist/style/components/modal.scss";
+
+class InquiryModal extends Component{
+  constructor(props) {
+    super(props);
+  }
+
+  render() {
+    return(
+      <AtModal isOpened={this.props.isOpened}>
+        <AtModalHeader>{this.props.title || '提示'}</AtModalHeader>
+        <AtModalContent>
+          {this.props.content || ''}
+        </AtModalContent>
+        <AtModalAction>
+          <Button onClick={this.props.onClose}>取消</Button>
+          <Button onClick={this.props.onDetermine}>确定</Button>
+        </AtModalAction>
+      </AtModal>
+    )
+  }
+}
+
+export default InquiryModal;

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

@@ -19,6 +19,7 @@ import 'taro-ui/dist/style/components/textarea.scss';
 import 'taro-ui/dist/style/components/calendar.scss';
 
 import './publicContent.less';
+import InquiryModal from "../../components/common/inquiryModal";
 
 class PublicContent extends Component{
   constructor(props) {
@@ -293,6 +294,7 @@ class PublicContent extends Component{
         {this.state.validDates.length !== 0? <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
           <View className='formName'>去除放假时间:</View>
           <AtCalendar
+            currentDate={this.state.rangeStartVal}
             minDate={this.state.rangeStartVal}
             maxDate={this.state.rangeEndVal}
             isSwiper={false}
@@ -327,14 +329,14 @@ class PublicContent extends Component{
             }}
           />
         </View> : null}
-        <View className='formItem'>
+        <View className='formItem' style={{paddingBottom:0}}>
           <View className='formName'>公出地点:</View>
           <View className='formValue' onClick={this.selectArrder}>
               <Text className='formValueText'>{this.props.selectArrderLocation.name}</Text>
               <AtIcon value='chevron-right' size='30' color='#bbbbbb'/>
           </View>
         </View>
-        <View className='tips'>地址选择错误,将影响打卡定位,选择后请认真核对</View>
+        <View className='tips'>打卡范围是以地图中红标为中心100米范围为可打卡范围,拖动地图可移动红标</View>
         <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
           <View className='formName'>公出事由:</View>
           <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
@@ -367,10 +369,40 @@ class PublicContent extends Component{
           }}>
             上一步
           </AtButton>
-          <AtButton type='primary' loading={this.state.loading} circle onClick={this.onSubmit}>
+          <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}
+          content={this.state.inquiryContent}
+          onClose={()=>{
+            this.setState({
+              isInquiryOpened:false,
+              inquiryTitle:'',
+              inquiryContent:'',
+            })
+          }}
+          onDetermine={()=>{
+            this.state.inquiryFn();
+            this.setState({
+              isInquiryOpened:false,
+              inquiryTitle:'',
+              inquiryContent:'',
+              inquiryFn:()=>{}
+            })
+          }}
+        />
       </View>
     )
   }

+ 1 - 1
src/pages/applyDepart/publicContent.less

@@ -4,7 +4,7 @@
     display: flex;
     align-items: center;
     font-size: 30px;
-    padding-bottom: 25px;
+    padding-bottom: 28px;
     .formName{
       white-space: nowrap;
     }

+ 1 - 1
src/pages/egressDetails/enterprise.jsx

@@ -109,7 +109,7 @@ class Enterprise extends Component{
                 this.setState({
                   selectId:v.id
                 })
-                this.props.onChange({uid:v.id});
+                this.props.onChange({uid:v.id,nickname:v.name});
               }}>
                 <View style={{fontSize:'15px'}}>{v.name}</View>
                 {this.state.selectId === v.id ? <Icon size='20' type='success_no_circle' /> : null}

+ 49 - 16
src/pages/egressDetails/index.jsx

@@ -1,12 +1,14 @@
 import React,{Component} from "react";
 import { View,Image,Button } from '@tarojs/components'
 import Taro, { getCurrentInstance } from "@tarojs/taro";
-import {AtButton, AtCalendar, AtIcon, AtTextarea} from 'taro-ui'
+import {AtButton, AtCalendar, AtIcon, AtTextarea,AtModal, AtTimeline, AtModalContent, AtModalAction} from 'taro-ui'
+import Skeleton from 'taro-skeleton'
+
+import InquiryModal from '../../components/common/inquiryModal';
+
+import Modify from './modify';
 import {examinePublicRelease,getReleasetDails,getListPublicReleaseLog} from '../../utils/servers/servers';
 import {resourceAddress} from '../../utils/config';
-import { AtModal, AtTimeline, AtModalContent, AtModalAction } from "taro-ui";
-import Modify from './modify';
-import Skeleton from 'taro-skeleton'
 import './index.less';
 
 import 'taro-ui/dist/style/components/icon.scss';
@@ -21,7 +23,6 @@ import Passed from '../../image/passed.png';
 import Reviewed from '../../image/reviewed.png';
 import Wx from '../../image/wx.png';
 import ImagePicker from "../../components/common/imagePicker";
-
 import switchIocn from '../../image/switch.png';
 import MessageNoticebar from "../../components/common/messageNoticebar";
 
@@ -38,7 +39,6 @@ class EgressDetails extends Component{
       isDetailedOpened:false,
       isOpened:false,
       isModifyOpened:false,
-      modifyType:0,
       selectArrderLocation:{}
     }
     this.examinePublicRelease= this.examinePublicRelease.bind(this);
@@ -221,7 +221,6 @@ class EgressDetails extends Component{
                   <View className='edit' onClick={()=>{
                     this.setState({
                       isModifyOpened:true,
-                      modifyType:2,
                     })
                   }}>
                     <AtIcon value='edit' size='18' color='#3864ef'/>
@@ -274,12 +273,12 @@ class EgressDetails extends Component{
             <View className='item'>
               <View className='title'>
                 公出企业
-                {dtails.permission === 0 && dtails.status === 0 ? <Image src={switchIocn} className='switchItem' onClick={()=>{
-                  this.setState({
-                    isModifyOpened:true,
-                    modifyType:1,
-                  })
-                }}/> : null}
+                {/*{dtails.permission === 0 && dtails.status === 0 ? <Image src={switchIocn} className='switchItem' onClick={()=>{*/}
+                {/*  this.setState({*/}
+                {/*    isModifyOpened:true,*/}
+                {/*    modifyType:1,*/}
+                {/*  })*/}
+                {/*}}/> : null}*/}
               </View>
               <View className='value'>
                 {dtails.nickname}
@@ -319,12 +318,26 @@ class EgressDetails extends Component{
               dtails.permission === 1 && dtails.status === 1 ?
                 <View className='operation'>
                   <AtButton type='secondary' circle loading={this.state.loading} onClick={()=>{
-                    this.examinePublicRelease(0);
+                    this.setState({
+                      isInquiryOpened:true,
+                      inquiryTitle:'提醒',
+                      inquiryContent:'您确定要驳回此申请吗?',
+                      inquiryFn:()=>{
+                        this.examinePublicRelease(0);
+                      }
+                    })
                   }}>
                     驳回
                   </AtButton>
                   <AtButton type='primary' loading={this.state.loading} circle onClick={()=>{
-                    this.examinePublicRelease(2);
+                    this.setState({
+                      isInquiryOpened:true,
+                      inquiryTitle:'提醒',
+                      inquiryContent:'您确定要同意此申请吗?',
+                      inquiryFn:()=>{
+                        this.examinePublicRelease(2);
+                      }
+                    })
                   }}>
                     同意
                   </AtButton>
@@ -380,7 +393,6 @@ class EgressDetails extends Component{
           locationInfor={this.state.selectArrderLocation}
           id={this.$instance.router.params.id}
           isOpened={this.state.isModifyOpened}
-          modifyType={this.state.modifyType}
           onModalClose={()=>{
             this.setState({
               isModifyOpened:false,
@@ -394,6 +406,27 @@ class EgressDetails extends Component{
             this.getReleasetDails();
           })
         }}/> : null}
+        <InquiryModal
+          isOpened={this.state.isInquiryOpened}
+          title={this.state.inquiryTitle}
+          content={this.state.inquiryContent}
+          onClose={()=>{
+            this.setState({
+              isInquiryOpened:false,
+              inquiryTitle:'',
+              inquiryContent:'',
+            })
+          }}
+          onDetermine={()=>{
+            this.state.inquiryFn();
+            this.setState({
+              isInquiryOpened:false,
+              inquiryTitle:'',
+              inquiryContent:'',
+              inquiryFn:()=>{}
+            })
+          }}
+        />
       </View>
     )
   }

+ 15 - 26
src/pages/egressDetails/modify.jsx

@@ -13,7 +13,9 @@ class Modify extends Component{
   constructor(props) {
     super(props);
     this.state={
-      data:{}
+      data:{},
+      dtails:props.dtails,
+      modifyType:1,
     }
     this.submit = this.submit.bind(this);
     this.onChange = this.onChange.bind(this);
@@ -21,29 +23,12 @@ class Modify extends Component{
 
   submit(){
     if(Object.keys(this.state.data).length === 0){
-      this.props.onClose();
+      Taro.showToast({title:'请先选择公出的企业',icon:'none'})
       return;
     }
-    updatePublicRelease({
-      id:this.props.id,
-      ...this.state.data
-    }).then(v=>{
-      if(v.error.length === 0){
-        Taro.showToast({title:'修改成功'});
-        Taro.eventCenter.trigger('listOperation',{
-          type:this.props.permission,
-          status: 1,
-          index:this.props.index
-        })
-        this.props.onClose();
-      }else{
-        Taro.showToast({title:v.error[0].message,icon:'none'})
-      }
-    }).catch(err=>{
-      Taro.showToast({title:'系统错误.请稍后重试',icon:'none'})
-      console.log(err)
+    this.setState({
+      modifyType:2
     })
-
   }
 
   componentWillUnmount() {
@@ -54,7 +39,11 @@ class Modify extends Component{
 
   onChange(value){
     this.setState({
-      data:value
+      dtails:{
+        ...this.state.dtails,
+        ...value,
+      },
+      data:value,
     })
   }
 
@@ -63,7 +52,7 @@ class Modify extends Component{
       <AtModal isOpened={this.props.isOpened} onClose={this.props.onModalClose}>
         <AtModalContent>
           {
-            this.props.modifyType === 1 ?
+            this.state.modifyType === 1 ?
               <Enterprise isOpened={this.props.isOpened} onChange={this.onChange}/> :
               <PublicContent
                 permission={this.props.permission}
@@ -72,14 +61,14 @@ class Modify extends Component{
                   this.props.onClose();
                 }}
                 locationInfor={this.props.locationInfor}
-                dtails={this.props.dtails}
+                dtails={this.state.dtails}
                 isOpened={this.props.isOpened}
                 onChange={this.onChange}
               />
           }
         </AtModalContent>
         {
-          this.props.modifyType === 1 ?
+          this.state.modifyType === 1 ?
             <AtModalAction>
               <Button onClick={()=>{
                 this.props.onClose();
@@ -87,7 +76,7 @@ class Modify extends Component{
                 取消
               </Button>
               <Button onClick={this.submit}>
-                确定
+                下一步
               </Button>
             </AtModalAction>:
             null

+ 35 - 2
src/pages/egressDetails/publicContent.jsx

@@ -20,6 +20,7 @@ import 'taro-ui/dist/style/components/textarea.scss';
 import 'taro-ui/dist/style/components/calendar.scss';
 
 import './publicContent.less';
+import InquiryModal from "../../components/common/inquiryModal";
 
 class PublicContent extends Component{
   constructor(props) {
@@ -142,6 +143,7 @@ class PublicContent extends Component{
     })
     updatePublicRelease({
       id:this.props.dtails.id,
+      uid:this.props.dtails.uid,
       releaseStarts:this.state.rangeStartMinuteVal,
       releaseEnds:this.state.rangeEndMinuteVal,
       remarks:this.state.reason,
@@ -323,6 +325,7 @@ class PublicContent extends Component{
         {this.state.validDates.length !== 0? <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
           <View className='formName'>去除放假时间:</View>
           <AtCalendar
+            currentDate={this.state.rangeStartVal}
             minDate={this.state.rangeStartVal}
             maxDate={this.state.rangeEndVal}
             isSwiper={false}
@@ -398,10 +401,40 @@ class PublicContent extends Component{
           }}>
             取消
           </AtButton>
-          <AtButton type='primary' loading={this.state.loading} circle onClick={this.onSubmit}>
-            提交申请
+          <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}
+          content={this.state.inquiryContent}
+          onClose={()=>{
+            this.setState({
+              isInquiryOpened:false,
+              inquiryTitle:'',
+              inquiryContent:'',
+            })
+          }}
+          onDetermine={()=>{
+            this.state.inquiryFn();
+            this.setState({
+              isInquiryOpened:false,
+              inquiryTitle:'',
+              inquiryContent:'',
+              inquiryFn:()=>{}
+            })
+          }}
+        />
       </View>
     )
   }