diff --git a/src/components/Workflow/DialogSelectPerson.vue b/src/components/Workflow/DialogSelectPerson.vue index af9773b70..76c9ebfee 100644 --- a/src/components/Workflow/DialogSelectPerson.vue +++ b/src/components/Workflow/DialogSelectPerson.vue @@ -14,6 +14,8 @@ const $q = useQuasar(); const { dialogConfirm, showLoader, hideLoader, messageError } = useCounterMixin(); +const isAct = ref(false); +const search = ref(""); const modal = defineModel("modal", { required: true }); const props = defineProps({ stateId: { type: String, require: true }, @@ -25,6 +27,15 @@ const props = defineProps({ const selected = ref([]); const rows = ref([]); const columns = ref([ + { + name: "posNo", + align: "left", + label: "เลขที่ตำแหน่ง", + sortable: true, + field: "posNo", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, { name: "fullName", align: "left", @@ -57,6 +68,14 @@ const columns = ref([ }, ]); +const total = ref(0); +const totalList = ref(1); +const pagination = ref({ + sortBy: "createdAt", + descending: true, + page: 1, + rowsPerPage: 10, +}); const isAcceptSetting = ref(false); const isApproveSetting = ref(false); const isReasonSetting = ref(false); @@ -64,9 +83,18 @@ const isReasonSetting = ref(false); async function fetchLists() { showLoader(); await http - .get(config.API.workflow + `commander/${props.type}`) + .put(config.API.workflow + `commander/${props.type}`, { + isAct: isAct.value, + keyword: search.value, + page: pagination.value.page, + pageSize: pagination.value.rowsPerPage, + }) .then(async (res) => { - rows.value = res.data.result; + totalList.value = Math.ceil( + res.data.result.total / pagination.value.rowsPerPage + ); + total.value = res.data.result.total; + rows.value = res.data.result.data; }) .catch((err) => { messageError($q, err); @@ -107,8 +135,32 @@ function onCloseModal() { isAcceptSetting.value = false; isApproveSetting.value = false; isReasonSetting.value = false; + + search.value = '' + isAct.value = false } +function onSearchData() { + getSearch(); +} + +function updatePagination(newPagination: any) { + pagination.value.page = 1; + pagination.value.rowsPerPage = newPagination.rowsPerPage; +} + +function getSearch() { + pagination.value.page = 1; + fetchLists(); +} + +watch( + () => pagination.value.rowsPerPage, + async () => { + getSearch(); + } +); + watch(modal, (val) => { if (val) { fetchLists(); @@ -124,11 +176,44 @@ watch(modal, (val) => { +
+
+ +
+ + แสดงเฉพาะรักษาการแทน + + + +
+ + +
+
{ :rows-per-page-options="[10, 25, 50, 100]" selection="single" v-model:selected="selected" + @update:pagination="updatePagination" > + +