Merge branch 'develop' into setthawut

This commit is contained in:
setthawutttty 2024-11-12 17:26:09 +07:00
commit 3399f14823
9 changed files with 114 additions and 46 deletions

View file

@ -12,5 +12,7 @@ export default {
msgId: (id: string) => `${message}/my-notifications/${id}`,
msgNoread: () => `${message}/my-notifications/noread`,
msgInboxDelete: (id: string) => `${message}/my-inboxes/${id}`,
replyMessage: (id: string) => `${reply}/${id}`,
msgNotiAdmin: `${env.API_URI}/org/profile/noti-admin`,
};

View file

@ -10,8 +10,9 @@ export default {
page: number,
pageSize: number,
isActive: boolean,
commandSysId: string
commandSysId: string,
search: string
) =>
`${commandSalary}/admin?page=${page}&pageSize=${pageSize}&isActive=${isActive}&commandSysId=${commandSysId}`,
commandSalaryById:(id:string)=>`${commandSalary}/${id}`
`${commandSalary}/admin?page=${page}&pageSize=${pageSize}&isActive=${isActive}&commandSysId=${commandSysId}&search=${search}`,
commandSalaryById: (id: string) => `${commandSalary}/${id}`,
};

View file

@ -45,13 +45,14 @@ function onSubmit() {
showLoader();
const pathAPI =
props.type === "Administrator"
? config.API.replyMessage(props.idInbox)
? config.API.msgNotiAdmin
: config.API.replyMessage(props.idInbox);
await http
.put(pathAPI, {
subject: subject.value,
body: body.value,
})
const method = props.type === "Administrator" ? http.post : http.put;
await method(pathAPI, {
subject: subject.value,
body: body.value,
})
.then(() => {
success($q, "ส่งข้อความสำเร็จ");
onClose();

View file

@ -10,6 +10,7 @@ import { useCounterMixin } from "@/stores/mixin";
/** importType*/
import type { QTableProps } from "quasar";
import type {
DataOption,
ItemsMenu,
Pagination,
} from "@/modules/02_users/interface/index/Main";
@ -37,6 +38,7 @@ const currentPage = ref<number>(1); // หน้า
const total = ref<number>(0); //
const maxPage = ref<number>(0); //
const pageSize = ref<number>(10); //
const employeeClass = ref<string>("officer");
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -149,24 +151,28 @@ const itemMenu = ref<ItemsMenu[]>([
},
]);
const employeeClassMain = ref<DataOption[]>([
{ id: "officer", name: "ข้าราชการกรุงเทพมหานครสามัญ" },
{ id: "employee", name: "ลูกจ้างประจำกรุงเทพมหานคร" },
]);
const employeeClassOption = ref<DataOption[]>(employeeClassMain.value);
/**
* งกนดงขอมลรายชอผใชงาน
*/
async function fetchListUsers() {
let max = pageSize.value;
let first = (currentPage.value - 1) * pageSize.value;
showLoader();
await http
.get(
config.API.managementUser +
`?max=${max}&first=${first}&search=${keyword.value}`
`?pageSize=${pageSize.value}&page=${currentPage.value}&keyword=${keyword.value}&type=${employeeClass.value}`
)
.then(async (res) => {
const data = await res.data.data;
total.value = res.data.total;
const data = await res.data.result;
total.value = data.total;
maxPage.value = Math.ceil(total.value / pageSize.value);
rows.value = data.map((e: Users) => ({
rows.value = data.data.map((e: Users) => ({
...e,
roles: Array.isArray(e.roles)
? e.roles.filter(
@ -288,6 +294,24 @@ function updatePagination(initialPagination: Pagination) {
pageSize.value = initialPagination.rowsPerPage;
}
/**
* function นหาขอม Option
* @param val คำคนหา
* @param update function
* @param type ประเภท option
*/
function filterFnOptions(val: string, update: Function, type: string) {
switch (type) {
case "employeeClass":
update(() => {
employeeClassOption.value = employeeClassMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
}
}
/**
* การเปลยนแปลงของจำนวนขอมลตอหน
*
@ -318,8 +342,38 @@ onMounted(async () => {
</div>
<q-card flast bordered class="q-pa-md">
<div class="items-center col-12 row q-col-gutter-sm q-mb-sm">
<q-btn flat round dense color="primary" icon="add" @click="openDialog()">
<div class="items-center col-12 row q-col-gutter-sm">
<q-select
outlined
dense
v-model="employeeClass"
:options="employeeClassOption"
label="สถานภาพ"
emit-value
map-options
option-label="name"
option-value="id"
use-input
style="width: 300px"
@update:model-value="(currentPage = 1), fetchListUsers()"
@filter="(inputValue: string,
doneFn: Function) => filterFnOptions(inputValue, doneFn,'employeeClass')"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
<q-btn
class="q-ml-sm"
flat
round
dense
color="primary"
icon="add"
@click="openDialog()"
>
<q-tooltip>เพมผใชงาน </q-tooltip>
</q-btn>
<q-space />

View file

@ -41,7 +41,7 @@ async function fatchOrg() {
nodeTree.value = data;
if (data.length === 1) {
selectedOrg(data[0].id);
} else {
} else if (data.length > 1) {
await fetchListPerson(); //
}
})

View file

@ -29,12 +29,12 @@ defineProps<{
<q-separator />
<q-card-actions align="right">
<q-btn
label="ส่งออกเป็นไฟล์ TXT"
label="ดาวน์โหลด (.TXT)"
color="blue"
type="submit"
icon-right="send"
icon="download"
@click="onSend"
><q-tooltip>งออกเปนไฟล TXT</q-tooltip></q-btn
><q-tooltip>ดาวนโหลด (.TXT)</q-tooltip></q-btn
>
</q-card-actions>
</q-card>

View file

@ -564,12 +564,13 @@ onMounted(async () => {
</q-btn-dropdown>
</div>
<q-btn
label="ส่งออกเป็นไฟล์ CSV"
dense
flat
color="green"
type="submit"
icon-right="send"
icon-right="download"
@click="onSendCSV"
><q-tooltip>งออกเปนไฟล CSV</q-tooltip></q-btn
><q-tooltip>ดาวนโหลด (.CSV)</q-tooltip></q-btn
>
</div>

View file

@ -97,6 +97,11 @@ const menuList = ref<{ icon: string; label: string; path: string }[]>([
label: "ระบบ Admin",
path: "/logs?system=admin",
},
{
icon: "mdi-account-arrow-right",
label: "การเข้าใช้งานและการออกจากระบบ",
path: "/logs?system=inout",
},
]);
onMounted(async () => {

View file

@ -75,7 +75,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "name",
align: "left",
label: "ข้อความต้นแบบสำหรับลงในตำแหน่ง/เงินเดือน (ต้นแบบ)",
label: "ข้อความต้นแบบสำหรับลงในตำแหน่ง/เงินเดือน",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
@ -116,21 +116,21 @@ function onDialogEdit(data: ListTemplateSalary) {
* ลบ คำส
* @param id id คำส
*/
function onDelete(id: string) {
dialogRemove($q, () => {
async function onDelete(id: string) {
dialogRemove($q, async () => {
showLoader();
http
await http
.delete(config.API.commandSalaryById(id))
.then(async (res) => {
success($q, "ลบข้อมูลเสร็จสิ้น");
.then(async () => {
await fetchSalaryList();
hideLoader();
success($q, "ลบข้อมูลเสร็จสิ้น");
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
});
}
@ -146,33 +146,34 @@ function closeDialog() {
/** บันทึกข้อมูล dialog */
function onSubmit() {
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
const url = isEdit.value
? config.API.commandSalaryById(dataForm.id)
: config.API.commandSalary;
showLoader();
http[isEdit.value ? "put" : "post"](url, {
await http[isEdit.value ? "put" : "post"](url, {
name: dataForm.name,
commandSysId: activeOrderId.value,
isActive: dataForm.isActive,
})
.then(async (res) => {
closeDialog();
success($q, "บันทึกข้อมูลสำเร็จ");
.then(async () => {
await fetchSalaryList();
hideLoader();
success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
});
}
/** เก็บ id list คำสั่งที่เลือก เพื่อใช้ class */
function selectInbox(data: CommandSysType) {
activeOrderId.value = data.id;
pagination.value.page = 1;
fetchSalaryList();
}
@ -181,13 +182,15 @@ function selectInbox(data: CommandSysType) {
*/
async function fetchSalaryList() {
showLoader();
rows.value = [];
await http
.get(
config.API.commandSalaryDetail(
pagination.value.page,
pagination.value.rowsPerPage,
isActive.value,
activeOrderId.value
activeOrderId.value,
filter.value
)
)
.then(async (res) => {
@ -239,6 +242,7 @@ watch(
watch(
() => isActive.value,
async () => {
pagination.value.page = 1;
await fetchSalaryList();
}
);
@ -321,6 +325,7 @@ onMounted(() => {
outlined
v-model="filter"
placeholder="ค้นหา"
@keydown.enter="(pagination.page = 1), fetchSalaryList()"
>
<template v-slot:append>
<q-icon name="search" v-if="filter == ''" />
@ -352,13 +357,12 @@ onMounted(() => {
ref="table"
:columns="columns"
:rows="rows"
:filter="filter"
row-key="id"
flat
bordered
:paging="true"
dense
:rows-per-page-options="[1, 25, 50, 100]"
:rows-per-page-options="[25, 50, 100]"
@update:pagination="updatePagination"
:visible-columns="visibleColumns"
>
@ -466,7 +470,7 @@ onMounted(() => {
<Header
:tittle="`${
isEdit ? 'แก้ไข' : 'เพิ่ม'
}นแบบสำหรบลงในตำแหน/เงนเดอน (นแบบ)`"
}นแบบสำหรบลงในตำแหน/เงนเดอน`"
:close="closeDialog"
/>
<q-separator />