crafts-detail.vue 5.0 KB

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