PMCORE-3268:Preview does not work in mode edit

Correction ellipsis

CR
This commit is contained in:
fabio
2021-09-01 16:14:42 -04:00
parent 31a38f2d32
commit 1a68f31362
5 changed files with 103 additions and 46 deletions

View File

@@ -58,6 +58,7 @@ export default {
if (response.statusText === "OK") { if (response.statusText === "OK") {
that.$refs["modal-delete-list"].hide(); that.$refs["modal-delete-list"].hide();
that.$parent.$refs["table"].getData(); that.$parent.$refs["table"].getData();
that.$parent.$refs['ellipsis-' + that.data.id].hideActionButtons();
} }
}); });
} }

View File

@@ -98,6 +98,14 @@ export default {
return this.$parent.$parent.$parent.$parent.getCasesForPreview(data) return this.$parent.$parent.$parent.$parent.getCasesForPreview(data)
}, },
}, },
customCaseId: '',
statusTitle: {
ON_TIME: this.$i18n.t("ID_IN_PROGRESS"),
OVERDUE: this.$i18n.t("ID_TASK_OVERDUE"),
DRAFT: this.$i18n.t("ID_IN_DRAFT"),
PAUSED: this.$i18n.t("ID_PAUSED"),
UNASSIGNED: this.$i18n.t("ID_UNASSIGNED"),
},
} }
}, },
mounted() { mounted() {
@@ -119,25 +127,19 @@ export default {
paged, paged,
limit = data.limit, limit = data.limit,
start = data.page === 1 ? 0 : limit * (data.page - 1), start = data.page === 1 ? 0 : limit * (data.page - 1),
filters = {}, filters = {};
sort = "";
paged = start + "," + limit; paged = start + "," + limit;
filters = { filters = {
paged: paged, paged: paged,
} }
_.forIn(this.filters, function (item, key) { if (this.customCaseId !== '') {
if(filters && item.value) { filters['id'] = this.customCaseId;
filters[item.filterVar] = item.value;
}
});
if (sort) {
filters["sort"] = sort;
} }
return new Promise((resolutionFunc, rejectionFunc) => { return new Promise((resolutionFunc, rejectionFunc) => {
switch (that.type) { switch (that.type) {
case 'inbox': case 'inbox':
api.cases api.cases
.todo(filters) .inbox(filters)
.then((response) => { .then((response) => {
dt = that.formatDataResponse(response.data.data); dt = that.formatDataResponse(response.data.data);
resolutionFunc({ resolutionFunc({
@@ -195,16 +197,21 @@ export default {
}); });
}, },
/** /**
* Format Response API to grid todo and columns * Format Response API custom case list to grid todo and columns
* @param {object} response
* @returns {object}
*/ */
formatDataResponse(response) { formatDataResponse(response) {
let data = []; let data = [];
_.forEach(response, (v) => { _.forEach(response, (v) => {
data.push({ data.push({
...v,
...{
CASE_NUMBER: v.APP_NUMBER, CASE_NUMBER: v.APP_NUMBER,
CASE_TITLE: v.DEL_TITLE, CASE_TITLE: v.DEL_TITLE,
PROCESS_NAME: v.PRO_TITLE, PROCESS_NAME: v.PRO_TITLE,
TASK: [{ TASK: [
{
TITLE: v.TAS_TITLE, TITLE: v.TAS_TITLE,
CODE_COLOR: v.TAS_COLOR, CODE_COLOR: v.TAS_COLOR,
COLOR: v.TAS_COLOR_LABEL, COLOR: v.TAS_COLOR_LABEL,
@@ -212,8 +219,10 @@ export default {
v.TAS_STATUS === "OVERDUE" v.TAS_STATUS === "OVERDUE"
? this.$i18n.t("ID_DELAYED") + ":" ? this.$i18n.t("ID_DELAYED") + ":"
: this.statusTitle[v.TAS_STATUS], : this.statusTitle[v.TAS_STATUS],
DELAYED_MSG: v.TAS_STATUS === "OVERDUE" ? v.DELAY : "", DELAYED_MSG:
}], v.TAS_STATUS === "OVERDUE" ? v.DELAY : "",
},
],
USER_DATA: this.formatUser(v.SEND_BY_INFO), USER_DATA: this.formatUser(v.SEND_BY_INFO),
USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({ USERNAME_DISPLAY_FORMAT: utils.userNameDisplayFormat({
userName: v.USR_LASTNAME, userName: v.USR_LASTNAME,
@@ -228,6 +237,7 @@ export default {
APP_UID: v.APP_UID, APP_UID: v.APP_UID,
PRO_UID: v.PRO_UID, PRO_UID: v.PRO_UID,
TAS_UID: v.TAS_UID, TAS_UID: v.TAS_UID,
}
}); });
}); });
return data; return data;

View File

@@ -1,5 +1,6 @@
<template> <template>
<div id="home"> <div id="home">
<ModalPreview ref="modal-preview"></ModalPreview>
<div class="demo"> <div class="demo">
<div class="container"> <div class="container">
<h5>{{ $t("ID_NEW_CASES_LISTS") }} ({{ module.title }})</h5> <h5>{{ $t("ID_NEW_CASES_LISTS") }} ({{ module.title }})</h5>
@@ -284,7 +285,7 @@
<b-button tvariant="danger" @click="onCancel">{{ <b-button tvariant="danger" @click="onCancel">{{
$t("ID_CANCEL") $t("ID_CANCEL")
}}</b-button> }}</b-button>
<b-button variant="outline-primary">{{ <b-button variant="outline-primary" @click="showPreview">{{
$t("ID_PREVIEW") $t("ID_PREVIEW")
}}</b-button> }}</b-button>
<b-button type="submit" variant="primary">{{ <b-button type="submit" variant="primary">{{
@@ -301,6 +302,7 @@ import utils from "../../../utils/utils";
import Multiselect from "vue-multiselect"; import Multiselect from "vue-multiselect";
import Api from "./Api/CaseList"; import Api from "./Api/CaseList";
import IconPicker from "../../../components/iconPicker/IconPicker.vue"; import IconPicker from "../../../components/iconPicker/IconPicker.vue";
import ModalPreview from "../../Modals/ModalPreview.vue";
export default { export default {
name: "CaseListSketh", name: "CaseListSketh",
@@ -308,6 +310,7 @@ export default {
Multiselect, Multiselect,
IconPicker, IconPicker,
IconPicker, IconPicker,
ModalPreview,
}, },
props: ["params", "module"], props: ["params", "module"],
data() { data() {
@@ -370,7 +373,8 @@ export default {
defaultCaseList: [], defaultCaseList: [],
isValidName: null, isValidName: null,
isValidTable: null, isValidTable: null,
pmTable: null pmTable: null,
isPreview: false
}; };
}, },
computed: { computed: {
@@ -603,6 +607,7 @@ export default {
* On submit event handler * On submit event handler
*/ */
onSubmit() { onSubmit() {
let that = this;
this.isValidName = true; this.isValidName = true;
this.isValidTable = true; this.isValidTable = true;
if (!this.params.name) { if (!this.params.name) {
@@ -621,7 +626,15 @@ export default {
delete this.params["tableName"]; delete this.params["tableName"];
Api.updateCaseList(this.params) Api.updateCaseList(this.params)
.then((response) => { .then((response) => {
if (that.isPreview) {
that.$refs["modal-preview"].columns = that.getColumns();
that.$refs["modal-preview"].type = that.params.type;
that.$refs["modal-preview"].customCaseId = that.params.id;
that.$refs["modal-preview"].show();
that.isPreview = false;
} else {
this.$emit("closeSketch"); this.$emit("closeSketch");
}
}) })
.catch((err) => { .catch((err) => {
this.makeToast('danger', this.$i18n.t('ID_ERROR'), err.response.statusText); this.makeToast('danger', this.$i18n.t('ID_ERROR'), err.response.statusText);
@@ -630,8 +643,16 @@ export default {
} else { } else {
Api.createCaseList(this.params) Api.createCaseList(this.params)
.then((response) => { .then((response) => {
if (that.isPreview) {
that.params.id = response.data.id;
that.$refs["modal-preview"].columns = that.getColumns();
that.$refs["modal-preview"].type = that.params.type;
that.$refs["modal-preview"].customCaseId = that.params.id;
that.$refs["modal-preview"].show();
that.isPreview = false;
} else {
this.$emit("closeSketch"); this.$emit("closeSketch");
}
}) })
.catch((err) => { .catch((err) => {
this.makeToast('danger',this.$i18n.t('ID_ERROR') ,err.response.statusText); this.makeToast('danger',this.$i18n.t('ID_ERROR') ,err.response.statusText);
@@ -691,6 +712,30 @@ export default {
.catch((e) => { .catch((e) => {
console.error(e); console.error(e);
}) })
},
/**
* Show modal preview
*/
showPreview() {
this.isPreview = true;
this.onSubmit();
},
/**
* Get columns to show in the preview
*/
getColumns() {
var columns = [],
auxColumn,
i;
for (i = 0; i < this.dataCaseList.length; i += 1) {
auxColumn = this.dataCaseList[i];
if (auxColumn.set) {
columns.push(auxColumn.field);
}
}
columns.push('actions');
columns.unshift('detail');
return columns
} }
}, },
}; };

View File

@@ -13,7 +13,7 @@
> >
<div slot="actions" slot-scope="props"> <div slot="actions" slot-scope="props">
<div @click="updateDataEllipsis(props.row)"> <div @click="updateDataEllipsis(props.row)">
<ellipsis ref="ellipsis" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis> <ellipsis :ref="`ellipsis-${props.row.id}`" v-if="dataEllipsis" :data="dataEllipsis"> </ellipsis>
</div> </div>
</div> </div>
<div slot="owner" slot-scope="props"> <div slot="owner" slot-scope="props">
@@ -196,6 +196,7 @@ export default {
showPreview(data) { showPreview(data) {
this.$refs["modal-preview"].columns = this.getColumns(data); this.$refs["modal-preview"].columns = this.getColumns(data);
this.$refs["modal-preview"].type = data.type; this.$refs["modal-preview"].type = data.type;
this.$refs["modal-preview"].customCaseId = data.id;
this.$refs["modal-preview"].show(); this.$refs["modal-preview"].show();
}, },
/** /**
@@ -297,7 +298,7 @@ export default {
that.downloadCaseList(data); that.downloadCaseList(data);
} }
}, },
pause: { preview: {
name: "preview", name: "preview",
icon: "fas fa-tv", icon: "fas fa-tv",
color: "green", color: "green",

View File

@@ -27,7 +27,7 @@ export let cases = {
} }
return Api.get({ return Api.get({
service, service,
params: data.filters, params: data,
keys keys
}); });
}, },