|
|
|
|
@ -15,7 +15,9 @@ import {
|
|
|
|
|
import icons_json from '@icon-park/vue-next/icons.json';
|
|
|
|
|
|
|
|
|
|
const icons_search = ref('')
|
|
|
|
|
const icons_list = computed(() => {
|
|
|
|
|
const iconSearchUpdate = (e = '') => {
|
|
|
|
|
icons_list.value = []
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
let list = []
|
|
|
|
|
let search = icons_search.value
|
|
|
|
|
if (!!search) {
|
|
|
|
|
@ -51,8 +53,10 @@ const icons_list = computed(() => {
|
|
|
|
|
for (let i in list_turn) {
|
|
|
|
|
ret.push(list_turn[i])
|
|
|
|
|
}
|
|
|
|
|
return ret
|
|
|
|
|
})
|
|
|
|
|
icons_list.value = ret
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const icons_list = ref([])
|
|
|
|
|
|
|
|
|
|
const table_list = ref([])
|
|
|
|
|
const AdminAuthList = async () => {
|
|
|
|
|
@ -138,6 +142,9 @@ const AdminDelete = async () => {
|
|
|
|
|
if (edit_data.value.pid === 0) {
|
|
|
|
|
const index = table_list.value.findIndex(item => item.id === response.data.id)
|
|
|
|
|
table_list.value.splice(index, 1)
|
|
|
|
|
|
|
|
|
|
const select_index = admin_auth_select.value.findIndex(item => item.id === response.data.id);
|
|
|
|
|
admin_auth_select.value.splice(select_index, 1)
|
|
|
|
|
} else {
|
|
|
|
|
const index = table_list.value.findIndex(item => item.id === edit_data.value.pid)
|
|
|
|
|
const children_index = table_list.value[index].children.findIndex(item => item.id === response.data.id)
|
|
|
|
|
@ -176,6 +183,10 @@ const editDoneClick = async () => {
|
|
|
|
|
window.$message().success('创建')
|
|
|
|
|
if (data.pid === 0) {
|
|
|
|
|
table_list.value.unshift(response.data.info)
|
|
|
|
|
if (data.type === 1) admin_auth_select.value.unshift({
|
|
|
|
|
id: response.data.info.id,
|
|
|
|
|
title: response.data.info.title,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
const index = table_list.value.findIndex(item => item.id === data.pid)
|
|
|
|
|
table_list.value[index].children.unshift(response.data.info)
|
|
|
|
|
@ -184,6 +195,7 @@ const editDoneClick = async () => {
|
|
|
|
|
window.$message().success('修改成功')
|
|
|
|
|
let index = table_list.value.findIndex(item => item.id === data.id);
|
|
|
|
|
let children_index = -1;
|
|
|
|
|
let select_index = -1;
|
|
|
|
|
if (index === -1) {
|
|
|
|
|
for (let i in table_list.value) {
|
|
|
|
|
if ('children' in table_list.value[i]) {
|
|
|
|
|
@ -198,13 +210,23 @@ const editDoneClick = async () => {
|
|
|
|
|
if ('children' in table_list.value[index]) {
|
|
|
|
|
response.data.info.children = JSON.parse(JSON.stringify(table_list.value[index].children));
|
|
|
|
|
}
|
|
|
|
|
if (data.type === 1) {
|
|
|
|
|
select_index = admin_auth_select.value.findIndex(item => item.id === data.id);
|
|
|
|
|
admin_auth_select.value.splice(select_index, 1)
|
|
|
|
|
}
|
|
|
|
|
table_list.value.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
nextTick(()=>{
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
if (data.pid === 0) {
|
|
|
|
|
if (!('children' in response.data.info)) {
|
|
|
|
|
response.data.info.children = [];
|
|
|
|
|
}
|
|
|
|
|
if (data.type === 1) {
|
|
|
|
|
admin_auth_select.value.unshift({
|
|
|
|
|
id: response.data.info.id,
|
|
|
|
|
title: response.data.info.title,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (index === -1) {
|
|
|
|
|
table_list.value.unshift(response.data.info);
|
|
|
|
|
} else {
|
|
|
|
|
@ -232,6 +254,11 @@ const iconChooseClick = (icon) => {
|
|
|
|
|
})
|
|
|
|
|
icon_show.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const iconChooseShowClick = () => {
|
|
|
|
|
iconSearchUpdate()
|
|
|
|
|
icon_show.value = true
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
@ -243,7 +270,7 @@ const iconChooseClick = (icon) => {
|
|
|
|
|
</div>
|
|
|
|
|
<div ml-2>
|
|
|
|
|
<el-input class="input_line_input_wrapper" v-model="icons_search"
|
|
|
|
|
placeholder="请输入"></el-input>
|
|
|
|
|
placeholder="请输入" @change="iconSearchUpdate"></el-input>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div mt-2>
|
|
|
|
|
@ -274,7 +301,7 @@ const iconChooseClick = (icon) => {
|
|
|
|
|
<el-tag w-full type="info">名称</el-tag>
|
|
|
|
|
</div>
|
|
|
|
|
<div ml-2>
|
|
|
|
|
<el-input class="input_line_input_wrapper" v-model="edit_data.name"
|
|
|
|
|
<el-input class="input_line_input_wrapper" v-model="edit_data.title"
|
|
|
|
|
placeholder="请输入名称"></el-input>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@ -283,7 +310,7 @@ const iconChooseClick = (icon) => {
|
|
|
|
|
<el-tag w-full type="info">路由</el-tag>
|
|
|
|
|
</div>
|
|
|
|
|
<div ml-2>
|
|
|
|
|
<el-input class="input_line_input_wrapper" v-model="edit_data.title"
|
|
|
|
|
<el-input class="input_line_input_wrapper" v-model="edit_data.name"
|
|
|
|
|
placeholder="请输入路由"></el-input>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@ -292,7 +319,8 @@ const iconChooseClick = (icon) => {
|
|
|
|
|
<el-tag w-full type="info">图标</el-tag>
|
|
|
|
|
</div>
|
|
|
|
|
<div ml-2>
|
|
|
|
|
<div @click="icon_show = true" cursor-pointer class="input_line_input_wrapper icon_wrapper" text-center>
|
|
|
|
|
<div @click="iconChooseShowClick()" cursor-pointer class="input_line_input_wrapper icon_wrapper"
|
|
|
|
|
text-center>
|
|
|
|
|
<el-icon>
|
|
|
|
|
<Icon v-if="!!edit_data.icon" :type="edit_data.icon"></Icon>
|
|
|
|
|
</el-icon>
|
|
|
|
|
|