InWarehouseDialog.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <el-dialog :visible.sync="visible" title="入库明细" width="70%">
  3. <div class="info">
  4. <div>入库单号 {{ info.bizNum }}</div>
  5. <div class="search-box">
  6. <el-input
  7. v-model="searchVal"
  8. size="small"
  9. v-if="dimension === 1"
  10. :placeholder="`搜索${assetTypeName}编码/批次号`"
  11. ></el-input>
  12. <el-input
  13. v-else
  14. size="small"
  15. v-model="searchVal"
  16. :placeholder="`搜索${assetTypeName}编码`"
  17. ></el-input>
  18. <!-- <el-button size="small" @click="handleCreateCode"
  19. >批量生成二维码</el-button
  20. > -->
  21. </div>
  22. </div>
  23. <el-table
  24. :data="showTableData"
  25. height="60vh"
  26. class="w100"
  27. border
  28. @selection-change="handleSelectionChange"
  29. :header-cell-style="{ background: '#EEEEEE', border: 'none' }"
  30. >
  31. <el-table-column label="序号" type="index"></el-table-column>
  32. <el-table-column
  33. :label="`${assetTypeName}编码`"
  34. prop="onlyCode"
  35. ></el-table-column>
  36. <el-table-column label="包装编码" prop="num"></el-table-column>
  37. <el-table-column label="最小包装单元" prop="" v-if="!baseInfo.isUnpack">
  38. <template slot-scope="{ row }">{{
  39. `${row.measurementUnit || ''}${row.unit}/${row.minPackUnit}`
  40. }}</template>
  41. </el-table-column>
  42. <el-table-column
  43. label="批次号"
  44. prop="batchNum"
  45. v-if="dimension == 1"
  46. ></el-table-column>
  47. <el-table-column label="生产日期" prop="manufactureTime">
  48. <template slot-scope="{ row }">{{
  49. row.manufactureTime || row.procurementTime
  50. }}</template></el-table-column
  51. >
  52. <el-table-column label="过期时间" prop="expirationTime"></el-table-column>
  53. <el-table-column label="货位" prop="" show-overflow-tooltip>
  54. <template slot-scope="{ row }">
  55. {{
  56. `${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`
  57. }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column type="selection"></el-table-column>
  61. </el-table>
  62. <QrPrint
  63. ref="QrPrint"
  64. @close="QrPrintClose"
  65. :config="barCodeConfig"
  66. :openBarCode.sync="openWindows"
  67. />
  68. </el-dialog>
  69. </template>
  70. <script>
  71. // import { getWarehouseSceneDetail } from '@/api/stockManagement/stockLedger'
  72. // import dictMixin from '@/mixins/dictMixins'
  73. // import { batchBarPrint } from '@/api/ledgerAssets/booksList'
  74. // import QrPrint from '@/components/print/printPDF.vue'
  75. // 条码类型枚举
  76. const codeTypeObj = {
  77. 生产设备: 0,
  78. // 舟皿: '',
  79. 周转车: 1,
  80. 模具: 3,
  81. 混合料: 4,
  82. 混炼料: 5,
  83. 破碎料: 6,
  84. 返回料: 8,
  85. 返工料: 9,
  86. 备品备件: 10,
  87. 车削料: 11,
  88. 风管料: 12,
  89. 地面料: 13
  90. }
  91. export default {
  92. // mixins: [dictMixin],
  93. // components: { QrPrint },
  94. props: {
  95. assetCode: String,
  96. baseInfo: {
  97. type: Object,
  98. default: () => ({})
  99. }
  100. },
  101. data () {
  102. return {
  103. openWindows: false,
  104. visible: false,
  105. tableData: [],
  106. info: {},
  107. barCodeConfig: [],
  108. searchVal: '',
  109. selectList: []
  110. }
  111. },
  112. computed: {
  113. dimension () {
  114. return this.$route.query.dimension
  115. },
  116. showTableData () {
  117. return this.tableData.filter(item => {
  118. if (this.searchVal) {
  119. return (
  120. (item.onlyCode && item.onlyCode.indexOf(this.searchVal)) > -1 ||
  121. (item.batchNum &&
  122. this.dimension == 1 &&
  123. item.batchNum.indexOf(this.searchVal)) > -1
  124. )
  125. }
  126. return true
  127. })
  128. },
  129. assetTypeName () {
  130. return this.getDictValue('物品类型', this.baseInfo.assetType)
  131. }
  132. },
  133. created () {
  134. // this.requestDict('物品类型')
  135. },
  136. methods: {
  137. open ({ bizNum, batchNum }) {
  138. this.info = { bizNum, batchNum }
  139. this._getWarehouseSceneDetail(bizNum, batchNum)
  140. this.visible = true
  141. },
  142. async _getWarehouseSceneDetail (bizNum, batchNum) {
  143. const res = await getWarehouseSceneDetail({
  144. bizNum,
  145. batchNum,
  146. bizStatus: 1,
  147. inventoryCode: this.assetCode
  148. })
  149. if (res?.success) {
  150. this.tableData = res.data
  151. }
  152. },
  153. handleSelectionChange (val) {
  154. this.selectList = val
  155. },
  156. handleCreateCode () {
  157. console.log(this.baseInfo, 222)
  158. const classificationArr =
  159. this.baseInfo?.classificationUrl?.split('-') || []
  160. let index = 0
  161. let barType
  162. while (classificationArr[index]) {
  163. barType = codeTypeObj[classificationArr[index]]
  164. if (barType !== undefined) {
  165. break
  166. }
  167. index++
  168. }
  169. if (barType === undefined) {
  170. return this.$message.error('当前物品类型不支持生成二维码')
  171. }
  172. if (!this.selectList?.length) {
  173. return this.$message.error('请选择数据')
  174. }
  175. this.handlPrint(barType)
  176. },
  177. QrPrintClose () {
  178. this.barCodeConfig = []
  179. },
  180. async handlPrint (barType) {
  181. this.openWindows = true
  182. let params = this.selectList.map(item => {
  183. return {
  184. barType: barType,
  185. bizId: item.id
  186. }
  187. })
  188. let _this = this
  189. const res = await batchBarPrint(params)
  190. async function getResList () {
  191. for (const el of res.data) {
  192. const fontTypeObj = { 1: '宋体', 2: '微软雅黑', 3: 'Arial' }
  193. let item = el
  194. item.useModeList = item.useModeList.sort((a, b) => {
  195. return a.barAvg.substr(4) - b.barAvg.substr(4)
  196. })
  197. const useModeList = item.useModeList
  198. // 条码框数据
  199. _this.barCodeConfig.push({
  200. putType: el.putType,
  201. qrCode: el.qrCode,
  202. sizeLong: el.sizeLong,
  203. sizeWide:el.sizeWide,
  204. code1: useModeList[0].sampleData,
  205. code2: useModeList[1].sampleData,
  206. code3: useModeList[2].sampleData,
  207. code4: useModeList[3].sampleData,
  208. code5: useModeList[4].sampleData,
  209. code6: useModeList[5].sampleData,
  210. code7: useModeList[6].sampleData,
  211. code8: useModeList[7].sampleData,
  212. code9: useModeList[8].sampleData,
  213. code10: useModeList[9].sampleData,
  214. code11: useModeList[10].sampleData,
  215. code12: useModeList[11].sampleData,
  216. code13: useModeList[12].sampleData,
  217. code14: useModeList[13].sampleData,
  218. fontSizeCode1: useModeList[0].fontSize,
  219. fontSizeCode2: useModeList[1].fontSize,
  220. fontSizeCode3: useModeList[2].fontSize,
  221. fontSizeCode4: useModeList[3].fontSize,
  222. fontSizeCode5: useModeList[4].fontSize,
  223. fontSizeCode6: useModeList[5].fontSize,
  224. fontSizeCode7: useModeList[6].fontSize,
  225. fontSizeCode8: useModeList[7].fontSize,
  226. fontSizeCode9: useModeList[8].fontSize,
  227. fontSizeCode10: useModeList[9].fontSize,
  228. fontSizeCode11: useModeList[10].fontSize,
  229. fontSizeCode12: useModeList[11].fontSize,
  230. fontSizeCode13: useModeList[12].fontSize,
  231. fontSizeCode14: useModeList[13].fontSize,
  232. typefaceCode1: fontTypeObj[useModeList[0].fontType],
  233. typefaceCode2: fontTypeObj[useModeList[1].fontType],
  234. typefaceCode3: fontTypeObj[useModeList[2].fontType],
  235. typefaceCode4: fontTypeObj[useModeList[3].fontType],
  236. typefaceCode5: fontTypeObj[useModeList[4].fontType],
  237. typefaceCode6: fontTypeObj[useModeList[5].fontType],
  238. typefaceCode7: fontTypeObj[useModeList[6].fontType],
  239. typefaceCode8: fontTypeObj[useModeList[7].fontType],
  240. typefaceCode9: fontTypeObj[useModeList[8].fontType],
  241. typefaceCode10: fontTypeObj[useModeList[9].fontType],
  242. typefaceCode11: fontTypeObj[useModeList[10].fontType],
  243. typefaceCode12: fontTypeObj[useModeList[11].fontType],
  244. typefaceCode13: fontTypeObj[useModeList[12].fontType],
  245. typefaceCode14: fontTypeObj[useModeList[13].fontType]
  246. })
  247. }
  248. }
  249. getResList()
  250. }
  251. }
  252. }
  253. </script>
  254. <style lang="scss" scoped>
  255. .info {
  256. font-weight: bold;
  257. color: #000;
  258. display: flex;
  259. justify-content: space-between;
  260. align-items: center;
  261. margin-bottom: 20px;
  262. .search-box {
  263. display: flex;
  264. justify-content: space-between;
  265. align-items: center;
  266. }
  267. }
  268. </style>