fix bug
This commit is contained in:
parent
e9ce66b6c1
commit
60e548405a
1 changed files with 38 additions and 49 deletions
|
|
@ -1,56 +1,56 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, defineProps } from "vue";
|
||||
import type { QTableProps } from "quasar";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
import type {
|
||||
DataOption,
|
||||
FormPositionSelect,
|
||||
FormPositionSelectRef,
|
||||
} from "@/modules/02_organizationalNew/interface/index/Main";
|
||||
|
||||
import type {
|
||||
OptionType,
|
||||
OptionLevel,
|
||||
OptionExecutive,
|
||||
DataPosition,
|
||||
} from "@/modules/02_organizationalNew/interface/response/organizational";
|
||||
|
||||
const posExecutive = ref<string>("");
|
||||
const isSpecial = ref<boolean>(false);
|
||||
const shape = ref<string>("false");
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
/**
|
||||
* 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 dataLevel = ref<any>();
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
dialogRemove,
|
||||
} = mixin;
|
||||
const posExecutive = ref<string>("");
|
||||
const isSpecial = ref<boolean>(false);
|
||||
const shape = ref<string>("false");
|
||||
|
||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||
const isDisValidate = ref<boolean>(false);
|
||||
const positionNameRef = ref<Object | null>(null);
|
||||
const positionFieldRef = ref<Object | null>(null);
|
||||
const positionTypeRef = ref<Object | null>(null);
|
||||
const positionLevelRef = ref<Object | null>(null);
|
||||
const positionExecutiveRef = ref<Object | null>(null);
|
||||
const positionExecutiveFieldRef = ref<Object | null>(null);
|
||||
const positionAreaRef = ref<Object | null>(null);
|
||||
|
||||
const typeOpsMain = ref<DataOption[]>([]);
|
||||
const levelOpsMain = ref<DataOption[]>([]);
|
||||
|
|
@ -79,30 +79,11 @@ const formPositionSelect = reactive<FormPositionSelect>({
|
|||
positionArea: "",
|
||||
});
|
||||
|
||||
const objectPositionSelectRef: FormPositionSelectRef = {
|
||||
positionName: positionNameRef,
|
||||
positionField: positionFieldRef,
|
||||
positionType: positionTypeRef,
|
||||
positionLevel: positionLevelRef,
|
||||
positionExecutive: positionExecutiveRef,
|
||||
positionExecutiveField: positionExecutiveFieldRef,
|
||||
positionArea: positionAreaRef,
|
||||
};
|
||||
|
||||
/** ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม */
|
||||
/**
|
||||
* ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม
|
||||
*/
|
||||
function validateFormPositionEdit() {
|
||||
isDisValidate.value = false;
|
||||
// const hasError = [];
|
||||
// for (const key in objectPositionSelectRef) {
|
||||
// if (Object.prototype.hasOwnProperty.call(objectPositionSelectRef, key)) {
|
||||
// const property = objectPositionSelectRef[key];
|
||||
// if (property.value && typeof property.value.validate === "function") {
|
||||
// const isValid = property.value.validate();
|
||||
// hasError.push(isValid);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (hasError.every((result) => result === true)) {
|
||||
if (isEditCheck.value == true) {
|
||||
saveSelectEdit();
|
||||
} else {
|
||||
|
|
@ -111,6 +92,9 @@ function validateFormPositionEdit() {
|
|||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังชั่น บันทึกการแก้ไข
|
||||
*/
|
||||
function saveSelectEdit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -167,7 +151,9 @@ function saveSelectEdit() {
|
|||
"ต้องการยืนยันแก้ไขตำแหน่งนี้ใช่หรือไม่?"
|
||||
);
|
||||
}
|
||||
/** ฟังชั่น บันทึก */
|
||||
/**
|
||||
* ฟังชั่น บันทึก
|
||||
*/
|
||||
function onSubmitSelectEdit() {
|
||||
dialogConfirm(
|
||||
$q,
|
||||
|
|
@ -225,6 +211,9 @@ function onSubmitSelectEdit() {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังชั่น เครียลฟอร์ม
|
||||
*/
|
||||
async function clearFormPositionSelect() {
|
||||
isEditCheck.value = false;
|
||||
isDisValidate.value = await true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue