History.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. projectName: '',
  78. refuseReason: '同意',
  79. auditFlag: 1,
  80. auditModelKey: null,
  81. auditModelName: null,
  82. auditColumns: [
  83. {
  84. title: '审批人',
  85. dataIndex: 'userName',
  86. key: 'userName',
  87. width: '20%'
  88. },
  89. {
  90. title: '审批时间',
  91. dataIndex: 'createTime',
  92. key: 'auditTime',
  93. width: '30%',
  94. scopedSlots: { customRender: 'keyword' }
  95. },
  96. {
  97. title: '审批结果',
  98. dataIndex: 'flag',
  99. key: 'flag',
  100. width: '30%',
  101. customRender: (text, row, index) => {
  102. return text ? '通过' : '不通过'
  103. }
  104. },
  105. {
  106. title: '审批意见',
  107. dataIndex: 'opinion',
  108. key: 'opinion'
  109. }
  110. ],
  111. auditData: []
  112. }
  113. },
  114. created () {
  115. // 下拉框map
  116. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.ACTIVITI_FORM_STATUS)
  117. this.modalTitle = '审批'
  118. // this.getAuditRecords()
  119. // this.getImage()
  120. },
  121. mounted () {
  122. // this.timer = setInterval(this.showImage, 1000)
  123. },
  124. methods: {
  125. base (record, taskId) {
  126. this.targetId = record.id
  127. this.projectName = record.projectName ? record.projectName : ''
  128. this.taskId = taskId
  129. this.processInstanceId = record.processInstanceId
  130. this.historyRecordLoading = true
  131. this.historyImgLoading = true
  132. this.auditModelKey = record.auditModelKey
  133. this.auditModelName = this.DictCache.VALUE.SB_INFO_AUDIT_MODEL_NAME[this.auditModelKey]
  134. this.getAuditRecords(record)
  135. this.getImage(record)
  136. },
  137. showImage () {
  138. if (this.countNum === 0) {
  139. this.showFlag = false
  140. } else {
  141. this.showFlag = true
  142. }
  143. this.countNum++
  144. if (this.countNum === 2) {
  145. this.countNum = 0
  146. }
  147. },
  148. getAuditRecords (record) {
  149. getAuditRecord(record.processInstanceId).then(res => {
  150. this.historyRecordLoading = false
  151. const auditData = res.data
  152. for (let i = 0; i < auditData.length; i++) {
  153. const item = auditData[i]
  154. item.opinion = this.getFormatOpinion(item.opinion)
  155. }
  156. this.auditData = auditData
  157. })
  158. },
  159. getFormatOpinion (opinion) {
  160. if (opinion === '提交申请') {
  161. return '同意'
  162. } else {
  163. return opinion
  164. }
  165. },
  166. getImage (record) {
  167. getShineProImage(record.processInstanceId)
  168. .then((res) => {
  169. this.historyImgLoading = false
  170. const images = res.data.images
  171. this.image1 = 'data:image/png;base64,' + images[0]
  172. this.image2 = 'data:image/png;base64,' + images[1]
  173. this.timer = setInterval(this.showImage, 1000)
  174. }).catch(() => {
  175. this.confirmLoading = false
  176. })
  177. },
  178. changeOpinion (e) {
  179. this.refuseReason = e.target.value ? '同意' : '不同意'
  180. },
  181. save () {
  182. this.confirmLoading = true
  183. const params = {}
  184. params.id = this.targetId
  185. params.processInstanceId = this.processInstanceId
  186. params.refuseReason = this.refuseReason
  187. params.auditFlag = this.auditFlag
  188. params.taskId = this.taskId
  189. params.auditModelKey = this.auditModelKey
  190. params.auditModelName = this.auditModelName
  191. params.projectName = this.projectName ? this.projectName : null
  192. auditSbInfoScrapForAudit(params)
  193. .then(() => {
  194. this.$message.info('操作成功')
  195. this.auditFinish = false
  196. this.handleOk()
  197. }).catch(() => {
  198. this.confirmLoading = false
  199. this.auditFinish = true
  200. })
  201. },
  202. handleCancel () {
  203. alert('hhhh')
  204. this.confirmLoading = false
  205. this.image1 = ''
  206. this.showFlag = true
  207. this.countNum = 0
  208. this.image2 = ''
  209. this.refuseReason = '同意'
  210. this.auditFlag = 1
  211. this.auditFinish = true
  212. clearInterval(this.timer)
  213. this.$emit('ok')
  214. },
  215. handleOk () {
  216. this.$emit('ok')
  217. }
  218. }
  219. }
  220. </script>