From 185acb9f9f73c1818b9eb2dcb783c30d2174381f Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期四, 16 十一月 2023 15:44:54 +0800
Subject: [PATCH] 优化产品选择组件
---
src/views/warehouseManage/listingRules/index.vue | 1
src/views/productManage/reorderRules/index.vue | 5 --
src/components/makepager/CommonFormTableView.vue | 90 ++++++++++++++++++---------------------------
3 files changed, 37 insertions(+), 59 deletions(-)
diff --git a/src/components/makepager/CommonFormTableView.vue b/src/components/makepager/CommonFormTableView.vue
index 7a7cf80..4cfa286 100644
--- a/src/components/makepager/CommonFormTableView.vue
+++ b/src/components/makepager/CommonFormTableView.vue
@@ -274,7 +274,11 @@
:echoName="scope.row[item.prop]"
checkedNum="1"
:clearable="true"
- @select-user="selProductClick"
+ @select-user="
+ (val) => {
+ selProductClick(val, scope.row)
+ }
+ "
>
</SimpleSearchInput>
</template>
@@ -288,30 +292,6 @@
>
<div class="custom-name">
<span v-if="scope.row.isEdit || scope.row.editable">{{ scope.row.productCategory }}</span>
-
- <!-- <el-select
- v-else
- v-model="scope.row[item.prop]"
- placeholder="璇烽�夋嫨"
- size="mini"
- style="width: 80%"
- @change="
- (val) => {
- selProductTypeClick(val)
- }
- "
- >
- <el-option
- v-for="item in productTypeNameOptions"
- :key="item.id"
- :label="item.name"
- :value="{
- value: item.id,
- label: item.name
- }"
- >
- </el-option>
- </el-select> -->
<el-autocomplete
v-else
style="width: 100%"
@@ -673,14 +653,16 @@
})
},
// 閫夋嫨浜у搧
- selProductClick(item) {
+ selProductClick(item, row) {
if (this.isReorder) {
this.productId = item.id
this.productName = item.name
- this.getAmountAndPrediction(item, "product")
+ this.getAmountAndPrediction(item, "product", row)
} else {
+ let selIndex = 0
this.tableList.tableData.map((ite, index) => {
- if (index === 0) {
+ if (ite.id === row.id) {
+ selIndex = index
ite.productId = item.id
ite.productName = item.name
ite.categoryId = item.categoryId
@@ -689,7 +671,7 @@
ite.unit = item.unit
}
})
- this.$emit("selProductClick", "product", this.tableList.tableData[0])
+ this.$emit("selProductClick", "product", this.tableList.tableData[selIndex])
}
if (this.isinventory) {
@@ -697,7 +679,6 @@
locationId: 0,
productId: item.value
}).then((res) => {
- console.log(res)
if (res.code === 200) {
const list = res.data ? res.data : []
this.selLocationOptions = list.locationList
@@ -705,7 +686,6 @@
}
})
}
- console.log(this.tableList.tableData)
// this.$emit("selProductClick", item)
},
// 閫夋嫨浜у搧绫诲瀷
@@ -737,9 +717,7 @@
},
// 閫夋嫨浣嶇疆
selLocationClick(item, prop, row) {
- console.log(item, prop, row, "璧峰浣嶇疆")
if (prop === "areaName") {
- // this.initialPosition=item.label
getLocationList({
jointName: item.label,
page: 1,
@@ -748,16 +726,13 @@
if (res.code === 200) {
const list = res.data ? res.data : []
this.selSonLocationOptions = list
- if (this.isReorder) {
- this.locacionName = list[0]?.name
- this.locacionId = list[0]?.id
- this.$emit("selLocationClick", list[0], "locacionName")
- }
}
})
}
if (this.isReorder) {
- if (this.productId !== 0) {
+ this.locacionId = item.value
+ this.productId = row.productId
+ if (this.productId.length !== 0) {
this.getAmountAndPrediction(row, "location", item)
}
}
@@ -780,26 +755,33 @@
},
// 鑾峰彇鍦ㄥ簱涓庨娴嬫暟閲�
getAmountAndPrediction(item, val, ite) {
- console.log(item, val, ite)
- if (this.productName.length > 0) {
- getAmountAndPrediction({
- locationId: val === "product" ? this.locacionId : ite.value,
- productId: val === "product" ? item.value : this.productId
- }).then((res) => {
- if (res.code === 200) {
- this.tableList.tableData.map((ite, index) => {
- if (index == 0) {
+ let selIndex = 0
+ getAmountAndPrediction({
+ locationId: val === "product" ? this.locacionId : ite.value,
+ productId: val === "product" ? item.id : this.productId
+ }).then((res) => {
+ if (res.code === 200) {
+ this.tableList.tableData.map((ite, index) => {
+ if (val === "product") {
+ if (index === 0) {
+ selIndex = index
ite.amount = res.data.amount
ite.prediction = res.data.prediction
ite.productId = item.id
ite.productName = item.name
ite.unit = item.unit
}
- })
- this.$emit("selProductClick", this.tableList.tableData[0])
- }
- })
- }
+ } else {
+ if (ite.id === item.id) {
+ selIndex = index
+ ite.amount = res.data.amount
+ ite.prediction = res.data.prediction
+ }
+ }
+ })
+ this.$emit("selProductClick", this.tableList.tableData[selIndex])
+ }
+ })
},
// 閫夋嫨璺嚎
selRouteClick(item, prop) {
@@ -849,7 +831,6 @@
this.$emit("addProductClick")
},
commonInputChange(val, prop, row) {
- console.log(val, prop)
this.$emit("inputContent", val, prop, row)
},
// 娓呯┖
@@ -891,6 +872,7 @@
},
// 琛岀偣鍑�
tableRowClick(row) {
+ this.locacionName = row.location.name
this.$emit("tableRowClick", row, row.index)
},
// 鍗曢�夎鐩稿叧
diff --git a/src/views/productManage/reorderRules/index.vue b/src/views/productManage/reorderRules/index.vue
index fad6b56..91de486 100644
--- a/src/views/productManage/reorderRules/index.vue
+++ b/src/views/productManage/reorderRules/index.vue
@@ -92,7 +92,6 @@
this.pagerOptions.currPage = 1
this.searchTaskMap =
query.productId?.length > 0 ? [{ productId: this.queryProductId, title: query.productName }] : []
- console.log(this.searchTaskMap)
}
this.getData()
},
@@ -123,7 +122,6 @@
pageSize: this.pagerOptions.pageSize
}).then((res) => {
if (res.code === 200) {
- console.log(res)
const list = res.data.map((item) => {
let orderNum = 0
if (parseFloat(item.minInventory) - parseFloat(item.prediction) > 0) {
@@ -182,7 +180,6 @@
},
// 鏂板
addProductClick() {
- console.log(this.addTitle)
this.isSel()
if (this.isNoProduct && this.addTitle === "鏂板缓") {
this.$refs.tablelistRef.getProductList()
@@ -292,7 +289,7 @@
this.tableData.map((item, index) => {
if (index === rowIndex) {
item.isEdit = false
- item.editable = false
+ item.editable = true
item.isOrder = true
} else {
item.isEdit = true
diff --git a/src/views/warehouseManage/listingRules/index.vue b/src/views/warehouseManage/listingRules/index.vue
index 3e5914f..dfbd8d3 100644
--- a/src/views/warehouseManage/listingRules/index.vue
+++ b/src/views/warehouseManage/listingRules/index.vue
@@ -90,7 +90,6 @@
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
--
Gitblit v1.8.0