Merge branch 'develop' into dev

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-11 10:19:02 +07:00
commit 0c416e3cbc
3 changed files with 69 additions and 6 deletions

View file

@ -198,4 +198,8 @@ export default {
orgIssues: `${organization}/issues`,
// active รักษาการในตำแหน่งตามหน่วยงาน
activeActPosition: (id: string) => `${orgPosAct}/${id}`,
//เผยแพร่จากร่างเป็นปัจจุบัน
moveDraftToCurrent: (rootDndId: string) =>
`${organization}/move-draft-to-current/${rootDndId}`,
};

View file

@ -1,9 +1,10 @@
<script setup lang="ts">
import { ref, watch } from "vue";
import { ref, watch, computed } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
import { useRoute } from "vue-router";
/** importType*/
import type { ListMenu } from "@/modules/02_organization/interface/index/Main";
@ -23,8 +24,15 @@ import { useCounterMixin } from "@/stores/mixin";
/** use*/
const $q = useQuasar();
const store = useOrganizational();
const { dialogRemove, showLoader, hideLoader, messageError, success } =
useCounterMixin();
const route = useRoute();
const {
dialogRemove,
showLoader,
hideLoader,
messageError,
success,
dialogConfirm,
} = useCounterMixin();
/** props*/
const nodeTEST = defineModel<OrgTree[]>("nodeTree", { default: [] });
@ -84,8 +92,30 @@ const listAdd = ref<ListMenu[]>([
type: "DETAIL",
color: "blue-9",
},
{
label: "เผยแพร่",
icon: "mdi-publish",
type: "PUBLISH",
color: "indigo-9",
},
]);
const getMenuItems = computed(() => {
return (orgLevel: number) => {
const isOwner = checkPermission(route)?.attrOwnership === "OWNER";
const isLevel4 = orgLevel === 4;
const isRoot = orgLevel === 0;
if (isRoot && isOwner) {
return listAdd.value;
} else if (isLevel4) {
return listAdd.value.slice(1, 6);
} else {
return listAdd.value.slice(0, 6);
}
};
});
const filter = ref<string>("");
const nodes = ref<Array<OrgTree>>([]);
const dataSort = ref<Array<any>>([]);
@ -372,6 +402,33 @@ function onClickHistory(level: number, id: string) {
modalHistory.value = true;
}
/**
* งกนเผยแพรโครงสรางจากรางเปนปจจนตามหนวยงาน
* @param data อมลโครงสราง
*/
function onPublicOrganization(data: OrgTree) {
const orgName = data.orgName; //
const orgDnaId = data.orgDnaId; // ID
dialogConfirm(
$q,
async () => {
showLoader();
try {
await http.post(config.API.moveDraftToCurrent(orgDnaId));
await props.fetchDataTree?.();
await success($q, "เผยแพร่โครงสร้างสำเร็จ");
} catch (err) {
messageError($q, err);
} finally {
hideLoader();
}
},
"ยืนยันการเผยแพร่โครงสร้างและอัตรากำลัง",
`คุณต้องการเผยแพร่โครงสร้างและอัตรากำลังของ${orgName} ใช่หรือไม่?`
);
}
watch(
() => nodeTEST.value,
() => {
@ -488,9 +545,7 @@ watch(
<q-menu>
<q-list
dense
v-for="(item, index) in prop.node.orgLevel === 4
? listAdd.slice(1, 6)
: listAdd"
v-for="(item, index) in getMenuItems(prop.node.orgLevel)"
:key="index"
style="min-width: 100px"
>
@ -520,6 +575,8 @@ watch(
prop.node.orgLevel,
prop.node.orgTreeId
)
: item.type === 'PUBLISH'
? onPublicOrganization(prop.node)
: null
"
>

View file

@ -37,6 +37,8 @@ interface OrgTree {
orgRevisionId: string;
isOfficer: boolean;
children: OrgTree[];
orgName: string;
orgDnaId: string;
}
interface OrgRevision {