|
@@ -1,7 +1,13 @@
|
|
|
import { ElMessage } from "element-plus";
|
|
|
-import { params, preventReload, token } from "../env";
|
|
|
+import { params, preventReload } from "../env";
|
|
|
import * as platform from "./enter-shared";
|
|
|
import { asyncTimeout } from "@/utils/shared";
|
|
|
+import { getEmptyStoreData } from "@/core/store/store";
|
|
|
+import { defaultLayer } from "@/constant";
|
|
|
+import { tableTitleKey } from "./store";
|
|
|
+import { getBaseItem } from "@/core/components/util";
|
|
|
+import { getRealPixel } from "./views/tabulation/gen-tab";
|
|
|
+import { getPaperConfig, paperConfigs } from "../components/slide/actions";
|
|
|
|
|
|
window.platform = { ...platform };
|
|
|
|
|
@@ -53,7 +59,7 @@ if (window.platform.sceneDraw) {
|
|
|
import(import.meta.env.VITE_ENTRY_EXAMPLE);
|
|
|
});
|
|
|
|
|
|
- console.log(subgroup)
|
|
|
+ console.log(subgroup);
|
|
|
window.platform.saveOverviewData = async (id: any, data: any) => {
|
|
|
const result = await platform.saveOverviewData(id, {
|
|
|
...data,
|
|
@@ -69,13 +75,71 @@ if (window.platform.sceneDraw) {
|
|
|
import(import.meta.env.VITE_ENTRY_EXAMPLE);
|
|
|
}
|
|
|
|
|
|
+// window.platform.getTableTemp = () => platform.getTableTemp();
|
|
|
+
|
|
|
+window.platform.getTabulationData = async (...args: any[]) => {
|
|
|
+ const result = await platform.getTabulationData.apply(this, args as any);
|
|
|
+ if (!result.title) {
|
|
|
+ result.title = platform.getTableTemp().title;
|
|
|
+ }
|
|
|
+ if (!result.store) {
|
|
|
+ result.store = {
|
|
|
+ ...getEmptyStoreData(),
|
|
|
+ };
|
|
|
+ }
|
|
|
+ if (result.title) {
|
|
|
+ let texts = result.store.layers[defaultLayer].text;
|
|
|
+ if (!texts) {
|
|
|
+ texts = result.store.layers[defaultLayer].text = []
|
|
|
+ }
|
|
|
+ let title = texts.find((title: any) => title.key === tableTitleKey);
|
|
|
+ if (title) {
|
|
|
+ title.content = result.title;
|
|
|
+ } else {
|
|
|
+ const { margin, size } = getPaperConfig(
|
|
|
+ (paperConfigs as any)[result.paperKey].size,
|
|
|
+ (paperConfigs as any)[result.paperKey].scale
|
|
|
+ );
|
|
|
+ const title = {
|
|
|
+ ...getBaseItem(),
|
|
|
+ content: result.title,
|
|
|
+ width: getRealPixel(90, result.paperKey),
|
|
|
+ heihgt: getRealPixel(14.4, result.paperKey),
|
|
|
+ fontSize: getRealPixel(12, result.paperKey),
|
|
|
+ key: tableTitleKey,
|
|
|
+ align: "center",
|
|
|
+ mat: [1, 0, 0, 1, 0, 0],
|
|
|
+ };
|
|
|
+ const pos = {
|
|
|
+ x:
|
|
|
+ (size.width - margin[3]) / 2 -
|
|
|
+ getRealPixel(40, result.paperKey) +
|
|
|
+ margin[3],
|
|
|
+ y: getRealPixel(15, result.paperKey) + margin[0],
|
|
|
+ };
|
|
|
+ title.mat[4] = pos.x;
|
|
|
+ title.mat[5] = pos.y;
|
|
|
+ texts.push(title)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+};
|
|
|
+
|
|
|
+window.platform.saveTabulationData = (id: any, data: any) => {
|
|
|
+ const texts = data.store.layers[defaultLayer].text;
|
|
|
+ let title = texts.find((title: any) => title.key === tableTitleKey);
|
|
|
+ let content = title ? title.content : ''
|
|
|
+
|
|
|
+ return platform.saveTabulationData(id, {...data, title: content})
|
|
|
+}
|
|
|
+
|
|
|
// 登录检测
|
|
|
setTimeout(() => {
|
|
|
if (!platform.getHeaders().token) {
|
|
|
ElMessage.error("当前用户未登录");
|
|
|
window.platform.login();
|
|
|
} else {
|
|
|
- console.log('0.0')
|
|
|
+ console.log("0.0");
|
|
|
platform.getSceneList("").next();
|
|
|
}
|
|
|
-}, 500);
|
|
|
+}, 500);
|