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); window.$gz.form.addNoSelectionItem(vm.searchResults, true);
} else { } else {
//Not here, better get it //Not here, better get it
let variantSegment = ""; let pickListParams = {
ayaType: vm.ayaType,
preselectedIds: [vm.value]
};
if (vm.variant != null) { if (vm.variant != null) {
variantSegment = `&variant=${vm.variant}`; pickListParams["listVariant"] = vm.variant;
//variantSegment = `&variant=${vm.variant}`;
} }
let urlParams = // let pickListParams =
"?ayaType=" + vm.ayaType + "&preId=" + vm.value + variantSegment; // "?ayaType=" + vm.ayaType + "&preId=" + vm.value + variantSegment;
/*
[FromBody]
public AyaType AyaType { get; set; }
[FromBody] vm.getList(pickListParams);
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);
} }
}, },
replaceLastSelection() { 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; let vm = this;
if (vm.fetching) { if (vm.fetching) {
return; return;
} }
vm.fetching = true; vm.fetching = true;
//default params for when called on init //default params for when called on init
if (!urlParams) { if (!pickListParams) {
urlParams = "?ayaType=" + vm.ayaType; pickListParams = {
ayaType: vm.ayaType,
preselectedIds: [vm.value]
};
// urlParams = "?ayaType=" + vm.ayaType;
if (vm.includeInactive) { if (vm.includeInactive) {
urlParams += "&inactive=true"; pickListParams["inactive"] = true;
//urlParams += "&inactive=true";
} }
if (vm.variant != null) { if (vm.variant != null) {
urlParams += `&variant=${vm.variant}`; pickListParams["listVariant"] = vm.variant;
//urlParams += `&variant=${vm.variant}`;
} }
} }
try { 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; vm.fetching = false;
//We never expect there to be no data here //We never expect there to be no data here
@@ -391,14 +394,16 @@ export default {
} }
} }
//build url //build parameter
let urlParams = "?ayaType=" + vm.ayaType; let pickListParams = { ayaType: vm.ayaType };
//let urlParams = "?ayaType=" + vm.ayaType;
if (!emptyQuery) { if (!emptyQuery) {
let query = queryTerms[0]; let query = queryTerms[0];
if (queryTerms[1] != "[?]") { if (queryTerms[1] != "[?]") {
query += " " + queryTerms[1]; query += " " + queryTerms[1];
} }
urlParams += "&query=" + query; //urlParams += "&query=" + query;
pickListParams["query"]=query;
} }
if (vm.includeInactive) { if (vm.includeInactive) {