From 3ffa64648831ceade32fba83047d0e99ff92c990 Mon Sep 17 00:00:00 2001
From: 张涛 <“2538313560@qq.com”>
Date: 星期一, 18 十一月 2024 14:06:00 +0800
Subject: [PATCH] fix:改动
---
src/views/authority/group/index.vue | 1219 +++++++++++++++++++++++++++++++--------------------------
src/utils/auth.ts | 6
src/api/authority.ts | 6
src/router/index.ts | 4
src/router/routes/index.ts | 5
5 files changed, 665 insertions(+), 575 deletions(-)
diff --git a/src/api/authority.ts b/src/api/authority.ts
index db2b6a5..d4347d0 100644
--- a/src/api/authority.ts
+++ b/src/api/authority.ts
@@ -182,3 +182,9 @@
export function DialogList(role: string) {
return axios.get<Result<any>>("/base/system/dialog/list" + "?role=" + role);
}
+
+// 鐢ㄦ埛缁勭浉鍏�
+
+export function GroupList(params: Pagination) {
+ return axios.post<Result<User[]>>("/api/group/group_list", { params });
+}
\ No newline at end of file
diff --git a/src/router/index.ts b/src/router/index.ts
index 0644622..194ea7b 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,4 +1,4 @@
-import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router';
+import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router';
import NProgress from 'nprogress'; // progress bar
import 'nprogress/nprogress.css';
@@ -7,7 +7,7 @@
import createRouteGuard from './guard';
NProgress.configure({ showSpinner: false }); // NProgress Configuration
-
+console.log('appRoutes', appRoutes)
const router = createRouter({
//history: createWebHistory(),
history: createWebHashHistory(),
diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts
index 763aa59..34b8881 100644
--- a/src/router/routes/index.ts
+++ b/src/router/routes/index.ts
@@ -8,9 +8,6 @@
eager: true,
});
-
-console.log(externalModules, 'externalModules');
-
function formatModules(_modules: any, result: RouteRecordNormalized[]) {
Object.keys(_modules).forEach((key) => {
const defaultModule = _modules[key].default;
@@ -24,8 +21,6 @@
}
export const appRoutes: RouteRecordNormalized[] = formatModules(modules, []);
-
-console.log(appRoutes, 'appRoutes');
export const appExternalRoutes: RouteRecordNormalized[] = formatModules(
externalModules,
diff --git a/src/utils/auth.ts b/src/utils/auth.ts
index 0caf5e8..99e0afd 100644
--- a/src/utils/auth.ts
+++ b/src/utils/auth.ts
@@ -1,7 +1,7 @@
const TOKEN_KEY = 'token';
const Authorization = 'Authorization';
const UserInfo = 'userInfo';
-const UserResources='userResources'
+const UserResources = 'userResources'
const isLogin = () => {
return !!localStorage.getItem(TOKEN_KEY);
@@ -12,7 +12,7 @@
};
const setToken = (token: string) => {
- localStorage.setItem(TOKEN_KEY, token);
+ localStorage.setItem(TOKEN_KEY, token);
};
const clearToken = () => {
@@ -48,4 +48,4 @@
localStorage.removeItem(UserResources);
};
-export { isLogin, getToken, setToken, clearToken,getAuthorization, setAuthorization, getUserInfo, setUserInfo,setUserResources,getUserResources,clearUserResources};
+export { isLogin, getToken, setToken, clearToken, getAuthorization, setAuthorization, getUserInfo, setUserInfo, setUserResources, getUserResources, clearUserResources };
diff --git a/src/views/authority/group/index.vue b/src/views/authority/group/index.vue
index 533239b..a7a1ee2 100644
--- a/src/views/authority/group/index.vue
+++ b/src/views/authority/group/index.vue
@@ -5,10 +5,18 @@
<div class="table-page-search-wrapper">
<div class="search-wrapper">
<div>
- <a-input v-model="formModel.name" :style="{ width: '320px' }" :placeholder="$t('璇疯緭鍏�')" />
+ <a-input
+ v-model="formModel.name"
+ :style="{ width: '320px' }"
+ :placeholder="$t('璇疯緭鍏�')"
+ />
</div>
<div>
- <a-button type="primary" style="margin-right: 20px; margin-left: 10px" @click="search">
+ <a-button
+ type="primary"
+ style="margin-right: 20px; margin-left: 10px"
+ @click="search"
+ >
<template #icon>
<icon-search />
</template>
@@ -25,7 +33,9 @@
<div class="search-wrapper">
<div>
<a-space>
- <a-button type="primary" :align="'right'" @click="operation(0)">+ 鏂板缓鐢ㄦ埛缁�</a-button>
+ <a-button type="primary" :align="'right'" @click="operation(0)"
+ >+ 鏂板缓鐢ㄦ埛缁�</a-button
+ >
</a-space>
</div>
<div class="wrapper-icon">
@@ -41,8 +51,12 @@
</div>
</a-tooltip>
<template #content>
- <a-doption v-for="item in densityList" :key="item.value" :value="item.value"
- :class="{ active: item.value === size }">
+ <a-doption
+ v-for="item in densityList"
+ :key="item.value"
+ :value="item.value"
+ :class="{ active: item.value === size }"
+ >
<span>{{ item.name }}</span>
</a-doption>
</template>
@@ -50,31 +64,69 @@
</div>
</div>
</div>
- <a-table row-key="id" :loading="loading" :pagination="pagination" :columns="columns" :data="renderData"
- :bordered="false" :size="size" @page-change="onPageChange">
+ <a-table
+ row-key="id"
+ :loading="loading"
+ :pagination="pagination"
+ :columns="columns"
+ :data="renderData"
+ :bordered="false"
+ :size="size"
+ @page-change="onPageChange"
+ >
<template #index="{ rowIndex }">
{{ rowIndex + 1 + (pagination.current - 1) * pagination.pageSize }}
</template>
<template #status="{ record }">
- <a-switch v-model="record.status" checked-value="1" unchecked-value="0"
- @change="statusChange(record.status, record)" />
+ <a-switch
+ v-model="record.status"
+ checked-value="1"
+ unchecked-value="0"
+ @change="statusChange(record.status, record)"
+ />
</template>
<template #operations="{ record }">
<a-space>
- <a-button type="outline" @click="operation(2, record)">缂栬緫</a-button>
- <a-button type="dashed" status="success" @click="operation(1, record)">鎴愬憳绠$悊</a-button>
- <a-button type="dashed" status="warning" @click="operation(4, record)">鏉冮檺绠$悊</a-button>
- <a-popconfirm content="璇风‘璁ゆ槸鍚﹀垹闄わ紵" type="success" @ok="operation(3, record)">
+ <a-button type="outline" @click="operation(2, record)"
+ >缂栬緫</a-button
+ >
+ <a-button
+ type="dashed"
+ status="success"
+ @click="operation(1, record)"
+ >鎴愬憳绠$悊</a-button
+ >
+ <a-button
+ type="dashed"
+ status="warning"
+ @click="operation(4, record)"
+ >鏉冮檺绠$悊</a-button
+ >
+ <a-popconfirm
+ content="璇风‘璁ゆ槸鍚﹀垹闄わ紵"
+ type="success"
+ @ok="operation(3, record)"
+ >
<a-button type="outline" status="danger">鍒犻櫎</a-button>
</a-popconfirm>
</a-space>
</template>
</a-table>
</a-card>
- <a-modal v-model:visible="visible" :title="editModalTitle" width="30%" @cancel="handleCancel(1)" @ok="editHandleOk">
+ <a-modal
+ v-model:visible="visible"
+ :title="editModalTitle"
+ width="30%"
+ @cancel="handleCancel(1)"
+ @ok="editHandleOk"
+ >
<a-form ref="formRef" :model="editform" auto-label-width>
<a-row>
- <a-form-item field="loginName" label="鐢ㄦ埛缁勫悕绉板悕绉�:" :rules="[{ required: true, message: '鐢ㄦ埛鍚嶅繀濉�' }]">
+ <a-form-item
+ field="loginName"
+ label="鐢ㄦ埛缁勫悕绉板悕绉�:"
+ :rules="[{ required: true, message: '鐢ㄦ埛鍚嶅繀濉�' }]"
+ >
<a-input v-model="editform.loginName" />
</a-form-item>
</a-row>
@@ -85,36 +137,63 @@
</a-row>
</a-form>
</a-modal>
- <a-modal v-model:visible="memberVisible" width="50%" title="鐢ㄦ埛缁勬垚鍛樼鐞�" @cancel="handleCancel(2)"
- @ok="editDeptHandleOk">
+ <a-modal
+ v-model:visible="memberVisible"
+ width="50%"
+ title="鐢ㄦ埛缁勬垚鍛樼鐞�"
+ @cancel="handleCancel(2)"
+ @ok="editDeptHandleOk"
+ >
<div :style="{ display: 'flex', justifyContent: 'center' }">
<!-- TODO榛樿鍊煎洖鏄� -->
- <a-transfer show-search :data="memberList" :default-value="selectedMemberList" :source-input-search-props="{
- placeholder: '璇疯緭鍏ョ敤鎴峰悕鎼滅储'
- }" :target-input-search-props="{
- placeholder: '璇疯緭鍏ョ敤鎴峰悕鎼滅储'
- }">
+ <a-transfer
+ show-search
+ :data="memberList"
+ :default-value="selectedMemberList"
+ :source-input-search-props="{
+ placeholder: '璇疯緭鍏ョ敤鎴峰悕鎼滅储',
+ }"
+ :target-input-search-props="{
+ placeholder: '璇疯緭鍏ョ敤鎴峰悕鎼滅储',
+ }"
+ >
<template #source-title>鍙�夊垪琛�</template>
<template #target-title>宸查�夊垪琛�</template>
</a-transfer>
</div>
</a-modal>
- <a-modal v-if="resourcevisible" v-model:visible="resourcevisible" width="50%" title="鏉冮檺绠$悊" ok-text="鍏抽棴"
- hide-cancel="true" @ok="handleCancel(3)">
+ <a-modal
+ v-if="resourcevisible"
+ v-model:visible="resourcevisible"
+ width="50%"
+ title="鏉冮檺绠$悊"
+ ok-text="鍏抽棴"
+ hide-cancel="true"
+ @ok="handleCancel(3)"
+ >
<div :style="{ 'display': 'flex', 'flex-direction': 'column' }">
- <a-card :style="{
- 'width': '100%',
- 'height': '40%',
- 'overflow-y': 'auto',
- 'margin': '1px',
- }" class="card-demo" title="鐢ㄦ埛鎵�鏈夋潈闄�" hoverable>
-
+ <a-card
+ :style="{
+ 'width': '100%',
+ 'height': '40%',
+ 'overflow-y': 'auto',
+ 'margin': '1px',
+ }"
+ class="card-demo"
+ title="鐢ㄦ埛鎵�鏈夋潈闄�"
+ hoverable
+ >
<a-space wrap>
鑿滃崟鍔熻兘锛�
<!-- TODO榛樿鍊煎洖鏄� -->
<a-checkbox-group :default-value="['1']">
- <a-checkbox v-for="(item, index) of checkStrictlyMenu" :value="item.menuId" :key="item.menuId">
- {{ item.menuName }}</a-checkbox>
+ <a-checkbox
+ v-for="(item, index) of checkStrictlyMenu"
+ :key="item.menuId"
+ :value="item.menuId"
+ >
+ {{ item.menuName }}</a-checkbox
+ >
</a-checkbox-group>
</a-space>
<a-divider />
@@ -122,8 +201,13 @@
鐭ヨ瘑搴�:
<!-- TODO榛樿鍊煎洖鏄� -->
<a-checkbox-group :default-value="['1']">
- <a-checkbox v-for="(item, index) of checkStrictlyKnowledge" :value="item.menuId" :key="item.knowledgeId">
- {{ item.knowledgeName }}</a-checkbox>
+ <a-checkbox
+ v-for="(item, index) of checkStrictlyKnowledge"
+ :key="item.knowledgeId"
+ :value="item.menuId"
+ >
+ {{ item.knowledgeName }}</a-checkbox
+ >
</a-checkbox-group>
</a-space>
<a-divider />
@@ -131,13 +215,23 @@
鏅鸿兘浣�:
<!-- TODO榛樿鍊煎洖鏄� -->
<a-checkbox-group :default-value="['1']">
- <a-checkbox v-for="(item, index) of checkStrictlyDialog" :value="item.dialogId" :key="item.menuId">
- {{ item.dialogName }}</a-checkbox>
+ <a-checkbox
+ v-for="(item, index) of checkStrictlyDialog"
+ :key="item.menuId"
+ :value="item.dialogId"
+ >
+ {{ item.dialogName }}</a-checkbox
+ >
</a-checkbox-group>
<!-- TODO榛樿鍊煎洖鏄� -->
<a-checkbox-group :default-value="['1']">
- <a-checkbox v-for="(item, index) of checkStrictlyAgent" :value="item.agentId" :key="item.menuId">
- {{ item.agentName }}</a-checkbox>
+ <a-checkbox
+ v-for="(item, index) of checkStrictlyAgent"
+ :key="item.menuId"
+ :value="item.agentId"
+ >
+ {{ item.agentName }}</a-checkbox
+ >
</a-checkbox-group>
</a-space>
</a-card>
@@ -147,585 +241,580 @@
</template>
<script lang="ts" setup>
-import { computed, reactive, ref, h, onMounted } from 'vue';
-import { useI18n } from 'vue-i18n';
-import useLoading from '@/hooks/loading';
-import { Pagination } from '@/types/global';
-import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
-import {
- DialogList,
- KnowledgeList,
- OrganizationList,
- ResourceList,
- Role,
- RoleList,
- User,
- UserAdd,
- UserChangePwd,
- UserDelete,
- UserEdit,
- UserList,
- Userstatus,
-} from '@/api/authority';
-import { Modal } from '@arco-design/web-vue';
-import Authheader from '@/views/authority/components/authheader.vue';
-import { create } from 'lodash';
-import { queryCanvasList } from '@/api/Agent';
+ import { computed, reactive, ref, h, onMounted } from 'vue';
+ import { useI18n } from 'vue-i18n';
+ import {
+ OrganizationList,
+ RoleList,
+ User,
+ UserAdd,
+ UserDelete,
+ UserEdit,
+ GroupList,
+ Userstatus,
+ } from '@/api/authority';
+ import useLoading from '@/hooks/loading';
+ import { Pagination } from '@/types/global';
+ import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
+ import { Modal } from '@arco-design/web-vue';
+ import Authheader from '@/views/authority/components/authheader.vue';
+ import { create } from 'lodash';
+ import { queryCanvasList } from '@/api/Agent';
-const memberList = ref([
- {
- label: '寮犱笁',
- value: 'zhangsan',
- },
- {
- label: ' 鏉庡洓',
- value: 'lisi',
- },
- {
- label: '寮犱笁',
- value: 'zhangsan',
- },
-]);
-const selectedMemberList = ref(['zhangsan'])
+ const memberList = ref([
+ {
+ label: '寮犱笁',
+ value: 'zhangsan',
+ },
+ {
+ label: ' 鏉庡洓',
+ value: 'lisi',
+ },
+ {
+ label: '寮犱笁',
+ value: 'zhangsan',
+ },
+ ]);
+ const selectedMemberList = ref(['zhangsan']);
-const roles = ref([]);
+ const roles = ref([]);
-const treeData = ref([]);
-const checkedKeys = ref([]);
-const expandKdys = ref([]);
-const checkStrictly = ref([]);
-const checkStrictlyMenu = ref([]);
-const checkStrictlyKnowledge = ref([]);
-const checkStrictlyDialog = ref([]);
-const checkStrictlyAgent = ref([]);
-const checkStrictlyDeptRole = ref([]);
-const formRef = ref();
+ const treeData = ref([]);
+ const checkedKeys = ref([]);
+ const expandKdys = ref([]);
+ const checkStrictly = ref([]);
+ const checkStrictlyMenu = ref([]);
+ const checkStrictlyKnowledge = ref([]);
+ const checkStrictlyDialog = ref([]);
+ const checkStrictlyAgent = ref([]);
+ const checkStrictlyDeptRole = ref([]);
+ const formRef = ref();
-const menuTips = ref(['鏉冮檺绠$悊', '鐢ㄦ埛缁�']);
-type SizeProps = 'mini' | 'small' | 'medium' | 'large';
-const account = ref(null);
-const generateFormModel = () => {
- return {
- name: '',
+ const menuTips = ref(['鏉冮檺绠$悊', '鐢ㄦ埛缁�']);
+ type SizeProps = 'mini' | 'small' | 'medium' | 'large';
+ const account = ref(null);
+ const generateFormModel = () => {
+ return {
+ name: '',
+ };
};
-};
-const showLine = ref(true);
-const { loading, setLoading } = useLoading(true);
-const { t } = useI18n();
-const editModalTitle = ref('鏂板');
-const renderData = ref<User[]>([]);
-const formModel = ref(generateFormModel());
-const editform = ref<User>({
- createTime: '',
- dept: undefined,
- deptName: '',
- email: '',
- nickName: '',
- phoneNumber: '',
- status: '',
- userId: '',
- loginName: '',
- userName: '',
- psw: '',
- role: [],
-});
-
-const size = ref<SizeProps>('medium');
-const visible = ref(false);
-const memberVisible = ref(false);
-const resourcevisible = ref(false);
-const selectUser = ref({});
-
-const loadRole = async () => {
- await RoleList(null).then((res) => {
- roles.value = res.rows;
+ const showLine = ref(true);
+ const { loading, setLoading } = useLoading(true);
+ const { t } = useI18n();
+ const editModalTitle = ref('鏂板');
+ const renderData = ref<User[]>([]);
+ const formModel = ref(generateFormModel());
+ const editform = ref<User>({
+ createTime: '',
+ dept: undefined,
+ deptName: '',
+ email: '',
+ nickName: '',
+ phoneNumber: '',
+ status: '',
+ userId: '',
+ loginName: '',
+ userName: '',
+ psw: '',
+ role: [],
});
-};
-const roleChange = (val) => {
- editform.value.role = val;
-};
+ const size = ref<SizeProps>('medium');
+ const visible = ref(false);
+ const memberVisible = ref(false);
+ const resourcevisible = ref(false);
+ const selectUser = ref({});
-const onCheck = (newCheckedKeys, event) => {
- const o = { deptId: event.node.deptId, deptName: event.node.deptName };
- if (event.checked) {
- event.node.roles.forEach((val) => {
- checkStrictlyDeptRole.value.push(val);
+ const loadRole = async () => {
+ await RoleList(null).then((res) => {
+ roles.value = res.rows;
});
- checkStrictly.value.push(o);
- } else {
- checkStrictly.value.forEach((val, idx, array) => {
- // val: 褰撳墠鍊�
- if (val.deptId == event.node.deptId) {
- checkStrictly.value.splice(idx, 1);
- checkStrictlyDeptRole.value.forEach((val2, idx2, array2) => {
- if (val2.deptId == event.node.deptId) {
- checkStrictlyDeptRole.value.splice(idx2, 1);
- }
- });
- return true;
- }
- });
- }
-};
+ };
-const basePagination: Pagination = {
- current: 1,
- pageSize: 15,
-};
-const pagination = reactive({
- ...basePagination,
-});
+ const roleChange = (val) => {
+ editform.value.role = val;
+ };
-const densityList = computed(() => [
- {
- name: t('searchTable.size.mini'),
- value: 'mini',
- },
- {
- name: t('searchTable.size.small'),
- value: 'small',
- },
- {
- name: t('searchTable.size.medium'),
- value: 'medium',
- },
- {
- name: t('searchTable.size.large'),
- value: 'large',
- },
-]);
-const columns = computed<TableColumnData[]>(() => [
- {
- title: t('搴忓彿'),
- dataIndex: 'index',
- slotName: 'index',
- },
- // TODO 浠ヤ笅闇�瑕佸瓧娈靛鎺�
- {
- title: t('鐢ㄦ埛缁勫悕绉�'),
- dataIndex: 'loginName',
- },
- {
- title: t('鐢ㄦ埛缁勬垚鍛�'),
- dataIndex: 'roleName',
- },
- {
- title: t('鐢ㄦ埛缁勮鏄�'),
- dataIndex: 'deptName',
- slotName: 'deptName',
- },
- {
- title: t('鍒涘缓鏃堕棿'),
- dataIndex: 'deptName',
- slotName: 'deptName',
- },
- {
- title: t('鐘舵��'),
- dataIndex: 'status',
- slotName: 'status',
- },
- {
- title: t('searchTable.columns.operations'),
- dataIndex: 'operations',
- slotName: 'operations',
- },
-]);
-
-const statusChange = async (value, record) => {
- if (record?.dept) {
- await Userstatus(record.userId, value).then((res) => { });
- } else {
- record.status = '0';
- Modal.warning({
- title: '鎻愮ず',
- content: '濡傛兂鍚敤鐢ㄦ埛锛岄渶杩涜閮ㄩ棬閰嶇疆.',
- });
- }
-};
-
-const handleCancel = (type) => {
- if (type == 1) {
- visible.value = false;
- }
- if (type == 2) {
- memberVisible.value = false;
- }
-};
-
-const editDeptHandleOk = async () => {
- const depts: Array = [];
- const user: User = { userId: selectUser.value.userId };
- checkStrictly.value.forEach((val) => {
- depts.push(val.deptId);
- });
- user.dept = depts;
- await UserEdit(user).then((res) => {
- fetchData();
- });
-};
-
-const cb = async (err) => {
- if (err) {
- visible.value = true;
- } else {
- let uuu;
- if (editform.value.userId.length > 0) {
- await UserEdit({
- ...editform.value,
- } as unknown as User).then((res) => {
- fetchData();
- uuu = res.data;
+ const onCheck = (newCheckedKeys, event) => {
+ const o = { deptId: event.node.deptId, deptName: event.node.deptName };
+ if (event.checked) {
+ event.node.roles.forEach((val) => {
+ checkStrictlyDeptRole.value.push(val);
});
+ checkStrictly.value.push(o);
} else {
- await UserAdd({
- ...editform.value,
- } as unknown as User).then((res) => {
- fetchData();
- uuu = res.data;
- });
- }
- if (!uuu.dept) {
- memberVisible.value = true;
- checkedKeys.value = [];
- expandKdys.value = [];
- checkStrictly.value = [];
- selectUser.value = uuu;
- }
- }
-};
-const editHandleOk = () => {
- formRef.value.validate(cb);
-};
-const operation = async (t, record) => {
- if (t == 0) {
- editModalTitle.value = '鏂板';
- visible.value = true;
- editform.value.userId = '';
- editform.value.userName = '';
- editform.value.loginName = '';
- editform.value.nickName = '';
- editform.value.email = '';
- editform.value.phoneNumber = '';
- editform.value.role = '';
- }
- // 鎴愬憳绠$悊
- if (t == 1) {
- memberVisible.value = true;
- }
- // 缂栬緫
- if (t == 2) {
- visible.value = true;
- formRef.value?.resetFields();
- editform.value.role = [];
- editModalTitle.value = '缂栬緫';
- editform.value.userId = record.userId;
- editform.value.userName = record.userName;
- editform.value.loginName = record.loginName;
- editform.value.email = record.email;
- editform.value.phoneNumber = record.phoneNumber;
- if (record.roles?.length > 0) {
- // 閬嶅巻record.roles
- record.roles.forEach((val) => {
- editform.value.role.push(val.roleId);
- });
- }
- }
- // 鍒犻櫎
- if (t == 3) {
- await UserDelete(record.userId).then((res) => {
- if (res.code == 200) {
- fetchData();
- }
- });
- }
- // 鏉冮檺
- if (t == 4) {
- resourcevisible.value = true;
- checkStrictlyMenu.value = [];
- checkStrictlyKnowledge.value = [];
- checkStrictlyDialog.value = [];
- checkStrictlyAgent.value = [];
- selectUser.value = record;
-
- let agents;
- if (record.agents) {
- agents = record.agents;
- } else {
- agents = record.roles ? record.roles[0].agents : null;
- }
- if (agents) {
- agents.forEach((val) => {
- checkStrictlyAgent.value.push({
- agentId: val.id,
- agentName: val.title,
- });
- });
- }
- let resources;
- if (record.resources) {
- resources = record.resources;
- } else {
- resources = record.roles ? record.roles[0].resources : null;
- }
- if (resources) {
- resources.forEach((val) => {
- checkStrictlyMenu.value.push({
- menuId: val.menuId,
- menuName: val.menuName,
- });
- });
- }
- let knowledges;
- if (record.knowledges) {
- knowledges = record.knowledges;
- } else {
- knowledges = record.roles ? record.roles[0].knowledges : null;
- }
- if (knowledges) {
- knowledges.forEach((val) => {
- checkStrictlyKnowledge.value.push({
- knowledgeId: val.id,
- knowledgeName: val.name,
- });
- });
- }
- const dialogs = record.roles ? record.roles[0].dialogs : null;
- if (dialogs) {
- dialogs.forEach((val) => {
- checkStrictlyDialog.value.push({
- dialogId: val.id,
- dialogName: val.name,
- });
- });
- }
- }
-};
-
-const fetchData = async (
- params: Pagination = { current: 1, pageSize: 20 }
-) => {
- setLoading(true);
- try {
- await UserList(params).then((res) => {
- for (const user of res.rows) {
- if (user.dept) {
- for (const d of user.dept) {
- if (user.deptName) {
- user.deptName += `${d.deptName},`;
- } else {
- user.deptName = `${d.deptName},`;
+ checkStrictly.value.forEach((val, idx, array) => {
+ // val: 褰撳墠鍊�
+ if (val.deptId == event.node.deptId) {
+ checkStrictly.value.splice(idx, 1);
+ checkStrictlyDeptRole.value.forEach((val2, idx2, array2) => {
+ if (val2.deptId == event.node.deptId) {
+ checkStrictlyDeptRole.value.splice(idx2, 1);
}
- }
+ });
+ return true;
}
- if (user.roles) {
- for (const r of user.roles) {
- if (user.roleName) {
- user.roleName += `${r.roleName},`;
- } else {
- user.roleName = `${r.roleName},`;
- }
- }
- }
- }
- renderData.value = res.rows;
- console.log(renderData);
- pagination.current = params.current;
- pagination.total = res.total;
- });
- } catch (err) {
- // you can report use errorHandler or other
- } finally {
- setLoading(false);
- }
-};
+ });
+ }
+ };
-const search = () => {
- fetchData({
+ const basePagination: Pagination = {
+ current: 1,
+ pageSize: 15,
+ };
+ const pagination = reactive({
...basePagination,
- ...formModel.value,
- } as unknown as Pagination);
-};
-
-const onPageChange = (current: number) => {
- fetchData({ ...basePagination, current });
-};
-
-const OrganizationData = async (key) => {
- await OrganizationList(key).then((res) => {
- treeData.value = [...res.rows];
});
-};
-fetchData();
-OrganizationData('');
-loadRole();
+ const densityList = computed(() => [
+ {
+ name: t('searchTable.size.mini'),
+ value: 'mini',
+ },
+ {
+ name: t('searchTable.size.small'),
+ value: 'small',
+ },
+ {
+ name: t('searchTable.size.medium'),
+ value: 'medium',
+ },
+ {
+ name: t('searchTable.size.large'),
+ value: 'large',
+ },
+ ]);
+ const columns = computed<TableColumnData[]>(() => [
+ {
+ title: t('搴忓彿'),
+ dataIndex: 'index',
+ slotName: 'index',
+ },
+ // TODO 浠ヤ笅闇�瑕佸瓧娈靛鎺�
+ {
+ title: t('鐢ㄦ埛缁勫悕绉�'),
+ dataIndex: 'loginName',
+ },
+ {
+ title: t('鐢ㄦ埛缁勬垚鍛�'),
+ dataIndex: 'roleName',
+ },
+ {
+ title: t('鐢ㄦ埛缁勮鏄�'),
+ dataIndex: 'deptName',
+ slotName: 'deptName',
+ },
+ {
+ title: t('鍒涘缓鏃堕棿'),
+ dataIndex: 'deptName',
+ slotName: 'deptName',
+ },
+ {
+ title: t('鐘舵��'),
+ dataIndex: 'status',
+ slotName: 'status',
+ },
+ {
+ title: t('searchTable.columns.operations'),
+ dataIndex: 'operations',
+ slotName: 'operations',
+ },
+ ]);
-const reset = () => {
- formModel.value = generateFormModel();
-};
+ const statusChange = async (value, record) => {
+ if (record?.dept) {
+ await Userstatus(record.userId, value).then((res) => {});
+ } else {
+ record.status = '0';
+ Modal.warning({
+ title: '鎻愮ず',
+ content: '濡傛兂鍚敤鐢ㄦ埛锛岄渶杩涜閮ㄩ棬閰嶇疆.',
+ });
+ }
+ };
-const handleSelectDensity = (
- val: string | number | Record<string, any> | undefined,
- e: Event
-) => {
- size.value = val as SizeProps;
-};
+ const handleCancel = (type) => {
+ if (type == 1) {
+ visible.value = false;
+ }
+ if (type == 2) {
+ memberVisible.value = false;
+ }
+ };
+
+ const editDeptHandleOk = async () => {
+ const depts: Array = [];
+ const user: User = { userId: selectUser.value.userId };
+ checkStrictly.value.forEach((val) => {
+ depts.push(val.deptId);
+ });
+ user.dept = depts;
+ await UserEdit(user).then((res) => {
+ fetchData();
+ });
+ };
+
+ const cb = async (err) => {
+ if (err) {
+ visible.value = true;
+ } else {
+ let uuu;
+ if (editform.value.userId.length > 0) {
+ await UserEdit({
+ ...editform.value,
+ } as unknown as User).then((res) => {
+ fetchData();
+ uuu = res.data;
+ });
+ } else {
+ await UserAdd({
+ ...editform.value,
+ } as unknown as User).then((res) => {
+ fetchData();
+ uuu = res.data;
+ });
+ }
+ if (!uuu.dept) {
+ memberVisible.value = true;
+ checkedKeys.value = [];
+ expandKdys.value = [];
+ checkStrictly.value = [];
+ selectUser.value = uuu;
+ }
+ }
+ };
+ const editHandleOk = () => {
+ formRef.value.validate(cb);
+ };
+ const operation = async (t, record) => {
+ if (t == 0) {
+ editModalTitle.value = '鏂板';
+ visible.value = true;
+ editform.value.userId = '';
+ editform.value.userName = '';
+ editform.value.loginName = '';
+ editform.value.nickName = '';
+ editform.value.email = '';
+ editform.value.phoneNumber = '';
+ editform.value.role = '';
+ }
+ // 鎴愬憳绠$悊
+ if (t == 1) {
+ memberVisible.value = true;
+ }
+ // 缂栬緫
+ if (t == 2) {
+ visible.value = true;
+ formRef.value?.resetFields();
+ editform.value.role = [];
+ editModalTitle.value = '缂栬緫';
+ editform.value.userId = record.userId;
+ editform.value.userName = record.userName;
+ editform.value.loginName = record.loginName;
+ editform.value.email = record.email;
+ editform.value.phoneNumber = record.phoneNumber;
+ if (record.roles?.length > 0) {
+ // 閬嶅巻record.roles
+ record.roles.forEach((val) => {
+ editform.value.role.push(val.roleId);
+ });
+ }
+ }
+ // 鍒犻櫎
+ if (t == 3) {
+ await UserDelete(record.userId).then((res) => {
+ if (res.code == 200) {
+ fetchData();
+ }
+ });
+ }
+ // 鏉冮檺
+ if (t == 4) {
+ resourcevisible.value = true;
+ checkStrictlyMenu.value = [];
+ checkStrictlyKnowledge.value = [];
+ checkStrictlyDialog.value = [];
+ checkStrictlyAgent.value = [];
+ selectUser.value = record;
+
+ let agents;
+ if (record.agents) {
+ agents = record.agents;
+ } else {
+ agents = record.roles ? record.roles[0].agents : null;
+ }
+ if (agents) {
+ agents.forEach((val) => {
+ checkStrictlyAgent.value.push({
+ agentId: val.id,
+ agentName: val.title,
+ });
+ });
+ }
+ let resources;
+ if (record.resources) {
+ resources = record.resources;
+ } else {
+ resources = record.roles ? record.roles[0].resources : null;
+ }
+ if (resources) {
+ resources.forEach((val) => {
+ checkStrictlyMenu.value.push({
+ menuId: val.menuId,
+ menuName: val.menuName,
+ });
+ });
+ }
+ let knowledges;
+ if (record.knowledges) {
+ knowledges = record.knowledges;
+ } else {
+ knowledges = record.roles ? record.roles[0].knowledges : null;
+ }
+ if (knowledges) {
+ knowledges.forEach((val) => {
+ checkStrictlyKnowledge.value.push({
+ knowledgeId: val.id,
+ knowledgeName: val.name,
+ });
+ });
+ }
+ const dialogs = record.roles ? record.roles[0].dialogs : null;
+ if (dialogs) {
+ dialogs.forEach((val) => {
+ checkStrictlyDialog.value.push({
+ dialogId: val.id,
+ dialogName: val.name,
+ });
+ });
+ }
+ }
+ };
+
+ const fetchData = async (
+ params: Pagination = { current: 1, pageSize: 20 }
+ ) => {
+ setLoading(true);
+ try {
+ await GroupList(params).then((res) => {
+ for (const user of res.rows) {
+ if (user.dept) {
+ for (const d of user.dept) {
+ if (user.deptName) {
+ user.deptName += `${d.deptName},`;
+ } else {
+ user.deptName = `${d.deptName},`;
+ }
+ }
+ }
+ if (user.roles) {
+ for (const r of user.roles) {
+ if (user.roleName) {
+ user.roleName += `${r.roleName},`;
+ } else {
+ user.roleName = `${r.roleName},`;
+ }
+ }
+ }
+ }
+ renderData.value = res.rows;
+ console.log(renderData);
+ pagination.current = params.current;
+ pagination.total = res.total;
+ });
+ } catch (err) {
+ // you can report use errorHandler or other
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const search = () => {
+ fetchData({
+ ...basePagination,
+ ...formModel.value,
+ } as unknown as Pagination);
+ };
+
+ const onPageChange = (current: number) => {
+ fetchData({ ...basePagination, current });
+ };
+
+ const OrganizationData = async (key) => {
+ await OrganizationList(key).then((res) => {
+ treeData.value = [...res.rows];
+ });
+ };
+
+ fetchData();
+ OrganizationData('');
+ loadRole();
+
+ const reset = () => {
+ formModel.value = generateFormModel();
+ };
+
+ const handleSelectDensity = (
+ val: string | number | Record<string, any> | undefined,
+ e: Event
+ ) => {
+ size.value = val as SizeProps;
+ };
</script>
<style scoped lang="less">
-.card-demo {
- width: 460px;
- margin-left: 24px;
- transition-property: all;
-}
+ .card-demo {
+ width: 460px;
+ margin-left: 24px;
+ transition-property: all;
+ }
-.card-demo:hover {
- transform: translateY(-4px);
-}
+ .card-demo:hover {
+ transform: translateY(-4px);
+ }
-.table-page-search-wrapper {
- padding-top: 10px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
- padding-bottom: 10px;
- border-bottom: 1px solid #e8e8e8;
-
- .search-wrapper {
+ .table-page-search-wrapper {
+ padding-top: 10px;
display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ padding-bottom: 10px;
+ border-bottom: 1px solid #e8e8e8;
- .wrapper-icon {
+ .search-wrapper {
display: flex;
- align-items: center;
- margin-left: 40px;
- // margin-right: 40px;
- }
- }
-}
-.space_select_all {
- display: flex;
- justify-content: end;
- margin-bottom: 15px;
-}
-
-.table_box {
- display: flex;
-
- border: 1px solid #e8e8e8;
- border-bottom: none;
-
- .row1_clo {
- min-width: 200px;
- display: flex;
- padding-left: 20px;
- border-right: 1px solid #e8e8e8;
- }
-
- .table_row1 {
- width: 100%;
-
- .row1_list {
- display: flex;
- min-height: 40px;
- border-bottom: 1px solid #e8e8e8;
- // line-height: 40px;
- }
- }
-
- .row1_clo2 {
- width: 100%;
- border-top: none;
-
- .row2_clo2_1 {
- display: flex;
- width: 100%;
- min-height: 40px;
- line-height: 40px;
- border-bottom: 1px solid #e8e8e8;
-
- .row1_clo2_1 {
- border-right: 1px solid #e8e8e8;
- min-width: 310px;
- padding-left: 20px;
- }
-
- .row1_clo2_2 {
- border-top: none;
- border-right: none;
- width: 100%;
+ .wrapper-icon {
display: flex;
- flex-wrap: wrap;
-
- div {
- margin-left: 20px;
- }
+ align-items: center;
+ margin-left: 40px;
+ // margin-right: 40px;
}
}
}
- .row2_clo2_1:last-child {
- border-bottom: none;
- }
-}
-
-:deep(.arco-transfer-view) {
- width: 250px;
- height: 400px
-}
-</style>
-
-<style lang="less">
-.ant-table-wrapper {
- .ant-table-tbody {
- tr {
- td {
- .ant-table-row-cell-break-word {
- .ant-table-column-sorter {
- display: none;
- }
- }
- }
- }
+ .space_select_all {
+ display: flex;
+ justify-content: end;
+ margin-bottom: 15px;
}
- .search-wrapper {
+ .table_box {
display: flex;
- .wrapper-icon {
+ border: 1px solid #e8e8e8;
+ border-bottom: none;
+
+ .row1_clo {
+ min-width: 200px;
display: flex;
- align-items: center;
- margin-left: 40px;
- // margin-right: 40px;
+ padding-left: 20px;
+ border-right: 1px solid #e8e8e8;
+ }
+
+ .table_row1 {
+ width: 100%;
+
+ .row1_list {
+ display: flex;
+ min-height: 40px;
+ border-bottom: 1px solid #e8e8e8;
+ // line-height: 40px;
+ }
+ }
+
+ .row1_clo2 {
+ width: 100%;
+ border-top: none;
+
+ .row2_clo2_1 {
+ display: flex;
+ width: 100%;
+ min-height: 40px;
+ line-height: 40px;
+ border-bottom: 1px solid #e8e8e8;
+
+ .row1_clo2_1 {
+ border-right: 1px solid #e8e8e8;
+ min-width: 310px;
+ padding-left: 20px;
+ }
+
+ .row1_clo2_2 {
+ border-top: none;
+ border-right: none;
+ width: 100%;
+ display: flex;
+ flex-wrap: wrap;
+
+ div {
+ margin-left: 20px;
+ }
+ }
+ }
+ }
+
+ .row2_clo2_1:last-child {
+ border-bottom: none;
}
}
-}
+
+ :deep(.arco-transfer-view) {
+ width: 250px;
+ height: 400px;
+ }
</style>
<style lang="less">
-.ant-table-wrapper {
- .ant-table-tbody {
- tr {
- td {
- .ant-table-row-cell-break-word {
- .ant-table-column-sorter {
- display: none;
+ .ant-table-wrapper {
+ .ant-table-tbody {
+ tr {
+ td {
+ .ant-table-row-cell-break-word {
+ .ant-table-column-sorter {
+ display: none;
+ }
+ }
+ }
+ }
+ }
+
+ .search-wrapper {
+ display: flex;
+
+ .wrapper-icon {
+ display: flex;
+ align-items: center;
+ margin-left: 40px;
+ // margin-right: 40px;
+ }
+ }
+ }
+</style>
+
+<style lang="less">
+ .ant-table-wrapper {
+ .ant-table-tbody {
+ tr {
+ td {
+ .ant-table-row-cell-break-word {
+ .ant-table-column-sorter {
+ display: none;
+ }
}
}
}
}
}
-}
</style>
<style lang="less" scoped>
-.table-page-search-wrapper {
- .ant-form-inline {
- :deep(.ant-form-item) {
- display: flex;
+ .table-page-search-wrapper {
+ .ant-form-inline {
+ :deep(.ant-form-item) {
+ display: flex;
+ }
}
}
-}
</style>
--
Gitblit v1.8.0