部分修改
This commit is contained in:
parent
85cc0dc55f
commit
144413041a
|
|
@ -18,7 +18,7 @@
|
|||
v-else
|
||||
:to="{
|
||||
path: path,
|
||||
query: resolveQuery
|
||||
query: resolveQuery,
|
||||
}"
|
||||
>
|
||||
<el-menu-item :index="path">
|
||||
|
|
@ -30,55 +30,55 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { queryToObject } from '@/utils/util'
|
||||
import { isQuery } from '@/utils/validate'
|
||||
import { computed, defineComponent, toRefs } from 'vue'
|
||||
import { RouteRecordRaw } from 'vue-router'
|
||||
export default defineComponent({
|
||||
components: {},
|
||||
props: {
|
||||
route: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
import { queryToObject } from '@/utils/util'
|
||||
import { isQuery } from '@/utils/validate'
|
||||
import { computed, defineComponent, toRefs } from 'vue'
|
||||
import { RouteRecordRaw } from 'vue-router'
|
||||
export default defineComponent({
|
||||
components: {},
|
||||
props: {
|
||||
route: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
path: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
path: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
const { path, route } = toRefs(props)
|
||||
// 是否有子路由
|
||||
const hasChildren = computed(() => {
|
||||
const children: RouteRecordRaw[] = route.value.children ?? []
|
||||
return !!children.filter(item => !item.meta?.hidden).length
|
||||
})
|
||||
// 解析路径,后台上传的并非完整路径
|
||||
const resolvePath = computed(() => (p?: string) => {
|
||||
return p !== undefined ? `${path.value}/${p}` : path.value
|
||||
})
|
||||
// 解析参数'{id:1}'|| id=1 => {id: 1}
|
||||
const resolveQuery = computed(() => {
|
||||
const query = route.value.query
|
||||
try {
|
||||
if (isQuery(query)) {
|
||||
return queryToObject(query)
|
||||
} else {
|
||||
return JSON.parse(query)
|
||||
}
|
||||
} catch (error) {}
|
||||
})
|
||||
setup(props) {
|
||||
const { path, route } = toRefs(props)
|
||||
// 是否有子路由
|
||||
const hasChildren = computed(() => {
|
||||
const children: RouteRecordRaw[] = route.value.children ?? []
|
||||
return !!children.filter((item) => !item.meta?.hidden).length
|
||||
})
|
||||
// 解析路径,后台上传的并非完整路径
|
||||
const resolvePath = computed(() => (p?: string) => {
|
||||
return p !== undefined ? `${path.value}/${p}` : path.value
|
||||
})
|
||||
// 解析参数'{id:1}'|| id=1 => {id: 1}
|
||||
const resolveQuery = computed(() => {
|
||||
const query = route.value.query
|
||||
try {
|
||||
if (isQuery(query)) {
|
||||
return queryToObject(query)
|
||||
} else {
|
||||
return JSON.parse(query)
|
||||
}
|
||||
} catch (error) {}
|
||||
})
|
||||
|
||||
return {
|
||||
hasChildren,
|
||||
resolvePath,
|
||||
resolveQuery
|
||||
}
|
||||
}
|
||||
})
|
||||
return {
|
||||
hasChildren,
|
||||
resolvePath,
|
||||
resolveQuery,
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.iconfont {
|
||||
font-size: 26px;
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@
|
|||
import { ElForm } from 'element-plus'
|
||||
import { useAdmin } from '@/core/hooks/app'
|
||||
import FooterBtns from '@/components/footer-btns/index.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { apiDeptAdd, apiDeptEdit, apiDeptDetail, apiDeptLists } from '@/api/organize'
|
||||
|
||||
const { router, route } = useAdmin()
|
||||
|
|
@ -169,6 +170,7 @@
|
|||
: apiDeptAdd(formData.value)
|
||||
promise.then(() => {
|
||||
setTimeout(() => router.go(-1), 500)
|
||||
ElMessage({ type: 'success', message: '保存成功' })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@
|
|||
import Popup from '@/components/popup/index.vue'
|
||||
import { flatten } from '@/utils/util'
|
||||
import { apiDeptLists, apiDeptDelete } from '@/api/organize'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
|
|
@ -108,6 +109,7 @@
|
|||
const handleDelete = (id: number) => {
|
||||
apiDeptDelete({ id }).then(() => {
|
||||
getDeptLists()
|
||||
ElMessage({ type: 'success', message: '删除成功' })
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
import { computed, defineComponent, onMounted, reactive, Ref, ref, toRefs } from 'vue'
|
||||
import FooterBtns from '@/components/footer-btns/index.vue'
|
||||
import { apiPostAdd, apiPostEdit, apiPostDetail } from '@/api/organize'
|
||||
import { ElForm } from 'element-plus'
|
||||
import { ElForm, ElMessage } from 'element-plus'
|
||||
import { useAdmin } from '@/core/hooks/app'
|
||||
|
||||
const { router, route } = useAdmin()
|
||||
|
|
@ -119,6 +119,7 @@
|
|||
: apiPostAdd(formData.value)
|
||||
promise.then(() => {
|
||||
setTimeout(() => router.go(-1), 500)
|
||||
ElMessage({ type: 'success', message: '保存成功' })
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@
|
|||
import Popup from '@/components/popup/index.vue'
|
||||
import { usePages } from '@/core/hooks/pages'
|
||||
import { apiPostLists, apiPostDelete } from '@/api/organize'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
|
|
@ -100,6 +101,7 @@
|
|||
id,
|
||||
}).then(() => {
|
||||
requestApi()
|
||||
ElMessage({ type: 'success', message: '删除成功' })
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue