fix: lint && typecheck

This commit is contained in:
xingyu4j
2026-06-29 15:27:34 +08:00
parent 516c821c37
commit ded914d56c
43 changed files with 190 additions and 119 deletions

View File

@@ -55,7 +55,7 @@ export function refuseFriendRequest(
/** 查询「我相关」的好友申请列表(游标分页:传 maxId 加载更多) */
export function getMyFriendRequestList(limit: number, maxId?: number) {
const params: Record<string, number> = { limit };
if (maxId != null) {
if (maxId) {
params.maxId = maxId;
}
return requestClient.get<ImFriendRequestApi.FriendRequestRespVO[]>(

View File

@@ -4,6 +4,7 @@ import type { Conversation } from '../../types';
import { computed, ref } from 'vue';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { Input, message } from 'ant-design-vue';
@@ -81,7 +82,7 @@ const recentForwardConversations = computed(() =>
.map((key) => byKey.value.get(key))
.filter(
(c): c is Conversation =>
c != null && !hideSet.value.has(getConversationKey(c)),
!isUndefined(c) && !hideSet.value.has(getConversationKey(c)),
),
);
@@ -96,7 +97,7 @@ const selectedConversations = computed(() =>
.map((key) => byKey.value.get(key))
.filter(
(conversation): conversation is Conversation =>
conversation != null &&
!isUndefined(conversation) &&
!hideSet.value.has(getConversationKey(conversation)),
),
);

View File

@@ -7,6 +7,7 @@ import { computed, ref, watch } from 'vue';
import { confirm } from '@vben/common-ui';
import { CommonStatusEnum } from '@vben/constants';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import {
Button,
@@ -95,13 +96,10 @@ const myId = computed(() => getCurrentUserId());
/** 历史退群群:禁所有群操作入口(邀请 / 移出 / 改资料 / 禁言 / 审批 / 退出等只保留展示props.group 是 GroupLite 无 joinStatus回 store 取全量 */
const isQuitGroup = computed(() => {
const id = props.group?.id;
return id != null && isGroupQuit(groupStore.getGroup(id));
return !isUndefined(id) && isGroupQuit(groupStore.getGroup(id));
});
const isOwner = computed(
() =>
!isQuitGroup.value &&
props.group != null &&
props.group.ownerId === myId.value,
() => !isQuitGroup.value && props.group?.ownerId === myId.value,
);
/** 当前用户在群里的角色(来自 props.members 的 me 行);用于判定是否可移出他人 */
const myRole = computed(

View File

@@ -5,6 +5,7 @@ import { computed } from 'vue';
import { confirm } from '@vben/common-ui';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { Tag } from 'ant-design-vue';
@@ -86,7 +87,7 @@ const showSendName = computed(() => {
return false;
}
const lastType = props.conversation.lastMessageType;
return lastType != null && isNormalMessage(lastType);
return !isUndefined(lastType) && isNormalMessage(lastType);
});
/** 列表展示文案:草稿优先(对齐微信 PC有草稿时盖掉最后一条预览→ 撤回实时算 → lastContent 兜底 */
@@ -96,7 +97,7 @@ const lastContentDisplay = computed(() => {
}
if (
props.conversation.lastMessageType === ImContentType.RECALL &&
props.conversation.lastSenderId != null
!isUndefined(props.conversation.lastSenderId)
) {
return buildRecallTip(
props.conversation.lastSenderId,

View File

@@ -13,6 +13,7 @@ import { computed, inject } from 'vue';
import { confirm } from '@vben/common-ui';
import { IconifyIcon as Icon } from '@vben/icons';
import { useUserStore } from '@vben/stores';
import { isUndefined } from '@vben/utils';
import { useClipboard } from '@vueuse/core';
import { message as antdMessage, Tag } from 'ant-design-vue';
@@ -251,7 +252,7 @@ const redialRtcCall = inject(IM_RTC_REDIAL_KEY);
/** 私聊 RTC_CALL_END 气泡点击:用同款 mediaType 重拨 */
function handleRtcCallBubbleClick() {
const mediaType = rtcCallEndPrivatePayload.value?.mediaType;
if (mediaType == null) {
if (isUndefined(mediaType)) {
return;
}
redialRtcCall?.(mediaType);

View File

@@ -4,6 +4,7 @@ import type { ImManagerGroupApi } from '#/api/im/manager/group';
import { computed, ref, useAttrs, watch } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { Input, Tooltip } from 'ant-design-vue';
@@ -47,13 +48,13 @@ const showClear = computed(() => {
props.allowClear &&
!props.disabled &&
hovering.value &&
props.modelValue != null
props.modelValue !== null
);
});
/** 根据编号查询群信息(用于编辑回显) */
async function resolveItemById(id: number | undefined) {
if (id == null) {
if (isUndefined(id)) {
selectedItem.value = undefined;
return;
}
@@ -83,7 +84,9 @@ function handleClick(event: MouseEvent) {
clearSelected();
return;
}
dialogRef.value?.open(props.modelValue == null ? [] : [props.modelValue]);
dialogRef.value?.open(
isUndefined(props.modelValue) ? [] : [props.modelValue],
);
}
/** 弹窗选中回调 */

View File

@@ -1,3 +1,5 @@
import { isUndefined } from '@vben/utils';
import { getDb } from './db';
/**
@@ -54,16 +56,15 @@ export async function runIncrementalPull<T extends PullRecord>(
): Promise<void> {
const storedCursor = await getPullCursor(cursorKey);
const highWater = { ...storedCursor };
let cursor =
storedCursor.lastUpdateTime == null
? {}
: {
lastUpdateTime: Math.max(
0,
storedCursor.lastUpdateTime - PULL_OVERLAP_MS,
),
lastId: 0,
};
let cursor = isUndefined(storedCursor.lastUpdateTime)
? {}
: {
lastUpdateTime: Math.max(
0,
storedCursor.lastUpdateTime - PULL_OVERLAP_MS,
),
lastId: 0,
};
for (let page = 0; page < PULL_MAX_PAGES; page++) {
if (isActive && !isActive()) {
return;
@@ -89,12 +90,12 @@ export async function runIncrementalPull<T extends PullRecord>(
if (!last) {
return;
}
if (last.updateTime == null) {
if (isUndefined(last.updateTime)) {
return;
}
cursor = { lastUpdateTime: last.updateTime, lastId: last.id };
if (
highWater.lastUpdateTime == null ||
isUndefined(highWater.lastUpdateTime) ||
cursor.lastUpdateTime > highWater.lastUpdateTime ||
(cursor.lastUpdateTime === highWater.lastUpdateTime &&
cursor.lastId > (highWater.lastId ?? 0))
@@ -154,14 +155,14 @@ export async function runMinIdPull<T extends { id?: number }>(options: {
// 本批最大消息 id 作为下次游标;无有效 id 则本批 apply 后停(无法继续翻页)
const validIds = list
.map((record) => record.id)
.filter((id): id is number => id != null);
.filter((id): id is number => id !== null);
const nextMinId = validIds.length > 0 ? Math.max(...validIds) : undefined;
// applyPage 返回 false本页未落地如入库失败不推进游标并终止避免漏消息
if ((await applyPage(list, nextMinId)) === false) {
return;
}
// 无有效 id或游标没前进后端契约是 id > minId理论不会出现防御死翻
if (nextMinId == null || nextMinId <= minId) {
if (isUndefined(nextMinId) || nextMinId <= minId) {
return;
}
minId = nextMinId;

View File

@@ -58,7 +58,7 @@ watch(
// 只有商品发生变化时才重新查询
if (
productSpus.value.length === 0 ||
productSpus.value.some((spu) => spu.id == null || !ids.includes(spu.id))
productSpus.value.some((spu) => spu.id === null || !ids.includes(spu.id))
) {
productSpus.value = await getSpuDetailList(ids);
}

View File

@@ -60,7 +60,7 @@ watch(
if (
activityList.value.length === 0 ||
activityList.value.some(
(activity) => activity.id == null || !ids.includes(activity.id),
(activity) => activity.id === null || !ids.includes(activity.id),
)
) {
activityList.value = await getCombinationActivityListByIds(ids);

View File

@@ -59,7 +59,7 @@ watch(
if (
activityList.value.length === 0 ||
activityList.value.some(
(activity) => activity.id == null || !ids.includes(activity.id),
(activity) => activity.id === null || !ids.includes(activity.id),
)
) {
activityList.value = await getSeckillActivityListByIds(ids as number[]);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { message } from 'ant-design-vue';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -1,3 +1,5 @@
import { isUndefined } from '@vben/utils';
import { requestClient } from '#/api/request';
export namespace ImFriendRequestApi {
@@ -55,7 +57,7 @@ export function refuseFriendRequest(
/** 查询「我相关」的好友申请列表(游标分页:传 maxId 加载更多) */
export function getMyFriendRequestList(limit: number, maxId?: number) {
const params: Record<string, number> = { limit };
if (maxId != null) {
if (!isUndefined(maxId)) {
params.maxId = maxId;
}
return requestClient.get<ImFriendRequestApi.FriendRequestRespVO[]>(

View File

@@ -4,6 +4,7 @@ import type { Conversation } from '../../types';
import { computed, ref } from 'vue';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { Input, message } from 'antdv-next';
@@ -81,7 +82,7 @@ const recentForwardConversations = computed(() =>
.map((key) => byKey.value.get(key))
.filter(
(c): c is Conversation =>
c != null && !hideSet.value.has(getConversationKey(c)),
!isUndefined(c) && !hideSet.value.has(getConversationKey(c)),
),
);
@@ -96,7 +97,7 @@ const selectedConversations = computed(() =>
.map((key) => byKey.value.get(key))
.filter(
(conversation): conversation is Conversation =>
conversation != null &&
!isUndefined(conversation) &&
!hideSet.value.has(getConversationKey(conversation)),
),
);

View File

@@ -7,6 +7,7 @@ import { computed, ref, watch } from 'vue';
import { confirm } from '@vben/common-ui';
import { CommonStatusEnum } from '@vben/constants';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { Button, Drawer, Input, message, Popover, Switch } from 'antdv-next';
@@ -88,13 +89,10 @@ const myId = computed(() => getCurrentUserId());
/** 历史退群群:禁所有群操作入口(邀请 / 移出 / 改资料 / 禁言 / 审批 / 退出等只保留展示props.group 是 GroupLite 无 joinStatus回 store 取全量 */
const isQuitGroup = computed(() => {
const id = props.group?.id;
return id != null && isGroupQuit(groupStore.getGroup(id));
return !isUndefined(id) && isGroupQuit(groupStore.getGroup(id));
});
const isOwner = computed(
() =>
!isQuitGroup.value &&
props.group != null &&
props.group.ownerId === myId.value,
() => !isQuitGroup.value && props.group?.ownerId === myId.value,
);
/** 当前用户在群里的角色(来自 props.members 的 me 行);用于判定是否可移出他人 */
const myRole = computed(

View File

@@ -5,6 +5,7 @@ import { computed } from 'vue';
import { confirm } from '@vben/common-ui';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { Tag } from 'antdv-next';
@@ -86,7 +87,7 @@ const showSendName = computed(() => {
return false;
}
const lastType = props.conversation.lastMessageType;
return lastType != null && isNormalMessage(lastType);
return !isUndefined(lastType) && isNormalMessage(lastType);
});
/** 列表展示文案:草稿优先(对齐微信 PC有草稿时盖掉最后一条预览→ 撤回实时算 → lastContent 兜底 */
@@ -96,7 +97,7 @@ const lastContentDisplay = computed(() => {
}
if (
props.conversation.lastMessageType === ImContentType.RECALL &&
props.conversation.lastSenderId != null
!isUndefined(props.conversation.lastSenderId)
) {
return buildRecallTip(
props.conversation.lastSenderId,

View File

@@ -13,6 +13,7 @@ import { computed, inject } from 'vue';
import { confirm } from '@vben/common-ui';
import { IconifyIcon as Icon } from '@vben/icons';
import { useUserStore } from '@vben/stores';
import { isUndefined } from '@vben/utils';
import { useClipboard } from '@vueuse/core';
import { message as antdMessage, Tag } from 'antdv-next';
@@ -251,7 +252,7 @@ const redialRtcCall = inject(IM_RTC_REDIAL_KEY);
/** 私聊 RTC_CALL_END 气泡点击:用同款 mediaType 重拨 */
function handleRtcCallBubbleClick() {
const mediaType = rtcCallEndPrivatePayload.value?.mediaType;
if (mediaType == null) {
if (isUndefined(mediaType)) {
return;
}
redialRtcCall?.(mediaType);

View File

@@ -4,6 +4,7 @@ import type { ImManagerGroupApi } from '#/api/im/manager/group';
import { computed, ref, useAttrs, watch } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { Input, Tooltip } from 'antdv-next';
@@ -47,13 +48,13 @@ const showClear = computed(() => {
props.allowClear &&
!props.disabled &&
hovering.value &&
props.modelValue != null
props.modelValue !== null
);
});
/** 根据编号查询群信息(用于编辑回显) */
async function resolveItemById(id: number | undefined) {
if (id == null) {
if (isUndefined(id)) {
selectedItem.value = undefined;
return;
}
@@ -83,7 +84,9 @@ function handleClick(event: MouseEvent) {
clearSelected();
return;
}
dialogRef.value?.open(props.modelValue == null ? [] : [props.modelValue]);
dialogRef.value?.open(
isUndefined(props.modelValue) ? [] : [props.modelValue],
);
}
/** 弹窗选中回调 */

View File

@@ -1,3 +1,5 @@
import { isUndefined } from '@vben/utils';
import { getDb } from './db';
/**
@@ -54,16 +56,15 @@ export async function runIncrementalPull<T extends PullRecord>(
): Promise<void> {
const storedCursor = await getPullCursor(cursorKey);
const highWater = { ...storedCursor };
let cursor =
storedCursor.lastUpdateTime == null
? {}
: {
lastUpdateTime: Math.max(
0,
storedCursor.lastUpdateTime - PULL_OVERLAP_MS,
),
lastId: 0,
};
let cursor = isUndefined(storedCursor.lastUpdateTime)
? {}
: {
lastUpdateTime: Math.max(
0,
storedCursor.lastUpdateTime - PULL_OVERLAP_MS,
),
lastId: 0,
};
for (let page = 0; page < PULL_MAX_PAGES; page++) {
if (isActive && !isActive()) {
return;
@@ -89,12 +90,12 @@ export async function runIncrementalPull<T extends PullRecord>(
if (!last) {
return;
}
if (last.updateTime == null) {
if (isUndefined(last.updateTime)) {
return;
}
cursor = { lastUpdateTime: last.updateTime, lastId: last.id };
if (
highWater.lastUpdateTime == null ||
isUndefined(highWater.lastUpdateTime) ||
cursor.lastUpdateTime > highWater.lastUpdateTime ||
(cursor.lastUpdateTime === highWater.lastUpdateTime &&
cursor.lastId > (highWater.lastId ?? 0))
@@ -154,14 +155,14 @@ export async function runMinIdPull<T extends { id?: number }>(options: {
// 本批最大消息 id 作为下次游标;无有效 id 则本批 apply 后停(无法继续翻页)
const validIds = list
.map((record) => record.id)
.filter((id): id is number => id != null);
.filter((id): id is number => id !== null);
const nextMinId = validIds.length > 0 ? Math.max(...validIds) : undefined;
// applyPage 返回 false本页未落地如入库失败不推进游标并终止避免漏消息
if ((await applyPage(list, nextMinId)) === false) {
return;
}
// 无有效 id或游标没前进后端契约是 id > minId理论不会出现防御死翻
if (nextMinId == null || nextMinId <= minId) {
if (isUndefined(nextMinId) || nextMinId <= minId) {
return;
}
minId = nextMinId;

View File

@@ -58,7 +58,7 @@ watch(
// 只有商品发生变化时才重新查询
if (
productSpus.value.length === 0 ||
productSpus.value.some((spu) => spu.id == null || !ids.includes(spu.id))
productSpus.value.some((spu) => spu.id === null || !ids.includes(spu.id))
) {
productSpus.value = await getSpuDetailList(ids);
}

View File

@@ -60,7 +60,7 @@ watch(
if (
activityList.value.length === 0 ||
activityList.value.some(
(activity) => activity.id == null || !ids.includes(activity.id),
(activity) => activity.id === null || !ids.includes(activity.id),
)
) {
activityList.value = await getCombinationActivityListByIds(ids);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { message } from 'antdv-next';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { message } from 'antdv-next';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { message } from 'antdv-next';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { message } from 'antdv-next';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -1,3 +1,5 @@
import { isUndefined } from '@vben/utils';
import { requestClient } from '#/api/request';
export namespace ImFriendRequestApi {
@@ -55,7 +57,7 @@ export function refuseFriendRequest(
/** 查询「我相关」的好友申请列表(游标分页:传 maxId 加载更多) */
export function getMyFriendRequestList(limit: number, maxId?: number) {
const params: Record<string, number> = { limit };
if (maxId != null) {
if (!isUndefined(maxId)) {
params.maxId = maxId;
}
return requestClient.get<ImFriendRequestApi.FriendRequestRespVO[]>(

View File

@@ -4,6 +4,7 @@ import type { Conversation } from '../../types';
import { computed, ref } from 'vue';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { ElInput, ElMessage } from 'element-plus';
@@ -81,7 +82,7 @@ const recentForwardConversations = computed(() =>
.map((key) => byKey.value.get(key))
.filter(
(c): c is Conversation =>
c != null && !hideSet.value.has(getConversationKey(c)),
!isUndefined(c) && !hideSet.value.has(getConversationKey(c)),
),
);
@@ -96,7 +97,7 @@ const selectedConversations = computed(() =>
.map((key) => byKey.value.get(key))
.filter(
(conversation): conversation is Conversation =>
conversation != null &&
!isUndefined(conversation) &&
!hideSet.value.has(getConversationKey(conversation)),
),
);

View File

@@ -7,6 +7,7 @@ import { computed, ref, watch } from 'vue';
import { confirm } from '@vben/common-ui';
import { CommonStatusEnum } from '@vben/constants';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import {
ElButton,
@@ -95,13 +96,10 @@ const myId = computed(() => getCurrentUserId());
/** 历史退群群:禁所有群操作入口(邀请 / 移出 / 改资料 / 禁言 / 审批 / 退出等只保留展示props.group 是 GroupLite 无 joinStatus回 store 取全量 */
const isQuitGroup = computed(() => {
const id = props.group?.id;
return id != null && isGroupQuit(groupStore.getGroup(id));
return !isUndefined(id) && isGroupQuit(groupStore.getGroup(id));
});
const isOwner = computed(
() =>
!isQuitGroup.value &&
props.group != null &&
props.group.ownerId === myId.value,
() => !isQuitGroup.value && props.group?.ownerId === myId.value,
);
/** 当前用户在群里的角色(来自 props.members 的 me 行);用于判定是否可移出他人 */
const myRole = computed(

View File

@@ -5,6 +5,7 @@ import { computed } from 'vue';
import { confirm } from '@vben/common-ui';
import { IconifyIcon as Icon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { ElTag } from 'element-plus';
@@ -86,7 +87,7 @@ const showSendName = computed(() => {
return false;
}
const lastType = props.conversation.lastMessageType;
return lastType != null && isNormalMessage(lastType);
return !isUndefined(lastType) && isNormalMessage(lastType);
});
/** 列表展示文案:草稿优先(对齐微信 PC有草稿时盖掉最后一条预览→ 撤回实时算 → lastContent 兜底 */
@@ -96,7 +97,7 @@ const lastContentDisplay = computed(() => {
}
if (
props.conversation.lastMessageType === ImContentType.RECALL &&
props.conversation.lastSenderId != null
!isUndefined(props.conversation.lastSenderId)
) {
return buildRecallTip(
props.conversation.lastSenderId,

View File

@@ -13,6 +13,7 @@ import { computed, inject } from 'vue';
import { confirm } from '@vben/common-ui';
import { IconifyIcon as Icon } from '@vben/icons';
import { useUserStore } from '@vben/stores';
import { isUndefined } from '@vben/utils';
import { useClipboard } from '@vueuse/core';
import { ElMessage, ElTag } from 'element-plus';
@@ -251,7 +252,7 @@ const redialRtcCall = inject(IM_RTC_REDIAL_KEY);
/** 私聊 RTC_CALL_END 气泡点击:用同款 mediaType 重拨 */
function handleRtcCallBubbleClick() {
const mediaType = rtcCallEndPrivatePayload.value?.mediaType;
if (mediaType == null) {
if (isUndefined(mediaType)) {
return;
}
redialRtcCall?.(mediaType);

View File

@@ -4,6 +4,7 @@ import type { ImManagerGroupApi } from '#/api/im/manager/group';
import { computed, ref, useAttrs, watch } from 'vue';
import { IconifyIcon } from '@vben/icons';
import { isUndefined } from '@vben/utils';
import { ElInput, ElTooltip } from 'element-plus';
@@ -47,13 +48,13 @@ const showClear = computed(() => {
props.clearable &&
!props.disabled &&
hovering.value &&
props.modelValue != null
props.modelValue !== null
);
});
/** 根据编号查询群信息(用于编辑回显) */
async function resolveItemById(id: number | undefined) {
if (id == null) {
if (isUndefined(id)) {
selectedItem.value = undefined;
return;
}
@@ -83,7 +84,9 @@ function handleClick(event: MouseEvent) {
clearSelected();
return;
}
dialogRef.value?.open(props.modelValue == null ? [] : [props.modelValue]);
dialogRef.value?.open(
isUndefined(props.modelValue) ? [] : [props.modelValue],
);
}
/** 弹窗选中回调 */

View File

@@ -1,3 +1,5 @@
import { isUndefined } from '@vben/utils';
import { getDb } from './db';
/**
@@ -54,16 +56,15 @@ export async function runIncrementalPull<T extends PullRecord>(
): Promise<void> {
const storedCursor = await getPullCursor(cursorKey);
const highWater = { ...storedCursor };
let cursor =
storedCursor.lastUpdateTime == null
? {}
: {
lastUpdateTime: Math.max(
0,
storedCursor.lastUpdateTime - PULL_OVERLAP_MS,
),
lastId: 0,
};
let cursor = isUndefined(storedCursor.lastUpdateTime)
? {}
: {
lastUpdateTime: Math.max(
0,
storedCursor.lastUpdateTime - PULL_OVERLAP_MS,
),
lastId: 0,
};
for (let page = 0; page < PULL_MAX_PAGES; page++) {
if (isActive && !isActive()) {
return;
@@ -89,12 +90,12 @@ export async function runIncrementalPull<T extends PullRecord>(
if (!last) {
return;
}
if (last.updateTime == null) {
if (isUndefined(last.updateTime)) {
return;
}
cursor = { lastUpdateTime: last.updateTime, lastId: last.id };
if (
highWater.lastUpdateTime == null ||
isUndefined(highWater.lastUpdateTime) ||
cursor.lastUpdateTime > highWater.lastUpdateTime ||
(cursor.lastUpdateTime === highWater.lastUpdateTime &&
cursor.lastId > (highWater.lastId ?? 0))
@@ -154,14 +155,14 @@ export async function runMinIdPull<T extends { id?: number }>(options: {
// 本批最大消息 id 作为下次游标;无有效 id 则本批 apply 后停(无法继续翻页)
const validIds = list
.map((record) => record.id)
.filter((id): id is number => id != null);
.filter((id): id is number => id !== null);
const nextMinId = validIds.length > 0 ? Math.max(...validIds) : undefined;
// applyPage 返回 false本页未落地如入库失败不推进游标并终止避免漏消息
if ((await applyPage(list, nextMinId)) === false) {
return;
}
// 无有效 id或游标没前进后端契约是 id > minId理论不会出现防御死翻
if (nextMinId == null || nextMinId <= minId) {
if (isUndefined(nextMinId) || nextMinId <= minId) {
return;
}
minId = nextMinId;

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { ElLoading, ElMessage } from 'element-plus';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { ElLoading, ElMessage } from 'element-plus';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { ElLoading, ElMessage } from 'element-plus';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -11,7 +11,11 @@ import {
OrderStatusEnum,
OrderUpdateStatusList,
} from '@vben/constants';
import { downloadFileFromBlobPart, formatDateTime } from '@vben/utils';
import {
downloadFileFromBlobPart,
formatDateTime,
isUndefined,
} from '@vben/utils';
import { ElLoading, ElMessage } from 'element-plus';
@@ -107,7 +111,7 @@ async function handleExpandChange(
return;
}
const key = row.id;
if (key == null) {
if (isUndefined(key)) {
return;
}
Reflect.deleteProperty(detailMap, key);

View File

@@ -12,7 +12,7 @@ const { $t } = useSimpleLocale();
const [rootProps, form] = injectFormProps();
const collapsed = defineModel({ default: false });
const collapsed = defineModel<boolean>({ default: false });
const resetButtonOptions = computed(() => {
return {

View File

@@ -31,8 +31,10 @@ const props = withDefaults(defineProps<Props>(), {
const emits = defineEmits<{ 'update:value': [any, string] }>();
const modelValue = defineModel('value', {
default: {} as Recordable<CollapsibleParamSchema['defaultValue']>,
const modelValue = defineModel<
Recordable<CollapsibleParamSchema['defaultValue']>
>('value', {
default: () => ({}),
});
const visibleRefs = useTemplateRef('visibleRefs');

View File

@@ -30,7 +30,7 @@ const delegatedProps = computed(() => {
const forwarded = useForwardPropsEmits(delegatedProps, emits);
const open = defineModel('open', { default: true });
const open = defineModel<boolean>('open', { default: true });
function toggle() {
open.value = !open.value;

View File

@@ -7,7 +7,7 @@ const props = defineProps<{
}>();
// 控制箭头展开/收起状态
const collapsed = defineModel({ default: false });
const collapsed = defineModel<boolean>({ default: false });
</script>
<template>

View File

@@ -23,7 +23,9 @@ const sidebarDraggable = defineModel<boolean>('sidebarDraggable');
const sidebarCollapsed = defineModel<boolean>('sidebarCollapsed');
const sidebarExpandOnHover = defineModel<boolean>('sidebarExpandOnHover');
const sidebarButtons = defineModel<string[]>('sidebarButtons', { default: [] });
const sidebarButtons = defineModel<string[]>('sidebarButtons', {
default: () => [],
});
const sidebarCollapsedButton = defineModel<boolean>('sidebarCollapsedButton');
const sidebarFixedButton = defineModel<boolean>('sidebarFixedButton');