From d17d3ac3da20d054223a0b1b31909bd0d9caad4d Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期一, 29 七月 2024 19:48:42 +0800
Subject: [PATCH] 知识库页面解析方法接口调用开发
---
src/views/authority/users/index.vue | 99 ++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 84 insertions(+), 15 deletions(-)
diff --git a/src/views/authority/users/index.vue b/src/views/authority/users/index.vue
index 097ab35..d25c456 100644
--- a/src/views/authority/users/index.vue
+++ b/src/views/authority/users/index.vue
@@ -149,40 +149,58 @@
</a-modal>
<a-modal width="30%" v-model:visible="resourcevisible" title="鏉冮檺閰嶇疆" @cancel="handleCancel(3)"
- @ok="editDeptHandleOk">
+ @ok="editResourceHandleOk">
<div :style="{ display:'flex', 'flex-direction':'column' }">
<a-tabs :style="{ width: '100%',height: '500px', 'overflow-y': 'auto' }">
<a-tab-pane key="1">
<template #title>
- <icon-calendar/> 鑿滃崟
+ <icon-calendar />
+ 鑿滃崟
</template>
- Content of Tab Panel 1
+ <a-tree
+ class="tree-demo"
+ v-model:checked-keys="checkedKeysMenu"
+ v-model:expanded-keys="expandKdysMenu"
+ :checkable="true"
+ :data="treeDataMenu"
+ :show-line="showLineMenu"
+ @check="onCheckMenu"
+ :fieldNames="{
+ key:'menuId',
+ title:'menuName',
+ children:'children',
+ }"
+ :check-strictly="checkStrictlyMenu"
+ >
+ </a-tree>
</a-tab-pane>
<a-tab-pane key="2">
<template #title>
- <icon-clock-circle/> 鐭ヨ瘑搴�
+ <icon-clock-circle />
+ 鐭ヨ瘑搴�
</template>
Content of Tab Panel 2
</a-tab-pane>
<a-tab-pane key="3">
<template #title>
- <icon-user/> 鏅鸿兘浣�
+ <icon-user />
+ 鏅鸿兘浣�
</template>
Content of Tab Panel 3
</a-tab-pane>
</a-tabs>
- <a-card :style="{ width: '100%',height: '200px', 'overflow-y': 'auto', margin:'1px'}"
- class="card-demo"
- title="鐢ㄦ埛鎵�鏈夋潈闄�"
- hoverable
+ <a-card :style="{ width: '100%',height: '200px', 'overflow-y': 'auto', margin:'1px'}"
+ class="card-demo"
+ title="鐢ㄦ埛鎵�鏈夋潈闄�"
+ hoverable
>
<a-space wrap>
<a-tag
- v-for="(tag, index) of checkResourceStrictly"
- :key="tag.deptId"
- @close="handleRemove(tag)"
+ v-for="(tag, index) of checkStrictlyMenu"
+ :key="tag.menuId"
+ @close="handleMenuRemove(tag)"
>
- {{ tag.deptName }}
+ {{ tag.menuName }}
</a-tag>
</a-space>
</a-card>
@@ -200,6 +218,7 @@
import type { TableColumnData } from "@arco-design/web-vue/es/table/interface";
import {
OrganizationList,
+ ResourceList,
User,
UserAdd,
UserChangePwd,
@@ -215,7 +234,14 @@
let checkedKeys = ref([]);
let expandKdys = ref([]);
let checkStrictly = ref([]);
-let checkResourceStrictly=ref([])
+
+
+let treeDataMenu = ref([]);
+let checkedKeysMenu = ref([]);
+let expandKdysMenu = ref([]);
+let checkStrictlyMenu = ref([]);
+
+
let menuTips = ref(["鏉冮檺绠$悊", "璐﹀彿"]);
type SizeProps = "mini" | "small" | "medium" | "large";
const account = ref(null);
@@ -262,8 +288,25 @@
}
};
+const onCheckMenu = (newCheckedKeys, event) => {
+ let o = { "menuId": event.node.menuId, "menuName": event.node.menuName };
+ if (event.checked) {
+ checkStrictlyMenu.value.push(o);
+ } else {
+ checkStrictlyMenu.value.forEach((val, idx, array) => {
+ // val: 褰撳墠鍊�
+ if (val.menuId == event.node.menuId) {
+ checkStrictlyMenu.value.splice(idx, 1);
+ return true;
+ }
+ });
+ }
+};
const handleRemove = (key) => {
checkStrictly.value = checkStrictly.value.filter((tag) => tag !== key);
+};
+const handleMenuRemove = (key) => {
+ checkStrictlyMenu.value = checkStrictlyMenu.value.filter((tag) => tag !== key);
};
const basePagination: Pagination = {
current: 1,
@@ -352,6 +395,17 @@
});
};
+const editResourceHandleOk = async () => {
+ let resources: Array = [], user: User = { "userId": selectUser.value.userId };
+ checkStrictlyMenu.value.forEach((val) => {
+ resources.push(val.menuId);
+ });
+ user.resources = resources;
+ await UserEdit(user).then((res) => {
+ fetchData();
+ });
+};
+
const editHandleOk = async () => {
if (editform.value.userId.length > 0) {
await UserEdit({
@@ -414,7 +468,15 @@
//鏉冮檺
if (t == 4) {
resourcevisible.value = true;
-
+ checkedKeysMenu.value = [];
+ expandKdysMenu.value = [];
+ checkStrictlyMenu.value = [];
+ selectUser.value = record;
+ record.resources.forEach((val) => {
+ checkStrictlyMenu.value.push({ "menuId": val.menuId, "menuName": val.menuName });
+ checkedKeysMenu.value.push(val.menuId);
+ expandKdysMenu.value.push(val.menuId);
+ });
}
//鏈烘瀯
@@ -468,9 +530,16 @@
treeData.value = [...res.rows];
});
};
+const MenuData = async (key) => {
+ await ResourceList(key).then((res) => {
+ treeDataMenu.value = [...res.rows];
+ });
+};
+
fetchData();
OrganizationData("");
+MenuData();
const reset = () => {
formModel.value = generateFormModel();
--
Gitblit v1.8.0