api workflow

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-17 11:23:48 +07:00
parent 079a1c1972
commit 619e93231c
3 changed files with 52 additions and 25 deletions

View file

@ -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<any[]>([]);
const rows = ref<any[]>([
{
id: "1",
fullName: "นายศรัณย์ ศิลาดี",
position: "นักบริหาร",
posType: "บริหาร(สูง)",
organization: "",
},
]);
const selected = ref<DataCommander[]>([]);
const rows = ref<DataCommander[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "fullName",
@ -38,6 +31,9 @@ const columns = ref<QTableProps["columns"]>([
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<QTableProps["columns"]>([
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<boolean>(false);
const isApproveSetting = ref<boolean>(false);
const isReasonSetting = ref<boolean>(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) => {

View file

@ -125,7 +125,7 @@ onMounted(async () => {
:color="state < index + 1 ? 'grey-4' : ''"
>
<!-- Darft -->
<div class="row q-col-gutter-sm" v-if="state === 1">
<div class="row q-col-gutter-sm" v-if="state === 1 && index === 0">
<div>
<q-btn
v-if="isChangeState"
@ -149,7 +149,9 @@ onMounted(async () => {
>
<q-item-section>
<q-item-label
>{{ item.createdFullName }}
>{{
`${item.prefix}${item.firstName} ${item.lastName}`
}}
<!-- {{ `(${item.position})` }} -->
</q-item-label>
<q-item-label caption lines="2">{{

View file

@ -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 };