门禁授权操作优化
This commit is contained in:
parent
d24d03457a
commit
bef5cc55e9
1
apps/web-antd/src/api/common.d.ts
vendored
1
apps/web-antd/src/api/common.d.ts
vendored
@ -51,5 +51,6 @@ export interface TreeNode<T = any> {
|
|||||||
|
|
||||||
title?: string;
|
title?: string;
|
||||||
key?:any
|
key?:any
|
||||||
|
disabled: boolean
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ export function authRecordInfo(id: ID) {
|
|||||||
* @returns void
|
* @returns void
|
||||||
*/
|
*/
|
||||||
export function authRecordAdd(data: AuthRecordForm) {
|
export function authRecordAdd(data: AuthRecordForm) {
|
||||||
return requestClient.postWithMsg<void>('/sis/authRecord', data);
|
return requestClient.postWithMsg<void>('/sis/authRecord/add', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
10
apps/web-antd/src/api/sis/authRecord/model.d.ts
vendored
10
apps/web-antd/src/api/sis/authRecord/model.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import type { PageQuery, BaseEntity } from '#/api/common';
|
import type { BaseEntity, PageQuery } from '#/api/common';
|
||||||
|
|
||||||
export interface AuthRecordVO {
|
export interface AuthRecordVO {
|
||||||
/**
|
/**
|
||||||
@ -15,25 +15,25 @@ export interface AuthRecordVO {
|
|||||||
* 门禁id
|
* 门禁id
|
||||||
*/
|
*/
|
||||||
acdId: string | number;
|
acdId: string | number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AuthRecordForm extends BaseEntity {
|
export interface AuthRecordForm extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
id?: string | number;
|
libId?: string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人像id
|
* 人像id
|
||||||
*/
|
*/
|
||||||
imgId?: string | number;
|
imgIds?: string[] | number[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 门禁id
|
* 门禁id
|
||||||
*/
|
*/
|
||||||
acdId?: string | number;
|
acIds?: string[] | number[];
|
||||||
|
|
||||||
|
issue: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AuthRecordQuery extends PageQuery {
|
export interface AuthRecordQuery extends PageQuery {
|
||||||
|
@ -5,11 +5,12 @@ import { useVbenModal } from '@vben/common-ui';
|
|||||||
import { useBeforeCloseDiff } from '#/utils/popup';
|
import { useBeforeCloseDiff } from '#/utils/popup';
|
||||||
import { Switch, Transfer, Tree } from 'ant-design-vue';
|
import { Switch, Transfer, Tree } from 'ant-design-vue';
|
||||||
import { queryTree } from '#/api/sis/accessControl';
|
import { queryTree } from '#/api/sis/accessControl';
|
||||||
|
import { authRecordAdd } from '#/api/sis/authRecord';
|
||||||
import type { TreeNode } from '#/api/common';
|
import type { TreeNode } from '#/api/common';
|
||||||
|
import type { AuthRecordForm } from '#/api/sis/authRecord/model';
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
const title = ref('门禁授权');
|
const title = ref('门禁授权');
|
||||||
|
|
||||||
const { onBeforeClose } = useBeforeCloseDiff({});
|
const { onBeforeClose } = useBeforeCloseDiff({});
|
||||||
|
|
||||||
const [BasicModal, modalApi] = useVbenModal({
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
@ -19,20 +20,29 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
onBeforeClose,
|
onBeforeClose,
|
||||||
onClosed: handleClosed,
|
onClosed: handleClosed,
|
||||||
onConfirm: handleConfirm,
|
onConfirm: handleConfirm,
|
||||||
|
onOpenChange: async (isOpen) => {
|
||||||
|
if (!isOpen) {
|
||||||
|
checked.value = false;
|
||||||
|
targetKeys.value = []
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
async function handleConfirm() {
|
async function handleConfirm() {
|
||||||
try {
|
try {
|
||||||
modalApi.lock(true);
|
modalApi.lock(true);
|
||||||
|
const { ids, libId } = modalApi.getData() as {
|
||||||
/*const { valid } = await formApi.validate();
|
ids?: number[] | string[];
|
||||||
if (!valid) {
|
libId: number | string;
|
||||||
return;
|
};
|
||||||
}
|
const params: AuthRecordForm = {
|
||||||
const data = cloneDeep(await formApi.getValues());
|
libId,
|
||||||
await (isUpdate.value ? personLibImgUpdate(data) : personLibImgAdd(data));*/
|
imgIds: ids,
|
||||||
|
acIds: targetKeys.value,
|
||||||
// resetInitialized();
|
issue: checked.value
|
||||||
|
};
|
||||||
|
const res = await authRecordAdd(params);
|
||||||
|
console.log(res);
|
||||||
emit('reload');
|
emit('reload');
|
||||||
modalApi.close();
|
modalApi.close();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -60,6 +70,10 @@ function handleTreeData(treeData: TreeNode[] | any[], datasource: TreeNode[]) {
|
|||||||
treeData.forEach((item) => {
|
treeData.forEach((item) => {
|
||||||
item.title = item.label;
|
item.title = item.label;
|
||||||
item.key = item.code;
|
item.key = item.code;
|
||||||
|
// 如果不是门禁,则
|
||||||
|
if (item.level != 5) {
|
||||||
|
item.disabled = true;
|
||||||
|
}
|
||||||
datasource.push(item);
|
datasource.push(item);
|
||||||
if (item.children) {
|
if (item.children) {
|
||||||
handleTreeData(item.children, datasource);
|
handleTreeData(item.children, datasource);
|
||||||
@ -102,7 +116,7 @@ function isChecked(
|
|||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<Transfer
|
<Transfer
|
||||||
v-model:target-keys="targetKeys"
|
v-model:target-keys="targetKeys"
|
||||||
class="tree-transfer h-[400px]"
|
class="tree-transfer h-[400px] overflow-auto"
|
||||||
:data-source="dataSource"
|
:data-source="dataSource"
|
||||||
:render="(item) => item.title"
|
:render="(item) => item.title"
|
||||||
>
|
>
|
||||||
|
@ -129,7 +129,9 @@ function handleDownloadExcel() {
|
|||||||
* 对图像进行门禁授权
|
* 对图像进行门禁授权
|
||||||
*/
|
*/
|
||||||
function accessControlAuth() {
|
function accessControlAuth() {
|
||||||
authModalApi.setData({});
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<PersonLibImgForm>) => row.id);
|
||||||
|
authModalApi.setData({ ids, libId: rows[0].libId });
|
||||||
authModalApi.open();
|
authModalApi.open();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user