|
@@ -1,5 +1,5 @@
|
|
|
import React, { Component } from "react";
|
|
|
-import { View, Image, Button } from "@tarojs/components";
|
|
|
+import { View, Image, Button, Text } from "@tarojs/components";
|
|
|
import Taro, { getCurrentInstance } from "@tarojs/taro";
|
|
|
import {
|
|
|
AtButton,
|
|
@@ -19,6 +19,8 @@ import {
|
|
|
examinePublicRelease,
|
|
|
getReleasetDails,
|
|
|
updatePublicRelease,
|
|
|
+ addAssistant,
|
|
|
+ deleteAssistant,
|
|
|
} from "../../utils/servers/servers";
|
|
|
import { resourceAddress } from "../../utils/config";
|
|
|
import "./index.less";
|
|
@@ -40,6 +42,7 @@ import ImagePicker from "../../components/common/imagePicker";
|
|
|
import MessageNoticebar from "../../components/common/messageNoticebar";
|
|
|
import { getClockState } from "../../utils/tools";
|
|
|
import HistoricalClock from "../../components/historicalClock";
|
|
|
+import UserQuery from "../../components/common/userquery"; //选择协单人弹窗
|
|
|
|
|
|
class EgressDetails extends Component {
|
|
|
$instance = getCurrentInstance();
|
|
@@ -58,6 +61,10 @@ class EgressDetails extends Component {
|
|
|
current: "",
|
|
|
isNo: true,
|
|
|
foc: false,
|
|
|
+ coorderList: [],
|
|
|
+ cList: [],
|
|
|
+ popup: false,
|
|
|
+ selid: "",
|
|
|
};
|
|
|
this.examinePublicRelease = this.examinePublicRelease.bind(this);
|
|
|
this.getReleasetDails = this.getReleasetDails.bind(this);
|
|
@@ -98,6 +105,8 @@ class EgressDetails extends Component {
|
|
|
v.data.annexUrl = list;
|
|
|
this.setState({
|
|
|
dtails: v.data,
|
|
|
+ coorderList: v.data.assistantName != null && v.data.assistantName != "" ? v.data.assistantName.split(",") : [],
|
|
|
+ cList: v.data.assistantAid != null && v.data.assistantName != "" ? v.data.assistantAid.split(",") : [],
|
|
|
selectArrderLocation: {
|
|
|
longitude: parseFloat(v.data.longitude),
|
|
|
latitude: parseFloat(v.data.latitude),
|
|
@@ -291,9 +300,57 @@ class EgressDetails extends Component {
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
+ // 弹窗开关
|
|
|
+ popupClick(id) {
|
|
|
+ !this.state.popup &&
|
|
|
+ this.setState({
|
|
|
+ selid: id
|
|
|
+ })
|
|
|
+ this.setState({
|
|
|
+ popup: !this.state.popup
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //增加协单助力
|
|
|
+ addA(aid) {
|
|
|
+ const { selid } = this.state
|
|
|
+ addAssistant({
|
|
|
+ id: selid,
|
|
|
+ aid,
|
|
|
+ }).then((v) => {
|
|
|
+ if (v.error.length === 0) {
|
|
|
+ this.popupClick();
|
|
|
+ this.getReleasetDails();
|
|
|
+ } else {
|
|
|
+ Taro.showToast({ title: v.error[0].message, icon: "none" });
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //删除协单助力
|
|
|
+ deleteA(id, aid) {
|
|
|
+ Taro.showLoading({
|
|
|
+ title: '操作中...'
|
|
|
+ })
|
|
|
+ deleteAssistant({
|
|
|
+ id,
|
|
|
+ aid,
|
|
|
+ }).then((v) => {
|
|
|
+ Taro.hideLoading();
|
|
|
+ if (v.error.length === 0) {
|
|
|
+ this.getReleasetDails();
|
|
|
+ } else {
|
|
|
+ Taro.showToast({ title: v.error[0].message, icon: "none" });
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ Taro.hideLoading();
|
|
|
+ Taro.showToast({ title: "系统错误,请稍后再试", icon: "none" });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
render() {
|
|
|
- const { dtails, current } = this.state;
|
|
|
+ const { dtails, current, cList, coorderList, popup } = this.state;
|
|
|
return (
|
|
|
<View className="egressDetails">
|
|
|
<MessageNoticebar />
|
|
@@ -315,9 +372,7 @@ class EgressDetails extends Component {
|
|
|
<View>
|
|
|
<View className="title">
|
|
|
{dtails.type === 3 ? dtails.mainName : dtails.aname}提交的公出申请
|
|
|
- {dtails.updateStatus == 1 && (
|
|
|
- <View className="titRight">改</View>
|
|
|
- )}
|
|
|
+ {dtails.updateStatus == 1 && <View className="titRight">改</View>}
|
|
|
</View>
|
|
|
<View className="address">申请时间: {dtails.createTimes}</View>
|
|
|
<View
|
|
@@ -348,11 +403,54 @@ class EgressDetails extends Component {
|
|
|
</View>
|
|
|
) : (
|
|
|
<View className="valueContent">
|
|
|
+ {
|
|
|
+ dtails.status != 3 && dtails.type == 3 && (current === "查看协单" || current === "我的协单")
|
|
|
+ ? <View className="item">
|
|
|
+ <View className="title" style={{ color: "red" }}>协单助手(助手无成本)</View>
|
|
|
+ <View className="cassistant">
|
|
|
+ {
|
|
|
+ coorderList.length == 0
|
|
|
+ ? <Text>无</Text>
|
|
|
+ : coorderList.map((item, index) =>
|
|
|
+ <View className="citems" key={index}>
|
|
|
+ {item}
|
|
|
+ <View className="cclose"
|
|
|
+ onClick={() => {
|
|
|
+ this.setState({
|
|
|
+ isInquiryOpened: true,
|
|
|
+ inquiryTitle: "温馨提示",
|
|
|
+ inquiryContent: "您确定要移除此协单助手吗?",
|
|
|
+ inquiryFn: () => {
|
|
|
+ this.deleteA(dtails.id, cList[index])
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }}
|
|
|
+ ><AtIcon value="close-circle" size="15" color="#bbbbbb" /></View>
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ {cList.length < 5 && <Button className="addbuttom" type='primary' onClick={this.popupClick.bind(this, dtails.id)}>添加协单助手</Button>}
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ : coorderList.length != 0 &&
|
|
|
+ <View className="item">
|
|
|
+ <View className="title" style={{ color: "red" }}>协单助手(助手无成本)</View>
|
|
|
+ <View className="cassistant">
|
|
|
+ {
|
|
|
+ coorderList.map((item, index) =>
|
|
|
+ <View className="citems" style={{ paddingRight: 0 }} key={index}>
|
|
|
+ {item}
|
|
|
+ </View>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ </View>
|
|
|
+ </View>
|
|
|
+ }
|
|
|
<View className="item">
|
|
|
<View className="title">
|
|
|
公出地点:
|
|
|
- {dtails.permission === 0 && dtails.type !== 3 &&
|
|
|
- (dtails.status === 0 || dtails.status === 3) ? (
|
|
|
+ {current !== "审核" && dtails.permission === 0
|
|
|
+ && dtails.type !== 3 && dtails.type !== 4 ? (
|
|
|
<View
|
|
|
className="edit"
|
|
|
onClick={() => {
|
|
@@ -434,7 +532,8 @@ class EgressDetails extends Component {
|
|
|
? "业务公出" : dtails.type == 1
|
|
|
? "技术公出" : dtails.type == 2
|
|
|
? "行政公出" : dtails.type == 3
|
|
|
- ? "技术协单" : ""}
|
|
|
+ ? "技术协单" : dtails.type == 4
|
|
|
+ ? "协单助手" : ""}
|
|
|
</View>
|
|
|
</View>
|
|
|
{dtails.type == 1 ? (
|
|
@@ -548,7 +647,8 @@ class EgressDetails extends Component {
|
|
|
</AtButton>
|
|
|
</View>
|
|
|
) : null}
|
|
|
- {current !== "审核" && dtails.permission === 0 && dtails.status !== 3 && dtails.type !== 3 ? (
|
|
|
+ {current !== "审核" && dtails.permission === 0
|
|
|
+ && dtails.type !== 3 && dtails.type !== 4 ? (
|
|
|
<View className="item" id={"reasons"}>
|
|
|
<View className="title">修改/撤销</View>
|
|
|
<AtTextarea
|
|
@@ -564,10 +664,12 @@ class EgressDetails extends Component {
|
|
|
/>
|
|
|
</View>
|
|
|
) : null}
|
|
|
- {current !== "审核" && dtails.permission === 0 && dtails.status !== 3 && dtails.type !== 3 ? (
|
|
|
+ {current !== "审核" && dtails.permission === 0
|
|
|
+ && dtails.type !== 3 && dtails.type !== 4 ? (
|
|
|
<View className="operation">
|
|
|
<Button
|
|
|
type="warn"
|
|
|
+ disabled={dtails.status === 3}
|
|
|
loading={this.state.loading}
|
|
|
onClick={() => {
|
|
|
if (this.state.loading) {
|
|
@@ -719,6 +821,16 @@ class EgressDetails extends Component {
|
|
|
}}
|
|
|
/>
|
|
|
) : null}
|
|
|
+ {popup &&
|
|
|
+ <UserQuery
|
|
|
+ isOpened={popup}
|
|
|
+ onDesc={this.popupClick.bind(this)}
|
|
|
+ coorderList={cList}
|
|
|
+ selList={dtails.assistAid ? dtails.assistAid.split(",") : []}
|
|
|
+ req={true}
|
|
|
+ addClick={this.addA.bind(this)}
|
|
|
+ />
|
|
|
+ }
|
|
|
</View>
|
|
|
);
|
|
|
}
|