ปรับ Code เคื่องราช

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-29 10:59:58 +07:00
parent 51d072ccc0
commit 240862be2c
13 changed files with 548 additions and 885 deletions

View file

@ -20,22 +20,18 @@ const {
hideLoader,
notifyError,
} = mixin;
const status = ref<status>("");
const status = ref<string>("");
const Advertise = ref<string>("");
const issue = ref<string>("");
const brand = ref<string>("");
const cardid = ref<string>("");
const prefixId = ref<string>("");
const fullName = ref<string>("");
const volume = ref<string>("");
const episode = ref<string>("");
const duty = ref<string>("");
const announced = ref<string>("");
const firstname = ref<string>("");
const lastname = ref<string>("");
const position = ref<string>("");
const invoice = ref<string | null>(null);
const payment = ref<string>("");
const addressPayment = ref<string | null>(null);
const affiliationRequest = ref<string>("");
@ -56,46 +52,6 @@ const paymentOp = [
{ label: "จัดส่งทางไปรษณี", value: "จัดส่งทางไปรษณี" },
{ label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" },
];
const volumeOp = [
{ label: "เล่มที่", value: "xx1" },
{ label: "เล่มที่2", value: "xx2" },
{ label: "เล่มที่3", value: "xx3" },
];
const episodeOp = [
{ label: "ตอนที่1", value: "xx1" },
{ label: "ตอนที่2", value: "xx2" },
{ label: "ตอนที่3", value: "xx3" },
];
const dutyOp = [
{ label: "หน้าที่1", value: "xx1" },
{ label: "หน้าที่2", value: "xx2" },
{ label: "หน้าที่3", value: "xx3" },
];
const announcedOp = [
{ label: "ลำดับที่1", value: "xx1" },
{ label: "ลำดับที่2", value: "xx2" },
{ label: "ลำดับที่3", value: "xx3" },
];
const affiliationRequestOp = [
{ label: "สังกัด1", value: "xx1" },
{ label: "สังกัด2", value: "xx2" },
{ label: "สังกัด3", value: "xx3" },
];
const affiliationReceivedOp = [
{ label: "สังกัด4", value: "xx4" },
{ label: "สังกัด5", value: "xx5" },
{ label: "สังกัด6", value: "xx6" },
];
const prefixOp = [
{ label: "นาย", value: "mr" },
{ label: "นางสาว", value: "miss" },
{ label: "นาง", value: "mrs" },
];
const positionOp = [
{ label: "ตำแหน่ง1", value: "xxx1" },
{ label: "ตำแหน่ง2", value: "xxx2" },
{ label: "ตำแหน่ง3", value: "xxx3" },
];
const clearDateExam = () => {
receivedate.value = null;
announceDate.value = null;
@ -141,12 +97,12 @@ watch(props, () => {
episode.value = "";
duty.value = "";
announced.value = "";
// invoice.value = "";
invoiceDate.value = null;
payment.value = "";
if (props.action === "editData") {
fectDataByid(props.personId);
if (props.personId !== undefined) {
if (props.action === "editData") {
fectDataByid(props.personId);
}
}
}
});
@ -205,11 +161,10 @@ const findlist = async (id: string) => {
criterias: data,
})
.then((res) => {
// console.log(res.data.result);
listPerson.value = res.data.result;
})
.catch((e) => {
console.log(e);
messageError($q, e);
})
.finally(() => {
hideLoader();
@ -217,7 +172,9 @@ const findlist = async (id: string) => {
};
const fectDataByid = async (id: string) => {
showLoader();
employeeClass.value = "";
if (props.profileType !== undefined) {
employeeClass.value = props.profileType.toString();
}
await http
.get(config.API.noteByid(id))
.then((res) => {
@ -240,7 +197,6 @@ const fectDataByid = async (id: string) => {
payment.value = data.typePayment;
addressPayment.value = data.address;
status.value = data.status;
employeeClass.value = props.profileType;
})
.catch((err) => {
console.log(err);
@ -264,7 +220,6 @@ const clickSave = async () => {
section: episode.value, //
page: duty.value, //
no: announced.value,
// : invoice.value,
datePayment: invoiceDate.value, //
typePayment: payment.value, //
address: addressPayment.value, //
@ -278,20 +233,21 @@ const clickSave = async () => {
});
};
const addNote = async (body: any) => {
await http
.put(config.API.noteAdd(props.roundId), body)
.then(() => {
success($q, "เพิ่มราชชื่อสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
props.close();
});
if (props.roundId !== undefined) {
await http
.put(config.API.noteAdd(props.roundId), body)
.then(() => {
success($q, "เพิ่มราชชื่อสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
props.close();
});
}
};
const searchcardid = () => {
// console.log(cardid.value);
if (cardid.value.length === 13) {
let data = listPerson.value.find((e: any) => e.citizenId === cardid.value);
if (data) {
@ -314,7 +270,8 @@ const searchcardid = () => {
dense
@click="props.close"
style="color: #ff8080; background-color: #ffdede"
/>
><q-tooltip></q-tooltip></q-btn
>
</q-toolbar>
<q-separator />
@ -368,24 +325,8 @@ const searchcardid = () => {
mask="#############"
@keyup="searchcardid"
/>
<!-- :rules="[(val:any) =>val.length != 13 ||`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,]" -->
</div>
<!-- <div class="col-xs-12 col-sm-4">
<q-select
:rules="[(val) => !!val || 'กรุณาเลือกคำนำหน้าชื่อ']"
hide-bottom-space
:options="prefixOp"
class="col-xs-12 col-sm-6 inputgreen"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="prefixId"
:label="`คำนำหน้าชื่อ`"
:disable="disbleStatus"
/>
</div> -->
<div class="col-xs-6 col-sm-4">
<q-input
disable
@ -412,35 +353,10 @@ const searchcardid = () => {
v-model="position"
:label="`ตำเเหน่ง`"
/>
<!-- <q-select
:disable="disbleStatus"
hide-bottom-space
:options="positionOp"
class="col-xs-12 col-sm-6 inputgreen"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="position"
:label="`ตำเเหน่ง`"
/> -->
</div>
<div class="col-6"></div>
<!-- <div class="col-xs-6 col-sm-3 col-md-5">
<q-input
hide-bottom-space
outlined
dense
lazy-rules
borderless
v-model="lastname"
:rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
:label="`${'นามสกุล'}`"
/>
</div> -->
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
รายละเอยดตำเเหน
@ -462,18 +378,6 @@ const searchcardid = () => {
/>
</div>
<div class="col-xs-12 col-sm-6">
<!-- <q-input
:disable="disbleStatus"
:rules="[
(val) => !!val || 'กรุณากรอกชื่อชั้นตราเครื่องราชอิสริยาภรณ์',
]"
hide-bottom-space
dense
borderless
outlined
v-model="brand"
label="ชั้นตราเครื่องราชอิสริยาภรณ์"
/> -->
<q-select
:disable="disbleStatus || status == 'DONE'"
v-model="brand"
@ -563,20 +467,6 @@ const searchcardid = () => {
v-model="affiliationRequest"
label="สังกัด ณ วันที่ขอพระราชทานเครื่องราชอิสริยาภรณ์"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกสังกัด']"
hide-bottom-space
:options="affiliationRequestOp"
class="col-xs-12 col-sm-6"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="affiliationRequest"
:label="`สังกัด ณ วันที่ขอพระราชทานเครื่องราชอิสริยาภรณ์`"
/> -->
</div>
<div class="col-xs-12 col-sm-6">
<q-input
@ -591,19 +481,6 @@ const searchcardid = () => {
v-model="affiliationReceived"
label="สังกัด ณ วันที่ได้รับประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์"
/>
<!-- <q-select
:rules="[(val) => !!val || 'กรุณาเลือกสังกัด']"
hide-bottom-space
:options="affiliationReceivedOp"
class="col-xs-12 col-sm-6"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="affiliationReceived"
:label="`สังกัด ณ วันที่ได้รับประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์`"
/> -->
</div>
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
@ -665,21 +542,6 @@ const searchcardid = () => {
:label="`เล่มที่`"
:rules="[(val) => !!val || 'กรุณากรอกเล่มที่']"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกเล่มที่']"
hide-bottom-space
:options="volumeOp"
class="col-xs-12 col-sm-6"
dense
borderless
option-label="label"
option-value="value"
outlined
emit-value
v-model="volume"
:label="`เล่มที่`"
/> -->
</div>
<div class="col-xs-12 col-sm-4">
<q-input
@ -694,21 +556,6 @@ const searchcardid = () => {
:label="`ตอนที่`"
:rules="[(val) => !!val || 'กรุณากรอกตอนที่']"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกตอนที่']"
hide-bottom-space
:options="episodeOp"
class="col-xs-12 col-sm-6"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="episode"
emit-value
:label="`ตอนที่`"
/> -->
</div>
<div class="col-xs-12 col-sm-6">
<q-input
@ -723,21 +570,6 @@ const searchcardid = () => {
:label="`หน้าที่`"
:rules="[(val) => !!val || 'กรุณากรอกหน้าที่']"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกหน้าที่']"
hide-bottom-space
:options="dutyOp"
class="col-xs-12 col-sm-6"
dense
emit-value
borderless
option-label="label"
option-value="value"
outlined
v-model="duty"
:label="`หน้าที่`"
/> -->
</div>
<div class="col-xs-12 col-sm-6">
<q-input
@ -752,36 +584,11 @@ const searchcardid = () => {
:label="`ลำดับที่`"
:rules="[(val) => !!val || 'กรุณากรอกลำดับที่']"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกลำดับที่']"
hide-bottom-space
:options="announcedOp"
class="col-xs-12 col-sm-6"
dense
emit-value
borderless
option-label="label"
option-value="value"
outlined
v-model="announced"
:label="`ลำดับที่`"
/> -->
</div>
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
ผลการจายใบกำก
</div>
<!-- <div class="col-xs-12 col-sm-4"> -->
<!-- :rules="[(val) => !!val || 'กรุณากรแกหมายเล่นใบกำกับ']" -->
<!-- <q-input
dense
borderless
outlined
v-model="invoice"
label="หมายเลขใบกํากับ"
/>
</div> -->
<div class="col-xs-12 col-sm-6">
<datepicker
menu-class-name="modalfix"
@ -860,7 +667,9 @@ const searchcardid = () => {
<q-separator />
<div class="q-pa-md">
<div class="row justify-end">
<q-btn label="บันทึก" @click="clickSave" color="public" />
<q-btn label="บันทึก" @click="clickSave" color="public"
><q-tooltip>นท</q-tooltip></q-btn
>
</div>
</div>
</q-card>

View file

@ -1,18 +1,17 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
import { useCounterMixin } from '@/stores/mixin'
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin()
const { success, messageError,hideLoader,dialogConfirm } = mixin
const mixin = useCounterMixin();
const { success, messageError, hideLoader, dialogConfirm, showLoader } = mixin;
const fileUpload = ref<any>(null);
const reason = ref<string>("");
const file = ref<string>("");
const documentTitle = ref<string>("");
const $q = useQuasar();
const $q = useQuasar();
const filterKeyword = ref<string>("");
const filterDoc = ref<any>(null);
@ -55,9 +54,9 @@ const colums2 = ref<QTableProps["columns"]>([
const rows2 = ref<any>([]);
interface TypeData {
fileName:string
reason:string
pathName:string
fileName: string;
reason: string;
pathName: string;
}
const props = defineProps({
roundId: {
@ -66,41 +65,39 @@ const props = defineProps({
});
const getRequest = async () => {
showLoader();
await http
.get(config.API.requestDocNote(props.roundId as string))
.then((res:any) =>{
console.log(res)
const data = res.data.result
console.log(data)
data.map((item:TypeData) =>{
rows2.value.push({
fileName:item.fileName,
annotation:item.reason,
file:item.pathName
})
}
)
console.log(rows2.value)
})
.catch((e) => {
.get(config.API.requestDocNote(props.roundId as string))
.then((res: any) => {
const data = res.data.result;
data.map((item: TypeData) => {
rows2.value.push({
fileName: item.fileName,
annotation: item.reason,
file: item.pathName,
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
};
const putRequest = () => {
const dataAppend = new FormData()
dataAppend.append("Name",documentTitle.value)
dataAppend.append("Reason",reason.value)
dataAppend.append("File",fileUpload.value)
http
.put(config.API.requestDocNote(props.roundId as string),dataAppend)
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
const putRequest = async () => {
showLoader();
const dataAppend = new FormData();
dataAppend.append("Name", documentTitle.value);
dataAppend.append("Reason", reason.value);
dataAppend.append("File", fileUpload.value);
await http
.put(config.API.requestDocNote(props.roundId as string), dataAppend)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
@ -110,10 +107,9 @@ const putRequest = () => {
getRequest();
hideLoader();
});
}
onMounted(async() => {
console.log(props.roundId);
await getRequest()
};
onMounted(async () => {
await getRequest();
});
const resetFilterRef = () => {
filterKeyword.value = "";
@ -126,8 +122,8 @@ const pagination = ref({
rowsPerPage: 10,
});
const save = () => {
dialogConfirm($q,()=>putRequest())
}
dialogConfirm($q, () => putRequest());
};
</script>
<template>
<Transition>
@ -171,7 +167,9 @@ const save = () => {
/>
</div>
<div class="col-12 flex justify-end">
<q-btn label="บันทึก" @click="save" color="public" />
<q-btn label="บันทึก" @click="save" color="public">
<q-tooltip>นท</q-tooltip></q-btn
>
</div>
<div class="row col-12">
<q-space />
@ -238,13 +236,15 @@ const save = () => {
{{ props.row.fileName }}
</q-td>
<q-td key="annotation" :props="props">
{{ props.row.annotation !== null ? props.row.annotation:"-"}}
{{
props.row.annotation !== null ? props.row.annotation : "-"
}}
</q-td>
<q-td auto-width>
<q-btn
type="a"
:href="props.row.file"
target="_blank"
type="a"
:href="props.row.file"
target="_blank"
dense
size="14px"
flat