This commit is contained in:
@@ -429,10 +429,7 @@ export default {
|
|||||||
this.selected.splice(0, this.selected.length - 1);
|
this.selected.splice(0, this.selected.length - 1);
|
||||||
}
|
}
|
||||||
//emit event to parent form of selected rows
|
//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
|
//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
|
//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"));
|
this.$emit("selection-change", window.$gz._.map(this.selected, "id"));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,25 +1,55 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<gz-data-table
|
<v-row>
|
||||||
v-if="!jobActive"
|
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||||
formKey="adm-attachments"
|
<v-col cols="12">
|
||||||
:dataListKey="dataListKey"
|
<gz-data-table
|
||||||
:dataListFilter="dataListFilter"
|
v-if="!jobActive"
|
||||||
:dataListSort="dataListSort"
|
formKey="adm-attachments"
|
||||||
:showSelect="true"
|
:dataListKey="dataListKey"
|
||||||
:singleSelect="false"
|
:dataListFilter="dataListFilter"
|
||||||
:reload="reload"
|
:dataListSort="dataListSort"
|
||||||
v-on:selection-change="handleSelected"
|
:showSelect="true"
|
||||||
>
|
:singleSelect="false"
|
||||||
</gz-data-table>
|
:reload="reload"
|
||||||
|
v-on:selection-change="handleSelected"
|
||||||
|
>
|
||||||
|
</gz-data-table>
|
||||||
|
|
||||||
<template v-if="jobActive">
|
<template v-if="jobActive">
|
||||||
<v-progress-circular
|
<v-progress-circular
|
||||||
indeterminate
|
indeterminate
|
||||||
color="primary"
|
color="primary"
|
||||||
:size="60"
|
:size="60"
|
||||||
></v-progress-circular>
|
></v-progress-circular>
|
||||||
</template>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -31,6 +61,7 @@ export default {
|
|||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||||
//await fetchTranslatedText(this);
|
//await fetchTranslatedText(this);
|
||||||
generateMenu(this);
|
generateMenu(this);
|
||||||
|
this.handleSelected([]); //start out read only no selection state for bulk ops options
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||||
@@ -39,12 +70,23 @@ export default {
|
|||||||
return {
|
return {
|
||||||
jobActive: false,
|
jobActive: false,
|
||||||
reload: false,
|
reload: false,
|
||||||
|
moveDialog: false,
|
||||||
selectedItems: [],
|
selectedItems: [],
|
||||||
currentListViewId: 1,
|
currentListViewId: 1,
|
||||||
dataListKey: "AttachmentDataList",
|
dataListKey: "AttachmentDataList",
|
||||||
dataListFilter: "",
|
dataListFilter: "",
|
||||||
dataListSort: "",
|
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: {
|
methods: {
|
||||||
@@ -59,11 +101,48 @@ export default {
|
|||||||
this.selectedItems = selected;
|
this.selectedItems = selected;
|
||||||
|
|
||||||
if (this.canBulkOp()) {
|
if (this.canBulkOp()) {
|
||||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":duplicate");
|
window.$gz.eventBus.$emit(
|
||||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":new");
|
"menu-enable-item",
|
||||||
|
FORM_KEY + ":DELETE_SELECTED"
|
||||||
|
);
|
||||||
|
window.$gz.eventBus.$emit(
|
||||||
|
"menu-enable-item",
|
||||||
|
FORM_KEY + ":MOVE_SELECTED"
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":duplicate");
|
window.$gz.eventBus.$emit(
|
||||||
window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":new");
|
"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() {
|
async deleteSelected() {
|
||||||
@@ -74,14 +153,16 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = API_BASE_URL + vm.$route.params.recordid;
|
|
||||||
|
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
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) {
|
if (res.error) {
|
||||||
vm.formState.serverError = res.error;
|
vm.formState.serverError = res.error;
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
}
|
}
|
||||||
|
this.reload = !this.reload;
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
window.$gz.errorHandler.handleFormError(ex, vm);
|
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||||
}
|
}
|
||||||
@@ -165,7 +246,8 @@ function clickHandler(menuItem) {
|
|||||||
m.vm.startMaintenanceJob();
|
m.vm.startMaintenanceJob();
|
||||||
break;
|
break;
|
||||||
case "MOVE_SELECTED":
|
case "MOVE_SELECTED":
|
||||||
m.vm.moveSelected();
|
m.vm.moveDialog = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "DELETE_SELECTED":
|
case "DELETE_SELECTED":
|
||||||
m.vm.deleteSelected();
|
m.vm.deleteSelected();
|
||||||
|
|||||||
Reference in New Issue
Block a user