table 添加请求缓存设置

This commit is contained in:
小陌 2024-01-09 14:42:39 +08:00
parent 5ee7e6cde5
commit 2389ee0cef
5 changed files with 39 additions and 17 deletions

View File

@ -64,7 +64,11 @@ export default {
methods: {
handleSearchUpdated(newSearch) {
this.statloading = true;
this.$http.get(this.config.remoteurl || 'stat/admin/get', newSearch, { cache: this.config.cache ? true : false }).then((res) => {
var options = {
cache: this.config.cache || true,
cacheparameters: this.config.cacheparameters || false
};
this.$http.get(this.config.remoteurl || 'stat/admin/get', newSearch, options).then((res) => {
this.statloading = false;
if (res.code == 200) {
Object.assign(this.data, res.data);
@ -117,7 +121,13 @@ export default {
if (typeof this.search.date == 'undefined') {
this.search.date = this.getMonthDates();
}
this.$http.get(this.config.remoteurl || 'stat/admin/get', this.search, { cache: this.config.cache ? true : false }).then((res) => {
var options = {
cache: this.config.cache || true,
cacheparameters: this.config.cacheparameters || false
};
this.$http.get(this.config.remoteurl || 'stat/admin/get', this.search, options).then((res) => {
this.loading = false;
if (res.code == 200) {
//

View File

@ -269,10 +269,7 @@ export default {
delete reqData[config.request.page]
delete reqData[config.request.pageSize]
}
Object.assign(reqData, this.tableParams)
if (scrollto === true) {
this.loading = true;
let detailsArea = document.querySelector(".el-main");

View File

@ -121,7 +121,11 @@ export default {
this.column = data.column || 'column';
},
getType() {
this.$http.get('log/admin/types', { type: this.$route.query.type }, { cacheparameters: true }).then((res) => {
var options = {
cache: this.$route.meta.cache || true,
cacheparameters: this.$route.meta.cacheparameters || false
};
this.$http.get('log/admin/types', { type: this.$route.query.type }, options).then((res) => {
if (res.code == 200) {
Object.assign(this.$data, res.data);
// search
@ -138,7 +142,6 @@ export default {
if (!this.api) {
this.api = 'log/admin/lists'
}
this.$refs.table.reload(this.search)
let url = window.location.href;
for (const [key, value] of Object.entries(this.search)) {
@ -167,13 +170,15 @@ export default {
;
overflow: hidden;
}
.el-header{
height:50px
.el-header {
height: 50px
}
.el-aside {
background-color: white;
}
.x-page-header {
border-bottom: 0px solid #ebebebc2;
padding: 5px;

View File

@ -84,7 +84,12 @@ export default {
//
if (this.tablename || this.tableurl) {
var awaitvar = this.tableurl ? this.$http.get(this.tableurl, {}, { cache: true }) : this.$api.system.table.get(this.tablename, { cache: this.$route.meta.tablecache || 0 });
var options = {
cache: this.$route.meta.cache || true,
cacheparameters: this.$route.meta.cacheparameters || false
};
var awaitvar = this.tableurl ? this.$http.get(this.tableurl, {}, options) : this.$api.system.table.get(this.tablename, options);
awaitvar.then((res) => {
if (res.code == 200) {
Object.assign(this.$data, res.data);

View File

@ -96,7 +96,12 @@ export default {
//
if (this.tablename || this.tableurl) {
var awaitvar = this.tableurl ? this.$http.get(this.tableurl, {}, { cache: true }) : this.$api.system.table.get(this.tablename, { cache: this.$route.meta.tablecache || 0 });
var options = {
cache: this.$route.meta.cache || true,
cacheparameters: this.$route.meta.cacheparameters || false
};
var awaitvar = this.tableurl ? this.$http.get(this.tableurl, {}, options) : this.$api.system.table.get(this.tablename, options);
awaitvar.then((res) => {
if (res.code == 200) {
Object.assign(this.$data, res.data);