This commit is contained in:
2020-06-30 20:48:26 +00:00
parent 0c3d85271e
commit 3e91727b76
2 changed files with 55 additions and 13 deletions

View File

@@ -81,6 +81,15 @@ export default {
label: { type: String, default: "" }
},
watch: {
ayaType(val,oldVal){
if(val!=oldVal && oldVal!=null){
//change of type so clear out the list
this.searchResults=[];
this.searchEntry=null;
this.lastSelection=null;
this.initialized=false;
}
},
value(val) {
this.fetchValueIfNotPresent();
},

View File

@@ -34,7 +34,25 @@
<v-card-text>
<v-container>
<v-row>
aytype selector ayid selector
<v-col cols="12">
<v-select
v-model="moveType"
:items="selectLists.objectTypes"
item-text="name"
item-value="id"
:label="$ay.t('AyaType')"
></v-select>
</v-col>
<v-col cols="12" v-if="moveType != 0">
<gz-pick-list
:ayaType="moveType"
:showEditIcon="false"
:includeInactive="true"
v-model="moveId"
label="Id"
></gz-pick-list>
</v-col>
</v-row>
</v-container>
</v-card-text>
@@ -59,7 +77,8 @@ export default {
async created() {
this.rights = window.$gz.role.getRights(window.$gz.type.FileAttachment);
window.$gz.eventBus.$on("menu-click", clickHandler);
//await fetchTranslatedText(this);
await fetchTranslatedText(this);
await populateSelectionLists(this);
generateMenu(this);
this.handleSelected([]); //start out read only no selection state for bulk ops options
},
@@ -70,13 +89,18 @@ export default {
return {
jobActive: false,
reload: false,
moveDialog: false,
moveDialog: true,
moveType: null,
moveId: null,
selectedItems: [],
currentListViewId: 1,
dataListKey: "AttachmentDataList",
dataListFilter: "",
dataListSort: "",
rights: window.$gz.role.defaultRightsObject(),
selectLists: {
objectTypes: []
},
formState: {
ready: true,
dirty: false,
@@ -124,18 +148,14 @@ export default {
let vm = this;
try {
//called from move dialog, already selected
vm.moveDialog=false;
let dialogResult = await window.$gz.dialog.confirmDelete();
if (dialogResult != true) {
return;
}
//TODO: Gather the ID and type here
vm.moveDialog = false;
window.$gz.form.deleteAllErrorBoxErrors(vm);
let res = await window.$gz.api.remove(url);
let res = await window.$gz.api.upsert("attachment/bulk-move", {
idList: this.selectedItems,
ayaType: this.moveType,
toId: this.moveId
});
if (res.error) {
vm.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(vm);
@@ -330,4 +350,17 @@ async function fetchTranslatedText(vm) {
"MoveSelected"
]);
}
//////////////////////
//
//
async function populateSelectionLists(vm) {
let res = await window.$gz.api.get("enum-list/list/Core");
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error, vm);
} else {
vm.selectLists.objectTypes = res.data;
window.$gz.form.addNoSelectionItem(vm.selectLists.objectTypes);
}
}
</script>