style: lint格式化文件

This commit is contained in:
2025-10-21 18:04:02 +08:00
parent f9ca969fec
commit 7629120548
1092 changed files with 148218 additions and 157907 deletions

View File

@ -1,6 +1,6 @@
import {
defineAsyncComponent,
// FunctionalComponent, CSSProperties
defineAsyncComponent
// FunctionalComponent, CSSProperties
} from 'vue';
import { Spin } from 'ant-design-vue';
import { noop } from '/@/utils';
@ -20,44 +20,44 @@ import { noop } from '/@/utils';
// };
interface Options {
size?: 'default' | 'small' | 'large';
delay?: number;
timeout?: number;
loading?: boolean;
retry?: boolean;
size?: 'default' | 'small' | 'large';
delay?: number;
timeout?: number;
loading?: boolean;
retry?: boolean;
}
export function createAsyncComponent(loader: Fn, options: Options = {}) {
const { size = 'small', delay = 100, timeout = 30000, loading = false, retry = true } = options;
return defineAsyncComponent({
loader,
loadingComponent: loading ? <Spin spinning={true} size={size} /> : undefined,
// The error component will be displayed if a timeout is
// provided and exceeded. Default: Infinity.
// TODO
timeout,
// errorComponent
// Defining if component is suspensible. Default: true.
// suspensible: false,
delay,
/**
*
* @param {*} error Error message object
* @param {*} retry A function that indicating whether the async component should retry when the loader promise rejects
* @param {*} fail End of failure
* @param {*} attempts Maximum allowed retries number
*/
onError: !retry
? noop
: (error, retry, fail, attempts) => {
if (error.message.match(/fetch/) && attempts <= 3) {
// retry on fetch errors, 3 max attempts
retry();
} else {
// Note that retry/fail are like resolve/reject of a promise:
// one of them must be called for the error handling to continue.
fail();
}
},
});
const { size = 'small', delay = 100, timeout = 30000, loading = false, retry = true } = options;
return defineAsyncComponent({
loader,
loadingComponent: loading ? <Spin spinning={true} size={size} /> : undefined,
// The error component will be displayed if a timeout is
// provided and exceeded. Default: Infinity.
// TODO
timeout,
// errorComponent
// Defining if component is suspensible. Default: true.
// suspensible: false,
delay,
/**
*
* @param {*} error Error message object
* @param {*} retry A function that indicating whether the async component should retry when the loader promise rejects
* @param {*} fail End of failure
* @param {*} attempts Maximum allowed retries number
*/
onError: !retry
? noop
: (error, retry, fail, attempts) => {
if (error.message.match(/fetch/) && attempts <= 3) {
// retry on fetch errors, 3 max attempts
retry();
} else {
// Note that retry/fail are like resolve/reject of a promise:
// one of them must be called for the error handling to continue.
fail();
}
}
});
}

View File

@ -1,25 +1,25 @@
const statusMap = {
ACTIVE: '审批中',
SUSPENDED: '挂起',
COMPLETED: '已完成',
'INTERNALLY_TERMINATED': '已终止'
}
ACTIVE: '审批中',
SUSPENDED: '挂起',
COMPLETED: '已完成',
INTERNALLY_TERMINATED: '已终止'
};
const statusColorMap = {
ACTIVE: '#0000FF',
SUSPENDED: '#EFBD47',
COMPLETED: '#009900',
'INTERNALLY_TERMINATED': '#FF0000'
}
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
}
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;
}

View File

@ -5,16 +5,16 @@ import { isFunction } from '/@/utils/is';
* @description: Get slot to prevent empty error
*/
export function getSlot(slots: Slots, slot = 'default', data?: any) {
if (!slots || !Reflect.has(slots, slot)) {
return null;
}
if (!isFunction(slots[slot])) {
console.error(`${slot} is not a function!`);
return null;
}
const slotFn = slots[slot];
if (!slotFn) return null;
return slotFn(data);
if (!slots || !Reflect.has(slots, slot)) {
return null;
}
if (!isFunction(slots[slot])) {
console.error(`${slot} is not a function!`);
return null;
}
const slotFn = slots[slot];
if (!slotFn) return null;
return slotFn(data);
}
/**
@ -23,13 +23,13 @@ export function getSlot(slots: Slots, slot = 'default', data?: any) {
* @param excludeKeys
*/
export function extendSlots(slots: Slots, excludeKeys: string[] = []) {
const slotKeys = Object.keys(slots);
const ret: any = {};
slotKeys.map((key) => {
if (excludeKeys.includes(key)) {
return null;
}
ret[key] = () => getSlot(slots, key);
});
return ret;
const slotKeys = Object.keys(slots);
const ret: any = {};
slotKeys.map((key) => {
if (excludeKeys.includes(key)) {
return null;
}
ret[key] = () => getSlot(slots, key);
});
return ret;
}