BatchDetail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <!-- 批次明细 -->
  2. <template>
  3. <div class="detail-box">
  4. <el-table
  5. :data="tableData"
  6. :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
  7. >
  8. <el-table-column width="80px" label="序号" type="index" />
  9. <el-table-column label="批次号" prop="batchNum" sortable>
  10. <template slot-scope="{ row }">
  11. <el-popover
  12. placement="bottom-start"
  13. title=""
  14. width="900"
  15. trigger="click"
  16. >
  17. <el-table
  18. :data="row.children"
  19. height="300"
  20. row-key="index"
  21. :header-cell-style="{
  22. background: '#EEEEEE',
  23. border: 'none'
  24. }"
  25. v-loading="row.loading"
  26. >
  27. <el-table-column width="80px" label="序号" type="index" />
  28. <el-table-column label="入库单号" prop="bizNum"></el-table-column>
  29. <el-table-column label="入库场景" prop="bizType">
  30. <template slot-scope="{ row }">
  31. {{ getSceneState(+row.bizType) }}
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="数量" prop="count"></el-table-column>
  35. <el-table-column
  36. label="包装单位"
  37. width="120"
  38. prop="packingUnit"
  39. ></el-table-column>
  40. <el-table-column
  41. label="最小包装单位"
  42. width="120"
  43. prop="minPackUnit"
  44. ></el-table-column>
  45. <el-table-column
  46. label="库位"
  47. prop=""
  48. min-width="150"
  49. show-overflow-tooltip
  50. >
  51. <template slot-scope="{ row }">
  52. {{ row.position }}
  53. </template>
  54. </el-table-column>
  55. <el-table-column
  56. label="入库时间"
  57. prop="updateTime"
  58. ></el-table-column>
  59. <el-table-column label="入库人" prop=""></el-table-column>
  60. <el-table-column label="条码" prop=""></el-table-column>
  61. </el-table>
  62. <el-link
  63. type="primary"
  64. slot="reference"
  65. @click.stop="handleExpand(row)"
  66. >{{ row.batchNum }}</el-link
  67. >
  68. </el-popover>
  69. </template>
  70. </el-table-column>
  71. <el-table-column
  72. label="库存数量"
  73. prop="availableCountBase"
  74. ></el-table-column>
  75. <el-table-column label="计量单位" prop="measuringUnit"></el-table-column>
  76. <el-table-column label="重量单位" prop=""></el-table-column>
  77. <el-table-column label="包装数量" prop="packingUnit"></el-table-column>
  78. <el-table-column label="最小包装单元" prop=""></el-table-column>
  79. <el-table-column label="首次入库时间" prop="createTime"></el-table-column>
  80. <el-table-column label="最近出库时间" prop=""></el-table-column>
  81. <el-table-column label="质检单" prop="" v-if="baseInfo.assetType === 3">
  82. <template slot-scope="{ row }">
  83. <el-button type="text" @click="_getAnalysisCertificate(row)"
  84. >查看</el-button
  85. >
  86. </template>
  87. </el-table-column>
  88. </el-table>
  89. <Pagination
  90. :total="total"
  91. :page.sync="page"
  92. :size.sync="size"
  93. @pagination="handlePageChange"
  94. />
  95. <el-dialog :visible.sync="certificateVisible" title="质检单" width="55vw">
  96. <div style="text-align: center; max-height: 80vh; overflow: auto">
  97. <img class="certificate" :src="certificate" style="width: 50vw" />
  98. </div>
  99. </el-dialog>
  100. </div>
  101. </template>
  102. <script>
  103. import Pagination from '@/components/Pagination';
  104. // import { sceneState } from '@/utils/dict/index'
  105. // import { useDictLabel } from '@/utils/dict/index'
  106. // import {
  107. // inWarehouseSceneDetail,
  108. // getAnalysisCertificate,
  109. // getDetail
  110. // } from '@/api/stockManagement/stockLedger'
  111. // import { imageView } from '@/utils/index'
  112. import { getBatchDetails } from '@/api/classifyManage/index';
  113. export default {
  114. components: { Pagination },
  115. props: {
  116. baseInfo: {
  117. type: Object,
  118. default: () => ({})
  119. },
  120. baseParams: {
  121. type: Object,
  122. default: () => ({})
  123. }
  124. },
  125. data() {
  126. return {
  127. searchForm: { batchNum: '', isZero: '' },
  128. tableData: [],
  129. size: 10,
  130. page: 1,
  131. total: 0,
  132. certificateVisible: false,
  133. certificate: ''
  134. };
  135. },
  136. created() {
  137. this.getList();
  138. },
  139. methods: {
  140. // getSceneState: useDictLabel(sceneState),
  141. //质检单 资产类型、资产编码以及批次号获取质检单
  142. async _getAnalysisCertificate(row) {
  143. if (row.certificate) {
  144. this.certificate = row.certificate;
  145. this.certificateVisible = true;
  146. return;
  147. }
  148. const res = await getAnalysisCertificate({
  149. code: this.baseInfo.assetType,
  150. ...this.baseParams,
  151. batchNum: row.batchNum
  152. });
  153. if (res?.success) {
  154. if (res.data?.length) {
  155. imageView(res.data[0]).then((res) => {
  156. this.certificate = res;
  157. this.$set(row, 'certificate', res);
  158. this.certificateVisible = true;
  159. });
  160. } else {
  161. this.$message.error('未上传质检单!');
  162. }
  163. }
  164. },
  165. // 批次入库详情
  166. async handleExpand(row) {
  167. if (!row.children?.length) {
  168. this.$set(row, 'loading', true);
  169. const res = await inWarehouseSceneDetail({
  170. ...this.baseParams,
  171. bizStatus: 1,
  172. batchNum: row.batchNum
  173. });
  174. if (res?.success) {
  175. this.$set(
  176. row,
  177. 'children',
  178. res.data.map((item, index) => ({
  179. index: index + '' + Date.now(),
  180. ...item
  181. }))
  182. );
  183. }
  184. this.$set(row, 'loading', false);
  185. }
  186. },
  187. search() {
  188. this.page = 1;
  189. this.getList();
  190. },
  191. reset() {
  192. this.searchForm = {};
  193. this.search();
  194. },
  195. handlePageChange() {
  196. this.getList();
  197. },
  198. async getList() {
  199. const params = {
  200. size: this.size,
  201. page: this.page,
  202. ...this.baseParams,
  203. batchNum: this.baseParams.batchNum || this.searchForm.batchNum,
  204. isZero: this.searchForm.isZero,
  205. inventoryCode: this.baseInfo.assetCode,
  206. name: this.baseInfo.assetName,
  207. // dimension: +this.$route.query.dimension
  208. batchNo: this.$route.query.batchNo,
  209. categoryId: this.baseParams.categoryId
  210. };
  211. const res = await getBatchDetails(params);
  212. this.tableData = (res.data.list || []).map((item, index) => ({
  213. index: index + '' + Date.now(),
  214. ...item
  215. }));
  216. // this.total = res.count;
  217. }
  218. }
  219. };
  220. </script>
  221. <style lang="scss" scoped>
  222. .detail-box {
  223. margin: 20px auto;
  224. }
  225. </style>