This commit is contained in:
2021-01-13 18:07:05 +00:00
parent 68a786b9fe
commit 03f1383206

View File

@@ -197,34 +197,19 @@ export default {
window.$gz.form.addNoSelectionItem(vm.searchResults, true);
} else {
//Not here, better get it
let variantSegment = "";
let pickListParams = {
ayaType: vm.ayaType,
preselectedIds: [vm.value]
};
if (vm.variant != null) {
variantSegment = `&variant=${vm.variant}`;
pickListParams["listVariant"] = vm.variant;
//variantSegment = `&variant=${vm.variant}`;
}
let urlParams =
"?ayaType=" + vm.ayaType + "&preId=" + vm.value + variantSegment;
/*
[FromBody]
public AyaType AyaType { get; set; }
// let pickListParams =
// "?ayaType=" + vm.ayaType + "&preId=" + vm.value + variantSegment;
[FromBody]
public string Query { get; set; }
[FromBody]
public bool Inactive { get; set; }
[FromBody]
public List<long> PreselectedIds { get; set; }
[FromBody]
public string ListVariant { get; set; }
//"{\"ayaType\":8,\"preselectedIds\":[1,3,5,7]}"
}
*/
vm.getList(urlParams);
vm.getList(pickListParams);
}
},
replaceLastSelection() {
@@ -286,24 +271,42 @@ export default {
// }
// }
},
getList: async function(urlParams) {
getList: async function(pickListParams) {
/*
public AyaType AyaType { get; set; }
public string Query { get; set; }
public bool Inactive { get; set; }
public List<long> PreselectedIds { get; set; }
public string ListVariant { get; set; }
//"{\"ayaType\":8,\"preselectedIds\":[1,3,5,7]}"
}
*/
let vm = this;
if (vm.fetching) {
return;
}
vm.fetching = true;
//default params for when called on init
if (!urlParams) {
urlParams = "?ayaType=" + vm.ayaType;
if (!pickListParams) {
pickListParams = {
ayaType: vm.ayaType,
preselectedIds: [vm.value]
};
// urlParams = "?ayaType=" + vm.ayaType;
if (vm.includeInactive) {
urlParams += "&inactive=true";
pickListParams["inactive"] = true;
//urlParams += "&inactive=true";
}
if (vm.variant != null) {
urlParams += `&variant=${vm.variant}`;
pickListParams["listVariant"] = vm.variant;
//urlParams += `&variant=${vm.variant}`;
}
}
try {
let res = await window.$gz.api.get("pick-list/list" + urlParams);
let res = await window.$gz.api.upsert("pick-list/list", pickListParams);
// let res = await window.$gz.api.get("pick-list/list" + urlParams);
vm.fetching = false;
//We never expect there to be no data here
@@ -391,14 +394,16 @@ export default {
}
}
//build url
let urlParams = "?ayaType=" + vm.ayaType;
//build parameter
let pickListParams = { ayaType: vm.ayaType };
//let urlParams = "?ayaType=" + vm.ayaType;
if (!emptyQuery) {
let query = queryTerms[0];
if (queryTerms[1] != "[?]") {
query += " " + queryTerms[1];
}
urlParams += "&query=" + query;
//urlParams += "&query=" + query;
pickListParams["query"]=query;
}
if (vm.includeInactive) {