inventory-detail.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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">查看</div>
  9. <div style="margin-left: 20px;margin-right: 20px">
  10. <!-- 工作流 -->
  11. <div v-if="flowVisible">
  12. <el-steps :active="activeNo" finish-status="success" 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-if="isFlow">
  29. <approve-component ref="approve" @approveFinished="approveFinished"/>
  30. </div>
  31. <e-desc title="基本信息" column="3">
  32. <e-desc-item label="盘点编码">{{dataForm.inventoryCode}}</e-desc-item>
  33. <e-desc-item label="盘点员">{{dataForm.checkerName}}</e-desc-item>
  34. <e-desc-item label="复核员">{{dataForm.dcheckerName}}</e-desc-item>
  35. <e-desc-item label="备注说明" span="3">{{dataForm.notes}}</e-desc-item>
  36. </e-desc>
  37. </div>
  38. <span slot="footer" class="dialog-footer">
  39. <el-button @click="onChose">返回</el-button>
  40. </span>
  41. </div>
  42. <!-- </el-dialog> -->
  43. </template>
  44. <script>
  45. import EDesc from '../common/e-desc'
  46. import EDescItem from '../common/e-desc-item'
  47. import uploadComponent from '../common/upload-component'
  48. import { dealStepData, dealStepLogs } from '@/api/util'
  49. import ApproveComponent from '../common/approve-component'
  50. import {getInventoryDetail} from '@/api/warehouse'
  51. import WarehouseComponent from '../common/warehouse-component'
  52. import ShelveComponent from '../common/shelve-component'
  53. export default {
  54. name: 'inventory-detail',
  55. components: {
  56. EDesc, EDescItem, uploadComponent, ApproveComponent, ShelveComponent, WarehouseComponent
  57. },
  58. data () {
  59. return {
  60. visible: false,
  61. flowVisible: false,
  62. isFlow: false,
  63. id: 0,
  64. dataForm: {},
  65. dataForm1: {},
  66. dataList: [],
  67. fileList: [],
  68. fileList1: [],
  69. activeNo: 0,
  70. stepList: [],
  71. logList: [],
  72. pageIndex: 1,
  73. pageSize: 10,
  74. totalPage: 0,
  75. dataListLoading: false,
  76. dataListSelections: [],
  77. optionsMs: [
  78. {
  79. code: '0',
  80. value: '正常'
  81. },
  82. {
  83. code: '1',
  84. value: '盘点中'
  85. }
  86. ],
  87. optionsState: [
  88. {
  89. code: '0',
  90. value: '正常'
  91. },
  92. {
  93. code: '-1',
  94. value: '盘亏'
  95. },
  96. {
  97. code: '1',
  98. value: '盘盈'
  99. }
  100. ]
  101. }
  102. },
  103. methods: {
  104. onChose () {
  105. this.$emit('onChose')
  106. },
  107. async init (id, businessType) {
  108. this.visible = true
  109. this.isFlow = !!(businessType && businessType !== '')
  110. this.id = id || 0
  111. this.dataForm = {}
  112. this.fileList = []
  113. this.fileList1 = []
  114. this.dataForm1 = {}
  115. // 获取详情
  116. this.queryData(businessType)
  117. },
  118. // 查询
  119. queryData (businessType) {
  120. this.pageIndex = 1
  121. this.stepList = []
  122. this.logList = []
  123. this.getDataList(businessType)
  124. },
  125. // 获取数据列表
  126. getDataList (businessType) {
  127. this.dataListLoading = true
  128. let params = {
  129. 'current': this.pageIndex,
  130. 'size': this.pageSize,
  131. 'inventoryId': this.id,
  132. 'warehouseId': this.dataForm1.warehouseId ? this.dataForm1.warehouseId : null,
  133. 'shelveId': this.dataForm1.shelveId ? this.dataForm1.shelveId : null
  134. }
  135. getInventoryDetail(params).then(({data}) => {
  136. if (data && data.code === '200') {
  137. this.dataList = data.data.records
  138. this.totalPage = Number(data.data.total)
  139. if (this.dataList.length > 0) {
  140. let item = this.dataList[0]
  141. this.dataForm.inventoryCode = item.inventoryCode
  142. this.dataForm.checkerName = item.checkerName
  143. this.dataForm.dcheckerName = item.dcheckerName
  144. this.dataForm.notes = item.notes
  145. // 流程图展示
  146. if (item.workFlowBusinessExt) {
  147. this.flowVisible = true
  148. dealStepData(this.dataList[0].workFlowBusinessExt.workFlowProcessStepList, this.stepList)
  149. dealStepLogs(this.dataList[0].workFlowBusinessExt.processLogList, this.logList)
  150. }
  151. if (this.dataList[0].workFlowProcessStepList) {
  152. this.activeNo = Number(this.dataList[0].workFlowProcessStepList.activeNo)
  153. }
  154. // 初始化审批Form
  155. this.showApproveForm(businessType, this.id)
  156. }
  157. } else {
  158. this.dataList = []
  159. this.totalPage = 0
  160. }
  161. this.dataListLoading = false
  162. })
  163. },
  164. // 每页数
  165. sizeChangeHandle (val) {
  166. this.pageSize = val
  167. this.pageIndex = 1
  168. this.getDataList()
  169. },
  170. // 当前页
  171. currentChangeHandle (val) {
  172. this.pageIndex = val
  173. this.getDataList()
  174. },
  175. // 多选
  176. selectionChangeHandle (val) {
  177. this.dataListSelections = val
  178. },
  179. // 初始化审批Form
  180. showApproveForm (businessType, businessId) {
  181. if (this.isFlow) {
  182. this.$nextTick(() => {
  183. this.$refs.approve.init(businessType, businessId)
  184. })
  185. }
  186. },
  187. // 物品状态转换
  188. formatMs (row) {
  189. for (let i = 0; i < this.optionsMs.length; i++) {
  190. if (this.optionsMs[i].code === row.materialState) {
  191. return this.optionsMs[i].value
  192. }
  193. }
  194. },
  195. // 盘库状态转换
  196. formatState (row) {
  197. for (let i = 0; i < this.optionsState.length; i++) {
  198. if (this.optionsState[i].code === row.inventoryState) {
  199. return this.optionsState[i].value
  200. }
  201. }
  202. },
  203. // 审批完成
  204. approveFinished () {
  205. this.onChose()
  206. this.$emit('approveFinished')
  207. },
  208. warehouseChanged (item) {
  209. this.dataForm1.warehouseId = item
  210. this.$refs.shelveCom.init(item)
  211. }
  212. }
  213. }
  214. </script>
  215. <style scoped>
  216. .my-line{
  217. border-bottom: 1px solid #c0c4cc;
  218. margin-bottom: 10px;
  219. }
  220. .title{
  221. padding: 10px 0 ;
  222. }
  223. </style>