From 7f5306d896fa0c541a83c4b62d0c533a604dd184 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期日, 28 四月 2024 18:23:23 +0800
Subject: [PATCH] 供应商管理模块 添加新产品的时候供应商对应的产品和已增加的产品都不可选的逻辑处理
---
src/views/supplierManage/supplier/index.vue | 89 ++++++++++++++++++++++++++++++--------------
1 files changed, 60 insertions(+), 29 deletions(-)
diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue
index d3bccbd..88e9dbe 100644
--- a/src/views/supplierManage/supplier/index.vue
+++ b/src/views/supplierManage/supplier/index.vue
@@ -22,8 +22,9 @@
ref="tableSupplier"
:table-list="tableList"
@selCommonClick="selCommonClick"
- @tableRowClick="tableRowClick"
@selTableCol="selTableCol"
+ @tableRowClick="tableRowClick"
+ :selectClassRow="selectRow"
>
<template slot="tableButton">
<el-table-column label="鎿嶄綔" width="100">
@@ -57,12 +58,12 @@
:amount-view="false"
:show-screen="false"
:show-action-btn="false"
- :placeholder="'璇疯緭鍏ヤ骇鍝佸悕绉�'"
+ :placeholder="'璇疯緭鍏ヤ骇鍝佸悕绉�/浜у搧瑙勬牸/浜у搧缂栫爜'"
@searchClick="onProductFilterSearch"
>
<template slot="leftButton">
<div class="sub-title"><span class="sub-title-decorator"></span>鍙彁渚涚殑浜у搧</div>
- <el-button type="primary" size="mini">鍒涘缓閲囪喘鍗�</el-button>
+ <el-button type="primary" size="mini" @click="creatPurchase">鍒涘缓閲囪喘鍗�</el-button>
</template>
<template slot="rightButton">
<el-button type="primary" size="mini" @click="addNewProductClick">娣诲姞鏂颁骇鍝�</el-button>
@@ -109,23 +110,27 @@
<!-- 鐩稿叧渚涘簲鍟� -->
<RaleteSupplierList v-if="raleteSupplierConfig.visible" :common-config="raleteSupplierConfig" />
<!-- 娣诲姞鏂颁骇鍝� -->
- <AddNewProduct v-if="newProductConfig.visible" :add-common-config="newProductConfig" />
+ <AddNewProduct v-if="newProductConfig.visible" :disabledList="productTableList.tableInfomation" :add-common-config="newProductConfig" />
+ <!-- 鏂板缓/缂栬緫 -->
+ <AddPurchase v-if="editPurchaseConfig.visible" :edit-common-config="editPurchaseConfig" />
</div>
</template>
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import { getSupplierList, changeSupplierStatus } from "@/api/supplierManage/supplier"
+import { getPurchaseList } from "@/api/purchaseManage/purchase"
import DetailSupplier from "@/views/supplierManage/supplier/DetailSupplier"
import AddSupplier from "@/views/supplierManage/supplier/AddSupplier"
import RaleteSupplierList from "@/views/supplierManage/supplier/RaleteSupplierList"
import AddNewProduct from "@/views/supplierManage/supplier/AddNewProduct"
-import { getProductList, deleteProduct } from "@/api/productManage/product"
+import { getProductListTwo, deleteProduct } from "@/api/productManage/product"
+import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
export default {
name: "SupplierManage",
props: {},
- components: { DetailSupplier, AddSupplier, RaleteSupplierList, AddNewProduct },
+ components: { DetailSupplier, AddSupplier, RaleteSupplierList, AddNewProduct, AddPurchase },
mixins: [pageMixin],
computed: {},
data() {
@@ -138,7 +143,8 @@
searchProductOptions: [], // 浜у搧鏌ヨ
commonDetail: {
visible: false,
- infomation: {}
+ infomation: {},
+ productListInfo: []
},
editConfig: {
visible: false,
@@ -180,7 +186,16 @@
{ label: "閲囪喘浠锋牸", prop: "purchasePrice", min: 130 },
{ label: "渚涜揣鏃堕暱(澶�)", prop: "deliveryTime", min: 130 },
{ label: "鐗╂祦鏃堕暱(澶�)", prop: "shippingDuration", min: 130 }
- ]
+ ],
+ editPurchaseConfig: {
+ // 鍒涘缓閲囪喘
+ visible: false,
+ title: "鍒涘缓",
+ infomation: {
+ supplierName: ""
+ }
+ },
+ selectRow: {}
}
},
created() {
@@ -264,24 +279,27 @@
page: this.pagerOptions.currPage,
pageSize: this.pagerOptions.pageSize
}).then((res) => {
- console.log(res.data)
- if (res.data.code === 200) {
- const list = res.data.data.list.map((item) => {
+ console.log(res)
+ if (res.code === 200) {
+ const list = res.data.list.map((item) => {
return {
...item,
+ id: item.id,
status_name: item.status === 0 ? "鏈惎鐢�" : "鍚敤"
}
})
+ console.log(list)
this.tableList.tableInfomation = list || []
- this.pagerOptions.totalCount = res.data.data.total
+ this.pagerOptions.totalCount = res.data.total
if (list && list.length > 0) {
- this.supplierId = this.tableList.tableInfomation[0].ID
+ this.supplierId = this.tableList.tableInfomation[0].id
+ this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {}
} else {
this.supplierId = 0
}
- this.$nextTick(() => {
- this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0])
- })
+ // this.$nextTick(() => {
+ // this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0])
+ // })
// 閲嶆柊鑾峰彇渚涘簲鍟嗗垪琛ㄥ悗搴旇閲嶇疆浜у搧鍒楄〃椤电爜
this.productPagerOptions.currPage = 1
@@ -299,20 +317,19 @@
// 浜у搧鍒楄〃
async getProductList(val, content) {
console.log(val, content)
- await getProductList({
+ await getProductListTwo({
[val]: content,
supplierId: this.supplierId,
page: this.productPagerOptions.currPage,
pageSize: this.productPagerOptions.pageSize
}).then((res) => {
- console.log(res.data)
- const list = res.data.data.list.map((item) => {
+ let list = res.data.list.map((item) => {
return {
...item
}
})
this.productTableList.tableInfomation = list || []
- this.productPagerOptions.totalCount = res.data.data.total
+ this.productPagerOptions.totalCount = res.data.total
})
},
// 鎼滅储渚涘簲鍟�
@@ -324,19 +341,22 @@
// 鎼滅储浜у搧
onProductFilterSearch(searchText) {
this.productPagerOptions.currPage = 1
- this.getProductList("name", searchText)
+ this.getProductList("keyword", searchText)
},
// 鏂板缓渚涘簲鍟�
addBtnClick() {
this.editConfig.visible = true
this.editConfig.title = "鏂板缓"
- this.editConfig.infomation = { fileId: 0 }
+ this.editConfig.infomation = {
+ fileId: 0,
+ responsiblePersonName: document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1")
+ }
},
// 鍚敤渚涘簲鍟�
async enableClick(row, value) {
let status = value === "鍚敤" ? 1 : 0
await changeSupplierStatus({
- id: row.ID,
+ id: Number(row.id),
status: status
}).then((res) => {
if (res.code === 200) {
@@ -365,7 +385,6 @@
},
// 淇敼浜у搧
editClick(row) {
- console.log(row)
this.newProductConfig.visible = true
this.newProductConfig.title = "淇敼"
this.newProductConfig.infomation = { ...row }
@@ -378,7 +397,7 @@
type: "warning"
})
.then(() => {
- deleteProduct({ id: row.ID }).then((response) => {
+ deleteProduct({ id: row.id }).then((response) => {
if (response.code === 200) {
this.$message.success("鍒犻櫎鎴愬姛")
this.getProductList()
@@ -398,14 +417,16 @@
this.selValueList = list
},
tableRowClick(row) {
- console.log(row)
this.productPagerOptions.currPage = 1
- this.supplierId = row.ID
+ this.selectRow = row
+ this.supplierId = row.id
this.getProductList()
},
// 璇︽儏
- selCommonClick(row) {
- console.log(row)
+ async selCommonClick(row) {
+ await getPurchaseList({ pageSize: 10, page: 1, supplierId: Number(row.id) }).then((res) => {
+ this.commonDetail.productListInfo = res.data.list
+ })
this.commonDetail.visible = true
this.commonDetail.infomation = { ...row }
},
@@ -418,6 +439,16 @@
currentProductHandler(val) {
this.productPagerOptions.currPage = val
this.getProductList()
+ },
+ // 鍒涘缓閲囪喘鍗�
+ creatPurchase() {
+ this.editPurchaseConfig.visible = true
+ this.editPurchaseConfig.title = "鏂板缓"
+ this.editPurchaseConfig.infomation = {
+ supplierId: this.selectRow.id,
+ purchaseTypeId: "2",
+ supplierName: this.selectRow.name
+ }
}
}
}
--
Gitblit v1.8.0