details.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <div class="content-height p20">
  3. <div class="page-title">
  4. <PageHeader title="调拨详情"> </PageHeader>
  5. </div>
  6. <div>
  7. <StatusStep :activeCode="infoData.auditStatus" :statusList="statusList" />
  8. <div class="content-detail mt10">
  9. <div class="basic-details">
  10. <HeaderTitle title="基本信息" size="16px"></HeaderTitle>
  11. </div>
  12. <div class="mt20">
  13. <el-form label-width="110px">
  14. <el-col :span="8">
  15. <el-form-item label="调拨名称">
  16. <span>{{ infoData.name }}</span>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="8">
  20. <el-form-item label="调拨单号">
  21. <span>{{ infoData.allotCode }}</span>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="8">
  25. <el-form-item label="创建人">
  26. <span>{{ infoData.allotName }}</span>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="8">
  30. <el-form-item label="创建时间">
  31. <span>{{ infoData.createTime }}</span>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="8">
  35. <el-form-item label="调拨类型">
  36. <span>{{
  37. allocationType.filter((item) => item.code == infoData.type)[0]
  38. ?.label
  39. }}</span>
  40. </el-form-item>
  41. </el-col>
  42. <el-col :span="8">
  43. <el-form-item label="列表维度">
  44. <span>{{
  45. dimensionType.filter((item) => item.code == infoData.inventoryDimension)[0]
  46. ?.label
  47. }}</span>
  48. </el-form-item>
  49. </el-col>
  50. <el-col :span="8">
  51. <el-form-item label="调出库">
  52. <span>{{ infoData.sourceWarehouse }}</span>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="8">
  56. <el-form-item label="调入库">
  57. <span>{{ infoData.targetWarehouse }}</span>
  58. </el-form-item>
  59. </el-col>
  60. </el-form>
  61. </div>
  62. </div>
  63. <div class="content-detail mt20">
  64. <HeaderTitle title="调拨明细" size="16px"></HeaderTitle>
  65. <div class="mt20">
  66. <!-- <AssetsCell
  67. v-for="(item, index) in detailList"
  68. :key="index"
  69. :item="item"
  70. type="detail"
  71. /> -->
  72. <el-table
  73. ref="table"
  74. :data="detailList"
  75. tooltip-effect="dark"
  76. :max-height="500"
  77. border
  78. >
  79. <el-table-column label="序号" type="index" width="50">
  80. </el-table-column>
  81. <el-table-column
  82. label="物品编码"
  83. prop="categoryCode"
  84. :show-overflow-tooltip="true"
  85. ></el-table-column>
  86. <el-table-column
  87. label="物品名称"
  88. prop="categoryName"
  89. :show-overflow-tooltip="true"
  90. ></el-table-column>
  91. <el-table-column
  92. v-if="infoData.inventoryDimension != 1"
  93. label="批次号"
  94. prop="batchNo"
  95. :show-overflow-tooltip="true"
  96. >
  97. </el-table-column>
  98. <el-table-column
  99. label="调出仓库"
  100. prop="warehouseName"
  101. :show-overflow-tooltip="true"
  102. >
  103. </el-table-column>
  104. <el-table-column
  105. label="调出库区"
  106. prop="areaName"
  107. :show-overflow-tooltip="true"
  108. >
  109. </el-table-column>
  110. <el-table-column
  111. label="调出货架"
  112. prop="goodsShelfName"
  113. :show-overflow-tooltip="true"
  114. >
  115. </el-table-column>
  116. <el-table-column
  117. label="调出货位"
  118. prop="goodsAllocationName"
  119. :show-overflow-tooltip="true"
  120. >
  121. </el-table-column>
  122. <el-table-column
  123. label="调入仓库"
  124. prop="targetWarehouseName"
  125. :show-overflow-tooltip="true"
  126. >
  127. </el-table-column>
  128. <el-table-column
  129. label="调入库区"
  130. prop="targetAreaName"
  131. :show-overflow-tooltip="true"
  132. >
  133. </el-table-column>
  134. <el-table-column
  135. label="调入货架"
  136. prop="targetGoodsShelfName"
  137. :show-overflow-tooltip="true"
  138. >
  139. </el-table-column>
  140. <el-table-column
  141. label="调入货位"
  142. prop="targetGoodsAllocationName"
  143. :show-overflow-tooltip="true"
  144. >
  145. </el-table-column>
  146. <el-table-column
  147. label="牌号"
  148. prop="brandNum"
  149. :show-overflow-tooltip="true"
  150. ></el-table-column>
  151. <el-table-column
  152. label="型号"
  153. prop="categoryModel"
  154. :show-overflow-tooltip="true"
  155. ></el-table-column>
  156. <el-table-column
  157. label="规格"
  158. prop="specification"
  159. :show-overflow-tooltip="true"
  160. ></el-table-column>
  161. <el-table-column
  162. v-if="infoData.inventoryDimension == 3"
  163. label="包装编码"
  164. prop="packageNo"
  165. :show-overflow-tooltip="true"
  166. ></el-table-column>
  167. <el-table-column
  168. v-if="infoData.inventoryDimension == 3"
  169. label="包装数量"
  170. prop="packingQuantity"
  171. :show-overflow-tooltip="true"
  172. ></el-table-column>
  173. <el-table-column
  174. v-if="infoData.inventoryDimension == 3"
  175. label="包装单位"
  176. prop="packingUnit"
  177. :show-overflow-tooltip="true"
  178. ></el-table-column>
  179. <el-table-column
  180. label="计量数量"
  181. prop="measureQuantity"
  182. :show-overflow-tooltip="true"
  183. ></el-table-column>
  184. <el-table-column
  185. label="调拨数量"
  186. prop="quantity"
  187. :show-overflow-tooltip="true"
  188. ></el-table-column>
  189. <el-table-column
  190. label="计量单位"
  191. prop="measureUnit"
  192. :show-overflow-tooltip="true"
  193. ></el-table-column>
  194. <el-table-column
  195. label="重量"
  196. prop="weight"
  197. :show-overflow-tooltip="true"
  198. >
  199. </el-table-column>
  200. <el-table-column
  201. label="重量单位"
  202. prop="weightUnit"
  203. :show-overflow-tooltip="true"
  204. >
  205. </el-table-column>
  206. </el-table>
  207. </div>
  208. </div>
  209. <div
  210. v-if="infoData.type == 2"
  211. class="content-detail mt20"
  212. style="height: 450px"
  213. >
  214. <HeaderTitle title="流程图" size="16px"></HeaderTitle>
  215. <my-process-viewer
  216. key="designer"
  217. v-model="bpmnXML"
  218. v-bind="bpmnControlForm"
  219. :activityData="activityList"
  220. :processInstanceData="processInstance"
  221. :taskData="tasks"
  222. />
  223. </div>
  224. </div>
  225. </div>
  226. </template>
  227. <script>
  228. import storageApi from '@/api/warehouseManagement/index.js';
  229. import AssetsCell from './components/AssetsCell';
  230. import {
  231. getProcessInstance,
  232. getTaskListByProcessInstanceId,
  233. getProcessDefinitionBpmnXML,
  234. getActivityList
  235. } from '@/api/bpm/index';
  236. // import { getDetail } from '@/api/stockManagement/inventoryAllocation'
  237. import PageHeader from '@/components/PageHeader';
  238. import { allocationType, dimensionType } from '@/utils/dict/warehouse';
  239. import { useDictLabelFilter } from '@/utils/dict';
  240. import StatusStep from '@/components/StatusStep/index.vue';
  241. export default {
  242. components: { AssetsCell, StatusStep, PageHeader },
  243. data() {
  244. return {
  245. allocationType,
  246. dimensionType,
  247. auditStatus: [
  248. { code: 0, label: '未提交', class: 'danger-text' },
  249. { code: 1, label: '审核中', class: 'primary-text' },
  250. { code: 2, label: '已完成', class: 'primary-text' }
  251. ],
  252. detailList: [],
  253. infoData: {},
  254. // 流程实例
  255. id: undefined, // 流程实例的编号
  256. processInstance: {},
  257. // BPMN 数据
  258. bpmnXML: null,
  259. bpmnControlForm: {
  260. prefix: 'flowable'
  261. },
  262. activityList: [],
  263. // 审批记录
  264. tasksLoad: true,
  265. tasks: []
  266. };
  267. },
  268. created() {
  269. this._getDetail();
  270. },
  271. filters: {
  272. dictFilter: useDictLabelFilter
  273. },
  274. computed: {
  275. statusList() {
  276. const base = [{ label: '创建' }];
  277. /* 库外 */
  278. if (this.infoData.type == 2) {
  279. base.push({ code: 1, label: '审核中' });
  280. }
  281. if (this.infoData.auditStatus == 0) {
  282. base.push({ code: 0, label: '未提交', activeColor: '#cc3300' });
  283. } else {
  284. if ([2].includes(this.infoData.auditStatus)) {
  285. base.push({ code: 2, label: '已完成', activeColor: '#157a2c' });
  286. }
  287. }
  288. console.log(base, 'base');
  289. return base;
  290. }
  291. },
  292. methods: {
  293. /** 获得流程实例 */
  294. getDetail(id) {
  295. // 获得流程实例相关
  296. this.processInstanceLoading = true;
  297. getProcessInstance(id).then((response) => {
  298. if (!response) {
  299. this.$message.error('查询不到流程信息!');
  300. return;
  301. }
  302. // 设置流程信息
  303. this.processInstance = response;
  304. // //将业务表单,注册为动态组件
  305. // const path = this.processInstance.processDefinition.formCustomViewPath;
  306. // Vue.component("async-biz-form-component", function (resolve) {
  307. // require([`@/views${path}`], resolve);
  308. // });
  309. // 加载流程图
  310. getProcessDefinitionBpmnXML(
  311. this.processInstance.processDefinition.id
  312. ).then((response) => {
  313. this.bpmnXML = response;
  314. });
  315. // 加载活动列表
  316. getActivityList({
  317. processInstanceId: this.processInstance.id
  318. }).then((response) => {
  319. console.log(response, 'response');
  320. this.activityList = response;
  321. });
  322. // 取消加载中
  323. this.processInstanceLoading = false;
  324. });
  325. // 获得流程任务列表(审批记录)
  326. this.tasksLoad = true;
  327. getTaskListByProcessInstanceId(id).then((response) => {
  328. // 审批记录
  329. this.tasks = [];
  330. // 移除已取消的审批
  331. response.forEach((task) => {
  332. if (task.result !== 4) {
  333. this.tasks.push(task);
  334. }
  335. });
  336. // 排序,将未完成的排在前面,已完成的排在后面;
  337. this.tasks.sort((a, b) => {
  338. // 有已完成的情况,按照完成时间倒序
  339. if (a.endTime && b.endTime) {
  340. return b.endTime - a.endTime;
  341. } else if (a.endTime) {
  342. return 1;
  343. } else if (b.endTime) {
  344. return -1;
  345. // 都是未完成,按照创建时间倒序
  346. } else {
  347. return b.createTime - a.createTime;
  348. }
  349. });
  350. // 需要审核的记录
  351. const userId = store.getters.userId;
  352. this.tasks.forEach((task) => {
  353. if (task.result !== 1 && task.result !== 6) {
  354. // 只有待处理才需要
  355. return;
  356. }
  357. if (!task.assigneeUser || task.assigneeUser.id !== userId) {
  358. // 自己不是处理人
  359. return;
  360. }
  361. });
  362. // 取消加载中
  363. this.tasksLoad = false;
  364. });
  365. },
  366. async _getDetail() {
  367. const res = await storageApi.getAllotDetailList({
  368. applyId: this.$route.query.id
  369. });
  370. const data = await storageApi.getAllotDetail(this.$route.query.id);
  371. this.infoData = data;
  372. this.getDetail(data.flowableTaskId);
  373. if (this.infoData.type == 1) {
  374. // 库内调拨
  375. /* this.infoData.auditStatus = 2; */
  376. this.infoData.auditStatus = data.status;
  377. } else {
  378. // 库外调拨
  379. this.infoData.auditStatus = data.status;
  380. }
  381. this.detailList = res.map((item) => {
  382. return {
  383. ...item,
  384. categoryCode: this.infoData.categoryCode,
  385. categoryName: this.infoData.categoryName,
  386. brandNum: this.infoData.brandNum,
  387. categoryModel: this.infoData.model,
  388. specification: this.infoData.specification
  389. };
  390. });
  391. // if (res?.success) {
  392. // this.infoData = res.data.conventionalStockTransfer;
  393. // this.detailList = res.data.stockTransferInfoList.map((i) => ({
  394. // batchNum: i.batchNo,
  395. // ...i
  396. // }));
  397. // }
  398. }
  399. }
  400. };
  401. </script>
  402. <style lang="scss" scoped>
  403. :deep(.el-form-item) {
  404. margin-bottom: 0 !important;
  405. }
  406. .p20 {
  407. padding: 20px;
  408. }
  409. .mt40 {
  410. margin-top: 40px;
  411. }
  412. .mt20 {
  413. margin-top: 20px;
  414. }
  415. .content-detail {
  416. overflow: hidden;
  417. }
  418. .content-height {
  419. height: auto;
  420. background: #fff;
  421. }
  422. </style>