Merge branch 'develop' into dev

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-04-28 16:02:03 +07:00
commit 0119ecec6d
3 changed files with 47 additions and 8 deletions

View file

@ -16,4 +16,6 @@ export default {
/** กำหนดสิทธิ์*/
managementPermission,
resetPassword: `${management}/user/reset-password`,
};

View file

@ -36,8 +36,11 @@ const {
hideLoader,
success,
dialogConfirm,
dialogMessageNotify,
} = useCounterMixin();
const NODE_ENV = ref<string>(process.env.NODE_ENV || "development");
/** Tree*/
const activeId = ref<string>(""); // id
const orgId = ref<string | null>(null); // id node
@ -195,6 +198,12 @@ const itemMenu = ref<ItemsMenu[]>([
color: "blue-9",
type: "managementRole",
},
{
label: "รีเซ็ตรหัสผ่าน",
icon: "mdi-lock-reset",
color: "teal-4",
type: "resetPassword",
},
{
label: "ลบ",
icon: "delete",
@ -281,7 +290,7 @@ async function fetchListUsers() {
e.name === "STAFF" ||
e.name === "SUPER_ADMIN" ||
e.name === "ADMIN" ||
e.name === "USER"
e.name === "USER",
)
: [],
}));
@ -319,6 +328,8 @@ function onClickAction(type: string, data: Users) {
// /
const status = type === "open" ? true : false;
onLockUser(data.id, status);
} else if (type === "resetPassword") {
onReSetPassword(data.id);
}
}
@ -346,7 +357,7 @@ async function onDeleteUser(id: string) {
currentPage.value = await updateCurrentPage(
currentPage.value,
maxPage.value,
rows.value.length
rows.value.length,
);
await fetchListUsers();
success($q, "ลบข้อมูลสำเร็จ");
@ -385,7 +396,7 @@ function onLockUser(id: string, type: boolean) {
type ? "ยืนยันการเปิดใช้" : "ยืนยันการระงับใช้งาน",
type
? "ต้องการยืนยันการเปิดใช้นี้หรือไม่ ?"
: "ต้องการยืนยันระงับการใช้งานนี้หรือไม่ ?"
: "ต้องการยืนยันระงับการใช้งานนี้หรือไม่ ?",
);
}
@ -410,7 +421,7 @@ function filterFnOptions(val: string, update: Function, type: string) {
case "employeeClass":
update(() => {
employeeClassOption.value = employeeClassMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
(v: DataOption) => v.name.indexOf(val) > -1,
);
});
break;
@ -430,6 +441,32 @@ async function onSearchData() {
await fetchListUsers();
}
function onReSetPassword(id: string) {
dialogConfirm(
$q,
async () => {
try {
showLoader();
const messsage =
NODE_ENV.value === "production"
? "รหัสผ่านจะถูกเปลี่ยนเป็น วันเดือนปีพุทธศักราชเกิด ของผู้ใช้งาน (รูปแบบ ววดดปปปป เช่น 14042533)"
: "ระบบจะตั้งรหัสผ่านใหม่เป็น P@ssw0rd";
await http.post(config.API.resetPassword, {
keycloak: id,
});
success($q, "รีเซ็ตรหัสผ่านสำเร็จ");
dialogMessageNotify($q, messsage);
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
},
"ยืนยันการรีเซ็ตรหัสผ่าน",
"ต้องการยืนยันการรีเซ็ตรหัสผ่านนี้หรือไม่ ?",
);
}
/**
* การเปลยนแปลงของจำนวนขอมลตอหน
* งขอมลรายชอผใชงานตามจำนวนขอมลตอหน
@ -438,7 +475,7 @@ watch(
() => pageSize.value,
() => {
fetchListUsers();
}
},
);
const tokenParsedData = ref<string[]>([]);
@ -473,7 +510,7 @@ onMounted(async () => {
<template>
<div class="row items-center">
<div class="toptitle text-dark row items-center q-py-xs">
ดการผใชงาน
ดการผใชงาน {{ NODE_ENV }}
</div>
</div>

View file

@ -550,7 +550,7 @@ onMounted(async () => {
(props.row.attrIsGet = true),
(props.row.attrIsUpdate = true),
(props.row.attrIsDelete = true),
(props.row.attrPrivilege = 'ROOT')
(props.row.attrPrivilege = 'PARENT')
"
v-if="props.row.children.length === 0"
:disable="!props.row.selected || formData.isAdminVisibled"
@ -676,7 +676,7 @@ onMounted(async () => {
(item.attrIsGet = true),
(item.attrIsUpdate = true),
(item.attrIsDelete = true),
(item.attrPrivilege = 'ROOT')
(item.attrPrivilege = 'PARENT')
"
:disable="!item.selected || formData.isAdminVisibled"
/>