feat(gov):btn delete
This commit is contained in:
parent
41c11f6913
commit
ef0f879cf8
4 changed files with 112 additions and 5 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue