diff --git a/src/api/00_dashboard/api.message.ts b/src/api/00_dashboard/api.message.ts index 8fe705b9..8f7049e2 100644 --- a/src/api/00_dashboard/api.message.ts +++ b/src/api/00_dashboard/api.message.ts @@ -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`, }; diff --git a/src/api/05_command/api.command.ts b/src/api/05_command/api.command.ts index b332aefb..d9c4e897 100644 --- a/src/api/05_command/api.command.ts +++ b/src/api/05_command/api.command.ts @@ -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}`, }; diff --git a/src/components/Dialogs/PopupReplyInbox.vue b/src/components/Dialogs/PopupReplyInbox.vue index a014bf52..37600e2b 100644 --- a/src/components/Dialogs/PopupReplyInbox.vue +++ b/src/components/Dialogs/PopupReplyInbox.vue @@ -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(); diff --git a/src/modules/02_users/views/01_user.vue b/src/modules/02_users/views/01_user.vue index 4ae70010..a9a370db 100644 --- a/src/modules/02_users/views/01_user.vue +++ b/src/modules/02_users/views/01_user.vue @@ -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(1); // หน้า const total = ref(0); // จำนวนรายการ const maxPage = ref(0); // จำนวนหน้า const pageSize = ref(10); // จำนวนข้อมูลต่อหน้า +const employeeClass = ref("officer"); const columns = ref([ { name: "no", @@ -149,24 +151,28 @@ const itemMenu = ref([ }, ]); +const employeeClassMain = ref([ + { id: "officer", name: "ข้าราชการกรุงเทพมหานครสามัญ" }, + { id: "employee", name: "ลูกจ้างประจำกรุงเทพมหานคร" }, +]); + +const employeeClassOption = ref(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 () => { -
- +
+ + + + เพิ่มผู้ใช้งาน diff --git a/src/modules/02_users/views/04_roleOrganization.vue b/src/modules/02_users/views/04_roleOrganization.vue index 6b4835b2..b3ade258 100644 --- a/src/modules/02_users/views/04_roleOrganization.vue +++ b/src/modules/02_users/views/04_roleOrganization.vue @@ -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(); // ดึงข้อมูลรายชื่อคนที่มีสิทธิ์จัดการโครงสร้าง } }) diff --git a/src/modules/03_logs/components/DialogDataDiff.vue b/src/modules/03_logs/components/DialogDataDiff.vue index 319bc963..bf10dde1 100644 --- a/src/modules/03_logs/components/DialogDataDiff.vue +++ b/src/modules/03_logs/components/DialogDataDiff.vue @@ -29,12 +29,12 @@ defineProps<{ ส่งออกเป็นไฟล์ TXTดาวน์โหลด (.TXT) diff --git a/src/modules/03_logs/components/LogTable.vue b/src/modules/03_logs/components/LogTable.vue index f313e88b..f2936ad7 100644 --- a/src/modules/03_logs/components/LogTable.vue +++ b/src/modules/03_logs/components/LogTable.vue @@ -564,12 +564,13 @@ onMounted(async () => {
ส่งออกเป็นไฟล์ CSVดาวน์โหลด (.CSV)
diff --git a/src/modules/03_logs/views/mainView.vue b/src/modules/03_logs/views/mainView.vue index 14301476..ecf012de 100644 --- a/src/modules/03_logs/views/mainView.vue +++ b/src/modules/03_logs/views/mainView.vue @@ -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 () => { diff --git a/src/modules/05_command/views/salaryLists.vue b/src/modules/05_command/views/salaryLists.vue index d3fdbb1e..6d11fd44 100644 --- a/src/modules/05_command/views/salaryLists.vue +++ b/src/modules/05_command/views/salaryLists.vue @@ -75,7 +75,7 @@ const columns = ref([ { 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()" >