|
@@ -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>
|
|
|
);
|
|
|
}
|