From 3b6eee772d06d27c5de4281824940c568b85a1f3 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期二, 19 十二月 2023 13:58:01 +0800
Subject: [PATCH] vuex存储菜单信息,修改采购管理和供应商管理接口参数
---
src/views/supplierManage/supplier/AddNewProduct.vue | 6 +++---
src/views/supplierManage/supplier/AddSupplier.vue | 4 ++--
src/store/index.js | 4 ++++
src/views/purchaseManage/purchase/index.vue | 8 ++++----
src/components/layout/components/appsidebar/index.vue | 10 +---------
src/router/index.js | 3 +++
6 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/src/components/layout/components/appsidebar/index.vue b/src/components/layout/components/appsidebar/index.vue
index 2ba00f9..4eacae5 100644
--- a/src/components/layout/components/appsidebar/index.vue
+++ b/src/components/layout/components/appsidebar/index.vue
@@ -30,13 +30,11 @@
</template>
<script>
-import {getMenuTreeByRole} from "@/api/menus/index"
export default {
name: "AppSidebar",
props: {},
data() {
return {
- menus:[]
}
},
watch: {},
@@ -46,13 +44,7 @@
},
methods: {
getMenuTreeByRole(){
- getMenuTreeByRole().then((res)=>{
- res.data.list.map((item)=>{
- if(item.systemType===4){
- this.menus=item.menus
- }
- })
- })
+ this.menus=this.$store.state.menus.menus
},
// 鐩戝惉璺敱
initNavMenu() {
diff --git a/src/router/index.js b/src/router/index.js
index 5b0aac6..0eedd14 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -6,6 +6,7 @@
import purchaseRouter from "./purchase/index.js"
import productRouter from "./product/index.js"
import {getMenuTreeByRole} from "@/api/menus/index"
+import store from '@/store/index.js'; // 鏇挎崲涓哄疄闄呯殑瀛樺偍瀹炰緥璺緞
Vue.use(Router)
const login = (resolve) => require(["@/views/other/login/index"], resolve)
@@ -118,6 +119,8 @@
};
const foundObject = res.data.list.find(obj => obj.systemType === 4);
if (foundObject) {
+ // 瀛樺偍杩泇uex
+ store.commit('setMenus', foundObject);
foundObject.menus.forEach(item => {
const nextPath = item.children.find(obj => obj.path === routePath);
if (nextPath) {
diff --git a/src/store/index.js b/src/store/index.js
index 3f464bf..2ed9e57 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -6,10 +6,14 @@
export default new Vuex.Store({
state: {
+ menus:[],
},
getters: {
},
mutations: {
+ setMenus(state,payload){
+ state.menus = payload
+ }
},
actions: {
},
diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue
index 2c70931..b53992b 100644
--- a/src/views/purchaseManage/purchase/index.vue
+++ b/src/views/purchaseManage/purchase/index.vue
@@ -265,7 +265,7 @@
this.editConfig.detailEnter = false
this.editConfig.isDisabled = false
this.tableLoading = true
- getPurchaseInfo({ id: row.id }).then((res) => {
+ getPurchaseInfo({ id: Number(row.id) }).then((res) => {
if (res.code == 200) {
this.tableLoading = false
this.editConfig.visible = true
@@ -303,7 +303,7 @@
if (!row.supplierName) {
this.btnEdit(row)
} else {
- submitPurchase({ id: row.ID, status: 2 }).then((response) => {
+ submitPurchase({ id: Number(row.id), status: 2 }).then((response) => {
if (response.code === 200) {
this.$message.success("鎻愪氦鎴愬姛")
this.getData()
@@ -326,7 +326,7 @@
type: "warning"
}).then(
() => {
- submitPurchase({ id: row.ID, status: 5 }).then((response) => {
+ submitPurchase({ id: Number(row.id), status: 5 }).then((response) => {
if (response.code === 200) {
this.$message.success("宸插彇娑�")
this.getData()
@@ -348,7 +348,7 @@
type: "warning"
})
.then(() => {
- deletePurchase({ id: row.ID }).then((response) => {
+ deletePurchase({ id: Number(row.id) }).then((response) => {
if (response.code === 200) {
this.$message.success("鍒犻櫎鎴愬姛")
this.getData()
diff --git a/src/views/supplierManage/supplier/AddNewProduct.vue b/src/views/supplierManage/supplier/AddNewProduct.vue
index 4ebb1bc..c06cabd 100644
--- a/src/views/supplierManage/supplier/AddNewProduct.vue
+++ b/src/views/supplierManage/supplier/AddNewProduct.vue
@@ -156,11 +156,11 @@
number: "",
price: 0,
total: 0,
- supplierId: this.supplierId
+ supplierId:this.supplierId
}
]
} else {
- this.tableData = [{ ...this.editConfig.infomation }]
+ this.tableData = [{ ...this.editConfig.infomation}]
this.detailEnter = true
}
this.productTableList = {
@@ -185,7 +185,7 @@
this.tableData.map((item) => {
if (item.productId === row.productId) {
item[prop] = val
- item.supplierId = this.supplierId
+ item.supplierId =Number(this.supplierId)
item.deliveryTime = this.deliveryTime
item.shippingDuration = this.shippingDuration
item.purchasePrice = this.purchasePrice
diff --git a/src/views/supplierManage/supplier/AddSupplier.vue b/src/views/supplierManage/supplier/AddSupplier.vue
index 37b31a4..b964ffa 100644
--- a/src/views/supplierManage/supplier/AddSupplier.vue
+++ b/src/views/supplierManage/supplier/AddSupplier.vue
@@ -392,13 +392,13 @@
detailAddress: data.detailAddress || "",
email: data.email || "",
fileId: this.file_id || 0,
- id: data.id || 0,
+ // id: data.id || 0,
industry: data.industry || "",
name: data.name || "",
number: data.number || "",
phone: data.phone || "",
responsiblePersonName:
- data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"),
+ data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"),
status: data.status || 0,
supplierType: data.supplierType || "",
url: data.url || ""
--
Gitblit v1.8.0