Browse Source

Merge remote-tracking branch 'origin/dev' into dev

lichao 3 years ago
parent
commit
42ea6c7c2d

+ 8 - 0
src/main.js

@@ -53,6 +53,10 @@ import {
   saveColumnData,
   delColumnData
 } from "@/util/columnSetting"
+import {
+  inDetailsKey,
+  leaveDetailsKey
+} from "@/util/keyData"
 // 导入弹窗放大样式
 import '@/assets/css/form.css'
 // 客户调出收发货地址
@@ -113,6 +117,10 @@ Vue.prototype.getColumnName = getColumnName
 Vue.prototype.getColumnData = getColumnData
 Vue.prototype.saveColumnData = saveColumnData
 Vue.prototype.delColumnData=delColumnData
+//进入详情页时,保存id和其他参数
+Vue.prototype.inDetailsKey=inDetailsKey
+//离开详情页时,清除对应key的id和其他参数
+Vue.prototype.leaveDetailsKey=leaveDetailsKey
 Vue.config.productionTip = false;
 Vue.prototype.corpAddr = corpAddr;
 // 业务锁

+ 25 - 0
src/util/keyData.js

@@ -0,0 +1,25 @@
+//进入详情页时,保存id和其他参数
+export function inDetailsKey(key, obj) {
+  let list = []
+  list = getDetailsKey() ? getDetailsKey() : []
+  if (list.find(e => e.key == key)) {
+    list.fill({key: key,...obj},list.findIndex(item => item.key == key),list.findIndex(item => item.key == key)+1) 
+    sessionStorage.setItem('detailsKeyData', JSON.stringify(list))
+  } else {
+    list.push({
+      key: key,
+      ...obj
+    })
+    sessionStorage.setItem('detailsKeyData', JSON.stringify(list))
+  }
+}
+//离开详情页时,清除对应key的id和其他参数
+export function leaveDetailsKey(key) {
+  let list = []
+  list = getDetailsKey() ? getDetailsKey() : []
+  list.splice(list.findIndex(item => item.key == key), 1)
+  sessionStorage.setItem('detailsKeyData', JSON.stringify(list))
+}
+export function getDetailsKey() {
+  return JSON.parse(sessionStorage.getItem("detailsKeyData"))
+}

+ 24 - 2
src/views/exportTrade/salesContract/detailsPage.vue

@@ -1930,6 +1930,14 @@ export default {
               this.oldExchange = this.deepClone(this.form.exchangeRate);
               if (status == "goBack") {
                 this.$emit("goBack");
+                this.leaveDetailsKey(this.$route.name);
+              }
+              if (this.form.id) {
+                this.unLock({
+                  moduleName: "xs",
+                  tableName: "business_order",
+                  billId: this.form.id
+                });
               }
             })
             .finally(() => {
@@ -2008,9 +2016,11 @@ export default {
           })
           .catch(() => {
             this.$emit("goBack");
+            this.leaveDetailsKey(this.$route.name);
           });
       } else {
         this.$emit("goBack");
+        this.leaveDetailsKey(this.$route.name);
       }
     },
     openReport() {
@@ -2079,8 +2089,20 @@ export default {
       });
     },
     openEdit() {
-      this.detailData.status = 2;
-      this.option = this.$options.data().option;
+      const data = {
+        moduleName: "xs",
+        tableName: "business_order",
+        billId: this.form.id,
+        no: localStorage.getItem("browserID")
+      };
+      this.saveLoading = true;
+      this.checkLock(data).then(res => {
+        if (res.data.code == 200) {
+          this.onLock(data).then(response => {});
+          this.detailData.status = 2;
+          this.option = this.$options.data().option;
+        }
+      });
     },
     async saveColumn() {
       const inSave = await this.saveColumnData(

+ 6 - 1
src/views/exportTrade/salesContract/index.vue

@@ -119,7 +119,7 @@
             type="text"
             icon="el-icon-edit"
             size="small"
-            @click.stop="editOpen(scope.row, 2)"
+            @click.stop="editOpen(scope.row, 1)"
             >编辑
           </el-button>
           <el-button
@@ -297,6 +297,11 @@ export default {
         status: status
       };
       this.show = false;
+      this.inDetailsKey(this.$route.name, {
+        moduleName: "xs",
+        tableName: "business_order",
+        id: row.id
+      });
     },
     //点击搜索按钮触发
     searchChange(params, done) {