This commit is contained in:
@@ -429,10 +429,7 @@ export default {
|
||||
this.selected.splice(0, this.selected.length - 1);
|
||||
}
|
||||
//emit event to parent form of selected rows
|
||||
//this.$emit("update:selected", this.selected);
|
||||
//Note vm this bubbles up all the columns of all the selected rows
|
||||
console.log("gzdatatable:handleSelectChange emitting ", this.selected);
|
||||
|
||||
//so, to be more efficient for now will just send the ID's until I see a need for other shit
|
||||
this.$emit("selection-change", window.$gz._.map(this.selected, "id"));
|
||||
},
|
||||
|
||||
@@ -1,25 +1,55 @@
|
||||
<template>
|
||||
<div>
|
||||
<gz-data-table
|
||||
v-if="!jobActive"
|
||||
formKey="adm-attachments"
|
||||
:dataListKey="dataListKey"
|
||||
:dataListFilter="dataListFilter"
|
||||
:dataListSort="dataListSort"
|
||||
:showSelect="true"
|
||||
:singleSelect="false"
|
||||
:reload="reload"
|
||||
v-on:selection-change="handleSelected"
|
||||
>
|
||||
</gz-data-table>
|
||||
<v-row>
|
||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||
<v-col cols="12">
|
||||
<gz-data-table
|
||||
v-if="!jobActive"
|
||||
formKey="adm-attachments"
|
||||
:dataListKey="dataListKey"
|
||||
:dataListFilter="dataListFilter"
|
||||
:dataListSort="dataListSort"
|
||||
:showSelect="true"
|
||||
:singleSelect="false"
|
||||
:reload="reload"
|
||||
v-on:selection-change="handleSelected"
|
||||
>
|
||||
</gz-data-table>
|
||||
|
||||
<template v-if="jobActive">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
:size="60"
|
||||
></v-progress-circular>
|
||||
</template>
|
||||
<template v-if="jobActive">
|
||||
<v-progress-circular
|
||||
indeterminate
|
||||
color="primary"
|
||||
:size="60"
|
||||
></v-progress-circular>
|
||||
</template>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row justify="center">
|
||||
<v-dialog v-model="moveDialog" persistent max-width="600px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span class="headline">{{ $ay.t("MoveSelected") }}</span>
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-container>
|
||||
<v-row>
|
||||
aytype selector ayid selector
|
||||
</v-row>
|
||||
</v-container>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="blue darken-1" text @click="moveDialog = false">{{
|
||||
$ay.t("Cancel")
|
||||
}}</v-btn>
|
||||
<v-btn color="blue darken-1" text @click="moveSelected()">{{
|
||||
$ay.t("OK")
|
||||
}}</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -31,6 +61,7 @@ export default {
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
//await fetchTranslatedText(this);
|
||||
generateMenu(this);
|
||||
this.handleSelected([]); //start out read only no selection state for bulk ops options
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||
@@ -39,12 +70,23 @@ export default {
|
||||
return {
|
||||
jobActive: false,
|
||||
reload: false,
|
||||
moveDialog: false,
|
||||
selectedItems: [],
|
||||
currentListViewId: 1,
|
||||
dataListKey: "AttachmentDataList",
|
||||
dataListFilter: "",
|
||||
dataListSort: "",
|
||||
rights: window.$gz.role.defaultRightsObject()
|
||||
rights: window.$gz.role.defaultRightsObject(),
|
||||
formState: {
|
||||
ready: true,
|
||||
dirty: false,
|
||||
valid: true,
|
||||
readOnly: false,
|
||||
loading: false,
|
||||
errorBoxMessage: null,
|
||||
appError: null,
|
||||
serverError: {}
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@@ -59,11 +101,48 @@ export default {
|
||||
this.selectedItems = selected;
|
||||
|
||||
if (this.canBulkOp()) {
|
||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":duplicate");
|
||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":new");
|
||||
window.$gz.eventBus.$emit(
|
||||
"menu-enable-item",
|
||||
FORM_KEY + ":DELETE_SELECTED"
|
||||
);
|
||||
window.$gz.eventBus.$emit(
|
||||
"menu-enable-item",
|
||||
FORM_KEY + ":MOVE_SELECTED"
|
||||
);
|
||||
} else {
|
||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":duplicate");
|
||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":new");
|
||||
window.$gz.eventBus.$emit(
|
||||
"menu-disable-item",
|
||||
FORM_KEY + ":DELETE_SELECTED"
|
||||
);
|
||||
window.$gz.eventBus.$emit(
|
||||
"menu-disable-item",
|
||||
FORM_KEY + ":MOVE_SELECTED"
|
||||
);
|
||||
}
|
||||
},
|
||||
async moveSelected(ayType, ayId) {
|
||||
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
|
||||
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
let res = await window.$gz.api.remove(url);
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
}
|
||||
this.reload = !this.reload;
|
||||
} catch (ex) {
|
||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||
}
|
||||
},
|
||||
async deleteSelected() {
|
||||
@@ -74,14 +153,16 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
let url = API_BASE_URL + vm.$route.params.recordid;
|
||||
|
||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||
let res = await window.$gz.api.remove(url);
|
||||
let res = await window.$gz.api.upsert(
|
||||
"attachment/bulk-delete",
|
||||
this.selectedItems
|
||||
);
|
||||
if (res.error) {
|
||||
vm.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
}
|
||||
this.reload = !this.reload;
|
||||
} catch (ex) {
|
||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||
}
|
||||
@@ -165,7 +246,8 @@ function clickHandler(menuItem) {
|
||||
m.vm.startMaintenanceJob();
|
||||
break;
|
||||
case "MOVE_SELECTED":
|
||||
m.vm.moveSelected();
|
||||
m.vm.moveDialog = true;
|
||||
|
||||
break;
|
||||
case "DELETE_SELECTED":
|
||||
m.vm.deleteSelected();
|
||||
|
||||
Reference in New Issue
Block a user