diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index eb76de5..388023c 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -2,7 +2,7 @@ "$schema": "../gen/schemas/desktop-schema.json", "identifier": "default", "description": "enables the default permissions", - "windows": ["main"], + "windows": ["*"], "permissions": [ "core:default", "core:window:default", @@ -28,6 +28,14 @@ "core:window:allow-set-always-on-top", "core:window:allow-set-always-on-bottom", "core:window:allow-unmaximize", - "core:window:allow-unminimize" + "core:window:allow-unminimize", + "core:window:allow-center", + "core:window:allow-request-user-attention", + "core:window:allow-set-decorations", + "core:window:allow-set-resizable", + "core:window:allow-set-skip-taskbar", + "core:webview:allow-set-webview-position", + "core:webview:allow-set-webview-size", + "core:window:allow-create" ] } diff --git a/src/utils/tauriWindow.ts b/src/utils/tauriWindow.ts new file mode 100644 index 0000000..41f7409 --- /dev/null +++ b/src/utils/tauriWindow.ts @@ -0,0 +1,55 @@ +import { WebviewWindow } from '@tauri-apps/api/webviewWindow' + +/** + * 打开新的页面功能 + * @param label 新打开页面的标签 + * @param options 新页面配置项 + */ +export const newWindow = async ( + label: string, + options: any +) => { + const webview = new WebviewWindow(`${label}`, { + ...options + }) + webview.once('tauri://created', async function () { + console.log(`${label}创建成功`) + }) + webview.once('tauri://error', function (e) { + console.log(e) + }) +} + +/** + * 创建 Excel 编辑窗口 + * @param id Excel 记录 ID + * @param name Excel 名称 + */ +export const createEditWindow = async (id: number, name: string) => { + await newWindow(`excel-edit-${id}`, { + url: `/wps/xlsx?id=${id}&mode=edit`, + title: `编辑 Excel - ${name}`, + width: 900, + height: 650, + resizable: true, + decorations: true, + center: true, + visible: true + }) +} + +/** + * 创建通用 Excel 窗口 + */ +export const createExcelWindow = async () => { + await newWindow('excel-main', { + url: '/wps/xlsx', + title: 'Excel 数据管理', + width: 1000, + height: 700, + resizable: true, + decorations: true, + center: true, + visible: true + }) +} diff --git a/src/views/wps/xlsx/index.vue b/src/views/wps/xlsx/index.vue index 95eb5f2..4ad87fe 100644 --- a/src/views/wps/xlsx/index.vue +++ b/src/views/wps/xlsx/index.vue @@ -9,11 +9,7 @@ label-width="110px" > - + 新增 @@ -33,26 +29,16 @@ v-if="refreshTable" > - + - + @@ -63,12 +49,10 @@