taskForm.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <view class="task-form-container">
  3. <u-sticky offset-top="50">
  4. <u-subsection fontSize="25" mode="subsection" :list="tabList" :current="curNow" @change="sectionChange"
  5. activeColor="#157A2C" bgColor="#fff"></u-subsection>
  6. </u-sticky>
  7. <!-- 入库信息 -->
  8. <view v-show="curNow === 0">
  9. <u--form style="margin: 0 20px;" labelPosition="left" :model="infoData" ref="uForm" labelWidth="180rpx">
  10. <u-form-item label="入库单号" borderBottom>
  11. {{ infoData.bizNo || '-' }}
  12. </u-form-item>
  13. <u-form-item label="入库物品类型" borderBottom>
  14. {{ handleAssetType(extInfo.assetType) || '-' }}
  15. </u-form-item>
  16. <u-form-item label="入库场景" borderBottom>
  17. {{ getSceneState(infoData.bizType) || '-' }}
  18. </u-form-item>
  19. <u-form-item label="关联订单" borderBottom>
  20. {{ extInfo.documentSource || '-' }}
  21. </u-form-item>
  22. <u-form-item label="客户名称" borderBottom>
  23. {{ infoData.clientName || '-' }}
  24. </u-form-item>
  25. <u-form-item label="供应商" borderBottom>
  26. {{ extInfo.supplierName || '-' }}
  27. </u-form-item>
  28. <u-form-item label="供应商代号" borderBottom>
  29. {{ extInfo.supplierCode || '-' }}
  30. </u-form-item>
  31. <u-form-item label="入库时间" borderBottom>
  32. {{ infoData.storageTime || infoData.createTime || '-' }}
  33. </u-form-item>
  34. <u-form-item label="入库登记人" borderBottom>
  35. {{ extInfo.createUserName || '-' }}
  36. </u-form-item>
  37. <u-form-item label="权属部门" borderBottom>
  38. {{ extInfo.deptName || '-' }}
  39. </u-form-item>
  40. <u-form-item label="审核人" borderBottom>
  41. {{ infoData.verifyName || '-' }}
  42. </u-form-item>
  43. <u-form-item label="状态" borderBottom>
  44. {{ stepsTitle }}
  45. </u-form-item>
  46. <u-form-item label="备注" borderBottom>
  47. {{ infoData.remark || '-' }}
  48. </u-form-item>
  49. </u--form>
  50. </view>
  51. <!-- 产品信息 -->
  52. <view v-show="curNow === 1">
  53. <common-product-list :list="productList" :tableField="productFields"></common-product-list>
  54. </view>
  55. <!-- 包装明细 -->
  56. <view v-show="curNow === 2">
  57. <common-product-list :list="showPackingList" :tableField="packingFields"></common-product-list>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import { getInboundDetailsById, getInboundDetailsByIds } from '@/api/warehouseManagement'
  63. import { getInfoBySourceBizNoAll } from '@/api/wms'
  64. import { allCategoryLevel } from '@/api/wt';
  65. import { useDictLabel } from '@/utils/dict/index';
  66. import { sceneState, qualityResults, qualityStatus } from '@/enum/dict.js';
  67. import { mapGetters, mapActions } from 'vuex';
  68. import { parameterGetByCode } from '@/api/mainData/index.js';
  69. import commonProductList from '../common/commonProductList.vue';
  70. export default {
  71. components: { commonProductList },
  72. props: {
  73. bizType: {
  74. type: String,
  75. default: ''
  76. },
  77. businessId: {
  78. type: String,
  79. default: ''
  80. },
  81. isUpload: {
  82. type: Boolean,
  83. default: false
  84. },
  85. isInterior: {
  86. type: Boolean,
  87. default: true
  88. },
  89. isIds: {
  90. type: Boolean,
  91. default: false
  92. }
  93. },
  94. data() {
  95. return {
  96. tabList: ['入库信息', '产品信息', '包装明细'],
  97. curNow: 0,
  98. qualityStatus,
  99. qualityResults,
  100. productList: [],
  101. showPackingList: [],
  102. packingList: [],
  103. extInfo: {},
  104. codeList: [],
  105. infoData: {},
  106. stepsTitle: '已完成',
  107. stepsStatus: 'success',
  108. active: 0,
  109. isPrice: 1,
  110. // 产品信息字段配置
  111. productFields: [
  112. { label: '仓库', field: 'warehouseName' },
  113. // { label: '编码', field: 'categoryCode' },
  114. // { label: '名称', field: 'categoryName' },
  115. { label: '型号', field: 'categoryModel' },
  116. { label: '规格', field: 'specification' },
  117. { label: '牌号', field: 'brandNum' },
  118. { label: '批次号', field: 'batchNo' },
  119. { label: '包装数量', field: 'packingQuantity' },
  120. { label: '单位', field: 'packingUnit' },
  121. { label: '计量数量', field: 'measureQuantity' },
  122. { label: '计量单位', field: 'measureUnit' },
  123. { label: '重量', field: 'weight' },
  124. { label: '重量单位', field: 'weightUnit' },
  125. { label: '机型', field: 'modelKey' },
  126. { label: '颜色', field: 'colorKey' },
  127. { label: '允许拆包', field: 'isUnpack' },
  128. { label: '供应商', field: 'supplierName' },
  129. ],
  130. // 包装明细字段配置
  131. packingFields: [
  132. { label: '批次号', field: 'batchNo' },
  133. { label: '包装编码', field: 'packageNo' },
  134. // { label: '名称', field: 'categoryName' },
  135. // { label: '编码', field: 'categoryCode' },
  136. { label: '型号', field: 'categoryModel' },
  137. { label: '规格', field: 'specification' },
  138. { label: '牌号', field: 'brandNum' },
  139. { label: '发货条码', field: 'barcodes' },
  140. { label: '包装数量', field: 'packingQuantity' },
  141. { label: '包装单位', field: 'packingUnit' },
  142. { label: '计量数量', field: 'measureQuantity' },
  143. { label: '计量单位', field: 'measureUnit' },
  144. { label: '物料代号', field: 'materielDesignation' },
  145. { label: '客户代号', field: 'clientCode' },
  146. { label: '刻码', field: 'engrave' },
  147. { label: '重量', field: 'weight' },
  148. { label: '重量单位', field: 'weightUnit' },
  149. { label: '机型', field: 'modelKey' },
  150. { label: '颜色', field: 'colorKey' },
  151. { label: '供应商', field: 'supplierName' },
  152. { label: '供应商代号', field: 'supplierCode' },
  153. { label: '质检结果', field: 'result' },
  154. { label: '质检状态', field: 'status' },
  155. { label: '仓库', field: 'warehouseName' },
  156. { label: '生产日期', field: 'productionDate' },
  157. { label: '采购日期', field: 'purchaseDate' },
  158. { label: '失效日期', field: 'expireDate' },
  159. ],
  160. };
  161. },
  162. watch: {
  163. 'infoData.verifyStatus': {
  164. immediate: true,
  165. handler(val) {
  166. if (val == 0) {
  167. this.active = 1;
  168. this.stepsTitle = '未审核';
  169. this.stepsStatus = 'wait';
  170. } else if (val == 1) {
  171. this.active = 2;
  172. this.stepsTitle = '审核中';
  173. this.stepsStatus = 'process';
  174. } else if (val == 2) {
  175. this.active = 2;
  176. this.stepsTitle = '审核通过';
  177. this.stepsStatus = 'success';
  178. } else if (val == 3) {
  179. this.active = 2;
  180. this.stepsTitle = '驳回';
  181. this.stepsStatus = 'error';
  182. }
  183. }
  184. },
  185. businessId(val) {
  186. if (val) {
  187. this._getInfo(val);
  188. }
  189. }
  190. },
  191. computed: {
  192. ...mapGetters(['getDictValue']),
  193. clientEnvironmentId() {
  194. return this.$store.state.user.info.clientEnvironmentId;
  195. },
  196. },
  197. created() {
  198. parameterGetByCode({
  199. code: 'wms_price'
  200. }).then((res) => {
  201. this.isPrice = res.value;
  202. });
  203. this.requestDict('类型用途');
  204. this.getAllCategoryType();
  205. this._getInfo(this.businessId);
  206. },
  207. methods: {
  208. ...mapActions('dict', ['requestDict']),
  209. getSceneState: useDictLabel(sceneState),
  210. sectionChange(index) {
  211. this.curNow = index;
  212. },
  213. handleAssetType(r) {
  214. if (!r) return '-';
  215. var arr = r.split(',');
  216. var filteredData = this.codeList.filter(function(item) {
  217. return arr.indexOf(item.dictCode) !== -1;
  218. });
  219. return filteredData.map(function(item) { return item.dictValue; }).join(',');
  220. },
  221. async getAllCategoryType() {
  222. var data = await allCategoryLevel();
  223. this.codeList = data.map(function(item) {
  224. return { dictCode: item.id, dictValue: item.name };
  225. });
  226. },
  227. async _getInfo(id) {
  228. if (!id) return;
  229. var res = null;
  230. var resAll = null;
  231. if (this.isInterior) {
  232. res = await getInboundDetailsById(id);
  233. } else if (this.isIds) {
  234. resAll = await getInboundDetailsByIds(id);
  235. } else {
  236. res = await getInfoBySourceBizNoAll(id);
  237. res = res[0] || {};
  238. }
  239. if (this.isIds) {
  240. res = JSON.parse(JSON.stringify(resAll[0]));
  241. this.extInfo = resAll[0].extInfo;
  242. res['outInDetailList'] = [];
  243. resAll.forEach(function(item) {
  244. item.outInDetailList.forEach(function(val) {
  245. val['bizNo'] = item.bizNo;
  246. res['outInDetailList'].push(val);
  247. });
  248. });
  249. res['bizNo'] = resAll.map(function(item) { return item.bizNo; });
  250. this.infoData = res;
  251. } else {
  252. this.infoData = res;
  253. this.extInfo = res.extInfo || {};
  254. }
  255. this.productList = (res && res.outInDetailList && res.outInDetailList.map(function(productItem) {
  256. return {
  257. productCode: productItem.categoryCode,
  258. productName: productItem.categoryName,
  259. categoryCode: productItem.categoryCode,
  260. categoryName: productItem.categoryName,
  261. categoryModel: productItem.categoryModel,
  262. specification: productItem.specification,
  263. brandNum: productItem.brandNum,
  264. batchNo: productItem.batchNo,
  265. packingQuantity: productItem.packingQuantity,
  266. packingUnit: productItem.packingUnit,
  267. measureQuantity: productItem.measureQuantity,
  268. measureUnit: productItem.measureUnit,
  269. weight: productItem.weight,
  270. weightUnit: productItem.weightUnit,
  271. modelKey: productItem.modelKey,
  272. colorKey: productItem.colorKey,
  273. warehouseName: productItem.warehouseName,
  274. supplierName: productItem.supplierName,
  275. supplierCode: productItem.supplierCode,
  276. productionRequirements: productItem.productionRequirements,
  277. isUnpack: productItem.isUnpack == 1 ? '是' : '否',
  278. supplierName: productItem.supplierName,
  279. outInDetailRecordRequestList: (productItem.outInDetailRecordRequestList && productItem.outInDetailRecordRequestList.map(function(packingItem) {
  280. return {
  281. productCode: packingItem.packageNo || packingItem.categoryCode,
  282. productName: packingItem.categoryName || '包装',
  283. categoryName: productItem.categoryName,
  284. categoryCode: productItem.categoryCode,
  285. categoryModel: productItem.categoryModel,
  286. specification: productItem.specification,
  287. brandNum: productItem.brandNum,
  288. batchNo: packingItem.batchNo,
  289. packageNo: packingItem.packageNo,
  290. barcodes: packingItem.barcodes,
  291. packingQuantity: packingItem.packingQuantity,
  292. packingUnit: packingItem.packingUnit,
  293. measureQuantity: packingItem.measureQuantity,
  294. measureUnit: packingItem.measureUnit,
  295. materielDesignation: packingItem.materielDesignation,
  296. clientCode: packingItem.clientCode,
  297. engrave: packingItem.engrave,
  298. weight: packingItem.weight,
  299. weightUnit: packingItem.weightUnit,
  300. modelKey: packingItem.modelKey,
  301. colorKey: packingItem.colorKey,
  302. supplierName: productItem.supplierName,
  303. supplierCode: productItem.supplierCode,
  304. result: qualityResults[packingItem.result] != null ? qualityResults[packingItem.result] : packingItem.result,
  305. status: qualityStatus[packingItem.status] != null ? qualityStatus[packingItem.status] : packingItem.status,
  306. warehouseName: packingItem.warehouseName,
  307. areaName: packingItem.areaName,
  308. goodsShelfName: packingItem.goodsShelfName,
  309. goodsAllocationName: packingItem.goodsAllocationName,
  310. productionDate: packingItem.productionDate,
  311. purchaseDate: packingItem.purchaseDate,
  312. expireDate: packingItem.expireDate,
  313. };
  314. }))
  315. };
  316. })) || [];
  317. // 获取包装维度数据
  318. var arr = [];
  319. var that = this;
  320. this.productList.forEach(function(item) {
  321. (item.outInDetailRecordRequestList || []).forEach(function(k) {
  322. arr.push(k);
  323. });
  324. });
  325. this.packingList = arr;
  326. this.showPackingList = arr;
  327. },
  328. getTableValue() {
  329. return {};
  330. }
  331. }
  332. };
  333. </script>
  334. <style lang="scss" scoped>
  335. .task-form-container {
  336. min-height: 100vh;
  337. background-color: #fff;
  338. }
  339. </style>