Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m57s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m57s
This commit is contained in:
commit
ea52d177fd
1 changed files with 44 additions and 9 deletions
|
|
@ -1,15 +1,24 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, computed } from "vue";
|
import { ref, onMounted, computed } from "vue";
|
||||||
import { useRoute } from "vue-router";
|
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type { ResRecord } from "@/modules/15_development/interface/response/Main";
|
import type { ResRecord } from "@/modules/15_development/interface/response/Main";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const { date2Thai, onSearchDataTable } = useCounterMixin();
|
const {
|
||||||
|
date2Thai,
|
||||||
|
onSearchDataTable,
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
success,
|
||||||
|
messageError,
|
||||||
|
dialogRemove,
|
||||||
|
} = useCounterMixin();
|
||||||
|
|
||||||
//prosp
|
//prosp
|
||||||
const isProfile = defineModel<boolean>("isProfile", { required: true });
|
const isProfile = defineModel<boolean>("isProfile", { required: true });
|
||||||
|
|
@ -231,10 +240,6 @@ const visibleColumns = ref<string[]>([
|
||||||
"commandNumber",
|
"commandNumber",
|
||||||
"commandDate",
|
"commandDate",
|
||||||
]);
|
]);
|
||||||
const pagination = ref({
|
|
||||||
page: 1,
|
|
||||||
rowsPerPage: 10,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* convert status to text
|
* convert status to text
|
||||||
|
|
@ -253,10 +258,11 @@ function formBmaofficer(val: string) {
|
||||||
|
|
||||||
/** function เรียกข้อมูลโครงการ*/
|
/** function เรียกข้อมูลโครงการ*/
|
||||||
function fetchDataProject() {
|
function fetchDataProject() {
|
||||||
rows.value = listPerson.value.filter(
|
const data = listPerson.value.filter(
|
||||||
(e: ResRecord) => e.isProfile === isProfile.value
|
(e: ResRecord) => e.isProfile === isProfile.value
|
||||||
);
|
);
|
||||||
rowsMain.value = rows.value;
|
rowsMain.value = data;
|
||||||
|
serchDataTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
function serchDataTable() {
|
function serchDataTable() {
|
||||||
|
|
@ -267,6 +273,23 @@ function serchDataTable() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDelete(id: string) {
|
||||||
|
dialogRemove($q, async () => {
|
||||||
|
try {
|
||||||
|
showLoader();
|
||||||
|
await http.delete(config.API.developmentMain + `/delete/${id}`);
|
||||||
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
|
rowsMain.value = rowsMain.value.filter((e: ResRecord) => e.id !== id);
|
||||||
|
listPerson.value = listPerson.value.filter((e: ResRecord) => e.id !== id);
|
||||||
|
serchDataTable();
|
||||||
|
} catch (error) {
|
||||||
|
messageError($q, error);
|
||||||
|
} finally {
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */
|
/** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
fetchDataProject();
|
fetchDataProject();
|
||||||
|
|
@ -314,12 +337,12 @@ onMounted(() => {
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
:paging="true"
|
:paging="true"
|
||||||
v-model:pagination="pagination"
|
|
||||||
:rows-per-page-options="[20, 50, 100]"
|
:rows-per-page-options="[20, 50, 100]"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
<q-th auto-width />
|
||||||
<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">{{ col.label }}</span>
|
<span class="text-weight-medium">{{ col.label }}</span>
|
||||||
</q-th>
|
</q-th>
|
||||||
|
|
@ -327,6 +350,18 @@ onMounted(() => {
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
<q-td auto-width>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="red"
|
||||||
|
@click="handleDelete(props.row.id)"
|
||||||
|
icon="mdi-delete"
|
||||||
|
>
|
||||||
|
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</q-td>
|
||||||
|
|
||||||
<q-td v-for="col in props.cols" :key="col.id">
|
<q-td v-for="col in props.cols" :key="col.id">
|
||||||
<div v-if="col.name === 'isDone'" class="text-center">
|
<div v-if="col.name === 'isDone'" class="text-center">
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue