Refactoring code module 06_retirement
This commit is contained in:
parent
1225254062
commit
ea921b39b0
29 changed files with 730 additions and 823 deletions
|
|
@ -2,9 +2,10 @@
|
|||
import { onMounted, ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { tokenParsed } from "@/plugins/auth";
|
||||
|
||||
/**Import type */
|
||||
|
|
@ -51,7 +52,7 @@ const fullName = ref<string>("");
|
|||
const status = ref<string>("");
|
||||
|
||||
//นำข้อมูลจาก API มาแสดง
|
||||
const getData = async () => {
|
||||
async function getData() {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.outByid(dataId))
|
||||
|
|
@ -81,21 +82,21 @@ const getData = async () => {
|
|||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่น Cancle
|
||||
*/
|
||||
const clickCancel = async () => {
|
||||
async function clickCancel() {
|
||||
await getData();
|
||||
edit.value = false;
|
||||
myForm.value?.resetValidation();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่น Saveจาก API
|
||||
*/
|
||||
const onSubmit = async () => {
|
||||
async function onSubmit() {
|
||||
dialogMessage(
|
||||
$q,
|
||||
"ต้องการแก้ไขข้อมูลหรือไม่?",
|
||||
|
|
@ -131,18 +132,18 @@ const onSubmit = async () => {
|
|||
},
|
||||
undefined
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Function เพิ่ม Class เวลา Edit
|
||||
* @param val เมื่อเป็นEdit จะเปลี่ยน Class
|
||||
*/
|
||||
const getClass = (val: boolean) => {
|
||||
function getClass(val: boolean) {
|
||||
return {
|
||||
"full-width inputgreen cursor-pointer": val,
|
||||
"full-width cursor-pointer": !val,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
/** Hook */
|
||||
onMounted(async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue