Переглянути джерело

设备台账进入部件 返回时记录状态类型及分页

haojianlong 5 роки тому
батько
коміт
1d969a1b41

+ 24 - 12
src/components/ledger/handsontables/device.vue

@@ -1,5 +1,5 @@
 <template>
-  <div style="height: calc(100% - 44.5px);padding: 0px 10px 10px;box-sizing: border-box;">
+  <div style="height: calc(100% - 44.5px);padding: 0px 10px 10px;box-sizing: border-box;" v-loading="loading">
     <div class="hanson-bar">
       <div style="float:right;overflow:hidden;">
         <!-- <span style="width:20px;float:left;display:block;height:20px;cursor: pointer;" @click="changeAssetsFalg">
@@ -83,9 +83,9 @@
       </p>
     </div>
 
-    <div v-show="mess.deviceId && tableData && tableData.length" v-loading="loading" id="handsontable" ref="handsontable"></div>
+    <div v-show="mess.deviceId && tableData && tableData.length" id="handsontable" ref="handsontable"></div>
     <div v-show="mess.deviceId && tableData && tableData.length" class="right">
-      <my-pagination @change="getTableData" :page="page"></my-pagination>
+      <my-pagination @change="getTableData" :page="page" :key="pageKey"></my-pagination>
     </div>
     <details-dialog :iframeSrc="iframeSrc" v-if="myDialog.details" :dialog="myDialog"></details-dialog>
     <!-- 关联的系统 -->
@@ -233,6 +233,7 @@ export default {
                 total: 0,
                 currentPage: 1
             },
+            pageKey: new Date().getTime(),
             batchPage: {
                 size: 50,
                 sizes: [10, 30, 50, 100, 150, 200],
@@ -342,7 +343,18 @@ export default {
     methods: {
         //获取表头
         getHeaderData(code) {
-            this.page.currentPage = 1
+            let tempParams = this.$route.params;
+            if (!tempParams.used && tempParams.pageSize) {
+                console.log(22222222222)
+                console.log(tempParams)
+                this.page.currentPage = tempParams.pageNo;
+                this.page.size = tempParams.pageSize;
+                this.onlyRead = tempParams.readOnly;
+                tempParams.used = true;
+            } else {
+                this.page.currentPage = 1
+            }
+            this.pageKey = new Date().getTime();
             this.mess = code
             this.changeCader()
             if (this.mess.deviceId) {
@@ -1036,14 +1048,14 @@ export default {
                     return false
                 //包含的部件字段
                 case 'Count':
-                    if (this.onlyRead) {
-                        this.$router.push({path: '/ledger/parts', query: {deviceId: infos.EquipID}});
-                    } else {
-                        this.$router.push({
-                            path: '/ledger/partsmanage',
-                            query: {deviceId: infos.EquipID, typeId: this.mess.deviceId}
-                        });
-                    }
+                    console.log(this.page)
+                    let countUrl = this.onlyRead ? '/ledger/parts' : '/ledger/partsmanage';
+                    this.$router.push({path: countUrl, query: {
+                        deviceId: infos.EquipID,
+                        typeId: this.mess.deviceId,
+                        pageNo: this.page.currentPage,
+                        pageSize: this.page.size
+                    }});
                     return false
                 default:
                     break;

+ 18 - 3
src/views/ledger/facility/parts/index.vue

@@ -10,6 +10,7 @@
         <span>只看要采集的信息</span>
         <el-checkbox v-model="allMess" @change="getTableHeader"></el-checkbox>
       </div> -->
+      <el-button size="small" type="default" icon="el-icon-back" @click="goback" style="margin-right:10px;"></el-button>
       <el-select v-model="showType" @change="initTable" style="width:100px;margin-right:10px;vertical-align:bottom;">
         <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value">
         </el-option>
@@ -128,13 +129,15 @@ export default {
       mess: {},
       id: 0,
       EquipmentList: [],
-      firmId: "" //品牌型号所需字段
+      firmId: "", //品牌型号所需字段
+      queryParam: {}, //返回到指定位置
     };
   },
   computed: {
     ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   created() {
+    this.queryParam = this.$route.query;
     this.deviceId = this.$route.query.deviceId;
     this.getTypes();
   },
@@ -229,7 +232,7 @@ export default {
         columns: this.formatHeaderType(this.tableHeader),
         rowHeights: 30,
         maxRows: this.tableData.length,
-        contextMenu: this.onlyRead ? false :{
+        contextMenu: this.onlyRead ? false : {
           items: {
             remove_row: {
               name: "删除部件"
@@ -486,7 +489,7 @@ export default {
                         item,
                         head.Path,
                         // child.error ? "表号功能号格式错误" : "表号功能号不存在"
-                        child.error ? child.value? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
+                        child.error ? child.value ? "表号功能号格式错误" : "表号功能号不存在" : "暂未采集到实时数据"
                       );
                     }
                   });
@@ -498,6 +501,18 @@ export default {
           this.tableExample.loadData(this.tableData);
         });
       }
+    },
+    // 返回
+    goback() {
+      this.$router.push({
+        name: 'facilityLedger',
+        params: {
+          deviceId: this.queryParam.typeId,
+          pageNo: this.queryParam.pageNo,
+          pageSize: this.queryParam.pageSize,
+          readOnly: true
+        }
+      })
     }
   }
 };

+ 4 - 2
src/views/ledger/facility/partsmanage/addparts/index.vue

@@ -137,7 +137,7 @@ export default {
     ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   created() {
-    this.category = this.$route.params;
+    this.category = this.$route.query;
     this.category.ParentId = this.category.Code.substr(0, 4);
     this.getBelongs();
     this.getTableHeader();
@@ -224,7 +224,9 @@ export default {
               path: "/ledger/partsmanage",
               query: {
                 deviceId: this.category.deviceId,
-                typeId: this.category.ParentId
+                typeId: this.category.ParentId,
+                pageNo: this.category.pageNo,
+                pageSize: this.category.pageSize
               }
             });
           }

+ 22 - 3
src/views/ledger/facility/partsmanage/index.vue

@@ -10,6 +10,7 @@
         <span>隐藏自动填充的信息</span>
         <el-checkbox v-model="allMess" @change="getTableHeader"></el-checkbox>
       </div> -->
+      <el-button size="small" type="default" icon="el-icon-back" @click="goback" style="margin-right:10px;"></el-button>
       <el-select v-model="showType" @change="initTable" style="width:100px;margin-right:10px;vertical-align:bottom;">
         <el-option v-for="item in showTypes" :key="item.value" :label="item.label" :value="item.value">
         </el-option>
@@ -153,13 +154,15 @@ export default {
       id: 0,
       EquipmentList: [],
       firmId: "", //品牌型号所需字段--族id三位编码(传设备类id或部件类id)
-      deviceType: {}
+      deviceType: {},
+      queryParam: {}, //返回到指定位置
     };
   },
   computed: {
     ...mapGetters("layout", ["projectId", "secret", "userId"])
   },
   created() {
+    this.queryParam = this.$route.query;
     this.deviceId = this.$route.query.deviceId; //设备id
     this.typeId = this.$route.query.typeId; //设备类id
     this.mess.deviceId = this.typeId;
@@ -300,7 +303,11 @@ export default {
       this.activeTab.deviceId = this.deviceId;
       this.$router.push({
         name: "partsadd",
-        params: this.activeTab
+        query: {
+          ...this.activeTab,
+          pageNo: this.queryParam.pageNo,
+          pageSize: this.queryParam.pageSize
+        }
       });
     },
     // 删除表格行
@@ -406,7 +413,7 @@ export default {
         columns: this.formatHeaderType(this.tableHeader),
         rowHeights: 30,
         maxRows: this.tableData.length,
-        contextMenu: this.onlyRead ? false :{
+        contextMenu: this.onlyRead ? false : {
           items: {
             remove_row: {
               name: "删除部件"
@@ -732,6 +739,18 @@ export default {
         })
       }
     },
+    // 返回
+    goback() {
+      this.$router.push({
+        name: 'facilityLedger',
+        params: {
+          deviceId: this.queryParam.typeId,
+          pageNo: this.queryParam.pageNo,
+          pageSize: this.queryParam.pageSize,
+          readOnly: false
+        }
+      })
+    }
   }
 };
 </script>