diff --git a/src/components/MyConfirm/Confirm.vue b/src/components/MyConfirm/Confirm.vue index cb336d7..25786c1 100644 --- a/src/components/MyConfirm/Confirm.vue +++ b/src/components/MyConfirm/Confirm.vue @@ -1,26 +1,36 @@ - + + - + {{ msg }} - {{ info }} + {{ info }} + + + 此操作无法被回滚。 + 请输入 {{ confirmName }} 以确认: + + + - {{ confirmText }} + {{ confirmText }} {{ closeText }} - + diff --git a/src/components/MyConfirm/index.ts b/src/components/MyConfirm/index.ts index 6899b45..0c44a48 100644 --- a/src/components/MyConfirm/index.ts +++ b/src/components/MyConfirm/index.ts @@ -2,8 +2,8 @@ import { MyConfirm } from "@/types/Basics"; import confirm from "./Confirm.vue"; import { createApp } from "vue"; -export default ({ title, msg, info, confirmText, closeText, isLoading, onOk, onCancel }: MyConfirm) => { - return new Promise((reslove, reject) => { +export default ({ title, msg, info, confirmText, closeText, isLoading, confirmName, danger, onOk, onCancel }: MyConfirm) => { + return new Promise((reslove, _reject) => { const instance = createApp(confirm, { title, msg, @@ -11,6 +11,8 @@ export default ({ title, msg, info, confirmText, closeText, isLoading, onOk, onC confirmText, closeText, isLoading, + confirmName, + danger, confirmFn: { onOk, reslove, diff --git a/src/types/Basics.d.ts b/src/types/Basics.d.ts index 932f796..bb38223 100644 --- a/src/types/Basics.d.ts +++ b/src/types/Basics.d.ts @@ -105,6 +105,10 @@ export interface MyConfirm { isLoading?: boolean; confirmText?: string; closeText?: string; + /** 输名确认:值与 msg 对象名一致才允许点确认键(危险操作删除模,对齐 projman) */ + confirmName?: string; + /** 红色确认键(危险操作) */ + danger?: boolean; onOk?: Function; onCancel?: Function; } diff --git a/src/views/app/AppList.vue b/src/views/app/AppList.vue index 31919d2..071650e 100644 --- a/src/views/app/AppList.vue +++ b/src/views/app/AppList.vue @@ -181,13 +181,14 @@ const columns = [ width: 280, render: (h: any, { row }: any) => { // SCHOOL 模式:仅编辑(名称/描述/图标,写学校覆盖表);模块管理/推送设置/删除全部隐藏。 - // 基石应用(app_nature=BASE)只做身份注册:模块/推送/删除置灰,「编辑」保持可用(密钥轮换入口) + // 基石应用(app_nature=BASE)只做身份注册:模块/推送置灰;删除允许——基石也可下线, + // 但走「输名确认」删除模(危险确认,与 projman 应用删除同款)。 const base = row.appNature === "BASE"; const actions = [$utils.operatingTextHandle(h, '编辑', '', () => handleEdit(row))]; if (!isSchoolMode.value) { actions.push($utils.operatingTextHandle(h, '模块管理', '', () => goModuleManage(row), base)); actions.push($utils.operatingTextHandle(h, '推送设置', '', () => openPushSetting(row), base)); - actions.push($utils.operatingTextHandle(h, '删除', 'text-error', () => handleDelete(row), base)); + actions.push($utils.operatingTextHandle(h, '删除', 'text-error', () => handleDelete(row))); } return actions; } @@ -239,18 +240,24 @@ function openSortModal() { sortModalVisible.value = true; } -/* ---------------- 删除应用 ---------------- */ +/* ---------------- 删除应用(删除模:输名确认 + 红色确认键,对齐 projman;基石应用同样可删) ---------------- */ async function handleDelete(row: any) { + const name = row.name || String(row.id); await MyConfirm({ - msg: `确定删除应用「${row.name || row.id}」吗?`, - info: "删除后不可恢复!", + title: "删除应用", + msg: `确定删除应用「${name}」吗?`, + info: "删除后不可恢复,关联就绪资源需手动清理!" + + (row.appNature === "BASE" ? "(基石应用:请先确认无平台组件仍依赖其 appKey 签名身份)" : ""), + confirmName: name, + danger: true, + confirmText: "删除", async onOk() { try { await Apis.AppSettings.deleteApp({ pathParams: { id: row.id } }); Message.success('删除成功!'); tableRef.value?.reloadData(OperatorEnum.del); } catch (e: any) { - console.warn(e?.message || '删除失败'); + Message.error(e?.message || '删除失败'); } }, });