index.jsx 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import React, { Component } from "react";
  2. import { AtModal, AtModalAction, AtModalContent, AtIcon } from "taro-ui";
  3. import { Button, Image, View, Text } from "@tarojs/components";
  4. import Taro from "@tarojs/taro";
  5. import './index.less';
  6. import { getAccountLog } from '../../../utils/servers/servers';
  7. import "taro-ui/dist/style/components/icon.scss";
  8. class AuditDetails extends Component {
  9. constructor(props) {
  10. super(props);
  11. this.state = {
  12. list: [],
  13. }
  14. this.selLog = this.selLog.bind(this);
  15. }
  16. componentDidMount() {
  17. this.selLog();
  18. }
  19. selLog() {
  20. Taro.showLoading({
  21. title: '加载中...'
  22. })
  23. getAccountLog({
  24. eaid: this.props.id
  25. }).then(v => {
  26. Taro.hideLoading();
  27. if (v.error.length === 0) {
  28. this.setState({
  29. list: v.data || []
  30. })
  31. this.isHere(v.data || [])
  32. } else {
  33. Taro.showToast({ title: v.error[0].message, icon: 'none' })
  34. }
  35. }).catch(err => {
  36. Taro.hideLoading();
  37. Taro.showToast({ title: '系统错误.请稍后重试', icon: 'none' })
  38. })
  39. }
  40. isHere(list = []) {
  41. for (var i = 0; i < list.length; i++) {
  42. if (!list[i].id) {
  43. this.setState({
  44. processStatus: list[i].processStatus
  45. })
  46. return
  47. }
  48. }
  49. }
  50. render() {
  51. const { list, processStatus } = this.state
  52. return (
  53. <AtModal
  54. width="90%"
  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.list?.map((v, n) => (
  62. <View key={v.key} className='item'>
  63. <View className='head'>
  64. <View className='spot'
  65. style={{
  66. borderColor: processStatus == v.processStatus
  67. ? "#6190E8" : !v.remarks
  68. ? "#999999" : "#6190E8",
  69. color: processStatus == v.processStatus && !v.id
  70. ? "#fff" : !v.remarks
  71. ? "#999999" : "#6190E8",
  72. background: processStatus == v.processStatus && !v.id && "#6190E8",
  73. }}
  74. >{!!v.remarks ? "✓" : n + 1}</View>
  75. <View className='clockTime'
  76. style={{ color: processStatus == v.processStatus && !v.id && "black", }}
  77. >
  78. {v.auditorName}
  79. &nbsp; &nbsp;
  80. {processStatus == v.processStatus && !v.id && <Text style={{ color: "#FFA500" }}>审核中...</Text>}
  81. </View>
  82. </View>
  83. <View className='clockContent'>
  84. <View className='verticalLine'
  85. style={{
  86. visibility: list.length != (n + 1)
  87. ? "visible"
  88. : "hidden"
  89. }}
  90. />
  91. <View className='rightContent'>
  92. {v.remarks &&
  93. <View className='contentItem'>
  94. <AtIcon className='atIcon' value='settings' size='15' color='#999999' />
  95. 操作:<Text style={{ color: ["#1D4FEA", "#34DE38", "#108EE9", "red", "#1D4FEA"][v.status] }}
  96. >{["【发起】", "【通过】", "【完成】", "【驳回】", "【重新发起】"][v.status]}</Text>
  97. </View>}
  98. {v.remarks &&
  99. <View className='contentItem'>
  100. <AtIcon className='atIcon' value='clock' size='15' color='#999999' />
  101. 操作时间:{v.createTimeStr}
  102. </View>}
  103. {v.remarks &&
  104. <View className='contentItem'>
  105. <AtIcon className='atIcon' value='message' size='15' color='#999999' />
  106. 备注:{v.remarks}
  107. </View>}
  108. </View>
  109. </View>
  110. </View>
  111. ))
  112. }
  113. </View>
  114. </AtModalContent>
  115. <AtModalAction>
  116. <Button onClick={this.props.onClose}>确定</Button>
  117. </AtModalAction>
  118. </AtModal>
  119. )
  120. }
  121. }
  122. export default AuditDetails;