refactor(DialogOrgSelect): reset positionData to default values

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-05-05 17:39:52 +07:00
parent a7341c7440
commit 999a2d1b45

View file

@ -244,10 +244,16 @@ function close() {
expanded.value = [];
nodeLevel.value = 0;
nodeId.value = "";
positionData.value = [];
positionNo.value = [];
rowData.value = [];
}
async function getDataTable(id: string, level: number = 0) {
showLoader();
positionData.value = [];
positionNo.value = [];
rowData.value = [];
const body = {
node: level,
nodeId: id,
@ -261,7 +267,7 @@ async function getDataTable(id: string, level: number = 0) {
await http
.post(config.API.orgPosPlacement, body)
.then((res) => {
.then(async (res) => {
const dataMain: PositionMain[] = [];
posMasterMain.value = res.data.result.data;
@ -299,7 +305,6 @@ async function getDataTable(id: string, level: number = 0) {
positionNo.value = listPosNo;
rowData.value = listPosNo;
// positionData.value = listPosNo;
if (props.dataRows?.posmasterId) {
const newUse = positionUse.value.filter(
@ -313,6 +318,7 @@ async function getDataTable(id: string, level: number = 0) {
(e: any) => !positionUse.value.includes(e.id)
);
}
await onClickSelectPos(positionId.value);
})
.catch((err) => {
messageError($q, err);
@ -409,7 +415,6 @@ async function fetchPosFind(level: number, id: string) {
seletcId.value = props?.dataRows?.positionId;
datePos.value = props?.dataRows?.reportingDate;
await getDataTable(nodeId.value, level);
await onClickSelectPos(positionId.value);
})
.catch((e) => {
messageError($q, e);