From 386878d3b2c54585c3d572ff34b3d5831d5175a1 Mon Sep 17 00:00:00 2001 From: zuozhengqing <a13193816592@163.com> Date: 星期三, 22 十一月 2023 14:50:44 +0800 Subject: [PATCH] 供应商管理-请求头添加token --- src/views/supplierManage/supplier/index.vue | 6 +-- src/api/purchaseManage/purchase.js | 29 +++++++++----- src/store/modules/getSupplierName.js | 2 src/views/supplierManage/supplier/AddSupplier.vue | 2 src/views/purchaseManage/purchase/index.vue | 14 ++++-- src/api/productManage/product.js | 13 +++++- 6 files changed, 41 insertions(+), 25 deletions(-) diff --git a/src/api/productManage/product.js b/src/api/productManage/product.js index 7929fa8..2fecaed 100644 --- a/src/api/productManage/product.js +++ b/src/api/productManage/product.js @@ -2,9 +2,16 @@ import axios from "axios" // 浜у搧鍒楄〃 -export const getProductList = async (data) => { - return await axios.get(`/api/p/getProductList`, { - params: data +// export const getProductList = async (data) => { +// return await axios.get(`/api/p/getProductList`, { +// params: data +// }) +// } +export function getProductList(data) { + return request({ + url: "/api/p/getProductList", + method: "get", + data }) } // 鍒涘缓浜у搧 diff --git a/src/api/purchaseManage/purchase.js b/src/api/purchaseManage/purchase.js index e9ab89b..73373b2 100644 --- a/src/api/purchaseManage/purchase.js +++ b/src/api/purchaseManage/purchase.js @@ -50,19 +50,26 @@ }) } // 閲囪喘鍗曞垪琛� -export const getPurchaseList = async (data) => { - return await axios.get(`/api/purchase/purchaseList`, { - params: data - }) - } +// export const getPurchaseList = async (data) => { +// return await axios.get(`/api/purchase/purchaseList`, { +// params: data +// }) +// } +export function getPurchaseList(data) { + return request({ + url: "/api/purchase/purchaseList", + method: "get", + params: data + }) +} // 鍒涘缓閲囪喘鍗� export function addPurchase(data) { - return request({ - url: "/api/purchase/purchase", - method: "post", - data - }) - } + return request({ + url: "/api/purchase/purchase", + method: "post", + data + }) +} // 鏇存柊閲囪喘鍗� export function updatePurchase(data) { return request({ diff --git a/src/store/modules/getSupplierName.js b/src/store/modules/getSupplierName.js index 172e6e5..897d522 100644 --- a/src/store/modules/getSupplierName.js +++ b/src/store/modules/getSupplierName.js @@ -12,7 +12,7 @@ }, actions:{ getSupplier(context){ - getSupplierList({page:1,pageSize:100}).then((res) => { + getSupplierList({page:1,pageSize:100,status:1}).then((res) => { if (res.code == 200) { context.commit("supplierNameList", res.data.list) } else { diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue index 9bf233e..f5ef1f0 100644 --- a/src/views/purchaseManage/purchase/index.vue +++ b/src/views/purchaseManage/purchase/index.vue @@ -111,7 +111,11 @@ { label: "缁忓姙浜�", prop: "handledBy", min: 130 }, { label: "鍒跺崟浜�", prop: "creator", min: 130 } ], - showCol: ['閲囪喘鍗曞彿', '閲囪喘鍗曞悕绉�', '鍗曟嵁绫诲瀷', '渚涘簲鍟嗗悕绉�', '閲囪喘鏁伴噺', '鏀惰揣浠撳簱','缁忓姙浜�','鍒跺崟浜�'] + showCol: ['閲囪喘鍗曞彿', '閲囪喘鍗曞悕绉�', '鍗曟嵁绫诲瀷', '渚涘簲鍟嗗悕绉�', '閲囪喘鏁伴噺', '鏀惰揣浠撳簱','缁忓姙浜�','鍒跺崟浜�'], + pagerOptions:{ + pageSize:15, + currPage:1, + } } }, created() { @@ -163,18 +167,18 @@ // 璇锋眰鏁版嵁 async getData() { await getPurchaseList({ - keyword: this.search, + keyword: this.search||'', page: this.pagerOptions.currPage, pageSize: this.pagerOptions.pageSize }) .then((res) => { - if (res.data.code === 200) { - let list = res.data.data.list + if (res.code === 200) { + let list = res.data.list list.map((item)=>{ item.supplierName=item.supplier.name }) this.tableList.tableInfomation = list || [] - this.pagerOptions.totalCount = res.data.data.total + this.pagerOptions.totalCount = res.data.total } }) .catch((err) => { diff --git a/src/views/supplierManage/supplier/AddSupplier.vue b/src/views/supplierManage/supplier/AddSupplier.vue index 9e9b3a4..f6083ba 100644 --- a/src/views/supplierManage/supplier/AddSupplier.vue +++ b/src/views/supplierManage/supplier/AddSupplier.vue @@ -363,7 +363,7 @@ name: data.name || "", number: data.number || "", phone: data.phone || "", - responsiblePersonName: data.responsiblePersonName || "admin", + responsiblePersonName: data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"), status: data.status || 0, supplierType: data.supplierType || "", url: data.url || "" diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue index 9deb6a0..8eb6b99 100644 --- a/src/views/supplierManage/supplier/index.vue +++ b/src/views/supplierManage/supplier/index.vue @@ -278,7 +278,6 @@ name: this.searchSupplierName, page: this.pagerOptions.currPage, pageSize: this.pagerOptions.pageSize, - status:1, }).then((res) => { console.log(res) if (res.code === 200) { @@ -324,14 +323,13 @@ 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 }) }, // 鎼滅储渚涘簲鍟� -- Gitblit v1.8.0