customFlowDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. <template>
  2. <view class="uni-app">
  3. <view class="status-bar" />
  4. <view class="main-container">
  5. <wk-nav-bar :title="navTitle" />
  6. <view
  7. v-if="showNoData"
  8. :style="{backgroundImage: bgUrl('images/no_data.png')}"
  9. class="no-data">
  10. 暂无数据
  11. </view>
  12. <view v-else class="container">
  13. <template v-if="showTaskData">
  14. <view class="task-container">
  15. <view class="group-title-box">
  16. <view class="prev-badge" />
  17. <text>阶段工作</text>
  18. </view>
  19. <view class="task-content">
  20. <view
  21. v-for="(task, index) in detailData.taskData"
  22. :key="index"
  23. class="task-item">
  24. <view :class="{over: task.isOk}" class="checkbox">
  25. <text v-if="task.isOk" class="icon wk wk-check" />
  26. </view>
  27. <view class="item-content">
  28. <view class="item-title" :class="{'over': task.isOk}">
  29. <text v-if="task.isNull" class="required">
  30. *
  31. </text>
  32. <text>{{ task.taskName }}</text>
  33. </view>
  34. <view
  35. v-if="task.isOk && task.createUserName"
  36. class="item-desc">
  37. {{ task.createUserName }}于{{ task.createTime | formatTime }}完成
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="field-container">
  44. <view class="group-title-box">
  45. <view class="prev-badge" />
  46. <text>阶段工作</text>
  47. </view>
  48. <view class="field-content">
  49. <base-info-item
  50. v-for="item in fieldList"
  51. :key="item.fieldId"
  52. :field="item" />
  53. </view>
  54. </view>
  55. </template>
  56. <view
  57. v-if="auditInfo.examineFlowList"
  58. class="line" />
  59. <!--审核流程-->
  60. <view
  61. v-if="auditInfo.examineFlowList"
  62. class="examine-flow-container section">
  63. <view
  64. v-for="(item, index) in auditInfo.examineFlowList"
  65. :key="index"
  66. class="flow-item">
  67. <wk-audit-flow-item
  68. :item-data="item"
  69. :audit-info="auditInfo" />
  70. </view>
  71. </view>
  72. </view>
  73. <view
  74. v-if="showExamineBtn"
  75. class="footer-region">
  76. <view class="footer-box">
  77. <view
  78. v-if="auditInfo.isRecheck === 1"
  79. class="footer-button recall"
  80. @click="handleAuditAction('cancel')">
  81. 撤回
  82. </view>
  83. <template v-if="auditInfo.isCheck === 1">
  84. <view class="footer-button refuse" @click="handleAuditAction('refuse')">
  85. 拒绝
  86. </view>
  87. <view class="footer-button pass" @click="handleAuditAction('pass')">
  88. 通过
  89. </view>
  90. </template>
  91. </view>
  92. </view>
  93. <view
  94. v-else-if="!showNoData"
  95. class="footer-btn-group">
  96. <button
  97. class="button plain-btn"
  98. @click="handleToComment">
  99. 反馈
  100. <template v-if="detailData.commentNum">
  101. ({{ detailData.commentNum }})
  102. </template>
  103. </button>
  104. </view>
  105. </view>
  106. <uni-popup
  107. ref="commentPopup"
  108. radius="20rpx 20rpx 0 0"
  109. type="bottom"
  110. @click.stop>
  111. <flow-comment-popup
  112. v-if="showCommentContent"
  113. :data-id="routerQuery.id"
  114. :comment-num="detailData.commentNum"
  115. @update="getData"
  116. @close="handleCloseComment" />
  117. </uni-popup>
  118. </view>
  119. </template>
  120. <script>
  121. import {
  122. QueryFlowDataInfoAPI,
  123. SaveFlowDataAPI
  124. } from '@/api/crm/flow.js'
  125. import { QueryExamineRecordList, AuditExamine } from 'API/examine'
  126. import BaseInfoItem from './components/detailSection/baseInfoItem.vue'
  127. import FlowCommentPopup from './components/customFlow/flowCommentPopup.vue'
  128. import moment from 'moment'
  129. export default {
  130. name: 'CustomFlowDetail',
  131. filters: {
  132. formatTime(data) {
  133. return moment(data).format('YYYY-MM-DD HH:mm:ss')
  134. }
  135. },
  136. components: {
  137. BaseInfoItem,
  138. FlowCommentPopup
  139. },
  140. data() {
  141. return {
  142. loading: false,
  143. routerQuery: {},
  144. detailData: {},
  145. fieldList: [],
  146. auditInfo: {}, // 审批流程信息
  147. showCommentContent: false
  148. }
  149. },
  150. computed: {
  151. navTitle() {
  152. const name = this.detailData.flowName || ''
  153. return `${name}阶段信息`
  154. },
  155. showNoData() {
  156. return this.detailData &&
  157. !(this.detailData.taskData || []).length &&
  158. !(this.detailData.fieldData || []).length &&
  159. !this.detailData.examineId
  160. },
  161. showTaskData() {
  162. return this.detailData &&
  163. this.detailData.taskData &&
  164. this.detailData.taskData.length
  165. },
  166. showExamineBtn() {
  167. if (this.$isEmpty(this.auditInfo)) return false
  168. return this.auditInfo.isCheck === 1 || this.auditInfo.isRecheck === 1
  169. }
  170. },
  171. onLoad(options) {
  172. this.routerQuery = options || {}
  173. this.getData()
  174. },
  175. methods: {
  176. bgUrl(val) {
  177. return `url(${this.$static(val)})`
  178. },
  179. getData() {
  180. QueryFlowDataInfoAPI({
  181. dataId: this.routerQuery.id
  182. }).then(res => {
  183. this.detailData = res
  184. this.fieldList = this.detailData.fieldData || []
  185. if (res.examineId) {
  186. this.getAuditInfo()
  187. }
  188. }).catch(() => {})
  189. },
  190. /**
  191. * 获取审批步骤
  192. */
  193. getAuditInfo() {
  194. QueryExamineRecordList({
  195. recordId: this.detailData.examineRecordId
  196. }).then(res => {
  197. this.auditInfo = res
  198. // console.log('res step list: ', res)
  199. }).catch()
  200. },
  201. handleAuditAction(action) {
  202. // cancel 撤回 refuse 拒绝 pass 通过
  203. this.auditType = action
  204. getApp().globalData.auditInfo = this.auditInfo
  205. uni.$once('save-audit', this.handleAudit)
  206. this.$Router.navigateTo({
  207. url: '/pages_common/audit/index',
  208. query: {
  209. type: action
  210. }
  211. })
  212. },
  213. /**
  214. * 审核
  215. * @param form 审核信息
  216. */
  217. handleAudit(form) {
  218. let params = {
  219. typeId: this.id,
  220. recordId: this.detailData.examineRecordId,
  221. ...form
  222. }
  223. console.log('audit:', form)
  224. AuditExamine(params).then(() => {
  225. this.$toast(params.status === 4 ? '撤销成功' : '审核成功')
  226. this.getData()
  227. this.$refreshAndToPrev(this, false)
  228. }).catch(() => {})
  229. },
  230. /**
  231. * 反馈信息弹窗
  232. */
  233. handleToComment() {
  234. this.showCommentContent = true
  235. this.$refs.commentPopup.open()
  236. },
  237. /**
  238. * 关闭反馈弹窗
  239. */
  240. handleCloseComment() {
  241. this.showCommentContent = false
  242. this.$refs.commentPopup.close()
  243. }
  244. }
  245. }
  246. </script>
  247. <style scoped lang="scss">
  248. .checkbox {
  249. width: 40rpx;
  250. height: 40rpx;
  251. border: 1rpx solid #CCCCCC;
  252. border-radius: 6rpx;
  253. overflow: hidden;
  254. @include center;
  255. .icon {
  256. font-size: 28rpx;
  257. line-height: 1;
  258. color: white;
  259. }
  260. &.over {
  261. background-color: rgba(60,128,247,.5);
  262. border-color: transparent;
  263. }
  264. }
  265. .no-data {
  266. width: 100%;
  267. flex: 1;
  268. text-align: center;
  269. font-size: 26rpx;
  270. color: #BBBBBB;
  271. background-position: center 200rpx;
  272. background-repeat: no-repeat;
  273. background-size: 200rpx;
  274. padding-top: 430rpx;
  275. }
  276. .footer-btn-group {
  277. .plain-btn {
  278. color: $theme-color;
  279. border: 1rpx solid $theme-color;
  280. background-color: white;
  281. }
  282. }
  283. .container {
  284. flex: 1;
  285. background-color: white;
  286. overflow: auto;
  287. padding: 0 30rpx 20rpx;
  288. .group-title-box {
  289. font-size: $wk-font-medium;
  290. padding: 18rpx 0;
  291. @include left;
  292. .prev-badge {
  293. width: 10rpx;
  294. height: 30rpx;
  295. border-radius: 10rpx;
  296. background-color: $theme-color;
  297. margin-right: 15rpx;
  298. }
  299. }
  300. .task-container {
  301. .task-content {
  302. padding-left: 15rpx;
  303. margin-top: -15rpx;
  304. .task-item {
  305. padding: 20rpx 0;
  306. display: flex;
  307. align-items: flex-start;
  308. justify-content: flex-start;
  309. .item-content {
  310. flex: 1;
  311. color: $gray;
  312. margin-left: 25rpx;
  313. .required {
  314. color: $error;
  315. }
  316. }
  317. .item-desc {
  318. font-size: $wk-font-sm;
  319. color: $light;
  320. margin-top: 5rpx;
  321. }
  322. }
  323. }
  324. }
  325. .field-container {
  326. .field-content {
  327. margin: 0 -20rpx;
  328. .info-item {
  329. padding-left: 20rpx;
  330. padding-right: 20rpx;
  331. border-bottom: 0 none;
  332. }
  333. }
  334. }
  335. .line {
  336. width: calc(100% + 60rpx);
  337. height: 40rpx;
  338. background-color: $main-bg;
  339. margin: 0 -30rpx;
  340. &::before {
  341. content: '';
  342. width: 100%;
  343. height: 25rpx;
  344. background-color: white;
  345. display: block;
  346. }
  347. }
  348. .examine-flow-container {
  349. padding: 30rpx;
  350. .flow-item {
  351. position: relative;
  352. margin-bottom: 20rpx;
  353. &::after {
  354. content: '';
  355. position: relative;
  356. left: 52rpx;
  357. top: 10rpx;
  358. width: 1rpx;
  359. height: 60rpx;
  360. border-left: 1rpx dashed #ccc;
  361. display: block;
  362. }
  363. &:last-child::after {
  364. display: none;
  365. }
  366. }
  367. }
  368. }
  369. .footer-region {
  370. background-color: white;
  371. width: 100%;
  372. height: 120rpx;
  373. padding: 0 30rpx;
  374. border-top: 1rpx solid $border-color;
  375. .footer-box {
  376. width: 100%;
  377. height: 100%;
  378. @include center;
  379. .footer-button {
  380. width: 210rpx;
  381. height: 72rpx;
  382. font-size: $wk-font-base;
  383. border-radius: 6rpx;
  384. @include center;
  385. }
  386. .refuse {
  387. background-color: $error;
  388. color: white;
  389. margin-right: 30rpx;
  390. }
  391. .pass {
  392. background-color: $theme-color;
  393. color: white;
  394. }
  395. .recall {
  396. color: $gray;
  397. background-color: #F5F5F5;
  398. margin-right: 30rpx;
  399. }
  400. }
  401. }
  402. </style>