API มอบหมายหน้าที่ความรับผิดชอบ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-07 18:03:50 +07:00
parent 88bf249250
commit e7568373c8
4 changed files with 135 additions and 78 deletions

View file

@ -30,6 +30,7 @@ const nodes = ref<Array<NodeTree[]>>([]); // ข้อมูลโครงส
const lazy = ref(nodes);
const expanded = ref<string[]>([]); //
const nodeId = ref<string>(""); // id
const isOfficer = ref<boolean>(false);
/** Table*/
const columns = ref<QTableProps["columns"]>([
@ -97,11 +98,11 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
{
name: "responsibilities",
align: "left",
name: "isPosMasterAssign",
align: "center",
label: "การเจ้าหน้าที่",
sortable: false,
field: "responsibilities",
field: "isPosMasterAssign",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
@ -287,6 +288,7 @@ async function fetchDataTable(id: string, revisionId: string, level: number) {
*/
function updateSelected(data: NodeTree) {
nodeId.value = data.orgTreeId;
isOfficer.value = data.isOfficer;
fetchDataTable(data.orgTreeId, data.orgRevisionId, data.orgLevel);
}
@ -309,27 +311,24 @@ function onClickAddRole(data: PosMaster) {
* @param id ตำแหน
*/
function onDelete(id: string) {
dialogRemove($q, () => {
// showLoader();
// http
// .post(config.API.managementPermission, {
// authRoleId: "",
// posMasterId: id,
// })
// .then(async () => {
// await fetchDataTable(
// reqMaster.id,
// reqMaster.revisionId,
// reqMaster.type
// );
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.posAssign + `/${id}`)
.then(async () => {
await fetchDataTable(
reqMaster.id,
reqMaster.revisionId,
reqMaster.type
);
success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
@ -506,7 +505,15 @@ onMounted(() => {
:key="col.name"
:props="props"
>
<span class="text-weight-medium">{{ col.label }}</span>
<span class="text-weight-medium">
<template v-if="col.name === 'isPosMasterAssign'">
{{ !isOfficer ? col.label : "สกจ." }}
</template>
<template v-else>
{{ col.label }}
</template>
</span>
</q-th>
<q-th auto-width></q-th>
</q-tr>
@ -531,7 +538,10 @@ onMounted(() => {
:key="col.name"
:props="props"
>
<div>
<div v-if="col.name === 'isPosMasterAssign'">
<q-icon name="check" v-if="col.value" color="primary" />
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
@ -682,6 +692,7 @@ onMounted(() => {
v-model:modal="modalDialog"
:dataPosMaster="dataPosMaster as PosMaster"
:fetchDataTable="fetchDataTable"
:reqMaster="reqMaster"
/>
</template>