| | |
| | | </template> |
| | | <script> |
| | | import { transferAdd } from '@/api/stock/transfer'; |
| | | import { getCategorySelectTree, getTree, goodsTemplate, goodsModel } from '@/api/baseSetting/finsystenant'; |
| | | import { getParentTenant,queryWarehouseGoods } from '@/api/stock/transfer'; |
| | | import { getCategorySelectTree, goodsModel, warehouseSelectNumber } from '@/api/baseSetting/finsystenant'; |
| | | import { getParentTenant, queryWarehouseGoods } from '@/api/stock/transfer'; |
| | | import MyButton from '@/components/myButton/myButton'; |
| | | import winMd from '@/components/win/win-md'; |
| | | import upload from '@/components/upload/index'; |
| | |
| | | unit: null, //单位 |
| | | }, |
| | | rules: { |
| | | warehouseId: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | outAgencyId: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | createTime: [{ required: true, message: '请选择', trigger: 'change' }], |
| | | |
| | | baseCategoryIds: [{ required: true, message: '请选择', trigger: 'change' }], |
| | |
| | | this.getgoodsTemplate(); |
| | | this.getgoodsModel(); |
| | | this.getCategoryTree(); |
| | | this.formData.transferGoods.push(JSON.parse(JSON.stringify(this.goodsItem))); |
| | | }, |
| | | |
| | | // 获取上级机构 |
| | | handegetParentTenant() { |
| | | getParentTenant().then((res) => { |
| | | this.agencyOptions = [res]; |
| | | this.formData.outAgencyId = res.id; |
| | | if (res.id != this.userInfo.tenantId) { |
| | | this.agencyOptions = [res]; |
| | | this.formData.outAgencyId = res.id; |
| | | this.formData.transferGoods.push(JSON.parse(JSON.stringify(this.goodsItem))); |
| | | }else{ |
| | | this.$message.warning('无上级机构') |
| | | } |
| | | }); |
| | | }, |
| | | |
| | |
| | | |
| | | // 物品名称列表选择 |
| | | goodsTemplateChange(e, index) { |
| | | let temp = this.formData.transferGoods.find(v=>v.baseGoodsTemplateId==e) |
| | | if(temp) { |
| | | this.$message.warning('已选过此物品') |
| | | return |
| | | }else{ |
| | | this.formData.transferGoods[index].baseGoodsTemplateId = e |
| | | let temp = this.formData.transferGoods.find((v) => v.baseGoodsTemplateId == e); |
| | | if (temp) { |
| | | this.$message.warning('已选过此物品'); |
| | | return; |
| | | } else { |
| | | this.formData.transferGoods[index].baseGoodsTemplateId = e; |
| | | } |
| | | this.formData.transferGoods[index].modelsOptions = []; |
| | | this.formData.transferGoods[index].modelsIds = []; |
| | |
| | | }, |
| | | |
| | | // 规格型号选择 |
| | | modelChange(e, index) { |
| | | async modelChange(e, index) { |
| | | let arr = [...this.formData.transferGoods[index].models]; |
| | | let str = JSON.stringify(arr); |
| | | e.forEach((item) => { |
| | | for (let item of e) { |
| | | if (str.indexOf(item) == -1) { |
| | | let temp = this.goodsModelAll.find((v) => v.id == item); |
| | | arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit }); |
| | | let num = await warehouseSelectNumber({ |
| | | baseGoodsModelsId: item, |
| | | warehouseType: 0, |
| | | states: 1, |
| | | buyType: 1, |
| | | agencyId: this.formData.outAgencyId, |
| | | }); |
| | | arr.push({ ...this.modelsItem, baseGoodsModelsId: item, unit: temp.unit, worehouseCount: num }); |
| | | } |
| | | }); |
| | | } |
| | | this.formData.transferGoods[index].models = arr; |
| | | }, |
| | | |
| | |
| | | countsChange(e, goodsIndex, index) { |
| | | const curItem = this.formData.transferGoods[goodsIndex].models[index]; |
| | | const worehouseCount = curItem.worehouseCount; |
| | | if(e==0) { |
| | | if (e == 0) { |
| | | this.$message.warning('数量不能为0'); |
| | | curItem.counts = null |
| | | curItem.counts = null; |
| | | } |
| | | if (e > worehouseCount) { |
| | | this.$message.warning('数量超过现有库存'); |
| | |
| | | }, |
| | | |
| | | close() { |
| | | this.formData = { |
| | | warehouseId: '', // 调拨仓库id |
| | | procureTime: '', // 调拨时间 |
| | | transferGoods: [], |
| | | }; |
| | | this.$emit('close'); |
| | | }, |
| | | }, |