กำหนดสิทธิ์ => API กำหนดสิทธิ์

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-06-14 14:39:37 +07:00
parent 9b61266135
commit b964f1087c

View file

@ -23,7 +23,8 @@ import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const store = usePermissionsStore();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin();
/** Tree*/
const filter = ref<string>("");
@ -103,11 +104,11 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "role",
name: "authRoleName",
align: "left",
label: "สิทธิ์",
sortable: false,
field: "role",
field: "authRoleName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -208,9 +209,8 @@ const pagination = ref<Pagination>({
const modalDialogAdd = ref<boolean>(false);
/** function เรียกข้อมูลโครงสร้าง แบบปัจุบันและ แบบร่าง*/
async function fetchOrganizationActive() {
showLoader();
await http
function fetchOrganizationActive() {
http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
@ -227,9 +227,6 @@ async function fetchOrganizationActive() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -314,6 +311,32 @@ function onClickAddRole(data: PosMaster) {
dataPosMaster.value = data;
}
function onDeleteRole(id: string) {
dialogRemove(
$q,
() => {
showLoader();
http
.post(config.API.managementPermission, {
authRoleId: "",
posMasterId: id,
})
.then(() => {
fetchDataTable(reqMaster.id, reqMaster.revisionId, reqMaster.type);
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
},
"ยืนยันการลบสิทธิ์",
"ต้องการยืนยันการลบสิทธิ์นี้หรือไม่ ?"
);
}
/** callblck function ทำการ fetch ข้อมูล tree เมื่อมีการเปลี่ยน Tab ปัจจับัน,แบบร่าง*/
watch(
() => store.typeOrganizational,
@ -575,6 +598,24 @@ onMounted(() => {
</q-item-section>
</q-item>
</q-list>
<q-list dense style="min-width: 150px">
<q-item
clickable
v-close-popup
@click="onDeleteRole(props.row.id)"
>
<q-item-section>
<div class="row items-center">
<q-icon
color="red"
size="17px"
name="delete"
/>
<div class="q-pl-md">ลบสทธ</div>
</div>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-td>