feat(gov):btn delete

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-13 19:21:01 +07:00
parent 41c11f6913
commit ef0f879cf8
4 changed files with 112 additions and 5 deletions

View file

@ -1,7 +1,6 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import { useQuasar } from "quasar";
import axios from "axios";
import { useRoute } from "vue-router";
import { checkPermission } from "@/utils/permissions";
@ -290,8 +289,8 @@ async function fetchData(id: string) {
http
.get(config.API.profileNewDisciplineByProfileId(id, empType.value))
.then((res) => {
rows.value = res.data.result;
rowsMain.value = res.data.result;
serchDataTable();
})
.catch((err) => {
messageError($q, err);
@ -461,6 +460,21 @@ function serchDataTable() {
);
}
function handleDelete(id: string) {
// dialogRemove($q, async () => {
// showLoader();
// try {
// await http.delete(config.API.profileChangeNameUpdate + `${id}`);
// await fetchData(profileId.value);
// success($q, "");
// } catch (err) {
// messageError($q, err);
// } finally {
// hideLoader();
// }
// });
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => {
fetchData(profileId.value);
@ -587,6 +601,17 @@ onMounted(() => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsDelete"
color="red"
flat
dense
round
icon="delete"
@click="handleDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td
v-for="col in props.cols"

View file

@ -208,7 +208,7 @@ async function getData() {
.get(config.API.profileNewLeaveById(profileId.value, empType.value))
.then(async (res) => {
const data = await res.data.result;
rows.value = data.map((item: DataLeave) => ({
const baseData = data.map((item: DataLeave) => ({
...item,
id: item.id,
typeLeave: item.leaveType.name,
@ -218,7 +218,9 @@ async function getData() {
numLeave: item.leaveDays,
typeLeaveId: item.leaveTypeId,
}));
rowsMain.value = rows.value;
rowsMain.value = baseData;
serchDataTable();
})
.catch((e) => {
messageError($q, e);
@ -474,6 +476,21 @@ function clickEditRowType() {
}
}
function f(id: string) {
// dialogRemove($q, async () => {
// showLoader();
// try {
// await http.delete(config.API.profileChangeNameUpdate + `${id}`);
// await getData();
// success($q, "");
// } catch (err) {
// messageError($q, err);
// } finally {
// hideLoader();
// }
// });
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
onMounted(() => {
getData();
@ -597,6 +614,17 @@ onMounted(() => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsDelete"
color="red"
flat
dense
round
icon="delete"
@click="handleDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td
v-for="col in props.cols"

View file

@ -192,8 +192,8 @@ async function fetchData(id: string) {
await http
.get(config.API.profileNewDutyByProfileId(id, empType.value))
.then(async (res) => {
rows.value = await res.data.result;
rowsMain.value = await res.data.result;
serchDataTable();
})
.catch((err) => {
messageError($q, err);
@ -447,6 +447,22 @@ function serchDataTable() {
);
}
function handleDelete(id: string) {
// dialogRemove($q, async () => {
// showLoader();
// try {
// await http.delete(config.API.profileChangeNameUpdate + `${id}`);
// await fetchData(profileId.value);
//
// success($q, "");
// } catch (err) {
// messageError($q, err);
// } finally {
// hideLoader();
// }
// });
}
/** ทำงานเมื่อ Components ถูกเรียกใช้งา*/
onMounted(() => {
fetchData(profileId.value);
@ -571,6 +587,17 @@ onMounted(() => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsDelete"
color="red"
flat
dense
round
icon="delete"
@click="handleDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td
v-for="col in props.cols"

View file

@ -438,6 +438,21 @@ async function onReturner(refId: string) {
});
}
function handleDelete(id: string) {
// dialogRemove($q, async () => {
// showLoader();
// try {
// await http.delete(config.API.profileChangeNameUpdate + `${id}`);
// await fetchData();
// success($q, "");
// } catch (err) {
// messageError($q, err);
// } finally {
// hideLoader();
// }
// });
}
onMounted(() => {
fetchData();
});
@ -583,6 +598,18 @@ onMounted(() => {
>
<q-tooltip>งตวกล</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsDelete && !props.row.commandId"
color="red"
flat
dense
round
icon="delete"
@click="handleDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div