提交 12d0d862 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

feat: 菜单初始化提交

上级 6f3f98b1
...@@ -8,8 +8,8 @@ import org.apache.ibatis.annotations.Update; ...@@ -8,8 +8,8 @@ import org.apache.ibatis.annotations.Update;
public interface ExtMenuMapper { public interface ExtMenuMapper {
@Update(" update sys_menu set sub_count = sub_count+1 where menu_id = #{menuId} ") @Update(" update sys_menu set sub_count = sub_count+1 where menu_id = #{menuId} ")
int incrementalSubcount(@Param("deptId") Long menuId); int incrementalSubcount(@Param("menuId") Long menuId);
@Update(" update sys_menu set sub_count = sub_count-1 where menu_id = #{menuId} and sub_count > 0") @Update(" update sys_menu set sub_count = sub_count-1 where menu_id = #{menuId} and sub_count > 0")
int decreasingSubcount(@Param("deptId") Long menuId); int decreasingSubcount(@Param("menuId") Long menuId);
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<el-row> <el-row>
<el-col> <el-col>
<span>{{$t('commons.delete_confirm')}}</span> <span>{{$t('commons.delete_confirm')}}</span>
<span class="delete-tip"> DELETE-{{record.name}}</span> <span class="delete-tip"> DELETE-{{record.name || record.title}}</span>
<br/> <br/>
</el-col> </el-col>
</el-row> </el-row>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
this.record = record; this.record = record;
}, },
confirm() { confirm() {
if (this.value.trim() != 'DELETE-' + this.record.name) { if (this.value.trim() != 'DELETE-' + (this.record.name || this.record.title) ) {
this.$warning(this.$t('commons.incorrect_input')); this.$warning(this.$t('commons.incorrect_input'));
return; return;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
row-key="menuId"> row-key="menuId">
<el-table-column :show-overflow-tooltip="true" label="菜单标题" width="125px" prop="title" /> <el-table-column :show-overflow-tooltip="true" label="菜单标题" width="150px" prop="title" />
<el-table-column prop="icon" label="图标" align="center" width="60px"> <el-table-column prop="icon" label="图标" align="center" width="60px">
<template slot-scope="scope"> <template slot-scope="scope">
<svg-icon :icon-class="scope.row.icon ? scope.row.icon : ''" /> <svg-icon :icon-class="scope.row.icon ? scope.row.icon : ''" />
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<span v-else></span> <span v-else></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="createTime" label="创建日期" width="135px"> <el-table-column prop="createTime" label="创建日期" width="160px">
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template> </template>
...@@ -180,7 +180,8 @@ export default { ...@@ -180,7 +180,8 @@ export default {
}, },
data() { data() {
return { return {
menus: null, menus: [],
topMunu: { id: 0, label: '顶级类目', children: null },
formType: "add", formType: "add",
queryPath: '/api/menu/childNodes/', queryPath: '/api/menu/childNodes/',
deletePath: '/api/menu/delete', deletePath: '/api/menu/delete',
...@@ -192,6 +193,7 @@ export default { ...@@ -192,6 +193,7 @@ export default {
tableData: [], tableData: [],
maps: new Map(), maps: new Map(),
oldPid: null, oldPid: null,
defaultForm: { menuId: null, title: null, menuSort: 999, path: null, component: null, componentName: null, iframe: false, pid: 0, icon: null, cache: false, hidden: false, type: 0, permission: null },
form: {}, form: {},
rule: { rule: {
name: [ name: [
...@@ -206,7 +208,8 @@ export default { ...@@ -206,7 +208,8 @@ export default {
} }
}, },
activated() { activated() {
this.initTableData(); this.form = Object.assign({}, this.defaultForm)
this.initTableData()
}, },
methods: { methods: {
create() { create() {
...@@ -219,7 +222,7 @@ export default { ...@@ -219,7 +222,7 @@ export default {
}, },
edit(row) { edit(row) {
this.dialogOrgAddVisible = true; this.dialogVisible = true;
this.formType = "modify"; this.formType = "modify";
this.oldPid = row.pid; this.oldPid = row.pid;
this.form = Object.assign({}, row); this.form = Object.assign({}, row);
...@@ -283,7 +286,8 @@ export default { ...@@ -283,7 +286,8 @@ export default {
if(!row){ if(!row){
data.some(node => node.children = null); data.some(node => node.children = null);
_self.tableData = data; _self.tableData = data;
_self.menus = null; _self.menus = [];
_self.menus.push(_self.topMunu)
}else{ }else{
this.maps.set(row.menuId, {row, treeNode, resolve}) this.maps.set(row.menuId, {row, treeNode, resolve})
...@@ -293,11 +297,11 @@ export default { ...@@ -293,11 +297,11 @@ export default {
}, },
closeFunc() { closeFunc() {
this.initTableData(); this.initTableData();
this.form = {}; this.form = this.defaultForm;
this.oldPid = null; this.oldPid = null;
this.menus = null; this.menus = null;
removeGoBackListener(this.closeFunc); removeGoBackListener(this.closeFunc);
this.dialogOrgAddVisible = false; this.dialogVisible = false;
}, },
...@@ -328,7 +332,7 @@ export default { ...@@ -328,7 +332,7 @@ export default {
} }
return { return {
id: node.menuId, id: node.menuId,
label:node.name, label:node.title,
children:node.children children:node.children
} }
}, },
...@@ -336,7 +340,7 @@ export default { ...@@ -336,7 +340,7 @@ export default {
return { return {
id: node.menuId, id: node.menuId,
pid: node.pid, pid: node.pid,
label: node.name, label: node.title,
children: node.children children: node.children
} }
}, },
...@@ -353,7 +357,7 @@ export default { ...@@ -353,7 +357,7 @@ export default {
this.initTableData(); this.initTableData();
this.oldPid && this.reloadByPid(this.oldPid) this.oldPid && this.reloadByPid(this.oldPid)
this.reloadByPid(this.form['pid']) this.reloadByPid(this.form['pid'])
this.dialogOrgAddVisible = false; this.dialogVisible = false;
}); });
} else { } else {
return false; return false;
...@@ -370,8 +374,8 @@ export default { ...@@ -370,8 +374,8 @@ export default {
cancelButtonText: this.$t('commons.cancel'), cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
let requests = [{menuId: menu.menuId, pid: menu.pid}] let request = {menuId: menu.menuId, pid: menu.pid}
this.$post(this.deletePath, requests, () => { this.$post(this.deletePath, request, () => {
this.$success(this.$t('commons.delete_success')); this.$success(this.$t('commons.delete_success'));
this.initTableData(); this.initTableData();
this.reloadByPid(menu.pid) this.reloadByPid(menu.pid)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论