Merge branch 'develop' into dev
This commit is contained in:
commit
0c416e3cbc
3 changed files with 69 additions and 6 deletions
|
|
@ -198,4 +198,8 @@ export default {
|
|||
orgIssues: `${organization}/issues`,
|
||||
// active รักษาการในตำแหน่งตามหน่วยงาน
|
||||
activeActPosition: (id: string) => `${orgPosAct}/${id}`,
|
||||
|
||||
//เผยแพร่จากร่างเป็นปัจจุบัน
|
||||
moveDraftToCurrent: (rootDndId: string) =>
|
||||
`${organization}/move-draft-to-current/${rootDndId}`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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
|
||||
"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ interface OrgTree {
|
|||
orgRevisionId: string;
|
||||
isOfficer: boolean;
|
||||
children: OrgTree[];
|
||||
orgName: string;
|
||||
orgDnaId: string;
|
||||
}
|
||||
|
||||
interface OrgRevision {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue