fix: 修改引用文件名和实际不一致的问题。
feat: 增加根据 location.origin 获取当前请求地址的功能。
This commit is contained in:
@ -16,7 +16,7 @@ VITE_BUILD_COMPRESS = 'gzip'
|
||||
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
|
||||
|
||||
# 接口地址 可以由nginx做转发或者直接写实际地址
|
||||
VITE_GLOB_API_URL=http://10.0.252.5:3100/api
|
||||
VITE_GLOB_API_URL=${location.origin}/api
|
||||
|
||||
|
||||
# 文件上传地址 可以由nginx做转发或者直接写实际地址
|
||||
|
||||
@ -21,7 +21,7 @@ function createConfig(params: CreateConfigParams) {
|
||||
try {
|
||||
const windowConf = `window.${configName}`;
|
||||
// Ensure that the variable will not be modified
|
||||
let configStr = `${windowConf}=${JSON.stringify(config)};`;
|
||||
let configStr = `${windowConf}=${JSON.stringify(config).replace(/:"([^"]+)"/g, ':`$1`')};`;
|
||||
configStr += `
|
||||
Object.freeze(${windowConf});
|
||||
Object.defineProperty(window, "${configName}", {
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
|
||||
|
||||
|
||||
<BasicTable @register="registerTable" ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys,type: 'radio', onChange: onSelectChange }" @row-dbClick="dbClickRow">
|
||||
|
||||
<BasicTable @register="registerTable" ref="tableRef" :row-selection="{ selectedRowKeys: selectedKeys, type: 'radio', onChange: onSelectChange }" @row-db-click="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)">
|
||||
@ -17,9 +14,6 @@
|
||||
</template>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
<TableAction :actions="getActions(record)" />
|
||||
</template>
|
||||
@ -42,21 +36,15 @@
|
||||
<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 { 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 { getXjrGroupPage, deleteXjrGroup } from '/@/api/system/group';
|
||||
import { SelectDepartment } from '/@/components/SelectOrganizational/index';
|
||||
import { PageWrapper } from '/@/components/Page';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
@ -67,30 +55,15 @@
|
||||
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';
|
||||
import { addGroupUser, getGroupUser, addGroupRole, getGroupRole } from '/@/api/system/group';
|
||||
|
||||
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
|
||||
|
||||
@ -103,25 +76,25 @@
|
||||
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 [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 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}]
|
||||
{ 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));
|
||||
@ -132,54 +105,48 @@
|
||||
});
|
||||
|
||||
const btnEvent = {
|
||||
edit : handleEdit,
|
||||
refresh : handleRefresh,
|
||||
view : handleView,
|
||||
batchdelete : handleBatchdelete,
|
||||
delete : handleDelete,
|
||||
addMember:handleAddUser,
|
||||
add:handleAdd,
|
||||
viewMember:handleViewUser,
|
||||
addRole:handleAddRole,
|
||||
viewRole:handleViewRole,
|
||||
}
|
||||
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
|
||||
formIdComputedRef.value = currentRoute.value.meta.formId;
|
||||
const schemaIdComputedRef = ref();
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
|
||||
|
||||
|
||||
|
||||
|
||||
schemaIdComputedRef.value = currentRoute.value.meta.schemaId;
|
||||
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
const selectedRowsData = ref<any[]>([]);
|
||||
|
||||
const formName='用户组管理';
|
||||
const [registerTable, { reload,getSelectRows }] = useTable({
|
||||
title: '' || (formName + '列表'),
|
||||
const formName = '用户组管理';
|
||||
const [registerTable, { reload, getSelectRows }] = useTable({
|
||||
title: '' || formName + '列表',
|
||||
api: getXjrGroupPage,
|
||||
rowKey: 'id',
|
||||
columns: filterColumns,
|
||||
formConfig: {
|
||||
rowProps: {
|
||||
gutter: 16,
|
||||
gutter: 16
|
||||
},
|
||||
schemas: searchFormSchema,
|
||||
fieldMapToTime: [],
|
||||
showResetButton: false,
|
||||
showResetButton: false
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||
},
|
||||
afterFetch: (res) => {
|
||||
tableRef.value.setToolBarWidth();
|
||||
|
||||
},
|
||||
useSearchForm: true,
|
||||
showTableSetting: true,
|
||||
@ -189,17 +156,17 @@
|
||||
width: 160,
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
slots: { customRender: 'action' },
|
||||
slots: { customRender: 'action' }
|
||||
},
|
||||
tableSetting: {
|
||||
size: false,
|
||||
setting: false,
|
||||
setting: false
|
||||
},
|
||||
customRow,
|
||||
customRow
|
||||
});
|
||||
|
||||
function dbClickRow(record) {
|
||||
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
|
||||
if (!actionButtonConfig?.value.some((element) => element.code == 'view')) {
|
||||
return;
|
||||
}
|
||||
const { processId, taskIds, schemaId } = record.workflowData || {};
|
||||
@ -232,19 +199,17 @@
|
||||
}
|
||||
|
||||
function buttonClick(code) {
|
||||
|
||||
btnEvent[code]();
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openGroupModal(true, {
|
||||
isUpdate: false,
|
||||
isUpdate: false
|
||||
});
|
||||
setGroupModalProps({ title: t('新增用户组') });
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
|
||||
router.push({
|
||||
path: '/form/Group/' + record.id + '/updateForm',
|
||||
query: {
|
||||
@ -254,13 +219,11 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteList([record.id]);
|
||||
}
|
||||
|
||||
function handleViewUser(){
|
||||
function handleViewUser() {
|
||||
let rows = warning();
|
||||
if (!rows) {
|
||||
return;
|
||||
@ -293,7 +256,7 @@
|
||||
try {
|
||||
const res = await getGroupRole(rows.id);
|
||||
openRoleModal(true, {
|
||||
roles: res,
|
||||
roles: res
|
||||
});
|
||||
setRoleModalProps({ title: t('添加角色') });
|
||||
} catch (e) {
|
||||
@ -301,7 +264,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function handleViewRole(){
|
||||
function handleViewRole() {
|
||||
let rows = warning();
|
||||
if (!rows) {
|
||||
return;
|
||||
@ -310,7 +273,6 @@
|
||||
openRoleListProps(true, res);
|
||||
setRoleListProps({ title: t('查看角色') });
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function handleSelectUserSuccess(rows, type) {
|
||||
@ -325,20 +287,19 @@
|
||||
addGroupUser(paramas).then((_) => {
|
||||
notification.info({
|
||||
message: t('添加人员'),
|
||||
description: t('成功'),
|
||||
description: t('成功')
|
||||
}); //提示消息
|
||||
});
|
||||
}
|
||||
|
||||
function handleSelectRoleSuccess(rows, type) {
|
||||
const selectRows = getSelectRows();
|
||||
let paramas = { type, id: selectRows[0].id, roleIds: rows.map(row => row.id) };
|
||||
|
||||
let paramas = { type, id: selectRows[0].id, roleIds: rows.map((row) => row.id) };
|
||||
|
||||
addGroupRole(paramas).then((_) => {
|
||||
notification.info({
|
||||
message: t('添加角色'),
|
||||
description: t('成功'),
|
||||
description: t('成功')
|
||||
}); //提示消息
|
||||
});
|
||||
}
|
||||
@ -348,13 +309,13 @@
|
||||
if (selectRows.length === 0) {
|
||||
notification.warning({
|
||||
message: t('警告'),
|
||||
description: t('必须选中一行!'),
|
||||
description: t('必须选中一行!')
|
||||
}); //提示消息
|
||||
return false;
|
||||
} else if (isAdminCantUse && selectRows[0].id === '1') {
|
||||
notification.warning({
|
||||
message: t('警告'),
|
||||
description: t('超级管理员不允许授权'),
|
||||
description: t('超级管理员不允许授权')
|
||||
});
|
||||
return false;
|
||||
} else {
|
||||
@ -366,21 +327,18 @@
|
||||
if (!selectedKeys.value.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: t('请选择需要删除的数据'),
|
||||
description: t('请选择需要删除的数据')
|
||||
});
|
||||
return;
|
||||
}
|
||||
//与工作流相关的数据不能进行批量删除
|
||||
const cantDelete = selectedRowsData.value.filter((x) => {
|
||||
return (
|
||||
(x.workflowData?.enabled && x.workflowData?.status) ||
|
||||
(!x.workflowData?.enabled && !!x.workflowData?.processId)
|
||||
);
|
||||
return (x.workflowData?.enabled && x.workflowData?.status) || (!x.workflowData?.enabled && !!x.workflowData?.processId);
|
||||
});
|
||||
if (cantDelete.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: t('含有不能删除的数据'),
|
||||
description: t('含有不能删除的数据')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@ -398,17 +356,14 @@
|
||||
handleSuccess();
|
||||
notification.success({
|
||||
message: 'Tip',
|
||||
description: t('删除成功!'),
|
||||
description: t('删除成功!')
|
||||
});
|
||||
});
|
||||
},
|
||||
onCancel() {},
|
||||
onCancel() {}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function onSelectChange(selectedRowKeys: [], selectedRows) {
|
||||
selectedKeys.value = selectedRowKeys;
|
||||
selectedRowsData.value = selectedRows;
|
||||
@ -425,32 +380,24 @@
|
||||
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);
|
||||
@ -466,22 +413,21 @@
|
||||
bus.off(FORM_LIST_MODIFIED, handleRefresh);
|
||||
}
|
||||
});
|
||||
function getActions(record: Recordable):ActionItem[] {
|
||||
|
||||
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),
|
||||
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),
|
||||
onClick: btnEvent[button.code].bind(null, record)
|
||||
};
|
||||
} else {
|
||||
return {};
|
||||
@ -490,16 +436,17 @@
|
||||
});
|
||||
return actionsList;
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
:deep(.ant-table-selection-col) {
|
||||
width: 50px;
|
||||
}
|
||||
.show{
|
||||
|
||||
.show {
|
||||
display: flex;
|
||||
}
|
||||
.hide{
|
||||
|
||||
.hide {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user