|
@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
|
|
|
import { KeepAliveState } from "@/stores/interface";
|
|
|
import { cloneDeep } from "lodash-es";
|
|
|
import { useTabsStore } from "@/stores/modules/tabs";
|
|
|
+import { LockBill, UnLockBill } from "@/api/modules/common";
|
|
|
|
|
|
export const useKeepAliveStore = defineStore({
|
|
|
id: "geeker-keepAlive",
|
|
@@ -54,6 +55,16 @@ export const useKeepAliveStore = defineStore({
|
|
|
}
|
|
|
this.keepAliveList.splice(index, 1);
|
|
|
// this.keepAliveList[index].times = this.keepAliveList[index].times + 1;
|
|
|
+
|
|
|
+ if (route.needLock && Number(route.billid)) {
|
|
|
+ UnLockBill({
|
|
|
+ keyword: String(route.billtype),
|
|
|
+ billid: Number(route.billid),
|
|
|
+ billcode: String(route.billcode)
|
|
|
+ }).catch(err => {
|
|
|
+ console.warn("解锁失败:", route.billtype, route.billid, err);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
console.log("getKeepAliveName routeItem removeKeepAliveName :>> ", index, JSON.stringify(this.keepAliveList));
|
|
|
console.log("getKeepAliveName routeItem removeKeepAliveName :>> ", this.keepAliveList);
|
|
@@ -95,6 +106,27 @@ export const useKeepAliveStore = defineStore({
|
|
|
name: to.name as string,
|
|
|
close: !to.meta.isAffix
|
|
|
};
|
|
|
+
|
|
|
+ if (to.meta.needLock && Number(to.query.id)) {
|
|
|
+ tabsParams["needLock"] = to.meta.needLock;
|
|
|
+ tabsParams["keyword"] = String(to.meta.billtype);
|
|
|
+ tabsParams["billid"] = Number(to.query.id);
|
|
|
+ tabsParams["billcode"] = String(to.query.code);
|
|
|
+ }
|
|
|
+
|
|
|
+ const isEditToDetail =
|
|
|
+ from.fullPath.includes("/edit") && to.fullPath.includes("/detail") && from.query?.id && from.meta?.needLock;
|
|
|
+
|
|
|
+ if (isEditToDetail) {
|
|
|
+ UnLockBill({
|
|
|
+ keyword: String(from.meta.billtype),
|
|
|
+ billid: Number(from.query.id),
|
|
|
+ billcode: String(from.query.code)
|
|
|
+ }).catch(err => {
|
|
|
+ console.warn("edit->detail 解锁失败:", err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
console.log("tabStore :>> ", tabStore, to);
|
|
|
console.log("tabsParams router:>> ", tabsParams);
|
|
|
let isReplace = false;
|