order-detail.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <!-- <el-dialog
  3. title="查看"
  4. width="70%"
  5. :close-on-click-modal="false"
  6. :visible.sync="visible"> -->
  7. <div>
  8. <div class="my-title" v-if="!prodVisible">查看</div>
  9. <div v-if="!prodVisible" 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.orderCode}}</e-desc-item>
  33. <e-desc-item label="合同号">{{dataForm.contractNumber}}</e-desc-item>
  34. <e-desc-item label="客户名称">{{dataForm.customerName}}</e-desc-item>
  35. <e-desc-item label="业务员">{{dataForm.salesmanName}}</e-desc-item>
  36. <e-desc-item label="合同交期">{{dataForm.deliveryDate?dataForm.deliveryDate.substring(0,10):''}}</e-desc-item>
  37. <e-desc-item label="备注说明" span="3">{{dataForm.notes}}</e-desc-item>
  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. min-width="140"
  55. :show-tooltip-when-overflow="true"
  56. label="物料名称">
  57. </el-table-column>
  58. <el-table-column
  59. prop="prodCode"
  60. header-align="center"
  61. align="center"
  62. min-width="120"
  63. :show-tooltip-when-overflow="true"
  64. label="物料编号">
  65. </el-table-column>
  66. <el-table-column
  67. prop="batchNumber"
  68. header-align="center"
  69. align="center"
  70. min-width="120"
  71. :show-tooltip-when-overflow="true"
  72. label="批次号">
  73. </el-table-column>
  74. <el-table-column
  75. prop="prodState"
  76. header-align="center"
  77. align="center"
  78. :formatter="formatState"
  79. :show-tooltip-when-overflow="true"
  80. label="状态">
  81. </el-table-column>
  82. <el-table-column
  83. prop="startTime"
  84. header-align="center"
  85. align="center"
  86. :show-tooltip-when-overflow="true"
  87. label="开始时间">
  88. </el-table-column>
  89. <el-table-column
  90. prop="endTime"
  91. header-align="center"
  92. align="center"
  93. :show-tooltip-when-overflow="true"
  94. label="完成时间">
  95. </el-table-column>
  96. <el-table-column
  97. fixed="right"
  98. header-align="center"
  99. align="center"
  100. width="120"
  101. label="操作">
  102. <template slot-scope="scope">
  103. <el-button type="text" v-if="isAuth('trace:search:prod:detail')" size="small" @click="prodDetailHandle(scope.row.id, scope.row.prodCode)">查看记录</el-button>
  104. <!-- <el-button v-if="isAuth('order:ctl:deliver') && Number(scope.row.orderState) === 3" type="text" size="small" @click="deliverHandle(scope.row.orderId)">发货</el-button>-->
  105. <!-- <el-button v-if="isAuth('order:ctl:arrived') && Number(scope.row.orderState) === 4 " type="text" size="small" @click="arrivedHandle(scope.row)">送达</el-button>-->
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. </e-desc>
  110. </div>
  111. <span class="dialog-footer">
  112. <el-button @click="onChose">返回</el-button>
  113. </span>
  114. <!-- 弹窗, 新增 / 修改 -->
  115. <prod-management-details v-if="prodVisible" ref="detail" @onChose="onChildClose"/>
  116. </div>
  117. <!-- </el-dialog> -->
  118. </template>
  119. <script>
  120. import EDesc from '../common/e-desc'
  121. import EDescItem from '../common/e-desc-item'
  122. import { dealStepData, dealStepLogs } from '@/api/util'
  123. import { getOrderDetailById } from '@/api/trace'
  124. import uploadComponent from '../common/upload-component'
  125. import ApproveComponent from '../common/approve-component'
  126. import ProductDetail from './product-detail'
  127. import ProdManagementDetails from '@/views/modules/production/prod-management-details'
  128. export default {
  129. name: 'order-detail',
  130. components: {
  131. ProdManagementDetails,
  132. EDesc,
  133. EDescItem,
  134. uploadComponent,
  135. ApproveComponent,
  136. ProductDetail
  137. },
  138. data () {
  139. return {
  140. visible: false,
  141. isFlow: false,
  142. prodVisible: false,
  143. id: 0,
  144. dataForm: {},
  145. productDetails: [],
  146. stepList: [],
  147. logList: [],
  148. fileList: [],
  149. // 状态:1:待排产,2:生产中,3:生产完成
  150. optionsState: [
  151. {
  152. code: '0',
  153. value: '待核料'
  154. },
  155. {
  156. code: '1',
  157. value: '待试制前检查'
  158. },
  159. {
  160. code: '2',
  161. value: '待排产'
  162. },
  163. {
  164. code: '3',
  165. value: '生产中'
  166. },
  167. {
  168. code: '4',
  169. value: '生产完成'
  170. },
  171. {
  172. code: '5',
  173. value: '不合格完成'
  174. }
  175. ]
  176. }
  177. },
  178. methods: {
  179. onChose () {
  180. this.$emit('onChose')
  181. },
  182. onChildClose () {
  183. this.prodVisible = false
  184. },
  185. async init (id, businessType) {
  186. this.visible = true
  187. this.isFlow = !!(businessType && businessType !== '')
  188. this.id = id || 0
  189. this.dataForm = {
  190. workFlowBusinessExt: null
  191. }
  192. this.productDetails = []
  193. this.stepList = []
  194. this.logList = []
  195. this.fileList = []
  196. this.getDetails(businessType)
  197. },
  198. getDetails (businessType) {
  199. getOrderDetailById(this.id).then(({data}) => {
  200. if (data && data.code === '200') {
  201. this.dataForm = data.data
  202. // 流程图展示
  203. dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
  204. dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
  205. // 附件
  206. if (data.data.attachList) {
  207. data.data.attachList.forEach((item) => {
  208. this.fileList.push({
  209. name: item.fileName,
  210. url: item.url,
  211. id: item.url
  212. })
  213. })
  214. }
  215. // 任务单物料明细
  216. if (data.data.prodProductionList) {
  217. this.productDetails = data.data.prodProductionList
  218. }
  219. // 初始化审批Form
  220. this.showApproveForm(businessType, this.id)
  221. }
  222. })
  223. },
  224. // 初始化审批Form
  225. showApproveForm (businessType, businessId) {
  226. if (this.isFlow) {
  227. this.$nextTick(() => {
  228. this.$refs.approve.init(businessType, businessId)
  229. })
  230. }
  231. },
  232. // 审批完成
  233. approveFinished () {
  234. this.onChose()
  235. this.$emit('approveFinished')
  236. },
  237. // 格式化物料状态
  238. formatState (row) {
  239. if (!row.prodState) return ''
  240. const item1 = this.optionsState.find((item) => item.code === row.prodState.toString())
  241. return item1 ? item1.value : ''
  242. },
  243. // 查看物料记录
  244. prodDetailHandle (productdId, prodCode) {
  245. this.prodVisible = true
  246. this.$nextTick(() => {
  247. this.$refs.detail.init(productdId, 4)
  248. })
  249. }
  250. }
  251. }
  252. </script>
  253. <style scoped>
  254. .my-line{
  255. border-bottom: 1px solid #c0c4cc;
  256. margin-bottom: 10px;
  257. }
  258. .title{
  259. padding: 10px 0 ;
  260. }
  261. </style>