|
@@ -1,16 +1,16 @@
|
|
|
-import React,{Component} from 'react';
|
|
|
+import React, { Component } from 'react';
|
|
|
import Taro from '@tarojs/taro';
|
|
|
-import {Text, View} from '@tarojs/components'
|
|
|
+import { Text, View } from '@tarojs/components'
|
|
|
import dayjs from 'dayjs';
|
|
|
import './index.less';
|
|
|
|
|
|
import ImagePicker from '../../components/common/imagePicker'
|
|
|
-import {resourceAddress} from '../../utils/config';
|
|
|
+import { resourceAddress } from '../../utils/config';
|
|
|
|
|
|
-import { AtButton,AtTextarea ,AtIcon,AtCalendar } from 'taro-ui'
|
|
|
-import {updatePublicRelease,getWorkingHoursList} from '../../utils/servers/servers';
|
|
|
+import { AtButton, AtTextarea, AtIcon, AtCalendar } from 'taro-ui'
|
|
|
+import { updatePublicRelease, getWorkingHoursList } from '../../utils/servers/servers';
|
|
|
|
|
|
-import {getHours, getNumHourse, getUserWordTimes} from '../../utils/tools';
|
|
|
+import { getHours, getNumHourse, getUserWordTimes } from '../../utils/tools';
|
|
|
|
|
|
import 'taro-ui/dist/style/components/form.scss';
|
|
|
import 'taro-ui/dist/style/components/button.scss';
|
|
@@ -23,26 +23,24 @@ import 'taro-ui/dist/style/components/calendar.scss';
|
|
|
import './publicContent.less';
|
|
|
import InquiryModal from "../../components/common/inquiryModal";
|
|
|
|
|
|
-class PublicContent extends Component{
|
|
|
+class PublicContent extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.state={
|
|
|
- rangeStartVal:'',
|
|
|
- rangeEndVal:'',
|
|
|
- rangeEndMinuteVal:'',
|
|
|
- rangeStartMinuteVal:'',
|
|
|
- reason:'',
|
|
|
- plan:'',
|
|
|
- expectedEffect:'',
|
|
|
- imgs:[],
|
|
|
- validDates:[],
|
|
|
- totalDuration:0,
|
|
|
- loading:false,
|
|
|
-
|
|
|
- workTypeList:[],
|
|
|
- workType:0,
|
|
|
-
|
|
|
- isPickerRender:false,
|
|
|
+ this.state = {
|
|
|
+ rangeStartVal: '',
|
|
|
+ rangeEndVal: '',
|
|
|
+ rangeEndMinuteVal: '',
|
|
|
+ rangeStartMinuteVal: '',
|
|
|
+ reason: '',
|
|
|
+ plan: '',
|
|
|
+ expectedEffect: '',
|
|
|
+ imgs: [],
|
|
|
+ validDates: [],
|
|
|
+ totalDuration: 0,
|
|
|
+ loading: false,
|
|
|
+ workTypeList: [],
|
|
|
+ workType: 0,
|
|
|
+ isPickerRender: false,
|
|
|
}
|
|
|
this.onSubmit = this.onSubmit.bind(this);
|
|
|
this.selectArrder = this.selectArrder.bind(this);
|
|
@@ -56,18 +54,20 @@ class PublicContent extends Component{
|
|
|
|
|
|
componentDidMount() {
|
|
|
let arr = [];
|
|
|
- for(let i of this.props.dtails.annexUrl){
|
|
|
+ for (let i of this.props.dtails.annexUrl) {
|
|
|
arr.push(i.url.split(resourceAddress).join(""))
|
|
|
}
|
|
|
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'),
|
|
|
+ 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'),
|
|
|
+ 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,
|
|
|
})
|
|
|
this.getWorkingHoursList();
|
|
|
}
|
|
@@ -75,126 +75,149 @@ class PublicContent extends Component{
|
|
|
componentWillUnmount() {
|
|
|
this.imagePickerRef && this.imagePickerRef.clear();
|
|
|
this.setState({
|
|
|
- rangeStartVal:'',
|
|
|
- rangeEndVal:'',
|
|
|
- rangeEndMinuteVal:'',
|
|
|
- rangeStartMinuteVal:'',
|
|
|
- reason:'',
|
|
|
- plan:'',
|
|
|
- expectedEffect:'',
|
|
|
- imgs:[],
|
|
|
- validDates:[],
|
|
|
- totalDuration:0,
|
|
|
- loading:false,
|
|
|
+ rangeStartVal: '',
|
|
|
+ rangeEndVal: '',
|
|
|
+ rangeEndMinuteVal: '',
|
|
|
+ rangeStartMinuteVal: '',
|
|
|
+ reason: '',
|
|
|
+ plan: '',
|
|
|
+ expectedEffect: '',
|
|
|
+ imgs: [],
|
|
|
+ validDates: [],
|
|
|
+ totalDuration: 0,
|
|
|
+ loading: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- getWorkingHoursList(){
|
|
|
- getWorkingHoursList({}).then((v)=>{
|
|
|
- if(v.error.length === 0){
|
|
|
+ getWorkingHoursList() {
|
|
|
+ getWorkingHoursList({}).then((v) => {
|
|
|
+ if (v.error.length === 0) {
|
|
|
let obj = Taro.getStorageSync('userInfor');
|
|
|
- let index = v.data.findIndex(value=>value.type === obj.workTimeInfor.type);
|
|
|
+ let index = v.data.findIndex(value => value.type === obj.workTimeInfor.type);
|
|
|
this.setState({
|
|
|
- workType:index !== -1 ? index : 0
|
|
|
+ workType: index !== -1 ? index : 0
|
|
|
})
|
|
|
this.setState({
|
|
|
- workTypeList:v.data
|
|
|
+ workTypeList: v.data
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Taro.showToast({
|
|
|
- title:v.error[0].message,
|
|
|
- icon:'none'
|
|
|
+ title: v.error[0].message,
|
|
|
+ icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
- }).catch(err=>{
|
|
|
+ }).catch(err => {
|
|
|
console.log(err)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- getNumHourse(startTime,endTime){
|
|
|
+ getNumHourse(startTime, endTime) {
|
|
|
this.setState({
|
|
|
- totalDuration:getNumHourse(startTime,endTime,this.state.validDates.length)
|
|
|
+ totalDuration: getNumHourse(startTime, endTime, this.state.validDates.length)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
- onSubmit(){
|
|
|
- if(!this.state.rangeStartMinuteVal){
|
|
|
- Taro.showToast({title:'请选择公出时间',icon:'none'})
|
|
|
- return ;
|
|
|
+ onSubmit() {
|
|
|
+ if (!this.state.rangeStartMinuteVal) {
|
|
|
+ Taro.showToast({ title: '请选择公出时间', icon: 'none' })
|
|
|
+ return;
|
|
|
}
|
|
|
- if(!this.state.rangeEndMinuteVal){
|
|
|
- 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.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.reason) {
|
|
|
+ Taro.showToast({ title: '请输入公出目标', icon: 'none' })
|
|
|
+ return;
|
|
|
}
|
|
|
- if(!this.state.plan){
|
|
|
- Taro.showToast({title:'请输入公出计划',icon:'none'})
|
|
|
- return ;
|
|
|
+ if (!this.state.plan) {
|
|
|
+ Taro.showToast({ title: '请输入公出计划', icon: 'none' })
|
|
|
+ return;
|
|
|
}
|
|
|
- if(!this.state.expectedEffect){
|
|
|
- Taro.showToast({title:'请输入预计效果',icon:'none'})
|
|
|
- return ;
|
|
|
+ if (!this.state.expectedEffect) {
|
|
|
+ Taro.showToast({ title: '请输入预计效果', icon: 'none' })
|
|
|
+ return;
|
|
|
}
|
|
|
- if(this.state.totalDuration === 0){
|
|
|
- Taro.showToast({title:'公出时间不足0小时',icon:'none'})
|
|
|
- return ;
|
|
|
+ if (this.state.totalDuration === 0) {
|
|
|
+ Taro.showToast({ title: '公出时间不足0小时', icon: 'none' })
|
|
|
+ return;
|
|
|
}
|
|
|
this.setState({
|
|
|
- loading:true
|
|
|
+ loading: true
|
|
|
})
|
|
|
- updatePublicRelease({
|
|
|
- id:this.props.dtails.id,
|
|
|
- uid:this.props.dtails.uid,
|
|
|
- releaseStarts:this.state.rangeStartMinuteVal,
|
|
|
- releaseEnds:this.state.rangeEndMinuteVal,
|
|
|
- remarks:this.state.reason,
|
|
|
- plan:this.state.plan,
|
|
|
- expectedEffect:this.state.expectedEffect,
|
|
|
- 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=>{
|
|
|
+ let datas;
|
|
|
+ if (this.props.dtails.type == 0) {
|
|
|
+ datas = {
|
|
|
+ id: this.props.dtails.id,
|
|
|
+ uid: this.props.dtails.uid,
|
|
|
+ releaseStarts: this.state.rangeStartMinuteVal,
|
|
|
+ releaseEnds: this.state.rangeEndMinuteVal,
|
|
|
+ remarks: this.state.reason,
|
|
|
+ plan: this.state.plan,
|
|
|
+ expectedEffect: this.state.expectedEffect,
|
|
|
+ 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),
|
|
|
+ type: this.props.dtails.type,
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ datas = {
|
|
|
+ id: this.props.dtails.id,
|
|
|
+ uid: this.props.dtails.uid,
|
|
|
+ releaseStarts: this.state.rangeStartMinuteVal,
|
|
|
+ releaseEnds: this.state.rangeEndMinuteVal,
|
|
|
+ remarks: this.state.reason,
|
|
|
+ plan: this.state.plan,
|
|
|
+ expectedEffect: this.state.expectedEffect,
|
|
|
+ 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),
|
|
|
+ type: this.props.dtails.type,
|
|
|
+ orderNo: this.props.dtails.orderNo,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ updatePublicRelease(datas).then(v => {
|
|
|
this.setState({
|
|
|
- loading:false
|
|
|
+ loading: false
|
|
|
})
|
|
|
- if(v.error.length === 0){
|
|
|
+ if (v.error.length === 0) {
|
|
|
Taro.showToast({
|
|
|
- title:'修改成功',
|
|
|
+ title: '修改成功',
|
|
|
})
|
|
|
- Taro.eventCenter.trigger('listOperation',{
|
|
|
- type:this.props.permission,
|
|
|
- index:this.props.index,
|
|
|
+ Taro.eventCenter.trigger('listOperation', {
|
|
|
+ type: this.props.permission,
|
|
|
+ index: this.props.index,
|
|
|
status: 1,
|
|
|
userName: this.props.locationInfor.name,
|
|
|
- releaseStarts:this.state.rangeStartMinuteVal,
|
|
|
- releaseEnds:this.state.rangeEndMinuteVal,
|
|
|
+ releaseStarts: this.state.rangeStartMinuteVal,
|
|
|
+ releaseEnds: this.state.rangeEndMinuteVal,
|
|
|
})
|
|
|
this.props.onClose();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Taro.showToast({
|
|
|
- title:v.error[0].message,
|
|
|
- icon:'none'
|
|
|
+ title: v.error[0].message,
|
|
|
+ icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
- }).catch(()=>{
|
|
|
+ }).catch(() => {
|
|
|
this.setState({
|
|
|
- loading:false
|
|
|
+ loading: false
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- selectArrder(){
|
|
|
+ selectArrder() {
|
|
|
const key = 'AWBBZ-GRAC2-JFYUO-CLA7I-JAHXK-YFFGT'; //使用在腾讯位置服务申请的key
|
|
|
const referer = '科德打卡定位'; //调用插件的app的名称
|
|
|
const category = '公司企业,房产小区';
|
|
@@ -203,25 +226,25 @@ class PublicContent extends Component{
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- onChange(value,type){
|
|
|
+ onChange(value, type) {
|
|
|
let arr = this.state.imgs.concat([]);
|
|
|
- if(type === 'add'){
|
|
|
+ if (type === 'add') {
|
|
|
arr.push(value)
|
|
|
- }else if(type === 'remove'){
|
|
|
- arr.splice(value,1)
|
|
|
+ } else if (type === 'remove') {
|
|
|
+ arr.splice(value, 1)
|
|
|
}
|
|
|
this.setState({
|
|
|
imgs: arr,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- onPickerHide(){
|
|
|
+ onPickerHide() {
|
|
|
this.setState({
|
|
|
isPickerRender: false,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- onSetPickerTime(val){
|
|
|
+ onSetPickerTime(val) {
|
|
|
let data = val.detail;
|
|
|
this.setState({
|
|
|
rangeStartMinuteVal: data.selectStartTime,
|
|
@@ -229,29 +252,30 @@ class PublicContent extends Component{
|
|
|
});
|
|
|
|
|
|
let arr = [];
|
|
|
- if(data.startTime && data.endTime){
|
|
|
+ if (data.startTime && data.endTime) {
|
|
|
let a = dayjs(data.startTime);
|
|
|
let b = dayjs(data.endTime);
|
|
|
- let num = b.diff(a, 'day')+1;
|
|
|
+ let num = b.diff(a, 'day') + 1;
|
|
|
let strAdd = data.startTime;
|
|
|
- for(let i = 0;i<num;i++){
|
|
|
+ for (let i = 0; i < num; i++) {
|
|
|
let time = dayjs(strAdd).add(i, 'days').format('YYYY-MM-DD');
|
|
|
- arr.push({value:time});
|
|
|
+ arr.push({ value: time });
|
|
|
}
|
|
|
}
|
|
|
this.setState({
|
|
|
- rangeEndVal:dayjs(data.endTime).format('YYYY-MM-DD'),
|
|
|
- rangeStartVal:dayjs(data.startTime).format('YYYY-MM-DD'),
|
|
|
- validDates:arr,
|
|
|
- },()=>{
|
|
|
+ rangeEndVal: dayjs(data.endTime).format('YYYY-MM-DD'),
|
|
|
+ rangeStartVal: dayjs(data.startTime).format('YYYY-MM-DD'),
|
|
|
+ validDates: arr,
|
|
|
+ }, () => {
|
|
|
let a1 = dayjs(dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss'));
|
|
|
let b1 = dayjs(dayjs(data.startTime).format('YYYY-MM-DD HH:mm:ss'));
|
|
|
- this.getNumHourse(b1,a1)
|
|
|
+ this.getNumHourse(b1, a1)
|
|
|
})
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
- const {dtails} = this.props;
|
|
|
+ const { dtails } = this.props;
|
|
|
+ console.log(dtails);
|
|
|
return (
|
|
|
<View className='publicContent'>
|
|
|
<View className='formItem'>
|
|
@@ -259,29 +283,37 @@ class PublicContent extends Component{
|
|
|
<View className='formValue'>{dtails.nickname}</View>
|
|
|
</View>
|
|
|
<View className='formItem'>
|
|
|
+ <View className='formName'>公出类型:</View>
|
|
|
+ <View className='formValue'>{dtails.type == 1 ? '技术公出' : '业务/行政公出'}</View>
|
|
|
+ </View>
|
|
|
+ { dtails.contractNo ? <View className='formItem'>
|
|
|
+ <View className='formName'>合同编号:</View>
|
|
|
+ <View className='formValue'>{dtails.contractNo}</View>
|
|
|
+ </View> : ''}
|
|
|
+ <View className='formItem'>
|
|
|
<View className='formName'>作息时间类型:</View>
|
|
|
<View className='formValue'>
|
|
|
- <picker onChange={(e)=>{
|
|
|
+ <picker onChange={(e) => {
|
|
|
this.setState({
|
|
|
workType: e.detail.value
|
|
|
})
|
|
|
- if(this.state.workTypeList[e.detail.value]){
|
|
|
+ if (this.state.workTypeList[e.detail.value]) {
|
|
|
let obj = Taro.getStorageSync('userInfor');
|
|
|
obj.workTimeInfor = this.state.workTypeList[e.detail.value];
|
|
|
Taro.setStorageSync('userInfor', obj);
|
|
|
this.setState({
|
|
|
- rangeStartVal:'',
|
|
|
+ rangeStartVal: '',
|
|
|
rangeStartMinuteVal: '',
|
|
|
- rangeEndMinuteVal:'',
|
|
|
- rangeEndVal:'',
|
|
|
- validDates:[],
|
|
|
- totalDuration:0
|
|
|
+ rangeEndMinuteVal: '',
|
|
|
+ rangeEndVal: '',
|
|
|
+ validDates: [],
|
|
|
+ totalDuration: 0
|
|
|
})
|
|
|
}
|
|
|
}} value={this.state.workType} rangeKey='name' range={this.state.workTypeList}>
|
|
|
- <view style={{display:'flex',alignItems:'center'}}>
|
|
|
+ <view style={{ display: 'flex', alignItems: 'center' }}>
|
|
|
{this.state.workTypeList[this.state.workType] ? this.state.workTypeList[this.state.workType].name : ''}
|
|
|
- <AtIcon value='chevron-right' size='20' color='#bbbbbb'/>
|
|
|
+ <AtIcon value='chevron-right' size='20' color='#bbbbbb' />
|
|
|
</view>
|
|
|
</picker>
|
|
|
</View>
|
|
@@ -289,9 +321,9 @@ class PublicContent extends Component{
|
|
|
<View className='formItem'>
|
|
|
<View className='formName'>公出时间:</View>
|
|
|
<View className='formValue'>
|
|
|
- <View className='time' onClick={()=>{
|
|
|
+ <View className='time' onClick={() => {
|
|
|
this.setState({
|
|
|
- isPickerRender:true
|
|
|
+ isPickerRender: true
|
|
|
})
|
|
|
}}>
|
|
|
{
|
|
@@ -302,7 +334,7 @@ class PublicContent extends Component{
|
|
|
<View>
|
|
|
结束时间:{this.state.rangeEndMinuteVal}
|
|
|
</View>
|
|
|
- </View>: '请选择公出时间'
|
|
|
+ </View> : '请选择公出时间'
|
|
|
}
|
|
|
</View>
|
|
|
<timePicker
|
|
@@ -312,28 +344,28 @@ class PublicContent extends Component{
|
|
|
dateLimit: false,
|
|
|
initStartTime: this.state.rangeStartMinuteVal, //默认开始时间
|
|
|
initEndTime: this.state.rangeEndMinuteVal, //默认结束时间
|
|
|
- limitStartTime: dayjs().subtract(3,'year').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- limitEndTime: dayjs().add(3,'year').format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ limitStartTime: dayjs().subtract(3, 'year').format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ limitEndTime: dayjs().add(3, 'year').format('YYYY-MM-DD HH:mm:ss')
|
|
|
}}
|
|
|
isPartition
|
|
|
pickerShow={this.state.isPickerRender}
|
|
|
- onconditionaljudgment={(v)=>{
|
|
|
+ onconditionaljudgment={(v) => {
|
|
|
let a = dayjs(dayjs(v.detail.endTime).second(0).format('YYYY-MM-DD HH:mm:ss'));
|
|
|
let b = dayjs(dayjs().second(0).format('YYYY-MM-DD HH:mm:ss'))
|
|
|
- if(a.isBefore(b)){
|
|
|
+ if (a.isBefore(b)) {
|
|
|
Taro.showToast({
|
|
|
- title:'结束时间不能小于当前时间',
|
|
|
- icon:'none'
|
|
|
+ title: '结束时间不能小于当前时间',
|
|
|
+ icon: 'none'
|
|
|
})
|
|
|
v.detail.setLv(false);
|
|
|
}
|
|
|
}}
|
|
|
- onhidepicker={()=>{
|
|
|
+ onhidepicker={() => {
|
|
|
this.onPickerHide()
|
|
|
}}
|
|
|
- onsetpickertime={(v)=>{
|
|
|
+ onsetpickertime={(v) => {
|
|
|
this.onSetPickerTime(v)
|
|
|
- }}/>
|
|
|
+ }} />
|
|
|
</View>
|
|
|
</View>
|
|
|
<View className='formItem'>
|
|
@@ -342,7 +374,7 @@ class PublicContent extends Component{
|
|
|
{this.state.totalDuration}小时
|
|
|
</View>
|
|
|
</View>
|
|
|
- {this.state.validDates.length !== 0? <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
|
|
|
+ {this.state.validDates.length !== 0 ? <View className='formItem' style={{ display: 'block', paddingTop: '15px' }}>
|
|
|
<View className='formName'>
|
|
|
<View>去除放假时间:</View>
|
|
|
<View className='tips'>绿色方块为公出时间,长按即可去除放假时间</View>
|
|
@@ -353,32 +385,32 @@ class PublicContent extends Component{
|
|
|
maxDate={this.state.rangeEndVal}
|
|
|
isSwiper={false}
|
|
|
validDates={this.state.validDates}
|
|
|
- onDayLongClick={(item)=>{
|
|
|
- if(!(dayjs(item.value).isSame(this.state.rangeStartVal) || dayjs(item.value).isSame(this.state.rangeEndVal))){
|
|
|
- if(!(dayjs(item.value).isAfter(this.state.rangeStartVal) && dayjs(item.value).isBefore(this.state.rangeEndVal))){
|
|
|
+ onDayLongClick={(item) => {
|
|
|
+ if (!(dayjs(item.value).isSame(this.state.rangeStartVal) || dayjs(item.value).isSame(this.state.rangeEndVal))) {
|
|
|
+ if (!(dayjs(item.value).isAfter(this.state.rangeStartVal) && dayjs(item.value).isBefore(this.state.rangeEndVal))) {
|
|
|
return;
|
|
|
}
|
|
|
- }else{
|
|
|
- Taro.showToast({title:'开始结束时间不能取消',icon:'none'})
|
|
|
+ } else {
|
|
|
+ Taro.showToast({ title: '开始结束时间不能取消', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
- let index = this.state.validDates.findIndex(v=>{
|
|
|
+ let index = this.state.validDates.findIndex(v => {
|
|
|
let lv = dayjs(v.value).isSame(item.value);
|
|
|
return lv
|
|
|
})
|
|
|
- const {start,end} = getUserWordTimes();
|
|
|
- let totalDuration = getHours(dayjs().format('YYYY-MM-DD')+start,dayjs(dayjs().format('YYYY-MM-DD')+end)); //一天工作时长
|
|
|
- if(index<0){
|
|
|
+ const { start, end } = getUserWordTimes();
|
|
|
+ let totalDuration = getHours(dayjs().format('YYYY-MM-DD') + start, dayjs(dayjs().format('YYYY-MM-DD') + end)); //一天工作时长
|
|
|
+ if (index < 0) {
|
|
|
let arr = item.value.split('-');
|
|
|
- this.state.validDates.push({value:arr.join('-')})
|
|
|
+ this.state.validDates.push({ value: arr.join('-') })
|
|
|
this.setState({
|
|
|
- validDates:this.state.validDates,
|
|
|
+ validDates: this.state.validDates,
|
|
|
totalDuration: this.state.totalDuration + totalDuration
|
|
|
})
|
|
|
- }else{
|
|
|
- this.state.validDates.splice(index,1)
|
|
|
+ } else {
|
|
|
+ this.state.validDates.splice(index, 1)
|
|
|
this.setState({
|
|
|
- validDates:this.state.validDates,
|
|
|
+ validDates: this.state.validDates,
|
|
|
totalDuration: this.state.totalDuration - totalDuration
|
|
|
})
|
|
|
}
|
|
@@ -386,89 +418,89 @@ class PublicContent extends Component{
|
|
|
/>
|
|
|
</View> : null}
|
|
|
<View className='formItem' style={{
|
|
|
- paddingBottom:0
|
|
|
+ paddingBottom: 0
|
|
|
}}>
|
|
|
<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'/>
|
|
|
+ <Text className='formValueText'>{this.props.locationInfor.name}</Text>
|
|
|
+ <AtIcon value='chevron-right' size='30' color='#bbbbbb' />
|
|
|
</View>
|
|
|
</View>
|
|
|
<View className='tips'>以地图为中心100米范围为可打卡区域,移动红标只需要拖动地图即可</View>
|
|
|
- <View className='formItem' style={{display:'block',paddingTop:'15px'}}>
|
|
|
+ <View className='formItem' style={{ display: 'block', paddingTop: '15px' }}>
|
|
|
{/* 公出目标 */}
|
|
|
- <View className='formName'><Text style={{color:'red'}}>*公出目标:</Text>
|
|
|
- <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
|
|
|
- <AtTextarea
|
|
|
- height={46}
|
|
|
- value={this.state.reason}
|
|
|
- onChange={(v)=>{
|
|
|
- this.setState({
|
|
|
- reason:v
|
|
|
- })
|
|
|
- }}
|
|
|
- maxLength={200}
|
|
|
- placeholder='本次公出目标,谈的思路与步骤?'
|
|
|
- />
|
|
|
- </View>
|
|
|
+ <View className='formName'><Text style={{ color: 'red' }}>*公出目标:</Text>
|
|
|
+ <View className='formValue' style={{ paddingTop: '10px', textAlign: 'left' }}>
|
|
|
+ <AtTextarea
|
|
|
+ height={46}
|
|
|
+ value={this.state.reason}
|
|
|
+ onChange={(v) => {
|
|
|
+ this.setState({
|
|
|
+ reason: v
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ maxLength={200}
|
|
|
+ placeholder='本次公出目标,谈的思路与步骤?'
|
|
|
+ />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
{/* 公出计划 */}
|
|
|
- <View className='formName'><Text style={{color:'red'}}>*公出计划:</Text>
|
|
|
- <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
|
|
|
- <AtTextarea
|
|
|
- height={46}
|
|
|
- value={this.state.plan}
|
|
|
- onChange={(v)=>{
|
|
|
- this.setState({
|
|
|
- plan:v
|
|
|
- })
|
|
|
- }}
|
|
|
- maxLength={200}
|
|
|
- placeholder='本次公出准备工作'
|
|
|
- />
|
|
|
- </View>
|
|
|
+ <View className='formName'><Text style={{ color: 'red' }}>*公出计划:</Text>
|
|
|
+ <View className='formValue' style={{ paddingTop: '10px', textAlign: 'left' }}>
|
|
|
+ <AtTextarea
|
|
|
+ height={46}
|
|
|
+ value={this.state.plan}
|
|
|
+ onChange={(v) => {
|
|
|
+ this.setState({
|
|
|
+ plan: v
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ maxLength={200}
|
|
|
+ placeholder='本次公出准备工作'
|
|
|
+ />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
{/* 预计效果 */}
|
|
|
- <View className='formName'><Text style={{color:'red'}}>*预计效果:</Text>
|
|
|
- <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
|
|
|
- <AtTextarea
|
|
|
- height={46}
|
|
|
- value={this.state.expectedEffect}
|
|
|
- onChange={(v)=>{
|
|
|
- this.setState({
|
|
|
- expectedEffect:v
|
|
|
- })
|
|
|
- }}
|
|
|
- maxLength={200}
|
|
|
- placeholder='预计本次公出效果'
|
|
|
- />
|
|
|
- </View>
|
|
|
+ <View className='formName'><Text style={{ color: 'red' }}>*预计效果:</Text>
|
|
|
+ <View className='formValue' style={{ paddingTop: '10px', textAlign: 'left' }}>
|
|
|
+ <AtTextarea
|
|
|
+ height={46}
|
|
|
+ value={this.state.expectedEffect}
|
|
|
+ onChange={(v) => {
|
|
|
+ this.setState({
|
|
|
+ expectedEffect: v
|
|
|
+ })
|
|
|
+ }}
|
|
|
+ maxLength={200}
|
|
|
+ placeholder='预计本次公出效果'
|
|
|
+ />
|
|
|
+ </View>
|
|
|
</View>
|
|
|
</View>
|
|
|
- <View className='formItem' style={{display:'block'}}>
|
|
|
+ <View className='formItem' style={{ display: 'block' }}>
|
|
|
<View className='formName'>附件:</View>
|
|
|
- <View className='formValue' style={{paddingTop:'10px',textAlign:'left'}}>
|
|
|
+ <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 }
|
|
|
+ /> : null}
|
|
|
</View>
|
|
|
</View>
|
|
|
<View className='operation'>
|
|
|
- <AtButton disabled={this.state.loading} type='secondary' circle onClick={()=>{
|
|
|
+ <AtButton disabled={this.state.loading} type='secondary' circle onClick={() => {
|
|
|
this.props.onClose();
|
|
|
}}>
|
|
|
取消
|
|
|
</AtButton>
|
|
|
- <AtButton type='primary' loading={this.state.loading} circle onClick={()=>{
|
|
|
+ <AtButton type='primary' loading={this.state.loading} circle onClick={() => {
|
|
|
this.setState({
|
|
|
- isInquiryOpened:true,
|
|
|
- inquiryTitle:'提醒',
|
|
|
- inquiryContent:'您确定要修改此申请吗?',
|
|
|
- inquiryFn:()=>{
|
|
|
+ isInquiryOpened: true,
|
|
|
+ inquiryTitle: '提醒',
|
|
|
+ inquiryContent: '您确定要修改此申请吗?',
|
|
|
+ inquiryFn: () => {
|
|
|
this.onSubmit();
|
|
|
}
|
|
|
})
|
|
@@ -480,20 +512,20 @@ class PublicContent extends Component{
|
|
|
isOpened={this.state.isInquiryOpened}
|
|
|
title={this.state.inquiryTitle}
|
|
|
content={this.state.inquiryContent}
|
|
|
- onClose={()=>{
|
|
|
+ onClose={() => {
|
|
|
this.setState({
|
|
|
- isInquiryOpened:false,
|
|
|
- inquiryTitle:'',
|
|
|
- inquiryContent:'',
|
|
|
+ isInquiryOpened: false,
|
|
|
+ inquiryTitle: '',
|
|
|
+ inquiryContent: '',
|
|
|
})
|
|
|
}}
|
|
|
- onDetermine={()=>{
|
|
|
+ onDetermine={() => {
|
|
|
this.state.inquiryFn();
|
|
|
this.setState({
|
|
|
- isInquiryOpened:false,
|
|
|
- inquiryTitle:'',
|
|
|
- inquiryContent:'',
|
|
|
- inquiryFn:()=>{}
|
|
|
+ isInquiryOpened: false,
|
|
|
+ inquiryTitle: '',
|
|
|
+ inquiryContent: '',
|
|
|
+ inquiryFn: () => { }
|
|
|
})
|
|
|
}}
|
|
|
/>
|