product-detail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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.productName}}</e-desc-item>
  31. <e-desc-item label="产品规格">{{dataForm.productSpec}}</e-desc-item>
  32. <e-desc-item label="产品类别">{{dataForm.productTypeValue}}</e-desc-item>
  33. <e-desc-item label="产品来源">{{dataForm.sourceName}}</e-desc-item>
  34. <e-desc-item label="备注说明" span="2">{{dataForm.notes}}</e-desc-item>
  35. </e-desc>
  36. <e-desc title="产品图纸">
  37. <upload-component :display="true" :display-title="false" :accept="'*'" :file-obj-list="fileList"/>
  38. </e-desc>
  39. <e-desc title="组合小产品">
  40. <el-table
  41. :data="productDetails"
  42. border
  43. style="width: 100%;">
  44. <el-table-column
  45. label="序号"
  46. type="index"
  47. width="50"
  48. align="center">
  49. </el-table-column>
  50. <el-table-column
  51. prop="productName"
  52. header-align="center"
  53. align="center"
  54. label="产品名称">
  55. </el-table-column>
  56. <el-table-column
  57. prop="specifications"
  58. header-align="center"
  59. align="center"
  60. label="规格">
  61. </el-table-column>
  62. <el-table-column
  63. prop="cnt"
  64. header-align="center"
  65. align="center"
  66. label="数量">
  67. </el-table-column>
  68. <el-table-column
  69. prop="notes"
  70. header-align="center"
  71. align="center"
  72. label="备注">
  73. </el-table-column>
  74. </el-table>
  75. </e-desc>
  76. <e-desc title="产品配料清单">
  77. <el-table
  78. :data="materialList"
  79. border
  80. style="width: 100%;">
  81. <el-table-column
  82. label="序号"
  83. type="index"
  84. width="50"
  85. align="center">
  86. </el-table-column>
  87. <el-table-column
  88. prop="materialName"
  89. header-align="center"
  90. align="center"
  91. label="物品名称">
  92. </el-table-column>
  93. <el-table-column
  94. prop="specifications"
  95. header-align="center"
  96. align="center"
  97. label="规格">
  98. </el-table-column>
  99. <el-table-column
  100. prop="cnt"
  101. header-align="center"
  102. align="center"
  103. label="数量">
  104. </el-table-column>
  105. <el-table-column
  106. prop="unitName"
  107. header-align="center"
  108. align="center"
  109. label="单位">
  110. </el-table-column>
  111. <el-table-column
  112. prop="notes"
  113. header-align="center"
  114. align="center"
  115. label="备注">
  116. </el-table-column>
  117. </el-table>
  118. </e-desc>
  119. </div>
  120. <span slot="footer" class="dialog-footer">
  121. <el-button @click="visible = false">返回</el-button>
  122. </span>
  123. </el-dialog>
  124. </template>
  125. <script>
  126. import EDesc from '../common/e-desc'
  127. import EDescItem from '../common/e-desc-item'
  128. import { dealStepData, dealStepLogs } from '@/api/util'
  129. import uploadComponent from '../common/upload-component'
  130. import { getProductDetail } from '@/api/product'
  131. import ApproveComponent from '../common/approve-component'
  132. export default {
  133. name: 'product-detail',
  134. components: {
  135. EDesc, EDescItem, uploadComponent, ApproveComponent
  136. },
  137. data () {
  138. return {
  139. visible: false,
  140. isFlow: false,
  141. id: 0,
  142. dataForm: {},
  143. materialList: [],
  144. productDetails: [],
  145. stepList: [],
  146. logList: [],
  147. fileList: []
  148. }
  149. },
  150. methods: {
  151. async init (id, businessType) {
  152. this.visible = true
  153. this.isFlow = !!(businessType && businessType !== '')
  154. this.id = id || 0
  155. this.dataForm = {}
  156. this.materialList = []
  157. this.productDetails = []
  158. this.stepList = []
  159. this.logList = []
  160. this.fileList = []
  161. this.getDetails(businessType)
  162. },
  163. getDetails (businessType) {
  164. getProductDetail(this.id).then(({data}) => {
  165. if (data && data.code === '200') {
  166. this.dataForm = data.data
  167. // 流程图展示
  168. if (data.data.workFlowBusinessExt) {
  169. dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
  170. dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
  171. }
  172. // 组合小产品
  173. data.data.composeProductMaterialList.forEach((item) => {
  174. this.productDetails.push(item)
  175. })
  176. // 产品配料清单
  177. data.data.productMaterialList.forEach((item) => {
  178. this.materialList.push(item)
  179. })
  180. // 产品图纸
  181. if (data.data.proDrawings) {
  182. this.dataForm.drawingIdList = []
  183. data.data.proDrawings.forEach((item) => {
  184. if (item.attachList) {
  185. item.attachList.forEach((item1) => {
  186. this.fileList.push({
  187. name: item1.fileName,
  188. url: item1.url,
  189. id: item1.url
  190. })
  191. })
  192. }
  193. })
  194. }
  195. // 初始化审批Form
  196. this.showApproveForm(businessType, this.id)
  197. }
  198. })
  199. },
  200. // 初始化审批Form
  201. showApproveForm (businessType, businessId) {
  202. if (this.isFlow) {
  203. this.$nextTick(() => {
  204. this.$refs.approve.init(businessType, businessId)
  205. })
  206. }
  207. },
  208. // 审批完成
  209. approveFinished () {
  210. this.visible = false
  211. this.$emit('approveFinished')
  212. }
  213. }
  214. }
  215. </script>
  216. <style scoped>
  217. .my-line{
  218. border-bottom: 1px solid #c0c4cc;
  219. margin-bottom: 10px;
  220. }
  221. .title{
  222. padding: 10px 0 ;
  223. }
  224. </style>