refactor ออกคำสั่ง
This commit is contained in:
parent
8dfa5ca02e
commit
3802d5d5a2
8 changed files with 526 additions and 916 deletions
|
|
@ -109,7 +109,7 @@ const conditionData = async () => {
|
|||
await fetchOrder(id);
|
||||
}
|
||||
};
|
||||
|
||||
// เรียกรายชื่อออกคำสั่ง
|
||||
const getData = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -141,6 +141,7 @@ const getData = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
//เรียกรายละเอียดของคำสั่ง
|
||||
const fetchOrder = async (id: string) => {
|
||||
await http
|
||||
.get(config.API.detailOrder(id))
|
||||
|
|
@ -152,6 +153,7 @@ const fetchOrder = async (id: string) => {
|
|||
messageError($q, err);
|
||||
});
|
||||
};
|
||||
// เช็คคำสั่ง
|
||||
const statuscode = computed(() => {
|
||||
if (
|
||||
orderTypeCode.value === "c-pm-01" ||
|
||||
|
|
@ -170,10 +172,11 @@ const statuscode = computed(() => {
|
|||
}
|
||||
return true;
|
||||
});
|
||||
// ยืนยันลบข้อมูลราชชื่อ
|
||||
const dialogDeleteData = async (id: string) => {
|
||||
dialogRemove($q, () => deleteData(id));
|
||||
};
|
||||
|
||||
// ลบข้อมูลราชชื่อ API
|
||||
const deleteData = async (id: string) => {
|
||||
await http
|
||||
.delete(config.API.personsOrder(id))
|
||||
|
|
@ -188,9 +191,8 @@ const deleteData = async (id: string) => {
|
|||
await conditionData();
|
||||
});
|
||||
};
|
||||
|
||||
// ปรับราชชื่อขึ้น
|
||||
const swapUp = async (id: string) => {
|
||||
// id = personalId
|
||||
await http
|
||||
.put(config.API.swapUpOrder(id))
|
||||
.catch((e) => {
|
||||
|
|
@ -201,9 +203,8 @@ const swapUp = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
// ปรับราชชื่อลง
|
||||
const swapDown = async (id: string) => {
|
||||
// id = personalId
|
||||
await http
|
||||
.put(config.API.swapDownOrder(id))
|
||||
.catch((e) => {
|
||||
|
|
@ -216,14 +217,13 @@ const swapDown = async (id: string) => {
|
|||
};
|
||||
|
||||
const upDown = async (value: any, up: boolean = true) => {
|
||||
const indexCurrent = value.rowIndex;
|
||||
if (up) {
|
||||
await swapUp(value.row.personalId);
|
||||
} else {
|
||||
await swapDown(value.row.personalId);
|
||||
}
|
||||
};
|
||||
|
||||
// บันทึกเงินเดือน
|
||||
const saveModal = () => {
|
||||
if (myForm.value !== null) {
|
||||
myForm.value.validate().then(async (result: boolean) => {
|
||||
|
|
@ -234,12 +234,13 @@ const saveModal = () => {
|
|||
}
|
||||
};
|
||||
const personalId = ref<string>("");
|
||||
// เปิด popup เงินเดือน
|
||||
const selectModal = (e: any) => {
|
||||
titleName.value = e.name;
|
||||
personalId.value = e.personalId;
|
||||
modalOpenClose(e.personalId);
|
||||
};
|
||||
|
||||
// เปิด popup เงินเดือน
|
||||
const modalOpenClose = async (personalId: string) => {
|
||||
modal.value = !modal.value;
|
||||
if (modal.value) {
|
||||
|
|
@ -249,6 +250,7 @@ const modalOpenClose = async (personalId: string) => {
|
|||
}
|
||||
myForm.value?.reset();
|
||||
};
|
||||
// เรียกข้อมูลเงินเดือนตาม personalId
|
||||
const fetchSalary = async (personalId: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -283,7 +285,7 @@ const fetchSalary = async (personalId: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
// ยืนยันการแก้ไขข้อมูลเงินเดือน
|
||||
const putSalary = async (salary: any) => {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
|
|
@ -298,7 +300,7 @@ const putSalary = async (salary: any) => {
|
|||
}
|
||||
await http
|
||||
.put(config.API.salaryOrder(personalId.value), modalData.value)
|
||||
.then((res: any) => {
|
||||
.then((any) => {
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -311,7 +313,7 @@ const putSalary = async (salary: any) => {
|
|||
});
|
||||
});
|
||||
};
|
||||
|
||||
// เปิด popup เพิ่มข้อมูลราชชื่อ
|
||||
const modalAddChange = async () => {
|
||||
modalAdd.value = !modalAdd.value;
|
||||
if (modalAdd.value == true) {
|
||||
|
|
@ -325,7 +327,7 @@ const modalAddChange = async () => {
|
|||
}
|
||||
} else await conditionData();
|
||||
};
|
||||
|
||||
// เรียกข้อมูลราขชื่อที่จะเพิ่ม
|
||||
const fetchaddlist = async (id: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -344,7 +346,6 @@ const fetchaddlist = async (id: string) => {
|
|||
}));
|
||||
rows2.value = list;
|
||||
selected.value = rows.value;
|
||||
// rows2.value = list.filter((e: any) => e.selectStatus === false);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -353,7 +354,7 @@ const fetchaddlist = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
|
||||
// ยืนยันการเพิ่มรายชื่อออกคำสั่ง
|
||||
const saveModalAdd = () => {
|
||||
if (myFormAdd.value !== null) {
|
||||
myFormAdd.value.validate().then(async (result: boolean) => {
|
||||
|
|
@ -372,7 +373,7 @@ const saveModalAdd = () => {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
// เพิ่มราชชื่อ API
|
||||
const addlist = async (data: Object) => {
|
||||
const id = route.params.orderid
|
||||
? route.params.orderid.toString()
|
||||
|
|
@ -393,7 +394,7 @@ const addlist = async (data: Object) => {
|
|||
});
|
||||
}
|
||||
};
|
||||
|
||||
// บันทึกข้อมูล step 2
|
||||
const save = async () => {
|
||||
const check = rows.value.find((x: any) => x.salaryAmount == 0);
|
||||
if (
|
||||
|
|
@ -725,8 +726,7 @@ const pagination = ref({
|
|||
color="public"
|
||||
@click="saveModalAdd"
|
||||
class="q-px-md"
|
||||
><!-- icon="mdi-content-save-outline"
|
||||
<q-tooltip>บันทึก</q-tooltip> -->
|
||||
>
|
||||
</q-btn>
|
||||
</q-card-actions>
|
||||
</q-form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue