diff --git a/back/services/cron.ts b/back/services/cron.ts index 26d71843..95b00dc6 100644 --- a/back/services/cron.ts +++ b/back/services/cron.ts @@ -245,8 +245,11 @@ export default class CronService { const filterKeys: any = Object.keys(filterQuery); for (const key of filterKeys) { let q: any = {}; - if (filterKeys[key]) { - q[key] = filterKeys[key]; + if (!filterQuery[key]) continue; + if (key === 'status' && filterQuery[key].includes(2)) { + q = { [Op.or]: [{ [key]: filterQuery[key] }, { isDisabled: 1 }] }; + } else { + q[key] = filterQuery[key]; } query[Op.and].push(q); } diff --git a/src/components/vlist.tsx b/src/components/vlist.tsx new file mode 100644 index 00000000..8d129360 --- /dev/null +++ b/src/components/vlist.tsx @@ -0,0 +1,404 @@ +import React, { + useRef, + useEffect, + useContext, + createContext, + useReducer, + useState, + useMemo, +} from 'react'; +import { throttle, isNumber, debounce } from 'lodash'; + +const initialState = { + // 行高度 + rowHeight: 0, + // 当前的scrollTop + curScrollTop: 0, + // 总行数 + totalLen: 0, +}; + +function reducer(state, action) { + const { curScrollTop, totalLen, ifScrollTopClear, scrollTop } = action; + + let stateScrollTop = state.curScrollTop; + switch (action.type) { + // 改变trs 即 改变渲染的列表trs + case 'changeTrs': + return { + ...state, + curScrollTop, + }; + // 更改totalLen + case 'changeTotalLen': + if (totalLen === 0) { + stateScrollTop = 0; + } + + return { + ...state, + totalLen, + curScrollTop: stateScrollTop, + }; + + case 'reset': + return { + ...state, + curScrollTop: ifScrollTopClear ? 0 : scrollTop ?? state.curScrollTop, + }; + default: + throw new Error(); + } +} + +// ==============全局常量 ================== // +const DEFAULT_VID = 'vtable'; +const vidMap = new Map(); +let preData = 0; + +// ===============context ============== // +const ScrollContext = createContext({ + dispatch: undefined, + renderLen: 1, + start: 0, + offsetStart: 0, + // ============= + rowHeight: initialState.rowHeight, + totalLen: 0, + vid: DEFAULT_VID, +}); + +// =============组件 =================== // + +function VCell(props: any): JSX.Element { + const { children, ...restProps } = props; + + return ( +