steps.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view>
  3. <view class="steps-wrap">
  4. <view class="step-box" v-for="(item,index) in stepArr" :key="index">
  5. <view class="step-line" v-if="stepArr.length>1"></view>
  6. <view class="step-content" :style="{borderTop:item.name==='抄送人'?'2rpx dashed #f3f0f0':'2rpx solid #e1e1e1'}">
  7. <view class="step-top-box">
  8. <view style="width: 50%;">
  9. <view class="title">{{item.name}}</view>
  10. <view class="text">{{item.intro}}</view>
  11. </view>
  12. <view class="step-user">
  13. <view @click="handleViewAllUser(item.allUser)" v-if="item.allUser.length>2" class="avatar" style="margin-right:10rpx;width:80rpx">全部</view>
  14. <view v-for="(user,index2) in item.user" :key="user.ApproveUserName" style="display: flex;">
  15. <view class="avatar">
  16. {{user.ApproveUserName==='admin'?user.ApproveUserName:user.ApproveUserName.slice(-2)}}
  17. <!-- <text class="whole-name">{{user.ApproveUserName}}</text> -->
  18. </view>
  19. <text class="symbol" v-if="index2!=item.user.length-1">{{item.auditType===1?'/':'+'}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="step-approve-box">
  24. <view class="step-approve-item" v-for="approve in item.approve" :key="approve.name">
  25. <view style="margin-bottom: 10rpx;">审批人:{{approve.name}}</view>
  26. <view style="margin-bottom: 10rpx;">{{approve.time}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <van-popup :show="show" @close="show=false" position="bottom" round custom-style="height: 50%;">
  33. <div class="alluser-wrap flex">
  34. <view class="avatar" v-for="item in temUser" :key="item.ApproveUserName">
  35. {{item.ApproveUserName==='admin'?item.ApproveUserName:item.ApproveUserName.slice(-2)}}
  36. <!-- <text class="whole-name">{{item.ApproveUserName}}</text> -->
  37. </view>
  38. </div>
  39. </van-popup>
  40. </view>
  41. </template>
  42. <script>
  43. export default{
  44. props:{
  45. data:[]
  46. },
  47. computed:{
  48. stepArr(){
  49. let arr=[]
  50. let count=0
  51. arr=this.data&&this.data.map(item=>{
  52. item[0].NodeType==='check'&&count++
  53. let stepCon={
  54. name:item[0].NodeType==='check'?'审批人':'抄送人',//审批节点标题
  55. intro:'',//描述
  56. user:item.slice(0,2),//审批节点人列表
  57. allUser:item,
  58. approve:[],//审批人信息{name:'',time:""}
  59. auditType:1
  60. }
  61. if(item[0].NodeType==='check'){
  62. if(item[0].AuditType===1){
  63. stepCon.intro=item.length>1?item.length+'人或签':''
  64. stepCon.auditType=1
  65. }else if(item[0].AuditType===2){
  66. stepCon.intro=item.length>1?item.length+'人会签':''
  67. stepCon.auditType=2
  68. }
  69. item.forEach(item2=>{
  70. if(item2.Status!=='待审批'&&item2.Status!=='已撤回'){
  71. let time=''
  72. if(item2.Status==='已驳回'){
  73. time=`驳回时间:${this.timeFormat(item2.ApproveTime)}`
  74. }else {
  75. time=`审批时间:${this.timeFormat(item2.ApproveTime)}`
  76. }
  77. let obj={name:item2.ApproveUserName,time:time}
  78. stepCon.approve.push(obj)
  79. }
  80. })
  81. }
  82. if(item[0].NodeType==='cc'){
  83. stepCon.intro='抄送'+item.length+'人'
  84. }
  85. return stepCon
  86. })
  87. // 处理审批节点标题描述 若有多级审批 则 为 一级审批 二级审批 若只有一级 则 不变
  88. if(count>1){
  89. let tag=0
  90. arr.forEach(item=>{
  91. if(item.name==='审批人'){
  92. tag++
  93. switch (tag) {
  94. case 1:
  95. item.name='一级审批人'
  96. break;
  97. case 2:
  98. item.name='二级审批人'
  99. break;
  100. case 3:
  101. item.name='三级审批人'
  102. break;
  103. }
  104. }
  105. })
  106. }
  107. return arr || []
  108. }
  109. },
  110. data () {
  111. return {
  112. show:false,
  113. temUser:[]
  114. }
  115. },
  116. methods: {
  117. timeFormat(e) {
  118. const time=new Date(e)
  119. const year=time.getFullYear()
  120. const month = time.getMonth() + 1 > 9 ? time.getMonth()+1 : '0'+(time.getMonth()+1);
  121. const day = time.getDate() > 9 ? time.getDate() : "0" + time.getDate();
  122. const hours=time.getHours() > 9 ? time.getHours():'0'+time.getHours()
  123. const minutes=time.getMinutes()>9 ?time.getMinutes():'0'+time.getMinutes()
  124. const seconds=time.getSeconds()>9?time.getSeconds():'0'+time.getSeconds()
  125. return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`
  126. },
  127. handleViewAllUser(e){
  128. this.temUser=e
  129. this.show=true
  130. }
  131. },
  132. }
  133. </script>
  134. <style lang="scss">
  135. .alluser-wrap{
  136. flex-wrap: wrap;
  137. padding: 20px;
  138. // min-height: 50vh;
  139. .avatar{
  140. padding: 0 16rpx;
  141. color: #fff;
  142. background-color: #3385FF;
  143. border-radius: 8rpx;
  144. height: 74rpx;
  145. line-height: 74rpx;
  146. position: relative;
  147. margin-right: 20rpx;
  148. margin-bottom: 50rpx;
  149. .whole-name{
  150. position: absolute;
  151. top: 105%;
  152. color: #666;
  153. font-size: 12px;
  154. left: 50%;
  155. transform: translateX(-50%);
  156. line-height: 1;
  157. min-width: 80rpx;
  158. text-align: center;
  159. }
  160. }
  161. }
  162. .step-box{
  163. display: flex;
  164. position: relative;
  165. }
  166. .step-line{
  167. width: 2rpx;
  168. background-color: #E1E1E1;
  169. margin-right: 40rpx;
  170. flex-shrink: 0;
  171. position: relative;
  172. top: 50rpx;
  173. &::before{
  174. position: absolute;
  175. left: 50%;
  176. transform: translateX(-50%);
  177. content: '';
  178. display: block;
  179. width: 20rpx;
  180. height: 20rpx;
  181. border-radius: 50%;
  182. background-color: #E1E1E1;
  183. }
  184. }
  185. .step-content{
  186. padding: 37rpx 0;
  187. flex: 1;
  188. border-top: 2rpx solid #e1e1e1;
  189. font-size: 12px;
  190. color: #666;
  191. .title{
  192. font-size: 16px;
  193. font-weight: bold;
  194. margin-bottom: 8rpx;
  195. color: #333;
  196. }
  197. }
  198. .step-box:first-child{
  199. .step-content{
  200. border: none !important;
  201. }
  202. }
  203. .step-box:last-child{
  204. .step-line{
  205. width: 0;
  206. }
  207. }
  208. .step-approve-box{
  209. margin-top: 40rpx;
  210. .step-approve-item{
  211. color: #F58D57;
  212. }
  213. }
  214. .step-top-box{
  215. display: flex;
  216. justify-content: space-between;
  217. .step-user{
  218. display: flex;
  219. flex-wrap: wrap;
  220. .avatar{
  221. padding: 0 16rpx;
  222. color: #fff;
  223. background-color: #3385FF;
  224. border-radius: 8rpx;
  225. height: 74rpx;
  226. line-height: 74rpx;
  227. position: relative;
  228. .whole-name{
  229. position: absolute;
  230. top: 105%;
  231. color: #666;
  232. font-size: 12px;
  233. left: 50%;
  234. transform: translateX(-50%);
  235. line-height: 1;
  236. min-width: 80rpx;
  237. text-align: center;
  238. }
  239. }
  240. .symbol{
  241. font-size: 18px;
  242. position: relative;
  243. top: 12rpx;
  244. margin: 0 10rpx;
  245. }
  246. }
  247. }
  248. </style>