index.jsx 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import React,{Component} from "react";
  2. import {AtModal, AtModalAction, AtModalContent, AtIcon } from "taro-ui";
  3. import {Button, Image,View} from "@tarojs/components";
  4. import Taro from "@tarojs/taro";
  5. import './index.less';
  6. import {getListPublicReleaseLog} from '../../utils/servers/servers';
  7. import "taro-ui/dist/style/components/icon.scss";
  8. import {getClockState} from "../../utils/tools";
  9. import ImagePicker from "../common/imagePicker";
  10. import {resourceAddress} from "../../utils/config";
  11. class HistoricalClock extends Component{
  12. constructor(props) {
  13. super(props);
  14. this.state={
  15. publicReleaseLog:[]
  16. }
  17. this.getListPublicReleaseLog = this.getListPublicReleaseLog.bind(this);
  18. }
  19. componentDidMount() {
  20. this.getListPublicReleaseLog();
  21. }
  22. getListPublicReleaseLog(){
  23. Taro.showLoading({
  24. title:'加载中...'
  25. })
  26. getListPublicReleaseLog({
  27. id:this.props.id
  28. }).then(v=>{
  29. Taro.hideLoading();
  30. if(v.error.length === 0){
  31. for(let d of v.data){
  32. let list = [];
  33. for(let i of (d.photoUrl || '').split(',')){
  34. if(i){
  35. list.push({'url':resourceAddress + i})
  36. }
  37. }
  38. d.photoUrl = list;
  39. }
  40. this.setState({
  41. publicReleaseLog:v.data,
  42. })
  43. }else{
  44. Taro.showToast({title:v.error[0].message,icon:'none'})
  45. }
  46. }).catch(err=>{
  47. Taro.hideLoading();
  48. Taro.showToast({title:'系统错误.请稍后重试',icon:'none'})
  49. console.log(err)
  50. })
  51. }
  52. render() {
  53. return (
  54. <AtModal
  55. isOpened={this.props.isOpened}
  56. onClose={this.props.onClose}
  57. onCancel={this.props.onClose}>
  58. <AtModalContent>
  59. <View className='historicalClock'>
  60. {
  61. this.state.publicReleaseLog.map((v,k)=>(
  62. <View key={k} className='item'>
  63. <View className='head'>
  64. <View className='spot'/>
  65. <View className='clockTime' style={{
  66. color:getClockState(v.status,true).color
  67. }}>
  68. {getClockState(v.status,true).title}
  69. </View>
  70. </View>
  71. <View className='clockContent'>
  72. <View className='verticalLine' style={{
  73. visibility:this.state.publicReleaseLog[k+1] ? 'visible' : 'hidden'
  74. }}/>
  75. <View className='rightContent' style={{
  76. paddingBottom:this.state.publicReleaseLog[k+1] ? '30px' : 0
  77. }}>
  78. <View className='contentItem'>
  79. <AtIcon className='atIcon' value='user' size='15' color='#999999'/>
  80. 操作人:{v.aname}
  81. </View>
  82. <View className='contentItem'>
  83. <AtIcon className='atIcon' value='clock' size='15' color='#999999'/>
  84. 操作时间:{v.createTimes}
  85. </View>
  86. {v.remarks ? <View className='contentItem'>
  87. <AtIcon className='atIcon' value='message' size='15' color='#999999'/>
  88. 备注:{v.remarks}
  89. </View> : null}
  90. {v.photoUrl.length !== 0 ? <View className='contentItem'>
  91. <AtIcon className='atIcon' value='file-generic' size='15' color='#999999'/>
  92. 附件:
  93. <ImagePicker
  94. files={v.photoUrl || []}
  95. showAddBtn={false} />
  96. </View> : null}
  97. </View>
  98. </View>
  99. </View>
  100. ))
  101. }
  102. </View>
  103. </AtModalContent>
  104. <AtModalAction>
  105. <Button onClick={this.props.onClose}>确定</Button>
  106. </AtModalAction>
  107. </AtModal>
  108. )
  109. }
  110. }
  111. export default HistoricalClock;