check statusjson ประกาศเกษียณอายุราชการ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-23 13:55:11 +07:00
parent 393f94297e
commit e183754ccf
5 changed files with 169 additions and 137 deletions

View file

@ -46,4 +46,7 @@ export default {
listOut: () => `${retirement}/out`, listOut: () => `${retirement}/out`,
outByid: (id: string) => `${retirement}/out/${id}`, outByid: (id: string) => `${retirement}/out/${id}`,
outReport: `${retirement}/out/report`, outReport: `${retirement}/out/report`,
fileRetirement: (id: string) => `${retirement}/upload/${id}`,
checkfileupload: (id: string) => `${retirement}/upload/check/${id}`
}; };

View file

@ -20,9 +20,10 @@ const retireld_params = route.params.retirementId;
const modalNote = ref<boolean>(false); const modalNote = ref<boolean>(false);
const note = ref<string>(""); const note = ref<string>("");
const retireProfileId = ref<string>(""); const retireProfileId = ref<string>("");
const retireld = ref<string>(); const retireld = ref<string>(retireld_params.toString());
const profileId = ref<string>(""); const profileId = ref<string>("");
const filter = ref<string>(""); const filter = ref<string>("");
const statusUpload = ref<boolean>();
const columns = ref<any["columns"]>([ const columns = ref<any["columns"]>([
{ {
@ -131,20 +132,7 @@ const columns = ref<any["columns"]>([
style: "font-size: 14px", style: "font-size: 14px",
}, },
]); ]);
const rows = ref<any>([ const rows = ref<any>([]);
// {
// fixname: "",
// name: " ",
// brand: "",
// positionType: "",
// positionManager: "",
// positionLavel: "",
// positionNumber: ".2",
// govGroup: "",
// govOffice: "",
// bureau: "",
// },
]);
const visibleColumns = ref<string[]>([ const visibleColumns = ref<string[]>([
"order", "order",
"fixname", "fixname",
@ -160,11 +148,14 @@ const visibleColumns = ref<string[]>([
]); ]);
const action = ref<string>(""); const action = ref<string>("");
const fileUpload = ref<any>(null);
const fileInputRef = ref<any>(null);
onMounted(() => { onMounted(() => {
retireld.value = retireld_params.toString(); retireld.value = retireld_params.toString();
console.log(retireld_params); console.log(retireld_params);
fecthlistprofile(retireld.value); fecthlistprofile(retireld.value);
fecthCheck(retireld.value);
}); });
const round = ref<number>(); const round = ref<number>();
const typeReport = ref<string>(""); const typeReport = ref<string>("");
@ -205,6 +196,17 @@ const fecthlistprofile = async (id: string) => {
hideLoader(); hideLoader();
}); });
}; };
const fecthCheck = async (id: string) => {
await http
.get(config.API.checkfileupload(id))
.then((res) => {
console.log(res);
statusUpload.value = res.data.result;
})
.catch((err) => {
console.log(err);
});
};
// DelProfile // DelProfile
const clickDelete = () => { const clickDelete = () => {
$q.dialog({ $q.dialog({
@ -297,38 +299,33 @@ const visibleNote = computed(() => {
return true; return true;
} }
}); });
// const saveList = () => { const uploadFile = async (event: any) => {
// $q.dialog({ showLoader();
// title: "", const selectedFile = event;
// message: "?", console.log(selectedFile);
// cancel: { const formdata = new FormData();
// flat: true, formdata.append("file", selectedFile);
// color: "negative", await http
// }, .put(config.API.fileRetirement(retireld.value.toString()), formdata)
// persistent: true, .then((res) => {
// }) success($q, "เพิ่มไฟล์สำเร็จ");
// .onOk(async () => { })
// const retireld = "1233444"; .catch((err) => {
// await http messageError($q, err);
// .post(config.API.listRetire("123"), { retireld: retireld }) })
// .then(() => { .finally(() => {
// success($q, ""); fileUpload.value = null;
// }) fecthlistprofile(retireld.value);
// .catch((e) => { fecthCheck(retireld.value);
// messageError($q, e); hideLoader();
// }) });
// .finally(() => {
// fecthlist();
// });
// })
// .onCancel(() => {})
// .onDismiss(() => {});
// };
const classrow = (prop: any) => {
if (profileId.value !== "" && prop.profileId === profileId.value) {
return "color: #26a69a;";
} else return "";
}; };
// const classrow = (prop: any) => {
// if (profileId.value !== "" && prop.profileId === profileId.value) {
// return "color: #26a69a;";
// } else return "";
// };
const paging = ref<boolean>(true); const paging = ref<boolean>(true);
const pagination = ref({ const pagination = ref({
sortBy: "order", sortBy: "order",
@ -359,80 +356,103 @@ const paginationLabel = (start: number, end: number, total: number) => {
<div> <div>
<q-card class="col-12 q-pa-md"> <q-card class="col-12 q-pa-md">
<div class="row col-12 q-pb-sm"> <div class="row col-12 q-pb-sm">
<AddList <div class="row">
:dataProfile="dataProfile" <AddList
:retireld="retireld" :dataProfile="dataProfile"
:profile-id="profileId" :retireld="retireld"
:UpdateListId="UpdateListId" :profile-id="profileId"
v-if=" :UpdateListId="UpdateListId"
statusReport === false && v-if="
(typeReport == 'ADD' || typeReport == '' || typeReport == null) statusReport === false &&
" (typeReport == 'ADD' || typeReport == '' || typeReport == null) &&
/> statusUpload !== true
"
/>
<!-- <q-btn flat round style="color: #016987;" icon="save" @click="saveList"> <!-- <q-btn flat round style="color: #016987;" icon="save" @click="saveList">
<q-tooltip>นทกขอม</q-tooltip> <q-tooltip>นทกขอม</q-tooltip>
</q-btn> --> </q-btn> -->
<q-btn color="primary" flat round icon="download"> <q-btn color="primary" flat round icon="download">
<q-menu> <q-menu>
<q-list style="min-width: 100px"> <q-list style="min-width: 100px">
<q-item clickable> <q-item clickable>
<q-item-section avatar> <q-item-section avatar>
<q-icon color="red" name="mdi-file-pdf" /> <q-icon color="red" name="mdi-file-pdf" />
</q-item-section> </q-item-section>
<q-item-section>ไฟล .PDF</q-item-section> <q-item-section>ไฟล .PDF</q-item-section>
</q-item> </q-item>
<q-item clickable> <q-item clickable>
<q-item-section avatar> <q-item-section avatar>
<q-icon color="green" name="mdi-file-excel" /> <q-icon color="green" name="mdi-file-excel" />
</q-item-section> </q-item-section>
<q-item-section>ไฟล .xls</q-item-section> <q-item-section>ไฟล .xls</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
</q-menu> </q-menu>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip> <q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn> </q-btn>
<q-btn flat round color="light-blue" icon="upload"> <q-file
<q-tooltip>พโหลดไฟล</q-tooltip> bg-color="white"
</q-btn>
<q-space />
<q-tabs shrink>
<q-input
borderless
outlined outlined
dense dense
debounce="300" v-model="fileUpload"
v-model="filter" accept=".pdf"
placeholder="ค้นหา" :style="fileUpload === null ? 'width: 100px' : 'width: auto'"
style="max-width: 200px" v-if="statusUpload !== true"
class="q-ml-sm"
> >
<template v-slot:append> <template v-slot:prepend>
<q-icon name="search" /> <q-icon color="light-blue" name="attach_file" />
<q-tooltip>พโหลดไฟล</q-tooltip>
</template> </template>
</q-input> </q-file>
<q-select <q-btn
v-model="visibleColumns" flat
multiple round
outlined color="light-blue"
dense icon="upload"
options-dense @click="uploadFile(fileUpload)"
:display-value="$q.lang.table.columns" v-if="fileUpload !== null"
emit-value />
map-options </div>
:options="columns" <q-space />
option-value="name" <div class="row">
options-cover <q-tabs shrink>
style="min-width: 150px" <q-input
class="gt-xs q-ml-sm" borderless
> outlined
<!-- <template v-slot:option="{ opt }"> dense
<div>{{ opt.label }}</div> debounce="300"
<div class="sublabel">{{ opt.sublabel }}</div> v-model="filter"
</template> --> placeholder="ค้นหา"
</q-select> style="max-width: 200px"
</q-tabs> class="q-ml-sm"
>
<template v-slot:append>
<q-icon name="search" />
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
class="gt-xs q-ml-sm"
>
<!-- <template v-slot:option="{ opt }">
<div>{{ opt.label }}</div>
<div class="sublabel">{{ opt.sublabel }}</div>
</template> -->
</q-select>
</q-tabs>
</div>
</div> </div>
<div> <div>
@ -467,7 +487,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
(typeReport === 'EDIT' || (typeReport === 'EDIT' ||
typeReport === null || typeReport === null ||
typeReport === '') && typeReport === '') &&
statusReport === false statusReport === false &&
statusUpload !== true
" "
/> />
<q-th <q-th
@ -476,7 +497,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
(typeReport === 'REMOVE' || (typeReport === 'REMOVE' ||
typeReport === null || typeReport === null ||
typeReport === '') && typeReport === '') &&
statusReport === false statusReport === false &&
statusUpload !== true
" "
/> />
</q-tr> </q-tr>
@ -553,7 +575,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
(typeReport === 'EDIT' || (typeReport === 'EDIT' ||
typeReport === null || typeReport === null ||
typeReport === '') && typeReport === '') &&
statusReport === false statusReport === false &&
statusUpload !== true
" "
> >
<q-btn <q-btn
@ -578,7 +601,8 @@ const paginationLabel = (start: number, end: number, total: number) => {
(typeReport === 'REMOVE' || (typeReport === 'REMOVE' ||
typeReport === null || typeReport === null ||
typeReport === '') && typeReport === '') &&
statusReport === false statusReport === false &&
statusUpload !== true
" "
> >
<q-btn <q-btn

View file

@ -50,6 +50,7 @@
round round
color="add" color="add"
icon="mdi-plus" icon="mdi-plus"
:disable="checkjson == true"
> >
<q-tooltip>เพ</q-tooltip> <q-tooltip>เพ</q-tooltip>
</q-btn> </q-btn>
@ -275,7 +276,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, useAttrs, reactive, watch } from "vue"; import { onMounted, ref, useAttrs, reactive, watch, computed } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
FormMainProbation, FormMainProbation,
@ -355,9 +356,9 @@ const tab = ref<any>("officer");
const visibleColumns2 = ref<string[]>(["no", "name", "retireNumber"]); const visibleColumns2 = ref<string[]>(["no", "name", "retireNumber"]);
const yearOptions = reactive<any[]>([]); const yearOptions = reactive<any[]>([]);
const filteryear = () => { const filteryear = () => {
console.log(yearOptions); // console.log(yearOptions);
yearOptions.push({ id: currentYear, name: currentYear + 543 }); yearOptions.push({ id: currentYear, name: currentYear + 543 });
console.log(yearOptions[0].id); // console.log(yearOptions[0].id);
fiscalyear.value = yearOptions[0].id; fiscalyear.value = yearOptions[0].id;
fetchRetirement(type.value, currentYear); fetchRetirement(type.value, currentYear);
}; };
@ -367,7 +368,7 @@ const fetchRetirement = async (type: string, year: any) => {
await http await http
.get(config.API.retirement(type, year)) .get(config.API.retirement(type, year))
.then((res) => { .then((res) => {
console.log(res); // console.log(res);
rows.value = []; rows.value = [];
let data = res.data.result; let data = res.data.result;
rows.value = data.map((items: any) => ({ rows.value = data.map((items: any) => ({
@ -378,9 +379,11 @@ const fetchRetirement = async (type: string, year: any) => {
total: items.total, total: items.total,
round: items.round, round: items.round,
typeReport: typeReportChangeName(items.typeReport), typeReport: typeReportChangeName(items.typeReport),
json: items.json,
})); }));
actionOption.value = rows.value; actionOption.value = rows.value;
rows.value.sort((a, b) => a.round - b.round); rows.value.sort((a, b) => a.round - b.round);
checkststus(rows.value);
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -540,7 +543,7 @@ const cerateRetirement = async (data: object) => {
}); });
}; };
const clickSelect = async (action: string) => { const clickSelect = async (action: string) => {
console.log(action); // console.log(action);
// console.log(radio.value); // console.log(radio.value);
$q.dialog({ $q.dialog({
title: "ยืนยันการแก้ไขข้อมูลประกาศเกษียณ", title: "ยืนยันการแก้ไขข้อมูลประกาศเกษียณ",
@ -558,7 +561,7 @@ const clickSelect = async (action: string) => {
retireHistoryId: action, retireHistoryId: action,
option: radio.value, option: radio.value,
}; };
console.log(data); // console.log(data);
await cerateRetirement(data); await cerateRetirement(data);
}) })
@ -569,6 +572,14 @@ const clickSelect = async (action: string) => {
const clickClose = async () => { const clickClose = async () => {
modal.value = false; modal.value = false;
}; };
const checkjson = ref<boolean>();
const checkststus = (data: any) => {
let jsonfasle = rows.value.find((e: any) => e.json == false);
if (jsonfasle) {
checkjson.value = true;
} else checkjson.value = false;
};
const fiscalyear = ref<number>(); const fiscalyear = ref<number>();
// const fiscalyearOP = ref<any>([ // const fiscalyearOP = ref<any>([
// { id: 1, name: "" }, // { id: 1, name: "" },
@ -608,7 +619,7 @@ watch(type, () => {
fetchRetirement(type.value, currentYear); fetchRetirement(type.value, currentYear);
}); });
const typeReportChangeName = (val: string) => { const typeReportChangeName = (val: string) => {
console.log(val); // console.log(val);
switch (val) { switch (val) {
case "EDIT": case "EDIT":
return "ประกาศแก้ไขเกษียณ"; return "ประกาศแก้ไขเกษียณ";

View file

@ -236,7 +236,7 @@ const fecthlistRetire = async () => {
} }
}) })
.catch((e) => { .catch((e) => {
console.log(e); // console.log(e);
messageError($q, e); messageError($q, e);
}); });
}; };
@ -257,7 +257,7 @@ const fecthlistperson = async (id: string) => {
criterias: data, criterias: data,
}) })
.then((res) => { .then((res) => {
console.log(res); // console.log(res);
rows2.value = res.data.result.map((e: any) => ({ rows2.value = res.data.result.map((e: any) => ({
id: e.id, id: e.id,
@ -269,7 +269,7 @@ const fecthlistperson = async (id: string) => {
modalAdd.value = true; modalAdd.value = true;
}) })
.catch((e) => { .catch((e) => {
console.log(e); // console.log(e);
messageError($q, e); messageError($q, e);
}) })
.finally(() => { .finally(() => {
@ -294,14 +294,14 @@ const addlistperson = async (id: string) => {
// insigniaId: organization.value, // insigniaId: organization.value,
insigniaPeriodId: props.roundId, insigniaPeriodId: props.roundId,
}; };
console.log(data); // console.log(data);
await http await http
.post(config.API.insigniaCreate(), data) .post(config.API.insigniaCreate(), data)
.then(() => { .then(() => {
success($q, "เพิ่มรายชื่อสำเร็จ"); success($q, "เพิ่มรายชื่อสำเร็จ");
}) })
.catch((err) => { .catch((err) => {
console.log(err); // console.log(err);
messageError($q, err); messageError($q, err);
}) })
.finally(() => { .finally(() => {
@ -439,8 +439,8 @@ const fecthInsignia = async () => {
.then((res) => { .then((res) => {
insigniaOptions.value = res.data.result; insigniaOptions.value = res.data.result;
}) })
.catch((err) => { .catch(() => {
console.log(err); // console.log(err);
}); });
}; };
// const fecthInsigniaType = async () => { // const fecthInsigniaType = async () => {

View file

@ -39,17 +39,11 @@ export const useInsigniaDataStore = defineStore("insignia", () => {
} else rows.value = [] } else rows.value = []
} }
const fetchOption = (op: any) => { const fetchOption = (op: any) => {
console.log(agency.value);
console.log(op);
if (agency.value !== null) { if (agency.value !== null) {
typeOc.value = agency.value typeOc.value = agency.value
optionsTypeOc.value = op.filter((e: any) => e.id == agency.value optionsTypeOc.value = op.filter((e: any) => e.id == agency.value
) )
} else { optionsTypeOc.value = op, typeOc.value = op[2].id } } else { optionsTypeOc.value = op, typeOc.value = op[2].id }
console.log(optionsTypeOc.value);
} }
const filtertypeInsignia = async () => { const filtertypeInsignia = async () => {
typeinsignia.value = "all" typeinsignia.value = "all"