pull/1/head
dt_2916866708 1 year ago
parent 6a42423cfb
commit 0f3a7b72d6
  1. 7
      src/api/product/productAttr.js
  2. 3
      src/components/Category/edit.vue
  3. 5
      src/permission.js
  4. 2
      src/router/index.js
  5. 8
      src/store/modules/permission.js
  6. 16
      src/views/product/productClassify/index.vue

@ -8,6 +8,13 @@ export default {
data: page data: page
}) })
}, },
classifyUpdate(page) {
return request({
url: `/${service_name}/mallProductClassification/update`,
method: 'post',
data: page
})
},
classifyGetByPage(page) { // 分页查询 classifyGetByPage(page) { // 分页查询
return request({ return request({
url: `/${service_name}/mallProductClassification/getByPage`, url: `/${service_name}/mallProductClassification/getByPage`,

@ -43,6 +43,7 @@ export default {
}, },
data() { data() {
return { return {
model:"add",
loadingBtn: false, loadingBtn: false,
constants: [], constants: [],
editPram: { editPram: {
@ -83,7 +84,7 @@ export default {
addTreeListLabelForCasCard(arr, child) { addTreeListLabelForCasCard(arr, child) {
}, },
handlerSubmit() { handlerSubmit() {
productApi.classifySave(this.editPram,).then((result) => { productApi[this.model](this.editPram).then((result) => {
if(result.code==20000){ if(result.code==20000){
this.$parent.$parent.editDialogConfig.visible=false; this.$parent.$parent.editDialogConfig.visible=false;
this.$message.success("添加成功!"); this.$message.success("添加成功!");

@ -35,8 +35,9 @@ router.beforeEach(async (to, from, next) => {
} else { } else {
try { try {
await store.dispatch('user/getInfo') await store.dispatch('user/getInfo')
const accessRoutes = await store.dispatch('permission/generateRoutes') const accessRoutes = await store.dispatch('permission/generateRoutes');
router.addRoutes(accessRoutes) console.log(accessRoutes,"routerrouterrouter")
router.addRoutes(accessRoutes);
next({ ...to, replace: true }) next({ ...to, replace: true })
} catch (error) { } catch (error) {
await store.dispatch('user/resetToken') await store.dispatch('user/resetToken')

@ -24,7 +24,7 @@ export const constantRoutes = [{
redirect: 'productList', redirect: 'productList',
meta: { title: '商品', icon: 'iconkongzhitai', affix: true }, meta: { title: '商品', icon: 'iconkongzhitai', affix: true },
children: [ children: [
{ {
path: '/productList', path: '/productList',
component: () => import('@/views/product/productList/index'), component: () => import('@/views/product/productList/index'),
name: 'productList', name: 'productList',

@ -7,7 +7,7 @@ import Layout from '@/layout'
* @param routes asyncRoutes * @param routes asyncRoutes
* @param auths * @param auths
*/ */
export function filterAsyncRouter(asyncRouterMap) { export function filterAsyncRouter(asyncRouterMap) {
return asyncRouterMap.filter(route => { return asyncRouterMap.filter(route => {
if (route.component) { if (route.component) {
// Layout组件特殊处理 // Layout组件特殊处理
@ -40,9 +40,9 @@ const actions = {
generateRoutes({ commit, dispatch }) { generateRoutes({ commit, dispatch }) {
return new Promise(resolve => { return new Promise(resolve => {
// 向后端请求路由数据 // 向后端请求路由数据
getRouters().then(res => { getRouters().then(res => {
const accessedRoutes = filterAsyncRouter([]||res.data) const accessedRoutes = filterAsyncRouter(res.data);
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true }) accessedRoutes.push({ path: '*', redirect: '/404', hidden: true });
commit('SET_ROUTES', accessedRoutes) commit('SET_ROUTES', accessedRoutes)
resolve(accessedRoutes) resolve(accessedRoutes)
}) })

@ -52,7 +52,9 @@
<el-dropdown> <el-dropdown>
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button> <el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click="edit(scope.row)">编辑</el-dropdown-item> <el-dropdown-item >
<span @click="edit(scope.row)">编辑</span>
</el-dropdown-item>
<el-dropdown-item v-if="scope.row.level == 1"> <el-dropdown-item v-if="scope.row.level == 1">
<span @click="addClass(scope.row)">新增下级</span> <span @click="addClass(scope.row)">新增下级</span>
</el-dropdown-item> </el-dropdown-item>
@ -147,6 +149,7 @@ export default {
// //
addClass(parent = null) { addClass(parent = null) {
this.editDialogConfig.visible = true; this.editDialogConfig.visible = true;
this.$refs.edit.model = "classifySave";
// this.$nextTick(()=>{ // this.$nextTick(()=>{
// this.$refs.edit.parent = parent; // this.$refs.edit.parent = parent;
// }); // });
@ -158,15 +161,16 @@ export default {
} }
}, },
// //
edit(row) { edit(row) {
console.log(row.level);
this.editDialogConfig.visible = true; this.editDialogConfig.visible = true;
this.$nextTick(()=>{ this.$nextTick(()=>{
let { level, icon, showFlag, categoryName, sort, parentId } = row; let { level, icon, showFlag, categoryName, sort, parentId,id } = row;
console.log(this.tableData.find(item=>item==parentId),"categoryName")
if (row.level == 1) { if (row.level == 1) {
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId }) this.$refs.edit.model = "classifyUpdate";
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId,id })
} else { } else {
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag,parentCategoryName:this.tableData.find(item=>item==parentId).categoryName, categoryName, sort, parentId }) this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag,parentCategoryName:this.tableData.find(item=>item==parentId).categoryName, categoryName, sort, parentId,id })
} }
}) })
}, },

Loading…
Cancel
Save