Refactoring code module 02_organization
This commit is contained in:
parent
63b9aafbaf
commit
0f5d772e53
24 changed files with 805 additions and 1033 deletions
|
|
@ -1,18 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from "vue";
|
||||
import { reactive, watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useOrganizational } from "@/modules/02_organization/store/organizational";
|
||||
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const store = useOrganizational();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||
const { showLoader, hideLoader, messageError } = mixin;
|
||||
|
||||
const modal = defineModel<boolean>("structureDetail", { required: true });
|
||||
const treeId = defineModel<string>("treeId", { required: true });
|
||||
|
|
@ -30,12 +30,17 @@ const formData = reactive<any>({
|
|||
orgShortName: "",
|
||||
});
|
||||
|
||||
/**
|
||||
* function ดึงข้อมูลรายละเอียดโหนดขอโครงสร้างตาม ID โหนดโครงสร้าง
|
||||
* @param id id โหนดโครงสร้าง
|
||||
* @param type ระดับโหนดของโครงอสร้าง
|
||||
*/
|
||||
async function fetchDetailTree(id: string, type: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.orgLevelByid(type.toLocaleLowerCase(), id))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result;
|
||||
const range = data[`org${type}Rank`];
|
||||
formData.orgName = data.orgRootName ? data.orgRootName : "-";
|
||||
formData.agencyName = data.orgName ? data.orgName : "-";
|
||||
|
|
@ -60,10 +65,19 @@ async function fetchDetailTree(id: string, type: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function ปิด popup
|
||||
*/
|
||||
function close() {
|
||||
modal.value = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* ดูการเปลี่ยนแปลงของ modal
|
||||
*
|
||||
* เมื่อ modal เป็น true จะส่งระดับของโหนดไปเช็ค
|
||||
* และจะดึงข้อมูลรายละเอียดโหนดขอโครงสร้างตาม ID และ ระดับ โหนดโครงสร้าง
|
||||
*/
|
||||
watch(
|
||||
() => modal.value,
|
||||
async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue