系统生成的菜单和按钮不允许删除

This commit is contained in:
hyt 2024-05-15 16:36:42 +08:00
parent 6eeb79261a
commit 06c988be91
4 changed files with 797 additions and 305 deletions

View File

@ -106,7 +106,7 @@ const permission = {
name: 'masterDataEdit',
hidden: true,
meta: {
title: '基本信息',
title: '',
hidden: true
}
},
@ -116,7 +116,7 @@ const permission = {
name: 'dataOrigin',
hidden: true,
meta: {
title: '数据源',
title: '',
hidden: true
}
},
@ -126,7 +126,7 @@ const permission = {
name: 'displayInfo',
hidden: true,
meta: {
title: '显示信息',
title: '',
hidden: true
}
@ -136,7 +136,7 @@ const permission = {
name: 'authorily',
component: () => import('@/views/masterDataOptions/authority'),
meta: {
title: '配置权限',
title: '',
hidden: true
}
},
@ -145,7 +145,7 @@ const permission = {
name: 'distribute',
component: () => import('@/views/masterDataOptions/distribute'),
meta: {
title: '分发设置',
title: '',
hidden: true
}
}

View File

@ -66,6 +66,7 @@
:ruleForm="stepOneForm"
:isFunBtn="false"
@onSubmit="onSubmitHandle"
@onChangeRadio="stepOneChangeRadio"
></baseNewForm>
</div>
</template>
@ -616,6 +617,7 @@ export default {
stepZeroForm: {
needLogin: '1',
enableAccessEntry: ['2']
}, //1
stepOneformRow: [
{
@ -685,13 +687,38 @@ export default {
message: 'TPS'
}
]
},
{
elCol: [
{
type: 'radio',
title: '是否扩展API',
maxlength: 200,
id: 'extensionApi',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true,
options: [
{
label: '是',
id: '1'
},
{
label: '否',
id: '2'
}
]
}
]
}
],//2
stepOneForm: {
requestCoding: '1',
timeoutPeriod: 10000,
currentLimiting: 100,
requestMethod: '1'
requestMethod: '1',
extensionApi: '1'
}, //2
stepThreeRadio: 1, //穿
stepThreeRadioOptions: [
@ -1121,6 +1148,231 @@ export default {
}
},
methods: {
//api1
stepOneChangeRadio(val, index, indexRow, row) {
console.log(row)
if (row.id === 'extensionApi') {
if (val == 1) {
this.stepOneformRow = [
{
elCol: [
{
type: 'input',
title: '目标地址',
maxlength: 200,
id: 'destinationAddress',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true
}
]
},
{
elCol: [
{
type: 'select',
title: '请求编码',
id: 'requestCoding',
row: 24,
required: true,
options: []
}
]
},
{
elCol: [
{
type: 'select',
title: '请求方法',
id: 'requestMethod',
row: 24,
required: true,
options: []
}
]
},
{
elCol: [
{
type: 'num',
title: '超出时间',
id: 'timeoutPeriod',
row: 24,
min: 1,
max: 600000,
maxlength: 50,
required: true,
message: 'ms'
}
]
},
{
elCol: [
{
type: 'num',
title: '限流',
maxlength: 50,
id: 'currentLimiting',
min: 1,
row: 24,
max: 1000,
required: true,
message: 'TPS'
}
]
},
{
elCol: [
{
type: 'radio',
title: '是否扩展API',
maxlength: 200,
id: 'extensionApi',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true,
options: [
{
label: '是',
id: '1'
},
{
label: '否',
id: '2'
}
]
}
]
},
{
elCol: [
{
type: 'input',
title: '内部bean名称',
maxlength: 200,
id: 'beanName',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true
}
]
},
{
elCol: [
{
type: 'input',
title: '方法名称',
maxlength: 200,
id: 'funName',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true
}
]
}
]
} else {
this.stepOneformRow = [
{
elCol: [
{
type: 'input',
title: '目标地址',
maxlength: 200,
id: 'destinationAddress',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true
}
]
},
{
elCol: [
{
type: 'select',
title: '请求编码',
id: 'requestCoding',
row: 24,
required: true,
options: []
}
]
},
{
elCol: [
{
type: 'select',
title: '请求方法',
id: 'requestMethod',
row: 24,
required: true,
options: []
}
]
},
{
elCol: [
{
type: 'num',
title: '超出时间',
id: 'timeoutPeriod',
row: 24,
min: 1,
max: 600000,
maxlength: 50,
required: true,
message: 'ms'
}
]
},
{
elCol: [
{
type: 'num',
title: '限流',
maxlength: 50,
id: 'currentLimiting',
min: 1,
row: 24,
max: 1000,
required: true,
message: 'TPS'
}
]
},
{
elCol: [
{
type: 'radio',
title: '是否扩展API',
maxlength: 200,
id: 'extensionApi',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true,
options: [
{
label: '是',
id: '1'
},
{
label: '否',
id: '2'
}
]
}
]
}
]
}
}
},
//
handleSelect(key, keyPath) {
this.activeIndex = key
@ -1323,8 +1575,231 @@ export default {
obj1['requestMethod'] = res.attribute.requestMethod
obj1['timeoutPeriod'] = res.attribute.timeoutPeriod
obj1['currentLimiting'] = res.attribute.currentLimiting
obj1['extensionApi'] = res.attribute.extensionApi
obj1['funName'] = res.attribute.funName
obj1['beanName'] = res.attribute.beanName
this.stepZeroForm = obj0
this.stepOneForm = obj1
//stepOneChangeRadio
if (this.stepOneForm.extensionApi == 1) {
this.stepOneformRow = [
{
elCol: [
{
type: 'input',
title: '目标地址',
maxlength: 200,
id: 'destinationAddress',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true
}
]
},
{
elCol: [
{
type: 'select',
title: '请求编码',
id: 'requestCoding',
row: 24,
required: true,
options: []
}
]
},
{
elCol: [
{
type: 'select',
title: '请求方法',
id: 'requestMethod',
row: 24,
required: true,
options: []
}
]
},
{
elCol: [
{
type: 'num',
title: '超出时间',
id: 'timeoutPeriod',
row: 24,
min: 1,
max: 600000,
maxlength: 50,
required: true,
message: 'ms'
}
]
},
{
elCol: [
{
type: 'num',
title: '限流',
maxlength: 50,
id: 'currentLimiting',
min: 1,
row: 24,
max: 1000,
required: true,
message: 'TPS'
}
]
},
{
elCol: [
{
type: 'radio',
title: '是否扩展API',
maxlength: 200,
id: 'extensionApi',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true,
options: [
{
label: '是',
id: '1'
},
{
label: '否',
id: '2'
}
]
}
]
},
{
elCol: [
{
type: 'input',
title: '内部bean名称',
maxlength: 200,
id: 'beanName',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true
}
]
},
{
elCol: [
{
type: 'input',
title: '方法名称',
maxlength: 200,
id: 'funName',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true
}
]
}
]
} else {
this.stepOneformRow = [
{
elCol: [
{
type: 'input',
title: '目标地址',
maxlength: 200,
id: 'destinationAddress',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true
}
]
},
{
elCol: [
{
type: 'select',
title: '请求编码',
id: 'requestCoding',
row: 24,
required: true,
options: []
}
]
},
{
elCol: [
{
type: 'select',
title: '请求方法',
id: 'requestMethod',
row: 24,
required: true,
options: []
}
]
},
{
elCol: [
{
type: 'num',
title: '超出时间',
id: 'timeoutPeriod',
row: 24,
min: 1,
max: 600000,
maxlength: 50,
required: true,
message: 'ms'
}
]
},
{
elCol: [
{
type: 'num',
title: '限流',
maxlength: 50,
id: 'currentLimiting',
min: 1,
row: 24,
max: 1000,
required: true,
message: 'TPS'
}
]
},
{
elCol: [
{
type: 'radio',
title: '是否扩展API',
maxlength: 200,
id: 'extensionApi',
pattern: '',
message: 'URL或协议不合法',
row: 24,
required: true,
options: [
{
label: '是',
id: '1'
},
{
label: '否',
id: '2'
}
]
}
]
}
]
}
this.$set(this.returnedForm, 'returnSuccessField', res.attribute.returnSuccessField)
this.$set(this.returnedForm, 'returnSuccessValue', res.attribute.returnSuccessValue)
this.$set(this.returnedForm, 'returnMsg', res.attribute.returnMsg)

View File

@ -45,7 +45,7 @@
<script>
import baseTable from '@/components/base/baseTable'
import baseLayout from "@/components/base/baseNewLayout"
import baseLayout from '@/components/base/baseNewLayout'
import baseDialog from '@/components/base/BaseNewDialog/index.vue'
import baseTree from '@/components/base/BaseMenuTree/index.vue'
import baseForm from '@/components/base/baseNewForm/index.vue'
@ -106,7 +106,9 @@ export default {
pageSize: 20,
menuId: '',
pageNum: 1
}
},
radioRow: {},//
clickTreeRow: {}//
}
},
computed: {
@ -132,6 +134,7 @@ export default {
},
//
handleNodeClick(data) {
this.clickTreeRow = data
this.pageModel.menuId = data.id
this.pageModel.pageNum = 1
this.RefreshTable()
@ -155,6 +158,7 @@ export default {
radioChange(val) {
this.radioIndex = val.index
this.radioID = val.id
this.radioRow = val
},
async getTableData() {
this.tabLoading = true
@ -222,6 +226,10 @@ export default {
this.$vmNews('请选择一条数据')
return
}
if(this.clickTreeRow.formId){
this.$vmNews("系统自动生成的按钮无法删除")
return
}
this.$confirm('确定删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',

View File

@ -8,17 +8,20 @@
<div slot="main" flex style="height:100%">
<div style="width: 100%;border-right:1px solid #dfe6ec;height:100%;overflow: auto;">
<base-tree ref="baseTree" :isCenter="false" :isSaveBtn="false" :Allshow="false" :expandAll="true"
:showCheckbox="false" :menuData="menuData" @handleNodeClick="formClick">
:showCheckbox="false" :menuData="menuData" @handleNodeClick="formClick"
>
</base-tree>
</div>
</div>
</base-layout>
<base-layout title="菜单树编辑区" :defaultButtonSwitch="false" :buttonList="buttonList" @onFuncBtn="getFuncBtn"
style="flex:1;">
style="flex:1;"
>
<div slot="main" style="padding:0 12px;height:300px">
<base-form ref="customForm" :formRow="formRow" :isFunBtn="isFunBtn" @elDialogClick="elDialogClick"
:formdata="ruleForm" @onSubmit="getSubmit">
:formdata="ruleForm" @onSubmit="getSubmit"
>
</base-form>
</div>
</base-layout>
@ -29,15 +32,15 @@
<script>
import router from '@/router'
import baseLayout from "@/components/base/baseNewLayout"
import baseForm from "@/components/base/baseNewForm/index.vue"
import baseTree from "@/components/base/BaseMenuTree/index.vue"
import baseTreeclick from "@/components/base/baseTreeClick/index.vue"
import baseDialog from "@/components/base/BaseNewDialog"
import baseOrganization from "@/components/base/baseOrganization"
import configData from "./configData";
import baseLayout from '@/components/base/baseNewLayout'
import baseForm from '@/components/base/baseNewForm/index.vue'
import baseTree from '@/components/base/BaseMenuTree/index.vue'
import baseTreeclick from '@/components/base/baseTreeClick/index.vue'
import baseDialog from '@/components/base/BaseNewDialog'
import baseOrganization from '@/components/base/baseOrganization'
import configData from './configData'
import {
GetOrganTree,
GetOrganTree
} from '@/api/apis/organization'
import {
GetMenuTree,
@ -46,6 +49,7 @@ import {
MenuDelData
} from '@/api/apis/menuManage'
import { authApi } from '@/api/apis/auth'
export default {
components: {
baseLayout,
@ -75,7 +79,7 @@ export default {
menuName: '删除节点',
icon: 'el-icon-delete',
type: 'danger'
},
}
],
delId: '',
menuData: [],
@ -83,6 +87,7 @@ export default {
rules: {},
formRow: configData.formRow,
isFunBtn: true,
clickTree: {}//
}
},
@ -98,7 +103,7 @@ export default {
},
//
async getMenuData() {
let res = await authApi('sysMenuConfigService','','queryEntityTree','',{})
let res = await authApi('sysMenuConfigService', '', 'queryEntityTree', '', {})
if (res.status == 200) {
let arr = res.attribute[0]
this.menuData = res.attribute
@ -109,8 +114,8 @@ export default {
if (btnEven.menuName == '新增根节点') {
let newRuleForm = {
parentMenuName: "",
parentMenuId: 0,
parentMenuName: '',
parentMenuId: 0
}
this.$nextTick(() => {
this.$refs.customForm.resetForm('ruleForm')
@ -126,14 +131,17 @@ export default {
parentMenuName: this.ruleForm.menuName,
parentMenuId: this.ruleForm.id
}
console.log(newRuleForm,'newRuleForm')
console.log(newRuleForm, 'newRuleForm')
this.$nextTick(() => {
this.$refs.customForm.resetForm('ruleForm')
this.$refs.customForm.choiceAssignment(newRuleForm)
})
}
if (btnEven.menuName == '删除节点') {
if(this.clickTree.formId){
this.$vmNews("系统自动生成的菜单不允许删除")
return
}
this.$confirm('确认删除该菜单吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -144,15 +152,15 @@ export default {
this.$message({
type: 'info',
message: '已取消删除'
});
});
})
})
}
},
async menuDel() {
let params = {
id: this.delId
}
let res = await authApi('sysMenuConfigService','','deleteEntity','',params)
let res = await authApi('sysMenuConfigService', '', 'deleteEntity', '', params)
if (res.status == 200) {
this.$vmNews('删除成功', 'success')
this.ruleForm = {}
@ -165,9 +173,9 @@ export default {
let params = {
id: id
}
let res = await authApi('sysMenuConfigService','','getEntity','',params)
let res = await authApi('sysMenuConfigService', '', 'getEntity', '', params)
if (res.status == 200) {
console.log(res,'res')
console.log(res, 'res')
this.ruleForm = res.attribute
this.$nextTick(() => {
this.$refs.customForm.choiceAssignment(res.attribute)
@ -179,10 +187,10 @@ export default {
...data
}
let res
if(params.id){
res = await authApi("sysMenuConfigService","","updateEntity","",params)
}else{
res = await authApi("sysMenuConfigService","","saveEntity","",params)
if (params.id) {
res = await authApi('sysMenuConfigService', '', 'updateEntity', '', params)
} else {
res = await authApi('sysMenuConfigService', '', 'saveEntity', '', params)
}
if (res.status == 200) {
this.$vmNews('保存成功', 'success')
@ -204,7 +212,7 @@ export default {
this.$refs.baseOrganization.dialogVisible = true
},
handleConfirmClick(val) {
console.log(val, "val");
console.log(val, 'val')
this.ruleForm.parentMenuName = val.label
this.ruleForm.parentMenuId = val.id
this.$refs.customForm.incomingParameters(this.ruleForm)
@ -212,9 +220,10 @@ export default {
},
formClick(data) {
this.delId = data.id
this.clickTree = data
this.getDetail(data.id)
},
},
}
}
}
</script>