vuex存储菜单信息,修改采购管理和供应商管理接口参数
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {getMenuTreeByRole} from "@/api/menus/index" |
| | | export default { |
| | | name: "AppSidebar", |
| | | props: {}, |
| | | data() { |
| | | return { |
| | | menus:[] |
| | | } |
| | | }, |
| | | watch: {}, |
| | |
| | | }, |
| | | 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() { |
| | |
| | | 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) |
| | |
| | | }; |
| | | const foundObject = res.data.list.find(obj => obj.systemType === 4); |
| | | if (foundObject) { |
| | | // 存储进vuex |
| | | store.commit('setMenus', foundObject); |
| | | foundObject.menus.forEach(item => { |
| | | const nextPath = item.children.find(obj => obj.path === routePath); |
| | | if (nextPath) { |
| | |
| | | |
| | | export default new Vuex.Store({ |
| | | state: { |
| | | menus:[], |
| | | }, |
| | | getters: { |
| | | }, |
| | | mutations: { |
| | | setMenus(state,payload){ |
| | | state.menus = payload |
| | | } |
| | | }, |
| | | actions: { |
| | | }, |
| | |
| | | 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 |
| | |
| | | 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() |
| | |
| | | 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() |
| | |
| | | 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() |
| | |
| | | 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 = { |
| | |
| | | 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 |
| | |
| | | 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 || "" |