From b92def04872a38977c9ec9a89a1006bac72322d9 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 13 十一月 2023 19:08:23 +0800
Subject: [PATCH] 位置id查位置报表
---
src/views/warehouseManage/listingRules/index.vue | 128 +++++++++++++++++++++++++++++++++++-------
1 files changed, 105 insertions(+), 23 deletions(-)
diff --git a/src/views/warehouseManage/listingRules/index.vue b/src/views/warehouseManage/listingRules/index.vue
index b84d797..de53dd3 100644
--- a/src/views/warehouseManage/listingRules/index.vue
+++ b/src/views/warehouseManage/listingRules/index.vue
@@ -4,12 +4,14 @@
<SearchCommonView
:add-title="addTitle"
:show-discard="showDiscard"
- :placeholder="'璇疯緭鍏ヤ綅缃�/浜у搧'"
+ :placeholder="'璇疯緭鍏ヤ骇鍝�/浜у搧绫诲埆'"
:amount-view="false"
+ :search-task-map="searchTaskMap"
@addCommonClick="addProductClick"
@searchClick="getList"
@discardBtnClick="discardBtnClick"
@applyBtnClick="applyBtnClick"
+ @delSelectClick="delSelectClick"
/>
</div>
<div class="list-view">
@@ -21,13 +23,14 @@
@tableRowClick="tableRowClick"
@selLocationClick="selLocationClick"
@selProductClick="selProductClick"
+ @selProductTypeClick="selProductTypeClick"
>
<template slot="tableButton">
- <el-table-column label="鎿嶄綔" width="90" fixed="right" align="center">
+ <el-table-column label="鎿嶄綔" width="90" align="center">
<template slot-scope="scope">
- <el-button v-if="scope.row.isEdit" @click.stop="delClick(scope)" type="text" size="small"
- >鍒犻櫎</el-button
- >
+ <span v-if="scope.row.isEdit" @click.stop="delClick(scope)" class="yes-cursor">
+ <span style="color: #2a78fb">鍒犻櫎</span>
+ </span>
</template>
</el-table-column>
</template>
@@ -88,23 +91,44 @@
isRowClick: false,
areaId: 0,
productId: 0,
+ productCategoryId: 0,
subLocationId: 0,
- currentRowId: 0
+ currentRowId: 0,
+ rowIndex: -1,
+ RuleType: 0,
+ queryProductId: null,
+ categoryId: null,
+ searchTaskMap: []
}
},
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
+ this.searchTaskMap =
+ query?.id > 0
+ ? [{ categoryId: this.categoryId, title: query.categoryName }]
+ : query.productId?.length > 0
+ ? [{ productId: this.queryProductId, title: query.productName }]
+ : []
+ console.log(this.searchTaskMap)
+ }
this.getData()
},
methods: {
setTable() {
this.tableList = {
tableData: [],
- selectBox: true,
+ selectBox: false,
+ selectIndex: true,
tableColumn: [
{ label: "褰撲骇鍝佸埌杈�", prop: "areaName", location: true },
{ label: "浜у搧", prop: "productName", product: true },
- { label: "浜у搧绫诲埆", prop: "productCategory" },
+ { label: "浜у搧绫诲埆", prop: "productCategory", productType: true },
{ label: "瀛樺偍鍒板瓙浣嶇疆", prop: "subLocation", location: true }
// { label: "鍏徃", prop: "companyName", company: true }
]
@@ -113,7 +137,8 @@
// 璇锋眰鏁版嵁
async getData() {
await getListingRulesList({
- // keyword: this.keyword,
+ productId: this.queryProductId ? this.queryProductId : null,
+ productCategoryId: this.categoryId ? this.categoryId : null,
page: this.pagerOptions.currPage,
pageSize: this.pagerOptions.pageSize
}).then((res) => {
@@ -121,8 +146,8 @@
const list = res.data.map((item) => {
return {
...item,
- areaName: item.area.jointName,
- subLocation: item.location.jointName,
+ areaName: { label: item.area.jointName, value: item.area.id },
+ subLocation: { label: item.location.jointName, value: item.location.id },
productName: item.product.name,
productCategory: item.productCategory.name,
isSet: false,
@@ -146,6 +171,8 @@
},
// 鏂板
addProductClick() {
+ this.tableList.tableColumn[1].product = true
+ this.tableList.tableColumn[2].productType = true
console.log(this.tableData)
this.isSel()
if (this.isNoProduct && this.addTitle === "鏂板缓") {
@@ -154,7 +181,7 @@
this.isRowClick = false
this.currentRowId = 0
this.countId++
- this.tableData.push({
+ this.tableData.unshift({
countId: this.countId,
areaId: 0,
areaName: "",
@@ -164,7 +191,8 @@
productName: "",
companyName: "",
isSet: true,
- isEdit: false
+ isEdit: false,
+ isOrder: true
})
this.areaId = 0
this.subLocationId = 0
@@ -173,8 +201,8 @@
} else {
if (this.areaId === 0) {
this.$message.error("璇烽�夋嫨褰撳墠浜у搧鍒拌揪浣嶇疆")
- } else if (this.productId === 0) {
- this.$message.error("璇烽�夋嫨浜у搧")
+ } else if (this.productId === 0 && this.productCategoryId === "") {
+ this.$message.error("璇烽�夋嫨浜у搧鎴栦骇鍝佺被鍒�")
} else if (this.subLocationId === 0) {
this.$message.error("璇烽�夋嫨瀛樺偍鍒板瓙浣嶇疆")
} else {
@@ -192,17 +220,18 @@
})
let requestUrl = this.currentRowId === 0 ? addListingRules : updateListingRules
requestUrl({
+ RuleType: this.RuleType,
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.getData()
}
})
}
@@ -212,7 +241,7 @@
isSel() {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].productName.length === 0) {
- this.isNoProduct = false
+ this.isNoProduct = true // 鏆傛椂淇敼涓簍rue锛屽鏋滀骇鍝佷互鍚庢槸蹇呭~锛屾敼涓篺alse灏辫
break
} else {
this.isNoProduct = true
@@ -221,12 +250,14 @@
},
// 鍙栨秷
discardBtnClick() {
+ 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(this.tableData.length - 1, 1)
+ this.tableData.splice(0, 1)
}
this.addTitle = "鏂板缓"
this.showDiscard = false
@@ -264,11 +295,12 @@
},
// 琛岀偣鍑�
tableRowClick(row, rowIndex) {
- console.log("11111")
+ 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.addTitle = "淇濆瓨"
this.showDiscard = true
@@ -279,6 +311,7 @@
this.tableData.map((item, index) => {
if (index === rowIndex) {
item.isEdit = false
+ item.isOrder = true
} else {
item.isEdit = true
}
@@ -287,6 +320,16 @@
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
+ this.tableList.tableColumn[2].productType = true
+ } else {
+ this.tableList.tableColumn[1].product = true
+ this.tableList.tableColumn[2].productType = false
+ }
}
},
// 鎼滅储
@@ -323,9 +366,23 @@
},
// 閫変腑浜у搧鏂规硶
selProductClick(item) {
- console.log(item)
+ console.log(item, "浜у搧")
+ this.RuleType = 1
+ this.tableList.tableColumn[2].productType = false
this.productId = item.value
this.productCategoryId = item.categoryId
+ },
+ // 閫変腑浜у搧绫诲瀷鏂规硶
+ selProductTypeClick(item) {
+ this.RuleType = 2
+ if (this.currentRowId === 0) {
+ this.productCategoryId = item.value
+ } else {
+ this.tableList.tableColumn[1].product = false
+ this.tableList.tableData[this.rowIndex].productName = " "
+ this.productId = ""
+ this.productCategoryId = this.tableList.tableData[this.rowIndex].productCategoryId
+ }
},
// 鍒犻櫎
async delClick(scope) {
@@ -336,10 +393,35 @@
this.getData()
}
})
+ },
+ // 鍒犻櫎浜у搧绫诲瀷
+ delSelectClick() {
+ this.categoryId = 0
+ this.queryProductId = ""
+ this.getData()
+ }
+ },
+ watch: {
+ rowIndex(newVal) {
+ 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
+ }
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+::v-deep {
+ .el-table {
+ border-top-left-radius: 12px;
+ border-top-right-radius: 12px;
+ overflow: auto;
+ }
+}
+</style>
--
Gitblit v1.8.0