crafts-detail.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <el-dialog
  3. title="查看"
  4. width="70%"
  5. :close-on-click-modal="false"
  6. :visible.sync="visible">
  7. <div style="margin-left: 20px;margin-right: 20px">
  8. <!-- 工作流 -->
  9. <div v-show="dataForm.workFlowBusinessExt">
  10. <el-steps :active="dataForm.workFlowBusinessExt?dataForm.workFlowBusinessExt.workFlowProcessStepList.length + 2:0" align-center style="margin-bottom: 20px">
  11. <template v-for="(item, i) in stepList">
  12. <el-step :icon="item.icon" :title="item.title" :description="item.description"></el-step>
  13. </template>
  14. </el-steps>
  15. <el-collapse style="margin-bottom: 20px">
  16. <el-collapse-item>
  17. <template slot="title">
  18. <span style="color: red">审批日志(展开查看更多):</span>
  19. </template>
  20. <template v-for="(item, i) in logList">
  21. <div>{{++i}}:{{item.approverName}} {{item.createTime}} {{item.approvalValue}}</div>
  22. </template>
  23. </el-collapse-item>
  24. </el-collapse>
  25. </div>
  26. <div v-show="isFlow">
  27. <approve-component ref="approve" @approveFinished="approveFinished"/>
  28. </div>
  29. <e-desc title="基本信息" column="3">
  30. <e-desc-item label="工艺名称">{{dataForm.techName}}</e-desc-item>
  31. <e-desc-item label="工艺版本">{{dataForm.techVersion}}</e-desc-item>
  32. <e-desc-item label="产品">{{dataForm.productId}}</e-desc-item>
  33. <e-desc-item label="备注" span="3">{{dataForm.notes}}</e-desc-item>
  34. </e-desc>
  35. <e-desc title="附件">
  36. <upload-component :display="true" :display-title="false" :accept="'*'" :file-obj-list="fileList"/>
  37. </e-desc>
  38. </div>
  39. <span slot="footer" class="dialog-footer">
  40. <el-button @click="visible = false">返回</el-button>
  41. </span>
  42. </el-dialog>
  43. </template>
  44. <script>
  45. import EDesc from '../common/e-desc'
  46. import EDescItem from '../common/e-desc-item'
  47. import { dealStepData, dealStepLogs } from '@/api/util'
  48. import uploadComponent from '../common/upload-component'
  49. import { getInfo } from '@/api/crafts'
  50. import ApproveComponent from '../common/approve-component'
  51. export default {
  52. name: 'crafts-detail',
  53. components: {
  54. EDesc, EDescItem, uploadComponent, ApproveComponent
  55. },
  56. data () {
  57. return {
  58. visible: false,
  59. isFlow: false,
  60. id: 0,
  61. dataForm: {},
  62. stepList: [],
  63. logList: [],
  64. fileList: []
  65. }
  66. },
  67. methods: {
  68. async init (id, businessType) {
  69. this.visible = true
  70. this.isFlow = !!(businessType && businessType !== '')
  71. this.id = id || 0
  72. this.dataForm = {}
  73. this.stepList = []
  74. this.logList = []
  75. this.fileList = []
  76. this.getDetails(businessType)
  77. },
  78. getDetails (businessType) {
  79. getInfo(this.id).then(({data}) => {
  80. if (data && data.code === '200') {
  81. this.dataForm = data.data
  82. // 流程图展示
  83. if (data.data.workFlowBusinessExt) {
  84. dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
  85. dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
  86. }
  87. // 附件
  88. if (data.data.attachList) {
  89. data.data.attachList.forEach((item) => {
  90. this.fileList.push({
  91. name: item.fileName,
  92. url: item.url,
  93. id: item.url
  94. })
  95. })
  96. }
  97. // 初始化审批Form
  98. this.showApproveForm(businessType, this.id)
  99. }
  100. })
  101. },
  102. // 初始化审批Form
  103. showApproveForm (businessType, businessId) {
  104. if (this.isFlow) {
  105. this.$nextTick(() => {
  106. this.$refs.approve.init(businessType, businessId)
  107. })
  108. }
  109. },
  110. // 审批完成
  111. approveFinished () {
  112. this.visible = false
  113. this.$emit('approveFinished')
  114. }
  115. }
  116. }
  117. </script>
  118. <style scoped>
  119. .my-line{
  120. border-bottom: 1px solid #c0c4cc;
  121. margin-bottom: 10px;
  122. }
  123. .title{
  124. padding: 10px 0 ;
  125. }
  126. </style>