From f45b159864ad79f326884ab3644269ef9eb7ee9d Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期四, 04 一月 2024 11:49:16 +0800
Subject: [PATCH] 出入库bug修复,调整仓库位置字段绑定,编辑时列表绑定源位置
---
src/views/warehouseManage/listingRules/index.vue | 175 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 91 insertions(+), 84 deletions(-)
diff --git a/src/views/warehouseManage/listingRules/index.vue b/src/views/warehouseManage/listingRules/index.vue
index de53dd3..32b3b4c 100644
--- a/src/views/warehouseManage/listingRules/index.vue
+++ b/src/views/warehouseManage/listingRules/index.vue
@@ -17,14 +17,19 @@
<div class="list-view">
<div class="table">
<CommonFormTableView
+ ref="tableRef"
:islistingrules="true"
:product-table-list="tableList"
@inputContent="inputContent"
@tableRowClick="tableRowClick"
@selLocationClick="selLocationClick"
+ @selSonLocationClick="selSonLocationClick"
+ @querySearchData="querySearchData"
@selProductClick="selProductClick"
- @selProductTypeClick="selProductTypeClick"
>
+ <!--
+ @selProductTypeClick="selProductTypeClick"
+ -->
<template slot="tableButton">
<el-table-column label="鎿嶄綔" width="90" align="center">
<template slot-scope="scope">
@@ -63,28 +68,6 @@
addTitle: "鏂板缓",
showDiscard: false,
tableList: {},
- tableData: [
- {
- location: "HC/閿�鍞尯",
- productName: "澶忓鐪熶笣鍚婂甫瑁�",
- amount: "0.00",
- unit: "浠�",
- count: "0.00",
- date: "2023-12-31",
- user: "绠$悊鍛�",
- isSet: true,
- isEdit: true
- },
- {
- location: "HM/閿�鍞尯",
- productName: "澶忓鐪熶笣鍚婂甫瑁�",
- productCategory: "",
- subLocation: "A鍖�",
- companyName: "璐濇�濈",
- isSet: true,
- isEdit: true
- }
- ],
searchOptions: [],
countId: 0,
isNoProduct: true, // 娣诲姞鏄庣粏琛屾椂鏄惁鏈変骇鍝佹湭閫夋嫨
@@ -98,14 +81,15 @@
RuleType: 0,
queryProductId: null,
categoryId: null,
- searchTaskMap: []
+ searchTaskMap: [],
+ isCreate: false,
+ thatRow: {}
}
},
created() {
this.setTable()
let query = this.$route.query
if (query) {
- console.log("aaaaaaaaaaaaa", query)
this.queryProductId = query.productId?.length ? query.productId : null
this.categoryId = query.id ? Number(query.id) : null
this.pagerOptions.currPage = 1
@@ -126,12 +110,13 @@
selectBox: false,
selectIndex: true,
tableColumn: [
- { label: "褰撲骇鍝佸埌杈�", prop: "areaName", location: true },
+ { label: "褰撲骇鍝佸埌杈�", prop: "areaName", toLocation: true },
{ label: "浜у搧", prop: "productName", product: true },
{ label: "浜у搧绫诲埆", prop: "productCategory", productType: true },
- { label: "瀛樺偍鍒板瓙浣嶇疆", prop: "subLocation", location: true }
+ { label: "瀛樺偍鍒板瓙浣嶇疆", prop: "subLocation", sonLocation: true }
// { label: "鍏徃", prop: "companyName", company: true }
- ]
+ ],
+ rowClickIndex: -1
}
},
// 璇锋眰鏁版嵁
@@ -171,6 +156,7 @@
},
// 鏂板
addProductClick() {
+ this.isCreate = true
this.tableList.tableColumn[1].product = true
this.tableList.tableColumn[2].productType = true
console.log(this.tableData)
@@ -190,6 +176,7 @@
subLocation: "",
productName: "",
companyName: "",
+ productCategory: "",
isSet: true,
isEdit: false,
isOrder: true
@@ -201,7 +188,7 @@
} else {
if (this.areaId === 0) {
this.$message.error("璇烽�夋嫨褰撳墠浜у搧鍒拌揪浣嶇疆")
- } else if (this.productId === 0 && this.productCategoryId === "") {
+ } else if (this.productId === 0 && this.productCategoryId === 0) {
this.$message.error("璇烽�夋嫨浜у搧鎴栦骇鍝佺被鍒�")
} else if (this.subLocationId === 0) {
this.$message.error("璇烽�夋嫨瀛樺偍鍒板瓙浣嶇疆")
@@ -224,14 +211,15 @@
id: this.currentRowId,
areaId: this.areaId,
locationId: this.subLocationId,
- productCategoryId: this.productCategoryId || "",
- productId: this.productId || ""
+ productCategoryId: this.productCategoryId,
+ productId: this.productId
}).then((res) => {
console.log(res)
if (res.code === 200) {
this.getData()
let tipStr = this.currentRowId === 0 ? "娣诲姞鎴愬姛" : "淇敼鎴愬姛"
this.$message.success(tipStr)
+ this.isCreate = false
}
})
}
@@ -250,15 +238,10 @@
},
// 鍙栨秷
discardBtnClick() {
+ this.getData()
+ this.isCreate = false
this.tableList.tableColumn[1].product = true
this.tableList.tableColumn[2].productType = true
- if (this.isRowClick) {
- this.tableData.map((item) => {
- item.isEdit = true
- })
- } else {
- this.tableData.splice(0, 1)
- }
this.addTitle = "鏂板缓"
this.showDiscard = false
},
@@ -295,40 +278,55 @@
},
// 琛岀偣鍑�
tableRowClick(row, rowIndex) {
+ this.thatRow = row
+ this.tableList.rowClickIndex = rowIndex
this.rowIndex = rowIndex
this.isSel()
if (!this.isNoProduct && this.currentRowId === 0) {
this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓")
} else {
- this.tableList.tableColumn[2].productType = true
- this.currentRowId = row.id
+ this.currentRowId = row.id || 0
this.addTitle = "淇濆瓨"
this.showDiscard = true
this.isRowClick = true
- if (!this.isNoProduct) {
- this.tableData.splice(this.tableData.length - 1, 1)
+ if (this.isNoProduct) {
+ // this.tableData.splice(this.tableData.length - 1, 1)
+ this.tableData.map((item, index) => {
+ if (index === rowIndex) {
+ item.isEdit = false
+ item.isOrder = true
+ } else {
+ item.isEdit = true
+ }
+ })
+ this.areaId = row.areaId
+ this.subLocationId = row.locationId
+ this.productCategoryId = row.productCategoryId
+ this.productId = row.productId
}
- this.tableData.map((item, index) => {
- if (index === rowIndex) {
- item.isEdit = false
- item.isOrder = true
- } else {
- item.isEdit = true
- }
- })
- this.areaId = row.areaId
- this.subLocationId = row.locationId
- this.productCategoryId = row.productCategoryId
- this.productId = row.productId
- if (
- this.tableList.tableData[rowIndex].productName === "" ||
- this.tableList.tableData[rowIndex].productName === " "
- ) {
- this.tableList.tableColumn[1].product = false
+ }
+ },
+ querySearchData(queryString, results, value) {
+ if (this.isCreate) {
+ if (queryString === "") {
+ this.tableList.tableColumn[1].product = true
this.tableList.tableColumn[2].productType = true
} else {
- this.tableList.tableColumn[1].product = true
- this.tableList.tableColumn[2].productType = false
+ if (value === "product") {
+ this.tableList.tableColumn[2].productType = false
+ if (results.length !== 0) {
+ this.productId = results[0].id
+ } else {
+ this.productId = 0
+ }
+ } else if (value === "productType") {
+ this.tableList.tableColumn[1].product = false
+ if (results.length !== 0) {
+ this.productCategoryId = results[0].id
+ } else {
+ this.productCategoryId = 0
+ }
+ }
}
}
},
@@ -355,33 +353,30 @@
this.editConfig.visible = true
this.editConfig.title = "鏂板缓"
},
- // 閫夋嫨浣嶇疆鏂规硶
+ // 閫夋嫨璧峰浣嶇疆鏂规硶
selLocationClick(item, prop) {
- console.log(item, prop)
if (prop === "areaName") {
this.areaId = item.value
} else if (prop === "subLocation") {
this.subLocationId = item.value
}
},
- // 閫変腑浜у搧鏂规硶
- selProductClick(item) {
- console.log(item, "浜у搧")
- this.RuleType = 1
- this.tableList.tableColumn[2].productType = false
- this.productId = item.value
- this.productCategoryId = item.categoryId
+ // 閫夋嫨瀛愪綅缃柟娉�
+ selSonLocationClick(item) {
+ this.subLocationId = item.value
},
- // 閫変腑浜у搧绫诲瀷鏂规硶
- selProductTypeClick(item) {
- this.RuleType = 2
- if (this.currentRowId === 0) {
- this.productCategoryId = item.value
- } else {
+ // 閫変腑浜у搧鏂规硶
+ selProductClick(value, item) {
+ console.log(value, item)
+ if (value === "product") {
+ this.RuleType = 1
+ this.tableList.tableColumn[2].productType = false
+ this.productId = item.productId
+ this.productCategoryId = item.categoryId
+ } else if (value === "productType") {
+ this.productCategoryId = item.id
+ this.RuleType = 2
this.tableList.tableColumn[1].product = false
- this.tableList.tableData[this.rowIndex].productName = " "
- this.productId = ""
- this.productCategoryId = this.tableList.tableData[this.rowIndex].productCategoryId
}
},
// 鍒犻櫎
@@ -403,13 +398,25 @@
},
watch: {
rowIndex(newVal) {
- if (this.tableList.tableData[newVal].productName === " ") {
- this.tableList.tableColumn[1].product = false
- this.tableList.tableColumn[2].productType = true
+ if (this.isCreate) {
+ if (newVal === 0) {
+ this.tableList.tableColumn[1].product = true
+ this.tableList.tableColumn[2].productType = true
+ } else {
+ this.$message.error("璇峰畬鎴愬綋鍓嶆柊寤烘垨鍙栨秷鏂板缓")
+ this.tableList.tableColumn[1].product = false
+ this.tableList.tableColumn[2].productType = false
+ }
} else {
- this.tableList.tableColumn[1].product = true
- this.tableList.tableColumn[2].productType = false
+ if (this.tableList.tableData[newVal].productName === "") {
+ this.tableList.tableColumn[1].product = false
+ this.tableList.tableColumn[2].productType = true
+ } else {
+ this.tableList.tableColumn[1].product = true
+ this.tableList.tableColumn[2].productType = false
+ }
}
+ this.$refs.tableRef.getProductCategoryList()
}
}
}
--
Gitblit v1.8.0