อัตรากำลังลูกจ้างประจำ ฯ => refactor code
This commit is contained in:
parent
7e2350eef8
commit
81e0a82b0e
18 changed files with 377 additions and 188 deletions
|
|
@ -4,33 +4,48 @@ import { useQuasar } from "quasar";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
import type {
|
||||
ResGroup,
|
||||
ResLevel,
|
||||
} from "@/modules/01_metadataNew/interface/response/positionEmployee/Main";
|
||||
import type { ObjectPosRef } from "@/modules/01_metadataNew/interface/index/positionEmployee";
|
||||
import type { DataOption } from "@/modules/16_positionEmployee/interface/index/Main";
|
||||
|
||||
import type { OptionType } from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
const isSpecial = ref<boolean>(false);
|
||||
/**
|
||||
* use
|
||||
*/
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
|
||||
|
||||
/**
|
||||
* props
|
||||
*/
|
||||
const modal = defineModel<boolean>("modalAdd", { required: true });
|
||||
const isEditCheck = defineModel<boolean>("isEdit", { required: true });
|
||||
const props = defineProps({
|
||||
emitSearch: Function,
|
||||
getData: Function,
|
||||
data: Object,
|
||||
levelOp: Object,
|
||||
});
|
||||
const modal = defineModel<boolean>("modalAdd", { required: true });
|
||||
const isEditCheck = defineModel<boolean>("isEdit", { required: true });
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
|
||||
|
||||
const isDisValidate = ref<boolean>(false);
|
||||
const isSpecial = ref<boolean>(false);
|
||||
const formDataPos = reactive({
|
||||
posName: "",
|
||||
posTypeName: "",
|
||||
|
|
@ -49,7 +64,9 @@ const posTypeMain = ref<ResGroup[]>([]);
|
|||
const posTypeOp = ref<DataOption[]>([]);
|
||||
const posLevelOp = ref<DataOption[]>([]);
|
||||
|
||||
/** ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม */
|
||||
/**
|
||||
* ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม
|
||||
*/
|
||||
function validateFormPositionEdit() {
|
||||
isDisValidate.value = false;
|
||||
const hasError = [];
|
||||
|
|
@ -80,9 +97,9 @@ async function submit() {
|
|||
? config.API.orgEmployeePos
|
||||
: config.API.orgEmployeePosById(props?.data?.id);
|
||||
await http[!isEditCheck.value ? "post" : "put"](url, body);
|
||||
success($q, "บันทีกข้อมูลสำเร็จ");
|
||||
props.emitSearch?.(formDataPos.posName, "positionName");
|
||||
close();
|
||||
await props.emitSearch?.(formDataPos.posName, "positionName");
|
||||
await success($q, "บันทีกข้อมูลสำเร็จ");
|
||||
await close();
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue