no message

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-29 11:52:45 +07:00
parent a487e8445d
commit 56f4d36bf8
3 changed files with 33 additions and 21 deletions

View file

@ -19,6 +19,8 @@ const { showLoader, hideLoader, messageError, dialogConfirm, success } =
useCounterMixin(); useCounterMixin();
const evaluatorId = ref<string>(route.params.id.toString()); const evaluatorId = ref<string>(route.params.id.toString());
const isReadonly = <boolean>(route.name === "KPIEditEvaluator" ? true : false);
const props = defineProps({ const props = defineProps({
type: { type: {
type: String, type: String,
@ -103,7 +105,7 @@ function createValue(val: string, done: Function) {
function filterFn(val: string, update: Function) { function filterFn(val: string, update: Function) {
update(() => { update(() => {
optionTopic.value = optionTopicMain.value.filter( optionTopic.value = optionTopicMain.value.filter(
(v: any) => v.indexOf(val) > -1 (v: string) => v.indexOf(val) > -1
); );
}); });
} }
@ -144,7 +146,15 @@ onMounted(() => {
<template> <template>
<div class="q-pa-md"> <div class="q-pa-md">
<q-toolbar style="padding: 0px"> <q-toolbar style="padding: 0px">
<q-btn flat round dense icon="add" color="blue-4" @click="openDialog"> <q-btn
v-if="isReadonly"
flat
round
dense
icon="add"
color="blue-4"
@click="openDialog"
>
<q-tooltip>เสนอความคดเห</q-tooltip> <q-tooltip>เสนอความคดเห</q-tooltip>
</q-btn> </q-btn>
<q-space /> <q-space />

View file

@ -58,7 +58,6 @@ function fetchEvaluation() {
formProfile.status = store.convertStatus(data.evaluationStatus); formProfile.status = store.convertStatus(data.evaluationStatus);
formProfile.result = store.convertResults(data.evaluationResults); formProfile.result = store.convertResults(data.evaluationResults);
fetchProfile(data.profileId); fetchProfile(data.profileId);
console.log(store.dataEvaluation);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -127,26 +126,27 @@ async function clearDialog() {
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
if(id.value){ if (id.value) {
showLoader(); showLoader();
http http
.put(config.API.kpiEvaluationCheck + `/${id.value}`, { .put(config.API.kpiEvaluationCheck + `/${id.value}`, {
evaluatorId: evaluatorId.value ? evaluatorId.value.id:null, evaluatorId: evaluatorId.value ? evaluatorId.value.id : null,
commanderId: commanderId.value ? commanderId.value.id:null, commanderId: commanderId.value ? commanderId.value.id : null,
commanderHighId: commanderHighId.value ? commanderHighId.value.id:null, commanderHighId: commanderHighId.value
}) ? commanderHighId.value.id
.then((res) => { : null,
success($q, "บันทึกสำเร็จ"); })
clearDialog(); .then((res) => {
}) success($q, "บันทึกสำเร็จ");
.catch((e) => { clearDialog();
messageError($q, e); })
}) .catch((e) => {
.finally(() => { messageError($q, e);
hideLoader(); })
}); .finally(() => {
hideLoader();
});
} }
}); });
} }

View file

@ -406,6 +406,8 @@ export const useCounterMixin = defineStore("mixin", () => {
} }
const messageError = (q: any, e: any = "", text: string = "") => { const messageError = (q: any, e: any = "", text: string = "") => {
console.log(e);
if (e == "" && text != "") { if (e == "" && text != "") {
q.dialog({ q.dialog({
component: CustomComponent, component: CustomComponent,