steps.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="steps-wrap">
  3. <view class="step-box" v-for="(item,index) in stepArr" :key="index">
  4. <view class="step-line" v-if="stepArr.length>1"></view>
  5. <view class="step-content">
  6. <view class="step-top-box">
  7. <view style="width: 50%;">
  8. <view class="title">{{item.name}}</view>
  9. <view class="text">{{item.intro}}</view>
  10. </view>
  11. <view class="step-user">
  12. <view v-for="(user,index2) in item.user" :key="user.ApproveUserName" style="display: flex;">
  13. <view class="avatar">{{user.ApproveUserName}}</view>
  14. <text class="symbol" v-if="index2!=item.user.length-1">{{item.auditType===1?'/':'+'}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="step-approve-box">
  19. <view class="step-approve-item" v-for="approve in item.approve" :key="approve.name">
  20. <view style="margin-bottom: 10rpx;">审批人:{{approve.name}}</view>
  21. <view style="margin-bottom: 10rpx;">{{approve.time}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default{
  30. props:{
  31. data:[]
  32. },
  33. computed:{
  34. stepArr(){
  35. let arr=[]
  36. arr=this.data&&this.data.map(item=>{
  37. let stepCon={
  38. name:item[0].NodeType==='check'?'审批人':'抄送人',//审批节点标题
  39. intro:'',//描述
  40. user:item,//审批节点人列表
  41. approve:[],//审批人信息{name:'',time:""}
  42. auditType:1
  43. }
  44. if(item[0].NodeType==='check'){
  45. if(item[0].AuditType===1){
  46. stepCon.intro=item.length>1?item.length+'人或签':''
  47. stepCon.auditType=1
  48. }else if(item[0].AuditType===2){
  49. stepCon.intro=item.length>1?item.length+'人会签':''
  50. stepCon.auditType=2
  51. }
  52. item.forEach(item2=>{
  53. if(item2.Status!=='待审批'&&item2.Status!=='已撤回'){
  54. let time=''
  55. if(item2.Status==='已驳回'){
  56. time=`驳回时间:${this.timeFormat(item2.ApproveTime)}`
  57. }else {
  58. time=`审批时间:${this.timeFormat(item2.ApproveTime)}`
  59. }
  60. let obj={name:item2.ApproveUserName,time:time}
  61. stepCon.approve.push(obj)
  62. }
  63. })
  64. }
  65. if(item[0].NodeType==='cc'){
  66. stepCon.intro='抄送'+item.length+'人'
  67. }
  68. return stepCon
  69. })
  70. // console.log(arr);
  71. return arr
  72. }
  73. },
  74. methods: {
  75. timeFormat(e) {
  76. const time=new Date(e)
  77. const year=time.getFullYear()
  78. const month = time.getMonth() + 1 > 9 ? time.getMonth()+1 : '0'+(time.getMonth()+1);
  79. const day = time.getDate() > 9 ? time.getDate() : "0" + time.getDate();
  80. const hours=time.getHours() > 9 ? time.getHours():'0'+time.getHours()
  81. const minutes=time.getMinutes()>9 ?time.getMinutes():'0'+time.getMinutes()
  82. const seconds=time.getSeconds()>9?time.getSeconds():'0'+time.getSeconds()
  83. return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`
  84. }
  85. },
  86. }
  87. </script>
  88. <style lang="scss">
  89. .step-box{
  90. display: flex;
  91. position: relative;
  92. }
  93. .step-line{
  94. width: 2rpx;
  95. background-color: #E1E1E1;
  96. margin-right: 40rpx;
  97. flex-shrink: 0;
  98. position: relative;
  99. top: 50rpx;
  100. &::before{
  101. position: absolute;
  102. left: 50%;
  103. transform: translateX(-50%);
  104. content: '';
  105. display: block;
  106. width: 20rpx;
  107. height: 20rpx;
  108. border-radius: 50%;
  109. background-color: #E1E1E1;
  110. }
  111. }
  112. .step-content{
  113. padding: 37rpx 0;
  114. flex: 1;
  115. border-bottom: 2rpx solid #e1e1e1;
  116. font-size: 12px;
  117. color: #666;
  118. .title{
  119. font-size: 16px;
  120. font-weight: bold;
  121. margin-bottom: 8rpx;
  122. color: #333;
  123. }
  124. }
  125. .step-box:last-child{
  126. .step-content{
  127. border: none;
  128. }
  129. }
  130. .step-box:last-child{
  131. .step-line{
  132. width: 0;
  133. }
  134. }
  135. .step-approve-box{
  136. margin-top: 40rpx;
  137. .step-approve-item{
  138. color: #F58D57;
  139. }
  140. }
  141. .step-top-box{
  142. display: flex;
  143. justify-content: space-between;
  144. .step-user{
  145. display: flex;
  146. flex-wrap: wrap;
  147. .avatar{
  148. padding: 0 16rpx;
  149. color: #fff;
  150. background-color: #3385FF;
  151. border-radius: 8rpx;
  152. height: 74rpx;
  153. line-height: 74rpx;
  154. }
  155. .symbol{
  156. font-size: 18px;
  157. position: relative;
  158. top: 18rpx;
  159. margin: 0 10rpx;
  160. }
  161. }
  162. }
  163. </style>