edit select person in probation system

This commit is contained in:
Warunee Tamkoo 2024-11-07 15:42:52 +07:00
parent 884fe69e2c
commit 1ae929acbf
5 changed files with 46 additions and 14 deletions

View file

@ -13,6 +13,7 @@ import type {
ListCommand,
DataOrder,
Pagination,
TabOptions,
} from "@/modules/18_command/interface/index/Main";
import type { DataListCommand } from "@/modules/18_command/interface/response/Main";
@ -283,6 +284,26 @@ function updatePagination(newPagination: Pagination) {
pagination.value.rowsPerPage = newPagination.rowsPerPage;
}
const isHold = ref<boolean>(true); // true / false
// tab
const tabOptions = ref<TabOptions[]>([
{ label: "สร้างคำสั่งใหม่", value: "NEW" },
{ label: "เลือกคำสั่งที่เป็นแบบร่าง", value: "DRAF" },
]);
/** ฟังก์ชั่นเช็คการแสดงผล ตรวจสอบว่าเป็นประเภทคำสั่งที่เป็นแบบเลือกได้รายการเดียวไหม ถ้าเป็นแบบรายการเดียวจะซ่อนเลือกคำสั่งที่เป็นแบบร่าง*/
async function displayTab() {
isHold.value =
(await (props.commandTypeCode !== "C-PM-10" &&
props.commandTypeCode !== "C-PM-11" &&
props.commandTypeCode !== "C-PM-12")) ?? false;
tabOptions.value = isHold.value
? [
{ label: "สร้างคำสั่งใหม่", value: "NEW" },
{ label: "เลือกคำสั่งที่เป็นแบบร่าง", value: "DRAF" },
]
: [{ label: "สร้างคำสั่งใหม่", value: "NEW" }];
}
/** ดูการเปลี่ยนแปลงของจำนวนแถวต่อหน้า*/
watch(
() => pagination.value.rowsPerPage,
@ -294,6 +315,7 @@ watch(
/** ดูการเปลี่ยนแปลงของ modal*/
watch(modal, () => {
if (modal.value && props.persons?.length !== 0) {
displayTab();
fetchCommandType();
}
});
@ -313,7 +335,6 @@ watch(
<q-dialog v-model="modal" persistent>
<q-card style="min-width: 50vw">
<DialogHeader :tittle="'สร้าง/เลือกคำสั่ง'" :close="closeModal" />
<q-separator />
<q-card-section style="max-height: 50vh" class="scroll">
<div class="row q-mb-md">
@ -324,10 +345,7 @@ watch(
color="white"
text-color="black"
no-caps
:options="[
{ label: 'สร้างคำสั่งใหม่', value: 'NEW' },
{ label: 'เลือกคำสั่งที่เป็นแบบร่าง', value: 'DRAF' },
]"
:options="tabOptions"
/>
</div>
</div>
@ -478,7 +496,6 @@ watch(
map-options
:options="columns"
option-value="name"
style="min-width: 140px"
class="gt-xs q-ml-sm"
/>
@ -539,6 +556,7 @@ watch(
<q-card-actions align="right">
<q-btn
v-if="isHold"
label="บันทึกและเลือกรายชื่อต่อ"
@click="() => onSubmit(false)"
:disable="