PMCORE-2685: PMFCaseLink url generated is not opening the case

fix removed code
This commit is contained in:
Rodrigo Quelca
2021-01-18 16:42:15 +00:00
parent 64168cb7cc
commit 5e137b82a2
4 changed files with 106 additions and 5 deletions

View File

@@ -49,6 +49,7 @@ import ModalNewRequest from "./ModalNewRequest.vue";
import CasesFilter from "../components/search/CasesFilter";
import TaskCell from "../components/vuetable/TaskCell.vue";
import api from "./../api/index";
import utils from "./../utils/utils";
export default {
name: "Draft",
@@ -59,7 +60,7 @@ export default {
TaskCell,
CasesFilter,
},
props: {},
props: ["defaultOption"],
data() {
return {
newCase: {
@@ -106,7 +107,9 @@ export default {
singleClickTimer: null
};
},
mounted() {},
mounted() {
this.openDefaultCase();
},
watch: {},
computed: {
/**
@@ -119,6 +122,22 @@ export default {
updated() {},
beforeCreate() {},
methods: {
/**
* Open a case when the component was mounted
*/
openDefaultCase() {
let params;
if(this.defaultOption) {
params = utils.getAllUrlParams(this.defaultOption);
console.log(params);
if (params && params.app_uid && params.del_index) {
this.openCase({
APP_UID: params.app_uid,
DEL_INDEX: params.del_index
});
}
}
},
/**
* On row click event handler
* @param {object} event

View File

@@ -24,6 +24,7 @@
:id="pageId"
:pageUri="pageUri"
:name="pageName"
:defaultOption="defaultOption"
@onSubmitFilter="onSubmitFilter"
@onRemoveFilter="onRemoveFilter"
@onUpdatePage="onUpdatePage"
@@ -93,7 +94,8 @@ export default {
CONSOLIDATED_CASES: "batch-routing",
CASES_TO_REASSIGN: "task-reassignments",
CASES_FOLDERS: "my-documents"
}
},
defaultOption: window.config.defaultOption || ''
};
},
mounted() {

View File

@@ -70,6 +70,7 @@ export default {
TaskCell,
CasesFilter,
},
props: ["defaultOption"],
data() {
return {
newCase: {
@@ -136,6 +137,22 @@ export default {
updated() {},
beforeCreate() {},
methods: {
/**
* Open a case when the component was mounted
*/
openDefaultCase() {
let params;
if(this.defaultOption) {
params = utils.getAllUrlParams(this.defaultOption);
console.log(params);
if (params && params.app_uid && params.del_index) {
this.openCase({
APP_UID: params.app_uid,
DEL_INDEX: params.del_index
});
}
}
},
/**
* On row click event handler
* @param {object} event

View File

@@ -13,11 +13,74 @@ export default {
format: '(@lastName, @firstName) @userName'
};
_.assignIn(defaultValues, params);
console.log(defaultValues);
aux = defaultValues.format;
aux = aux.replace('@userName',defaultValues.userName);
aux = aux.replace('@firstName',defaultValues.firstName);
aux = aux.replace('@lastName',defaultValues.lastName);
return aux;
}
},
getAllUrlParams(url) {
// get query string from url (optional) or window
var queryString = url ? url.split('?')[1] : window.location.search.slice(1);
// we'll store the parameters here
var obj = {};
// if query string exists
if (queryString) {
// stuff after # is not part of query string, so get rid of it
queryString = queryString.split('#')[0];
// split our query string into its component parts
var arr = queryString.split('&');
for (var i = 0; i < arr.length; i++) {
// separate the keys and the values
var a = arr[i].split('=');
// set parameter name and value (use 'true' if empty)
var paramName = a[0];
var paramValue = typeof (a[1]) === 'undefined' ? true : a[1];
// (optional) keep case consistent
paramName = paramName.toLowerCase();
if (typeof paramValue === 'string') paramValue = paramValue.toLowerCase();
// if the paramName ends with square brackets, e.g. colors[] or colors[2]
if (paramName.match(/\[(\d+)?\]$/)) {
// create key if it doesn't exist
var key = paramName.replace(/\[(\d+)?\]/, '');
if (!obj[key]) obj[key] = [];
// if it's an indexed array e.g. colors[2]
if (paramName.match(/\[\d+\]$/)) {
// get the index value and add the entry at the appropriate position
var index = /\[(\d+)\]/.exec(paramName)[1];
obj[key][index] = paramValue;
} else {
// otherwise add the value to the end of the array
obj[key].push(paramValue);
}
} else {
// we're dealing with a string
if (!obj[paramName]) {
// if it doesn't exist, create property
obj[paramName] = paramValue;
} else if (obj[paramName] && typeof obj[paramName] === 'string'){
// if property does exist and it's a string, convert it to an array
obj[paramName] = [obj[paramName]];
obj[paramName].push(paramValue);
} else {
// otherwise add the property
obj[paramName].push(paramValue);
}
}
}
}
return obj;
}
}