This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-19 15:41:37 +07:00
parent 848deaddbe
commit 64b6e10cb2
2 changed files with 192 additions and 27 deletions

View file

@ -10,9 +10,7 @@ import genreport from "@/plugins/genreportxlsx";
import config from "@/app.config";
import http from "@/plugins/http";
/**
* importType
*/
/** importType*/
import type { QTableProps } from "quasar";
import type {
ListMenu,
@ -22,10 +20,9 @@ import type {
import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational";
import type { PosMaster2 } from "@/modules/16_positionEmployee/interface/response/organizational";
import type { DataPosition } from "@/modules/16_positionEmployee/interface/index/organizational";
import type { DataPositionCondition } from "@/modules/19_condition/interface/response/Main";
/**
* importComponents
*/
/** importComponents*/
import DialogFormPosotion from "@/modules/16_positionEmployee/components/DialogFormPosition.vue";
import DialogPositionDetail from "@/modules/16_positionEmployee/components/DialogPositionDetail.vue";
import DialogSort from "@/modules/16_positionEmployee/components/DialogSortPosition.vue";
@ -34,18 +31,15 @@ import DialogHistoryPos from "@/modules/16_positionEmployee/components/DialogHis
import DialogSelectPerson from "@/modules/16_positionEmployee/components/DialogSelectPerson.vue";
import DialogSuccession from "@/modules/16_positionEmployee/components/DialogSuccession.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
import DialogCondition from "@/modules/16_positionEmployee/components/DialogCondition.vue";
/**
* ues
*/
/** ues*/
const $q = useQuasar();
const store = usePositionEmp();
const { showLoader, hideLoader, messageError, success, dialogRemove } =
useCounterMixin();
/**
* prosp
*/
/** prosp*/
const nodeTree = defineModel<any>("nodeTree", { required: true });
const orgLevel = defineModel<number>("orgLevel", { required: true });
const treeId = defineModel<string>("treeId", { required: true });
@ -72,9 +66,7 @@ const props = defineProps({
},
});
/**
* modal popup
*/
/** modal popup*/
const modalPerson = ref<boolean>(false); // popup
const personalId = ref<string>(""); // id
const dialogDetail = ref<boolean>(false); //
@ -84,6 +76,8 @@ const modalSort = ref<boolean>(false); // จัดลำดับ
const modalDialogMMove = ref<boolean>(false); //
const modalDialogSuccession = ref<boolean>(false); //
const modalDialogHistoryPos = ref<boolean>(false); //
const modalCondition = ref<boolean>(false); //
const dataCondition = ref<DataPositionCondition>();
const rowId = ref<string>("");
const actionType = ref<string>("");
@ -107,6 +101,12 @@ const listMenu = ref<ListMenu[]>([
type: "COPY",
color: "blue-6",
},
{
label: "จัดการตำแหน่งติดเงื่อนไข",
icon: "mdi-account-alert",
type: "CONDITION",
color: "deep-orange",
},
{
label: "ลบ",
icon: "delete",
@ -235,9 +235,7 @@ function onClickDelete(id: string) {
});
}
/**
* fdunction ดลำดบตำแหน
*/
/** function เปิด popup จัดลำดับตำแหน่ง*/
function onClickSort() {
modalSort.value = true;
}
@ -280,9 +278,7 @@ function openSelectPerson(data: DataPosition[]) {
dataDetailPos.value = data;
}
/**
* ลบคนครอง
*/
/** function ลบคนครอง*/
function removePerson(id: string) {
dialogRemove(
$q,
@ -313,15 +309,14 @@ function removePerson(id: string) {
/**
* function openPopup บทอดตำแหน
* @param id องการ
*/
function onClickInherit(id: string) {
modalDialogSuccession.value = !modalDialogSuccession.value;
rowId.value = id;
}
/**
* งขอมลสถจำนวนดานบน
*/
/** ดึงข้อมูลสถิติจำนวนด้านบน*/
function getSummary() {
showLoader();
http
@ -354,9 +349,13 @@ function getSummary() {
});
}
/** function DownloadReport*/
/**
* function DownloadReport
* @param val ประเภทเอกสารทองการดาวนโหลด
* @param name อเอกสารทองการดาวนโหลด
*
*/
async function onClickDownloadReport(val: string, name: string) {
// API
showLoader();
await http
.get(config.API.orgReport(val) + `/${treeId.value}`)
@ -379,6 +378,34 @@ const pagination = ref({
rowsPerPage: reqMaster.value.pageSize,
});
/**
* function เป popup ดการตำแหนงตดเงอนไข
* @param data อมลตำแหน
*/
function onClickCodition(data: any) {
dataCondition.value = {
conditionReason: data.conditionReason
? data.conditionReason.replace(/ /g, " \n")
: "",
id: data.id,
isCondition: data.isCondition,
orgShortname: data.orgShortname,
posMasterNo: Number(data.posMasterNo),
posMasterNoPrefix: data.posMasterNoPrefix,
posMasterNoSuffix: data.posMasterNoSuffix,
profilePosition: data.profilePosition,
profilePoslevel: data.profilePoslevel,
profilePostype: data.profilePostype,
positions: [],
};
modalCondition.value = true;
}
/** function fetchข้อมูลใหม่*/
async function fetchDataCondition() {
props.fetchDataTable?.(reqMaster.value.id, reqMaster.value.type, false);
}
watch(
() => modalDialogMMove.value,
() => {
@ -593,6 +620,8 @@ watch(
? onClickInherit(props.row.id)
: item.type === 'COPY'
? onClickPosition('COPY', props.row.id)
: item.type === 'CONDITION'
? onClickCodition(props.row)
: null
"
>
@ -624,7 +653,12 @@ watch(
</q-menu>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
:class="props.row.isCondition ? 'text-red' : ''"
>
<div v-if="col.name == 'no'">
{{
(reqMaster.page - 1) * Number(reqMaster.pageSize) +
@ -672,6 +706,12 @@ watch(
>
<q-tooltip>อมลในทะเบยนประว</q-tooltip>
</q-btn>
{{
props.row.isCondition && props.row.conditionReason
? `\r(${props.row.conditionReason})`
: ""
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
@ -758,6 +798,13 @@ watch(
@update:modal="(value:any)=>{modalPerson = value}"
:type="'employee'"
/>
<!-- ดการตำแหนงตดเงอนไข -->
<DialogCondition
v-model:modal="modalCondition"
:fetch-data="fetchDataCondition"
:data-condition="dataCondition"
/>
</template>
<style lang="scss" scoped>