History.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div>
  3. <title-divider title="审批信息" width="90px"></title-divider>
  4. <a-table
  5. :columns="auditColumns"
  6. :dataSource="auditData"
  7. :loading="historyRecordLoading"
  8. :pagination="false"
  9. >
  10. </a-table>
  11. <title-divider title="流程图" width="90px"></title-divider>
  12. <div>
  13. <img :loading="historyImgLoading" style="width: 90%" :src="image1" v-show="!showFlag" />
  14. <img :loading="historyImgLoading" style="width: 90%" :src="image2" v-show="showFlag"/>
  15. </div>
  16. <div v-show="audit">
  17. <title-divider title="审核信息" width="90px"></title-divider>
  18. <a-row class="form-row" :gutter="16">
  19. <a-col :lg="12" :md="12" :sm="24">
  20. <a-radio-group v-model="auditFlag" @change="changeOpinion">
  21. <a-radio :value="1">通过</a-radio>
  22. <a-radio :value="0">拒绝</a-radio>
  23. </a-radio-group>
  24. </a-col>
  25. </a-row>
  26. <a-row class="form-row" :gutter="16">
  27. <a-col :lg="12" :md="12" :sm="24">
  28. <a-form-item
  29. label="审核描述"
  30. >
  31. <a-textarea
  32. v-model="refuseReason"/>
  33. </a-form-item>
  34. </a-col>
  35. </a-row>
  36. <a-row :gutter="48" slot="">
  37. <a-col :md="48" :sm="48">
  38. <span class="table-page-search-submitButtons" style="float: right">
  39. <a-button type="primary" :loading="confirmLoading" @click="save()">提交</a-button>
  40. </span>
  41. </a-col>
  42. </a-row>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import DetailList from '@/components/tools/DetailList'
  48. import { getAuditRecord, getShineProImage } from '@/api/activiti/activiti'
  49. import { auditSbInfoScrapForAudit } from '@/api/activiti/activiti-sb-scrap'
  50. const DetailListItem = DetailList.Item
  51. export default {
  52. name: 'ActivitiHistory',
  53. components: {
  54. DetailList,
  55. DetailListItem
  56. },
  57. props: {
  58. audit: {
  59. type: Boolean,
  60. default: true
  61. }
  62. },
  63. data () {
  64. return {
  65. targetId: null,
  66. taskId: null,
  67. processInstanceId: null,
  68. confirmLoading: false,
  69. historyRecordLoading: false,
  70. historyImgLoading: false,
  71. auditFinish: true,
  72. image1: '',
  73. timer: '',
  74. showFlag: true,
  75. countNum: 0,
  76. image2: '',
  77. refuseReason: '同意',
  78. auditFlag: 1,
  79. auditModelKey: null,
  80. auditModelName: null,
  81. auditColumns: [
  82. {
  83. title: '审批人',
  84. dataIndex: 'userName',
  85. key: 'userName',
  86. width: '20%'
  87. },
  88. {
  89. title: '审批时间',
  90. dataIndex: 'createTime',
  91. key: 'auditTime',
  92. width: '30%',
  93. scopedSlots: { customRender: 'keyword' }
  94. },
  95. {
  96. title: '审批结果',
  97. dataIndex: 'flag',
  98. key: 'flag',
  99. width: '30%',
  100. customRender: (text, row, index) => {
  101. return text ? '通过' : '不通过'
  102. }
  103. },
  104. {
  105. title: '审批意见',
  106. dataIndex: 'opinion',
  107. key: 'opinion'
  108. }
  109. ],
  110. auditData: []
  111. }
  112. },
  113. created () {
  114. // 下拉框map
  115. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_FORM_STATUS)
  116. this.modalTitle = '审批'
  117. // this.getAuditRecords()
  118. // this.getImage()
  119. },
  120. mounted () {
  121. // this.timer = setInterval(this.showImage, 1000)
  122. },
  123. methods: {
  124. base (record, taskId) {
  125. this.targetId = record.id
  126. this.taskId = taskId
  127. this.processInstanceId = record.processInstanceId
  128. this.historyRecordLoading = true
  129. this.historyImgLoading = true
  130. this.auditModelKey = record.auditModelKey
  131. this.auditModelName = this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[this.auditModelKey]
  132. this.getAuditRecords(record)
  133. this.getImage(record)
  134. },
  135. showImage () {
  136. if (this.countNum === 0) {
  137. this.showFlag = false
  138. } else {
  139. this.showFlag = true
  140. }
  141. this.countNum++
  142. if (this.countNum === 2) {
  143. this.countNum = 0
  144. }
  145. },
  146. getAuditRecords (record) {
  147. getAuditRecord(record.processInstanceId).then(res => {
  148. this.historyRecordLoading = false
  149. const auditData = res.data
  150. for (let i = 0; i < auditData.length; i++) {
  151. const item = auditData[i]
  152. item.opinion = this.getFormatOpinion(item.opinion)
  153. }
  154. this.auditData = auditData
  155. })
  156. },
  157. getFormatOpinion (opinion) {
  158. if (opinion === '提交申请') {
  159. return '同意'
  160. } else {
  161. return opinion
  162. }
  163. },
  164. getImage (record) {
  165. getShineProImage(record.processInstanceId)
  166. .then((res) => {
  167. this.historyImgLoading = false
  168. const images = res.data.images
  169. this.image1 = 'data:image/png;base64,' + images[0]
  170. this.image2 = 'data:image/png;base64,' + images[1]
  171. this.timer = setInterval(this.showImage, 1000)
  172. }).catch(() => {
  173. this.confirmLoading = false
  174. })
  175. },
  176. changeOpinion (e) {
  177. this.refuseReason = e.target.value ? '同意' : '不同意'
  178. },
  179. save () {
  180. this.confirmLoading = true
  181. const params = {}
  182. params.id = this.targetId
  183. params.processInstanceId = this.processInstanceId
  184. params.refuseReason = this.refuseReason
  185. params.auditFlag = this.auditFlag
  186. params.taskId = this.taskId
  187. params.auditModelKey = this.auditModelKey
  188. params.auditModelName = this.auditModelName
  189. auditSbInfoScrapForAudit(params)
  190. .then(() => {
  191. this.$message.info('操作成功')
  192. this.auditFinish = false
  193. this.handleOk()
  194. }).catch(() => {
  195. this.confirmLoading = false
  196. this.auditFinish = true
  197. })
  198. },
  199. handleCancel () {
  200. alert('hhhh')
  201. this.confirmLoading = false
  202. this.image1 = ''
  203. this.showFlag = true
  204. this.countNum = 0
  205. this.image2 = ''
  206. this.refuseReason = '同意'
  207. this.auditFlag = 1
  208. this.auditFinish = true
  209. clearInterval(this.timer)
  210. this.$emit('ok')
  211. },
  212. handleOk () {
  213. this.$emit('ok')
  214. }
  215. }
  216. }
  217. </script>