From 619e93231cf757c6305eafe50580e56a1eb580a9 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 17 Oct 2024 11:23:48 +0700 Subject: [PATCH] api workflow --- .../Workflow/DialogSelectPerson.vue | 57 ++++++++++++------- src/components/Workflow/Main.vue | 6 +- .../Workflow/interface/response/Main.ts | 14 ++++- 3 files changed, 52 insertions(+), 25 deletions(-) diff --git a/src/components/Workflow/DialogSelectPerson.vue b/src/components/Workflow/DialogSelectPerson.vue index 9b24387..79cd338 100644 --- a/src/components/Workflow/DialogSelectPerson.vue +++ b/src/components/Workflow/DialogSelectPerson.vue @@ -7,6 +7,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import type { QTableProps } from "quasar"; +import type { DataCommander } from "@/components/Workflow/interface/response/Main"; import DialogHeader from "@/components/DialogHeader.vue"; @@ -21,16 +22,8 @@ const { stateId, fetchData } = defineProps({ }); /** table*/ -const selected = ref([]); -const rows = ref([ - { - id: "1", - fullName: "นายศรัณย์ ศิลาดี", - position: "นักบริหาร", - posType: "บริหาร(สูง)", - organization: "", - }, -]); +const selected = ref([]); +const rows = ref([]); const columns = ref([ { name: "fullName", @@ -38,6 +31,9 @@ const columns = ref([ label: "ชื่อ-นามสกุล", sortable: true, field: "fullName", + format(val, row) { + return `${row.prefix}${row.firstName} ${row.lastName}`; + }, headerStyle: "font-size: 14px", style: "font-size: 14px", }, @@ -50,20 +46,20 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, + // { + // name: "posType", + // align: "left", + // label: "ประเภทตำแหน่ง", + // sortable: true, + // field: "posType", + // headerStyle: "font-size: 14px", + // style: "font-size: 14px", + // }, { - name: "posType", - align: "left", - label: "ประเภทตำแหน่ง", - sortable: true, - field: "posType", - headerStyle: "font-size: 14px", - style: "font-size: 14px", - }, - { - name: "organization", + name: "orgRoot", align: "left", label: "สังกัด", - field: "organization", + field: "orgRoot", sortable: true, headerStyle: "font-size: 14px", style: "font-size: 14px", @@ -74,8 +70,22 @@ const isAcceptSetting = ref(false); const isApproveSetting = ref(false); const isReasonSetting = ref(false); -function fetchLists() {} +async function fetchLists() { + showLoader(); + await http + .get(config.API.workflow + `commander`) + .then(async (res) => { + rows.value = res.data.result; + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} +/** ฟังก์ชันยืนยัน*/ function onSubmit() { dialogConfirm($q, async () => { showLoader(); @@ -104,6 +114,9 @@ function onCloseModal() { modal.value = false; selected.value = []; rows.value = []; + isAcceptSetting.value = false; + isApproveSetting.value = false; + isReasonSetting.value = false; } watch(modal, (val) => { diff --git a/src/components/Workflow/Main.vue b/src/components/Workflow/Main.vue index e091b8d..f13eb5f 100644 --- a/src/components/Workflow/Main.vue +++ b/src/components/Workflow/Main.vue @@ -125,7 +125,7 @@ onMounted(async () => { :color="state < index + 1 ? 'grey-4' : ''" > -
+
{ > {{ item.createdFullName }} + >{{ + `${item.prefix}${item.firstName} ${item.lastName}` + }} {{ diff --git a/src/components/Workflow/interface/response/Main.ts b/src/components/Workflow/interface/response/Main.ts index 976afe0..99b0da3 100644 --- a/src/components/Workflow/interface/response/Main.ts +++ b/src/components/Workflow/interface/response/Main.ts @@ -22,6 +22,18 @@ interface StateUserComments { profileId: string; reason: string; stateId: string; + firstName: string; + lastName: string; + prefix: string; } -export type { DataListState }; +interface DataCommander { + firstName: string; + id: string; + lastName: string; + orgRoot: string; + position: string; + prefix: string; +} + +export type { DataListState, DataCommander };