From 1e061b101b0577c4444c6fdd94c4cf6885fb3b80 Mon Sep 17 00:00:00 2001 From: xiaofajia <1665375861@qq.com> Date: Fri, 11 Oct 2024 17:14:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8E=E9=87=87=E8=B4=AD=E3=80=81=E9=A2=86=E6=96=99?= =?UTF-8?q?=E5=85=B3=E8=81=94=E9=85=8D=E4=BB=B6=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/repair/Components/PartChoose.vue | 34 +++++++------- .../repair/stockOperate/Components/SoInfo.vue | 45 ++++++++++++++++-- .../stockOperate/Components/SoTable.vue | 44 ++++++++++-------- src/views/repair/stockOperate/InStock.vue | 28 +++++++++-- .../stockTransfer/Components/StInfo.vue | 2 +- src/views/repair/wares/WaresForm.vue | 46 +++++++++++-------- src/views/repair/wares/index.vue | 1 + 7 files changed, 138 insertions(+), 62 deletions(-) diff --git a/src/views/repair/Components/PartChoose.vue b/src/views/repair/Components/PartChoose.vue index cfe6814..8d58bd8 100644 --- a/src/views/repair/Components/PartChoose.vue +++ b/src/views/repair/Components/PartChoose.vue @@ -1,5 +1,5 @@ - - - - + + + + + + + + + + + + + + + @@ -110,7 +111,8 @@ export default { }, methods: { // TODO 获取商品信息 - async listPart() { + async listPart(val) { + this.queryParams.name = val try{ this.loading = true const res = await getWaresPage(this.queryParams) diff --git a/src/views/repair/stockOperate/Components/SoInfo.vue b/src/views/repair/stockOperate/Components/SoInfo.vue index aa5e8d6..b9b44a2 100644 --- a/src/views/repair/stockOperate/Components/SoInfo.vue +++ b/src/views/repair/stockOperate/Components/SoInfo.vue @@ -21,7 +21,7 @@ - + @@ -32,6 +32,10 @@ + + 新增商品 + 急件采购 + @@ -58,6 +62,7 @@ + @@ -69,10 +74,14 @@ import SoTable from "@/views/repair/stockOperate/Components/SoTable.vue"; import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue"; import {createUniqueCodeByHead} from "@/utils/createUniqueCode"; import {createRepairSo} from "@/api/repair/stockOperate/stockOperate"; +import {getWaresByName} from "@/api/repair/wares"; +import WaresForm from "@/views/repair/wares/WaresForm.vue"; +import router from "@/router"; export default { name: "SoInfo", components: { + WaresForm, StaffChoose, PartChoose, SoTable, @@ -84,6 +93,11 @@ export default { defaultValue: true, required: true }, + soType:{ + type: String, + default: "", + required: false + } }, data() { return { @@ -108,6 +122,9 @@ export default { this.init() }, methods: { + router() { + return router + }, // 得到选择的员工 getStaff(data) { this.formData.userId = data.id @@ -142,11 +159,12 @@ export default { this.formData.goodsList = data.map(item => { return { goodsId: item.id, - goodsType: "0", + goodsType: this.soType ? "1": "0", wareId: item.wareId, goodsCount: item.count, goodsPrice: item.newPrice, - remark: item.remark + remark: item.remark, + soiType: this.soByType ? "01" : "02" } }) }, @@ -178,6 +196,10 @@ export default { this.formData.soNo = createUniqueCodeByHead(this.soByType ? "CG" : "LL") this.staffRole = this.soByType ? this.staffRole : "领料人" this.partList = [] + if (this.soType){ + this.formData.soType = this.soType + this.formData.purchaseType = '02' + } }, // 提交前的构建 async createInit(){ @@ -194,6 +216,23 @@ export default { supplierName: data?.supplier?.name } } + }, + // 新增商品 + newWares(){ + this.$refs.waresForm.open(null); + }, + // 新增商品回调 + async pushData(name){ + const res = await getWaresByName(name) + const data = res.data + this.partList.push({ + ...data, + wareId: data.warehouse + }) + }, + // 急件采购 + newInStock(){ + this.$router.push("/repair/stock/repair-soi?active=purchaseCreate&soType=03") } } } diff --git a/src/views/repair/stockOperate/Components/SoTable.vue b/src/views/repair/stockOperate/Components/SoTable.vue index 4055012..edd21de 100644 --- a/src/views/repair/stockOperate/Components/SoTable.vue +++ b/src/views/repair/stockOperate/Components/SoTable.vue @@ -19,7 +19,8 @@
- + {{ scope.row.warehouseName }}
@@ -31,21 +32,24 @@
- + {{ scope.row.count }}
- +
- + {{ scope.row.newPrice }}
- + {{ scope.row.remark }}
@@ -91,16 +95,16 @@ export default { watch: { partList(val) { if (val && val.length > 0) { - const data = val[val.length - 1] - const newData = { - ...data, - count: 1, - totalPrice: data.price * 1, - remark: '', - newPrice: data.price, - } - this.list.push(newData) - }else { + this.list = val.map(item => { + return { + ...item, + count: 1, + totalPrice: item.purPrice * 1, + remark: '', + newPrice: item.purPrice, + } + }) + } else { this.list = [] } }, @@ -182,7 +186,11 @@ export default { } }, /** 保存数据 */ - save (row) { + save(row) { + if (!this.soByType && row.stock < row.count){ + row.count = 1 + this.$modal.msgError("库存数量不足") + } // 更新表格的数据 row.totalPrice = row.count * row.newPrice const id = row.id @@ -192,8 +200,8 @@ export default { }) this.clickCellMap[id] = [] }, - changeWare(row){ - if (row.ware){ + changeWare(row) { + if (row.ware) { row['wareId'] = row.ware.id row['warehouse'] = row.ware.id row['warehouseName'] = row.ware.name diff --git a/src/views/repair/stockOperate/InStock.vue b/src/views/repair/stockOperate/InStock.vue index 6fb300e..caa782b 100644 --- a/src/views/repair/stockOperate/InStock.vue +++ b/src/views/repair/stockOperate/InStock.vue @@ -1,12 +1,12 @@