Merge branch 'lhq_20250326' into 'dev'
add:添加用户组功能模块 See merge request itc-framework/ma/2024/front!50
This commit is contained in:
149
src/api/system/group/index.ts
Normal file
149
src/api/system/group/index.ts
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
import { XjrGroupPageModel, XjrGroupPageParams, XjrGroupPageResult } from './model/GroupModel';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { ErrorMessageMode } from '/#/axios';
|
||||||
|
import {RoleUserModel} from "/@/api/system/role/model";
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
Page = '/organization/group/page',
|
||||||
|
List = '/organization/group/list',
|
||||||
|
Info = '/organization/group/info',
|
||||||
|
XjrGroup = '/organization/group',
|
||||||
|
GroupUser = '/organization/group/user',
|
||||||
|
GroupRole = '/organization/group/role',
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询XjrGroup分页列表
|
||||||
|
*/
|
||||||
|
export async function getXjrGroupPage(params: XjrGroupPageParams, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<XjrGroupPageResult>(
|
||||||
|
{
|
||||||
|
url: Api.Page,
|
||||||
|
params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 新增用户组用户
|
||||||
|
*/
|
||||||
|
export async function addGroupUser(params, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<number>(
|
||||||
|
{
|
||||||
|
url: Api.GroupUser,
|
||||||
|
data: params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 新增用户组角色
|
||||||
|
*/
|
||||||
|
export async function addGroupRole(params, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<number>(
|
||||||
|
{
|
||||||
|
url: Api.GroupRole,
|
||||||
|
data: params,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询用户组用户
|
||||||
|
*/
|
||||||
|
export async function getGroupUser(id: string, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<RoleUserModel[]>(
|
||||||
|
{
|
||||||
|
url: Api.GroupUser,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 查询用户组角色
|
||||||
|
*/
|
||||||
|
export async function getGroupRole(id: string, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<RoleUserModel[]>(
|
||||||
|
{
|
||||||
|
url: Api.GroupRole,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description: 获取XjrGroup信息
|
||||||
|
*/
|
||||||
|
export async function getXjrGroup(id: String, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.get<XjrGroupPageModel>(
|
||||||
|
{
|
||||||
|
url: Api.Info,
|
||||||
|
params: { id },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 新增XjrGroup
|
||||||
|
*/
|
||||||
|
export async function addXjrGroup(xjrGroup: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.post<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.XjrGroup,
|
||||||
|
params: xjrGroup,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 更新XjrGroup
|
||||||
|
*/
|
||||||
|
export async function updateXjrGroup(xjrGroup: Recordable, mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.put<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.XjrGroup,
|
||||||
|
params: xjrGroup,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 删除XjrGroup(批量删除)
|
||||||
|
*/
|
||||||
|
export async function deleteXjrGroup(ids: string[], mode: ErrorMessageMode = 'modal') {
|
||||||
|
return defHttp.delete<boolean>(
|
||||||
|
{
|
||||||
|
url: Api.XjrGroup,
|
||||||
|
data: ids,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
errorMessageMode: mode,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
36
src/api/system/group/model/GroupModel.ts
Normal file
36
src/api/system/group/model/GroupModel.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: XjrGroup分页参数 模型
|
||||||
|
*/
|
||||||
|
export interface XjrGroupPageParams extends BasicPageParams {
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
enabledMark: string;
|
||||||
|
|
||||||
|
remark: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: XjrGroup分页返回值模型
|
||||||
|
*/
|
||||||
|
export interface XjrGroupPageModel {
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
code: string;
|
||||||
|
|
||||||
|
enabledMark: string;
|
||||||
|
|
||||||
|
remark: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: XjrGroup分页返回值结构
|
||||||
|
*/
|
||||||
|
export type XjrGroupPageResult = BasicFetchResult<XjrGroupPageModel>;
|
||||||
@ -161,6 +161,7 @@
|
|||||||
generatorConfig.tableStructureConfigs = formJson.tableStructureConfigs;
|
generatorConfig.tableStructureConfigs = formJson.tableStructureConfigs;
|
||||||
generatorConfig.formEventConfig = formJson.formEventConfig;
|
generatorConfig.formEventConfig = formJson.formEventConfig;
|
||||||
generatorConfig.outputConfig.dataAuthList = formJson.dataAuthList;
|
generatorConfig.outputConfig.dataAuthList = formJson.dataAuthList;
|
||||||
|
generatorConfig.outputConfig.type =res.formDesignType
|
||||||
generatorConfig.outputConfig.isDataAuth = formJson.isDataAuth;
|
generatorConfig.outputConfig.isDataAuth = formJson.isDataAuth;
|
||||||
isGetInfo.value = true;
|
isGetInfo.value = true;
|
||||||
});
|
});
|
||||||
@ -200,7 +201,6 @@
|
|||||||
tableInfo.value,
|
tableInfo.value,
|
||||||
buildOption(generatorConfig.formJson) as FormProps,
|
buildOption(generatorConfig.formJson) as FormProps,
|
||||||
);
|
);
|
||||||
|
|
||||||
await dataFirstGeneratorCode(data);
|
await dataFirstGeneratorCode(data);
|
||||||
closeModal();
|
closeModal();
|
||||||
emits('success');
|
emits('success');
|
||||||
|
|||||||
@ -8,7 +8,8 @@
|
|||||||
:clickRowToExpand="true"
|
:clickRowToExpand="true"
|
||||||
:treeData="treeData"
|
:treeData="treeData"
|
||||||
:fieldNames="fieldNames"
|
:fieldNames="fieldNames"
|
||||||
@select="handleSelect"
|
@row-dbClick="dbClickRow"
|
||||||
|
:row-selection="rowSelection"
|
||||||
>
|
>
|
||||||
<template #title="item">
|
<template #title="item">
|
||||||
<template v-if="item.renderIcon === 'parentIcon'">
|
<template v-if="item.renderIcon === 'parentIcon'">
|
||||||
@ -210,6 +211,9 @@
|
|||||||
const { currentRoute } = useRouter();
|
const { currentRoute } = useRouter();
|
||||||
const { path } = unref(currentRoute);
|
const { path } = unref(currentRoute);
|
||||||
const printMenuId = computed(() => currentRoute.value.meta.menuId as string);
|
const printMenuId = computed(() => currentRoute.value.meta.menuId as string);
|
||||||
|
const schemaIdComputedRef = ref();
|
||||||
|
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||||
|
const router = useRouter();
|
||||||
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||||
|
|
||||||
let columns: BasicColumn[] = [], //列表配置
|
let columns: BasicColumn[] = [], //列表配置
|
||||||
@ -321,6 +325,7 @@
|
|||||||
view: handleView,
|
view: handleView,
|
||||||
add: handleAdd,
|
add: handleAdd,
|
||||||
edit: handleEdit,
|
edit: handleEdit,
|
||||||
|
startwork : handleStartwork,
|
||||||
delete: handleDelete,
|
delete: handleDelete,
|
||||||
batchdelete: handleBatchdelete,
|
batchdelete: handleBatchdelete,
|
||||||
batchSetUserId: handleBatchSetUserId,
|
batchSetUserId: handleBatchSetUserId,
|
||||||
@ -544,6 +549,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
const info = {
|
const info = {
|
||||||
isUpdate: false,
|
isUpdate: false,
|
||||||
releaseId: menuId.value,
|
releaseId: menuId.value,
|
||||||
@ -553,6 +563,7 @@
|
|||||||
};
|
};
|
||||||
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
|
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleEdit(record: Recordable) {
|
function handleEdit(record: Recordable) {
|
||||||
const info = {
|
const info = {
|
||||||
@ -567,6 +578,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleView(record: Recordable) {
|
function handleView(record: Recordable) {
|
||||||
|
if (record.workflowData?.taskIds && record.workflowData.taskIds.length) {
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData;
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
taskId: taskIds[0],
|
||||||
|
rtId: currentRoute.value.query.rtId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (record.workflowData?.schemaId && !record.workflowData.taskIds) {
|
||||||
|
const { processId, schemaId } = record.workflowData;
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
rtId: currentRoute.value.query.rtId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
const info = {
|
const info = {
|
||||||
id: record[pkField.value],
|
id: record[pkField.value],
|
||||||
releaseId: menuId.value,
|
releaseId: menuId.value,
|
||||||
@ -577,6 +608,7 @@
|
|||||||
};
|
};
|
||||||
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
|
formType.value === 'modal' ? openModal(true, info) : openDrawer(true, info);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleCopyData(record: Recordable) {
|
function handleCopyData(record: Recordable) {
|
||||||
const info = {
|
const info = {
|
||||||
@ -842,7 +874,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function getActions(record: Recordable):ActionItem[] {
|
function getActions(record: Recordable):ActionItem[] {
|
||||||
const hasStartWorkButton = buttonConfigs.value?.some((x) => x.code === 'startwork');
|
|
||||||
let actionsList: ActionItem[] = [];
|
let actionsList: ActionItem[] = [];
|
||||||
let editAndDelBtn: ActionItem[] = [];
|
let editAndDelBtn: ActionItem[] = [];
|
||||||
let hasFlowRecord = false;
|
let hasFlowRecord = false;
|
||||||
@ -864,23 +896,21 @@
|
|||||||
}
|
}
|
||||||
if (button.code === 'flowRecord') hasFlowRecord = true;
|
if (button.code === 'flowRecord') hasFlowRecord = true;
|
||||||
});
|
});
|
||||||
if (record.workflowData?.enabled) {
|
if (record.workflowData.enabled) {
|
||||||
if (!hasStartWorkButton) return actionsList;
|
|
||||||
//与工作流有关联的表单
|
//与工作流有关联的表单
|
||||||
if (record.workflowData.status) {
|
if (record.workflowData.status) {
|
||||||
//如果是本人需要审批的数据 就会有taskIds 所以需要修改绑定事件
|
//如果是本人需要审批的数据 就会有taskIds 所以需要修改绑定事件
|
||||||
const act: ActionItem = {};
|
const act: ActionItem = {};
|
||||||
if (record.workflowData.taskIds) {
|
if (record.workflowData.taskIds) {
|
||||||
act.tooltip = t('查看流程(待审批)');
|
act.tooltip = '查看流程(待审批)';
|
||||||
act.icon = 'daishenpi|svg';
|
act.icon = 'daishenpi|svg';
|
||||||
act.onClick = handleApproveProcess.bind(null, record);
|
act.onClick = handleApproveProcess.bind(null, record);
|
||||||
} else {
|
} else {
|
||||||
act.tooltip =
|
act.tooltip =
|
||||||
t('查看流程') +
|
'查看流程' + (record.workflowData.status === 'ACTIVE' ? '(审批中)' : '(已完成)');
|
||||||
(record.workflowData.status === 'ACTIVE' ? t('(审批中)') : t('(已完成)'));
|
|
||||||
act.icon =
|
act.icon =
|
||||||
record.workflowData.status === 'ACTIVE' ? 'jinshenpi|svg' : 'shenpiwancheng|svg';
|
record.workflowData.status === 'ACTIVE' ? 'jinshenpi|svg' : 'shenpiwancheng|svg';
|
||||||
act.onClick = handleViewWorkflow.bind(null, record);
|
act.onClick = handleStartwork.bind(null, record);
|
||||||
}
|
}
|
||||||
actionsList.unshift(act);
|
actionsList.unshift(act);
|
||||||
if (hasFlowRecord) {
|
if (hasFlowRecord) {
|
||||||
@ -890,16 +920,17 @@
|
|||||||
onClick: handleFlowRecord.bind(null, record),
|
onClick: handleFlowRecord.bind(null, record),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
actionsList.unshift({
|
actionsList.unshift({
|
||||||
icon: 'faqishenpi|svg',
|
icon: 'faqishenpi|svg',
|
||||||
tooltip: record.workflowData.draftId ? t('编辑草稿') : t('发起审批'),
|
tooltip: record.workflowData.draftId ? '编辑草稿' : '发起审批' ,
|
||||||
onClick: handleLaunchProcess.bind(null, record),
|
onClick: handleLaunchProcess.bind(null, record),
|
||||||
});
|
});
|
||||||
actionsList = actionsList.concat(editAndDelBtn);
|
actionsList = actionsList.concat(editAndDelBtn);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!record.workflowData?.processId) {
|
if (!record.workflowData.processId) {
|
||||||
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
|
||||||
actionsList = actionsList.concat(editAndDelBtn);
|
actionsList = actionsList.concat(editAndDelBtn);
|
||||||
}
|
}
|
||||||
@ -907,12 +938,56 @@
|
|||||||
return actionsList;
|
return actionsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSelect(selectIds) {
|
function handleStartwork(record: Recordable) {
|
||||||
selectId.value = selectIds[0];
|
const { processId, schemaId } = record.workflowData;
|
||||||
reload({
|
router.push({
|
||||||
searchInfo: { [listConfig.value.leftMenuConfig?.listFieldName as string]: selectId.value },
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function dbClickRow(record) {
|
||||||
|
if (record.workflowData?.taskIds && record.workflowData.taskIds.length) {
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData;
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
taskId: taskIds[0],
|
||||||
|
rtId: currentRoute.value.query.rtId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (record.workflowData?.schemaId && !record.workflowData.taskIds) {
|
||||||
|
const { processId, schemaId } = record.workflowData;
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
rtId: currentRoute.value.query.rtId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/infoTaskManageItem/' + record.id + '/viewForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'infoManage/infoTaskManageItem'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const rowSelection: TableProps['rowSelection'] = {
|
||||||
|
onChange: (selectedRowKeys: string[], selectedRows: DataType[]) => {
|
||||||
|
selectedKeys.value = selectedRowKeys;
|
||||||
|
selectedRowsData.value = selectedRows;
|
||||||
|
},
|
||||||
|
getCheckboxProps: (record: DataType) => ({
|
||||||
|
disabled: record.workflowData.taskIds === null, // Column configuration not to be checked
|
||||||
|
name: record.workflowData.taskIds,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
async function fetchLeftData() {
|
async function fetchLeftData() {
|
||||||
//如果是数据字典
|
//如果是数据字典
|
||||||
|
|||||||
179
src/views/system/group/components/Form.vue
Normal file
179
src/views/system/group/components/Form.vue
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
<template>
|
||||||
|
<SimpleForm
|
||||||
|
ref="systemFormRef"
|
||||||
|
:formProps="data.formDataProps"
|
||||||
|
:formModel="{}"
|
||||||
|
:isWorkFlow="props.fromPage!=FromPageType.MENU"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive, ref, onMounted } from 'vue';
|
||||||
|
import { formProps, formEventConfigs } from './config';
|
||||||
|
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||||
|
import { addXjrGroup, getXjrGroup, updateXjrGroup } from '/@/api/system/group';
|
||||||
|
import { cloneDeep } from 'lodash-es';
|
||||||
|
import { FormDataProps } from '/@/components/Designer/src/types';
|
||||||
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
|
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
|
||||||
|
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
|
||||||
|
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
|
||||||
|
const { filterFormSchemaAuth } = usePermission();
|
||||||
|
|
||||||
|
const RowKey = 'id';
|
||||||
|
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
|
||||||
|
const props = defineProps({
|
||||||
|
fromPage: {
|
||||||
|
type: Number,
|
||||||
|
default: FromPageType.MENU,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const systemFormRef = ref();
|
||||||
|
const data: { formDataProps: FormDataProps } = reactive({
|
||||||
|
formDataProps: cloneDeep(formProps),
|
||||||
|
});
|
||||||
|
const state = reactive({
|
||||||
|
formModel: {},
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
if (props.fromPage == FromPageType.MENU) {
|
||||||
|
setMenuPermission();
|
||||||
|
await createFormEvent(formEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(formEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:加载表单
|
||||||
|
} else if (props.fromPage == FromPageType.FLOW) {
|
||||||
|
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||||
|
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
|
||||||
|
} else if (props.fromPage == FromPageType.PREVIEW) {
|
||||||
|
// 预览 无需权限,表单事件也无需执行
|
||||||
|
} else if (props.fromPage == FromPageType.DESKTOP) {
|
||||||
|
// 桌面设计 表单事件需要执行
|
||||||
|
emits('loadingCompleted'); //告诉系统表单已经加载完毕
|
||||||
|
await createFormEvent(formEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(formEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:加载表单
|
||||||
|
}
|
||||||
|
emits('form-mounted', formProps);
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
|
||||||
|
function setMenuPermission() {
|
||||||
|
data.formDataProps.schemas = filterFormSchemaAuth(formProps.schemas!);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验form 通过返回表单数据
|
||||||
|
async function validate() {
|
||||||
|
let values = [];
|
||||||
|
try {
|
||||||
|
values = await systemFormRef.value?.validate();
|
||||||
|
//添加隐藏组件
|
||||||
|
if (data.formDataProps.hiddenComponent?.length) {
|
||||||
|
data.formDataProps.hiddenComponent.forEach((component) => {
|
||||||
|
values[component.bindField] = component.value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
// 根据行唯一ID查询行数据,并设置表单数据 【编辑】
|
||||||
|
async function setFormDataFromId(rowId, skipUpdate) {
|
||||||
|
try {
|
||||||
|
const record = await getXjrGroup(rowId);
|
||||||
|
if (skipUpdate) {
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
setFieldsValue(record);
|
||||||
|
state.formModel = record;
|
||||||
|
await getFormDataEvent(formEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
|
||||||
|
return record;
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 辅助设置表单数据
|
||||||
|
function setFieldsValue(record) {
|
||||||
|
systemFormRef.value.setFieldsValue(record);
|
||||||
|
}
|
||||||
|
// 重置表单数据
|
||||||
|
async function resetFields() {
|
||||||
|
await systemFormRef.value.resetFields();
|
||||||
|
}
|
||||||
|
// 设置表单数据全部为Disabled 【查看】
|
||||||
|
async function setDisabledForm() {
|
||||||
|
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas));
|
||||||
|
}
|
||||||
|
// 获取行键值
|
||||||
|
function getRowKey() {
|
||||||
|
return RowKey;
|
||||||
|
}
|
||||||
|
// 更新api表单数据
|
||||||
|
async function update({ values, rowId }) {
|
||||||
|
try {
|
||||||
|
values[RowKey] = rowId;
|
||||||
|
state.formModel = values;
|
||||||
|
let saveVal = await updateXjrGroup(values);
|
||||||
|
await submitFormEvent(formEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:提交表单
|
||||||
|
return saveVal;
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
// 新增api表单数据
|
||||||
|
async function add(values) {
|
||||||
|
try {
|
||||||
|
state.formModel = values;
|
||||||
|
let saveVal = await addXjrGroup(values);
|
||||||
|
await submitFormEvent(formEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:提交表单
|
||||||
|
return saveVal;
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
|
||||||
|
async function setWorkFlowForm(obj: WorkFlowFormParams) {
|
||||||
|
try {
|
||||||
|
let flowData = changeWorkFlowForm(cloneDeep(formProps), obj);
|
||||||
|
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
|
||||||
|
data.formDataProps = buildOptionJson;
|
||||||
|
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
|
||||||
|
if (isViewProcess) {
|
||||||
|
setDisabledForm(); //查看
|
||||||
|
}
|
||||||
|
state.formModel = formModels;
|
||||||
|
if(formModels[RowKey]) {
|
||||||
|
setFormDataFromId(formModels[RowKey], false)
|
||||||
|
} else {
|
||||||
|
setFieldsValue(formModels)
|
||||||
|
}
|
||||||
|
} catch (error) {}
|
||||||
|
await createFormEvent(formEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:初始化表单
|
||||||
|
await loadFormEvent(formEventConfigs, state.formModel,
|
||||||
|
systemFormRef.value,
|
||||||
|
formProps.schemas); //表单事件:加载表单
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
setFieldsValue,
|
||||||
|
resetFields,
|
||||||
|
validate,
|
||||||
|
add,
|
||||||
|
update,
|
||||||
|
setFormDataFromId,
|
||||||
|
setDisabledForm,
|
||||||
|
setMenuPermission,
|
||||||
|
setWorkFlowForm,
|
||||||
|
getRowKey,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
110
src/views/system/group/components/GroupModal.vue
Normal file
110
src/views/system/group/components/GroupModal.vue
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
|
||||||
|
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
|
||||||
|
</BasicModal>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, computed, reactive } from 'vue';
|
||||||
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { formProps } from './config';
|
||||||
|
import ModalForm from './Form.vue';
|
||||||
|
import { FromPageType } from '/@/enums/workflowEnum';
|
||||||
|
|
||||||
|
const emit = defineEmits(['success', 'register']);
|
||||||
|
|
||||||
|
const { notification } = useMessage();
|
||||||
|
const formRef = ref();
|
||||||
|
const state = reactive({
|
||||||
|
formModel: {},
|
||||||
|
isUpdate: true,
|
||||||
|
isView: false,
|
||||||
|
isCopy: false,
|
||||||
|
rowId: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
|
state.isUpdate = !!data?.isUpdate;
|
||||||
|
state.isView = !!data?.isView;
|
||||||
|
state.isCopy = !!data?.isCopy;
|
||||||
|
|
||||||
|
setModalProps({
|
||||||
|
destroyOnClose: true,
|
||||||
|
maskClosable: false,
|
||||||
|
showCancelBtn: !state.isView,
|
||||||
|
showOkBtn: !state.isView,
|
||||||
|
canFullscreen: true,
|
||||||
|
width: 900,
|
||||||
|
});
|
||||||
|
if (state.isUpdate || state.isView || state.isCopy) {
|
||||||
|
state.rowId = data.id;
|
||||||
|
if (state.isView) {
|
||||||
|
await formRef.value.setDisabledForm();
|
||||||
|
}
|
||||||
|
await formRef.value.setFormDataFromId(state.rowId);
|
||||||
|
} else {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
|
||||||
|
|
||||||
|
async function saveModal() {
|
||||||
|
let saveSuccess = false;
|
||||||
|
try {
|
||||||
|
const values = await formRef.value?.validate();
|
||||||
|
//添加隐藏组件
|
||||||
|
if (formProps.hiddenComponent?.length) {
|
||||||
|
formProps.hiddenComponent.forEach((component) => {
|
||||||
|
values[component.bindField] = component.value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (values !== false) {
|
||||||
|
try {
|
||||||
|
if (!state.isUpdate || state.isCopy) {
|
||||||
|
saveSuccess = await formRef.value.add(values);
|
||||||
|
} else {
|
||||||
|
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
|
||||||
|
}
|
||||||
|
return saveSuccess;
|
||||||
|
} catch (error) {}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return saveSuccess;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
const saveSuccess = await saveModal();
|
||||||
|
setModalProps({ confirmLoading: true });
|
||||||
|
if (saveSuccess) {
|
||||||
|
if (!state.isUpdate || state.isCopy) {
|
||||||
|
//false 新增
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('新增成功!'),
|
||||||
|
}); //提示消息
|
||||||
|
} else {
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('修改成功!'),
|
||||||
|
}); //提示消息
|
||||||
|
}
|
||||||
|
closeModal();
|
||||||
|
formRef.value.resetFields();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClose() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
34
src/views/system/group/components/RoleListModal.vue
Normal file
34
src/views/system/group/components/RoleListModal.vue
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<template>
|
||||||
|
<BasicModal
|
||||||
|
width="1000px"
|
||||||
|
v-bind="$attrs"
|
||||||
|
@register="registerModal"
|
||||||
|
:show-cancel-btn="false"
|
||||||
|
:show-ok-btn="false"
|
||||||
|
>
|
||||||
|
<div class="flex flex-wrap" v-if="datas.length > 0">
|
||||||
|
<UserCard v-for="(item, index) in datas" :key="index" :item="item" />
|
||||||
|
</div>
|
||||||
|
<div v-else><a-empty :image="simpleImage" /></div>
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent, ref } from 'vue';
|
||||||
|
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||||
|
import UserCard from './UserCard.vue';
|
||||||
|
import { Empty } from 'ant-design-vue';
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'AuthModal',
|
||||||
|
components: { BasicModal, UserCard },
|
||||||
|
emits: ['success', 'register'],
|
||||||
|
setup(_) {
|
||||||
|
const datas = ref<any>([]);
|
||||||
|
const [registerModal, { setModalProps }] = useModalInner(async (data) => {
|
||||||
|
setModalProps({ confirmLoading: false });
|
||||||
|
datas.value = data;
|
||||||
|
});
|
||||||
|
|
||||||
|
return { registerModal, datas, simpleImage: Empty.PRESENTED_IMAGE_SIMPLE };
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
190
src/views/system/group/components/UserCard.vue
Normal file
190
src/views/system/group/components/UserCard.vue
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
<template>
|
||||||
|
<div class="list-item">
|
||||||
|
<div class="item-box">
|
||||||
|
<div class="item-left"><img :src="genderImg" /></div>
|
||||||
|
<div class="z-10">
|
||||||
|
<div class="item-right flex items-center">
|
||||||
|
<div class="item-title">{{ t('角色编码') }}</div>
|
||||||
|
<a-tooltip v-if="item?.code && item.code.length > 12" :title="item.code">
|
||||||
|
<div class="item-form-name"> {{ `${item.code.slice(0, 12)}...` }}</div>
|
||||||
|
</a-tooltip>
|
||||||
|
<div class="item-form-name" v-else> {{ item?.code || '-' }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="item-right flex items-center">
|
||||||
|
<div class="item-title">{{ t('角色名称') }}</div>
|
||||||
|
<a-tooltip v-if="item?.name && item.name.length > 8" :title="item.name">
|
||||||
|
<div class="item-form-name"> {{ `${item.name.slice(0, 8)}...` }}</div>
|
||||||
|
</a-tooltip>
|
||||||
|
<div class="item-form-name" v-else> {{ item?.name }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="fixed-checked" v-if="hasCheckSlot">
|
||||||
|
<slot name="check"></slot>
|
||||||
|
</div>
|
||||||
|
<div class="fixed-icon">
|
||||||
|
<IconFontSymbol icon="user" :fillColor="genderFillColor" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, useSlots } from 'vue';
|
||||||
|
import defaultImg from '/@/assets/workflow/default.png';
|
||||||
|
import FemaleImg from '/@/assets/workflow/female.png';
|
||||||
|
import MaleImg from '/@/assets/workflow/male.png';
|
||||||
|
import IconFontSymbol from '/@/components/IconFontSymbol/Index.vue';
|
||||||
|
import { GenderEnum } from '/@/enums/userEnum';
|
||||||
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
const { t } = useI18n();
|
||||||
|
let props = defineProps({
|
||||||
|
item: Object,
|
||||||
|
disabled: Boolean,
|
||||||
|
isShowTree: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const hasCheckSlot = computed(() => {
|
||||||
|
return !!useSlots().check;
|
||||||
|
});
|
||||||
|
const genderImg = computed(() => {
|
||||||
|
switch (props.item?.gender) {
|
||||||
|
case GenderEnum.FEMALE:
|
||||||
|
return FemaleImg;
|
||||||
|
case GenderEnum.MALE:
|
||||||
|
return MaleImg;
|
||||||
|
default:
|
||||||
|
return defaultImg;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const genderFillColor = computed(() => {
|
||||||
|
switch (props.item?.gender) {
|
||||||
|
case GenderEnum.FEMALE:
|
||||||
|
return '#ffedf5';
|
||||||
|
case GenderEnum.MALE:
|
||||||
|
return '#e9f0fe';
|
||||||
|
default:
|
||||||
|
return '#f1ecfe';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let fontcolor = computed(() => {
|
||||||
|
switch (props.item?.gender) {
|
||||||
|
case GenderEnum.FEMALE:
|
||||||
|
return '#ffd1d7';
|
||||||
|
case GenderEnum.MALE:
|
||||||
|
return '#3c7eff';
|
||||||
|
default:
|
||||||
|
return '#b389ff';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let bgcolor = computed(() => {
|
||||||
|
switch (props.item?.gender) {
|
||||||
|
case GenderEnum.FEMALE:
|
||||||
|
return '#fef6fa';
|
||||||
|
case GenderEnum.MALE:
|
||||||
|
return '#f3f8ff';
|
||||||
|
default:
|
||||||
|
return '#f5f1fd';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const itemleftwidth = computed(() => {
|
||||||
|
return props.isShowTree ? '30%' : '25%';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.list-item {
|
||||||
|
width: 30%;
|
||||||
|
background: v-bind(bgcolor);
|
||||||
|
border-color: transparent;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-left: 20px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border: 1px dotted v-bind(fontcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-box {
|
||||||
|
display: flex;
|
||||||
|
margin: 14px;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.item-left {
|
||||||
|
width: v-bind(itemleftwidth);
|
||||||
|
margin-right: 14px;
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-right {
|
||||||
|
.item-title {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #999;
|
||||||
|
margin: 10px 10px 4px 0;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-form-name {
|
||||||
|
color: #303133;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 8px 0 4px;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-checked {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -4px;
|
||||||
|
z-index: 1;
|
||||||
|
right: -6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-icon {
|
||||||
|
position: absolute;
|
||||||
|
right: -24px;
|
||||||
|
font-size: 70px;
|
||||||
|
transform: rotate(48deg);
|
||||||
|
top: -24px;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-checkbox-inner) {
|
||||||
|
border-color: v-bind(fontcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-checkbox-checked .ant-checkbox-inner) {
|
||||||
|
background-color: v-bind(fontcolor);
|
||||||
|
border-color: v-bind(fontcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-checkbox-checked::after),
|
||||||
|
:deep(.ant-checkbox-wrapper:hover .ant-checkbox-inner, .ant-checkbox:hover),
|
||||||
|
:deep(.ant-checkbox-inner),
|
||||||
|
:deep(.ant-checkbox:hover),
|
||||||
|
:deep(.ant-checkbox-input:focus + .ant-checkbox-inner) {
|
||||||
|
border-color: v-bind(fontcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
.picked {
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: dotted;
|
||||||
|
border-color: v-bind(fontcolor);
|
||||||
|
}
|
||||||
|
|
||||||
|
.not-picked {
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: dotted;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
291
src/views/system/group/components/config.ts
Normal file
291
src/views/system/group/components/config.ts
Normal file
@ -0,0 +1,291 @@
|
|||||||
|
import { FormProps, FormSchema } from '/@/components/Form';
|
||||||
|
import { BasicColumn } from '/@/components/Table';
|
||||||
|
|
||||||
|
export const searchFormSchema: FormSchema[] = [
|
||||||
|
{
|
||||||
|
field: 'name',
|
||||||
|
label: '用户组名称',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'code',
|
||||||
|
label: '用户组编码',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'enabledMark',
|
||||||
|
label: '状态',
|
||||||
|
component: 'XjrSelect',
|
||||||
|
componentProps: {
|
||||||
|
datasourceType: 'staticData',
|
||||||
|
staticOptions: [
|
||||||
|
{ key: 1, label: '启用', value: 1 },
|
||||||
|
{ key: 2, label: '停用', value: 0 },
|
||||||
|
],
|
||||||
|
labelField: 'label',
|
||||||
|
valueField: 'value',
|
||||||
|
|
||||||
|
getPopupContainer: () => document.body,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
dataIndex: 'name',
|
||||||
|
title: '用户组名称',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'code',
|
||||||
|
title: '用户组编码',
|
||||||
|
componentType: 'input',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'enabledMark',
|
||||||
|
title: '状态',
|
||||||
|
componentType: 'radio',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
customRender: ({ record }) => {
|
||||||
|
const staticOptions = [
|
||||||
|
{ key: 1, label: '启用', value: 1 },
|
||||||
|
{ key: 2, label: '停用', value: 0 },
|
||||||
|
];
|
||||||
|
return staticOptions.filter((x) => x.value === record.enabledMark)[0]?.label;
|
||||||
|
},
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
dataIndex: 'remark',
|
||||||
|
title: '备注',
|
||||||
|
componentType: 'textarea',
|
||||||
|
align: 'left',
|
||||||
|
|
||||||
|
sorter: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
//表单事件
|
||||||
|
export const formEventConfigs = {
|
||||||
|
0: [
|
||||||
|
{
|
||||||
|
type: 'circle',
|
||||||
|
color: '#2774ff',
|
||||||
|
text: '开始节点',
|
||||||
|
icon: '#icon-kaishi',
|
||||||
|
bgcColor: '#D8E5FF',
|
||||||
|
isUserDefined: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
color: '#F6AB01',
|
||||||
|
icon: '#icon-chushihua',
|
||||||
|
text: '初始化表单',
|
||||||
|
bgcColor: '#f9f5ea',
|
||||||
|
isUserDefined: false,
|
||||||
|
nodeInfo: { processEvent: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
1: [
|
||||||
|
{
|
||||||
|
color: '#B36EDB',
|
||||||
|
icon: '#icon-shujufenxi',
|
||||||
|
text: '获取表单数据',
|
||||||
|
detail: '(新增无此操作)',
|
||||||
|
bgcColor: '#F8F2FC',
|
||||||
|
isUserDefined: false,
|
||||||
|
nodeInfo: { processEvent: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
2: [
|
||||||
|
{
|
||||||
|
color: '#F8625C',
|
||||||
|
icon: '#icon-jiazai',
|
||||||
|
text: '加载表单',
|
||||||
|
bgcColor: '#FFF1F1',
|
||||||
|
isUserDefined: false,
|
||||||
|
nodeInfo: { processEvent: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
3: [
|
||||||
|
{
|
||||||
|
color: '#6C6AE0',
|
||||||
|
icon: '#icon-jsontijiao',
|
||||||
|
text: '提交表单',
|
||||||
|
bgcColor: '#F5F4FF',
|
||||||
|
isUserDefined: false,
|
||||||
|
nodeInfo: { processEvent: [] },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
4: [
|
||||||
|
{
|
||||||
|
type: 'circle',
|
||||||
|
color: '#F8625C',
|
||||||
|
text: '结束节点',
|
||||||
|
icon: '#icon-jieshuzhiliao',
|
||||||
|
bgcColor: '#FFD6D6',
|
||||||
|
isLast: true,
|
||||||
|
isUserDefined: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
export const formProps: FormProps = {
|
||||||
|
labelCol: { span: 3, offset: 0, labelWidthMode: 'flex' },
|
||||||
|
labelAlign: 'right',
|
||||||
|
layout: 'horizontal',
|
||||||
|
size: 'default',
|
||||||
|
schemas: [
|
||||||
|
{
|
||||||
|
key: '78982448aafb4c6aa670af77d3c81671',
|
||||||
|
field: 'name',
|
||||||
|
label: '用户组名称',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: true,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入用户组名称',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: true,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '5042a508994f4b73a6e6ff826bfc90a3',
|
||||||
|
field: 'code',
|
||||||
|
label: '用户组编码',
|
||||||
|
type: 'input',
|
||||||
|
component: 'Input',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: true,
|
||||||
|
respNewRow: false,
|
||||||
|
placeholder: '请输入用户组编码',
|
||||||
|
maxlength: null,
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
addonBefore: '',
|
||||||
|
addonAfter: '',
|
||||||
|
disabled: false,
|
||||||
|
allowClear: false,
|
||||||
|
showLabel: true,
|
||||||
|
required: true,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isSave: false,
|
||||||
|
isShow: true,
|
||||||
|
scan: false,
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'f236824d858c43cfb801762f2a585f75',
|
||||||
|
field: 'enabledMark',
|
||||||
|
label: '状态',
|
||||||
|
type: 'radio',
|
||||||
|
component: 'ApiRadioGroup',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
componentProps: {
|
||||||
|
span: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: true,
|
||||||
|
respNewRow: false,
|
||||||
|
showLabel: true,
|
||||||
|
disabled: false,
|
||||||
|
optionType: 'default',
|
||||||
|
staticOptions: [
|
||||||
|
{ key: 1, label: '启用', value: 1 },
|
||||||
|
{ key: 2, label: '停用', value: 0 },
|
||||||
|
],
|
||||||
|
datasourceType: 'staticData',
|
||||||
|
labelField: 'label',
|
||||||
|
valueField: 'value',
|
||||||
|
defaultSelect: '0',
|
||||||
|
apiConfig: {
|
||||||
|
path: 'CodeGeneration/selection',
|
||||||
|
method: 'GET',
|
||||||
|
apiId: '93d735dcb7364a0f8102188ec4d77ac7',
|
||||||
|
},
|
||||||
|
dicOptions: [],
|
||||||
|
required: false,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
isShow: true,
|
||||||
|
params: null,
|
||||||
|
style: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: '06f7026e60a14d07a0e53043caf99437',
|
||||||
|
field: 'remark',
|
||||||
|
label: '备注',
|
||||||
|
type: 'textarea',
|
||||||
|
component: 'InputTextArea',
|
||||||
|
colProps: { span: 24 },
|
||||||
|
defaultValue: '',
|
||||||
|
componentProps: {
|
||||||
|
width: '100%',
|
||||||
|
span: '',
|
||||||
|
defaultValue: '',
|
||||||
|
labelWidthMode: 'fix',
|
||||||
|
labelFixWidth: 120,
|
||||||
|
responsive: true,
|
||||||
|
respNewRow: true,
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
maxlength: null,
|
||||||
|
rows: 4,
|
||||||
|
autoSize: false,
|
||||||
|
showCount: false,
|
||||||
|
disabled: false,
|
||||||
|
showLabel: true,
|
||||||
|
allowClear: false,
|
||||||
|
required: false,
|
||||||
|
isShow: true,
|
||||||
|
rules: [],
|
||||||
|
events: {},
|
||||||
|
style: { width: '100%' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
buttonLocation: 'center',
|
||||||
|
actionColOptions: { span: 24 },
|
||||||
|
showResetButton: false,
|
||||||
|
showSubmitButton: false,
|
||||||
|
hiddenComponent: [],
|
||||||
|
};
|
||||||
62
src/views/system/group/components/workflowPermission.ts
Normal file
62
src/views/system/group/components/workflowPermission.ts
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
export const permissionList = [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '用户组名称',
|
||||||
|
fieldId: 'name',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '78982448aafb4c6aa670af77d3c81671',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '用户组编码',
|
||||||
|
fieldId: 'code',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'input',
|
||||||
|
key: '5042a508994f4b73a6e6ff826bfc90a3',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '状态',
|
||||||
|
fieldId: 'enabledMark',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'radio',
|
||||||
|
key: 'f236824d858c43cfb801762f2a585f75',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
view: true,
|
||||||
|
edit: true,
|
||||||
|
disabled: false,
|
||||||
|
isSaveTable: false,
|
||||||
|
tableName: '',
|
||||||
|
fieldName: '备注',
|
||||||
|
fieldId: 'remark',
|
||||||
|
isSubTable: false,
|
||||||
|
showChildren: true,
|
||||||
|
type: 'textarea',
|
||||||
|
key: '06f7026e60a14d07a0e53043caf99437',
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
505
src/views/system/group/index.vue
Normal file
505
src/views/system/group/index.vue
Normal file
@ -0,0 +1,505 @@
|
|||||||
|
<template>
|
||||||
|
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||||
|
|
||||||
|
|
||||||
|
<BasicTable @register="registerTable" ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys,type: 'radio', onChange: onSelectChange }" @row-dbClick="dbClickRow">
|
||||||
|
|
||||||
|
<template #toolbar>
|
||||||
|
<template v-for="button in tableButtonConfig" :key="button.code">
|
||||||
|
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
|
||||||
|
<template #icon><Icon :icon="button.icon" /></template>
|
||||||
|
{{ button.name }}
|
||||||
|
</a-button>
|
||||||
|
<a-button v-else :type="button.type">
|
||||||
|
<template #icon><Icon :icon="button.icon" /></template>
|
||||||
|
{{ button.name }}
|
||||||
|
</a-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<template v-if="column.dataIndex === 'action'">
|
||||||
|
<TableAction :actions="getActions(record)" />
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
|
||||||
|
<SelectDepartment
|
||||||
|
v-if="visible"
|
||||||
|
:visible="visible"
|
||||||
|
:multiple="true"
|
||||||
|
:selectedIds="selectedUserId"
|
||||||
|
@close="
|
||||||
|
() => {
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
@change="handleSelectUserSuccess"
|
||||||
|
/>
|
||||||
|
<AuthModal @register="registerAuthModal" />
|
||||||
|
<RoleListModal @register="registerRoleListModal" />
|
||||||
|
<GroupModal @register="registerModal" @success="handleSuccess" />
|
||||||
|
<RoleModal @register="registerRoleModal" @success="handleSelectRoleSuccess" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</PageWrapper>
|
||||||
|
</template>
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, computed, onMounted, onUnmounted, createVNode,
|
||||||
|
|
||||||
|
} from 'vue';
|
||||||
|
|
||||||
|
import { Modal } from 'ant-design-vue';
|
||||||
|
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||||
|
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
|
||||||
|
import { getXjrGroupPage, deleteXjrGroup} from '/@/api/system/Group';
|
||||||
|
import { SelectDepartment } from '/@/components/SelectOrganizational/index';
|
||||||
|
import { PageWrapper } from '/@/components/Page';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import AuthModal from '../dataAuthority/components/AuthModal.vue';
|
||||||
|
import RoleListModal from './components/RoleListModal.vue';
|
||||||
|
import RoleModal from '../user/components/RoleModal.vue';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import { useModal } from '/@/components/Modal';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import GroupModal from './components/GroupModal.vue';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import { searchFormSchema, columns } from './components/config';
|
||||||
|
import Icon from '/@/components/Icon/index';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import useEventBus from '/@/hooks/event/useEventBus';
|
||||||
|
import { addGroupUser,getGroupUser,addGroupRole,getGroupRole } from '/@/api/system/group';
|
||||||
|
|
||||||
|
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||||
|
|
||||||
|
const { notification } = useMessage();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
defineEmits(['register']);
|
||||||
|
const { filterColumnAuth, filterButtonAuth } = usePermission();
|
||||||
|
const visible = ref<boolean>(false);
|
||||||
|
const filterColumns = filterColumnAuth(columns);
|
||||||
|
const tableRef = ref();
|
||||||
|
const selectedUserId = ref<string[]>([]);
|
||||||
|
const [registerModal, { openModal:openGroupModal,setModalProps:setGroupModalProps }] = useModal();
|
||||||
|
const [registerAuthModal, { openModal,setModalProps }] = useModal();
|
||||||
|
const [registerRoleListModal, { openModal:openRoleListProps,setModalProps:setRoleListProps }] = useModal();
|
||||||
|
const [registerRoleModal, { openModal:openRoleModal,setModalProps:setRoleModalProps}] = useModal();
|
||||||
|
|
||||||
|
|
||||||
|
//展示在列表内的按钮
|
||||||
|
const actionButtons = ref<string[]>([ 'edit', 'copyData', 'delete', 'startwork','flowRecord']);
|
||||||
|
const buttonConfigs = computed(()=>{
|
||||||
|
const list = [
|
||||||
|
{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},
|
||||||
|
{"isUse":true,"name":"新增用户组","code":"add","icon":"","isDefault":true,"type":"primary"},
|
||||||
|
{"isUse":true,"name":"添加角色","code":"addRole","icon":"","isDefault":true,"type":"primary"},
|
||||||
|
{"isUse":true,"name":"查看角色","code":"viewRole","icon":"","isDefault":true,"type":"primary"},
|
||||||
|
{"isUse":true,"name":"添加成员","code":"addMember","icon":"","isDefault":true,"type":"primary"},
|
||||||
|
{"isUse":true,"name":"查看成员","code":"viewMember","icon":"","isDefault":true,"type":"primary"},
|
||||||
|
{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]
|
||||||
|
return filterButtonAuth(list);
|
||||||
|
})
|
||||||
|
|
||||||
|
const tableButtonConfig = computed(() => {
|
||||||
|
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
|
||||||
|
});
|
||||||
|
|
||||||
|
const actionButtonConfig = computed(() => {
|
||||||
|
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
|
||||||
|
});
|
||||||
|
|
||||||
|
const btnEvent = {
|
||||||
|
edit : handleEdit,
|
||||||
|
refresh : handleRefresh,
|
||||||
|
view : handleView,
|
||||||
|
batchdelete : handleBatchdelete,
|
||||||
|
delete : handleDelete,
|
||||||
|
addMember:handleAddUser,
|
||||||
|
add:handleAdd,
|
||||||
|
viewMember:handleViewUser,
|
||||||
|
addRole:handleAddRole,
|
||||||
|
viewRole:handleViewRole,
|
||||||
|
}
|
||||||
|
|
||||||
|
const { currentRoute } = useRouter();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
||||||
|
const formIdComputedRef = ref();
|
||||||
|
formIdComputedRef.value = currentRoute.value.meta.formId
|
||||||
|
const schemaIdComputedRef = ref();
|
||||||
|
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const selectedKeys = ref<string[]>([]);
|
||||||
|
const selectedRowsData = ref<any[]>([]);
|
||||||
|
|
||||||
|
const formName='用户组管理';
|
||||||
|
const [registerTable, { reload,getSelectRows }] = useTable({
|
||||||
|
title: '' || (formName + '列表'),
|
||||||
|
api: getXjrGroupPage,
|
||||||
|
rowKey: 'id',
|
||||||
|
columns: filterColumns,
|
||||||
|
formConfig: {
|
||||||
|
rowProps: {
|
||||||
|
gutter: 16,
|
||||||
|
},
|
||||||
|
schemas: searchFormSchema,
|
||||||
|
fieldMapToTime: [],
|
||||||
|
showResetButton: false,
|
||||||
|
},
|
||||||
|
beforeFetch: (params) => {
|
||||||
|
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||||
|
},
|
||||||
|
afterFetch: (res) => {
|
||||||
|
tableRef.value.setToolBarWidth();
|
||||||
|
|
||||||
|
},
|
||||||
|
useSearchForm: true,
|
||||||
|
showTableSetting: true,
|
||||||
|
|
||||||
|
striped: false,
|
||||||
|
actionColumn: {
|
||||||
|
width: 160,
|
||||||
|
title: '操作',
|
||||||
|
dataIndex: 'action',
|
||||||
|
slots: { customRender: 'action' },
|
||||||
|
},
|
||||||
|
tableSetting: {
|
||||||
|
size: false,
|
||||||
|
setting: false,
|
||||||
|
},
|
||||||
|
customRow,
|
||||||
|
});
|
||||||
|
|
||||||
|
function dbClickRow(record) {
|
||||||
|
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||||
|
if (taskIds && taskIds.length) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
taskId: taskIds[0],
|
||||||
|
formName: formName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (schemaId && !taskIds && processId) {
|
||||||
|
router.push({
|
||||||
|
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
|
||||||
|
query: {
|
||||||
|
readonly: 1,
|
||||||
|
taskId: '',
|
||||||
|
formName: formName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
router.push({
|
||||||
|
path: '/form/Group/' + record.id + '/viewForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'system/Group',
|
||||||
|
formName: formName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonClick(code) {
|
||||||
|
|
||||||
|
btnEvent[code]();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAdd() {
|
||||||
|
openGroupModal(true, {
|
||||||
|
isUpdate: false,
|
||||||
|
});
|
||||||
|
setGroupModalProps({ title: t('新增用户组') });
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
|
||||||
|
router.push({
|
||||||
|
path: '/form/Group/' + record.id + '/updateForm',
|
||||||
|
query: {
|
||||||
|
formPath: 'system/group',
|
||||||
|
formName: formName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function handleDelete(record: Recordable) {
|
||||||
|
deleteList([record.id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleViewUser(){
|
||||||
|
let rows = warning();
|
||||||
|
if (!rows) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getGroupUser(rows.id).then((res) => {
|
||||||
|
openModal(true, res);
|
||||||
|
setModalProps({ title: t('查看成员') });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAddUser(record: Recordable) {
|
||||||
|
let rows = warning();
|
||||||
|
if (!rows) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getGroupUser(rows.id).then((res) => {
|
||||||
|
selectedUserId.value = res.map((item) => {
|
||||||
|
return item.id;
|
||||||
|
});
|
||||||
|
console.log(selectedUserId.value);
|
||||||
|
visible.value = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleAddRole() {
|
||||||
|
const rows = warning();
|
||||||
|
if (!rows) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await getGroupRole(rows.id);
|
||||||
|
openRoleModal(true, {
|
||||||
|
roles: res,
|
||||||
|
});
|
||||||
|
setRoleModalProps({ title: t('添加角色') });
|
||||||
|
} catch (e) {
|
||||||
|
console.error('获取角色失败', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleViewRole(){
|
||||||
|
let rows = warning();
|
||||||
|
if (!rows) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getGroupRole(rows.id).then((res) => {
|
||||||
|
openRoleListProps(true, res);
|
||||||
|
setRoleListProps({ title: t('查看角色') });
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSelectUserSuccess(rows, type) {
|
||||||
|
const selectRows = getSelectRows();
|
||||||
|
let paramas;
|
||||||
|
if (type === 0) {
|
||||||
|
paramas = { type, id: selectRows[0].id, userIds: rows };
|
||||||
|
} else {
|
||||||
|
paramas = { type, id: selectRows[0].id, departmentIds: rows };
|
||||||
|
}
|
||||||
|
|
||||||
|
addGroupUser(paramas).then((_) => {
|
||||||
|
notification.info({
|
||||||
|
message: t('添加人员'),
|
||||||
|
description: t('成功'),
|
||||||
|
}); //提示消息
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSelectRoleSuccess(rows, type) {
|
||||||
|
const selectRows = getSelectRows();
|
||||||
|
let paramas = { type, id: selectRows[0].id, roleIds: rows.map(row => row.id) };
|
||||||
|
|
||||||
|
|
||||||
|
addGroupRole(paramas).then((_) => {
|
||||||
|
notification.info({
|
||||||
|
message: t('添加角色'),
|
||||||
|
description: t('成功'),
|
||||||
|
}); //提示消息
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function warning(isAdminCantUse = false) {
|
||||||
|
const selectRows = getSelectRows();
|
||||||
|
if (selectRows.length === 0) {
|
||||||
|
notification.warning({
|
||||||
|
message: t('警告'),
|
||||||
|
description: t('必须选中一行!'),
|
||||||
|
}); //提示消息
|
||||||
|
return false;
|
||||||
|
} else if (isAdminCantUse && selectRows[0].id === '1') {
|
||||||
|
notification.warning({
|
||||||
|
message: t('警告'),
|
||||||
|
description: t('超级管理员不允许授权'),
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return selectRows[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleBatchdelete() {
|
||||||
|
if (!selectedKeys.value.length) {
|
||||||
|
notification.warning({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('请选择需要删除的数据'),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//与工作流相关的数据不能进行批量删除
|
||||||
|
const cantDelete = selectedRowsData.value.filter((x) => {
|
||||||
|
return (
|
||||||
|
(x.workflowData?.enabled && x.workflowData?.status) ||
|
||||||
|
(!x.workflowData?.enabled && !!x.workflowData?.processId)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
if (cantDelete.length) {
|
||||||
|
notification.warning({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('含有不能删除的数据'),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
deleteList(selectedKeys.value);
|
||||||
|
}
|
||||||
|
function deleteList(ids) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示信息',
|
||||||
|
icon: createVNode(ExclamationCircleOutlined),
|
||||||
|
content: '是否确认删除?',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk() {
|
||||||
|
deleteXjrGroup(ids).then((_) => {
|
||||||
|
handleSuccess();
|
||||||
|
notification.success({
|
||||||
|
message: 'Tip',
|
||||||
|
description: t('删除成功!'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onCancel() {},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function onSelectChange(selectedRowKeys: [], selectedRows) {
|
||||||
|
selectedKeys.value = selectedRowKeys;
|
||||||
|
selectedRowsData.value = selectedRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
function customRow(record: Recordable) {
|
||||||
|
return {
|
||||||
|
onClick: () => {
|
||||||
|
let selectedRowKeys = [...selectedKeys.value];
|
||||||
|
if (selectedRowKeys.indexOf(record.id) >= 0) {
|
||||||
|
let index = selectedRowKeys.indexOf(record.id);
|
||||||
|
selectedRowKeys.splice(index, 1);
|
||||||
|
} else {
|
||||||
|
selectedRowKeys.push(record.id);
|
||||||
|
}
|
||||||
|
selectedKeys.value = selectedRowKeys;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function handleRefresh() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
function handleSuccess() {
|
||||||
|
|
||||||
|
selectedKeys.value = [];
|
||||||
|
selectedRowsData.value = [];
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleView(record: Recordable) {
|
||||||
|
|
||||||
|
dbClickRow(record);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
bus.on(FLOW_PROCESSED, handleRefresh);
|
||||||
|
bus.on(CREATE_FLOW, handleRefresh);
|
||||||
|
} else {
|
||||||
|
bus.on(FORM_LIST_MODIFIED, handleRefresh);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (schemaIdComputedRef.value) {
|
||||||
|
bus.off(FLOW_PROCESSED, handleRefresh);
|
||||||
|
bus.off(CREATE_FLOW, handleRefresh);
|
||||||
|
} else {
|
||||||
|
bus.off(FORM_LIST_MODIFIED, handleRefresh);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
function getActions(record: Recordable):ActionItem[] {
|
||||||
|
|
||||||
|
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
|
||||||
|
if (!record.workflowData?.processId) {
|
||||||
|
return {
|
||||||
|
icon: button?.icon,
|
||||||
|
tooltip: button?.name,
|
||||||
|
color: button.code === 'delete' ? 'error' : undefined,
|
||||||
|
onClick: btnEvent[button.code].bind(null, record),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (button.code === 'view') {
|
||||||
|
return {
|
||||||
|
icon: button?.icon,
|
||||||
|
tooltip: button?.name,
|
||||||
|
onClick: btnEvent[button.code].bind(null, record),
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return actionsList;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<style lang="less" scoped>
|
||||||
|
:deep(.ant-table-selection-col) {
|
||||||
|
width: 50px;
|
||||||
|
}
|
||||||
|
.show{
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.hide{
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user