แก้ API

This commit is contained in:
STW_TTTY\stwtt 2024-09-02 16:04:53 +07:00
parent d78b7db124
commit 459428979b
12 changed files with 37 additions and 33 deletions

View file

@ -33,7 +33,8 @@ export default {
kpiEvaluation,
kpiEvaluationUser,
kpiPlan,
kpiPlanById: (id: string) => `${kpiPlan}/edit/${id}`,
kpiPlanByIdEdit: (id: string) => `${kpiPlan}/edit/${id}`,
kpiPlanById: (id: string) => `${kpiPlan}/${id}`,
/** role */
kpiRole,

View file

@ -92,7 +92,7 @@ function fetchOrganizationActive() {
function fetchTreeStrategy() {
showLoader();
http
.get(config.API.devStrategy)
.get(config.API.devStrategy + `/edit`)
.then((res) => {
const data = res.data.result;
nodeplan.value = data;
@ -127,7 +127,7 @@ function fetchTreeAgency(id: string) {
function fetchDataById(id: string) {
showLoader();
http
.get(config.API.kpiPlanById(id))
.get(config.API.kpiPlanByIdEdit(id))
.then((res) => {
const data = res.data.result;
year.value = Number(data.year);

View file

@ -127,7 +127,7 @@ function selectAgency() {
/** บันทึกข้อมูล */
function onSubmit() {
const url = id.value
? config.API.kpiRoleMainEdit + `/${id.value}`
? config.API.kpiRoleMainList + `/${id.value}`
: config.API.kpiRoleMainList;
const body = {

View file

@ -85,7 +85,7 @@ async function fetchData() {
await http
.get(
config.API.kpiGroup +
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}`
`/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}`
)
.then(async (res) => {
total.value = res.data.result.total;

View file

@ -98,7 +98,7 @@ async function getData() {
http
.get(
config.API.kpiLink +
`?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}`
`/edit?page=${formQuery.page}&pageSize=${formQuery.pageSize}&keyword=${formQuery.keyword}`
)
.then((res) => {
total.value = res.data.result.total;
@ -210,7 +210,7 @@ async function onEdit(data: any) {
function getDataEdit(id: string) {
showLoader();
http
.get(config.API.kpiLink + `/${id}`)
.get(config.API.kpiLink + `/edit/${id}`)
.then((res) => {
const data = res.data.result;
groupName.value = {

View file

@ -57,7 +57,7 @@ function onSubmit() {
function getData() {
showLoader();
http
.get(config.API.kpiEvaluation)
.get(config.API.kpiEvaluation+`/edit`)
.then((res) => {
dataLevel.value = res.data.result.data;
})

View file

@ -115,7 +115,7 @@ function onClickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.kpiSpecial + `/edit/${id}`)
.delete(config.API.kpiSpecial + `/${id}`)
.then(() => {
fetchList();
success($q, "ลบข้อมูลสำเร็จ");

View file

@ -58,7 +58,7 @@ const titleDialog = ref<string>("");
function fetchDataTree() {
showLoader();
http
.get(config.API.devStrategy)
.get(config.API.devStrategy + `/edit`)
.then((res) => {
const data: DataStrategic[] = res.data.result;
nodes.value = data;
@ -154,7 +154,7 @@ function onSubmit() {
};
try {
const method = isStatusEdit.value ? "patch" : "post";
await http[method](config.API.devStrategy+`/edit`, formData);
await http[method](config.API.devStrategy, formData);
fetchDataTree();
success($q, "บันทึกข้อมูลสำเร็จ");
} catch (err) {

View file

@ -100,8 +100,8 @@ const roundOp = ref<DataOption[]>([
{ id: "OCT", name: "รอบตุลาคม" },
]);
function fetchList() {
http
async function fetchList() {
await http
.post(config.API.kpiRoleMainList + `/search-edit`, {
// ?page=${formFilter.page}&pageSize=${formFilter.pageSize}&period=${formFilter.round}&position=${formFilter.position}&keyword=${formFilter.keyword}&year=${formFilter.year}
keyword: formFilter.keyword,
@ -118,13 +118,13 @@ function fetchList() {
total.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
rows.value = data;
hideLoader();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
})
.finally(() => {});
}
function onClickAddOrView(status: boolean = false, id: string = "") {
@ -141,7 +141,7 @@ function onClickDelete(id: number) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.kpiRoleMainEdit + `/${id}`)
.delete(config.API.kpiRoleMainList + `/${id}`)
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
fetchList();
@ -187,9 +187,9 @@ function filterOption(val: any, update: Function) {
}
/** ดึงข้อมูลตำแหน่ง */
function getOptions() {
async function getOptions() {
showLoader();
http
await http
.get(config.API.orgSalaryPosition)
.then((res) => {
const dataOp = res.data.result;
@ -210,13 +210,13 @@ function getOptions() {
positionMainOp.value.push(...filteredData);
positionOp.value.push(...filteredData);
hideLoader();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
})
.finally(() => {});
}
function setModel(val: string) {
@ -244,8 +244,8 @@ function onClickHistory(id: string) {
});
}
function getTotal() {
http
async function getTotal() {
await http
.post(config.API.indicatorSummary)
.then((res) => {
const data = res.data.result;

View file

@ -148,7 +148,7 @@ async function fetchAssigned() {
async function getCriteria() {
await http
.get(config.API.KpiEvaluationInfo)
.get(config.API.KpiEvaluationInfo+`/edit`)
.then(async (res) => {
const data = await res.data.result.data;
dataListCriteria.value = data;

View file

@ -257,10 +257,10 @@ function clickList(id: string, isData: boolean = false) {
showLoader();
const url =
numpage.value === 1
? config.API.kpiPlan
? config.API.kpiPlan + `/edit`
: numpage.value === 2
? config.API.kpiRole
: config.API.kpiSpecial;
? config.API.kpiRole + `/edit`
: config.API.kpiSpecial + `/edit`;
http
.get(`${url}/${id}`)
.then((res) => {
@ -341,7 +341,7 @@ function closeDialog() {
formFilter.page = 1;
formFilter.pageSize = 20;
isStatusEdit.value = false
isStatusEdit.value = false;
checkDetail.value = false;
}
@ -427,7 +427,6 @@ watch(
fetchListPlan();
isStatusEdit.value && fetchListPlanByid(kpiUserPlannedId.value);
checkDetail.value && fetchListPlanByid(kpiUserPlannedId.value);
} else if (numpage.value === 2) {
fetchListRole();
isStatusEdit.value && fetchRoleByid(kpiUserPlannedId.value);
@ -992,9 +991,13 @@ const title = computed(() => {
</div>
</div>
</q-card-section>
<q-separator v-if="!checkDetail"/>
<q-separator v-if="!checkDetail" />
<q-card-actions v-if="!checkDetail" align="right" class="bg-white text-teal">
<q-card-actions
v-if="!checkDetail"
align="right"
class="bg-white text-teal"
>
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>

View file

@ -294,7 +294,7 @@ function fetchData() {
function fetchTree() {
showLoader();
http
.get(config.API.devStrategy)
.get(config.API.devStrategy+`/edit`)
.then((res) => {
const data = res.data.result;
nodes.value = data;