taskForm.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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((infoData.extInfo && infoData.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 && extInfo.documentSource) || '-' }}
  21. </u-form-item>
  22. <u-form-item label="来源单据" borderBottom>
  23. {{ infoData.sourceBizNo || '-' }}
  24. </u-form-item>
  25. <template v-if="infoData.bizType == 3">
  26. <u-form-item label="客户名称" borderBottom>
  27. {{ infoData.clientName || '-' }}
  28. </u-form-item>
  29. <u-form-item label="客户联系人" borderBottom>
  30. {{ infoData.clientUser || '-' }}
  31. </u-form-item>
  32. <u-form-item label="客户电话" borderBottom>
  33. {{ infoData.clientPhone || '-' }}
  34. </u-form-item>
  35. </template>
  36. <u-form-item label="领料人" borderBottom>
  37. {{ infoData.fromUser || '-' }}
  38. </u-form-item>
  39. <u-form-item label="领料人联系方式" borderBottom>
  40. {{ infoData.fromUserPhone || '-' }}
  41. </u-form-item>
  42. <u-form-item label="领料人部门" borderBottom>
  43. {{ (infoData.extInfo && infoData.extInfo.verifyDeptName) || '-' }}
  44. </u-form-item>
  45. <u-form-item label="出库时间" borderBottom>
  46. {{ infoData.storageTime || infoData.createTime || '-' }}
  47. </u-form-item>
  48. <u-form-item label="出库登记人" borderBottom>
  49. {{ (infoData.extInfo && infoData.extInfo.createUserName) || '-' }}
  50. </u-form-item>
  51. <u-form-item label="权属部门" borderBottom>
  52. {{ (infoData.extInfo && infoData.extInfo.deptName) || '-' }}
  53. </u-form-item>
  54. <u-form-item label="状态" borderBottom>
  55. {{ stepsTitle }}
  56. </u-form-item>
  57. <u-form-item label="备注" borderBottom>
  58. {{ infoData.remark || '-' }}
  59. </u-form-item>
  60. </u--form>
  61. </view>
  62. <!-- 出库物品清单 -->
  63. <view v-show="curNow === 1">
  64. <common-product-list :list="productList" :tableField="productFields"></common-product-list>
  65. </view>
  66. <!-- 包装明细 -->
  67. <view v-show="curNow === 2">
  68. <common-product-list :list="showPackingList" :tableField="packingFields"></common-product-list>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import { getInboundDetailsById, getInboundDetailsByIds } from '@/api/warehouseManagement'
  74. import { getInfoBySourceBizNoAll } from '@/api/wms'
  75. import { allCategoryLevel } from '@/api/wt';
  76. import { useDictLabel } from '@/utils/dict/index';
  77. import { outputSceneState, qualityResults, qualityStatus } from '@/enum/dict.js';
  78. import { mapGetters, mapActions } from 'vuex';
  79. import { parameterGetByCode } from '@/api/mainData/index.js';
  80. import commonProductList from '../common/commonProductList.vue';
  81. export default {
  82. components: { commonProductList },
  83. props: {
  84. businessId: {
  85. type: String,
  86. default: ''
  87. },
  88. isInterior: {
  89. type: Boolean,
  90. default: true
  91. },
  92. isIds: {
  93. type: Boolean,
  94. default: false
  95. },
  96. XTBG: {
  97. type: Boolean,
  98. default: false
  99. },
  100. },
  101. data() {
  102. return {
  103. tabList: ['出库信息', '物品清单', '包装明细'],
  104. curNow: 0,
  105. qualityStatus,
  106. qualityResults,
  107. productList: [],
  108. showPackingList: [],
  109. packingList: [],
  110. extInfo: {},
  111. codeList: [],
  112. infoData: {},
  113. stepsTitle: '已完成',
  114. stepsStatus: 'success',
  115. active: 0,
  116. isPrice: 1,
  117. // 物品清单字段配置
  118. productFields: [
  119. { label: '仓库', field: 'warehouseName' },
  120. // { label: '编码', field: 'categoryCode' },
  121. // { label: '名称', field: 'categoryName' },
  122. { label: '型号', field: 'categoryModel' },
  123. { label: '规格', field: 'specification' },
  124. { label: '牌号', field: 'brandNum' },
  125. { label: '批次号', field: 'batchNo' },
  126. { label: '包装数量', field: 'packingQuantity' },
  127. { label: '单位', field: 'packingUnit' },
  128. { label: '单价', field: 'singlePrice' },
  129. { label: '计量数量', field: 'measureQuantity' },
  130. { label: '计量单位', field: 'measureUnit' },
  131. { label: '重量', field: 'weight' },
  132. { label: '重量单位', field: 'weightUnit' },
  133. { label: '机型', field: 'modelKey' },
  134. { label: '颜色', field: 'colorKey' },
  135. { label: '锁定数量', field: 'lockQuantity' },
  136. { label: '库存', field: 'stockNum' },
  137. ],
  138. // 包装明细字段配置
  139. packingFields: [
  140. // { label: '编码', field: 'categoryCode' },
  141. // { label: '名称', field: 'categoryName' },
  142. { label: '批次号', field: 'batchNo' },
  143. { label: '发货条码', field: 'barcodes' },
  144. { label: '包装编码', field: 'packageNo' },
  145. { label: '包装数量', field: 'packingQuantity' },
  146. { label: '单位', field: 'packingUnit' },
  147. { label: '计量数量', field: 'measureQuantity' },
  148. { label: '计量单位', field: 'measureUnit' },
  149. { label: '物料代号', field: 'materielDesignation' },
  150. { label: '客户代号', field: 'clientCode' },
  151. { label: '刻码', field: 'engrave' },
  152. { label: '重量', field: 'weight' },
  153. { label: '重量单位', field: 'weightUnit' },
  154. { label: '机型', field: 'modelKey' },
  155. { label: '颜色', field: 'colorKey' },
  156. { label: '供应商', field: 'supplierName' },
  157. { label: '供应商代号', field: 'supplierCode' },
  158. { label: '质检结果', field: 'result', type: 'qualityResult' },
  159. { label: '质检状态', field: 'status', type: 'qualityStatus' },
  160. { label: '生产日期', field: 'productionDate' },
  161. { label: '采购日期', field: 'purchaseDate' },
  162. ],
  163. };
  164. },
  165. watch: {
  166. 'infoData.verifyStatus': {
  167. immediate: true,
  168. handler(val) {
  169. if (val == 0) {
  170. this.active = 1;
  171. this.stepsTitle = '未审核';
  172. this.stepsStatus = 'wait';
  173. } else if (val == 1) {
  174. this.active = 2;
  175. this.stepsTitle = '审核中';
  176. this.stepsStatus = 'process';
  177. } else if (val == 2) {
  178. this.active = 2;
  179. this.stepsTitle = '审核通过';
  180. this.stepsStatus = 'success';
  181. } else if (val == 3) {
  182. this.active = 2;
  183. this.stepsTitle = '驳回';
  184. this.stepsStatus = 'error';
  185. }
  186. }
  187. },
  188. },
  189. computed: {
  190. ...mapGetters(['getDictValue']),
  191. clientEnvironmentId() {
  192. return this.$store.state.user.info.clientEnvironmentId;
  193. },
  194. },
  195. created() {
  196. // 仓库出入库是否显示金额
  197. parameterGetByCode({
  198. code: 'wms_price'
  199. }).then((res) => {
  200. this.isPrice = res.value;
  201. });
  202. this.requestDict('类型用途');
  203. this.getAllCategoryType();
  204. this._getInfo(this.businessId);
  205. },
  206. methods: {
  207. ...mapActions('dict', ['requestDict']),
  208. getSceneState: useDictLabel(outputSceneState),
  209. sectionChange(index) {
  210. this.curNow = index;
  211. },
  212. handleAssetType(r) {
  213. const code = this.codeList.find((item) => item.dictCode == r);
  214. return (code && code.dictValue);
  215. },
  216. async getAllCategoryType() {
  217. const data = await allCategoryLevel();
  218. console.log('getAllCategoryType', data);
  219. this.codeList = data.map((item) => {
  220. return { dictCode: item.id, dictValue: item.name };
  221. });
  222. },
  223. async _getInfo(id) {
  224. if (!id) return;
  225. let res = {};
  226. let resAll = [];
  227. if (this.isInterior) {
  228. res = await getInboundDetailsById(id);
  229. } else if (this.isIds) {
  230. resAll = await getInboundDetailsByIds(id);
  231. } else {
  232. res = await getInfoBySourceBizNoAll(id);
  233. res = res[0] || {};
  234. }
  235. if (this.isIds) {
  236. res = JSON.parse(JSON.stringify(resAll[0]));
  237. this.extInfo = resAll[0].extInfo;
  238. res['outInDetailList'] = [];
  239. resAll.forEach((item) => {
  240. item.outInDetailList.forEach((val) => {
  241. val['bizNo'] = item.bizNo;
  242. res['outInDetailList'].push(val);
  243. });
  244. });
  245. res['bizNo'] = resAll.map((item) => item.bizNo);
  246. this.infoData = res;
  247. } else {
  248. this.infoData = res;
  249. this.extInfo = res && res.extInfo;
  250. }
  251. this.productList = (res && res.outInDetailList && res.outInDetailList.map((productItem) => {
  252. return {
  253. ...productItem,
  254. productCode: productItem.categoryCode,
  255. productName: productItem.categoryName,
  256. outInDetailRecordRequestList:
  257. (productItem.outInDetailRecordRequestList && productItem.outInDetailRecordRequestList.map((packingItem) => {
  258. return {
  259. ...packingItem,
  260. categoryName: productItem.categoryName,
  261. categoryCode: productItem.categoryCode,
  262. supplierCode: productItem.supplierCode,
  263. supplierName: productItem.supplierName,
  264. materialDetailList: (packingItem.materialDetailList && packingItem.materialDetailList.map((materialItem) => {
  265. return {
  266. ...materialItem,
  267. categoryName: productItem.categoryName,
  268. categoryCode: productItem.categoryCode
  269. };
  270. }))
  271. };
  272. }))
  273. };
  274. })) || [];
  275. // 获取包装维度数据,预处理质检字段为文本
  276. const arr = [];
  277. this.productList.forEach((item) => {
  278. (item.outInDetailRecordRequestList || []).forEach((k) => {
  279. arr.push({
  280. ...k,
  281. productCode: k.packageNo || k.categoryCode,
  282. productName: k.categoryName || '包装',
  283. result: qualityResults[k.result] != null ? qualityResults[k.result] : k.result,
  284. status: qualityStatus[k.status] != null ? qualityStatus[k.status] : k.status,
  285. });
  286. });
  287. });
  288. this.packingList = arr;
  289. this.showPackingList = arr;
  290. },
  291. getTableValue() {
  292. return {};
  293. }
  294. }
  295. };
  296. </script>
  297. <style lang="scss" scoped>
  298. .task-form-container {
  299. min-height: 100vh;
  300. background-color: #fff;
  301. }
  302. </style>