Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 2m53s

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-05-06 10:55:15 +07:00
commit 7848323b1f
3 changed files with 46 additions and 52 deletions

View file

@ -22,7 +22,7 @@ const store = useSelectOrgStore();
/** props*/ /** props*/
const selected = defineModel("selectedPos", { required: true }); // const selected = defineModel("selectedPos", { required: true }); //
const positionId = defineModel<string>("positionId", { required: true }); //id const positionId = defineModel<string>("positionId", { required: true }); //id
const seletcId = defineModel<string>("seletcId", { required: true }); // const selectId = defineModel<string>("selectId", { required: true }); //
const date = defineModel<Date | null>("datePos", { required: true }); // const date = defineModel<Date | null>("datePos", { required: true }); //
const positionData = defineModel<any[]>("position", { required: true }); // const positionData = defineModel<any[]>("position", { required: true }); //
const isAll = defineModel<boolean>("isAll", { required: true }); // const isAll = defineModel<boolean>("isAll", { required: true }); //
@ -214,9 +214,9 @@ async function onClickSelectPos(id: string) {
// //
if (position) { if (position) {
rowsPosition.value = position.positions; rowsPosition.value = position.positions;
if (seletcId.value) { if (selectId.value) {
selected.value = rowsPosition.value.filter( selected.value = rowsPosition.value.filter(
(e) => e.id === seletcId.value (e) => e.id === selectId.value
); );
} }
} }

View file

@ -11,6 +11,7 @@ import { useStructureTree } from "@/stores/structureTree";
/** importType*/ /** importType*/
import type { import type {
DataList,
PositionMaim, PositionMaim,
PositionNo, PositionNo,
Positions, Positions,
@ -41,17 +42,14 @@ const {
/**props*/ /**props*/
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const props = defineProps({
dataRow: { interface Props {
type: Object, dataRow?: DataList;
require: true, fetchTable?: () => Promise<void>;
}, fetchStatCard?: () => Promise<void>;
fetchTable: { }
type: Function,
require: true, const props = defineProps<Props>();
},
fetchStatCard: { type: Function, require: true },
});
/** Tree*/ /** Tree*/
const nodeId = ref<string>(""); const nodeId = ref<string>("");
@ -65,12 +63,12 @@ const expanded = ref<string[]>([]);
const positionUse = ref<string[]>([]); const positionUse = ref<string[]>([]);
const positionNo = ref<DataPositionNo[]>([]); const positionNo = ref<DataPositionNo[]>([]);
const positionId = ref<string>(""); const positionId = ref<string>("");
const seletcId = ref<string>(""); const selectId = ref<string>("");
const posType = ref<FormPosType | null>(null); const posType = ref<FormPosType | null>(null);
const posLevel = ref<string>(""); const posLevel = ref<string>("");
const selectedPos = ref<any[]>([]); const selectedPos = ref<Positions[]>([]);
const datePos = ref<Date | null>(new Date()); const datePos = ref<Date | null>(new Date());
const posMasterMain = ref<any[]>([]); const posMasterMain = ref<PositionMaim[]>([]);
const orgRevisionId = ref<string>(""); const orgRevisionId = ref<string>("");
const optionPosType = ref<FormPosType[]>([]); const optionPosType = ref<FormPosType[]>([]);
const optionPosLevel = ref<FormPosLevel[]>([]); const optionPosLevel = ref<FormPosLevel[]>([]);
@ -92,14 +90,14 @@ async function fetchStructure() {
*/ */
function updateSelected(data: TreeMain) { function updateSelected(data: TreeMain) {
if (props?.dataRow?.nodeId === data.orgTreeId) { if (props?.dataRow?.nodeId === data.orgTreeId) {
positionId.value = props?.dataRow?.posmasterId; positionId.value = props?.dataRow?.posmasterId ?? "";
seletcId.value = props?.dataRow?.positionId; selectId.value = props?.dataRow?.positionId ?? "";
datePos.value = props?.dataRow?.reportingDate datePos.value = props?.dataRow?.reportingDate
? new Date(props.dataRow.reportingDate) ? new Date(props.dataRow.reportingDate)
: new Date(); : new Date();
} else { } else {
positionId.value = ""; positionId.value = "";
seletcId.value = ""; selectId.value = "";
selectedPos.value = []; selectedPos.value = [];
datePos.value = new Date(); datePos.value = new Date();
} }
@ -155,7 +153,7 @@ async function fetchDataTable(id: string, level: number = 0) {
if (p.length !== 0) { if (p.length !== 0) {
const a = p.find((el: Positions) => el.positionIsSelected === true); const a = p.find((el: Positions) => el.positionIsSelected === true);
const { id, ...rest } = a ? a : p[0]; const { id, ...rest } = a ? a : p[0];
const data: any = { ...e, ...rest }; const data: PositionMaim = { ...e, ...rest } as PositionMaim;
dataMain.push(data); dataMain.push(data);
} }
}); });
@ -167,10 +165,10 @@ async function fetchDataTable(id: string, level: number = 0) {
(e) => e !== props.dataRow?.posmasterId (e) => e !== props.dataRow?.posmasterId
); );
positionNo.value = posMain.filter((e: any) => !newUse.includes(e.id)); positionNo.value = posMain.filter((e: DataPositionNo) => !newUse.includes(e.id));
} else { } else {
positionNo.value = posMain.filter( positionNo.value = posMain.filter(
(e: any) => !positionUse.value.includes(e.id) (e: DataPositionNo) => !positionUse.value.includes(e.id)
); );
} }
@ -202,8 +200,8 @@ async function fetchPosFind(level: number, id: string) {
expanded.value = data; expanded.value = data;
nodeId.value = id; nodeId.value = id;
positionId.value = props?.dataRow?.posmasterId; positionId.value = props?.dataRow?.posmasterId ?? "";
seletcId.value = props?.dataRow?.positionId; selectId.value = props?.dataRow?.positionId ?? "";
datePos.value = props?.dataRow?.reportingDate datePos.value = props?.dataRow?.reportingDate
? new Date(props.dataRow.reportingDate) ? new Date(props.dataRow.reportingDate)
: new Date(); : new Date();
@ -218,12 +216,14 @@ async function fetchPosFind(level: number, id: string) {
/** function บันทึกข้อมูลตำแหน่ง*/ /** function บันทึกข้อมูลตำแหน่ง*/
async function onClickSubmit() { async function onClickSubmit() {
const dataPosMaster = await posMasterMain.value?.find( const dataPosMaster = posMasterMain.value?.find(
(e: any) => e.id === positionId.value (e) => e.id === positionId.value
); );
if (selectedPos.value.length === 0) { if (selectedPos.value.length === 0) {
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง"); dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
} else if (!dataPosMaster) {
dialogMessageNotify($q, "ไม่พบข้อมูลตำแหน่ง");
} else { } else {
dialogConfirm($q, async () => { dialogConfirm($q, async () => {
showLoader(); showLoader();
@ -290,7 +290,7 @@ watch(
if (modal.value) { if (modal.value) {
await fetchPositionUes(); await fetchPositionUes();
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) { if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
await fetchPosFind(props?.dataRow?.node, props?.dataRow?.nodeId); await fetchPosFind(props?.dataRow?.node ?? 0, props?.dataRow?.nodeId ?? "");
} else { } else {
expanded.value = []; expanded.value = [];
} }
@ -343,28 +343,15 @@ function onPosType() {
} }
watch( watch(
() => isAll.value, [isAll, isBlank, () => isPosition.value],
(value, oldVal) => { ([newAll, newBlank, newPos], [oldAll, oldBlank, oldPos]) => {
if (value !== oldVal) { const shouldFetch = (newAll !== oldAll) || (newBlank !== oldBlank);
const isSelectMode = newPos === "select" && oldPos !== "select";
if (shouldFetch || isSelectMode) {
fetchDataTable(nodeId.value, nodeLevel.value); fetchDataTable(nodeId.value, nodeLevel.value);
} }
} if (isSelectMode) {
);
watch(
() => isBlank.value,
(value, oldVal) => {
if (value !== oldVal) {
fetchDataTable(nodeId.value, nodeLevel.value);
}
}
);
watch(
() => isPosition.value === "select",
(value, oldVal) => {
if (value !== oldVal) {
fetchDataTable(nodeId.value, nodeLevel.value);
getOrgPosType(); getOrgPosType();
} }
} }
@ -465,15 +452,15 @@ onMounted(() => {
:name="item" :name="item"
> >
<CardPosition <CardPosition
v-model:position="positionNo as []" v-model:position="positionNo"
v-model:selectedPos="selectedPos" v-model:selectedPos="selectedPos"
v-model:datePos="datePos" v-model:datePos="datePos"
v-model:positionId="positionId" v-model:positionId="positionId"
v-model:seletcId="seletcId" v-model:selectId="selectId"
v-model:is-all="isAll" v-model:is-all="isAll"
v-model:is-blank="isBlank" v-model:is-blank="isBlank"
v-model:is-position="isPosition" v-model:is-position="isPosition"
v-model:pos-type="posType as FormPosType | null" v-model:pos-type="posType"
v-model:pos-level="posLevel" v-model:pos-level="posLevel"
v-model:option-pos-type="optionPosType" v-model:option-pos-type="optionPosType"
v-model:option-pos-level="optionPosLevel" v-model:option-pos-level="optionPosLevel"
@ -481,7 +468,7 @@ onMounted(() => {
:on-pos-type="onPosType" :on-pos-type="onPosType"
:node-id="nodeId" :node-id="nodeId"
:node-level="nodeLevel" :node-level="nodeLevel"
:bma-officer="props.dataRow?.bmaOfficer" :bma-officer="props.dataRow?.bmaOfficer ?? ''"
:is-load-position="isLoadPosition" :is-load-position="isLoadPosition"
/> />
</q-tab-panel> </q-tab-panel>

View file

@ -1,17 +1,24 @@
interface DataList { interface DataList {
avatar: string; avatar: string;
bmaOfficer: string; bmaOfficer: string;
bmaOfficerCheck?: string;
deferment: boolean; deferment: boolean;
draft: string; draft: string;
examNumber: number; examNumber: number;
fullName: string; fullName: string;
idCard: string; idCard: string;
name: string; name: string;
node: number | null;
nodeId: string | null;
orgName: string | null; orgName: string | null;
organizationName: string; organizationName: string;
organizationShortName: string | null; organizationShortName: string | null;
personalId: string; personalId: string;
posLevelCandidateId: string | null;
posmasterId: string | null;
posTypeCandidateId: string | null;
positionCandidate: string; positionCandidate: string;
positionId: string | null;
positionNumber: string | null; positionNumber: string | null;
positionPath: string | null; positionPath: string | null;
profilePhoto: string; profilePhoto: string;