แก้ url api ทดลองงาน และแก้ไข process การเพิ่มคนเข้าระบบทดลองงาน

This commit is contained in:
Warunee Tamkoo 2023-08-09 13:12:31 +07:00
parent 0ee99d21e1
commit fe2adde41a
2 changed files with 66 additions and 148 deletions

View file

@ -26,7 +26,7 @@ const config = ref<any>({
"https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230712_172702.json", "https://s3cluster.frappet.com/bma-ehr-fpt/organization/strueture/tree_20230712_172702.json",
MEET_URI: "meet.frappet.com", MEET_URI: "meet.frappet.com",
API_RETIREMENT_URI: "https://bma-ehr.frappet.synology.me/api/v1", API_RETIREMENT_URI: "https://bma-ehr.frappet.synology.me/api/v1",
API_PROBATION_URI: "http://192.168.1.151:7776/v1", API_PROBATION_URI: "https://ehr.joolsoft.com/v1",
}, },
test: { test: {
API_URI: "http://localhost:5010/api/v1", API_URI: "http://localhost:5010/api/v1",

View file

@ -6,73 +6,28 @@
<div class="row q-col-gutter-sm"> <div class="row q-col-gutter-sm">
<div class="row col-12 q-col-gutter-sm"> <div class="row col-12 q-col-gutter-sm">
<div> <div>
<q-btn <q-btn @click="modal = true" size="12px" flat round color="add" icon="mdi-plus">
@click="modal = true"
size="12px"
flat
round
color="add"
icon="mdi-plus"
>
<q-tooltip>เพมผทดลองปฏหนาทราชการ</q-tooltip> <q-tooltip>เพมผทดลองปฏหนาทราชการ</q-tooltip>
</q-btn> </q-btn>
</div> </div>
<q-space /> <q-space />
<q-input <q-input class="col-xs-12 col-sm-3 col-md-2" standout dense v-model="filterKeyword" ref="filterRef" outlined
class="col-xs-12 col-sm-3 col-md-2" debounce="300" placeholder="ค้นหา">
standout
dense
v-model="filterKeyword"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
>
<template v-slot:append> <template v-slot:append>
<q-icon v-if="filterKeyword == ''" name="search" /> <q-icon v-if="filterKeyword == ''" name="search" />
<q-icon <q-icon v-if="filterKeyword !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
v-if="filterKeyword !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/>
</template> </template>
</q-input> </q-input>
<q-select <q-select v-model="visibleColumns" multiple outlined dense options-dense :display-value="$q.lang.table.columns"
v-model="visibleColumns" emit-value map-options :options="columns" option-value="name" options-cover style="min-width: 150px"
multiple class="col-xs-12 col-sm-3 col-md-2" />
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
class="col-xs-12 col-sm-3 col-md-2"
/>
</div> </div>
<div class="col-12"> <div class="col-12">
<q-table <q-table ref="table" :columns="columns" :rows="rows" :filter="filterKeyword" row-key="Order" flat bordered
ref="table" :paging="true" dense class="custom-header-table" v-bind="attrs" :visible-columns="visibleColumns"
:columns="columns" :pagination-label="paginationLabel" v-model:pagination="pagination">
:rows="rows"
:filter="filterKeyword"
row-key="Order"
flat
bordered
:paging="true"
dense
class="custom-header-table"
v-bind="attrs"
:visible-columns="visibleColumns"
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props"> <q-th v-for="col in props.cols" :key="col.name" :props="props">
@ -81,11 +36,8 @@
</q-tr> </q-tr>
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr <q-tr :props="props" class="cursor-pointer"
:props="props" @click="router.push(`/probation/detail/${props.row.personal_id}`)">
class="cursor-pointer"
@click="router.push(`/probation/detail/${props.row.personal_id}`)"
>
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'"> <div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
@ -108,16 +60,8 @@
</q-tr> </q-tr>
</template> </template>
<template v-slot:pagination="scope"> <template v-slot:pagination="scope">
<q-pagination <q-pagination v-model="pagination.page" active-color="primary" color="dark" :max="scope.pagesNumber"
v-model="pagination.page" :max-pages="5" size="sm" boundary-links direction-links></q-pagination>
active-color="primary"
color="dark"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template> </template>
</q-table> </q-table>
</div> </div>
@ -127,55 +71,23 @@
<q-dialog v-model="modal" persistent> <q-dialog v-model="modal" persistent>
<q-card style="width: 900px; max-width: 80vw"> <q-card style="width: 900px; max-width: 80vw">
<q-form ref="myForm"> <q-form ref="myForm">
<DialogHeader <DialogHeader tittle="เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ " :close="clickClose" />
tittle="เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ "
:close="clickClose"
/>
<q-separator /> <q-separator />
<q-card-section class="q-pa-md q-col-gutter-sm"> <q-card-section class="q-pa-md q-col-gutter-sm">
<q-input <q-input class="col-12" standout dense v-model="filterKeyword2" ref="filterRef2" outlined debounce="300"
class="col-12" placeholder="ค้นหา">
standout
dense
v-model="filterKeyword2"
ref="filterRef2"
outlined
debounce="300"
placeholder="ค้นหา"
>
<template v-slot:append> <template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" /> <q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon <q-icon v-if="filterKeyword2 !== ''" name="clear" class="cursor-pointer" @click="resetFilter2" />
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter2"
/>
</template> </template>
</q-input> </q-input>
<div class="col-12"> <div class="col-12">
<q-table <q-table ref="table2" :columns="columns2" :rows="rows2" :filter="filterKeyword2" row-key="Order" flat bordered
ref="table2" :paging="true" dense class="custom-header-table" v-bind="attrs" :pagination-label="paginationLabel"
:columns="columns2" v-model:pagination="pagination">
:rows="rows2"
:filter="filterKeyword2"
row-key="Order"
flat
bordered
:paging="true"
dense
class="custom-header-table"
v-bind="attrs"
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<template v-slot:header="props"> <template v-slot:header="props">
<q-tr :props="props"> <q-tr :props="props">
<q-th <q-th v-for="col in props.cols" :key="col.name" :props="props">
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<span class="text-weight-medium">{{ col.label }}</span> <span class="text-weight-medium">{{ col.label }}</span>
</q-th> </q-th>
<q-th auto-width /> <q-th auto-width />
@ -183,11 +95,7 @@
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td <q-td v-for="col in props.cols" :key="col.name" :props="props">
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name == 'no'"> <div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</div> </div>
@ -196,29 +104,14 @@
</div> </div>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn <q-btn dense class="q-px-md" outline color="primary" label="เพิ่ม" @click="clickAdd(props.row.id)">
dense
class="q-px-md"
outline
color="primary"
label="เพิ่ม"
@click="clickAdd(props.row.id)"
>
</q-btn> </q-btn>
</q-td> </q-td>
</q-tr> </q-tr>
</template> </template>
<template v-slot:pagination="scope"> <template v-slot:pagination="scope">
<q-pagination <q-pagination v-model="pagination.page" active-color="primary" color="dark" :max="scope.pagesNumber"
v-model="pagination.page" :max-pages="5" size="sm" boundary-links direction-links></q-pagination>
active-color="primary"
color="dark"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template> </template>
</q-table> </q-table>
</div> </div>
@ -436,11 +329,11 @@ onMounted(async () => {
getpersonalList(); getpersonalList();
}); });
// watch(modal, () => { watch(modal, () => {
// if (modal.value === true) { if (modal.value === true) {
// getpersonalList(); fecthlistPersonal();
// } }
// }); });
const getpersonalList = async () => { const getpersonalList = async () => {
showLoader(); showLoader();
@ -462,12 +355,30 @@ const getpersonalList = async () => {
})); }));
console.log("(data)", data); console.log("(data)", data);
}) })
.catch(() => {}) .catch(() => { })
.finally(() => { .finally(() => {
hideLoader(); hideLoader();
}); });
}; };
// fecth profile
const fecthlistPersonal = async () => {
showLoader();
await http
.get(config.API.profileOrganizRoot)
.then((res) => {
const id = res.data.result[0].id;
if (id !== "") {
findlist(id);
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const findlist = async (id: string) => { const findlist = async (id: string) => {
let data = [ let data = [
{ criteriaType: "is_retire", criteriaValue: "false" }, { criteriaType: "is_retire", criteriaValue: "false" },
@ -478,7 +389,7 @@ const findlist = async (id: string) => {
criterias: data, criterias: data,
}) })
.then((res) => { .then((res) => {
console.log("res:", res); // console.log("res:", res);
rows2.value = res.data.result.map((e: any) => ({ rows2.value = res.data.result.map((e: any) => ({
id: e.id, id: e.id,
fullname: e.fullname, fullname: e.fullname,
@ -499,9 +410,9 @@ const clickDelete = (id: string) => {
}, },
persistent: true, persistent: true,
}) })
.onOk(async () => {}) .onOk(async () => { })
.onCancel(() => {}) .onCancel(() => { })
.onDismiss(() => {}); .onDismiss(() => { });
}; };
const clickAdd = (id: string) => { const clickAdd = (id: string) => {
@ -515,16 +426,23 @@ const clickAdd = (id: string) => {
persistent: true, persistent: true,
}) })
.onOk(async () => { .onOk(async () => {
showLoader()
const postData = { const postData = {
personal_id: id, personal_id: id,
}; };
console.log("postData:", postData); // console.log("postData:", postData);
await http.post(config.API.personalAdd(), postData).then((res) => { await http.post(config.API.personalAdd(), postData).then((res) => {
console.log("res:", res); // console.log("res:", res);
getpersonalList();
}).catch((e) => {
messageError($q, e);
}).finally(() => {
clickClose()
hideLoader()
}); });
}) })
.onCancel(() => {}) .onCancel(() => { })
.onDismiss(() => {}); .onDismiss(() => { });
}; };
const clickClose = async () => { const clickClose = async () => {