ปลัด
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`,
|
||||
|
||||
checkIsOfficer: (id: string) => `${organization}/check/child1/${id}`,
|
||||
checkIsDeputys: (id: string) => `${organization}/check/root/${id}`,
|
||||
|
||||
orgPosReport:`${orgPos}/report/draft`,
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ const formData = reactive<FormDataAgency>({
|
|||
orgLevelSub: "",
|
||||
responsibility: "",
|
||||
isOfficer: false,
|
||||
isDeputy: false,
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -124,6 +125,13 @@ function onSubmit() {
|
|||
formData.responsibility != null ? formData.responsibility : "",
|
||||
};
|
||||
|
||||
if (type === "Root") {
|
||||
body = {
|
||||
...body,
|
||||
isDeputy:
|
||||
formData.isDeputy !== undefined ? String(formData.isDeputy) : "",
|
||||
};
|
||||
}
|
||||
if (type === "Child1") {
|
||||
body = {
|
||||
...body,
|
||||
|
|
@ -276,6 +284,8 @@ const tittleName = computed(() => {
|
|||
});
|
||||
|
||||
const checkIsOfficer = ref<boolean>(false); // เช็คว่าในโครงสร้างแบบร่างมีการเลือก สกจ. ไหม true = มี false = ไม่มี
|
||||
const checkIsDeputy = ref<boolean>(false); // เช็คว่าในโครงสร้างแบบร่างมีการเลือก สำนักปลัด ไหม true = มี false = ไม่มี
|
||||
|
||||
/** ฟังก์ชั่นเช็คว่าในโครงสร้างแบบร่างมีการเลือก สกจ. หรือยัง */
|
||||
async function checkOfficer() {
|
||||
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
|
||||
*/
|
||||
|
|
@ -301,7 +326,10 @@ watch(
|
|||
// ถ้าเป็นการเพิ่มข้อมูล
|
||||
if (actionType.value === "ADD") {
|
||||
props.dataNode?.orgLevel === 0 && checkOfficer();
|
||||
props.dataNode?.orgLevel === 0 && onCheckIsDeputy();
|
||||
|
||||
if (props.dataNode) {
|
||||
formData.isDeputy = false;
|
||||
formData.orgCode =
|
||||
props?.dataNode?.orgLevel !== 0
|
||||
? props?.dataNode.orgTreeCode
|
||||
|
|
@ -336,6 +364,7 @@ watch(
|
|||
formData.orgLevelSub = props.dataNode.orgTreeRankSub;
|
||||
formData.responsibility = props.dataNode.responsibility;
|
||||
formData.isOfficer = props.dataNode.isOfficer ?? false;
|
||||
formData.isDeputy = props.dataNode.isDeputy ?? false;
|
||||
orgLevelOption.value =
|
||||
props.dataNode.orgTreeRank === "DEPARTMENT"
|
||||
? 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>
|
||||
|
||||
<template>
|
||||
|
|
@ -547,6 +589,23 @@ function onChangeIsOfficer() {
|
|||
@update:model-value="onChangeIsOfficer"
|
||||
/>
|
||||
</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>
|
||||
</q-card-section>
|
||||
<q-separator />
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ interface FormDataAgency {
|
|||
orgLevelSub: string;
|
||||
responsibility: string;
|
||||
isOfficer?: boolean;
|
||||
isDeputy?: boolean;
|
||||
}
|
||||
|
||||
interface FormDataPosition {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue