inl-ui 0.1.155 → 0.1.158

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.
@@ -7160,7 +7160,67 @@ const PageContent = vue.defineComponent({
7160
7160
  }
7161
7161
  };
7162
7162
  const activeMenu = useActiveMenu(() => props.menu, props.extraPages, false, false, extraIframeList);
7163
+ let interval = null;
7164
+ vue.onMounted(() => {
7165
+ interval = setInterval(() => {
7166
+ historyArr.forEach(item => {
7167
+ if (item.inUse) {
7168
+ item.sendTime += 1e3;
7169
+ if (item.sendTime >= 60 * 1e3) {
7170
+ sendRecord(item, "update");
7171
+ item.sendTime = 0;
7172
+ }
7173
+ }
7174
+ if (item.leaveTime > 0) {
7175
+ item.leaveTime += 1e3;
7176
+ }
7177
+ });
7178
+ historyArr = historyArr.filter(item => item.leaveTime <= 60 * 1e3);
7179
+ }, 1e3);
7180
+ });
7181
+ let historyArr = [];
7182
+ const sendRecord = async (obj, fun) => {
7183
+ const userInfo = JSON.parse(sessionStorage.getItem("userinfo") || "{}");
7184
+ obj.userId = userInfo.userId;
7185
+ obj.userName = userInfo.userName;
7186
+ obj.menuName = obj.name;
7187
+ obj.type = 1;
7188
+ await axios__default["default"].post(fun === "insert" ? "/api/common/v1/menu-usage/record" : "/api/common/v1/menu-usage/update-duration", obj, {
7189
+ headers: {
7190
+ token: sessionStorage.getItem("token") || ""
7191
+ }
7192
+ });
7193
+ };
7163
7194
  vue.watch(activeMenu, (val, oldVal) => {
7195
+ console.log("activeMenu changed:", val, oldVal);
7196
+ debugger;
7197
+ if (oldVal) {
7198
+ const historyItem = historyArr.find(item => item.id === oldVal.id);
7199
+ if (historyItem) {
7200
+ historyItem.inUse = false;
7201
+ historyItem.sendTime = 0;
7202
+ historyItem.leaveTime = 1e3;
7203
+ }
7204
+ }
7205
+ if (val) {
7206
+ const historyItem = historyArr.find(item => item.id === val.id);
7207
+ if (historyItem) {
7208
+ historyItem.leaveTime = 0;
7209
+ historyItem.sendTime = 0;
7210
+ historyItem.inUse = true;
7211
+ sendRecord({
7212
+ ...val,
7213
+ uuid: historyItem.uuid
7214
+ }, "update");
7215
+ } else {
7216
+ val.leaveTime = 0;
7217
+ val.sendTime = 0;
7218
+ val.inUse = true;
7219
+ val.uuid = crypto.randomUUID();
7220
+ historyArr.push(val);
7221
+ sendRecord(val, "insert");
7222
+ }
7223
+ }
7164
7224
  handleMenuChange(val);
7165
7225
  function postIframeActive(id, active) {
7166
7226
  const iframeEl = document.querySelector(`#iframe${id}`);
@@ -7252,6 +7312,7 @@ const PageContent = vue.defineComponent({
7252
7312
  tabListRef.value?.closeTab(tab);
7253
7313
  };
7254
7314
  vue.onBeforeUnmount(() => {
7315
+ clearInterval(interval);
7255
7316
  for (const app of loadAppList.value) {
7256
7317
  app.app.unmount();
7257
7318
  }
@@ -7481,7 +7542,6 @@ const Layout = vue.defineComponent({
7481
7542
  const currMenu = vue.ref();
7482
7543
  const handleMenuSelect = menu => {
7483
7544
  currMenu.value = menu;
7484
- console.log("currMenu.value", currMenu.value);
7485
7545
  vue.nextTick(() => currMenu.value = void 0);
7486
7546
  };
7487
7547
  vue.onBeforeUnmount(() => {
@@ -1,4 +1,4 @@
1
- import { defineComponent, createVNode, ref, watch, resolveComponent, isVNode, computed, onBeforeUnmount, inject, onActivated, onDeactivated, nextTick, watchEffect, Fragment, withDirectives, vShow, toRaw, reactive, provide, createTextVNode, onMounted, KeepAlive, toRefs, shallowRef, onBeforeMount, mergeProps, onBeforeUpdate, Teleport } from 'vue';
1
+ import { defineComponent, createVNode, ref, watch, resolveComponent, isVNode, computed, onBeforeUnmount, inject, onActivated, onDeactivated, nextTick, watchEffect, Fragment, onMounted, withDirectives, vShow, toRaw, reactive, provide, createTextVNode, KeepAlive, toRefs, shallowRef, onBeforeMount, mergeProps, onBeforeUpdate, Teleport } from 'vue';
2
2
  import { createFromIconfontCN, SearchOutlined, DownOutlined, PoweroffOutlined, MenuUnfoldOutlined, MenuFoldOutlined, SkinFilled, FullscreenOutlined, PauseCircleOutlined, PlayCircleFilled, FullscreenExitOutlined, CaretUpOutlined, CaretRightOutlined, CaretDownOutlined, FileExcelTwoTone, InboxOutlined, MessageOutlined } from '@ant-design/icons-vue';
3
3
  import { useRoute, useRouter } from 'vue-router';
4
4
  import { useMounted, resolveRef, useThrottleFn, useLocalStorage, useFullscreen, useMouseInElement, useVModel, useMagicKeys, whenever, watchArray, useEventListener, useSessionStorage, useElementBounding, useToggle, useMemory, useWindowSize, useClipboard, useBreakpoints, breakpointsAntDesign } from '@vueuse/core';
@@ -7131,7 +7131,67 @@ const PageContent = defineComponent({
7131
7131
  }
7132
7132
  };
7133
7133
  const activeMenu = useActiveMenu(() => props.menu, props.extraPages, false, false, extraIframeList);
7134
+ let interval = null;
7135
+ onMounted(() => {
7136
+ interval = setInterval(() => {
7137
+ historyArr.forEach(item => {
7138
+ if (item.inUse) {
7139
+ item.sendTime += 1e3;
7140
+ if (item.sendTime >= 60 * 1e3) {
7141
+ sendRecord(item, "update");
7142
+ item.sendTime = 0;
7143
+ }
7144
+ }
7145
+ if (item.leaveTime > 0) {
7146
+ item.leaveTime += 1e3;
7147
+ }
7148
+ });
7149
+ historyArr = historyArr.filter(item => item.leaveTime <= 60 * 1e3);
7150
+ }, 1e3);
7151
+ });
7152
+ let historyArr = [];
7153
+ const sendRecord = async (obj, fun) => {
7154
+ const userInfo = JSON.parse(sessionStorage.getItem("userinfo") || "{}");
7155
+ obj.userId = userInfo.userId;
7156
+ obj.userName = userInfo.userName;
7157
+ obj.menuName = obj.name;
7158
+ obj.type = 1;
7159
+ await axios$3.post(fun === "insert" ? "/api/common/v1/menu-usage/record" : "/api/common/v1/menu-usage/update-duration", obj, {
7160
+ headers: {
7161
+ token: sessionStorage.getItem("token") || ""
7162
+ }
7163
+ });
7164
+ };
7134
7165
  watch(activeMenu, (val, oldVal) => {
7166
+ console.log("activeMenu changed:", val, oldVal);
7167
+ debugger;
7168
+ if (oldVal) {
7169
+ const historyItem = historyArr.find(item => item.id === oldVal.id);
7170
+ if (historyItem) {
7171
+ historyItem.inUse = false;
7172
+ historyItem.sendTime = 0;
7173
+ historyItem.leaveTime = 1e3;
7174
+ }
7175
+ }
7176
+ if (val) {
7177
+ const historyItem = historyArr.find(item => item.id === val.id);
7178
+ if (historyItem) {
7179
+ historyItem.leaveTime = 0;
7180
+ historyItem.sendTime = 0;
7181
+ historyItem.inUse = true;
7182
+ sendRecord({
7183
+ ...val,
7184
+ uuid: historyItem.uuid
7185
+ }, "update");
7186
+ } else {
7187
+ val.leaveTime = 0;
7188
+ val.sendTime = 0;
7189
+ val.inUse = true;
7190
+ val.uuid = crypto.randomUUID();
7191
+ historyArr.push(val);
7192
+ sendRecord(val, "insert");
7193
+ }
7194
+ }
7135
7195
  handleMenuChange(val);
7136
7196
  function postIframeActive(id, active) {
7137
7197
  const iframeEl = document.querySelector(`#iframe${id}`);
@@ -7223,6 +7283,7 @@ const PageContent = defineComponent({
7223
7283
  tabListRef.value?.closeTab(tab);
7224
7284
  };
7225
7285
  onBeforeUnmount(() => {
7286
+ clearInterval(interval);
7226
7287
  for (const app of loadAppList.value) {
7227
7288
  app.app.unmount();
7228
7289
  }
@@ -7452,7 +7513,6 @@ const Layout = defineComponent({
7452
7513
  const currMenu = ref();
7453
7514
  const handleMenuSelect = menu => {
7454
7515
  currMenu.value = menu;
7455
- console.log("currMenu.value", currMenu.value);
7456
7516
  nextTick(() => currMenu.value = void 0);
7457
7517
  };
7458
7518
  onBeforeUnmount(() => {
package/dist/index.cjs CHANGED
@@ -45,7 +45,7 @@ var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
45
45
  var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
46
46
  var mqtt__default = /*#__PURE__*/_interopDefaultLegacy(mqtt);
47
47
 
48
- var version = "0.1.154";
48
+ var version = "0.1.157";
49
49
 
50
50
  const setTheme = theme => {
51
51
  if (theme === "dark") {
@@ -8315,7 +8315,67 @@ const PageContent = vue.defineComponent({
8315
8315
  }
8316
8316
  };
8317
8317
  const activeMenu = useActiveMenu(() => props.menu, props.extraPages, false, false, extraIframeList);
8318
+ let interval = null;
8319
+ vue.onMounted(() => {
8320
+ interval = setInterval(() => {
8321
+ historyArr.forEach(item => {
8322
+ if (item.inUse) {
8323
+ item.sendTime += 1e3;
8324
+ if (item.sendTime >= 60 * 1e3) {
8325
+ sendRecord(item, "update");
8326
+ item.sendTime = 0;
8327
+ }
8328
+ }
8329
+ if (item.leaveTime > 0) {
8330
+ item.leaveTime += 1e3;
8331
+ }
8332
+ });
8333
+ historyArr = historyArr.filter(item => item.leaveTime <= 60 * 1e3);
8334
+ }, 1e3);
8335
+ });
8336
+ let historyArr = [];
8337
+ const sendRecord = async (obj, fun) => {
8338
+ const userInfo = JSON.parse(sessionStorage.getItem("userinfo") || "{}");
8339
+ obj.userId = userInfo.userId;
8340
+ obj.userName = userInfo.userName;
8341
+ obj.menuName = obj.name;
8342
+ obj.type = 1;
8343
+ await axios__default["default"].post(fun === "insert" ? "/api/common/v1/menu-usage/record" : "/api/common/v1/menu-usage/update-duration", obj, {
8344
+ headers: {
8345
+ token: sessionStorage.getItem("token") || ""
8346
+ }
8347
+ });
8348
+ };
8318
8349
  vue.watch(activeMenu, (val, oldVal) => {
8350
+ console.log("activeMenu changed:", val, oldVal);
8351
+ debugger;
8352
+ if (oldVal) {
8353
+ const historyItem = historyArr.find(item => item.id === oldVal.id);
8354
+ if (historyItem) {
8355
+ historyItem.inUse = false;
8356
+ historyItem.sendTime = 0;
8357
+ historyItem.leaveTime = 1e3;
8358
+ }
8359
+ }
8360
+ if (val) {
8361
+ const historyItem = historyArr.find(item => item.id === val.id);
8362
+ if (historyItem) {
8363
+ historyItem.leaveTime = 0;
8364
+ historyItem.sendTime = 0;
8365
+ historyItem.inUse = true;
8366
+ sendRecord({
8367
+ ...val,
8368
+ uuid: historyItem.uuid
8369
+ }, "update");
8370
+ } else {
8371
+ val.leaveTime = 0;
8372
+ val.sendTime = 0;
8373
+ val.inUse = true;
8374
+ val.uuid = crypto.randomUUID();
8375
+ historyArr.push(val);
8376
+ sendRecord(val, "insert");
8377
+ }
8378
+ }
8319
8379
  handleMenuChange(val);
8320
8380
  function postIframeActive(id, active) {
8321
8381
  const iframeEl = document.querySelector(`#iframe${id}`);
@@ -8407,6 +8467,7 @@ const PageContent = vue.defineComponent({
8407
8467
  tabListRef.value?.closeTab(tab);
8408
8468
  };
8409
8469
  vue.onBeforeUnmount(() => {
8470
+ clearInterval(interval);
8410
8471
  for (const app of loadAppList.value) {
8411
8472
  app.app.unmount();
8412
8473
  }
@@ -8636,7 +8697,6 @@ const Layout = vue.defineComponent({
8636
8697
  const currMenu = vue.ref();
8637
8698
  const handleMenuSelect = menu => {
8638
8699
  currMenu.value = menu;
8639
- console.log("currMenu.value", currMenu.value);
8640
8700
  vue.nextTick(() => currMenu.value = void 0);
8641
8701
  };
8642
8702
  vue.onBeforeUnmount(() => {
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { Key } from 'ant-design-vue/lib/table/interface';
11
11
  import * as vue_jsx_runtime from 'vue/jsx-runtime';
12
12
  import * as _ant_design_icons_vue_lib_components_IconFont from '@ant-design/icons-vue/lib/components/IconFont';
13
13
 
14
- var version = "0.1.154";
14
+ var version = "0.1.157";
15
15
 
16
16
  declare const _default$p: {
17
17
  set(theme: string): void;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import qiankun from 'vite-plugin-qiankun';
2
2
  import renderWithQiankun, { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
3
- import { defineComponent, createVNode, createApp, ref, watch, reactive, computed, onBeforeUnmount, inject, watchEffect, onActivated, onDeactivated, resolveComponent, isVNode, nextTick, Fragment, withDirectives, vShow, toRaw, provide, createTextVNode, onMounted, KeepAlive, toRefs, shallowRef, onBeforeMount, mergeProps, onBeforeUpdate, Teleport } from 'vue';
3
+ import { defineComponent, createVNode, createApp, ref, watch, reactive, computed, onBeforeUnmount, inject, watchEffect, onActivated, onDeactivated, resolveComponent, isVNode, nextTick, Fragment, onMounted, withDirectives, vShow, toRaw, provide, createTextVNode, KeepAlive, toRefs, shallowRef, onBeforeMount, mergeProps, onBeforeUpdate, Teleport } from 'vue';
4
4
  import axios$3 from 'axios';
5
5
  import { message, Menu, MenuItem, Input as Input$1, Badge, Avatar as Avatar$1, MenuDivider, Modal, SubMenu, Dropdown, Tooltip, Select, LayoutHeader, LayoutSider, Layout as Layout$1, LayoutContent, Form, Row, Col, FormItem, SelectOption, Switch, InputNumber } from 'ant-design-vue';
6
6
  import _, { isPlainObject as isPlainObject$2, omit, cloneDeep, differenceBy, isObject as isObject$3, concat } from 'lodash';
@@ -14,7 +14,7 @@ import { XPopup, CommentBlock, setAxiosOption } from '@sszj-temp/mobile';
14
14
  import { marked } from 'marked';
15
15
  import '@sszj-temp/mobile/style.css';
16
16
 
17
- var version = "0.1.154";
17
+ var version = "0.1.157";
18
18
 
19
19
  const setTheme = theme => {
20
20
  if (theme === "dark") {
@@ -8284,7 +8284,67 @@ const PageContent = defineComponent({
8284
8284
  }
8285
8285
  };
8286
8286
  const activeMenu = useActiveMenu(() => props.menu, props.extraPages, false, false, extraIframeList);
8287
+ let interval = null;
8288
+ onMounted(() => {
8289
+ interval = setInterval(() => {
8290
+ historyArr.forEach(item => {
8291
+ if (item.inUse) {
8292
+ item.sendTime += 1e3;
8293
+ if (item.sendTime >= 60 * 1e3) {
8294
+ sendRecord(item, "update");
8295
+ item.sendTime = 0;
8296
+ }
8297
+ }
8298
+ if (item.leaveTime > 0) {
8299
+ item.leaveTime += 1e3;
8300
+ }
8301
+ });
8302
+ historyArr = historyArr.filter(item => item.leaveTime <= 60 * 1e3);
8303
+ }, 1e3);
8304
+ });
8305
+ let historyArr = [];
8306
+ const sendRecord = async (obj, fun) => {
8307
+ const userInfo = JSON.parse(sessionStorage.getItem("userinfo") || "{}");
8308
+ obj.userId = userInfo.userId;
8309
+ obj.userName = userInfo.userName;
8310
+ obj.menuName = obj.name;
8311
+ obj.type = 1;
8312
+ await axios$3.post(fun === "insert" ? "/api/common/v1/menu-usage/record" : "/api/common/v1/menu-usage/update-duration", obj, {
8313
+ headers: {
8314
+ token: sessionStorage.getItem("token") || ""
8315
+ }
8316
+ });
8317
+ };
8287
8318
  watch(activeMenu, (val, oldVal) => {
8319
+ console.log("activeMenu changed:", val, oldVal);
8320
+ debugger;
8321
+ if (oldVal) {
8322
+ const historyItem = historyArr.find(item => item.id === oldVal.id);
8323
+ if (historyItem) {
8324
+ historyItem.inUse = false;
8325
+ historyItem.sendTime = 0;
8326
+ historyItem.leaveTime = 1e3;
8327
+ }
8328
+ }
8329
+ if (val) {
8330
+ const historyItem = historyArr.find(item => item.id === val.id);
8331
+ if (historyItem) {
8332
+ historyItem.leaveTime = 0;
8333
+ historyItem.sendTime = 0;
8334
+ historyItem.inUse = true;
8335
+ sendRecord({
8336
+ ...val,
8337
+ uuid: historyItem.uuid
8338
+ }, "update");
8339
+ } else {
8340
+ val.leaveTime = 0;
8341
+ val.sendTime = 0;
8342
+ val.inUse = true;
8343
+ val.uuid = crypto.randomUUID();
8344
+ historyArr.push(val);
8345
+ sendRecord(val, "insert");
8346
+ }
8347
+ }
8288
8348
  handleMenuChange(val);
8289
8349
  function postIframeActive(id, active) {
8290
8350
  const iframeEl = document.querySelector(`#iframe${id}`);
@@ -8376,6 +8436,7 @@ const PageContent = defineComponent({
8376
8436
  tabListRef.value?.closeTab(tab);
8377
8437
  };
8378
8438
  onBeforeUnmount(() => {
8439
+ clearInterval(interval);
8379
8440
  for (const app of loadAppList.value) {
8380
8441
  app.app.unmount();
8381
8442
  }
@@ -8605,7 +8666,6 @@ const Layout = defineComponent({
8605
8666
  const currMenu = ref();
8606
8667
  const handleMenuSelect = menu => {
8607
8668
  currMenu.value = menu;
8608
- console.log("currMenu.value", currMenu.value);
8609
8669
  nextTick(() => currMenu.value = void 0);
8610
8670
  };
8611
8671
  onBeforeUnmount(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inl-ui",
3
- "version": "0.1.155",
3
+ "version": "0.1.158",
4
4
  "description": "工业 pc ui库",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",