From ace978346df812db7cb7360aadbfb39e1b83cffc Mon Sep 17 00:00:00 2001 From: feijinping Date: Mon, 5 Dec 2022 23:37:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=81=E7=89=8C=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E5=95=86=E5=93=81=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/pms/brand.js | 8 ++ src/router/index.js | 14 +++ src/store/getters.js | 1 + src/store/modules/dict.js | 17 ++- src/views/components/BrandSelect.vue | 34 ++++++ src/views/pms/product/AddProduct.vue | 104 +++++++++++++++++++ src/views/pms/product/index.vue | 150 +-------------------------- 7 files changed, 180 insertions(+), 148 deletions(-) create mode 100644 src/views/components/BrandSelect.vue create mode 100644 src/views/pms/product/AddProduct.vue diff --git a/src/api/pms/brand.js b/src/api/pms/brand.js index 4a0e4d6..11c3253 100644 --- a/src/api/pms/brand.js +++ b/src/api/pms/brand.js @@ -9,6 +9,14 @@ export function listPmsBrand(query, pageReq) { params: pageReq }) } +export function allBrand(query, pageReq) { + return request({ + url: '/pms/brand/all', + method: 'post', + data: query, + params: pageReq + }) +} // 查询品牌管理详细 export function getPmsBrand(id) { diff --git a/src/router/index.js b/src/router/index.js index 0ef9d70..28ccdaa 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -161,6 +161,20 @@ export const dynamicRoutes = [ meta: { title: '修改生成配置', activeMenu: '/tool/gen' } } ] + }, + { + path: '/product', + component: Layout, + hidden: true, + permissions: ['pms:product:add'], + children: [ + { + path: 'edit', + component: () => import('@/views/pms/product/AddProduct'), + name: 'AddProduct', + meta: { title: '编辑商品' } + } + ] } ] diff --git a/src/store/getters.js b/src/store/getters.js index b69eec1..2e891cd 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -17,5 +17,6 @@ const getters = { dictMap: state => state.dict.dictMap, productCategories: state => state.dict.productCategories, + brandList: state => state.dict.brandList, } export default getters diff --git a/src/store/modules/dict.js b/src/store/modules/dict.js index 7d3f1e9..ebf2453 100644 --- a/src/store/modules/dict.js +++ b/src/store/modules/dict.js @@ -1,11 +1,13 @@ import {allByTypes} from "@/api/system/dict/data"; import {dict_types} from "@/config/business"; import {listPmsProductCategory} from "@/api/pms/productCategory"; +import {allBrand} from "@/api/pms/brand"; const dict = { state: { dictMap: {}, - productCategories: [] + productCategories: [], + brandList: [] }, mutations: { @@ -15,6 +17,9 @@ const dict = { SET_PRODUCT_CATEGORIES: (state, value) => { state.productCategories = value }, + SET_BRAND_LIST: (state, value) => { + state.brandList = value + }, }, actions: { loadDictionaries({ commit, state }, force = false) { @@ -43,7 +48,15 @@ const dict = { return listPmsProductCategory({}).then(res => { commit('SET_PRODUCT_CATEGORIES', res); }) - } + }, + loadBrandList({ commit, state }, force = false) { + if (!force && state.brandList.length > 0) { + return Promise.resolve(); + } + return allBrand({}).then(res => { + commit('SET_BRAND_LIST', res); + }) + }, } } diff --git a/src/views/components/BrandSelect.vue b/src/views/components/BrandSelect.vue new file mode 100644 index 0000000..17c584f --- /dev/null +++ b/src/views/components/BrandSelect.vue @@ -0,0 +1,34 @@ + + + + + diff --git a/src/views/pms/product/AddProduct.vue b/src/views/pms/product/AddProduct.vue new file mode 100644 index 0000000..76abb42 --- /dev/null +++ b/src/views/pms/product/AddProduct.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/src/views/pms/product/index.vue b/src/views/pms/product/index.vue index c1cf97f..0686c10 100644 --- a/src/views/pms/product/index.vue +++ b/src/views/pms/product/index.vue @@ -89,7 +89,7 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - 请选择字典生成 - - - - - - - - - - - - - - - - - - - - - - - - - - - - -