ผูก API ประวัติออกคำสั่ง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-09-06 09:56:49 +07:00
parent c1cf17bf14
commit 63d7f8c1d2
3 changed files with 39 additions and 90 deletions

View file

@ -381,7 +381,7 @@ const paginationLabel = (start: number, end: number, total: number) => {
flat
bordered
class="col-12 q-my-md q-mt-sm rounded-borders"
v-if="loadView == tr"
v-if="loadView == true"
>
<q-tabs
dense

View file

@ -21,15 +21,11 @@ const props = defineProps({
const OrderTypeOption = ref<any>([]);
const modal = ref<boolean>(false);
const employeeClass = ref<string>("");
const typeKeyword = ref<string>("");
const Keyword = ref<string>("");
const positionKeyword = ref<string>("");
const reportType = ref<string>("");
const reportYear = ref<number | null>();
const reportNo = ref<string>("");
const positionOps = ref<DataOption[]>([]);
const columns = ref<any["columns"]>([
{
name: "no",
@ -85,100 +81,52 @@ const clickOpenpopup = () => {
let currentDate = new Date();
let currentYear = currentDate.getFullYear();
reportYear.value = currentYear;
rows.value = [];
reportNo.value = "";
}
};
// const fecthPositionOfficer = async () => {
// await http
// .get(config.API.listPositionPathHistory)
// .then((res) => {
// let data = res.data.result.items;
// console.log(data);
// positionOps.value = data.map((e: any) => ({ id: e.id, name: e.name }));
// options.value = positionOps.value;
// })
// .catch((err) => {
// messageError($q, err);
// });
// };
// const fetchPositionPerm = async () => {
// await http
// .get(config.API.listPositionEmployeePositionHistory)
// .then((res) => {
// let data = res.data.result.items;
// positionOps.value = data.map((e: any) => ({ id: e.id, name: e.name }));
// options.value = positionOps.value;
// })
// .catch((err) => {
// messageError($q, err);
// });
// };
const clickSearch = async (type: string) => {
const clickSearch = async () => {
await myForm.value!.validate().then((result: boolean) => {
if (result) {
console.log(reportType.value);
console.log(reportYear.value);
console.log(reportNo.value);
// showLoader();
// let body = {};
// if (typeKeyword.value === "no") {
// Object.assign(body, {
// posNo: Keyword.value,
// });
// } else if (typeKeyword.value === "position") {
// Object.assign(body, {
// positionId: positionKeyword.value,
// });
// }
// http
// .post(config.API.profileHistory(type), body)
// .then((res) => {
// let data = res.data.result;
// if (data.length !== 0) {
// rows.value = data.map((e: any) => ({
// id: e.id,
// citizenId: e.citizenId,
// name: e.firstName + " " + e.lastName,
// posNo: e.posNo,
// position: e.position,
// date: date2Thai(e.date),
// }));
// } else {
// notifyError($q, "");
// rows.value = [];
// }
// })
// .catch((err) => {
// messageError($q, err);
// rows.value = [];
// })
// .finally(() => {
// hideLoader();
// });
let body = {
commandTypeId: reportType.value,
year: reportYear.value,
posno: reportNo.value,
};
// console.log(body);
showLoader();
http
.post(config.API.searchOrderprofile(), body)
.then((res) => {
let data = res.data.result;
console.log(data);
if (data.length !== 0) {
rows.value = data.map((e: any) => ({
id: e.id,
citizenId: e.citizenId,
name: e.fullName,
posNo: e.posNo,
position: e.position,
}));
} else {
notifyError($q, "ไม่มีข้อมูลที่ต้องการค้นหา");
rows.value = [];
}
})
.catch((err) => {
messageError($q, err);
rows.value = [];
})
.finally(() => {
hideLoader();
});
}
});
};
// const options = ref<any>([]);
// const filterFn = (val: string, update: any) => {
// if (val === "") {
// update(() => {
// options.value = OrderTypeOption.value;
// });
// return;
// } else {
// update(() => {
// options.value = OrderTypeOption.value.filter(
// (e: any) => e.name.search(val) !== -1
// );
// });
// }
// console.log(options.value);
// };
const clickRedirect = (id: string) => {
router.push(`/registry/${id}`);
};
const paging = ref<boolean>(true);
const pagination = ref({
sortBy: "citizenId",
@ -302,7 +250,7 @@ const paginationLabel = (start: number, end: number, total: number) => {
icon="mdi-magnify"
label="ค้นหา"
class="q-px-md"
@click="clickSearch(employeeClass)"
@click="clickSearch"
/>
</div>
</div>