1212
This commit is contained in:
@@ -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')
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ const actions = {
|
|||||||
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;
|
||||||
// });
|
// });
|
||||||
@@ -159,14 +162,15 @@ 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 })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user