feat: add delete is OWNER

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-05-29 10:12:16 +07:00
parent aa3d41b7b3
commit 21401ed519
6 changed files with 174 additions and 45 deletions

View file

@ -27,8 +27,15 @@ const stroeResign = useDataStore();
const { statusText } = stroe;
const router = useRouter();
const mixin = useCounterMixin();
const { messageError, date2Thai, showLoader, hideLoader, onSearchDataTable } =
mixin;
const {
messageError,
date2Thai,
showLoader,
hideLoader,
onSearchDataTable,
dialogRemove,
success,
} = mixin;
/** Table */
const rows = ref<ResponseItems[]>([]);
@ -129,7 +136,7 @@ const columns = ref<QTableProps["columns"]>([
sortable: true,
field: "status",
format(val, row) {
return stroeResign.mainTabs === "1"
return stroeResign.mainTabsEMP === "1"
? statusText(row.status)
: statusText(row.status, "อนุญาต");
},
@ -252,6 +259,21 @@ function onSearch() {
);
}
function handleDelete(id: string) {
dialogRemove($q, async () => {
try {
showLoader();
await http.delete(config.API.listResignEMP() + `/admin/${id}`);
await fecthlist();
success($q, "ลบข้อมูลสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
});
}
/**Hook */
onMounted(async () => {
statusEMP.value = stroeResign.formQureyEMP.status;
@ -391,6 +413,26 @@ onMounted(async () => {
>
<q-tooltip>แกไขขอม</q-tooltip>
</q-btn>
<q-btn
v-if="
checkPermission($route)?.attrOwnership === 'OWNER' &&
props.row.status !== 'REPORT' &&
props.row.status !== 'WAITING' &&
props.row.status !== 'DONE' &&
props.row.status !== 'CANCELING' &&
props.row.status !== 'CANCEL' &&
stroeResign.mainTabsEMP === '1'
"
flat
dense
round
color="red"
icon="delete"
@click.prevent="handleDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div