บันทึกผล
This commit is contained in:
parent
3531301713
commit
c91843ceba
9 changed files with 918 additions and 170 deletions
|
|
@ -1,14 +1,24 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useQuasar } from "quasar";
|
||||
import type { ResRecord } from "@/modules/15_development/interface/response/Main";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/**
|
||||
* usec
|
||||
*/
|
||||
const route = useRoute();
|
||||
const $q = useQuasar();
|
||||
const id = ref<string>(route.params.id.toString());
|
||||
|
|
@ -19,8 +29,19 @@ const {
|
|||
hideLoader,
|
||||
dialogConfirm,
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
} = useCounterMixin();
|
||||
|
||||
/**
|
||||
* prosp
|
||||
*/
|
||||
const isProfile = defineModel<boolean>("isProfile", { required: true });
|
||||
const listPerson = defineModel<ResRecord[]>("listPerson", { required: true });
|
||||
|
||||
/**
|
||||
* ข้อมุล Table
|
||||
*/
|
||||
const keyword = ref<string>("");
|
||||
const rows = ref<ResRecord[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "type",
|
||||
|
|
@ -170,7 +191,6 @@ const columns = ref<QTableProps["columns"]>([
|
|||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
]);
|
||||
|
||||
const visibleColumns = ref<string[]>([
|
||||
"type",
|
||||
"idcard",
|
||||
|
|
@ -186,41 +206,15 @@ const visibleColumns = ref<string[]>([
|
|||
"commandNumber",
|
||||
"commandDate",
|
||||
]);
|
||||
const files = ref<any>(null);
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const keyword = ref<string>("");
|
||||
const rows = ref<ResRecord[]>([]);
|
||||
|
||||
/** uoload file */
|
||||
async function clickUpload(file: any) {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
async () => {
|
||||
showLoader();
|
||||
const selectedFile = file;
|
||||
const formData = new FormData();
|
||||
formData.append("file", selectedFile);
|
||||
await http
|
||||
.post(config.API.developmentMainTab("tab6", id.value), formData)
|
||||
.then(() => {
|
||||
success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||
getData();
|
||||
files.value = null;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
showLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันการอัปโหลดไฟล์",
|
||||
"ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?"
|
||||
);
|
||||
}
|
||||
|
||||
/** convert status to text */
|
||||
/**
|
||||
* convert status to text
|
||||
* @param val ประเภท
|
||||
*/
|
||||
function formBmaofficer(val: string) {
|
||||
switch (val) {
|
||||
case "OFFICER":
|
||||
|
|
@ -234,90 +228,23 @@ function formBmaofficer(val: string) {
|
|||
}
|
||||
}
|
||||
|
||||
/** ดึงข้อมูล */
|
||||
async function getData() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.developmentMainTab("tab6", id.value))
|
||||
.then((res) => {
|
||||
rows.value = res.data.result;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** ส่งไปบันทึกที่ทะเบียนประวัติ */
|
||||
function sendRecordRegistry() {
|
||||
// ส่งไปบันทึกที่ทะเบียนประวัติ
|
||||
dialogConfirm(
|
||||
$q,
|
||||
() => {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.developmentMainTab("tab6/done", id.value))
|
||||
.then(async () => {
|
||||
await getData();
|
||||
await success($q, "ส่งข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
});
|
||||
},
|
||||
"ยืนยันการส่งข้อมูลไปบันทึกยังทะเบียนประวัติ",
|
||||
"ต้องการยืนยันการส่งข้อมูลไปบันทึกยังทะเบียนประวัติหรือไม่"
|
||||
/**
|
||||
* function เรียกข้อมูลโครงการ
|
||||
*/
|
||||
function fetchDataProject() {
|
||||
rows.value = listPerson.value.filter(
|
||||
(e: ResRecord) => e.isProfile === isProfile.value
|
||||
);
|
||||
}
|
||||
|
||||
/** ดึงข้อมูลเมื่อคอมโพเนนต์โหลดเสร็จสมบูรณ์ */
|
||||
onMounted(() => {
|
||||
getData();
|
||||
fetchDataProject();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-toolbar style="padding: 0px" class="text-primary q-mb-xs">
|
||||
<q-file
|
||||
v-model="files"
|
||||
dense
|
||||
label="อัปโหลดไฟล์"
|
||||
outlined
|
||||
accept=".xlsx"
|
||||
hide-bottom-space
|
||||
clearable
|
||||
class="col-xs-12 col-sm-4"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="attach_file" color="blue" />
|
||||
</template>
|
||||
</q-file>
|
||||
<q-btn
|
||||
v-if="files"
|
||||
size="md"
|
||||
icon="mdi-upload"
|
||||
round
|
||||
flat
|
||||
color="blue"
|
||||
@click="clickUpload(files)"
|
||||
>
|
||||
<q-tooltip>อัปโหลดไฟล์</q-tooltip>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="rows.length > 0"
|
||||
size="md"
|
||||
icon="mdi-clipboard-account-outline"
|
||||
round
|
||||
flat
|
||||
color="public"
|
||||
@click="sendRecordRegistry()"
|
||||
>
|
||||
<q-tooltip>ส่งไปบันทึกที่ทะเบียนประวัติ</q-tooltip>
|
||||
</q-btn>
|
||||
|
||||
<q-toolbar style="padding: 0px" class="q-mb-xs">
|
||||
<q-space />
|
||||
<q-input dense outlined v-model="keyword" label="ค้นหา" class="q-mr-sm">
|
||||
<template v-slot:append>
|
||||
|
|
@ -338,56 +265,61 @@ onMounted(() => {
|
|||
option-value="name"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
class="q-mr-sm"
|
||||
/>
|
||||
</q-toolbar>
|
||||
<d-table
|
||||
ref="table"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
:paging="true"
|
||||
:filter="keyword"
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[20, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td>
|
||||
<q-icon
|
||||
v-if="props.row.isDone"
|
||||
name="mdi-check"
|
||||
color="green"
|
||||
size="xs"
|
||||
>
|
||||
<q-tooltip>ส่งไปบันทึกที่ทะเบียนประวัติแล้ว</q-tooltip>
|
||||
</q-icon>
|
||||
</q-td>
|
||||
<q-td v-for="col in props.cols" :key="col.id">
|
||||
<div v-if="col.name == 'fullName'">
|
||||
{{ props.row.prefix ? props.row.prefix : ""
|
||||
}}{{ props.row.firstName ? props.row.firstName : "" }}
|
||||
{{ props.row.lastName ? props.row.lastName : "" }}
|
||||
</div>
|
||||
<div v-else class="table_ellipsis2">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
ref="table"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
:paging="true"
|
||||
:filter="keyword"
|
||||
v-model:pagination="pagination"
|
||||
:rows-per-page-options="[20, 50, 100]"
|
||||
:visible-columns="visibleColumns"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th auto-width />
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td>
|
||||
<q-icon
|
||||
v-if="props.row.isDone"
|
||||
name="mdi-check"
|
||||
color="green"
|
||||
size="xs"
|
||||
>
|
||||
<q-tooltip>ส่งไปบันทึกที่ทะเบียนประวัติแล้ว</q-tooltip>
|
||||
</q-icon>
|
||||
</q-td>
|
||||
<q-td v-for="col in props.cols" :key="col.id">
|
||||
<div v-if="col.name == 'fullName'">
|
||||
{{ props.row.prefix ? props.row.prefix : ""
|
||||
}}{{ props.row.firstName ? props.row.firstName : "" }}
|
||||
{{ props.row.lastName ? props.row.lastName : "" }}
|
||||
</div>
|
||||
<div v-else-if="col.name === 'org'" class="table_ellipsis">
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value ? col.value : "-" }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue