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