1212
This commit is contained in:
@@ -8,6 +8,13 @@ export default {
|
||||
data: page
|
||||
})
|
||||
},
|
||||
classifyUpdate(page) {
|
||||
return request({
|
||||
url: `/${service_name}/mallProductClassification/update`,
|
||||
method: 'post',
|
||||
data: page
|
||||
})
|
||||
},
|
||||
classifyGetByPage(page) { // 分页查询
|
||||
return request({
|
||||
url: `/${service_name}/mallProductClassification/getByPage`,
|
||||
|
||||
@@ -43,6 +43,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
model:"add",
|
||||
loadingBtn: false,
|
||||
constants: [],
|
||||
editPram: {
|
||||
@@ -83,7 +84,7 @@ export default {
|
||||
addTreeListLabelForCasCard(arr, child) {
|
||||
},
|
||||
handlerSubmit() {
|
||||
productApi.classifySave(this.editPram,).then((result) => {
|
||||
productApi[this.model](this.editPram).then((result) => {
|
||||
if(result.code==20000){
|
||||
this.$parent.$parent.editDialogConfig.visible=false;
|
||||
this.$message.success("添加成功!");
|
||||
|
||||
@@ -35,8 +35,9 @@ router.beforeEach(async (to, from, next) => {
|
||||
} else {
|
||||
try {
|
||||
await store.dispatch('user/getInfo')
|
||||
const accessRoutes = await store.dispatch('permission/generateRoutes')
|
||||
router.addRoutes(accessRoutes)
|
||||
const accessRoutes = await store.dispatch('permission/generateRoutes');
|
||||
console.log(accessRoutes,"routerrouterrouter")
|
||||
router.addRoutes(accessRoutes);
|
||||
next({ ...to, replace: true })
|
||||
} catch (error) {
|
||||
await store.dispatch('user/resetToken')
|
||||
|
||||
@@ -24,7 +24,7 @@ export const constantRoutes = [{
|
||||
redirect: 'productList',
|
||||
meta: { title: '商品', icon: 'iconkongzhitai', affix: true },
|
||||
children: [
|
||||
{
|
||||
{
|
||||
path: '/productList',
|
||||
component: () => import('@/views/product/productList/index'),
|
||||
name: 'productList',
|
||||
|
||||
@@ -7,7 +7,7 @@ import Layout from '@/layout'
|
||||
* @param routes asyncRoutes
|
||||
* @param auths
|
||||
*/
|
||||
export function filterAsyncRouter(asyncRouterMap) {
|
||||
export function filterAsyncRouter(asyncRouterMap) {
|
||||
return asyncRouterMap.filter(route => {
|
||||
if (route.component) {
|
||||
// Layout组件特殊处理
|
||||
@@ -40,9 +40,9 @@ const actions = {
|
||||
generateRoutes({ commit, dispatch }) {
|
||||
return new Promise(resolve => {
|
||||
// 向后端请求路由数据
|
||||
getRouters().then(res => {
|
||||
const accessedRoutes = filterAsyncRouter([]||res.data)
|
||||
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true })
|
||||
getRouters().then(res => {
|
||||
const accessedRoutes = filterAsyncRouter(res.data);
|
||||
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true });
|
||||
commit('SET_ROUTES', accessedRoutes)
|
||||
resolve(accessedRoutes)
|
||||
})
|
||||
|
||||
@@ -52,7 +52,9 @@
|
||||
<el-dropdown>
|
||||
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button>
|
||||
<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">
|
||||
<span @click="addClass(scope.row)">新增下级</span>
|
||||
</el-dropdown-item>
|
||||
@@ -147,6 +149,7 @@ export default {
|
||||
// 添加
|
||||
addClass(parent = null) {
|
||||
this.editDialogConfig.visible = true;
|
||||
this.$refs.edit.model = "classifySave";
|
||||
// this.$nextTick(()=>{
|
||||
// this.$refs.edit.parent = parent;
|
||||
// });
|
||||
@@ -158,15 +161,16 @@ export default {
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
edit(row) {
|
||||
console.log(row.level);
|
||||
edit(row) {
|
||||
this.editDialogConfig.visible = true;
|
||||
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) {
|
||||
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 {
|
||||
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 })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user