Merge branch 'develop' into working
# Conflicts: # src/interface/request/main/main.ts # src/modules/09_leave/router.ts
This commit is contained in:
commit
511fe670ae
6 changed files with 583 additions and 12 deletions
216
src/modules/09_leave/components/3_WorkTime/DialogForm.vue
Normal file
216
src/modules/09_leave/components/3_WorkTime/DialogForm.vue
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive } from "vue";
|
||||
import type { formData } from "@/modules/09_leave/interface/request/workTime";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const formData = reactive<formData>({
|
||||
morning: "07:30",
|
||||
morningEnd: "12:00",
|
||||
afternoon: "12:00",
|
||||
afternoonEnd: "15:30",
|
||||
reason: "",
|
||||
status: false,
|
||||
});
|
||||
|
||||
const props = defineProps({
|
||||
modal: Boolean,
|
||||
editCheck: Boolean,
|
||||
closeDialog: Function,
|
||||
detailData: Object,
|
||||
});
|
||||
|
||||
function clickSave() {
|
||||
if (props.closeDialog) {
|
||||
props.closeDialog();
|
||||
}
|
||||
console.log("save", formData);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<q-dialog v-model="props.modal" persistent>
|
||||
<q-card style="min-width: 350px" class="bg-grey-11">
|
||||
<DialogHeader
|
||||
:tittle="
|
||||
!editCheck
|
||||
? 'เพิ่มรอบการปฏิบัติงาน'
|
||||
: props.detailData
|
||||
? `แก้ไขรอบ ${props.detailData.round}`
|
||||
: ''
|
||||
"
|
||||
:close="closeDialog"
|
||||
/>
|
||||
<q-separator color="grey-4" />
|
||||
|
||||
<div
|
||||
class="col q-ma-md q-pa-sm bg-white border_custom text-weight-medium"
|
||||
>
|
||||
<p style="color: #21ba45; font-size: 16px">ครึ่งเช้า</p>
|
||||
<div class="row justify-between q-my-sm items-center">
|
||||
<p class="q-ma-none">เวลาเข้างาน</p>
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
:outlined="!$props.editCheck"
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="formData.morning"
|
||||
hide-bottom-space
|
||||
type="text"
|
||||
|
||||
/>
|
||||
</div>
|
||||
<q-separator inset />
|
||||
<div class="row items-center q-my-sm justify-between">
|
||||
<p class="q-ma-none">เวลาออกงาน</p>
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
:outlined="!$props.editCheck"
|
||||
dense
|
||||
v-model="formData.morningEnd"
|
||||
lazy-rules
|
||||
borderless
|
||||
hide-bottom-space
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="col q-ma-md q-pa-sm bg-white border_custom text-weight-medium"
|
||||
>
|
||||
<p style="color: #21ba45; font-size: 16px">ครึ่งบ่าย</p>
|
||||
<div class="row justify-between q-my-sm items-center">
|
||||
<p class="q-ma-none">เวลาเข้างาน</p>
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
:outlined="!$props.editCheck"
|
||||
dense
|
||||
lazy-rules
|
||||
borderless
|
||||
v-model="formData.afternoon"
|
||||
hide-bottom-space
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<q-separator inset />
|
||||
<div class="row items-center q-my-sm justify-between">
|
||||
<p class="q-ma-none">เวลาออกงาน</p>
|
||||
<q-input
|
||||
class="inputgreen"
|
||||
:outlined="!$props.editCheck"
|
||||
dense
|
||||
v-model="formData.afternoonEnd"
|
||||
lazy-rules
|
||||
borderless
|
||||
hide-bottom-space
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<q-input
|
||||
class="col-12 bg-white q-ma-md"
|
||||
outlined
|
||||
stack-label
|
||||
v-model="formData.reason"
|
||||
label="คำอธิบาย"
|
||||
hide-bottom-space
|
||||
type="textarea"
|
||||
></q-input>
|
||||
<div
|
||||
class="col q-ma-md q-pa-sm bg-white border_custom text-weight-medium"
|
||||
>
|
||||
<div class="row items-center q-my-sm justify-between">
|
||||
<p class="q-ma-none">สถานะการใช้งาน</p>
|
||||
<label class="toggle-control">
|
||||
<input type="checkbox" v-model="formData.status" />
|
||||
<span class="control"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator color="grey-4" />
|
||||
<div class="q-pa-md">
|
||||
<div class="row justify-end">
|
||||
<q-btn
|
||||
id="onSubmit"
|
||||
type="submit"
|
||||
flat
|
||||
round
|
||||
@click="clickSave"
|
||||
color="secondary"
|
||||
icon="mdi-content-save-outline"
|
||||
><q-tooltip>{{ !props.editCheck ? 'บันทึกข้อมูล':'บันทึกแก้ไขข้อมูล' }}</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.border_custom {
|
||||
border-radius: 6px !important;
|
||||
border: 1px solid #e1e1e1;
|
||||
}
|
||||
$toggle-background-color-on: #24b047;
|
||||
$toggle-background-color-off: darkgray;
|
||||
$toggle-control-color: white;
|
||||
$toggle-width: 40px;
|
||||
$toggle-height: 25px;
|
||||
$toggle-gutter: 3px;
|
||||
$toggle-radius: 50%;
|
||||
$toggle-control-speed: 0.15s;
|
||||
$toggle-control-ease: ease-in;
|
||||
|
||||
// These are our computed variables
|
||||
// change at your own risk.
|
||||
$toggle-radius: $toggle-height / 2;
|
||||
$toggle-control-size: $toggle-height - ($toggle-gutter * 2);
|
||||
|
||||
.toggle-control {
|
||||
display: block;
|
||||
position: relative;
|
||||
padding-left: $toggle-width;
|
||||
margin-bottom: 12px;
|
||||
cursor: pointer;
|
||||
font-size: 22px;
|
||||
user-select: none;
|
||||
|
||||
input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
height: 0;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
input:checked ~ .control {
|
||||
background-color: $toggle-background-color-on;
|
||||
|
||||
&:after {
|
||||
left: $toggle-width - $toggle-control-size - $toggle-gutter;
|
||||
}
|
||||
}
|
||||
|
||||
.control {
|
||||
position: absolute;
|
||||
top: -7px;
|
||||
left: -15px;
|
||||
height: $toggle-height;
|
||||
width: $toggle-width;
|
||||
border-radius: $toggle-radius;
|
||||
background-color: $toggle-background-color-off;
|
||||
transition: background-color $toggle-control-speed $toggle-control-ease;
|
||||
|
||||
&:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: $toggle-gutter;
|
||||
top: $toggle-gutter;
|
||||
width: $toggle-control-size;
|
||||
height: $toggle-control-size;
|
||||
border-radius: $toggle-radius;
|
||||
background: $toggle-control-color;
|
||||
transition: left $toggle-control-speed $toggle-control-ease;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
211
src/modules/09_leave/components/3_WorkTime/MainPage.vue
Normal file
211
src/modules/09_leave/components/3_WorkTime/MainPage.vue
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, useAttrs, onMounted } from "vue";
|
||||
|
||||
import router from "@/router";
|
||||
import { useQuasar } from "quasar";
|
||||
import DialogForm from '@/modules/09_leave/components/3_WorkTime/DialogForm.vue'
|
||||
import { useWorkTimeStore } from "@/modules/09_leave/stores/WorkTimeStore";
|
||||
const dataWorkTime = useWorkTimeStore();
|
||||
const { fecthList } = dataWorkTime;
|
||||
|
||||
const $q = useQuasar(); //ใช้ noti quasar
|
||||
const modal = ref<boolean>(false)
|
||||
const detailData = ref<any>()
|
||||
const editCheck = ref<boolean>(false)
|
||||
// ค้นหาในตาราง
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<HTMLInputElement | null>(null);
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
if (filterRef.value) {
|
||||
filterRef.value.focus();
|
||||
}
|
||||
};
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const paging = ref<boolean>(true);
|
||||
const pagination = ref({
|
||||
// sortBy: "desc",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
|
||||
function openModal(data:any,check:boolean){
|
||||
modal.value = true
|
||||
editCheck.value = check
|
||||
detailData.value = data
|
||||
};
|
||||
|
||||
function closeDialog(){
|
||||
modal.value = false
|
||||
editCheck.value = false
|
||||
}
|
||||
onMounted(() => {
|
||||
fecthList([
|
||||
{
|
||||
morning: "07:30",
|
||||
morningEnd: "12:00",
|
||||
afternoon: "13:00",
|
||||
afternoonEnd: "15:30",
|
||||
reason: "",
|
||||
status: 1,
|
||||
},
|
||||
{
|
||||
morning: "08:30",
|
||||
morningEnd: "12:00",
|
||||
afternoon: "13:00",
|
||||
afternoonEnd: "15:30",
|
||||
reason: "",
|
||||
status: 0,
|
||||
},
|
||||
{
|
||||
morning: "09:30",
|
||||
morningEnd: "12:00",
|
||||
afternoon: "13:00",
|
||||
afternoonEnd: "15:30",
|
||||
reason: "",
|
||||
status: 1,
|
||||
},
|
||||
{
|
||||
morning: "10:30",
|
||||
morningEnd: "12:00",
|
||||
afternoon: "13:00",
|
||||
afternoonEnd: "15:30",
|
||||
reason: "",
|
||||
status: 1,
|
||||
},
|
||||
]);
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
รายการรอบการปฏิบัติงาน
|
||||
</div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
|
||||
<div class="row col-12 q-col-gutter-sm q-mb-sm">
|
||||
<div>
|
||||
<q-btn
|
||||
for="#addInvestigatefacts"
|
||||
@click="openModal(null,false)"
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="add"
|
||||
icon="mdi-plus"
|
||||
>
|
||||
<q-tooltip>เพิ่มรอบการปฏิบัติงาน</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
<q-space />
|
||||
|
||||
<q-input
|
||||
for="#search"
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
standout
|
||||
dense
|
||||
v-model="filterKeyword"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterKeyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="filterKeyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<q-select
|
||||
for="#select"
|
||||
v-model="dataWorkTime.visibleColumns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
options-dense
|
||||
:display-value="$q.lang.table.columns"
|
||||
emit-value
|
||||
map-options
|
||||
:options="dataWorkTime.columns"
|
||||
option-value="name"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<d-table
|
||||
ref="table"
|
||||
:columns="dataWorkTime.columns"
|
||||
:rows="dataWorkTime.rows"
|
||||
:filter="filterKeyword"
|
||||
row-key="interrogated"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
v-bind="attrs"
|
||||
:visible-columns="dataWorkTime.visibleColumns"
|
||||
:pagination-label="paginationLabel"
|
||||
v-model:pagination="pagination"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
style="color: #000000; font-weight: 500;padding-top: 16px;padding-bottom: 16px;"
|
||||
>
|
||||
<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 v-for="col in props.cols" :key="col.name" :props="props" @click.prevent="openModal(props.row,true)">
|
||||
<div v-if="col.name === 'status'">
|
||||
<q-icon
|
||||
v-if="props.row.status === 1"
|
||||
name="mdi-check"
|
||||
size="sm"
|
||||
color="positive"
|
||||
/>
|
||||
<q-icon
|
||||
v-if="props.row.status === 0"
|
||||
name="mdi-close"
|
||||
size="sm"
|
||||
color="grey"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</d-table>
|
||||
</div>
|
||||
</q-card>
|
||||
<DialogForm
|
||||
:modal="modal"
|
||||
:closeDialog="closeDialog"
|
||||
:editCheck="editCheck"
|
||||
:detailData="detailData"
|
||||
/>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.q-table tbody td:before.no-background {
|
||||
background: none;
|
||||
}
|
||||
</style>
|
||||
21
src/modules/09_leave/interface/request/workTime.ts
Normal file
21
src/modules/09_leave/interface/request/workTime.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
interface workingTimeDataRowType {
|
||||
morning: string
|
||||
morningEnd: string
|
||||
afternoon: string
|
||||
afternoonEnd: string
|
||||
reason: string
|
||||
status: number
|
||||
}
|
||||
|
||||
interface formData {
|
||||
morning:string
|
||||
morningEnd:string
|
||||
afternoon:string
|
||||
afternoonEnd:string
|
||||
reason:string
|
||||
status:boolean
|
||||
}
|
||||
export type {
|
||||
workingTimeDataRowType,
|
||||
formData
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ const leaveMain = () => import("@/modules/09_leave/views/LeaveListMain.vue");
|
|||
const reportMain = () => import("@/modules/09_leave/views/ReportMain.vue")
|
||||
const leaveDetail = () => import("@/modules//09_leave/components/2_Leave/DetailLeave.vue")
|
||||
const RoundMain = () => import("@/modules/09_leave/views/RoundMain.vue")
|
||||
const workingtime = () => import('@/modules/09_leave/components/3_WorkTime/MainPage.vue')
|
||||
|
||||
export default [
|
||||
{
|
||||
|
|
@ -56,5 +57,15 @@ export default [
|
|||
Role: "coin",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/workingtime",
|
||||
name: "/working-time",
|
||||
component: workingtime,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: [9],
|
||||
Role: "coin",
|
||||
},
|
||||
},
|
||||
|
||||
]
|
||||
117
src/modules/09_leave/stores/WorkTimeStore.ts
Normal file
117
src/modules/09_leave/stores/WorkTimeStore.ts
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { workingTimeDataRowType } from '@/modules/09_leave/interface/request/workTime'
|
||||
|
||||
export const useWorkTimeStore = defineStore("WorkTimeStore", () => {
|
||||
const rows = ref<workingTimeDataRowType[]>([])
|
||||
|
||||
const visibleColumns = ref<string[]>([
|
||||
"round",
|
||||
"morning",
|
||||
"morningEnd",
|
||||
"afternoon",
|
||||
"afternoonEnd",
|
||||
"reason",
|
||||
"status",
|
||||
]); //ค้นหา คอลัมน์ คอลัมน์ที่แสดง
|
||||
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
|
||||
{
|
||||
name: "round",
|
||||
align: "left",
|
||||
label: "รอบ",
|
||||
sortable: true,
|
||||
field: "round",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "morning",
|
||||
align: "left",
|
||||
label: "รอบเช้า",
|
||||
sortable: true,
|
||||
field: "morning",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "morningEnd",
|
||||
align: "left",
|
||||
label: "รอบออก",
|
||||
sortable: true,
|
||||
field: "morningEnd",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "afternoon",
|
||||
align: "left",
|
||||
label: "รอบบ่าย",
|
||||
sortable: true,
|
||||
field: "afternoon",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "afternoonEnd",
|
||||
align: "left",
|
||||
label: "รอบออก",
|
||||
sortable: true,
|
||||
field: "afternoonEnd",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "reason",
|
||||
align: "left",
|
||||
label: "คำอธิบาย",
|
||||
sortable: true,
|
||||
field: "reason",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "status",
|
||||
align: "center",
|
||||
label: "สถานะการใช้งาน",
|
||||
sortable: false,
|
||||
field: "status",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
]);
|
||||
function fecthList(data: workingTimeDataRowType[]) {
|
||||
let datalist: workingTimeDataRowType[] = data.map((e: workingTimeDataRowType) => {
|
||||
return {
|
||||
round:`${e.morning}-${e.afternoonEnd}`,
|
||||
morning: e.morning,
|
||||
morningEnd: e.morningEnd,
|
||||
afternoon: e.afternoon,
|
||||
afternoonEnd: e.afternoonEnd,
|
||||
reason: e.reason === '' ? '-':e.reason,
|
||||
status: e.status,
|
||||
};
|
||||
});
|
||||
rows.value = datalist;
|
||||
}
|
||||
|
||||
return {
|
||||
fecthList,
|
||||
rows,
|
||||
visibleColumns,
|
||||
columns
|
||||
};
|
||||
})
|
||||
|
|
@ -34,23 +34,19 @@ const resetFilter = () => {
|
|||
};
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const paging = ref<boolean>(true);
|
||||
const pagination = ref({
|
||||
// sortBy: "desc",
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 10,
|
||||
});
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
|
||||
|
||||
const clickAdd = () => {
|
||||
router.push(`/discipline/investigatefacts/add`);
|
||||
};
|
||||
onMounted(() => {
|
||||
fecthList([
|
||||
onMounted(async() => {
|
||||
await fecthList([
|
||||
{
|
||||
subject: "ทุจริตในหน้าที่",
|
||||
interrogated: "ศิรินภา คงน้อยี่",
|
||||
|
|
@ -156,7 +152,6 @@ onMounted(() => {
|
|||
class="custom-header-table"
|
||||
v-bind="attrs"
|
||||
:visible-columns="dataInvestigate.visibleColumns"
|
||||
:pagination-label="paginationLabel"
|
||||
v-model:pagination="pagination"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
|
|
@ -176,9 +171,9 @@ onMounted(() => {
|
|||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<q-td v-if="col.name == 'no'">
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</q-td>
|
||||
</div>
|
||||
<div>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
|
|
@ -192,8 +187,8 @@ onMounted(() => {
|
|||
v-if="props.row.status === 'ยุติเรื่อง'"
|
||||
for="#cancel"
|
||||
dense
|
||||
outline
|
||||
color="deep-orange-7"
|
||||
unelevated
|
||||
color="primary"
|
||||
class="q-px-sm"
|
||||
>ยกเลิกยุติเรื่อง</q-btn
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue