Merge branch 'develop' into dev
This commit is contained in:
commit
0119ecec6d
3 changed files with 47 additions and 8 deletions
|
|
@ -16,4 +16,6 @@ export default {
|
|||
|
||||
/** กำหนดสิทธิ์*/
|
||||
managementPermission,
|
||||
|
||||
resetPassword: `${management}/user/reset-password`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue