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 {examinePublicRelease,getReleasetDails,getListPublicReleaseLog} from '../../utils/servers/servers'; import {resourceAddress} from '../../utils/config'; import { AtModal, AtTimeline, AtModalContent, AtModalAction } from "taro-ui" import './index.less'; import 'taro-ui/dist/style/components/icon.scss'; 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 Rejected from '../../image/rejected.png'; import Passed from '../../image/passed.png'; import Reviewed from '../../image/reviewed.png'; import ImagePicker from "../../components/common/imagePicker"; class EgressDetails extends Component{ $instance = getCurrentInstance() constructor(props) { super(props); this.state={ dtails:{}, opinion:'', publicReleaseLog:[] } this.examinePublicRelease= this.examinePublicRelease.bind(this); this.getReleasetDails= this.getReleasetDails.bind(this); this.getListPublicReleaseLog= this.getListPublicReleaseLog.bind(this); } componentDidShow() { this.getReleasetDails(); } getReleasetDails(){ getReleasetDails({ id:21 }).then(v=>{ if(v.error.length === 0){ let list = []; for(let i of v.data.annexUrl.split(',')){ if(i){ list.push({'url':resourceAddress + i}) } } v.data.annexUrl = list; this.setState({ dtails:v.data, }) }else{ Taro.showToast({title:v.error[0].message,icon:'none'}) } }).catch(err=>{ Taro.showToast({title:'系统错误,请稍后再试',icon:'none'}); console.log(err) }) } examinePublicRelease(status){ if(!this.state.opinion){ Taro.showToast({title:'请填写审批意见',icon:'none'}) return; } examinePublicRelease({ status, remarks:this.state.opinion, id:this.state.dtails.id }).then(v=>{ if(v.error.length === 0){ Taro.showToast({title:status===0?'驳回成功':'通过成功',icon:'none'}); this.state.dtails.status=status; this.setState({ dtails:this.state.dtails }) }else{ Taro.showToast({title:v.error[0].message,icon:'none'}) } }).catch(()=>{ Taro.showToast({title:'系统错误,请稍后再试',icon:'none'}) }) } getListPublicReleaseLog(){ getListPublicReleaseLog({ id:21 }).then(v=>{ if(v.error.length === 0){ let arr = []; for (let i of v.data){ arr.push({ title: i.status === 0 ? '驳回' : i.status === 1 ? '发起' : i.status === 2 ? '通过' : '', content: ['审核员:'+i.aname,i.remarks ? '审核意见:'+i.remarks : null], color: i.status === 0 ? '#f31212' : i.status === 1 ? '#1d4fea' : i.status === 2 ? '#34de38' : '' }) } this.setState({ publicReleaseLog:arr, isOpened:true }) }else{ Taro.showToast({title:v.error[0].message,icon:'none'}) } }).catch(err=>{ Taro.showToast({title:'系统错误.请稍后重试',icon:'none'}) console.log(err) }) } render() { const {dtails} = this.state; return ( {dtails.aname}提交的公出申请 公出企业:{dtails.nickname} { dtails.status === 0 ? '驳回' : dtails.status === 1 ? '发起' : dtails.status === 2 ? '通过' : '' } {/**/} {/* 公出编号*/} {/* 20212584646465495462*/} {/**/} {/**/} {/* 企业类型*/} {/* 稀有企业*/} {/**/} {/**/} {/* 审核人*/} {/* 营销经理*/} {/**/} 公出地点: {dtails.userName} 公出{dtails.duration}小时 明细 {dtails.releaseStarts} {dtails.releaseEnds} 申请时间 {dtails.createTimes} 公出原因 {dtails.remarks} 附件 {dtails.annexUrl && dtails.annexUrl.length > 0 ? : null} { this.$instance.router.params.type === '1' ? 填写审批意见 { this.setState({ opinion:value }) }} maxLength={200} placeholder='请填写审批意见' /> : null } { this.$instance.router.params.type === '1' ? { this.examinePublicRelease(0); }}> 驳回 { this.examinePublicRelease(2); }}> 同意 : null } 查看TA的历史记录 ) } } export default EgressDetails;