ปลัด
This commit is contained in:
parent
9d3601f23f
commit
8eed6589d1
3 changed files with 61 additions and 0 deletions
|
|
@ -135,6 +135,7 @@ export default {
|
||||||
orgPermissionsSys: `${organization}/permission`,
|
orgPermissionsSys: `${organization}/permission`,
|
||||||
|
|
||||||
checkIsOfficer: (id: string) => `${organization}/check/child1/${id}`,
|
checkIsOfficer: (id: string) => `${organization}/check/child1/${id}`,
|
||||||
|
checkIsDeputys: (id: string) => `${organization}/check/root/${id}`,
|
||||||
|
|
||||||
orgPosReport:`${orgPos}/report/draft`,
|
orgPosReport:`${orgPos}/report/draft`,
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ const formData = reactive<FormDataAgency>({
|
||||||
orgLevelSub: "",
|
orgLevelSub: "",
|
||||||
responsibility: "",
|
responsibility: "",
|
||||||
isOfficer: false,
|
isOfficer: false,
|
||||||
|
isDeputy: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -124,6 +125,13 @@ function onSubmit() {
|
||||||
formData.responsibility != null ? formData.responsibility : "",
|
formData.responsibility != null ? formData.responsibility : "",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (type === "Root") {
|
||||||
|
body = {
|
||||||
|
...body,
|
||||||
|
isDeputy:
|
||||||
|
formData.isDeputy !== undefined ? String(formData.isDeputy) : "",
|
||||||
|
};
|
||||||
|
}
|
||||||
if (type === "Child1") {
|
if (type === "Child1") {
|
||||||
body = {
|
body = {
|
||||||
...body,
|
...body,
|
||||||
|
|
@ -276,6 +284,8 @@ const tittleName = computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const checkIsOfficer = ref<boolean>(false); // เช็คว่าในโครงสร้างแบบร่างมีการเลือก สกจ. ไหม true = มี false = ไม่มี
|
const checkIsOfficer = ref<boolean>(false); // เช็คว่าในโครงสร้างแบบร่างมีการเลือก สกจ. ไหม true = มี false = ไม่มี
|
||||||
|
const checkIsDeputy = ref<boolean>(false); // เช็คว่าในโครงสร้างแบบร่างมีการเลือก สำนักปลัด ไหม true = มี false = ไม่มี
|
||||||
|
|
||||||
/** ฟังก์ชั่นเช็คว่าในโครงสร้างแบบร่างมีการเลือก สกจ. หรือยัง */
|
/** ฟังก์ชั่นเช็คว่าในโครงสร้างแบบร่างมีการเลือก สกจ. หรือยัง */
|
||||||
async function checkOfficer() {
|
async function checkOfficer() {
|
||||||
await http
|
await http
|
||||||
|
|
@ -291,6 +301,21 @@ async function checkOfficer() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ฟังก์ชั่นเช็คว่าในโครงสร้างแบบร่างมีการเลือก สกจ. หรือยัง */
|
||||||
|
async function onCheckIsDeputy() {
|
||||||
|
await http
|
||||||
|
.get(config.API.checkIsDeputys(store.draftId ?? ""))
|
||||||
|
.then((res) => {
|
||||||
|
checkIsDeputy.value = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* callback function ทำงานเมื่อ props.modal เป็น true
|
* callback function ทำงานเมื่อ props.modal เป็น true
|
||||||
*/
|
*/
|
||||||
|
|
@ -301,7 +326,10 @@ watch(
|
||||||
// ถ้าเป็นการเพิ่มข้อมูล
|
// ถ้าเป็นการเพิ่มข้อมูล
|
||||||
if (actionType.value === "ADD") {
|
if (actionType.value === "ADD") {
|
||||||
props.dataNode?.orgLevel === 0 && checkOfficer();
|
props.dataNode?.orgLevel === 0 && checkOfficer();
|
||||||
|
props.dataNode?.orgLevel === 0 && onCheckIsDeputy();
|
||||||
|
|
||||||
if (props.dataNode) {
|
if (props.dataNode) {
|
||||||
|
formData.isDeputy = false;
|
||||||
formData.orgCode =
|
formData.orgCode =
|
||||||
props?.dataNode?.orgLevel !== 0
|
props?.dataNode?.orgLevel !== 0
|
||||||
? props?.dataNode.orgTreeCode
|
? props?.dataNode.orgTreeCode
|
||||||
|
|
@ -336,6 +364,7 @@ watch(
|
||||||
formData.orgLevelSub = props.dataNode.orgTreeRankSub;
|
formData.orgLevelSub = props.dataNode.orgTreeRankSub;
|
||||||
formData.responsibility = props.dataNode.responsibility;
|
formData.responsibility = props.dataNode.responsibility;
|
||||||
formData.isOfficer = props.dataNode.isOfficer ?? false;
|
formData.isOfficer = props.dataNode.isOfficer ?? false;
|
||||||
|
formData.isDeputy = props.dataNode.isDeputy ?? false;
|
||||||
orgLevelOption.value =
|
orgLevelOption.value =
|
||||||
props.dataNode.orgTreeRank === "DEPARTMENT"
|
props.dataNode.orgTreeRank === "DEPARTMENT"
|
||||||
? orgLevelOptionMain.value
|
? orgLevelOptionMain.value
|
||||||
|
|
@ -359,6 +388,19 @@ function onChangeIsOfficer() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** ถ้ามีการเลือก สำนักปลัด และเคยมีเลือกไปแล้วระบบจะถามและให้ยืนยันการเลือกสำนักปลัด */
|
||||||
|
function onChangeIsDeputy() {
|
||||||
|
if (formData.isDeputy == true && checkIsDeputy.value == true) {
|
||||||
|
dialogConfirm(
|
||||||
|
$q,
|
||||||
|
() => (formData.isDeputy = true),
|
||||||
|
"ยืนยันการแก้ไข",
|
||||||
|
"คุณต้องการแก้ไข สำนักปลัด เป็นส่วนราชการนี้ใช่หรือไม่?",
|
||||||
|
() => (formData.isDeputy = false)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -547,6 +589,23 @@ function onChangeIsOfficer() {
|
||||||
@update:model-value="onChangeIsOfficer"
|
@update:model-value="onChangeIsOfficer"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="
|
||||||
|
(actionType === 'ADD' && props.dataNode?.orgLevel === 0) ||
|
||||||
|
(actionType === 'EDIT' && props.dataNode?.orgLevel === 0)
|
||||||
|
"
|
||||||
|
class="col-12"
|
||||||
|
>
|
||||||
|
<q-checkbox
|
||||||
|
keep-color
|
||||||
|
color="primary"
|
||||||
|
dense
|
||||||
|
v-model="formData.isDeputy"
|
||||||
|
label="สำนักปลัด"
|
||||||
|
class="q-ml-sm"
|
||||||
|
@update:model-value="onChangeIsDeputy"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ interface FormDataAgency {
|
||||||
orgLevelSub: string;
|
orgLevelSub: string;
|
||||||
responsibility: string;
|
responsibility: string;
|
||||||
isOfficer?: boolean;
|
isOfficer?: boolean;
|
||||||
|
isDeputy?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormDataPosition {
|
interface FormDataPosition {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue