closed: edit positions in current org structure (#1418)
This commit is contained in:
parent
8e56123e12
commit
7cb580060b
9 changed files with 85 additions and 31 deletions
|
|
@ -119,7 +119,11 @@ function onClickMovePos() {
|
|||
await http
|
||||
.post(config.API.orgPosMove, body)
|
||||
.then(async () => {
|
||||
await props.fetchDataTree?.(store.draftId);
|
||||
await props.fetchDataTree?.(
|
||||
store.typeOrganizational === "draft"
|
||||
? store.draftId
|
||||
: store.activeId
|
||||
);
|
||||
await success($q, "ย้ายตำแหน่งสำเร็จ");
|
||||
modal.value = false;
|
||||
})
|
||||
|
|
|
|||
|
|
@ -89,7 +89,8 @@ function getData() {
|
|||
page: 1,
|
||||
pageSize: props.totalData,
|
||||
keyword: "",
|
||||
revisionId: store.draftId,
|
||||
revisionId:
|
||||
store.typeOrganizational === "draft" ? store.draftId : store.activeId,
|
||||
})
|
||||
.then((res) => {
|
||||
const dataList = res.data.result.data;
|
||||
|
|
@ -99,7 +100,15 @@ function getData() {
|
|||
item.posMasterNoPrefix ? item.posMasterNoPrefix : ""
|
||||
}${item.posMasterNo ? item.posMasterNo : ""}${
|
||||
item.posMasterNoSuffix ? item.posMasterNoSuffix : ""
|
||||
} ${item.fullNameNextHolder ? item.fullNameNextHolder : ""}`,
|
||||
} ${
|
||||
store.typeOrganizational === "draft"
|
||||
? item.fullNameNextHolder
|
||||
? item.fullNameNextHolder
|
||||
: "ว่าง"
|
||||
: item.fullNameCurrentHolder
|
||||
? item.fullNameCurrentHolder
|
||||
: "ว่าง"
|
||||
}`,
|
||||
posMasterNoPrefix: item.posMasterNoPrefix,
|
||||
posMasterNo: item.posMasterNo,
|
||||
posMasterNoSuffix: item.posMasterNoSuffix,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,10 @@ const levelTree = ref<number>(0);
|
|||
*/
|
||||
async function fetchTree() {
|
||||
showLoader();
|
||||
const id: string = store.activeId ? store.activeId?.toString() : "";
|
||||
const id: string =
|
||||
(store.typeOrganizational === "draft"
|
||||
? store.activeId
|
||||
: store.historyDnaOrgId) ?? "";
|
||||
await http
|
||||
.get(config.API.orgByid(id))
|
||||
.then((res) => {
|
||||
|
|
@ -116,7 +119,10 @@ const reqMaster = reactive<FilterMaster>({
|
|||
page: 1,
|
||||
pageSize: 10,
|
||||
keyword: "",
|
||||
revisionId: store.activeId,
|
||||
revisionId:
|
||||
store.typeOrganizational === "draft"
|
||||
? store.activeId
|
||||
: store.historyDnaOrgId,
|
||||
});
|
||||
const totalRow = ref<number>(0);
|
||||
const selectedPos = ref<PosMaster[]>([]);
|
||||
|
|
@ -178,7 +184,12 @@ function onClickConfirm() {
|
|||
$q,
|
||||
async () => {
|
||||
const body: Inherit = {
|
||||
draftRevisionId:
|
||||
store.typeOrganizational === "draft"
|
||||
? store.draftId
|
||||
: store.activeId,
|
||||
draftPositionId: props.rowId,
|
||||
publishRevisionId: reqMaster.revisionId,
|
||||
publishPositionId: selectedPos.value[0].id,
|
||||
};
|
||||
showLoader();
|
||||
|
|
@ -238,7 +249,9 @@ watch([() => reqMaster.page, () => reqMaster.pageSize], async () => {
|
|||
<q-dialog v-model="modal" full-width persistent>
|
||||
<q-card>
|
||||
<Header
|
||||
:tittle="'เลือกตำแหน่งที่ต้องการสืบทอดจากโครงสร้างปัจจุบัน'"
|
||||
:tittle="`เลือกตำแหน่งที่ต้องการสืบทอดจากโครงสร้าง${
|
||||
store.typeOrganizational === 'draft' ? 'ปัจจุบัน' : 'ก่อนหน้า'
|
||||
}`"
|
||||
:close="
|
||||
() => {
|
||||
(modal = false), (filterTree = '');
|
||||
|
|
|
|||
|
|
@ -117,6 +117,12 @@ const listMenu = ref<ListMenu[]>([
|
|||
type: "HISTORY",
|
||||
color: "deep-purple",
|
||||
},
|
||||
{
|
||||
label: "ดูรายละเอียด",
|
||||
icon: "mdi-eye",
|
||||
type: "VIEW",
|
||||
color: "blue",
|
||||
},
|
||||
]);
|
||||
|
||||
const baseDocument = ref<DataDocument[]>([
|
||||
|
|
@ -563,7 +569,13 @@ watch(
|
|||
<!-- TOOLBAR -->
|
||||
<div class="col-12">
|
||||
<q-toolbar style="padding: 0">
|
||||
<div v-if="store.typeOrganizational === 'draft' && !store.isLosck">
|
||||
<div
|
||||
v-if="
|
||||
(checkPermission($route)?.attrOwnership == 'OWNER' &&
|
||||
store.typeOrganizational === 'current') ||
|
||||
(store.typeOrganizational === 'draft' && !store.isLock)
|
||||
"
|
||||
>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
|
|
@ -678,7 +690,11 @@ watch(
|
|||
<q-tr :props="props">
|
||||
<q-td>
|
||||
<q-btn
|
||||
v-if="store.typeOrganizational === 'draft' && !store.isLosck"
|
||||
v-if="
|
||||
(checkPermission($route)?.attrOwnership == 'OWNER' &&
|
||||
store.typeOrganizational === 'current') ||
|
||||
(store.typeOrganizational === 'draft' && !store.isLock)
|
||||
"
|
||||
flat
|
||||
color="secondary"
|
||||
icon="mdi-dots-horizontal-circle-outline"
|
||||
|
|
@ -689,10 +705,7 @@ watch(
|
|||
<q-list dense style="min-width: 150px">
|
||||
<!-- เลือกคนครอง -->
|
||||
<q-item
|
||||
v-if="
|
||||
props.row.positionIsSelected == 'ว่าง' &&
|
||||
store.typeOrganizational === 'draft'
|
||||
"
|
||||
v-if="props.row.positionIsSelected == 'ว่าง'"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="openSelectPerson(props.row)"
|
||||
|
|
@ -709,10 +722,7 @@ watch(
|
|||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-else-if="
|
||||
props.row.positionIsSelected != 'ว่าง' &&
|
||||
store.typeOrganizational === 'draft'
|
||||
"
|
||||
v-else-if="props.row.positionIsSelected != 'ว่าง'"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="removePerson(props.row.id)"
|
||||
|
|
@ -729,7 +739,16 @@ watch(
|
|||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-for="(item, index) in listMenu"
|
||||
v-for="(item, index) in props.row.positionIsSelected !=
|
||||
'ว่าง' && store.typeOrganizational === 'current'
|
||||
? listMenu.filter(
|
||||
(item) =>
|
||||
item.type !== 'DEL' && item.type !== 'CONDITION'
|
||||
)
|
||||
: props.row.positionIsSelected != 'ว่าง' &&
|
||||
store.typeOrganizational === 'draft'
|
||||
? listMenu.filter((item) => item.type !== 'CONDITION')
|
||||
: listMenu"
|
||||
:key="index"
|
||||
clickable
|
||||
v-close-popup
|
||||
|
|
@ -748,6 +767,8 @@ watch(
|
|||
? onClickCopyPosition('COPY', props.row.id, props.row)
|
||||
: item.type === 'CONDITION'
|
||||
? onClickCodition(props.row)
|
||||
: item.type === 'VIEW'
|
||||
? onClickViewDetail(props.row)
|
||||
: null
|
||||
"
|
||||
>
|
||||
|
|
@ -762,8 +783,7 @@ watch(
|
|||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
v-if="props.row.positionIsSelected != 'ว่าง'"
|
||||
<!-- <q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="onClickViewDetail(props.row)"
|
||||
|
|
@ -774,7 +794,7 @@ watch(
|
|||
<div class="q-pl-md">ดูรายละเอียด</div>
|
||||
</div>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-item> -->
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
|
|
|
|||
|
|
@ -387,8 +387,7 @@ watch(
|
|||
<div class="col-2" v-if="store.typeOrganizational === 'draft'">
|
||||
<q-btn
|
||||
v-if="
|
||||
checkPermission($route)?.attrOwnership == 'OWNER' &&
|
||||
!store.isLosck
|
||||
checkPermission($route)?.attrOwnership == 'OWNER' && !store.isLock
|
||||
"
|
||||
dense
|
||||
flat
|
||||
|
|
@ -405,7 +404,7 @@ watch(
|
|||
:class="
|
||||
store.typeOrganizational === 'draft' &&
|
||||
checkPermission($route)?.attrOwnership == 'OWNER' &&
|
||||
!store.isLosck
|
||||
!store.isLock
|
||||
? 'col-10'
|
||||
: 'col-12'
|
||||
"
|
||||
|
|
@ -477,7 +476,7 @@ watch(
|
|||
</div>
|
||||
|
||||
<q-btn
|
||||
v-if="store.typeOrganizational === 'draft' && !store.isLosck"
|
||||
v-if="store.typeOrganizational === 'draft' && !store.isLock"
|
||||
@click.stop
|
||||
flat
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ interface MovePos {
|
|||
interface Inherit {
|
||||
draftPositionId: string;
|
||||
publishPositionId: string;
|
||||
draftRevisionId?: string;
|
||||
publishRevisionId?: string;
|
||||
}
|
||||
|
||||
export type { FilterMaster, MovePos, Inherit };
|
||||
|
|
|
|||
|
|
@ -24,11 +24,12 @@ export const useOrganizational = defineStore("organizationalStore", () => {
|
|||
const activeId = ref<string>(); // id โครงสร้างปัจจุบัน
|
||||
const draftId = ref<string>(); // id แบบร่างโครงสร้าง
|
||||
const historyId = ref<string>(); // id ประวัติโครงสร้าง
|
||||
const historyDnaOrgId = ref<string>(); // id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
||||
const isPublic = ref<boolean>(false); // การเผยแพร่
|
||||
const treeId = ref<string>(); // id โหนด
|
||||
const level = ref<number>(); // ระดับโหนด
|
||||
const orgPublishDate = ref<Date | null>(null); // วันเผยแพร่
|
||||
const isLosck = ref<boolean>(false);
|
||||
const isLock = ref<boolean>(false);
|
||||
const sumPosition = reactive({
|
||||
total: 0,
|
||||
use: 0,
|
||||
|
|
@ -217,9 +218,10 @@ export const useOrganizational = defineStore("organizationalStore", () => {
|
|||
isOfficer,
|
||||
isStaff,
|
||||
rootId,
|
||||
isLosck,
|
||||
isLock,
|
||||
remark,
|
||||
convertStatus,
|
||||
fetchDataTree,
|
||||
historyDnaOrgId,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ async function fetchOrganizationActive() {
|
|||
if (data.draftId) {
|
||||
await fetchCheckIslock(data.draftId);
|
||||
} else {
|
||||
store.isLosck = false;
|
||||
store.isLock = false;
|
||||
}
|
||||
|
||||
if (data.activeName === null && data.draftName === null) {
|
||||
|
|
@ -101,6 +101,9 @@ async function fetchHistory() {
|
|||
? date2Thai(e.orgRevisionCreatedAt)
|
||||
: "",
|
||||
}));
|
||||
|
||||
// id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
||||
store.historyDnaOrgId = itemHistory.value[0].id;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -151,7 +154,7 @@ async function fetchCheckIslock(id: string) {
|
|||
.get(config.API.orgIsLock + `/${id}`)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
store.isLosck = data;
|
||||
store.isLock = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -178,9 +181,9 @@ watch(
|
|||
* ดึงข้อมูลโครงสร้างและรายการประวัติโครงสร้าง
|
||||
*/
|
||||
onMounted(async () => {
|
||||
const type = localStorage.getItem('org_type') ?? "current";
|
||||
const type = localStorage.getItem("org_type") ?? "current";
|
||||
store.typeOrganizational = type;
|
||||
localStorage.removeItem('org_type');
|
||||
localStorage.removeItem("org_type");
|
||||
await Promise.all([fetchOrganizationActive(), fetchHistory()]);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -331,7 +334,7 @@ onMounted(async () => {
|
|||
<q-btn
|
||||
v-if="
|
||||
checkPermission($route)?.attrOwnership == 'OWNER' &&
|
||||
!store.isLosck
|
||||
!store.isLock
|
||||
"
|
||||
color="green-6"
|
||||
dense
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ function onCloseDialog() {
|
|||
function onSubmit() {
|
||||
dialogConfirm($q, async () => {
|
||||
showLoader();
|
||||
formData.conditionReason =
|
||||
formData.isCondition === false ? "" : formData.conditionReason; // ถ้าไม่เลือกติดเงื่อนไขให้หมายเหตุเป็นค่าว่าง
|
||||
await http
|
||||
.put(
|
||||
config.API.positionCondition + `/${props?.dataCondition?.id}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue