Commit 74641dcb authored by 张俊's avatar 张俊
parents 6fb24019 8c426114
......@@ -33,7 +33,7 @@ export default {
},
colors: {
type: Array,
default: () => ["#c1c7d7", "#275a9d"],
default: () => ["#cbced7", "#2b4695"],
},
disabled: {
type: Boolean,
......
......@@ -61,14 +61,15 @@
{{ row.updated_time.split("+")[0].replace("T", " ").replace("Z", " ") }}
</template>
<template v-slot:state="{ row }">
<bg-switch-ele
<!-- <bg-switch-ele
v-model="row.state"
:rowId="row.id"
inline-prompt
activeText="是"
inactiveText="否"
@changeState="changeUseRow"
/>
/> -->
<bg-switch @click="changeUseRow(row)" :labels="['否','是']" :values="[0,1]" v-model="row.state"></bg-switch>
</template>
<template v-slot:action="{ row }">
<bg-table-btns :operations="getOperations(row)" />
......@@ -376,7 +377,6 @@ const changeUseRow = (row) => {
const changePage = (page) => {
state.filter.page = page
state.tableRows = []
getTableRows()
} // 改变页码
......@@ -447,7 +447,6 @@ const addConfirm = () => {
.then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.data)
state.tableRows = []
state.addDialog = false
changePage(1)
}else {
......@@ -464,7 +463,6 @@ const addConfirm = () => {
.then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.data)
state.tableRows = []
state.addDialog = false
changePage(1)
}else {
......@@ -490,7 +488,6 @@ const deleteData = () => {
if (res.data.code == 200) {
ElMessage.success(res.data.data)
state.dialogDelete = false
state.tableRows = []
changePage(1)
}else {
ElMessage.error(res.data.data)
......@@ -526,7 +523,6 @@ const moveRow = (row,type) => {
.then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.data)
state.tableRows = []
changePage(1)
}else {
ElMessage.error(res.data.data)
......
......@@ -55,7 +55,7 @@
<div class="action" @click="fileAction(1,selectData,selectParentData)">
新建本级
</div>
<div class="action" @click="fileAction(2,selectData,selectParentData)">
<div class="action" :class="{'disable':selectData && selectData.menu_type == 2}" @click="fileAction(2,selectData,selectParentData,selectData.menu_type == 2)">
新建下级
</div>
<div class="action" @click="fileAction(3,selectData,selectParentData)">
......@@ -243,6 +243,9 @@ const fileAction = (val,data,parent,disabled=false) => {
handleNodeClick(newChild);
state.newMenuId++
}else if (val == 2) { // 新建下级菜单
if (disabled) {
return
}
state.addType = 2
let newChild = {
menu_name: "新菜单",
......@@ -348,6 +351,8 @@ const closeAction = () => {
} // 点击其他地方,菜单操作框关闭
const saveMenu = (el,type) => {
el.menuRef.validate(valid => {
if (valid) {
let params = {
menu_name: el.menuForm.menu_name,
menu_type: el.menuForm.menu_type,
......@@ -368,12 +373,20 @@ const saveMenu = (el,type) => {
}
})
}else { // 新增
if (state.selectParentData) {
if (state.selectParentData.menu_type == 1 && el.menuForm.menu_type == 0) {
ElMessage.error("菜单之下不可以新建目录")
return
}
}
if(type == 1) { // 新增本级
params.p_menu_id = state.selectParentData ? state.selectParentData.menu_id : ""
}else { // 新增下级
params.p_menu_id = state.selectParentData.menu_id
}
if (params.menu_type != 0) {
params.dict_group_id = ""
}
axios
.post(`/apaas/system/v5/menu/add`,params)
.then((res) => {
......@@ -386,6 +399,8 @@ const saveMenu = (el,type) => {
}
})
}
}
})
} // 保存按钮,新增或编辑菜单
onBeforeMount(()=>{
......
......@@ -12,7 +12,7 @@
<el-input v-model="menuForm.menu_name" show-word-limit maxlength="8" placeholder="请输入菜单名称" />
</el-form-item>
<el-form-item label="类型" prop="menu_type">
<el-radio-group v-model="menuForm.menu_type">
<el-radio-group v-model="menuForm.menu_type" :disabled="radioDisabled">
<el-radio :label="0">目录</el-radio>
<el-radio :label="1">菜单</el-radio>
<el-radio :label="2">子页面</el-radio>
......@@ -138,6 +138,7 @@ const state = reactive({
iconArr: [], // 所有的图标
showIconArr: [], // 展示的图标
timer: null,
radioDisabled: false,
})
const getGroupList = () => {
......@@ -178,6 +179,12 @@ const searchIcon = () => {
} // 图标筛选
const setForm = (data) => {
console.log(data)
if (data.id) { // 编辑状态
state.radioDisabled = true
}else {
state.radioDisabled = false
}
state.menuForm = Object.assign(state.menuForm, data);
} // 表单赋值
......@@ -209,6 +216,7 @@ const {
iconFlag,
showIconArr,
icon_search,
radioDisabled,
} = toRefs(state)
defineExpose({ setForm , menuForm, menuRef })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment