ปรับ ui บันทึกผล

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-25 14:27:34 +07:00
parent d49ae13078
commit cdf697e761
4 changed files with 167 additions and 101 deletions

View file

@ -340,6 +340,7 @@ const searchcardid = () => {
v-model="employeeClass" v-model="employeeClass"
:label="`ขรก.สามัญ/ลูกจ้างประจำ`" :label="`ขรก.สามัญ/ลูกจ้างประจำ`"
@update:model-value="selectType" @update:model-value="selectType"
:disable="status !== ''"
/> />
</div> </div>
<div class="col-12 text-weight-bold text-grey"> <div class="col-12 text-weight-bold text-grey">
@ -347,7 +348,7 @@ const searchcardid = () => {
</div> </div>
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
<q-input <q-input
:disable="disbleStatus || status == 'DONE'" :disable="disbleStatus || status == 'DONE' || status == 'PENDING'"
hide-bottom-space hide-bottom-space
outlined outlined
class="inputgreen" class="inputgreen"
@ -549,7 +550,9 @@ const searchcardid = () => {
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-input <q-input
:disable="disbleStatus || status == 'DONE'" :disable="
disbleStatus || status == 'DONE' || status == 'PENDING'
"
:rules="[(val) => !!val || 'กรุณากรอกสังกัด']" :rules="[(val) => !!val || 'กรุณากรอกสังกัด']"
hide-bottom-space hide-bottom-space
dense dense
@ -575,7 +578,9 @@ const searchcardid = () => {
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">
<q-input <q-input
:disable="disbleStatus || status == 'DONE'" :disable="
disbleStatus || status == 'DONE' || status == 'PENDING'
"
:rules="[(val) => !!val || 'กรุณากรอกสังกัด']" :rules="[(val) => !!val || 'กรุณากรอกสังกัด']"
hide-bottom-space hide-bottom-space
dense dense
@ -794,7 +799,6 @@ const searchcardid = () => {
<template #trigger> <template #trigger>
<q-input <q-input
:disable="disbleStatus" :disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']"
dense dense
borderless borderless
outlined outlined
@ -833,13 +837,11 @@ const searchcardid = () => {
map-options map-options
v-model="payment" v-model="payment"
:label="`เลือกรูปแบบการจ่าย`" :label="`เลือกรูปแบบการจ่าย`"
:rules="[(val) => !!val || 'เลือกรูปแบบการจ่าย']"
/> />
</div> </div>
<div v-if="payment === 'จัดส่งทางไปรษณี'" class="col-12"> <div v-if="payment === 'จัดส่งทางไปรษณี'" class="col-12">
<q-input <q-input
:disable="disbleStatus" :disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณากรอกที่อยู่ที่จ่าย']"
label="ที่อยู่ที่จ่าย" label="ที่อยู่ที่จ่าย"
class="bg-white" class="bg-white"
dense dense

View file

@ -1,27 +1,76 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { ref, } from "vue"; import { ref, } from "vue";
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
const {
date2Thai,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
} = mixin;
export const useResultDataStore = defineStore("insigniaResult", () => { export const useResultDataStore = defineStore("insigniaResult", () => {
const insignia = ref<string>('') const insignia = ref<string>('')
const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "" }]) const insigniaOp = ref<any[]>([{ name: "ทั้งหมด", id: "" }])
const insigniaOp2 = ref<any[]>([]) const insigniaOp2 = ref<any[]>([])
const insigniaType = ref<any>() const insigniaType = ref<any>()
const invoiceType = ref<string>('all')
const invoiceTypeop = ref<any>([{ name: "ทั้งหมด", id: "all" }, { name: "ใบกำกับที่ค้างจ่าย", id: "noDate" }, { name: "ใบกำกับที่จ่ายแล้ว", id: "haveDate" }])
const rows = ref<any>([])
const listInsignia = ref<any>([])
const fetchDatainsignia = async (data: any) => { const fetchDatainsignia = async (data: any) => {
insignia.value = ''
invoiceType.value = 'all'
data.forEach((e: any) => { data.forEach((e: any) => {
insigniaOp.value.push({ name: e.name, id: e.id }) insigniaOp.value.push({ name: e.name, id: e.id })
}); });
data.forEach((e: any) => { data.forEach((e: any) => {
insigniaOp2.value.push({ name: e.name, id: e.id }) insigniaOp2.value.push({ name: e.name, id: e.id })
}); });
} }
const fetchDatainsigniaType = async (data: any) => { const fetchDatainsigniaType = async (data: any) => {
insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name })) insigniaType.value = data.map((e: any) => ({ name: e.id, label: e.name }))
} }
const fetchlistinsignia = async (data: any) => {
rows.value = [];
let alllist = await data.map((e: any) => ({
id: e.id,
citizenId: e.citizenId,
prefix: e.prefix,
position: e.position,
status: status(e.status),
dateReceive: date2Thai(e.dateReceive),
name: e.fullName,
type: e.requestInsignia,
employeeType: profileType(e.profileType),
profileType: e.profileType,
page: e.page,
number: e.no,
vatnumber: e.number,
datepay: date2Thai(e.datePayment),
typepay: e.typePayment,
address: e.address,
}));
rows.value = alllist
listInsignia.value = alllist
selectInvoice(invoiceType.value)
}
const selectInvoice = (invoice: string) => {
console.log(invoice);
if (invoice === "noDate") {
let list = listInsignia.value.filter((e: any) => e.datepay === null)
rows.value = list
} else if (invoice === "haveDate") {
let list = listInsignia.value.filter((e: any) => e.datepay !== null)
rows.value = list
} else rows.value = listInsignia.value
}
const status = (val: string) => { const status = (val: string) => {
switch (val) { switch (val) {
case "PENDING": case "PENDING":
@ -43,13 +92,18 @@ export const useResultDataStore = defineStore("insigniaResult", () => {
} }
} }
return { return {
rows,
insignia, insignia,
insigniaOp, insigniaOp,
insigniaOp2, insigniaOp2,
insigniaType, insigniaType,
invoiceType,
invoiceTypeop,
fetchDatainsignia, fetchDatainsignia,
fetchDatainsigniaType, fetchDatainsigniaType,
status, status,
profileType, profileType,
fetchlistinsignia,
selectInvoice,
}; };
}); });

View file

@ -45,6 +45,8 @@ const fecthRound = async () => {
.get(config.API.noteround()) .get(config.API.noteround())
.then((res) => { .then((res) => {
let data = res.data.result; let data = res.data.result;
// console.log(data);
selectRoundOption.value = data; selectRoundOption.value = data;
selectRound.value = data[0].id; selectRound.value = data[0].id;
// console.log(selectRound.value); // console.log(selectRound.value);
@ -57,7 +59,7 @@ const fecthInsignia = async () => {
await http await http
.get(config.API.insignia) .get(config.API.insignia)
.then((res) => { .then((res) => {
// console.log(res); console.log(res);
let data = res.data.result; let data = res.data.result;
DataStore.fetchDatainsignia(data); DataStore.fetchDatainsignia(data);
}) })
@ -80,8 +82,10 @@ const fecthInsigniaType = async () => {
const visibleColumns = ref<String[]>([ const visibleColumns = ref<String[]>([
"no", "no",
"status", "status",
"citizenId",
"name", "name",
"type", "type",
"dateReceive",
"employeeType", "employeeType",
"page", "page",
"number", "number",
@ -101,6 +105,7 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{ {
name: "status", name: "status",
align: "left", align: "left",
@ -110,6 +115,15 @@ const columns = ref<QTableProps["columns"]>([
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{
name: "citizenId",
align: "left",
label: "เลขบัตรประชาชน",
field: "citizenId",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{ {
name: "name", name: "name",
align: "left", align: "left",
@ -122,12 +136,21 @@ const columns = ref<QTableProps["columns"]>([
{ {
name: "type", name: "type",
align: "left", align: "left",
label: "ประเภทเครื่องราชฯ", label: "เครื่องราชฯ",
field: "type", field: "type",
sortable: true, sortable: true,
sort: (a: string, b: string) => sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
}, },
{
name: "dateReceive",
align: "left",
label: "วันที่ได้รับพระราชทาน",
field: "dateReceive",
sortable: true,
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{ {
name: "employeeType", name: "employeeType",
align: "left", align: "left",
@ -198,24 +221,7 @@ const columns = ref<QTableProps["columns"]>([
field: "", field: "",
}, },
]); ]);
const rows = ref<any>([
// {
// no: "1",
// status: "",
// name: " ",
// type: "",
// page: "8",
// number: "11",
// vatnumber: "5647833",
// datepay: null,
// typepay: null,
// address: " 2/3 14 ...",
// },
]);
watch(tab, () => { watch(tab, () => {
console.log(tab.value);
console.log(DataStore.insigniaType);
if (tab.value !== "doc") { if (tab.value !== "doc") {
fecthlistInsignia(); fecthlistInsignia();
} }
@ -242,24 +248,28 @@ const fecthlistInsignia = async () => {
.post(config.API.noteSearch(), data) .post(config.API.noteSearch(), data)
.then((res) => { .then((res) => {
let data = res.data.result; let data = res.data.result;
rows.value = []; console.log(data);
rows.value = data.map((e: any) => ({ DataStore.fetchlistinsignia(data);
id: e.id,
citizenId: e.citizenId, // rows.value = [];
prefix: e.prefix, // rows.value = data.map((e: any) => ({
position: e.position, // id: e.id,
status: DataStore.status(e.status), // citizenId: e.citizenId,
name: e.fullName, // prefix: e.prefix,
type: e.requestInsignia, // position: e.position,
employeeType: DataStore.profileType(e.profileType), // status: DataStore.status(e.status),
profileType: e.profileType, // dateReceive: date2Thai(e.dateReceive),
page: e.page, // name: e.fullName,
number: e.no, // type: e.requestInsignia,
vatnumber: e.number, // employeeType: DataStore.profileType(e.profileType),
datepay: date2Thai(e.datePayment), // profileType: e.profileType,
typepay: e.typePayment, // page: e.page,
address: e.address, // number: e.no,
})); // vatnumber: e.number,
// datepay: date2Thai(e.datePayment),
// typepay: e.typePayment,
// address: e.address,
// }));
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.log(err);
@ -392,38 +402,6 @@ const resetFilter = () => {
> >
<div class="q-pa-md"> <div class="q-pa-md">
<div class="row col-12 q-pb-sm q-col-gutter-x-xs"> <div class="row col-12 q-pb-sm q-col-gutter-x-xs">
<div>
<q-select
v-model="DataStore.insignia"
dense
outlined
lazy-rules
hide-bottom-space
:label="`${'เครื่องราชฯ'}`"
emit-value
map-options
option-label="name"
:options="DataStore.insigniaOp"
option-value="id"
:readonly="false"
:borderless="false"
style="min-width: 150px"
@update:model-value="selectorInsignia"
/>
</div>
<div>
<q-btn
@click="addData()"
size="12px"
flat
round
color="add"
icon="mdi-plus"
>
<q-tooltip>เพ</q-tooltip>
</q-btn>
</div>
<div> <div>
<q-file <q-file
dense dense
@ -441,27 +419,6 @@ const resetFilter = () => {
>พโหลดไฟลนทกผลการไดบพระราชทานเครองราชยสรยสภรณ</q-tooltip >พโหลดไฟลนทกผลการไดบพระราชทานเครองราชยสรยสภรณ</q-tooltip
> >
</q-file> </q-file>
<!-- <q-btn flat round color="light-blue" icon="upload">
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable v-close-popup>
<q-item-section avatar
><q-icon color="green-7" name="mdi-file-excel"
/></q-item-section>
<q-item-section
>นทกผลการไดบพระราชทานเครองราชยสรยสภรณ</q-item-section
>
</q-item>
<q-item clickable v-close-popup>
<q-item-section avatar
><q-icon color="green-7" name="mdi-file-excel"
/></q-item-section>
<q-item-section>นทกผลการจายใบกำก</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn> -->
</div> </div>
<div v-if="fileResult !== null"> <div v-if="fileResult !== null">
<q-btn <q-btn
@ -505,6 +462,61 @@ const resetFilter = () => {
<q-tooltip>พโหลดไฟลนทกผลการจายใบกำก</q-tooltip> <q-tooltip>พโหลดไฟลนทกผลการจายใบกำก</q-tooltip>
</q-btn> </q-btn>
</div> </div>
</div>
<div class="row col-12 q-pb-sm q-col-gutter-x-xs">
<div>
<q-select
v-model="DataStore.insignia"
dense
outlined
lazy-rules
hide-bottom-space
:label="`${'เครื่องราชฯ'}`"
emit-value
map-options
option-label="name"
:options="DataStore.insigniaOp"
option-value="id"
:readonly="false"
:borderless="false"
style="min-width: 150px"
@update:model-value="selectorInsignia"
/>
</div>
<div>
<q-select
v-model="DataStore.invoiceType"
dense
outlined
lazy-rules
hide-bottom-space
:label="`${'ใบกำกับ'}`"
emit-value
map-options
option-label="name"
:options="DataStore.invoiceTypeop"
option-value="id"
:readonly="false"
:borderless="false"
style="min-width: 150px"
@update:model-value="
DataStore.selectInvoice(DataStore.invoiceType)
"
/>
</div>
<div>
<q-btn
@click="addData()"
size="12px"
flat
round
color="add"
icon="mdi-plus"
>
<q-tooltip>เพ</q-tooltip>
</q-btn>
</div>
<q-space /> <q-space />
@ -549,7 +561,7 @@ const resetFilter = () => {
</div> </div>
</div> </div>
<d-table <d-table
:rows="rows" :rows="DataStore.rows"
:columns="columns" :columns="columns"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
:filter="filter" :filter="filter"

View file

@ -7,9 +7,7 @@
<q-card flat bordered class="col-12 q-my-sm q-mt-sm"> <q-card flat bordered class="col-12 q-my-sm q-mt-sm">
<q-stepper v-model="step" ref="stepper" color="primary" animated class="step" header-class="bg-grey-1"> <q-stepper v-model="step" ref="stepper" color="primary" animated class="step" header-class="bg-grey-1">
<q-step :name="1" title="รายละเอียดการออกคำสั่ง" prefix="1" :done="step > 1" :header-nav="step > 1" /> <q-step :name="1" title="รายละเอียดการออกคำสั่ง" prefix="1" :done="step > 1" :header-nav="step > 1" />
<q-step :name="2" title="เลือกรายชื่อ" prefix="2" :done="step > 2" :header-nav="step > 2" /> <q-step :name="2" title="เลือกรายชื่อ" prefix="2" :done="step > 2" :header-nav="step > 2" />
<q-step :name="3" title="เลือกรายชื่อส่งสำเนาคำสั่ง" prefix="3" :done="step > 3" :header-nav="step > 3" /> <q-step :name="3" title="เลือกรายชื่อส่งสำเนาคำสั่ง" prefix="3" :done="step > 3" :header-nav="step > 3" />
<q-step :name="4" title="รายละเอียดคำสั่งและแนบท้าย" prefix="4" :done="step > 4" :header-nav="step > 4" /> <q-step :name="4" title="รายละเอียดคำสั่งและแนบท้าย" prefix="4" :done="step > 4" :header-nav="step > 4" />
<template v-slot:message> <template v-slot:message>