From 810939b3e92452906bb76eb11e946929212091a4 Mon Sep 17 00:00:00 2001 From: feijinping Date: Wed, 30 Nov 2022 00:00:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DictTag/index.vue | 51 +++-------- src/store/getters.js | 3 +- src/store/modules/dict.js | 15 +++- src/views/components/ProdCategory.vue | 61 +++++++++++++ src/views/pms/productCategory/index.vue | 108 ++++++++++++------------ 5 files changed, 140 insertions(+), 98 deletions(-) create mode 100644 src/views/components/ProdCategory.vue diff --git a/src/components/DictTag/index.vue b/src/components/DictTag/index.vue index 4c196c4..50671ef 100644 --- a/src/components/DictTag/index.vue +++ b/src/components/DictTag/index.vue @@ -1,52 +1,23 @@ - \ No newline at end of file diff --git a/src/store/getters.js b/src/store/getters.js index a823148..b69eec1 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -15,6 +15,7 @@ const getters = { defaultRoutes:state => state.permission.defaultRoutes, sidebarRouters:state => state.permission.sidebarRouters, - dictMap: state => state.dict.dictMap + dictMap: state => state.dict.dictMap, + productCategories: state => state.dict.productCategories, } export default getters diff --git a/src/store/modules/dict.js b/src/store/modules/dict.js index d3d5c8d..7d3f1e9 100644 --- a/src/store/modules/dict.js +++ b/src/store/modules/dict.js @@ -1,15 +1,20 @@ import {allByTypes} from "@/api/system/dict/data"; import {dict_types} from "@/config/business"; +import {listPmsProductCategory} from "@/api/pms/productCategory"; const dict = { state: { - dictMap: {} + dictMap: {}, + productCategories: [] }, mutations: { SET_DICT_MAP: (state, map) => { state.dictMap = map }, + SET_PRODUCT_CATEGORIES: (state, value) => { + state.productCategories = value + }, }, actions: { loadDictionaries({ commit, state }, force = false) { @@ -31,6 +36,14 @@ const dict = { commit('SET_DICT_MAP', map) }) }, + loadProductCategories({ commit, state }, force = false) { + if (!force && state.productCategories.length > 0) { + return Promise.resolve(); + } + return listPmsProductCategory({}).then(res => { + commit('SET_PRODUCT_CATEGORIES', res); + }) + } } } diff --git a/src/views/components/ProdCategory.vue b/src/views/components/ProdCategory.vue new file mode 100644 index 0000000..cd29627 --- /dev/null +++ b/src/views/components/ProdCategory.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/src/views/pms/productCategory/index.vue b/src/views/pms/productCategory/index.vue index eac9f10..2ca9eae 100644 --- a/src/views/pms/productCategory/index.vue +++ b/src/views/pms/productCategory/index.vue @@ -22,19 +22,10 @@ - + - - - 新增 - - - - - - - - - + + + + + + + +