ประวัติฝึกอบรม/ดูงานลูกจ้าง
This commit is contained in:
parent
6fb49dd324
commit
3e625962cf
5 changed files with 69 additions and 71 deletions
|
|
@ -9,6 +9,8 @@ export default {
|
||||||
/** history */
|
/** history */
|
||||||
developmentHistoryList: (type: string) =>
|
developmentHistoryList: (type: string) =>
|
||||||
`${development}/history/${type}/filter`,
|
`${development}/history/${type}/filter`,
|
||||||
|
developmentHistoryListByid: (type: string, id: string) =>
|
||||||
|
`${development}/history/${type}/${id}`,
|
||||||
developmentHistoryAdd: (type: string) => `${development}/history/${type}`,
|
developmentHistoryAdd: (type: string) => `${development}/history/${type}`,
|
||||||
developmentProjectSearch: () => `${development}/main/search`,
|
developmentProjectSearch: () => `${development}/main/search`,
|
||||||
developmentHistoryListOrg: (type: string, year: number) =>
|
developmentHistoryListOrg: (type: string, year: number) =>
|
||||||
|
|
|
||||||
|
|
@ -43,9 +43,9 @@ const node = ref<any>([]);
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
const expanded = ref<any>([]);
|
const expanded = ref<any>([]);
|
||||||
|
|
||||||
async function fetchData(id: string) {
|
function fetchData(id: string) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.developmentMainTab("tab1", id))
|
.get(config.API.developmentMainTab("tab1", id))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
|
|
@ -60,8 +60,8 @@ async function fetchData(id: string) {
|
||||||
if (nodeTree) {
|
if (nodeTree) {
|
||||||
expanded.value = [];
|
expanded.value = [];
|
||||||
const parts = nodeTree?.orgName.split("/");
|
const parts = nodeTree?.orgName.split("/");
|
||||||
for (let i = 0; i < parts.length; i++) {
|
for (let i = 1; i < parts.length; i++) {
|
||||||
const arrangedParts = parts[i - 1];
|
const arrangedParts = parts[i];
|
||||||
expanded.value.push(arrangedParts);
|
expanded.value.push(arrangedParts);
|
||||||
}
|
}
|
||||||
updateSelected(nodeTree);
|
updateSelected(nodeTree);
|
||||||
|
|
@ -137,17 +137,19 @@ function updateSelected(data: any) {
|
||||||
formData.orgRevisionId = data.orgRevisionId;
|
formData.orgRevisionId = data.orgRevisionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchAndReplace(orgTreeData: any, treeId: string | null) {
|
async function searchAndReplace(orgTreeData: any, treeId: string | null) {
|
||||||
for (let orgTree of orgTreeData) {
|
if (orgTreeData) {
|
||||||
if (orgTree.orgTreeId === treeId) {
|
for (let orgTree of orgTreeData) {
|
||||||
return orgTree;
|
if (orgTree.orgTreeId === treeId) {
|
||||||
}
|
return orgTree;
|
||||||
let foundOrg: any = searchAndReplace(orgTree.children, treeId);
|
}
|
||||||
if (foundOrg) {
|
let foundOrg: any = await searchAndReplace(orgTree.children, treeId);
|
||||||
return foundOrg;
|
if (foundOrg) {
|
||||||
|
return foundOrg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ function getClass() {
|
||||||
/** save */
|
/** save */
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
const url = id.value
|
const url = id.value
|
||||||
? config.API.developmentHistoryList("officer") + `${id.value}`
|
? config.API.developmentHistoryListByid("officer", id.value)
|
||||||
: config.API.developmentHistoryAdd("officer");
|
: config.API.developmentHistoryAdd("officer");
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
|
|
@ -162,7 +162,7 @@ function upDateProject(data: any) {
|
||||||
function getDataEdit() {
|
function getDataEdit() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.developmentHistoryList("officer") + `${id.value}`)
|
.get(config.API.developmentHistoryListByid("officer", id.value))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
formMain.id = id.value;
|
formMain.id = id.value;
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ function getClass() {
|
||||||
/** save */
|
/** save */
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
const url = id.value
|
const url = id.value
|
||||||
? config.API.developmentHistoryList("employee") + `${id.value}`
|
? config.API.developmentHistoryListByid("employee", id.value)
|
||||||
: config.API.developmentHistoryAdd("employee");
|
: config.API.developmentHistoryAdd("employee");
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
|
|
@ -115,7 +115,7 @@ function onSubmit() {
|
||||||
dialogConfirm($q, () => {
|
dialogConfirm($q, () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
http[id.value ? "put" : "post"](url, body)
|
http[id.value ? "put" : "post"](url, body)
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
router.push(`/development/employee-history`);
|
router.push(`/development/employee-history`);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
@ -150,7 +150,7 @@ function upDateProject(data: any) {
|
||||||
function getDataEdit() {
|
function getDataEdit() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.developmentHistoryList("employee") + `${id.value}`)
|
.get(config.API.developmentHistoryListByid("employee", id.value))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
formMain.id = id.value;
|
formMain.id = id.value;
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,19 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, reactive } from "vue";
|
import { ref, onMounted, reactive } from "vue";
|
||||||
import { useQuasar, type QTableProps } from "quasar";
|
import { useQuasar, type QTableProps } from "quasar";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
DataOption,
|
DataOption,
|
||||||
FormFilter,
|
FormFilter,
|
||||||
} from "@/modules/15_development/interface/index/Main";
|
} from "@/modules/15_development/interface/index/Main";
|
||||||
|
|
||||||
import http from "@/plugins/http";
|
|
||||||
import config from "@/app.config";
|
|
||||||
|
|
||||||
/** importStore*/
|
/** importStore*/
|
||||||
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
|
||||||
|
|
||||||
import genReportXLSX from "@/plugins/genreportxlsx";
|
|
||||||
|
|
||||||
const maxPage = ref<number>(1);
|
|
||||||
const pagination = ref({
|
|
||||||
page: 1,
|
|
||||||
rowsPerPage: 10,
|
|
||||||
});
|
|
||||||
|
|
||||||
const formFilter = reactive<FormFilter>({
|
|
||||||
page: 1,
|
|
||||||
pageSize: 20,
|
|
||||||
keyword: "",
|
|
||||||
year: new Date().getFullYear(),
|
|
||||||
type: "",
|
|
||||||
posType: "",
|
|
||||||
posLevel: "",
|
|
||||||
retireYear: "",
|
|
||||||
rangeYear: { min: 0, max: 60 },
|
|
||||||
isShowRetire: null,
|
|
||||||
isProbation: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
/** use*/
|
/** use*/
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -42,22 +21,22 @@ const store = useDevelopmentDataStore();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
|
||||||
|
const pagination = ref({
|
||||||
|
page: 1,
|
||||||
|
rowsPerPage: 10,
|
||||||
|
});
|
||||||
|
const maxPage = ref<number>(1);
|
||||||
|
const formFilter = reactive({
|
||||||
|
root: "",
|
||||||
|
page: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
keyword: "",
|
||||||
|
year: new Date().getFullYear(),
|
||||||
|
});
|
||||||
|
|
||||||
const rows = ref<any>([]);
|
const rows = ref<any>([]);
|
||||||
const agency = ref<string>("");
|
const agency = ref<string>("");
|
||||||
const agencyOp = ref<DataOption[]>([
|
const agencyOp = ref<[]>([]);
|
||||||
{
|
|
||||||
id: "id1",
|
|
||||||
name: "name1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "id2",
|
|
||||||
name: "name2",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "id3",
|
|
||||||
name: "name3",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"citizenId",
|
"citizenId",
|
||||||
|
|
@ -127,17 +106,29 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// function onAdd() {
|
function fetchListOrg() {
|
||||||
// store.statusEdit = false;
|
showLoader();
|
||||||
// router.push(`/development/employee-history/add`);
|
http
|
||||||
// }
|
.get(config.API.developmentHistoryListOrg("employee", formFilter.year))
|
||||||
|
.then((res) => {
|
||||||
|
formFilter.root = "";
|
||||||
|
rows.value = [];
|
||||||
|
agencyOp.value = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function onDownload() {
|
function onDownload() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.post(config.API.developmentReportHistoryOfficer(), {
|
.post(config.API.developmentReportHistoryOfficer(), {
|
||||||
year: formFilter.year,
|
year: formFilter.year,
|
||||||
root: agency.value,
|
root: formFilter.root,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const dataList = res.data.result;
|
const dataList = res.data.result;
|
||||||
|
|
@ -162,12 +153,12 @@ function getData() {
|
||||||
pageSize: formFilter.pageSize,
|
pageSize: formFilter.pageSize,
|
||||||
keyword: formFilter.keyword,
|
keyword: formFilter.keyword,
|
||||||
year: formFilter.year,
|
year: formFilter.year,
|
||||||
root: agency.value,
|
root: formFilter.root,
|
||||||
};
|
};
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.get(config.API.developmentHistoryList("employee"), { params: queryParams })
|
.post(config.API.developmentHistoryList("employee"), formFilter)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res.data.result.data);
|
console.log(res.data.result.data);
|
||||||
const data = res.data.result.data;
|
const data = res.data.result.data;
|
||||||
|
|
@ -195,10 +186,10 @@ function getData() {
|
||||||
|
|
||||||
function yearAll() {
|
function yearAll() {
|
||||||
formFilter.year = 0;
|
formFilter.year = 0;
|
||||||
getData();
|
// getData();
|
||||||
}
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getData();
|
fetchListOrg();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -217,7 +208,7 @@ onMounted(() => {
|
||||||
autoApply
|
autoApply
|
||||||
year-picker
|
year-picker
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
@update:model-value="getData()"
|
@update:model-value="fetchListOrg()"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
<template #year-overlay-value="{ value }">{{
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
|
@ -229,14 +220,16 @@ onMounted(() => {
|
||||||
lazy-rules
|
lazy-rules
|
||||||
outlined
|
outlined
|
||||||
:model-value="
|
:model-value="
|
||||||
formFilter.year === 0 ? null : Number(formFilter.year) + 543
|
formFilter.year === 0
|
||||||
|
? 'ทั้งหมด'
|
||||||
|
: Number(formFilter.year) + 543
|
||||||
"
|
"
|
||||||
:label="`${'ปีงบประมาณ'}`"
|
:label="`${'ปีงบประมาณ'}`"
|
||||||
>
|
>
|
||||||
<template v-if="formFilter.year" v-slot:append>
|
<template v-if="formFilter.year" v-slot:append>
|
||||||
<q-icon
|
<q-icon
|
||||||
name="cancel"
|
name="cancel"
|
||||||
@click.stop.prevent="yearAll"
|
@click.stop.prevent="(formFilter.year = 0), fetchListOrg()"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -258,10 +251,11 @@ onMounted(() => {
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
label="หน่วยงาน"
|
label="หน่วยงาน"
|
||||||
v-model="agency"
|
v-model="formFilter.root"
|
||||||
:options="agencyOp"
|
:options="agencyOp"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@update:model-value="(formFilter.page = 1), getData()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue