refactor(org): add ROOT_CODE and CHILD_CODE fields for org hierarchy
This commit is contained in:
parent
72cbe6a8dc
commit
06ddc1c970
3 changed files with 145 additions and 12 deletions
|
|
@ -89,6 +89,11 @@ const formData = reactive<FormDataAgency>({
|
|||
DIVISION_CODE: "",
|
||||
SECTION_CODE: "",
|
||||
JOB_CODE: "",
|
||||
ROOT_CODE: "",
|
||||
CHILD1_CODE: "",
|
||||
CHILD2_CODE: "",
|
||||
CHILD3_CODE: "",
|
||||
CHILD4_CODE: "",
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -160,6 +165,11 @@ function onSubmit() {
|
|||
DIVISION_CODE: formData.DIVISION_CODE,
|
||||
SECTION_CODE: formData.SECTION_CODE,
|
||||
JOB_CODE: formData.JOB_CODE,
|
||||
ROOT_CODE: formData.ROOT_CODE,
|
||||
CHILD1_CODE: formData.CHILD1_CODE,
|
||||
CHILD2_CODE: formData.CHILD2_CODE,
|
||||
CHILD3_CODE: formData.CHILD3_CODE,
|
||||
CHILD4_CODE: formData.CHILD4_CODE,
|
||||
};
|
||||
|
||||
// เพิ่มข้อมูล
|
||||
|
|
@ -189,18 +199,20 @@ function onSubmit() {
|
|||
body
|
||||
)
|
||||
.then(async () => {
|
||||
await props.fetchDataTree(store.draftId);
|
||||
await props.edit?.(
|
||||
props.dataNode?.orgTreeId,
|
||||
type,
|
||||
body,
|
||||
props.dataNode?.orgRootCode
|
||||
);
|
||||
await props.fetchDataTable(
|
||||
props?.dataNode?.orgTreeId,
|
||||
props?.dataNode?.orgLevel,
|
||||
false
|
||||
);
|
||||
await Promise.all([
|
||||
await props.fetchDataTree(store.draftId),
|
||||
await props.edit?.(
|
||||
props.dataNode?.orgTreeId,
|
||||
type,
|
||||
body,
|
||||
props.dataNode?.orgRootCode
|
||||
),
|
||||
await props.fetchDataTable(
|
||||
props?.dataNode?.orgTreeId,
|
||||
props?.dataNode?.orgLevel,
|
||||
false
|
||||
),
|
||||
]);
|
||||
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeClear();
|
||||
})
|
||||
|
|
@ -231,6 +243,11 @@ function closeClear() {
|
|||
formData.isCommission = false;
|
||||
formData.isInformation = false;
|
||||
formData.misId = "";
|
||||
formData.ROOT_CODE = "";
|
||||
formData.CHILD1_CODE = "";
|
||||
formData.CHILD2_CODE = "";
|
||||
formData.CHILD3_CODE = "";
|
||||
formData.CHILD4_CODE = "";
|
||||
formData.DEPARTMENT_CODE = "";
|
||||
formData.DIVISION_CODE = "";
|
||||
formData.SECTION_CODE = "";
|
||||
|
|
@ -456,6 +473,7 @@ watch(
|
|||
else {
|
||||
props.dataNode?.orgLevel === 1 && checkOfficer();
|
||||
if (props.dataNode) {
|
||||
console.log(props.dataNode);
|
||||
formData.orgName = props.dataNode.orgTreeName;
|
||||
formData.orgShortName = props.dataNode.orgTreeShortName;
|
||||
formData.orgCode = props.dataNode.orgTreeCode;
|
||||
|
|
@ -474,6 +492,11 @@ watch(
|
|||
formData.DIVISION_CODE = props.dataNode.DIVISION_CODE;
|
||||
formData.SECTION_CODE = props.dataNode.SECTION_CODE;
|
||||
formData.JOB_CODE = props.dataNode.JOB_CODE;
|
||||
formData.ROOT_CODE = props.dataNode.ROOT_CODE;
|
||||
formData.CHILD1_CODE = props.dataNode.CHILD1_CODE;
|
||||
formData.CHILD2_CODE = props.dataNode.CHILD2_CODE;
|
||||
formData.CHILD3_CODE = props.dataNode.CHILD3_CODE;
|
||||
formData.CHILD4_CODE = props.dataNode.CHILD4_CODE;
|
||||
orgLevelOption.value =
|
||||
props.dataNode.orgTreeRank === "DEPARTMENT"
|
||||
? orgLevelOptionMain.value
|
||||
|
|
@ -730,6 +753,66 @@ watch(
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="col-12 row q-col-gutter-sm">
|
||||
<div class="col">
|
||||
<q-input
|
||||
v-model="formData.ROOT_CODE"
|
||||
dense
|
||||
outlined
|
||||
label="ROOT CODE"
|
||||
hide-bottom-space
|
||||
:class="classInput(false)"
|
||||
maxlength="3"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<q-input
|
||||
v-model="formData.CHILD1_CODE"
|
||||
dense
|
||||
outlined
|
||||
label="CHILD1 CODE"
|
||||
hide-bottom-space
|
||||
:class="classInput(false)"
|
||||
maxlength="3"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<q-input
|
||||
v-model="formData.CHILD2_CODE"
|
||||
dense
|
||||
outlined
|
||||
label="CHILD2 CODE"
|
||||
hide-bottom-space
|
||||
:class="classInput(false)"
|
||||
maxlength="3"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<q-input
|
||||
v-model="formData.CHILD3_CODE"
|
||||
dense
|
||||
outlined
|
||||
label="CHILD3 CODE"
|
||||
hide-bottom-space
|
||||
:class="classInput(false)"
|
||||
maxlength="3"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<q-input
|
||||
v-model="formData.CHILD4_CODE"
|
||||
dense
|
||||
outlined
|
||||
label="CHILD4 CODE"
|
||||
hide-bottom-space
|
||||
:class="classInput(false)"
|
||||
maxlength="3"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<q-input
|
||||
v-model="formData.responsibility"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ const formData = reactive({
|
|||
responsibility: "", //หน้าที่ความรับผิดชอบ
|
||||
isCommission: "", //สำนักปลัด
|
||||
isDeputy: "", //สำนักงาน กก.
|
||||
rootCode: "", //ROOT CODE
|
||||
child1Code: "", //CHILD1 CODE
|
||||
child2Code: "", //CHILD2 CODE
|
||||
child3Code: "", //CHILD3 CODE
|
||||
child4Code: "", //CHILD4 CODE
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
@ -76,6 +81,11 @@ async function fetchDetailTree(id: string, type: string) {
|
|||
formData.responsibility = data.responsibility ? data.responsibility : "-";
|
||||
formData.isDeputy = data.isDeputy ? "ใช่" : "-";
|
||||
formData.isCommission = data.isCommission ? "ใช่" : "-";
|
||||
formData.rootCode = data.ROOT_CODE ? data.ROOT_CODE : "-";
|
||||
formData.child1Code = data.CHILD1_CODE ? data.CHILD1_CODE : "-";
|
||||
formData.child2Code = data.CHILD2_CODE ? data.CHILD2_CODE : "-";
|
||||
formData.child3Code = data.CHILD3_CODE ? data.CHILD3_CODE : "-";
|
||||
formData.child4Code = data.CHILD4_CODE ? data.CHILD4_CODE : "-";
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -208,6 +218,41 @@ watch(
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row q-col-gutter-sm q-mb-xs">
|
||||
<div class="col-4 text-bold">ROOT CODE</div>
|
||||
<div class="col-8 text-grey-8">
|
||||
<p>{{ formData.rootCode }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row q-col-gutter-sm q-mb-xs">
|
||||
<div class="col-4 text-bold">CHILD1 CODE</div>
|
||||
<div class="col-8 text-grey-8">
|
||||
<p>{{ formData.child1Code }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row q-col-gutter-sm q-mb-xs">
|
||||
<div class="col-4 text-bold">CHILD2 CODE</div>
|
||||
<div class="col-8 text-grey-8">
|
||||
<p>{{ formData.child2Code }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row q-col-gutter-sm q-mb-xs">
|
||||
<div class="col-4 text-bold">CHILD3 CODE</div>
|
||||
<div class="col-8 text-grey-8">
|
||||
<p>{{ formData.child3Code }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row q-col-gutter-sm q-mb-xs">
|
||||
<div class="col-4 text-bold">CHILD4 CODE</div>
|
||||
<div class="col-8 text-grey-8">
|
||||
<p>{{ formData.child4Code }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row q-col-gutter-sm q-mb-xs">
|
||||
<div class="col-4 text-bold">หน้าที่ความรับผิดชอบ</div>
|
||||
<div class="col-8 text-grey-8">
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ interface FormDataAgency {
|
|||
DIVISION_CODE: string;
|
||||
SECTION_CODE: string;
|
||||
JOB_CODE: string;
|
||||
ROOT_CODE: string;
|
||||
CHILD1_CODE: string;
|
||||
CHILD2_CODE: string;
|
||||
CHILD3_CODE: string;
|
||||
CHILD4_CODE: string;
|
||||
}
|
||||
|
||||
interface FormDataPosition {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue