Merge branch 'develop' into NiceDev

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-12-13 15:26:30 +07:00
commit 74b68a7f65
9 changed files with 503 additions and 11 deletions

View file

@ -71,6 +71,14 @@ const items = ref<any>([
path: "/retire",
active: false,
},
{
icon: "mdi-scale-balance",
title: "อุทธรณ์ร้องทุกข์",
sub: "ทำเรื่องขออุทธรณ์ หรือร้องทุกข์",
color: "green-3",
path: "/appeal-complain",
active: false,
},
])
onMounted(async () => {
await fetchlistInbox()

View file

@ -36,13 +36,16 @@ const formDataSick = reactive<any>({
leaveEndDate: null,
halfDay: "day",
leaveTotal: "",
leaveLast: "",
leaveLast: null,
leaveNumber: "",
leaveAddress: "",
leaveDetail: "",
leaveDocument: [],
})
// leaveLast Date2thai
const leave2Thai = dataStore.leaveLast != null ? date2Thai(dataStore.leaveLast) : null
/** ตัวแปร ref สำหรับแสดง validate */
const leaveWroteRef = ref<object | null>(null)
const leaveStartDateRef = ref<object | null>(null)
@ -320,7 +323,7 @@ const isReadOnly = computed(() => {
outlined
ref="leaveLastRef"
for="leaveLastRef"
v-model="dataStore.leaveLast"
v-model="leave2Thai"
label="ลาครั้งสุดท้ายเมื่อวันที่"
readonly
hide-bottom-space

View file

@ -42,6 +42,9 @@ const formDataBirth = reactive<any>({
leaveDocument: [],
})
// leaveLast Date2thai
const leave2Thai = dataStore.leaveLast != null ? date2Thai(dataStore.leaveLast) : null
/** ตัวแปร ref สำหรับแสดง validate */
const leaveWroteRef = ref<object | null>(null)
const leaveStartDateRef = ref<object | null>(null)
@ -287,7 +290,7 @@ async function saveFormData() {
outlined
ref="leaveLastRef"
for="leaveLastRef"
v-model="dataStore.leaveLast"
v-model="leave2Thai"
label="ลาครั้งสุดท้ายเมื่อวันที่"
readonly
hide-bottom-space

View file

@ -72,7 +72,7 @@ onMounted(async () => {
</datepicker>
<q-input class="col-12 col-sm-4" dense bg-color="white" outlined readonly v-model="dataStore.typeLeave" label="เรื่อง" />
<q-input class="col-12 col-sm-4" dense outlined readonly bg-color="white" v-model="dataStore.dear" label="เรียน" />
<q-input class="col-12 col-sm-3" dense outlined readonly bg-color="white" v-model="dataStore.fullname" label="ชื่อผู้ยื่นขอ" />
<q-input class="col-12 col-sm-3" dense outlined readonly bg-color="white" v-model="dataStore.fullName" label="ชื่อผู้ยื่นขอ" />
<q-input class="col-12 col-sm-3" dense outlined readonly bg-color="white" v-model="dataStore.positionName" label="ตำแหน่งผู้ยื่นขอ" />
<q-input class="col-12 col-sm-3" dense outlined readonly bg-color="white" v-model="dataStore.positionLevelName" label="ระดับผู้ยื่นขอ" />
<q-input class="col-12 col-sm-3" dense outlined readonly bg-color="white" v-model="dataStore.organizationName" label="สังกัดผู้ยื่นขอ" />

View file

@ -184,7 +184,6 @@ export const useLeaveStore = defineStore("Leave", () => {
typeLeave.value = convertSubtitleInfo2(subitem)
}
typeId.value = convertId(item)
console.log(typeId.value)
}
/**
@ -193,7 +192,7 @@ export const useLeaveStore = defineStore("Leave", () => {
* @returns
*/
function convertSubtitle(val: string) {
return options.value.find(x => x.id == val)?.name
return options.value.find(x => x.code == val)?.name
}
/**
@ -229,7 +228,7 @@ export const useLeaveStore = defineStore("Leave", () => {
const dateSendLeave = ref<Date>() //วันที่ยื่นใบลา
const leaveTypeName = ref<string>("") //Name ประเภทการลา
const dear = ref<string>("") //เรียน
const fullname = ref<string>("") //คำนำหน้า ชื่อ นามสกุล ผู้ยื่นขอ
const fullName = ref<string>("") //คำนำหน้า ชื่อ นามสกุล ผู้ยื่นขอ
const positionName = ref<string>("") //ตำแหน่งผู้ยื่นขอ
const positionLevelName = ref<string>("") //ระดับผู้ยื่นขอ
const organizationName = ref<string>("") //สังกัดผู้ยื่นขอ
@ -241,7 +240,7 @@ export const useLeaveStore = defineStore("Leave", () => {
const dateAppoint = ref<Date>() //วันที่เข้ารับราชการ
const salary = ref<number>(0) //เงินเดือนปัจจุบัน
const salaryText = ref<string>("") //เงินเดือนปัจจุบัน(ภาษาไทย)
const leaveLast = ref<string>("")
const leaveLast = ref<Date>()
const restDayCurrentTotal = ref<string>("")
//ดึงข้อมูล profile จาก API
@ -254,7 +253,7 @@ export const useLeaveStore = defineStore("Leave", () => {
dateSendLeave.value = data.dateSendLeave
leaveTypeName.value = data.leaveTypeName
dear.value = data.dear
fullname.value = data.fullname
fullName.value = data.fullName
positionName.value = data.positionName
positionLevelName.value = data.positionLevelName
organizationName.value = data.organizationName
@ -266,7 +265,7 @@ export const useLeaveStore = defineStore("Leave", () => {
dateAppoint.value = data.dateAppoint
salary.value = data.salary
salaryText.value = data.salaryText
leaveLast.value = data.leaveLast
leaveLast.value = data.leaveLast && date2Thai(data.leaveLast)
restDayCurrentTotal.value = data.restDayCurrentTotal
console.log(data)
})
@ -303,7 +302,7 @@ export const useLeaveStore = defineStore("Leave", () => {
dateSendLeave,
leaveTypeName,
dear,
fullname,
fullName,
positionName,
positionLevelName,
organizationName,

View file

@ -0,0 +1,36 @@
/**
* Router
*/
const mainPage = () => import("@/modules/06_appealComplain/views/Main.vue");
const addPage = () => import("@/modules/06_appealComplain/views/Add.vue");
export default [
{
path: "/appeal-complain",
name: "appealComplain",
component: mainPage,
meta: {
Auth: true,
Key: [7],
},
},
{
path: "/appeal-complain/add",
name: "appealComplainAdd",
component: addPage,
meta: {
Auth: true,
Key: [7],
},
},
{
path: "/appeal-complain/:id",
name: "appealComplainView",
component: addPage,
meta: {
Auth: true,
Key: [7],
},
},
];

View file

@ -0,0 +1,5 @@
import { defineStore } from "pinia";
export const useAppealComplainStore = defineStore("appealComplainStore", () => {
return {};
});

View file

@ -0,0 +1,205 @@
<script setup lang="ts">
import { ref, onMounted } from "vue"
import { useQuasar } from "quasar"
import { useRouter, useRoute } from "vue-router"
import { useCounterMixin } from "@/stores/mixin"
import http from "@/plugins/http"
import config from "@/app.config"
import type { QForm } from "quasar"
const router = useRouter()
const $q = useQuasar()
const mixin = useCounterMixin()
const myform = ref<QForm | null>(null)
const { fails, success, messageError, showLoader, hideLoader } = mixin
/**
* วแปรทใชงาน
*/
const route = useRoute()
const files = ref<any>()
const tranferOrg = ref("")
const noteReason = ref("")
const id = ref<string>("")
const nameFile = ref<string>("")
const routeName = router.currentRoute.value.name
/**
* เรยกฟงกนทงหมดตอนเรยกใชไฟล
*/
onMounted(() => {
if (route.params.id !== undefined) {
id.value = route.params.id.toString()
fecthDataTransfer(id.value)
}
})
const saveData = async () => {
if (myform.value != null) {
await myform.value.validate().then(async (saveDataTest: Boolean) => {
if (saveDataTest) {
saveTransfer()
}
})
}
}
//
const saveTransfer = () => {
$q.dialog({
title: "ยืนยันการยื่นข้อมูลการโอน",
message: "ต้องการยื่นข้อมูลการโอนนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
if (files.value == undefined) {
fails($q, "กรุณากรอกอัพโหลดเอกสารเพิ่มเติม")
} else {
createTransfer()
}
})
.onCancel(() => {})
.onDismiss(() => {})
}
/**
* งกนสรางขอโอน
*/
const createTransfer = async () => {
const formData = new FormData()
const blob = files.value.slice(0, files.value[0].size)
const newFile = new File(blob, nameFile.value, {
type: files.value[0].type,
})
formData.append("Organization", tranferOrg.value)
formData.append("Reason", noteReason.value)
formData.append("file", newFile)
await http
.post(config.API.listtransfer(), formData)
.then((res: any) => {
success($q, "บันทึกข้อมูลสำเร็จ")
router.push(`/transfer`)
})
.catch((e: any) => {
messageError($q, e)
})
}
/**
* งกนเรยกขอมลจาก Api
* @param id ไอดของขอม
*/
const fecthDataTransfer = async (id: string) => {
showLoader()
await http
.get(config.API.transferByid(id))
.then((res: any) => {
let data = res.data.result
tranferOrg.value = data.organization
noteReason.value = data.reason
files.value = data.docs
})
.catch((e: any) => {
messageError($q, e)
})
.finally(() => {
hideLoader()
})
}
/**
* งกนดาวโหลดอพโหลดไฟล
*/
const fileDocDataUpload = ref<File[]>([])
const filesNull = () => {
files.value = null
}
//
const fileUploadDoc = async (file: any) => {
fileDocDataUpload.value.push(file)
nameFile.value = file[0].name
files.value = file
}
</script>
<template>
<div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white col-12 row items-center">
<q-btn icon="mdi-arrow-left" unelevated round dense flat color="primary" class="q-mr-sm" @click="router.go(-1)" />
<div v-if="routeName == 'addTransfer'">เพิ่มเรื่องขอโอน</div>
<div v-else>รายละเอียดเรื่องขอโอน</div>
</div>
<q-form ref="myform" class="col-12">
<q-card bordered>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12">
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-input
class="col-12"
dense
outlined
v-model="tranferOrg"
label="หน่วยงานที่ขอโอนไป"
:readonly="routeName != 'addTransfer'"
:rules="[(val:string) => !!val || `${'กรุณากรอกหน่วยงานที่ขอโอนไป'}`]"
/>
<q-input
class="col-12"
dense
outlined
v-model="noteReason"
label="เหตุผล"
type="textarea"
:readonly="routeName != 'addTransfer'"
:rules="[(val:string) => !!val || `${'กรุณากรอกเหตุผล'}`]"
/>
<div class="col-12 row" v-if="routeName == 'addTransfer'">
<q-uploader
bordered
flat
class="col-12"
accept=".jpg,.png,.pdf,.csv,.doc"
url="http://localhost:4444/upload"
label="เอกสารเพิ่มเติม"
type="file"
@added="fileUploadDoc"
@removed="filesNull"
/>
</div>
<div class="col-12 row" v-if="routeName != 'addTransfer'">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
<div class="q-pl-sm text-weight-bold text-dark">เอกสารเพมเต</div>
</div>
<q-card bordered flat class="full-width">
<q-list separator>
<q-item v-for="file in files" :key="file.key" class="q-my-xs">
<q-item-section>
<q-item-label class="full-width ellipsis">
{{ file.fileName }}
</q-item-label>
<q-item-label caption> </q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-card>
</div>
</div>
</div>
</div>
<q-separator v-if="routeName == 'addTransfer'" />
<div class="row col-12 q-pa-md" v-if="routeName == 'addTransfer'">
<q-space />
<q-btn unelevated dense class="q-px-md items-center" color="primary" label="ยื่นเรื่องขอโอน" @click="saveData" />
</div>
</q-card>
</q-form>
</div>
</div>
</template>

View file

@ -0,0 +1,233 @@
<script setup lang="ts">
import type { QTableProps } from "quasar";
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/02_transfer/store";
import http from "@/plugins/http";
import config from "@/app.config";
import Table from "@/components/Table.vue";
const transferData = useTransferDataStore();
const { statusText } = transferData;
const router = useRouter();
const $q = useQuasar();
const mixin = useCounterMixin();
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
/**
* งค pagination
*/
const initialPagination = ref({
rowsPerPage: 0,
});
/**
* เพมหวขอตาราง
*/
const filter = ref<string>("");
const rows = ref<any>([]);
const visibleColumns = ref<String[]>([
"no",
"date",
"position",
"noPos",
"level",
"salary",
"transfer",
"statustext",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:5px;",
},
{
name: "date",
align: "left",
label: "วันที่",
sortable: true,
field: "date",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:15%;",
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:15%;",
},
{
name: "noPos",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "noPos",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "level",
align: "left",
label: "อันดับ/ระดับ",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "salary",
align: "left",
label: "เงินเดือน",
sortable: true,
field: "salary",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "transfer",
align: "left",
label: "หน่วยงานที่ขอโอนไป",
sortable: true,
field: "transfer",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "statustext",
align: "left",
label: "สถานะ",
sortable: true,
field: "statustext",
headerStyle: "font-size: 14px",
style: "font-size: 14px; width:10%;",
},
]);
/**
* เรยกฟงกนทงหมดตอนเรยกใชไฟล
*/
onMounted(async () => {
await fecthListTransfer();
});
//
const fecthListTransfer = async () => {
// showLoader();
// await http
// .get(config.API.listUserTransfer())
// .then((res: any) => {
// let data = res.data.result;
// rows.value = data.map((e: any) => ({
// id: e.id,
// date: date2Thai(e.createdAt),
// status: e.status,
// statustext: statusText(e.status),
// position: e.organizationPositionOld,
// noPos: e.posNo,
// level: e.positionLevel,
// salary: e.salary,
// transfer: e.organization,
// }));
// })
// .catch((e: any) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
};
/**
* งกนกดเพมไปหนาเพ
*/
const clickAdd = async () => {
router.push(`/appeal-complain/add`);
};
/**
* กดเพอยอนกล
*/
const clickBack = () => {
router.push(`/`);
};
</script>
<template>
<div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle text-white col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="clickBack"
/>
ทธรณองทกข
</div>
<div class="col-12">
<q-card bordered class="q-pa-md">
<Table
style="max-height: 80vh"
:rows="rows"
:columns="columns"
:filter="filter"
:visible-columns="visibleColumns"
v-model:inputfilter="filter"
v-model:inputvisible="visibleColumns"
:pagination="initialPagination"
:inputShow="false"
:add="clickAdd"
:titleText="''"
>
<template #columns="props">
<q-tr
:props="props"
class="cursor-pointer"
@click="router.push(`/transfer/` + props.row.id)"
>
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="date" :props="props">
{{ props.row.date }}
</q-td>
<q-td key="position" :props="props">
{{ props.row.position }}
</q-td>
<q-td key="noPos" :props="props">
{{ props.row.noPos }}
</q-td>
<q-td key="level" :props="props">
{{ props.row.level }}
</q-td>
<q-td key="salary" :props="props">
{{ props.row.salary }}
</q-td>
<q-td key="transfer" :props="props">
{{ props.row.transfer }}
</q-td>
<q-td key="statustext" :props="props">
{{ props.row.statustext }}
</q-td>
</q-tr>
</template>
</Table>
</q-card>
</div>
</div>
</div>
</template>
<style></style>