¡improve save settigs

This commit is contained in:
Rodrigo Quelca
2021-07-28 15:18:49 +00:00
parent 5bf1c139be
commit d9efa8d1c0
2 changed files with 20 additions and 6 deletions

View File

@@ -117,6 +117,7 @@ export default {
parseInt(window.config.FORMATS.casesListRefreshTime) * 1000 parseInt(window.config.FORMATS.casesListRefreshTime) * 1000
); );
}, },
methods: { methods: {
/** /**
* Listener for iframes childs * Listener for iframes childs
@@ -199,12 +200,13 @@ export default {
this.config.setting[this.page] = {}; this.config.setting[this.page] = {};
} }
this.config.setting[this.page][prop] = data; this.config.setting[this.page][prop] = data;
console.log(this.config);
api.config api.config
.put(this.config) .put(this.config)
.then((response) => { .then((response) => {
if (response.data) { if (response.data) {
// this.settings = response.data; // this.settings = response.data;
console.log("Udated") console.log("Updated")
console.log(this.config); console.log(this.config);
} }
}) })

View File

@@ -24,6 +24,7 @@
:columns="columns" :columns="columns"
:options="options" :options="options"
ref="vueTable" ref="vueTable"
name="mycases"
@row-click="onRowClick" @row-click="onRowClick"
:key="random" :key="random"
> >
@@ -74,6 +75,8 @@ import GroupedCell from "../../components/vuetable/GroupedCell.vue";
import api from "../../api/index"; import api from "../../api/index";
import utils from "../../utils/utils"; import utils from "../../utils/utils";
import defaultMixins from "./defaultMixins"; import defaultMixins from "./defaultMixins";
import { Event } from 'vue-tables-2';
export default { export default {
name: "MyCases", name: "MyCases",
@@ -187,6 +190,7 @@ export default {
}; };
}, },
mounted() { mounted() {
let that = this;
this.getHeaders(); this.getHeaders();
this.openDefaultCase(); this.openDefaultCase();
// force to open start cases modal // force to open start cases modal
@@ -194,8 +198,19 @@ export default {
if (window.config._nodeId === "CASES_START_CASE") { if (window.config._nodeId === "CASES_START_CASE") {
this.$refs["newRequest"].show(); this.$refs["newRequest"].show();
} }
// define sort event
Event.$on('vue-tables.mycases.sorted', function (data) {
that.$emit("updateUserSettings", "orderBy", data);
});
},
watch: {
columns: function (val) {
this.$emit("updateUserSettings", "columns", val);
},
filters: function (val) {
this.$emit("updateUserSettings", "filters", val);
},
}, },
watch: {},
computed: { computed: {
/** /**
* Build our ProcessMaker apiClient * Build our ProcessMaker apiClient
@@ -331,10 +346,6 @@ export default {
sort = that.prepareSortString(data); sort = that.prepareSortString(data);
if (sort) { if (sort) {
filters["sort"] = sort; filters["sort"] = sort;
that.$emit("updateUserSettings", "orderBy", {
column: data.orderBy,
ascending: data.ascending === 1 ? true: false
});
} }
return new Promise((resolutionFunc, rejectionFunc) => { return new Promise((resolutionFunc, rejectionFunc) => {
api.cases api.cases
@@ -584,6 +595,7 @@ export default {
}, },
onUpdateFilters(data) { onUpdateFilters(data) {
this.$emit("onUpdateFilters", data.params); this.$emit("onUpdateFilters", data.params);
if (data.refresh) { if (data.refresh) {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["vueTable"].getData(); this.$refs["vueTable"].getData();