API ลบรายการประเมิน
This commit is contained in:
parent
86ae8fa847
commit
2910994f15
3 changed files with 55 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ const evaluation = `${env.API_URI}/evaluation`;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
evaluationList: () => `${evaluation}/user`,
|
evaluationList: () => `${evaluation}/user`,
|
||||||
|
evaluationByid: (id: string) => `${evaluation}/${id}`,
|
||||||
evaluationCheckStatus: () => `${evaluation}/check-status`,
|
evaluationCheckStatus: () => `${evaluation}/check-status`,
|
||||||
evaluationCheckStep: (id: string) => `${evaluation}/check/${id}`,
|
evaluationCheckStep: (id: string) => `${evaluation}/check/${id}`,
|
||||||
evaluationCheckById: (id: string) => `${evaluation}/check/${id}`,
|
evaluationCheckById: (id: string) => `${evaluation}/check/${id}`,
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,25 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, watch } from "vue";
|
import { ref, onMounted, watch } from "vue";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
|
||||||
/**import Type */
|
/**import Type */
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
|
|
||||||
/** import Store */
|
/** import Store */
|
||||||
import { useEvaluateStore } from "@/modules/06_evaluate/store";
|
import { useEvaluateStore } from "@/modules/06_evaluate/store";
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
/** use*/
|
/** use*/
|
||||||
const store = useEvaluateStore();
|
const store = useEvaluateStore();
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const $q = useQuasar();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const { dialogRemove, showLoader, hideLoader, success, messageError } = mixin;
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
page: {
|
page: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
@ -25,6 +33,10 @@ const props = defineProps({
|
||||||
type: Number,
|
type: Number,
|
||||||
require: true,
|
require: true,
|
||||||
},
|
},
|
||||||
|
fetchData: {
|
||||||
|
type: Function,
|
||||||
|
require: true,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["update:pagination"]);
|
const emit = defineEmits(["update:pagination"]);
|
||||||
|
|
@ -57,7 +69,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "dateSend",
|
field: "dateSend",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px; ",
|
style: "font-size: 14px;",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "status",
|
name: "status",
|
||||||
|
|
@ -97,6 +109,28 @@ function updateRowsPerPagen(newPagination: any) {
|
||||||
currentPage.value = 1;
|
currentPage.value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ลบรายการประเมิน
|
||||||
|
* @param id รายการประเมิน
|
||||||
|
*/
|
||||||
|
async function onCkilckDelete(id: string) {
|
||||||
|
dialogRemove($q, async () => {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.delete(config.API.evaluationByid(id))
|
||||||
|
.then(() => {
|
||||||
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
hideLoader();
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
props.fetchData?.();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function redireact ไปยังหน้ารายละเอียด
|
* function redireact ไปยังหน้ารายละเอียด
|
||||||
* @param data ข้อมูล row
|
* @param data ข้อมูล row
|
||||||
|
|
@ -136,6 +170,7 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
||||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<span class="text-weight-medium" v-html="col.label" />
|
<span class="text-weight-medium" v-html="col.label" />
|
||||||
</q-th>
|
</q-th>
|
||||||
|
<q-th></q-th>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
|
|
@ -153,6 +188,18 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
||||||
{{ col.value }}
|
{{ col.value }}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
<q-td>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
round
|
||||||
|
color="red"
|
||||||
|
icon="delete"
|
||||||
|
@click.stop="onCkilckDelete(props.row.id)"
|
||||||
|
>
|
||||||
|
<q-tooltip>ลบ</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</q-td>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:pagination="scope">
|
<template v-slot:pagination="scope">
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,12 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DialogMain :modal="modal" :menu="menu" :close="onclickAddEvaluate" />
|
<DialogMain
|
||||||
|
:modal="modal"
|
||||||
|
:menu="menu"
|
||||||
|
:close="onclickAddEvaluate"
|
||||||
|
:fetchData="fetchEvaluteList"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue