แก้ 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",
MEET_URI: "meet.frappet.com",
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: {
API_URI: "http://localhost:5010/api/v1",

View file

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