--添加测试模块
This commit is contained in:
@ -22,7 +22,7 @@ export function getAppEnvConfig() {
|
||||
(import.meta.env as unknown as GlobEnvConfig)
|
||||
: window[ENV_NAME as any]) as unknown as GlobEnvConfig;
|
||||
|
||||
const { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_REQUEST_TIMEOUT, VITE_GLOB_UPLOAD_URL, VITE_GLOB_UPLOAD_PREVIEW, VITE_GLOB_OUT_LINK_URL, VITE_GLOB_REPORT_URL, VITE_GLOB_PRINT_BASE_URL, VITE_GLOB_TENANT_ENABLED,VITE_GLOB_TENANT_INPUT_REQUIRED,VITE_GLOB_UPLOAD_ALERT_TIP } = ENV;
|
||||
const { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_REQUEST_TIMEOUT, VITE_GLOB_UPLOAD_URL, VITE_GLOB_UPLOAD_PREVIEW, VITE_GLOB_OUT_LINK_URL, VITE_GLOB_REPORT_URL, VITE_GLOB_PRINT_BASE_URL, VITE_GLOB_TENANT_ENABLED,VITE_GLOB_TENANT_INPUT_REQUIRED,VITE_GLOB_UPLOAD_ALERT_TIP, VITE_GLOB_CLOSE_ALERT_DISABLED } = ENV;
|
||||
|
||||
if (!/^[a-zA-Z\_]*$/.test(VITE_GLOB_APP_SHORT_NAME)) {
|
||||
warn(`VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`);
|
||||
@ -41,7 +41,8 @@ export function getAppEnvConfig() {
|
||||
VITE_GLOB_PRINT_BASE_URL,
|
||||
VITE_GLOB_TENANT_ENABLED,
|
||||
VITE_GLOB_TENANT_INPUT_REQUIRED,
|
||||
VITE_GLOB_UPLOAD_ALERT_TIP
|
||||
VITE_GLOB_UPLOAD_ALERT_TIP,
|
||||
VITE_GLOB_CLOSE_ALERT_DISABLED
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
25
src/utils/flow/index.js
Normal file
25
src/utils/flow/index.js
Normal file
@ -0,0 +1,25 @@
|
||||
const statusMap = {
|
||||
ACTIVE: '审批中',
|
||||
SUSPENDED: '挂起',
|
||||
COMPLETED: '已完成',
|
||||
'INTERNALLY_TERMINATED': '已终止'
|
||||
}
|
||||
|
||||
const statusColorMap = {
|
||||
ACTIVE: '#0000FF',
|
||||
SUSPENDED: '#EFBD47',
|
||||
COMPLETED: '#009900',
|
||||
'INTERNALLY_TERMINATED': '#FF0000'
|
||||
}
|
||||
|
||||
export function setIndexFlowStatus(workflowData) {
|
||||
const status = {};
|
||||
if (workflowData.taskIds) {
|
||||
status.label = '待审批';
|
||||
status.style = { color: '#CC9900' };
|
||||
} else {
|
||||
status.label = statusMap[workflowData.status]
|
||||
status.style = { color: statusColorMap[workflowData.status] }
|
||||
}
|
||||
return status
|
||||
}
|
||||
@ -645,6 +645,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
import { usePermission } from '/@/hooks/web/usePermission';
|
||||
import { useFormConfig } from '/@/hooks/web/useFormConfig';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { setIndexFlowStatus } from '/@/utils/flow/index'
|
||||
import { get${pascalMainTableName} } from '/@/api/${
|
||||
model.outputConfig.outputValue
|
||||
}/${lowerClassName}';
|
||||
@ -1493,7 +1494,7 @@ ${hasTemplatePrint ? ' reactive ' : ''}
|
||||
if (record.workflowData?.enabled) {
|
||||
//与工作流有关联的表单
|
||||
if (record.workflowData.status) {
|
||||
// 查看按钮现在同时有流程和表单的功能
|
||||
actionsList.unshift(setIndexFlowStatus(record.workflowData))
|
||||
} else {
|
||||
actionsList = actionsList.concat(editAndDelBtn);
|
||||
}
|
||||
@ -1674,7 +1675,7 @@ export function buildSimpleFormCode(model: GeneratorConfig, _tableInfo: TableInf
|
||||
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
|
||||
import { formProps, formEventConfigs ,formConfig} from './config';
|
||||
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
|
||||
import { add${pascalMainTableName}, get${pascalMainTableName}, update${pascalMainTableName} } from '/@/api/${
|
||||
import { add${pascalMainTableName}, get${pascalMainTableName}, update${pascalMainTableName}, delete${pascalMainTableName} } from '/@/api/${
|
||||
model.outputConfig.outputValue
|
||||
}/${lowerClassName}';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
@ -1867,6 +1868,12 @@ export function buildSimpleFormCode(model: GeneratorConfig, _tableInfo: TableInf
|
||||
systemFormRef.value,
|
||||
formProps.schemas); //表单事件:加载表单
|
||||
}
|
||||
function getFormModel() {
|
||||
return systemFormRef.value.formModel
|
||||
}
|
||||
async function handleDelete(id) {
|
||||
return await delete${pascalMainTableName}([id]);
|
||||
}
|
||||
defineExpose({
|
||||
setFieldsValue,
|
||||
resetFields,
|
||||
@ -1878,6 +1885,8 @@ export function buildSimpleFormCode(model: GeneratorConfig, _tableInfo: TableInf
|
||||
setMenuPermission,
|
||||
setWorkFlowForm,
|
||||
getRowKey,
|
||||
getFormModel,
|
||||
handleDelete
|
||||
});
|
||||
</script>\n
|
||||
`;
|
||||
|
||||
@ -24,6 +24,9 @@ import { notification } from 'ant-design-vue';
|
||||
import { throttle } from 'lodash-es';
|
||||
import useGlobalFlag from '/@/hooks/core/useGlobalFlag';
|
||||
|
||||
import { useLockStore } from '/@/store/modules/lock';
|
||||
|
||||
|
||||
const globSetting = useGlobSetting();
|
||||
const urlPrefix = globSetting.urlPrefix;
|
||||
const { createMessage, createErrorModal } = useMessage();
|
||||
@ -66,7 +69,7 @@ const transform: AxiosTransform = {
|
||||
throw new Error(t('请求出错,请稍候重试'));
|
||||
}
|
||||
// 这里 code,result,message为 后台统一的字段,需要在 types.ts内修改为项目自己的接口返回格式
|
||||
const { code, data, msg } = result;
|
||||
const { code, data, msg, tid } = result;
|
||||
|
||||
// 这里逻辑可以根据项目进行修改
|
||||
const hasSuccess = code === ResultEnum.SUCCESS;
|
||||
@ -83,9 +86,22 @@ const transform: AxiosTransform = {
|
||||
|
||||
const userStore = useUserStoreWithOut();
|
||||
userStore.setToken(undefined);
|
||||
console.log('登录超时,请重新登录!');
|
||||
|
||||
if (!window.location.hash.includes('login')&&!window.location.pathname.includes('login')
|
||||
&&!window.location.hash.includes('tokenLogin')&&!window.location.pathname.includes('tokenLogin')) {
|
||||
userStore.logout(true);
|
||||
if (userStore.getUserInfo.loginConfig?.lockPageReLogin) {
|
||||
console.error('not login page goto lockpage window.location.hash={}, window.location.pathname={}', window.location.hash, window.location.pathname, timeoutMsg);
|
||||
// 触发全局弹层锁屏
|
||||
const lockStore = useLockStore();
|
||||
lockStore.setLockInfo({
|
||||
isLock: true,
|
||||
msg: timeoutMsg
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
userStore.logout(true);
|
||||
}
|
||||
}
|
||||
if (data) {
|
||||
if(data.urlToRedirectTo){
|
||||
@ -98,12 +114,29 @@ const transform: AxiosTransform = {
|
||||
}else{
|
||||
// data 有logout 信息 ,存sessionStorage 给login page 弹框显示
|
||||
if (data.logoutMessage) {
|
||||
console.error('logoutMessage', data.logoutMessage);
|
||||
timeoutMsg = data.logoutMessage;
|
||||
sessionStorage.setItem('logoutInfoData', JSON.stringify({
|
||||
logoutMessage: data.logoutMessage,
|
||||
}));
|
||||
}
|
||||
const go = useGo();
|
||||
go('/login');
|
||||
if (userStore.getUserInfo.loginConfig?.lockPageReLogin) {
|
||||
console.error('go-login', timeoutMsg);
|
||||
// 触发全局弹层锁屏
|
||||
const lockStore = useLockStore();
|
||||
lockStore.setLockInfo({
|
||||
isLock: true,
|
||||
msg: timeoutMsg
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
const go = useGo();
|
||||
if(go) {
|
||||
go('/login');
|
||||
} else {
|
||||
throw new Error(timeoutMsg || t('请求出错,请稍候重试'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -118,6 +151,10 @@ const transform: AxiosTransform = {
|
||||
if (options.ignoreErrorInEditor && isEditorOpen.value) {
|
||||
ajaxError();
|
||||
} else {
|
||||
if (tid) {
|
||||
timeoutMsg = timeoutMsg + '(异常操作号:' + tid + ')';
|
||||
}
|
||||
console.error('异常操作:', timeoutMsg, new Date().toLocaleString());
|
||||
if (options.errorMessageMode === 'modal') {
|
||||
createErrorModal({ title: t('错误提示'), content: timeoutMsg });
|
||||
} else if (options.errorMessageMode === 'message') {
|
||||
@ -252,7 +289,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
|
||||
// authentication schemes,e.g: Bearer
|
||||
// authenticationScheme: 'Bearer',
|
||||
authenticationScheme: 'Bearer',
|
||||
timeout: 600000,
|
||||
timeout: globSetting.requestTimeout||60 * 1000,
|
||||
// 基础接口地址
|
||||
// baseURL: globSetting.apiUrl,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user