ow
This commit is contained in:
1 parent
1404640f16
commit
2bbf016cbf
167 files changed
+18941
-589
No files matched your search
@@ -0,0 +1,856 @@
|
||||
<template>
|
||||
<a-spin size="large" :spinning="loading">
|
||||
<div class="page-container">
|
||||
<div class="page-header">
|
||||
<a-row :gutter="[16, 8]">
|
||||
<a-col :lg="8" :sm="24">
|
||||
<a-row :wrap="false">
|
||||
<a-col flex="none">
|
||||
<div style="padding: 0 "><a-input flex="none" readonly value="组别名称"
|
||||
class="site-input-split" style="width: 160px;border-radius:0; border-top-left-radius: 5pt 5pt;
|
||||
border-bottom-left-radius: 5pt 5pt;
|
||||
pointer-events: none" /></div>
|
||||
</a-col>
|
||||
<a-col flex="auto">
|
||||
<a-input-search :disabled="isEdit" v-model:value="groupName" flex="auto"
|
||||
@search="onModalSearch" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :lg="12" :sm="24">
|
||||
<a-space>
|
||||
<a-button type="primary" :disabled="isEdit" :icon="h(FileSearchOutlined)"
|
||||
@click.prevent="onSearch">查询</a-button>
|
||||
<a-button type="primary" :disabled="isEdit" :icon="h(ClearOutlined)"
|
||||
@click.prevent="onReset">重置</a-button>
|
||||
<a-button type="primary" :disabled="isEdit" :icon="h(FileAddOutlined)"
|
||||
@click.prevent="onCreate">新增</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
<div class="page-main" :style="{ height: resultH }">
|
||||
<a-row :gutter="[16, 8]">
|
||||
<a-col :lg="8" :sm="24">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :lg="6" :sm="6" style="min-width: 80px;">
|
||||
<span>组别名称:</span>
|
||||
</a-col>
|
||||
<a-col :lg="18" :sm="18" style="min-width: 300px;">
|
||||
<a-input :maxlength="50" required :readonly="!isEdit"
|
||||
v-model:value="data.SecurityGroup.GroupName" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :lg="{ span: 8, offset: 2 }" :sm="24">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :lg="6" :sm="6" style="min-width: 80px;">
|
||||
<span>中文名称:</span>
|
||||
</a-col>
|
||||
<a-col :lg="18" :sm="18" style="min-width: 300px;">
|
||||
<a-input :maxlength="500" required :readonly="!isEdit"
|
||||
v-model:value="data.SecurityGroup.GroupLocalName" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[16, 8]" style="margin-top: 8px;">
|
||||
<a-col :lg="8" :sm="24">
|
||||
<a-row :wrap="false" align="middle">
|
||||
<a-col :lg="6" :sm="6" style="min-width: 80px;">
|
||||
<span>英文名称:</span>
|
||||
</a-col>
|
||||
<a-col :lg="18" :sm="18" style="min-width: 300px;">
|
||||
<a-input :maxlength="50" :readonly="!isEdit"
|
||||
v-model:value="data.SecurityGroup.GroupEngName" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-col>
|
||||
<a-col :lg="{ span: 8, offset: 2 }" :sm="24">
|
||||
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-divider orientation="left" orientation-margin="0px" dashed style="background-color: silver">
|
||||
|
||||
</a-divider>
|
||||
<a-collapse v-model:activeKey="activeKey">
|
||||
<a-collapse-panel key="1" header="权限明细">
|
||||
<a-table bordered :data-source="data.SecurityGroupPermissionViews" :columns="columnPermissions"
|
||||
:pagination="false" :scroll="{ x: 520, y: 600 }">
|
||||
<template #bodyCell="datas">
|
||||
<template v-if="datas.column.dataIndex === 'index'">
|
||||
<span>{{ datas.index + 1 }}</span>
|
||||
</template>
|
||||
<template v-if="datas.column.dataIndex === SecurityGroupPermissionViewEntity.DEPENDENT">
|
||||
<span v-if="isEdit" style="color: blue;font-size:18px;cursor: pointer;"
|
||||
@click="addPermissionDependent(datas.record.Dependent)">{{
|
||||
datas.record.Dependent
|
||||
}}</span>
|
||||
<span v-else style="color: #000;font-size:20px;">{{
|
||||
datas.record.Dependent
|
||||
}}</span>
|
||||
</template>
|
||||
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.IS_VIEW">
|
||||
<a-checkbox :disabled="!isEdit" v-model:checked="datas.record.IsView" />
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.IS_CREATE">
|
||||
<a-checkbox :disabled="!isEdit" v-model:checked="datas.record.IsCreate" />
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.IS_AMEND">
|
||||
<a-checkbox :disabled="!isEdit" v-model:checked="datas.record.IsAmend" />
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.IS_DELETE">
|
||||
<a-checkbox :disabled="!isEdit" v-model:checked="datas.record.IsDelete" />
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.PERMISSION_NAME && !isEdit">
|
||||
<span style="color: blue;font-size:18px;cursor: pointer;"
|
||||
@click="onViewPermissionOperation(datas.record.PermissionName)"> {{
|
||||
datas.record.PermissionName
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-else-if="datas.column.dataIndex === 'operation' && isEdit">
|
||||
<DeleteOutlined :style="{ fontSize: '24px', color: 'red' }"
|
||||
@click="deletePermission(datas.record.PermissionName)" />
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<template #extra v-if="isEdit">
|
||||
<PlusSquareTwoTone :style="{ fontSize: '24px', color: '#08c' }" @click="addPermission" />
|
||||
</template>
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel key="2" header="扩展权限明细">
|
||||
<a-table bordered :data-source="data.SecurityGroupPermissionDependentViews"
|
||||
:columns="columnPermissionDependents" :pagination="false" :scroll="{ x: 520, y: 600 }">
|
||||
<template #bodyCell="datas">
|
||||
<template v-if="datas.column.dataIndex === 'index'">
|
||||
<span>{{ datas.index + 1 }}</span>
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.IS_VIEW">
|
||||
<a-checkbox :disabled="!isEdit" v-model:checked="datas.record.IsView" />
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.IS_CREATE">
|
||||
<a-checkbox :disabled="!isEdit" v-model:checked="datas.record.IsCreate" />
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.IS_AMEND">
|
||||
<a-checkbox :disabled="!isEdit" v-model:checked="datas.record.IsAmend" />
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityGroupPermissionViewDisplayData.IS_DELETE">
|
||||
<a-checkbox :disabled="!isEdit" v-model:checked="datas.record.IsDelete" />
|
||||
</template>
|
||||
<template v-else-if="datas.column.dataIndex === 'operation' && isEdit">
|
||||
<DeleteOutlined :style="{ fontSize: '24px', color: 'red' }"
|
||||
@click="deletePermissionDependent(datas.record.DependentDetailName)" />
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel key="3" header="组别内的角色群">
|
||||
<a-table bordered :data-source="data.SecurityActorGroups" :columns="columnActors"
|
||||
:pagination="false" :scroll="{ x: 520, y: 600 }">
|
||||
<template #bodyCell="datas">
|
||||
<template v-if="datas.column.dataIndex === 'index'">
|
||||
<span>{{ datas.index + 1 }}</span>
|
||||
</template>
|
||||
<template
|
||||
v-else-if="datas.column.dataIndex === SecurityActorGroupViewEntity.ACTOR_NAME && !isEdit">
|
||||
<span style="color: blue;font-size:18px;cursor: pointer;"
|
||||
@click="onViewActorOperation(datas.record.ActorName)"> {{ datas.record.ActorName
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-else-if="datas.column.dataIndex === 'operation' && isEdit">
|
||||
<DeleteOutlined :style="{ fontSize: '24px', color: 'red' }"
|
||||
@click="deleteActor(datas.record.ActorName)" />
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<template #extra v-if="isEdit">
|
||||
<PlusSquareTwoTone :style="{ fontSize: '24px', color: '#08c' }" @click="addActor" />
|
||||
</template>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
</div>
|
||||
<div class="page-footer">
|
||||
<div style="">
|
||||
<a-row :gutter="24">
|
||||
<a-col :lg="24" :sm="24">
|
||||
<div>
|
||||
<a-row v-if="isEdit" :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-popconfirm v-if="data.SecurityGroup.CreatedBy" title="确定是否取消修改?" ok-text="是"
|
||||
cancel-text="否" @confirm="onCancel">
|
||||
<a-button type="primary" ghost :icon="h(UndoOutlined)">取消</a-button>
|
||||
</a-popconfirm>
|
||||
<a-button v-if="!data.SecurityGroup.CreatedBy" type="primary" ghost
|
||||
:icon="h(UndoOutlined)" @click.prevent="onCancel">取消</a-button>
|
||||
<a-button type="primary" ghost :icon="h(SaveOutlined)"
|
||||
@click.prevent="onSave">保存</a-button>
|
||||
</a-space>
|
||||
</a-row>
|
||||
<a-row v-else :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-button type="primary" v-if="canAmend" :icon="h(EditOutlined)"
|
||||
:disabled="!hasData" @click.prevent="onAmend">修改</a-button>
|
||||
<a-popconfirm :disabled="!hasData" title="确定是否删除这条记录?" ok-text="是"
|
||||
cancel-text="否" @confirm="onDelete">
|
||||
<a-button type="primary" danger :icon="h(DeleteOutlined)"
|
||||
:disabled="!hasData" v-if="canDelete">删除</a-button>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</a-row>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<dragModal v-model:open="modelOption.isModalGroup" width="80%" title="组别查询" @cancel="handleCance"
|
||||
:fullscreen="width < 640" :mask-closable="false" @ok="handleSelect">
|
||||
<GroupEnquiry ref="enquiry" @on-row-dblclick="handleSelect"></GroupEnquiry>
|
||||
</dragModal>
|
||||
<dragModal v-model:open="modelOption.isModalPermission" width="80%" title="权限查询" @cancel="handleCance"
|
||||
:fullscreen="width < 640" :mask-closable="false" @ok="handleSelectPermission">
|
||||
<PermissionEnquiry ref="permissionEnquiry" @on-row-dblclick="handleSelectPermission"></PermissionEnquiry>
|
||||
</dragModal>
|
||||
<dragModal v-model:open="modelOption.isModalPermissionDependent" width="80%" title="扩展权限查询"
|
||||
:fullscreen="width < 640" @cancel="handleCance" :mask-closable="false"
|
||||
@ok="handleSelectPermissionDependent">
|
||||
<PermissionDependentModal ref="permissionDependentEnquiry"
|
||||
@on-row-dblclick="handleSelectPermissionDependent">
|
||||
</PermissionDependentModal>
|
||||
</dragModal>
|
||||
<dragModal v-model:open="modelOption.isModalActor" width="80%" title="角色查询" @cancel="handleCance"
|
||||
:fullscreen="width < 640" :mask-closable="false" @ok="handleSelectActor">
|
||||
<ActorEnquiry ref="actorEnquiry" @on-row-dblclick="handleSelectActor"></ActorEnquiry>
|
||||
</dragModal>
|
||||
</a-spin>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { ref, unref, onBeforeMount, inject, provide, h, onMounted } from "vue";
|
||||
import { notification } from "ant-design-vue";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { DeleteOutlined, EditOutlined, ClearOutlined, FileSearchOutlined, FileAddOutlined, UndoOutlined, SaveOutlined, PlusSquareTwoTone, DownSquareTwoTone, UpSquareTwoTone } from "@ant-design/icons-vue";
|
||||
import { PermissionContext, usePermissionContext } from "@/hooks/PermissionContext"
|
||||
import dragModal from "@/components/basic/DragModal.vue"
|
||||
import GroupEnquiry from "./GroupEnquiry.vue";
|
||||
import PermissionEnquiry from "./PermissionEnquiry.vue";
|
||||
import ActorEnquiry from "./ActorEnquiry.vue";
|
||||
import PermissionDependentModal from "./PermissionDependentModal.vue";
|
||||
import { SecurityGroupData } from "@/data/auto/securityGroupData";
|
||||
import { SecurityGroupPermissionViewEntity } from "@/data/auto/securityGroupPermissionViewEntity";
|
||||
import { SecurityGroupPermissionViewDisplayData } from "@/data/auto/securityGroupPermissionViewDisplayData";
|
||||
import { SecurityGroupPermissionDependentViewDisplayData } from "@/data/auto/securityGroupPermissionDependentViewDisplayData";
|
||||
import SecurityGroupService from "@/service/security/securityGroupService";
|
||||
import { useYesNoPolicy } from "@/hooks/useYesNoPolicy"
|
||||
import { SelectOption } from "@/data/auto/selectOption";
|
||||
import { useWindowSize } from '@vueuse/core'
|
||||
import { SecurityGroupEntity } from "@/data/auto/securityGroupEntity";
|
||||
import { BindOption } from "@/data/custom/bindOption";
|
||||
import { SecurityPermissionEntity } from "@/data/auto/securityPermissionEntity";
|
||||
import { SecurityPermissionDependentEntity } from "@/data/auto/securityPermissionDependentEntity";
|
||||
import { SecurityActorGroupViewEntity } from "@/data/auto/securityActorGroupViewEntity";
|
||||
import { SecurityActorEntity } from "@/data/auto/securityActorEntity";
|
||||
import { operationToEnquiryMethodKey, OperationToEnquiryModelOption } from "@/injections"
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const groupName = ref<string>(route.params.id as string)
|
||||
const mode = ref<string>(route.params.mode as string)
|
||||
|
||||
const loading = ref<boolean>(false);
|
||||
const { width, height } = useWindowSize()
|
||||
|
||||
|
||||
const isEdit = ref<boolean>(false);
|
||||
const canAmend = ref<boolean>(false);
|
||||
const canDelete = ref<boolean>(false);
|
||||
const canCreate = ref<boolean>(false);
|
||||
|
||||
|
||||
const showModalType = ref<number>(0);
|
||||
|
||||
const data = ref<SecurityGroupData>(new SecurityGroupData());
|
||||
const hasData = ref<boolean>(false);
|
||||
|
||||
const yesNoPolicy = ref<SelectOption[]>([]);
|
||||
const resultH = ref('');
|
||||
const oldGroupName = ref<string>(groupName.value);
|
||||
|
||||
interface GroupEnquiry {
|
||||
keys: SecurityGroupEntity[],
|
||||
setBindOptionValue(bindValue: string, value: string, value1: string, values: string[]): void,
|
||||
}
|
||||
interface PermissionEnquiry {
|
||||
keys: SecurityPermissionEntity[],
|
||||
setBindOptionValue(bindValue: string, value: string, value1: string, values: string[]): void,
|
||||
}
|
||||
|
||||
interface PermissionDependentEnquiry {
|
||||
keys: SecurityPermissionDependentEntity[],
|
||||
setBindOptionValue(bindValue: string, value: string, value1: string, values: string[]): void,
|
||||
}
|
||||
|
||||
interface ActorEnquiry {
|
||||
keys: SecurityActorEntity[],
|
||||
setBindOptionValue(bindValue: string, value: string, value1: string, values: string[]): void,
|
||||
}
|
||||
|
||||
const enquiry = ref<GroupEnquiry | null>(null)
|
||||
const permissionEnquiry = ref<PermissionEnquiry | null>(null)
|
||||
const permissionDependentEnquiry = ref<PermissionDependentEnquiry | null>(null)
|
||||
const actorEnquiry = ref<ActorEnquiry | null>(null)
|
||||
|
||||
const activeKey = ref(['1', '2', '3']);
|
||||
|
||||
const columnPermissions = ref([
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
width: '5%',
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
sequence: 0,
|
||||
hidden: 'N',
|
||||
format: ''
|
||||
},
|
||||
{
|
||||
title: "权限名称",
|
||||
dataIndex: SecurityGroupPermissionViewEntity.PERMISSION_NAME,
|
||||
width: '20%',
|
||||
sequence: 1,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "中文名称",
|
||||
dataIndex: SecurityGroupPermissionViewEntity.PERMISSION_DESCRIPTION,
|
||||
width: '20%',
|
||||
sequence: 2,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "扩展名称",
|
||||
dataIndex: SecurityGroupPermissionViewEntity.DEPENDENT,
|
||||
width: '10%',
|
||||
sequence: 3,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "查看",
|
||||
dataIndex: SecurityGroupPermissionViewDisplayData.IS_VIEW,
|
||||
width: '5%',
|
||||
sequence: 4,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "新增",
|
||||
dataIndex: SecurityGroupPermissionViewDisplayData.IS_CREATE,
|
||||
width: '5%',
|
||||
sequence: 5,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "修改",
|
||||
dataIndex: SecurityGroupPermissionViewDisplayData.IS_AMEND,
|
||||
width: '5%',
|
||||
sequence: 6,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "删除",
|
||||
dataIndex: SecurityGroupPermissionViewDisplayData.IS_DELETE,
|
||||
width: '5%',
|
||||
sequence: 7,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "",
|
||||
dataIndex: 'operation',
|
||||
width: '5%',
|
||||
sequence: 8,
|
||||
hidden: 'N'
|
||||
}
|
||||
]);
|
||||
|
||||
const columnPermissionDependents = ref([
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
width: '5%',
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
sequence: 0,
|
||||
hidden: 'N',
|
||||
format: ''
|
||||
},
|
||||
{
|
||||
title: "扩展名称",
|
||||
dataIndex: SecurityGroupPermissionDependentViewDisplayData.DEPENDENT,
|
||||
width: '15%',
|
||||
sequence: 1,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "扩展子项目名称",
|
||||
dataIndex: SecurityGroupPermissionDependentViewDisplayData.DEPENDENT_DETAIL_NAME,
|
||||
width: '20%',
|
||||
sequence: 2,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "扩展子项目中文",
|
||||
dataIndex: SecurityGroupPermissionDependentViewDisplayData.DEPENDENT_DETAIL_DESCRIPTION,
|
||||
width: '10%',
|
||||
sequence: 3,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "查看",
|
||||
dataIndex: SecurityGroupPermissionDependentViewDisplayData.IS_VIEW,
|
||||
width: '5%',
|
||||
sequence: 4,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "新增",
|
||||
dataIndex: SecurityGroupPermissionDependentViewDisplayData.IS_CREATE,
|
||||
width: '5%',
|
||||
sequence: 5,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "修改",
|
||||
dataIndex: SecurityGroupPermissionDependentViewDisplayData.IS_AMEND,
|
||||
width: '5%',
|
||||
sequence: 6,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "删除",
|
||||
dataIndex: SecurityGroupPermissionDependentViewDisplayData.IS_DELETE,
|
||||
width: '5%',
|
||||
sequence: 7,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "",
|
||||
dataIndex: 'operation',
|
||||
width: '5%',
|
||||
sequence: 8,
|
||||
hidden: 'N'
|
||||
}
|
||||
]);
|
||||
|
||||
const columnActors = ref([
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
width: '5%',
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
sequence: 0,
|
||||
hidden: 'N',
|
||||
format: ''
|
||||
},
|
||||
{
|
||||
title: "角色名称",
|
||||
dataIndex: SecurityActorGroupViewEntity.ACTOR_NAME,
|
||||
width: '15%',
|
||||
sequence: 1,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "角色中文名称",
|
||||
dataIndex: SecurityActorGroupViewEntity.ACTOR_LOCAL_NAME,
|
||||
width: '15%',
|
||||
sequence: 1,
|
||||
hidden: 'N'
|
||||
},
|
||||
{
|
||||
title: "",
|
||||
dataIndex: 'operation',
|
||||
width: '5%',
|
||||
sequence: 8,
|
||||
hidden: 'N'
|
||||
}
|
||||
]);
|
||||
|
||||
//================provide================
|
||||
const modelOption = ref<OperationToEnquiryModelOption>(new OperationToEnquiryModelOption());
|
||||
modelOption.value.isModalActor = false;
|
||||
modelOption.value.isModalGroup = false;
|
||||
modelOption.value.isModalPermission = false;
|
||||
modelOption.value.isModalPermissionDependent = false;
|
||||
modelOption.value.selectionTypeActor = 'checkbox';
|
||||
modelOption.value.selectionTypeDependent = 'checkbox';
|
||||
modelOption.value.selectionTypeGroup = 'checkbox';
|
||||
modelOption.value.initBindOptionsDependent = [];
|
||||
modelOption.value.initBindOptionsGroup = [];
|
||||
|
||||
const getOperationToEnquiryModelOption = () => {
|
||||
return modelOption.value
|
||||
}
|
||||
provide(
|
||||
operationToEnquiryMethodKey,
|
||||
{
|
||||
getOperationToEnquiryModelOption,
|
||||
}
|
||||
);
|
||||
//================provide================
|
||||
|
||||
onBeforeMount(async () => {
|
||||
yesNoPolicy.value = await useYesNoPolicy().getSelectOption(false);
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
let pContext: PermissionContext = usePermissionContext();
|
||||
canAmend.value = pContext.canAmend(route.meta.permission as string);
|
||||
canDelete.value = pContext.canDelete(route.meta.permission as string);
|
||||
canCreate.value = pContext.canCreate(route.meta.permission as string);
|
||||
computResultTableHeight();
|
||||
|
||||
if (groupName.value && groupName.value.trim().length > 0) {
|
||||
onSearch();
|
||||
}
|
||||
if (mode.value && mode.value == 'create') {
|
||||
onCreate();
|
||||
isEdit.value = true;
|
||||
}
|
||||
else if (mode.value && mode.value == 'amend') {
|
||||
isEdit.value = true;
|
||||
}
|
||||
})
|
||||
|
||||
const computResultTableHeight = () => {
|
||||
if (width.value > 640) {
|
||||
resultH.value = 'calc(100vh - 220px )';
|
||||
}
|
||||
else {
|
||||
resultH.value = 'calc(100vh - 250px )';
|
||||
}
|
||||
}
|
||||
|
||||
const onModalSearch = (() => {
|
||||
|
||||
modelOption.value.isModalGroup = true;
|
||||
modelOption.value.selectionTypeGroup = 'radio';
|
||||
|
||||
showModalType.value = 0;
|
||||
})
|
||||
|
||||
const onSearch = (async () => {
|
||||
|
||||
if (!groupName.value || groupName.value.trim().length == 0) {
|
||||
notification.info({
|
||||
message: '系统提示:',
|
||||
description: '请输入组别名称',
|
||||
placement: "topRight",
|
||||
});
|
||||
hasData.value = false;
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
data.value = await SecurityGroupService.FindByKey(groupName.value.trim());
|
||||
loading.value = false;
|
||||
if (data.value.SecurityGroup == null) {
|
||||
notification.info({
|
||||
message: '系统提示:',
|
||||
description: '记录不存在',
|
||||
placement: "topRight",
|
||||
});
|
||||
data.value = new SecurityGroupData();
|
||||
hasData.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
hasData.value = true;
|
||||
})
|
||||
|
||||
const onReset = (() => {
|
||||
data.value = new SecurityGroupData();
|
||||
data.value.SecurityGroupPermissionViews = [];
|
||||
data.value.SecurityGroupPermissionDependentViews = [];
|
||||
data.value.SecurityActorGroups = [];
|
||||
groupName.value = '';
|
||||
hasData.value = false;
|
||||
})
|
||||
|
||||
const onCreate = (() => {
|
||||
onReset();
|
||||
isEdit.value = true;
|
||||
})
|
||||
|
||||
const onAmend = (() => {
|
||||
isEdit.value = true;
|
||||
oldGroupName.value = unref(data.value.SecurityGroup.GroupName);
|
||||
})
|
||||
|
||||
const onSave = (async () => {
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
|
||||
if (!data.value.SecurityGroupPermissionViews) data.value.SecurityGroupPermissionViews = [];
|
||||
if (!data.value.SecurityGroupPermissionDependentViews) data.value.SecurityGroupPermissionDependentViews = [];
|
||||
if (!data.value.SecurityActorGroups) data.value.SecurityActorGroups = [];
|
||||
|
||||
if (data.value.SecurityGroup?.CreatedBy)
|
||||
data.value = await SecurityGroupService.Update(data.value);
|
||||
else {
|
||||
data.value = await SecurityGroupService.Insert(data.value);
|
||||
}
|
||||
|
||||
groupName.value = data.value.SecurityGroup.GroupName;
|
||||
|
||||
loading.value = false;
|
||||
hasData.value = true;
|
||||
isEdit.value = false;
|
||||
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
const onCancel = (() => {
|
||||
onReset();
|
||||
if (oldGroupName.value && oldGroupName.value.length > 0) {
|
||||
groupName.value = oldGroupName.value;
|
||||
onSearch();
|
||||
}
|
||||
isEdit.value = false;
|
||||
})
|
||||
|
||||
const onDelete = (async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
|
||||
await SecurityGroupService.Delete(data.value.SecurityGroup.GroupName);
|
||||
|
||||
onReset();
|
||||
loading.value = false;
|
||||
|
||||
} catch (error) {
|
||||
loading.value = false;
|
||||
console.log(error);
|
||||
}
|
||||
})
|
||||
|
||||
const handleCance = (async () => {
|
||||
|
||||
})
|
||||
|
||||
|
||||
const addPermission = (event: MouseEvent) => {
|
||||
|
||||
modelOption.value.isModalPermission = true;
|
||||
modelOption.value.selectionTypePermission = 'checkbox';
|
||||
|
||||
// If you don't want click extra trigger collapse, you can prevent this:
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
const deletePermission = (key: string) => {
|
||||
data.value.SecurityGroupPermissionViews = data.value.SecurityGroupPermissionViews.filter(item => item.PermissionName !== key);
|
||||
if (data.value.SecurityGroupPermissionDependentViews)
|
||||
data.value.SecurityGroupPermissionDependentViews = data.value.SecurityGroupPermissionDependentViews.filter(item => item.PermissionName !== key);
|
||||
};
|
||||
|
||||
const addPermissionDependent = (dependent: string) => {
|
||||
|
||||
if (!isEdit.value) return;
|
||||
|
||||
modelOption.value.isModalPermissionDependent = true;
|
||||
modelOption.value.selectionTypeDependent = 'checkbox';
|
||||
|
||||
modelOption.value.initBindOptionsDependent = [];
|
||||
let bo: BindOption = new BindOption();
|
||||
bo.BindValue = SecurityPermissionDependentEntity.DB_DEPENDENT;
|
||||
bo.Value = dependent;
|
||||
bo.disabled = true;
|
||||
modelOption.value.initBindOptionsDependent.push(bo);
|
||||
|
||||
// If you don't want click extra trigger collapse, you can prevent this:
|
||||
|
||||
};
|
||||
|
||||
const deletePermissionDependent = (key: string) => {
|
||||
data.value.SecurityGroupPermissionDependentViews = data.value.SecurityGroupPermissionDependentViews.filter(item => item.DependentDetailName !== key);
|
||||
};
|
||||
|
||||
const addActor = (event: MouseEvent) => {
|
||||
|
||||
modelOption.value.isModalActor = true;
|
||||
modelOption.value.selectionTypeGroup = 'checkbox';
|
||||
|
||||
// If you don't want click extra trigger collapse, you can prevent this:
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
const deleteActor = (key: string) => {
|
||||
data.value.SecurityActorGroups = data.value.SecurityActorGroups.filter(item => item.ActorName !== key);
|
||||
};
|
||||
|
||||
const handleSelect = (async () => {
|
||||
if (enquiry.value) {
|
||||
if (enquiry.value.keys.length > 0) {
|
||||
//查询弹出
|
||||
if (showModalType.value == 0) {
|
||||
groupName.value = enquiry.value.keys[0].GroupName;
|
||||
|
||||
onSearch();
|
||||
}
|
||||
modelOption.value.isModalGroup = false;
|
||||
|
||||
}
|
||||
else {
|
||||
notification.info({
|
||||
message: '系统提示:',
|
||||
description: '请选择一条记录',
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const handleSelectPermission = (async () => {
|
||||
if (permissionEnquiry.value) {
|
||||
if (permissionEnquiry.value.keys.length > 0) {
|
||||
//查询弹出
|
||||
if (!data.value.SecurityGroupPermissionViews) data.value.SecurityGroupPermissionViews = [];
|
||||
permissionEnquiry.value.keys.forEach(element => {
|
||||
if (data.value.SecurityGroupPermissionViews.filter(item => item.PermissionName == element.PermissionName).length == 0) {
|
||||
let ent: SecurityGroupPermissionViewDisplayData = new SecurityGroupPermissionViewDisplayData();
|
||||
ent.PermissionName = element.PermissionName;
|
||||
ent.PermissionDescription = element.Description;
|
||||
ent.Dependent = element.Dependent;
|
||||
ent.IsAmend = ent.IsCreate = ent.IsDelete = ent.IsView = false;
|
||||
data.value.SecurityGroupPermissionViews.push(ent);
|
||||
}
|
||||
});
|
||||
modelOption.value.isModalPermission = false;
|
||||
|
||||
}
|
||||
else {
|
||||
notification.info({
|
||||
message: '系统提示:',
|
||||
description: '请选择一条记录',
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const handleSelectPermissionDependent = (async () => {
|
||||
if (permissionDependentEnquiry.value) {
|
||||
if (permissionDependentEnquiry.value.keys.length > 0) {
|
||||
//查询弹出
|
||||
if (!data.value.SecurityGroupPermissionDependentViews) data.value.SecurityGroupPermissionDependentViews = [];
|
||||
permissionDependentEnquiry.value.keys.forEach(element => {
|
||||
if (data.value.SecurityGroupPermissionDependentViews.filter(item => item.DependentDetailName == element.DependentDetailName).length == 0) {
|
||||
let ent: SecurityGroupPermissionDependentViewDisplayData = new SecurityGroupPermissionDependentViewDisplayData();
|
||||
ent.DependentDetailName = element.DependentDetailName;
|
||||
ent.DependentDetailDescription = element.DependentDetailDescription;
|
||||
ent.PermissionName = element.PermissionName;
|
||||
ent.Dependent = element.Dependent;
|
||||
ent.IsAmend = ent.IsCreate = ent.IsDelete = ent.IsView = false;
|
||||
data.value.SecurityGroupPermissionDependentViews.push(ent);
|
||||
}
|
||||
});
|
||||
modelOption.value.isModalPermissionDependent = false;
|
||||
}
|
||||
else {
|
||||
notification.info({
|
||||
message: '系统提示:',
|
||||
description: '请选择一条记录',
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const handleSelectActor = (async () => {
|
||||
if (actorEnquiry.value) {
|
||||
if (actorEnquiry.value.keys.length > 0) {
|
||||
//查询弹出
|
||||
if (!data.value.SecurityActorGroups) data.value.SecurityActorGroups = [];
|
||||
actorEnquiry.value.keys.forEach(element => {
|
||||
if (data.value.SecurityActorGroups.filter(item => item.ActorName == element.ActorName).length == 0) {
|
||||
let ent: SecurityActorGroupViewEntity = new SecurityActorGroupViewEntity();
|
||||
ent.ActorName = element.ActorName;
|
||||
ent.ActorLocalName = element.ActorLocalName;
|
||||
data.value.SecurityActorGroups.push(ent);
|
||||
}
|
||||
});
|
||||
modelOption.value.isModalActor = false;
|
||||
|
||||
}
|
||||
else {
|
||||
notification.info({
|
||||
message: '系统提示:',
|
||||
description: '请选择一条记录',
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const onViewActorOperation = ((actorName: string) => {
|
||||
router.push({ name: "ActorOperation", params: { id: actorName, mode: 'view' } });
|
||||
})
|
||||
|
||||
const onViewPermissionOperation = ((permissionName: string) => {
|
||||
router.push({ name: "PermissionOperation", params: { id: permissionName, mode: 'view' } });
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
<style lang="less">
|
||||
.page-container {
|
||||
margin-right: 0px;
|
||||
|
||||
}
|
||||
|
||||
.page-header {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 8px;
|
||||
padding-right: 12px;
|
||||
border-bottom: 1px solid silver;
|
||||
}
|
||||
|
||||
.page-header .ant-input-search .ant-input {
|
||||
border-radius: 0;
|
||||
border-left: 0;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
.page-main {
|
||||
overflow-y: auto;
|
||||
padding-top: 24px;
|
||||
padding-bottom: 4px;
|
||||
padding-right: 32px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.page-footer {
|
||||
z-index: 999;
|
||||
padding-left: 8px;
|
||||
padding-right: 18px;
|
||||
padding-top: 8px;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
bottom: 8px;
|
||||
border-top: 1px solid silver;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user