auditList.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="uni-app">
  3. <view class="status-bar" />
  4. <view class="main-container">
  5. <wk-nav-bar :title="navTitle" pervent @back="handleBack">
  6. <!-- #ifndef MP-WEIXIN -->
  7. <button
  8. v-if="!showRecord"
  9. class="button white-btn"
  10. @click="handleShowRecord">
  11. 审批记录
  12. </button>
  13. <!-- #endif -->
  14. </wk-nav-bar>
  15. <view v-if="!showNoData" class="container">
  16. <!--审批历史记录-->
  17. <view v-if="showRecord" class="list">
  18. <view v-for="(item, index) in recordList" :key="index" class="list-item">
  19. <view class="icon-box">
  20. <image v-if="item.examineStatus === 0" :src="$static('images/audit/await.png')" alt="" class="audit-icon" />
  21. <image v-else-if="item.examineStatus === 1" :src="$static('images/audit/pass.png')" alt="" class="audit-icon" />
  22. <image v-else-if="item.examineStatus === 2" :src="$static('images/audit/refuse.png')" alt="" class="audit-icon" />
  23. <image v-else-if="item.examineStatus === 3" :src="$static('images/audit/await.png')" alt="" class="audit-icon" />
  24. <image v-else-if="item.examineStatus === 4" :src="$static('images/audit/cancel.png')" alt="" class="audit-icon" />
  25. <image v-else-if="item.examineStatus === 5" :src="$static('images/audit/create.png')" alt="" class="audit-icon" />
  26. <image v-else-if="item.examineStatus === 6" :src="$static('images/audit/create.png')" alt="" class="audit-icon" />
  27. </view>
  28. <view class="content">
  29. <view class="time">
  30. <template v-if="item.orderId">
  31. 第{{ item.orderId }}级
  32. </template>
  33. {{ item.examineTime }}
  34. </view>
  35. <view class="info">
  36. <text class="name">
  37. {{ item.examineUserName }}
  38. </text>
  39. <text class="action">
  40. {{ calcStatus(item.examineStatus).label }}
  41. </text>
  42. <text v-if="item.examineStatus !== 3">
  43. 了此审批
  44. </text>
  45. </view>
  46. <view v-if="item.remarks" class="remarks">
  47. {{ item.remarks }}
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <!--审批流程-->
  53. <view v-else class="step-list">
  54. <view
  55. v-for="(item, index) in auditInfo.examineFlowList"
  56. :key="index"
  57. class="step-list-item">
  58. <wk-audit-flow-item
  59. :item-data="item"
  60. :audit-info="auditInfo" />
  61. </view>
  62. </view>
  63. </view>
  64. <view v-else class="no-data" :style="{backgroundImage: bgUrl('images/no_data.png')}">
  65. 暂无数据
  66. </view>
  67. </view>
  68. <!-- #ifdef MP-WEIXIN -->
  69. <view v-if="!showRecord" class="footer-btn-group">
  70. <button class="record-btn" @click="handleShowRecord">
  71. 审批记录
  72. </button>
  73. </view>
  74. <!-- #endif -->
  75. </view>
  76. </template>
  77. <script>
  78. import { QueryExamineRecordLog, QueryExamineRecordList} from 'API/examine'
  79. import {mapGetters} from 'vuex'
  80. export default {
  81. name: 'AuditList',
  82. data() {
  83. return {
  84. id: null,
  85. showRecord: false,
  86. recordList: [],
  87. auditInfo: {
  88. examineFlowList: []
  89. }
  90. }
  91. },
  92. computed: {
  93. ...mapGetters({
  94. calcStatus: 'base/calcStatus'
  95. }),
  96. navTitle() {
  97. return this.showRecord ? '审批历史记录' : '审批流程'
  98. },
  99. showNoData() {
  100. if (this.showRecord) return this.recordList.length === 0 || false
  101. else return this.auditInfo.examineFlowList.length === 0 || false
  102. }
  103. },
  104. onLoad(options) {
  105. console.log('options', options)
  106. this.id = options.id
  107. this.getAuditInfo(options)
  108. this.getRecordList()
  109. },
  110. onBackPress(evt) {
  111. if (evt.from === 'backbutton' && this.showRecord) {
  112. this.showRecord = false
  113. return true // 返回值为 true 时,表示不执行默认的返回
  114. }
  115. return false
  116. },
  117. methods: {
  118. /**
  119. * 背景图url
  120. * @param {String} val
  121. */
  122. bgUrl(val) {
  123. return `url(${this.$static(val)})`
  124. },
  125. handleBack() {
  126. if (this.showRecord) {
  127. this.showRecord = false
  128. return
  129. }
  130. this.$Router.navigateBack()
  131. },
  132. /**
  133. * 获取审批流
  134. */
  135. getAuditInfo(options) {
  136. QueryExamineRecordList({
  137. recordId: options.id,
  138. ownerUserId: options.u_id
  139. }).then(res => {
  140. this.auditInfo = res || {}
  141. }).catch()
  142. },
  143. getRecordList() {
  144. QueryExamineRecordLog({
  145. recordId: this.id
  146. }).then(res => {
  147. this.recordList = res
  148. }).catch()
  149. },
  150. handleShowRecord() {
  151. this.showRecord = !this.showRecord
  152. }
  153. }
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. .container {
  158. flex: 1;
  159. overflow: auto;
  160. background-color: white;
  161. .list {
  162. padding: 30rpx 60rpx;
  163. .list-item {
  164. width: 100%;
  165. display: flex;
  166. padding-bottom: 30rpx;
  167. .icon-box {
  168. position: relative;
  169. width: 50rpx;
  170. .audit-icon {
  171. position: relative;
  172. width: 50rpx;
  173. height: 50rpx;
  174. display: block;
  175. }
  176. &:before {
  177. position: absolute;
  178. top: 30rpx;
  179. left: 50%;
  180. transform: translateX(-50%);
  181. content: '';
  182. width: 2rpx;
  183. height: 100%;
  184. border-left: 1rpx dotted #cccccc;
  185. display: block;
  186. }
  187. }
  188. .content {
  189. flex: 1;
  190. line-height: 2;
  191. display: flex;
  192. flex-direction: column;
  193. margin-left: 36rpx;
  194. .time {
  195. font-size: 26rpx;
  196. color: $light;
  197. }
  198. .info {
  199. font-size: 30rpx;
  200. color: $gray;
  201. .name {}
  202. .action {}
  203. }
  204. .remarks {
  205. position: relative;
  206. font-size: 24rpx;
  207. color: $light;
  208. line-height: 1.5;
  209. background-color: $light-bg;
  210. padding: 20rpx 30rpx;
  211. margin-top: 25rpx;
  212. margin-right: 30rpx;
  213. &:before {
  214. position: absolute;
  215. top: -20rpx;
  216. left: 0;
  217. content: '';
  218. width: 0;
  219. height: 0;
  220. border-left: 20rpx solid $light-bg;
  221. border-right: 0 none;
  222. border-top: 20rpx solid transparent;
  223. border-bottom: 20rpx solid transparent;
  224. }
  225. }
  226. }
  227. &:last-child {
  228. .icon-box:before {
  229. display: none;
  230. }
  231. }
  232. }
  233. }
  234. .step-list {
  235. background-color: white;
  236. padding: 30rpx 30rpx 50rpx;
  237. .step-list-item {
  238. position: relative;
  239. margin-bottom: 20rpx;
  240. &::after {
  241. content: '';
  242. position: relative;
  243. left: 52rpx;
  244. top: 10rpx;
  245. width: 1rpx;
  246. height: 60rpx;
  247. border-left: 1rpx dashed #ccc;
  248. display: block;
  249. }
  250. &:last-child::after {
  251. display: none;
  252. }
  253. }
  254. }
  255. }
  256. .no-data {
  257. width: 100%;
  258. height: 100%;
  259. font-size: 26rpx;
  260. color: $light;
  261. text-align: center;
  262. background: no-repeat center 200rpx $main-bg;
  263. background-size: 36%;
  264. padding-top: 430rpx;
  265. }
  266. .footer-btn-group {
  267. @include center;
  268. .record-btn {
  269. width: 50%;
  270. height: 70rpx;
  271. font-size: $wk-font-base;
  272. color: $theme-color;
  273. line-height: 70rpx;
  274. border: 1rpx solid $theme-color;
  275. border-radius: 70rpx;
  276. }
  277. }
  278. </style>