@gct-paas/design 0.1.6-dev.22 → 0.1.6-dev.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,42 +17,42 @@ var i18nKeyMap = {
17
17
  };
18
18
  /** 参数 */
19
19
  var params = {};
20
+ /** 占用信息 */
21
+ var occupyInfo = ref({});
22
+ /** 锁定信息 */
23
+ var lockInfo = ref({});
24
+ var timeout = computed(() => {
25
+ return occupyInfo.value.querySpanNum * 1e3;
26
+ });
27
+ var wait = computed(() => {
28
+ return (occupyInfo.value.cacheNum - 10) / 2 * 1e3;
29
+ });
30
+ var unlockAvailable = computed(() => {
31
+ const { userId, username } = _gct.store.userInfo;
32
+ return lockInfo.value.id === userId || username === "admin";
33
+ });
34
+ /** 查询占用定时器 */
35
+ var occupyTimer = null;
36
+ async function _loadOccupyInfo() {
37
+ if (!params.id || !params.type || params.id.startsWith("___new___")) return;
38
+ const res = await _api.apaas.designerLock.getGetPageOccupyMsg(params);
39
+ const data = { ...res };
40
+ if (!data.querySpanNum) data.querySpanNum = 120;
41
+ if (!data.cacheNum) data.cacheNum = 500;
42
+ occupyInfo.value = data;
43
+ if (res?.occupyId) destoryOccupyTimer();
44
+ else if (!occupyTimer) occupyTimer = setInterval(() => {
45
+ _loadOccupyInfo();
46
+ }, timeout.value);
47
+ }
48
+ function destoryOccupyTimer() {
49
+ console.log("【销毁占用轮询】");
50
+ if (!occupyTimer) return;
51
+ console.log("【销毁占用轮询 清除定时器】");
52
+ clearInterval(occupyTimer);
53
+ occupyTimer = null;
54
+ }
20
55
  function useUserOccupy() {
21
- /** 占用信息 */
22
- const occupyInfo = ref({});
23
- /** 锁定信息 */
24
- const lockInfo = ref({});
25
- const timeout = computed(() => {
26
- return occupyInfo.value.querySpanNum * 1e3;
27
- });
28
- const wait = computed(() => {
29
- return (occupyInfo.value.cacheNum - 10) / 2 * 1e3;
30
- });
31
- const unlockAvailable = computed(() => {
32
- const { userId, username } = _gct.store.userInfo;
33
- return lockInfo.value.id === userId || username === "admin";
34
- });
35
- /** 查询占用定时器 */
36
- let occupyTimer = null;
37
- async function _loadOccupyInfo() {
38
- if (!params.id || !params.type || params.id.startsWith("___new___")) return;
39
- const res = await _api.apaas.designerLock.getGetPageOccupyMsg(params);
40
- const data = { ...res };
41
- if (!data.querySpanNum) data.querySpanNum = 120;
42
- if (!data.cacheNum) data.cacheNum = 500;
43
- occupyInfo.value = data;
44
- if (res?.occupyId) destoryOccupyTimer();
45
- else if (!occupyTimer) occupyTimer = setInterval(() => {
46
- _loadOccupyInfo();
47
- }, timeout.value);
48
- }
49
- function destoryOccupyTimer() {
50
- console.log("【销毁占用轮询】");
51
- if (!occupyTimer) return;
52
- console.log("【销毁占用轮询 清除定时器】");
53
- clearInterval(occupyTimer);
54
- occupyTimer = null;
55
- }
56
56
  function initMqttOccupy(data) {
57
57
  /** 强制刷新主题 */
58
58
  const CLEAN_CACHE = `CLEAN_CACHE`;
@@ -67,13 +67,9 @@ function useUserOccupy() {
67
67
  })
68
68
  }
69
69
  }).subscribe(CLEAN_CACHE, () => {
70
- const currentUrl = window.location.href;
71
- if (currentUrl.includes("?")) if (currentUrl.includes("reloadTime")) {
72
- const arr = currentUrl.split("reloadTime=");
73
- arr[1] = Date.now().toString();
74
- window.location.href = arr.join("reloadTime=");
75
- } else window.location.href = currentUrl + "&reloadTime=" + Date.now();
76
- else window.location.href = currentUrl + "?reloadTime=" + Date.now();
70
+ const url = new URL(window.location.href);
71
+ url.searchParams.set("reloadTime", Date.now().toString());
72
+ window.location.href = url.toString();
77
73
  location.reload();
78
74
  });
79
75
  }
@@ -89,7 +85,7 @@ function useUserOccupy() {
89
85
  if (lockInfo.value.id) return;
90
86
  if (_gct.store.userInfo.userId !== occupyInfo.value.occupyId && occupyInfo.value.occupyId) return;
91
87
  try {
92
- await _api.apaas.designerLock.getGetPageOccupyMsg(params);
88
+ await _api.apaas.designerLock.postOccupyPage(params);
93
89
  } catch (err) {
94
90
  console.warn("【占用异常】", err);
95
91
  } finally {
@@ -19,7 +19,7 @@ function useDesignCache() {
19
19
  * 缓存步骤,组件拖入布局画板时更新历史记录
20
20
  */
21
21
  function emitCache() {
22
- const id = _gct.store.context.aid;
22
+ const id = _gct.store.context.pid;
23
23
  historyUtils.addHistory({
24
24
  historyId: id,
25
25
  past: JSON.stringify(pageJson)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/design",
3
- "version": "0.1.6-dev.22",
3
+ "version": "0.1.6-dev.23",
4
4
  "type": "module",
5
5
  "description": "paas 平台设计界面底包",
6
6
  "loader": "dist/loader.esm.min.js",
@@ -51,10 +51,10 @@
51
51
  "react-dnd-html5-backend": "^16.0.1",
52
52
  "vue": "^3.5.30",
53
53
  "vue3-dnd": "^2.1.0",
54
- "@gct-paas/core": "0.1.6-dev.22",
55
- "@gct-paas/core-web": "0.1.6-dev.22",
56
- "@gct-paas/schema": "0.1.6-dev.22",
57
- "@gct-paas/scss": "0.1.6-dev.22"
54
+ "@gct-paas/core": "0.1.6-dev.23",
55
+ "@gct-paas/core-web": "0.1.6-dev.23",
56
+ "@gct-paas/schema": "0.1.6-dev.23",
57
+ "@gct-paas/scss": "0.1.6-dev.23"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/babel__core": "^7.20.5",
@@ -64,10 +64,10 @@
64
64
  "peerDependencies": {
65
65
  "@gct-paas/api": "^0.1.6-dev.14",
66
66
  "vue": ">=3",
67
- "@gct-paas/core": "0.1.6-dev.22",
68
- "@gct-paas/schema": "0.1.6-dev.22",
69
- "@gct-paas/core-web": "0.1.6-dev.22",
70
- "@gct-paas/scss": "0.1.6-dev.22"
67
+ "@gct-paas/core": "0.1.6-dev.23",
68
+ "@gct-paas/scss": "0.1.6-dev.23",
69
+ "@gct-paas/schema": "0.1.6-dev.23",
70
+ "@gct-paas/core-web": "0.1.6-dev.23"
71
71
  },
72
72
  "scripts": {
73
73
  "dev": "cross-env NODE_ENV=development vite build --watch --config vite.dev.config.ts",