fix rules แสดงความคิดเห็น ==> popup แสดงความคิดเห็น

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-07-15 13:30:34 +07:00
parent b8d74d6302
commit fa4ff7eb1e
2 changed files with 11 additions and 2 deletions

View file

@ -28,6 +28,10 @@ const props = defineProps({
textReport: { textReport: {
type: String, type: String,
}, },
isRules: {
type: Boolean,
default: true,
},
}); });
watch(props, () => { watch(props, () => {
if (modal.value === true && props.textReport == "") { if (modal.value === true && props.textReport == "") {
@ -68,7 +72,7 @@ function closeModal() {
outlined outlined
dense dense
lazy-rules lazy-rules
:rules="[(val:string) => !!val || `กรุณากรอก${label}`]" :rules="isRules ? [(val:string) => !!val || `กรุณากรอก${label}`] : []"
v-model="reason" v-model="reason"
:label="`${label}`" :label="`${label}`"
/> />

View file

@ -63,6 +63,7 @@ const dialogTitle = ref<string>("อนุญาต"); // Title ของ Dialog
const dialogLabel = ref<string>("เหตุผล"); // Label Dialog const dialogLabel = ref<string>("เหตุผล"); // Label Dialog
const modalAdd = ref<boolean>(false); // Modal const modalAdd = ref<boolean>(false); // Modal
const typeAdd = ref<string>(""); // COMMANDER, APPROVER const typeAdd = ref<string>(""); // COMMANDER, APPROVER
const isRules = ref<boolean>(true); //
/** Form รายละเอียดข้อมูล*/ /** Form รายละเอียดข้อมูล*/
const formData = reactive<FormData>({ const formData = reactive<FormData>({
id: "", //Id id: "", //Id
@ -446,14 +447,17 @@ async function checkLeaveType(leaveTypeId: string, formData: FormData) {
async function openModal(data: string) { async function openModal(data: string) {
if (data === "approve") { if (data === "approve") {
modalApprove.value = true; modalApprove.value = true;
isRules.value = false;
dialogTitle.value = "อนุญาต"; dialogTitle.value = "อนุญาต";
} }
if (data === "UnApprove") { if (data === "UnApprove") {
modalApprove.value = true; modalApprove.value = true;
dialogTitle.value = "ไม่อนุญาต"; dialogTitle.value = "ไม่อนุญาต";
isRules.value = true;
} }
if (data === "authority") { if (data === "authority") {
modalApprove.value = true; modalApprove.value = true;
isRules.value = true;
dialogTitle.value = "ความคิดเห็นของผู้บังคับบัญชา"; dialogTitle.value = "ความคิดเห็นของผู้บังคับบัญชา";
dialogLabel.value = "ความคิดเห็น"; dialogLabel.value = "ความคิดเห็น";
} }
@ -1229,7 +1233,8 @@ onMounted(async () => {
v-model:modal="modalApprove" v-model:modal="modalApprove"
:title="dialogTitle" :title="dialogTitle"
:label="dialogLabel" :label="dialogLabel"
:savaForm="clickSave" :sava-form="clickSave"
:is-rules="isRules"
/> />
<DialogAddCommander <DialogAddCommander