เครื่ิองราช => fix bug

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-06-30 21:12:26 +07:00
parent 2475f86608
commit 08455521f2
6 changed files with 262 additions and 133 deletions

View file

@ -1,6 +1,5 @@
divdiv
<script setup lang="ts">
import { ref, watch, computed } from "vue";
import { ref, watch, computed, reactive } from "vue";
import { QForm, useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
@ -132,7 +131,7 @@ const disbleStatus = computed(() => {
/** function เลือกประเภทลูกจ้าง */
async function selectType() {
showLoader();
// showLoader();
cardid.value = "";
fullName.value = "";
position.value = "";
@ -149,53 +148,73 @@ async function selectType() {
announced.value = "";
invoiceDate.value = null;
payment.value = "";
await fecthlistPerson();
// await fecthlistPerson();
}
/** function เรียกหน่วยงาน*/
async function fecthlistPerson() {
await http
.get(config.API.profileOrganizRoot)
.then((res) => {
const id = res.data.result[0].id;
if (id !== "") {
findlist(id); // id
}
})
.catch((e) => {
messageError($q, e);
});
}
// async function fecthlistPerson() {
// await http
// .get(config.API.profileOrganizRoot)
// .then((res) => {
// const id = res.data.result[0].id;
// if (id !== "") {
// findlist(id); // id
// }
// })
// .catch((e) => {
// messageError($q, e);
// });
// }
const formFilter = reactive({
page: 1,
pageSize: 10,
searchField: "citizenId",
searchKeyword: "",
});
/**
* function เรยกรายชอลกจางตาม id หนวยงาน
* @param id id หนวยงาน
*/
async function findlist(id: string) {
let data = [{}];
//
if (employeeClass.value === "officer") {
data = [{ criteriaType: "is_retire", criteriaValue: "false" }];
//
} else if (employeeClass.value === "employee") {
data = [
{ criteriaType: "is_retire", criteriaValue: "false" },
{ criteriaType: "employee_class", criteriaValue: "perm" },
];
}
await http
.post(config.API.profileSearchNewOcIdType(id, employeeClass.value), {
criterias: data,
})
showLoader();
http
.get(config.API.registryNew(""), { params: formFilter })
.then((res) => {
listPerson.value = res.data.result;
console.log();
})
.catch((e) => {
messageError($q, e);
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
// let data = [{}];
// //
// if (employeeClass.value === "officer") {
// data = [{ criteriaType: "is_retire", criteriaValue: "false" }];
// //
// } else if (employeeClass.value === "employee") {
// data = [
// { criteriaType: "is_retire", criteriaValue: "false" },
// { criteriaType: "employee_class", criteriaValue: "perm" },
// ];
// }
// await http
// .post(config.API.profileSearchNewOcIdType(id, employeeClass.value), {
// criterias: data,
// })
// .then((res) => {
// listPerson.value = res.data.result;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
}
/**

View file

@ -112,29 +112,29 @@ async function onSubmit(type: string, id: string) {
/** function เรียกหน่วยงาน*/
async function fetchOrgList() {
showLoader();
await http
.get(config.API.typeOc())
.then(async (response: any) => {
const orgArr = response.data.result.map((e: any) => ({
id: e.organizationId,
name: e.organizationName,
}));
OrgList.value = orgArr;
OrgList2.value = [
{
id: "00000000-0000-0000-0000-000000000000",
name: "สำนักนายกรัฐมนตรี",
},
...orgArr,
];
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
// showLoader();
// await http
// .get(config.API.typeOc())
// .then(async (response: any) => {
// const orgArr = response.data.result.map((e: any) => ({
// id: e.organizationId,
// name: e.organizationName,
// }));
// OrgList.value = orgArr;
// OrgList2.value = [
// {
// id: "00000000-0000-0000-0000-000000000000",
// name: "",
// },
// ...orgArr,
// ];
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
}
/** hook*/