|
@@ -1,17 +1,115 @@
|
|
|
<template>
|
|
|
- <div>111</div>
|
|
|
+ <hc-new-card>
|
|
|
+ <template #header>
|
|
|
+ <div class="w-40">
|
|
|
+ <el-select v-model="searchForm.sysId" filterable clearable block placeholder="选择所属系统">
|
|
|
+ <el-option v-for="item in clinets" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ <div class="ml-3 w-60">
|
|
|
+ <hc-search-input v-model="searchForm.name" placeholder="请输入菜单名称" @search="searchClick" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" :is-index="false" is-new lazy :load="tableLoad">
|
|
|
+ <template #sysId="{ row }">
|
|
|
+ {{ getSystemNmae(row.sysId) }}
|
|
|
+ </template>
|
|
|
+ <template #action="{ row }">
|
|
|
+ <el-link type="primary">权限配置</el-link>
|
|
|
+ </template>
|
|
|
+ </hc-table>
|
|
|
+ </hc-new-card>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { onActivated, ref } from 'vue'
|
|
|
-import { delMessage } from 'hc-vue3-ui'
|
|
|
-import { arrToId, getArrValue } from 'js-fast-way'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
+import { formValidate, getArrValue, getObjValue } from 'js-fast-way'
|
|
|
+import { getClinetAll } from '~api/other'
|
|
|
import mainApi from '~api/authority/data'
|
|
|
+import menuApi from '~api/system/menu'
|
|
|
+
|
|
|
+//初始组合式
|
|
|
+const router = useRouter()
|
|
|
+const useRoutes = useRoute()
|
|
|
|
|
|
//激活
|
|
|
onActivated(() => {
|
|
|
-
|
|
|
+//获取参数
|
|
|
+ const { sysId, name } = getObjValue(useRoutes.query)
|
|
|
+ searchForm.value = { sysId: sysId, name: name }
|
|
|
+ //获取数据
|
|
|
+ getClinetAllApi()
|
|
|
+ getTableData()
|
|
|
})
|
|
|
+
|
|
|
+//获取所有系统
|
|
|
+const clinets = ref([])
|
|
|
+const getClinetAllApi = async () => {
|
|
|
+ const { data } = await getClinetAll()
|
|
|
+ clinets.value = getArrValue(data)
|
|
|
+}
|
|
|
+
|
|
|
+//获取系统名称
|
|
|
+const getSystemNmae = (id) => {
|
|
|
+ const item = clinets.value.find((item) => item.id === id)
|
|
|
+ return item ? item.name : ''
|
|
|
+}
|
|
|
+
|
|
|
+//搜索表单
|
|
|
+const searchForm = ref({ sysId: null, name: null })
|
|
|
+
|
|
|
+//搜索
|
|
|
+const searchClick = () => {
|
|
|
+ router.push({
|
|
|
+ name: 'data_scope',
|
|
|
+ query: searchForm.value,
|
|
|
+ })
|
|
|
+ getTableData()
|
|
|
+}
|
|
|
+
|
|
|
+//表格数据
|
|
|
+const tableColumn = ref([
|
|
|
+ { key: 'name', name: '菜单名称' },
|
|
|
+ { key: 'sysId', name: '所属系统' },
|
|
|
+ { key: 'path', name: '路由地址' },
|
|
|
+ { key: 'code', name: '菜单编号' },
|
|
|
+ { key: 'category', name: '菜单类型', width: 90, align: 'center' },
|
|
|
+ { key: 'sort', name: '排序', width: 80, align: 'center' },
|
|
|
+ { key: 'action', name: '操作', width: 200, align: 'center' },
|
|
|
+])
|
|
|
+const tableData = ref([{}])
|
|
|
+
|
|
|
+//获取表格数据
|
|
|
+const tableLoading = ref(false)
|
|
|
+const getTableData = async () => {
|
|
|
+ tableData.value = []
|
|
|
+ tableLoading.value = true
|
|
|
+ tableData.value = await getLazyList(0)
|
|
|
+ tableLoading.value = false
|
|
|
+}
|
|
|
+
|
|
|
+//懒加载表格
|
|
|
+const tableLoad = async (row, node, resolve) => {
|
|
|
+ resolve(await getLazyList(row.id))
|
|
|
+}
|
|
|
+
|
|
|
+//获取表格数据
|
|
|
+const getLazyList = async (id) => {
|
|
|
+ let newArr = []
|
|
|
+ const { data } = await menuApi.getLazyList({
|
|
|
+ ...searchForm.value,
|
|
|
+ parentId: id,
|
|
|
+ })
|
|
|
+ //处理数据
|
|
|
+ const res = getArrValue(data)
|
|
|
+ for (let i = 0; i < res.length; i++) {
|
|
|
+ if (res[i].category === 1) {
|
|
|
+ newArr.push(res[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newArr
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|