feat(mes): 优化 confirm 的代码风格

pull/350/head
YunaiV 2026-05-29 19:32:43 +08:00
parent 8028d8b6ef
commit eeff84b63f
57 changed files with 133 additions and 196 deletions

View File

@ -105,9 +105,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
/** 解绑账号 */
function onUnbind(row: SystemSocialUserApi.SocialUser) {
confirm({
content: `确定解绑[${getDictLabel(DICT_TYPE.SYSTEM_SOCIAL_TYPE, row.type)}]平台的[${row.openid}]账号吗?`,
}).then(async () => {
confirm(`确定解绑[${getDictLabel(DICT_TYPE.SYSTEM_SOCIAL_TYPE, row.type)}]平台的[${row.openid}]账号吗?`).then(async () => {
await socialUnbind({ type: row.type, openid: row.openid });
//
message.success($t('ui.actionMessage.operationSuccess'));

View File

@ -39,9 +39,7 @@ async function handleUpdatePublicStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '公开' : '私有';
try {
await confirm({
content: `确认要将该图片切换为【${text}】吗?`,
});
await confirm(`确认要将该图片切换为【${text}】吗?`);
} catch {
return false;
}

View File

@ -77,9 +77,7 @@ async function handleStatusChange(
row: AiKnowledgeDocumentApi.KnowledgeDocument,
): Promise<boolean | undefined> {
try {
await confirm({
content: `你要将${row.name}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
});
await confirm(`你要将${row.name}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`);
} catch {
return false;
}

View File

@ -65,9 +65,7 @@ async function handleStatusChange(
row: AiKnowledgeSegmentApi.KnowledgeSegment,
): Promise<boolean | undefined> {
try {
await confirm({
content: `你要将片段 ${row.id} 的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
});
await confirm(`你要将片段 ${row.id} 的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`);
} catch {
return false;
}

View File

@ -39,9 +39,7 @@ async function handleUpdatePublicStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '公开' : '私有';
try {
await confirm({
content: `确认要将该音乐切换为【${text}】吗?`,
});
await confirm(`确认要将该音乐切换为【${text}】吗?`);
} catch {
return false;
}

View File

@ -75,9 +75,7 @@ async function handleDeleteContactBusinessList() {
return;
}
try {
await confirm({
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
});
await confirm(`确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`);
} catch {
return false;
}

View File

@ -84,9 +84,7 @@ function handleTransfer() {
/** 转化为客户 */
async function handleTransform(): Promise<boolean | undefined> {
try {
await confirm({
content: '确定将该线索转化为客户吗?',
});
await confirm('确定将该线索转化为客户吗?');
} catch {
return false;
}

View File

@ -72,9 +72,7 @@ async function handleDeleteContactBusinessList() {
return;
}
try {
await confirm({
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
});
await confirm(`确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`);
} catch {
return false;
}

View File

@ -102,9 +102,7 @@ function handleTransfer() {
/** 锁定客户 */
async function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
try {
await confirm({
content: `确定锁定客户【${customer.value.name}】吗?`,
});
await confirm(`确定锁定客户【${customer.value.name}】吗?`);
} catch {
return false;
}
@ -118,9 +116,7 @@ async function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
/** 领取客户 */
async function handleReceive(): Promise<boolean | undefined> {
try {
await confirm({
content: `确定领取客户【${customer.value.name}】吗?`,
});
await confirm(`确定领取客户【${customer.value.name}】吗?`);
} catch {
return false;
}
@ -139,9 +135,7 @@ function handleDistributeForm() {
/** 客户放入公海 */
async function handlePutPool(): Promise<boolean | undefined> {
try {
await confirm({
content: `确定将客户【${customer.value.name}】放入公海吗?`,
});
await confirm(`确定将客户【${customer.value.name}】放入公海吗?`);
} catch {
return false;
}
@ -156,9 +150,7 @@ async function handlePutPool(): Promise<boolean | undefined> {
async function handleUpdateDealStatus(): Promise<boolean | undefined> {
const dealStatus = !customer.value.dealStatus;
try {
await confirm({
content: `确定更新成交状态为【${dealStatus ? '已成交' : '未成交'}】吗?`,
});
await confirm(`确定更新成交状态为【${dealStatus ? '已成交' : '未成交'}】吗?`);
} catch {
return false;
}

View File

@ -100,9 +100,7 @@ async function handleDelete() {
return;
}
try {
await confirm({
content: `你要将${checkedRows.value.map((item) => item.nickname).join(',')}移出团队吗?`,
});
await confirm(`你要将${checkedRows.value.map((item) => item.nickname).join(',')}移出团队吗?`);
} catch {
return false;
}

View File

@ -67,9 +67,7 @@ async function handleDefaultStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '设置' : '取消';
try {
await confirm({
content: `确认要${text}"${row.name}"默认吗?`,
});
await confirm(`确认要${text}"${row.name}"默认吗?`);
} catch {
return false;
}

View File

@ -65,9 +65,7 @@ async function handleDefaultStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '设置' : '取消';
try {
await confirm({
content: `确认要${text}"${row.name}"默认吗?`,
});
await confirm(`确认要${text}"${row.name}"默认吗?`);
} catch {
return false;
}

View File

@ -42,9 +42,7 @@ function handleDetail(row: InfraApiErrorLogApi.ApiErrorLog) {
/** 处理已处理 / 已忽略的操作 */
async function handleProcess(id: number, processStatus: number) {
await confirm({
content: `确认标记为${InfraApiErrorLogProcessStatusEnum.DONE ? '已处理' : '已忽略'}?`,
});
await confirm(`确认标记为${InfraApiErrorLogProcessStatusEnum.DONE ? '已处理' : '已忽略'}?`);
const hideLoading = message.loading({
content: '正在处理中...',
duration: 0,

View File

@ -285,7 +285,7 @@ function handleEditPoint(row: IotDeviceModbusPointApi.ModbusPoint) {
/** 删除点位 */
async function handleDeletePoint(row: IotDeviceModbusPointApi.ModbusPoint) {
await confirm({ content: `确定要删除点位【${row.name}】吗?` });
await confirm(`确定要删除点位【${row.name}】吗?`);
await deleteModbusPoint(row.id!);
message.success('删除成功');
await gridApi.query();

View File

@ -126,7 +126,7 @@ function handleRowCheckboxChange({
/** 解绑单个设备 */
async function handleUnbind(row: IotDeviceApi.Device) {
await confirm({ content: `确定要解绑子设备【${row.deviceName}】吗?` });
await confirm(`确定要解绑子设备【${row.deviceName}】吗?`);
const hideLoading = message.loading({
content: `正在解绑【${row.deviceName}】...`,
duration: 0,
@ -142,9 +142,7 @@ async function handleUnbind(row: IotDeviceApi.Device) {
/** 批量解绑 */
async function handleUnbindBatch() {
await confirm({
content: `确定要解绑选中的 ${checkedIds.value.length} 个子设备吗?`,
});
await confirm(`确定要解绑选中的 ${checkedIds.value.length} 个子设备吗?`);
const hideLoading = message.loading({
content: '正在批量解绑...',
duration: 0,

View File

@ -65,9 +65,7 @@ async function handleStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '展示' : '隐藏';
try {
await confirm({
content: `确认要${text}该评论吗?`,
});
await confirm(`确认要${text}该评论吗?`);
} catch {
return false;
}

View File

@ -110,9 +110,7 @@ async function handleStatusChange(
//
const text = newStatus ? '上架' : '下架';
try {
await confirm({
content: `确认要${text + row.name}吗?`,
});
await confirm(`确认要${text + row.name}吗?`);
} catch {
return false;
}
@ -132,9 +130,7 @@ async function handleStatus02Change(row: MallSpuApi.Spu, newStatus: number) {
newStatus === ProductSpuStatusEnum.RECYCLE.status
? '加入到回收站'
: '恢复到仓库';
await confirm({
content: `确认要"${row.name}"${text}吗?`,
});
await confirm(`确认要"${row.name}"${text}吗?`);
const hideLoading = message.loading({
content: `正在${text}中...`,
duration: 0,

View File

@ -61,9 +61,7 @@ async function handleStatusChange(
row: MallCouponTemplateApi.CouponTemplate,
): Promise<boolean | undefined> {
try {
await confirm({
content: `你要将${row.name}的状态切换为【${newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用'}】吗?`,
});
await confirm(`你要将${row.name}的状态切换为【${newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用'}】吗?`);
} catch {
return false;
}

View File

@ -125,9 +125,7 @@ async function updateConversationPinnedFn(pinned: boolean) {
/** 删除会话 */
async function deleteConversationFn() {
// 1.
confirm({
content: '您确定要删除该会话吗?',
}).then(async () => {
confirm('您确定要删除该会话吗?').then(async () => {
await deleteConversation(rightClickConversation.value.id);
// 2.
closeRightMenu();

View File

@ -62,9 +62,7 @@ async function handleStatusChange(
//
const text = row.status === 0 ? '启用' : '停用';
try {
await confirm({
content: `确认要${text + row.name}吗?`,
});
await confirm(`确认要${text + row.name}吗?`);
} catch {
return false;
}

View File

@ -104,9 +104,7 @@ async function loadProductStatisticsList() {
async function handleExport() {
try {
//
await confirm({
content: '确认导出商品状况数据吗?',
});
await confirm('确认导出商品状况数据吗?');
//
exportLoading.value = true;
const data = await exportProductStatisticsExcel({

View File

@ -107,9 +107,7 @@ async function loadTradeStatisticsList() {
async function handleExport() {
try {
//
await confirm({
content: '确认导出交易状况数据吗?',
});
await confirm('确认导出交易状况数据吗?');
//
exportLoading.value = true;
const data = await exportTradeStatisticsExcel({

View File

@ -89,9 +89,7 @@ async function handleBrokerageEnabledChange(
): Promise<boolean | undefined> {
const text = newEnabled ? '开通' : '关闭';
try {
await confirm({
content: `你要将${row.nickname}的推广资格切换为【${text}】吗?`,
});
await confirm(`你要将${row.nickname}的推广资格切换为【${text}】吗?`);
} catch {
return false;
}

View File

@ -106,9 +106,11 @@ async function handleFinish() {
if (!valid) {
return;
}
await confirm({
content: '是否完成来料检验单编制?【完成后将不能更改】',
});
try {
await confirm('是否完成来料检验单编制?【完成后将不能更改】');
} catch {
return;
}
modalApi.lock();
try {
const current = JSON.stringify(await formApi.getValues());
@ -135,10 +137,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
//
const ok = await handleSubmit();
if (!ok) {
return;
}
//
message.success($t('ui.actionMessage.operationSuccess'));
await modalApi.close();
emit('success');
@ -167,6 +171,7 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getIqc(data.id);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
@ -174,6 +179,7 @@ const [Modal, modalApi] = useVbenModal({
} else if (data?.prefill) {
//
formData.value = { ...data.prefill };
// values
await formApi.setValues(data.prefill);
}
// finish

View File

@ -100,9 +100,11 @@ async function handleFinish() {
if (!valid) {
return;
}
await confirm({
content: '是否完成出货检验单编制?【完成后将不能更改】',
});
try {
await confirm('是否完成出货检验单编制?【完成后将不能更改】');
} catch {
return;
}
modalApi.lock();
try {
const current = JSON.stringify(await formApi.getValues());
@ -121,7 +123,6 @@ async function handleFinish() {
}
}
// TODO @AI
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
if (isDetail.value) {
@ -130,10 +131,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
//
const ok = await handleSubmit();
if (!ok) {
return;
}
//
message.success($t('ui.actionMessage.operationSuccess'));
await modalApi.close();
emit('success');
@ -149,6 +152,7 @@ const [Modal, modalApi] = useVbenModal({
}
formApi.setState({ schema: useFormSchema(formApi) });
subTabsName.value = 'line';
//
const data = modalApi.getData<{
formType: FormType;
id?: number;
@ -161,12 +165,15 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getOqc(data.id);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
} else if (data?.prefill) {
//
formData.value = { ...data.prefill };
// values
await formApi.setValues(data.prefill);
}
originalSnapshot.value = JSON.stringify(await formApi.getValues());

View File

@ -100,10 +100,11 @@ async function handleFinish() {
if (!valid) {
return;
}
// TODO @AI await confirm('') style vue
await confirm({
content: '是否完成退货检验单编制?【完成后将不能更改】',
});
try {
await confirm('是否完成退货检验单编制?【完成后将不能更改】');
} catch {
return;
}
modalApi.lock();
try {
const current = JSON.stringify(await formApi.getValues());
@ -122,7 +123,6 @@ async function handleFinish() {
}
}
// TODO @AI
const [Modal, modalApi] = useVbenModal({
async onConfirm() {
if (isDetail.value) {
@ -131,10 +131,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
//
const ok = await handleSubmit();
if (!ok) {
return;
}
//
message.success($t('ui.actionMessage.operationSuccess'));
await modalApi.close();
emit('success');
@ -150,6 +152,7 @@ const [Modal, modalApi] = useVbenModal({
}
formApi.setState({ schema: useFormSchema(formApi) });
subTabsName.value = 'line';
//
const data = modalApi.getData<{
formType: FormType;
id?: number;
@ -162,12 +165,15 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getRqc(data.id);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
} else if (data?.prefill) {
//
formData.value = { ...data.prefill };
// values
await formApi.setValues(data.prefill);
}
originalSnapshot.value = JSON.stringify(await formApi.getValues());

View File

@ -67,9 +67,7 @@ async function handleStatusChange(
): Promise<boolean | undefined> {
const text = newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用';
try {
await confirm({
content: `确认要${text + row.name}应用吗?`,
});
await confirm(`确认要${text + row.name}应用吗?`);
} catch {
return false;
}

View File

@ -139,9 +139,7 @@ async function handleStatusChange(
row: SystemUserApi.User,
): Promise<boolean | undefined> {
try {
await confirm({
content: `你要将${row.username}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
});
await confirm(`你要将${row.username}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`);
} catch {
return false;
}

View File

@ -105,9 +105,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
/** 解绑账号 */
function onUnbind(row: SystemSocialUserApi.SocialUser) {
confirm({
content: `确定解绑[${getDictLabel(DICT_TYPE.SYSTEM_SOCIAL_TYPE, row.type)}]平台的[${row.openid}]账号吗?`,
}).then(async () => {
confirm(`确定解绑[${getDictLabel(DICT_TYPE.SYSTEM_SOCIAL_TYPE, row.type)}]平台的[${row.openid}]账号吗?`).then(async () => {
await socialUnbind({ type: row.type, openid: row.openid });
//
ElMessage.success($t('ui.actionMessage.operationSuccess'));

View File

@ -38,9 +38,7 @@ async function handleUpdatePublicStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '公开' : '私有';
try {
await confirm({
content: `确认要将该图片切换为【${text}】吗?`,
});
await confirm(`确认要将该图片切换为【${text}】吗?`);
} catch {
return false;
}

View File

@ -76,9 +76,7 @@ async function handleStatusChange(
row: AiKnowledgeDocumentApi.KnowledgeDocument,
): Promise<boolean | undefined> {
try {
await confirm({
content: `你要将${row.name}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
});
await confirm(`你要将${row.name}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`);
} catch {
return false;
}

View File

@ -64,9 +64,7 @@ async function handleStatusChange(
row: AiKnowledgeSegmentApi.KnowledgeSegment,
): Promise<boolean | undefined> {
try {
await confirm({
content: `你要将片段 ${row.id} 的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
});
await confirm(`你要将片段 ${row.id} 的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`);
} catch {
return false;
}

View File

@ -38,9 +38,7 @@ async function handleUpdatePublicStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '公开' : '私有';
try {
await confirm({
content: `确认要将该音乐切换为【${text}】吗?`,
});
await confirm(`确认要将该音乐切换为【${text}】吗?`);
} catch {
return false;
}

View File

@ -75,9 +75,7 @@ async function handleDeleteContactBusinessList() {
return;
}
try {
await confirm({
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
});
await confirm(`确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`);
} catch {
return false;
}

View File

@ -85,9 +85,7 @@ function handleTransfer() {
/** 转化为客户 */
async function handleTransform(): Promise<boolean | undefined> {
try {
await confirm({
content: '确定将该线索转化为客户吗?',
});
await confirm('确定将该线索转化为客户吗?');
} catch {
return false;
}

View File

@ -72,9 +72,7 @@ async function handleDeleteContactBusinessList() {
return;
}
try {
await confirm({
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
});
await confirm(`确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`);
} catch {
return false;
}

View File

@ -103,9 +103,7 @@ function handleTransfer() {
/** 锁定客户 */
async function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
try {
await confirm({
content: `确定锁定客户【${customer.value.name}】吗?`,
});
await confirm(`确定锁定客户【${customer.value.name}】吗?`);
} catch {
return false;
}
@ -119,9 +117,7 @@ async function handleLock(lockStatus: boolean): Promise<boolean | undefined> {
/** 领取客户 */
async function handleReceive(): Promise<boolean | undefined> {
try {
await confirm({
content: `确定领取客户【${customer.value.name}】吗?`,
});
await confirm(`确定领取客户【${customer.value.name}】吗?`);
} catch {
return false;
}
@ -140,9 +136,7 @@ function handleDistributeForm() {
/** 客户放入公海 */
async function handlePutPool(): Promise<boolean | undefined> {
try {
await confirm({
content: `确定将客户【${customer.value.name}】放入公海吗?`,
});
await confirm(`确定将客户【${customer.value.name}】放入公海吗?`);
} catch {
return false;
}
@ -157,9 +151,7 @@ async function handlePutPool(): Promise<boolean | undefined> {
async function handleUpdateDealStatus(): Promise<boolean | undefined> {
const dealStatus = !customer.value.dealStatus;
try {
await confirm({
content: `确定更新成交状态为【${dealStatus ? '已成交' : '未成交'}】吗?`,
});
await confirm(`确定更新成交状态为【${dealStatus ? '已成交' : '未成交'}】吗?`);
} catch {
return false;
}

View File

@ -100,9 +100,7 @@ async function handleDelete() {
return;
}
try {
await confirm({
content: `你要将${checkedRows.value.map((item) => item.nickname).join(',')}移出团队吗?`,
});
await confirm(`你要将${checkedRows.value.map((item) => item.nickname).join(',')}移出团队吗?`);
} catch {
return false;
}

View File

@ -66,9 +66,7 @@ async function handleDefaultStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '设置' : '取消';
try {
await confirm({
content: `确认要${text}"${row.name}"默认吗?`,
});
await confirm(`确认要${text}"${row.name}"默认吗?`);
} catch {
return false;
}

View File

@ -64,9 +64,7 @@ async function handleDefaultStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '设置' : '取消';
try {
await confirm({
content: `确认要${text}"${row.name}"默认吗?`,
});
await confirm(`确认要${text}"${row.name}"默认吗?`);
} catch {
return false;
}

View File

@ -42,9 +42,7 @@ function handleDetail(row: InfraApiErrorLogApi.ApiErrorLog) {
/** 处理已处理 / 已忽略的操作 */
async function handleProcess(id: number, processStatus: number) {
await confirm({
content: `确认标记为${InfraApiErrorLogProcessStatusEnum.DONE ? '已处理' : '已忽略'}?`,
});
await confirm(`确认标记为${InfraApiErrorLogProcessStatusEnum.DONE ? '已处理' : '已忽略'}?`);
const loadingInstance = ElLoading.service({
text: '正在处理中...',
});

View File

@ -285,7 +285,7 @@ function handleEditPoint(row: IotDeviceModbusPointApi.ModbusPoint) {
/** 删除点位 */
async function handleDeletePoint(row: IotDeviceModbusPointApi.ModbusPoint) {
await confirm({ content: `确定要删除点位【${row.name}】吗?` });
await confirm(`确定要删除点位【${row.name}】吗?`);
await deleteModbusPoint(row.id!);
ElMessage.success('删除成功');
await gridApi.query();

View File

@ -126,7 +126,7 @@ function handleRowCheckboxChange({
/** 解绑单个设备 */
async function handleUnbind(row: IotDeviceApi.Device) {
await confirm({ content: `确定要解绑子设备【${row.deviceName}】吗?` });
await confirm(`确定要解绑子设备【${row.deviceName}】吗?`);
const loadingInstance = ElLoading.service({
text: `正在解绑【${row.deviceName}】...`,
});
@ -141,9 +141,7 @@ async function handleUnbind(row: IotDeviceApi.Device) {
/** 批量解绑 */
async function handleUnbindBatch() {
await confirm({
content: `确定要解绑选中的 ${checkedIds.value.length} 个子设备吗?`,
});
await confirm(`确定要解绑选中的 ${checkedIds.value.length} 个子设备吗?`);
const loadingInstance = ElLoading.service({
text: '正在批量解绑...',
});

View File

@ -64,9 +64,7 @@ async function handleStatusChange(
): Promise<boolean | undefined> {
const text = newStatus ? '展示' : '隐藏';
try {
await confirm({
content: `确认要${text}该评论吗?`,
});
await confirm(`确认要${text}该评论吗?`);
} catch {
return false;
}

View File

@ -109,9 +109,7 @@ async function handleStatusChange(
//
const text = newStatus ? '上架' : '下架';
try {
await confirm({
content: `确认要${text + row.name}吗?`,
});
await confirm(`确认要${text + row.name}吗?`);
} catch {
return false;
}
@ -131,9 +129,7 @@ async function handleStatus02Change(row: MallSpuApi.Spu, newStatus: number) {
newStatus === ProductSpuStatusEnum.RECYCLE.status
? '加入到回收站'
: '恢复到仓库';
await confirm({
content: `确认要"${row.name}"${text}吗?`,
});
await confirm(`确认要"${row.name}"${text}吗?`);
const loadingInstance = ElLoading.service({
text: `正在${text}中...`,
});

View File

@ -60,9 +60,7 @@ async function handleStatusChange(
row: MallCouponTemplateApi.CouponTemplate,
): Promise<boolean | undefined> {
try {
await confirm({
content: `你要将${row.name}的状态切换为【${newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用'}】吗?`,
});
await confirm(`你要将${row.name}的状态切换为【${newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用'}】吗?`);
} catch {
return false;
}

View File

@ -125,9 +125,7 @@ async function updateConversationPinnedFn(pinned: boolean) {
/** 删除会话 */
async function deleteConversationFn() {
// 1.
confirm({
content: '您确定要删除该会话吗?',
}).then(async () => {
confirm('您确定要删除该会话吗?').then(async () => {
await deleteConversation(rightClickConversation.value.id);
// 2.
closeRightMenu();

View File

@ -59,9 +59,7 @@ async function handleStatusChange(
//
const text = row.status === 0 ? '启用' : '停用';
try {
await confirm({
content: `确认要${text + row.name}吗?`,
});
await confirm(`确认要${text + row.name}吗?`);
} catch {
return false;
}

View File

@ -104,9 +104,7 @@ async function loadProductStatisticsList() {
async function handleExport() {
try {
//
await confirm({
content: '确认导出商品状况数据吗?',
});
await confirm('确认导出商品状况数据吗?');
//
exportLoading.value = true;
const data = await exportProductStatisticsExcel({

View File

@ -107,9 +107,7 @@ async function loadTradeStatisticsList() {
async function handleExport() {
try {
//
await confirm({
content: '确认导出交易状况数据吗?',
});
await confirm('确认导出交易状况数据吗?');
//
exportLoading.value = true;
const data = await exportTradeStatisticsExcel({

View File

@ -88,9 +88,7 @@ async function handleBrokerageEnabledChange(
): Promise<boolean | undefined> {
const text = newEnabled ? '开通' : '关闭';
try {
await confirm({
content: `你要将${row.nickname}的推广资格切换为【${text}】吗?`,
});
await confirm(`你要将${row.nickname}的推广资格切换为【${text}】吗?`);
} catch {
return false;
}

View File

@ -107,9 +107,11 @@ async function handleFinish() {
if (!valid) {
return;
}
await confirm({
content: '是否完成过程检验单编制?【完成后将不能更改】',
});
try {
await confirm('是否完成过程检验单编制?【完成后将不能更改】');
} catch {
return;
}
modalApi.lock();
try {
const current = JSON.stringify(await formApi.getValues());
@ -136,10 +138,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
//
const ok = await handleSubmit();
if (!ok) {
return;
}
//
ElMessage.success($t('ui.actionMessage.operationSuccess'));
await modalApi.close();
emit('success');
@ -155,6 +159,7 @@ const [Modal, modalApi] = useVbenModal({
}
formApi.setState({ schema: useFormSchema(formApi) });
subTabsName.value = 'line';
//
const data = modalApi.getData<{
formType: FormType;
id?: number;
@ -167,12 +172,15 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getIpqc(data.id);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
} else if (data?.prefill) {
//
formData.value = { ...data.prefill };
// values
await formApi.setValues(data.prefill);
}
originalSnapshot.value = JSON.stringify(await formApi.getValues());

View File

@ -108,9 +108,11 @@ async function handleFinish() {
if (!valid) {
return;
}
await confirm({
content: '是否完成来料检验单编制?【完成后将不能更改】',
});
try {
await confirm('是否完成来料检验单编制?【完成后将不能更改】');
} catch {
return;
}
modalApi.lock();
try {
const current = JSON.stringify(await formApi.getValues());
@ -137,10 +139,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
//
const ok = await handleSubmit();
if (!ok) {
return;
}
//
ElMessage.success($t('ui.actionMessage.operationSuccess'));
await modalApi.close();
emit('success');
@ -169,6 +173,7 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getIqc(data.id);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
@ -176,6 +181,7 @@ const [Modal, modalApi] = useVbenModal({
} else if (data?.prefill) {
//
formData.value = { ...data.prefill };
// values
await formApi.setValues(data.prefill);
}
// finish

View File

@ -107,9 +107,11 @@ async function handleFinish() {
if (!valid) {
return;
}
await confirm({
content: '是否完成出货检验单编制?【完成后将不能更改】',
});
try {
await confirm('是否完成出货检验单编制?【完成后将不能更改】');
} catch {
return;
}
modalApi.lock();
try {
const current = JSON.stringify(await formApi.getValues());
@ -136,10 +138,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
//
const ok = await handleSubmit();
if (!ok) {
return;
}
//
ElMessage.success($t('ui.actionMessage.operationSuccess'));
await modalApi.close();
emit('success');
@ -155,6 +159,7 @@ const [Modal, modalApi] = useVbenModal({
}
formApi.setState({ schema: useFormSchema(formApi) });
subTabsName.value = 'line';
//
const data = modalApi.getData<{
formType: FormType;
id?: number;
@ -167,12 +172,15 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getOqc(data.id);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
} else if (data?.prefill) {
//
formData.value = { ...data.prefill };
// values
await formApi.setValues(data.prefill);
}
originalSnapshot.value = JSON.stringify(await formApi.getValues());

View File

@ -107,9 +107,11 @@ async function handleFinish() {
if (!valid) {
return;
}
await confirm({
content: '是否完成退货检验单编制?【完成后将不能更改】',
});
try {
await confirm('是否完成退货检验单编制?【完成后将不能更改】');
} catch {
return;
}
modalApi.lock();
try {
const current = JSON.stringify(await formApi.getValues());
@ -136,10 +138,12 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
//
const ok = await handleSubmit();
if (!ok) {
return;
}
//
ElMessage.success($t('ui.actionMessage.operationSuccess'));
await modalApi.close();
emit('success');
@ -155,6 +159,7 @@ const [Modal, modalApi] = useVbenModal({
}
formApi.setState({ schema: useFormSchema(formApi) });
subTabsName.value = 'line';
//
const data = modalApi.getData<{
formType: FormType;
id?: number;
@ -167,12 +172,15 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getRqc(data.id);
// values
await formApi.setValues(formData.value);
} finally {
modalApi.unlock();
}
} else if (data?.prefill) {
//
formData.value = { ...data.prefill };
// values
await formApi.setValues(data.prefill);
}
originalSnapshot.value = JSON.stringify(await formApi.getValues());

View File

@ -66,9 +66,7 @@ async function handleStatusChange(
): Promise<boolean | undefined> {
const text = newStatus === CommonStatusEnum.ENABLE ? '启用' : '停用';
try {
await confirm({
content: `确认要${text + row.name}应用吗?`,
});
await confirm(`确认要${text + row.name}应用吗?`);
} catch {
return false;
}

View File

@ -137,9 +137,7 @@ async function handleStatusChange(
row: SystemUserApi.User,
): Promise<boolean | undefined> {
try {
await confirm({
content: `你要将${row.username}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`,
});
await confirm(`你要将${row.username}的状态切换为【${getDictLabel(DICT_TYPE.COMMON_STATUS, newStatus)}】吗?`);
} catch {
return false;
}