|
@@ -52,6 +52,12 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
export default {
|
|
|
+ beforeRouteLeave(to, from, next) {
|
|
|
+ if(to.name!='HotelDataOperation'){
|
|
|
+ localStorage.removeItem('jdzlval');
|
|
|
+ }
|
|
|
+ next()
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
@@ -105,6 +111,25 @@ export default {
|
|
|
that.currentPage = that.currentPage - 1;
|
|
|
}
|
|
|
}
|
|
|
+ if(JSON.parse(localStorage.getItem('jdzlval'))){
|
|
|
+ that.currentPage=JSON.parse(localStorage.getItem('jdzlval')).currentPage;
|
|
|
+ that.input=JSON.parse(localStorage.getItem('jdzlval')).input;
|
|
|
+ var newarr = [];
|
|
|
+ if (that.input == "") {
|
|
|
+ newarr = that.tableData;
|
|
|
+ } else {
|
|
|
+ for (var i = 0; i < that.tableData.length; i++) {
|
|
|
+ if (that.tableData[i].city.indexOf(that.input) != -1) {
|
|
|
+ newarr.push(that.tableData[i]);
|
|
|
+ } else if (that.tableData[i].name.indexOf(that.input) != -1) {
|
|
|
+ newarr.push(that.tableData[i]);
|
|
|
+ } else if (that.tableData[i].contact.indexOf(that.input) != -1) {
|
|
|
+ newarr.push(that.tableData[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ that.tableDatas = newarr;
|
|
|
+ }
|
|
|
}
|
|
|
that.loading = false
|
|
|
}).catch(function (error) {
|
|
@@ -135,6 +160,11 @@ export default {
|
|
|
},
|
|
|
|
|
|
upDate(index, row) {
|
|
|
+ var jdzlval={
|
|
|
+ currentPage:this.currentPage,
|
|
|
+ input:this.input,
|
|
|
+ }
|
|
|
+ localStorage.setItem('jdzlval', JSON.stringify(jdzlval));
|
|
|
this.$router.push({
|
|
|
path: "/home/HotelDataOperation",
|
|
|
query: { id: row.id }
|
|
@@ -175,10 +205,37 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ created(){
|
|
|
+ // if(JSON.parse(localStorage.getItem('jdzlval'))){
|
|
|
+ // this.currentPage=JSON.parse(localStorage.getItem('jdzlval')).currentPage;
|
|
|
+ // this.input=JSON.parse(localStorage.getItem('jdzlval')).input;
|
|
|
+ // var newarr = [];
|
|
|
+ // console.log(this.input);
|
|
|
+ // if (this.input == "") {
|
|
|
+ // console.log(1);
|
|
|
+ // newarr = this.tableData;
|
|
|
+ // } else {
|
|
|
+ // console.log(2);
|
|
|
+
|
|
|
+ // for (var i = 0; i < this.tableData.length; i++) {
|
|
|
+ // if (this.tableData[i].city.indexOf(this.input) != -1) {
|
|
|
+ // newarr.push(this.tableData[i]);
|
|
|
+ // } else if (this.tableData[i].name.indexOf(this.input) != -1) {
|
|
|
+ // newarr.push(this.tableData[i]);
|
|
|
+ // } else if (this.tableData[i].contact.indexOf(this.input) != -1) {
|
|
|
+ // newarr.push(this.tableData[i]);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+
|
|
|
+ // this.tableDatas = newarr;
|
|
|
+ // }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.token = JSON.parse(localStorage.getItem('userinif')).token;
|
|
|
this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
|
|
|
this.HotelData();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
</script>
|