รายการทั้งหมด / เพิ่มฟิล

This commit is contained in:
STW_TTTY\stwtt 2024-07-09 16:22:18 +07:00
parent f5c935b5df
commit 061cb27c41
5 changed files with 54 additions and 48 deletions

View file

@ -22,7 +22,7 @@ import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
const mixin = useCounterMixin();
const workStore = useWorklistDataStore();
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
const total = ref<number>(0);
const $q = useQuasar(); // noti quasar
/** ตัวแปร querySting*/
@ -137,6 +137,7 @@ async function fetchListTimeRecord() {
`?startDate=${querySting.startDate}&endDate=${querySting.startDate}&status=${querySting.status}&page=${querySting.page}&pageSize=${querySting.pageSize}&keyword=${querySting.keyword}`
)
.then((res) => {
total.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
const datalist: TableRowsTime[] = res.data.result.data.map(
(e: DataResTime) => ({
@ -200,6 +201,7 @@ onMounted(async () => {
<template>
<ToolBar :filetStatus="filetStatus" @update:pagination="updatePaging" />
<TableList
:total="total"
:rows="rows.length > 0 ? rows : []"
:page="page"
:rowsPerPage="rowsPerPage"

View file

@ -19,6 +19,7 @@ import TableList from "@/modules/09_leave/components/1_Work/TableList.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useWorklistDataStore } from "@/modules/09_leave/stores/WorkStore";
/** useStore */
const total = ref<number>(0);
const mixin = useCounterMixin();
const workStore = useWorklistDataStore();
const { date2Thai, dateToISO, showLoader, hideLoader, messageError } = mixin;
@ -110,6 +111,7 @@ async function fetchListLogRecord() {
}&pageSize=${rowsPerPage.value}&keyword=${keyword.value}`
)
.then((res) => {
total.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
let datalist: TableRows[] = res.data.result.data.map((e: DataResLog) => ({
id: e.id,
@ -160,6 +162,7 @@ onMounted(async () => {
<ToolBarDate :keyword="keyword" @update:pagination="updatePagingProp" />
<TableList
:total="total"
:rows="rows.length > 0 ? rows : []"
:page="page"
:rowsPerPage="rowsPerPage"

View file

@ -35,6 +35,10 @@ const props = defineProps({
type: Number,
require: true,
},
total: {
type: Number,
require: true,
},
tab: {
type: String,
require: true,
@ -188,6 +192,7 @@ onMounted(() => {
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ total }} รายการ
<q-pagination
v-model="currentPage"
active-color="primary"

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from "vue";
import { onMounted, reactive, ref, computed } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
@ -17,9 +17,14 @@ import config from "@/app.config";
const other1 = ref<boolean>(false);
const other2 = ref<boolean>(false);
const otherInput1 = ref<string>("");
const otherInput2 = ref<string>("");
const reasonPlanned = ref<string>("");
const reasonActual = ref<string>("");
const checkOtherBox = computed<boolean>(() => {
return formData.developmentProjectTechniquePlanneds.includes("อื่นๆ");
});
const checkOtherBox2 = computed<boolean>(() => {
return formData.developmentProjectTechniqueActuals.includes("อื่นๆ");
});
const $q = useQuasar();
const store = useDevelopmentDataStore();
const route = useRoute();
@ -43,6 +48,8 @@ const projectTechniquesOp = ref<DataOptionTechnique[]>([
{ value: "การสัมมนาเชิงปฏิบัติการ", label: "การสัมมนาเชิงปฏิบัติการ" },
{ value: "การบรรยายพิเศษ", label: "การบรรยายพิเศษ" },
{ value: "การฝึกศึกษา", label: "การฝึกศึกษา" },
{ value: "การบรรยาย", label: "การบรรยาย" },
{ value: "อื่นๆ", label: "อื่นๆ" },
]);
const formData = reactive<FormProjectDetail>({
@ -130,6 +137,8 @@ function fetchData() {
expanded.value = arrayExpanded.filter((e) => e !== null).slice(0, -1);
expanded2.value = arrayExpanded2.filter((e) => e !== null).slice(0, -1);
reasonPlanned.value = data.reasonPlanned;
reasonActual.value = data.reasonActual;
})
.catch((err) => {
messageError($q, err);
@ -186,6 +195,8 @@ async function onSubmit() {
strategyChildPlannedNode: formData.strategyChildPlannedNode,
strategyChildActualId: formData.strategyChildActualId,
strategyChildActualNode: formData.strategyChildActualNode,
reasonPlanned: reasonPlanned.value,
reasonActual: reasonActual.value,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -214,11 +225,11 @@ function updateSelected(data: DataStrategic, type: string) {
}
function checkOther(type: number, val: boolean) {
if(val == false){
if(type == 1){
otherInput1.value = ''
}else if(type == 2){
otherInput2.value = ''
if (val == false) {
if (type == 1) {
reasonPlanned.value = "";
} else if (type == 2) {
reasonActual.value = "";
}
}
}
@ -465,25 +476,17 @@ onMounted(() => {
type="checkbox"
/>
</div>
<div class="col-12 q-mb-lg">
<div class="col-12">
<div class="row">
<div class="col-4 relative-position">
<div class="other_custom">
<q-checkbox
v-model="other1"
label="อื่นๆ"
size="sm"
color="primary"
keep-color
:disable="store.projectStatus === 'FINISH'"
@update:model-value="checkOther(1, other1)"
/>
</div>
</div>
<div class="col-8 relative-position">
<div class="other_custom_input" v-if="other1 == true">
<q-input v-model="otherInput1" dense outlined label="กรุณากรอก อื่นๆ"></q-input>
<div class="offset-4 col-8 relative-position">
<div class="other_custom_input" v-if="checkOtherBox">
<q-input
v-model="reasonPlanned"
dense
outlined
class="inputgreen"
label="กรุณาระบุ"
></q-input>
</div>
</div>
</div>
@ -573,24 +576,17 @@ onMounted(() => {
type="checkbox"
/>
</div>
<div class="col-12 q-mb-lg">
<div class="col-12">
<div class="row">
<div class="col-4 relative-position">
<div class="other_custom">
<q-checkbox
v-model="other2"
label="อื่นๆ"
size="sm"
color="primary"
keep-color
@update:model-value="checkOther(2, other2)"
/>
</div>
</div>
<div class="col-8 relative-position">
<div class="other_custom_input" v-if="other2 == true">
<q-input v-model="otherInput2" dense outlined label="กรุณากรอก อื่นๆ"></q-input>
<div class="offset-4 col-8 relative-position">
<div class="other_custom_input" v-if="checkOtherBox2">
<q-input
v-model="reasonActual"
dense
outlined
label="กรุณาระบุ"
class="inputgreen"
></q-input>
</div>
</div>
</div>
@ -641,7 +637,7 @@ onMounted(() => {
}
.other_custom_input {
position: absolute;
top: -25px;
top: -45px;
width: 100%;
}
</style>

View file

@ -74,13 +74,13 @@ interface FormProjectDetail {
projectDayBackPlanned: string | null;
projectDayHoldPlanned: string | null;
projectNigthHoldPlanned: string | null;
developmentProjectTechniquePlanneds: [];
developmentProjectTechniquePlanneds: String[];
isBackActual: boolean;
isHoldActual: boolean;
projectDayBackActual: string | null;
projectDayHoldActual: string | null;
projectNigthHoldActual: string | null;
developmentProjectTechniqueActuals: [];
developmentProjectTechniqueActuals: String[];
projectModalActual?: string | null;
projectModalPlanned?: string | null;
strategyChildPlannedId?: string | null; //id ยุทธศาสตร์เป้าหมายตามแผน