From 825d99e22e8e7ff2284f5553207b9864dc7fa960 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 17 Oct 2024 11:23:28 +0700 Subject: [PATCH] api workflow --- .../Workflow/DialogSelectPerson.vue | 45 +++++++++++-------- src/components/Workflow/Main.vue | 13 +++--- src/interface/response/workflow/Main.ts | 39 ++++++++++++++++ 3 files changed, 73 insertions(+), 24 deletions(-) create mode 100644 src/interface/response/workflow/Main.ts diff --git a/src/components/Workflow/DialogSelectPerson.vue b/src/components/Workflow/DialogSelectPerson.vue index b49d61687..88c80b3ae 100644 --- a/src/components/Workflow/DialogSelectPerson.vue +++ b/src/components/Workflow/DialogSelectPerson.vue @@ -22,14 +22,7 @@ const { stateId, fetchData } = defineProps({ /** table*/ const selected = ref([]); -const rows = ref([ - { - fullName: "นายศรัณย์ ศิลาดี", - position: "นักบริหาร", - posType: "บริหาร(สูง)", - organization: "", - }, -]); +const rows = ref([]); const columns = ref([ { name: "fullName", @@ -37,6 +30,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", }, @@ -49,15 +45,15 @@ 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", align: "left", @@ -73,7 +69,20 @@ 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 () => { diff --git a/src/components/Workflow/Main.vue b/src/components/Workflow/Main.vue index 5197c3241..8ccf93e46 100644 --- a/src/components/Workflow/Main.vue +++ b/src/components/Workflow/Main.vue @@ -6,6 +6,8 @@ import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; +import type { DataListState } from "@/interface/response/workflow/Main"; + import DialogSelectPerson from "@/components/Workflow/DialogSelectPerson.vue"; import DialogApprove from "@/components/Workflow/DialogApprove.vue"; @@ -19,7 +21,7 @@ const { id, sysName } = defineProps({ }); const stateId = ref(""); //id state ปัจุบัน -const state = ref(2); //state ปัจุบัน +const state = ref(1); //state ปัจุบัน const isChangeState = ref(false); //ส่งไปยังผู้บังคับบัญชา/ผู้มีอำนาจ const isOperate = ref(true); //เปลี่ยนสถานะ (state) เอกสารได้ @@ -31,10 +33,9 @@ const isCancel = ref(true); //ลบเอกสารได้ (ถ้ const modalSelectPerson = ref(false); const modalApprove = ref(false); -const itemState = ref([]); +const itemState = ref([]); async function fetchData() { - console.log(id, sysName); await http .post(config.API.workflow + `check-state-all`, { refId: id, @@ -129,7 +130,7 @@ onMounted(async () => { :color="state < index + 1 ? 'grey-4' : ''" > -
+
{ :key="index" > - {{ item.createdFullName }} + + {{ `${item.prefix}${item.firstName} ${item.lastName}` }} {{ diff --git a/src/interface/response/workflow/Main.ts b/src/interface/response/workflow/Main.ts new file mode 100644 index 000000000..99b0da399 --- /dev/null +++ b/src/interface/response/workflow/Main.ts @@ -0,0 +1,39 @@ +interface DataListState { + stateId: string; + stateName: string; + stateNo: number; + stateUserComments: StateUserComments[]; +} + +interface StateUserComments { + createdAt: string; + createdFullName: string; + createdUserId: string; + id: string; + isAccept: boolean | null; + isAcceptSetting: boolean | null; + isApprove: boolean | null; + isApproveSetting: boolean | null; + isReasonSetting: boolean | null; + lastUpdateFullName: string; + lastUpdateUserId: string; + lastUpdatedAt: string; + order: null; + profileId: string; + reason: string; + stateId: string; + firstName: string; + lastName: string; + prefix: string; +} + +interface DataCommander { + firstName: string; + id: string; + lastName: string; + orgRoot: string; + position: string; + prefix: string; +} + +export type { DataListState, DataCommander };