fix bug
This commit is contained in:
parent
c1bb3651ab
commit
4986a17e06
3 changed files with 68 additions and 11 deletions
|
|
@ -3,11 +3,11 @@ import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { ref, watch, reactive } from "vue";
|
import { ref, watch, reactive } from "vue";
|
||||||
import type { QTableProps } from "quasar";
|
import { useRoute } from "vue-router";
|
||||||
import CardPosition from "@/modules/05_placement/components/PersonalList/CardPosition.vue";
|
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
OrgTree,
|
OrgTree,
|
||||||
DataTree,
|
DataTree,
|
||||||
|
|
@ -27,6 +27,7 @@ const props = defineProps({
|
||||||
onSubmit: Function,
|
onSubmit: Function,
|
||||||
});
|
});
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
const route = useRoute();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const {
|
const {
|
||||||
dialogConfirm,
|
dialogConfirm,
|
||||||
|
|
@ -37,14 +38,15 @@ const {
|
||||||
dialogMessageNotify,
|
dialogMessageNotify,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
|
/** props*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const title = defineModel<string>("title", { required: true });
|
const title = defineModel<string>("title", { required: true });
|
||||||
const type = defineModel<any>("type", { required: true });
|
const type = defineModel<any>("type", { required: true });
|
||||||
|
|
||||||
const posType = defineModel<any>("posType", { required: true });
|
const posType = defineModel<any>("posType", { required: true });
|
||||||
const posLevel = defineModel<any>("posLevel", { required: true });
|
const posLevel = defineModel<any>("posLevel", { required: true });
|
||||||
const position = defineModel<any>("position", { required: true });
|
const position = defineModel<any>("position", { required: true });
|
||||||
|
|
||||||
|
// const routeName = ref<string>(route?.name);
|
||||||
const orgRevisionId = ref<string>("");
|
const orgRevisionId = ref<string>("");
|
||||||
const filter = ref<string>("");
|
const filter = ref<string>("");
|
||||||
const isAll = ref<boolean>(false);
|
const isAll = ref<boolean>(false);
|
||||||
|
|
@ -292,7 +294,20 @@ async function getDataTable(id: string, level: number = 0) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
positionNo.value = listPosNo;
|
positionNo.value = listPosNo;
|
||||||
positionData.value = listPosNo;
|
// positionData.value = listPosNo;
|
||||||
|
|
||||||
|
if (props.dataRows?.posmasterId) {
|
||||||
|
const newUse = positionUse.value.filter(
|
||||||
|
(e) => e !== props.dataRows?.posmasterId
|
||||||
|
);
|
||||||
|
positionData.value = listPosNo.filter(
|
||||||
|
(e: any) => !newUse.includes(e.id)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
positionData.value = listPosNo.filter(
|
||||||
|
(e: any) => !positionUse.value.includes(e.id)
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -435,7 +450,7 @@ watch(
|
||||||
async (n) => {
|
async (n) => {
|
||||||
if (n == true) {
|
if (n == true) {
|
||||||
getActive();
|
getActive();
|
||||||
console.log(props.dataRows);
|
fetchPositionUes();
|
||||||
|
|
||||||
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
|
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
|
||||||
await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId);
|
await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId);
|
||||||
|
|
@ -451,6 +466,26 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const positionUse = ref<string[]>([]);
|
||||||
|
function fetchPositionUes() {
|
||||||
|
const URL =
|
||||||
|
route.name === "appoint-promote"
|
||||||
|
? config.API.apppointmentPosition()
|
||||||
|
: route.name === "receive"
|
||||||
|
? config.API.receiveDataPosition()
|
||||||
|
: null;
|
||||||
|
if (URL) {
|
||||||
|
http
|
||||||
|
.get(URL)
|
||||||
|
.then((res) => {
|
||||||
|
positionUse.value = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => isAll.value,
|
() => isAll.value,
|
||||||
(value, oldVal) => {
|
(value, oldVal) => {
|
||||||
|
|
@ -481,8 +516,6 @@ function onSubmit() {
|
||||||
const dataPosMaster = posMasterMain.value?.find(
|
const dataPosMaster = posMasterMain.value?.find(
|
||||||
(e: any) => e.id === positionId.value
|
(e: any) => e.id === positionId.value
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(dataPosMaster);
|
|
||||||
if (selectedPos.value.length === 0) {
|
if (selectedPos.value.length === 0) {
|
||||||
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
|
dialogMessageNotify($q, "กรุณาเลือกตำแหน่ง");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -271,7 +271,20 @@ async function getDataTable(id: string, level: number = 0) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
positionNo.value = listPosNo;
|
positionNo.value = listPosNo;
|
||||||
positionData.value = listPosNo;
|
// positionData.value = listPosNo;
|
||||||
|
|
||||||
|
if (props.dataRows?.posmasterId) {
|
||||||
|
const newUse = positionUse.value.filter(
|
||||||
|
(e) => e !== props.dataRows?.posmasterId
|
||||||
|
);
|
||||||
|
positionData.value = listPosNo.filter(
|
||||||
|
(e: any) => !newUse.includes(e.id)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
positionData.value = listPosNo.filter(
|
||||||
|
(e: any) => !positionUse.value.includes(e.id)
|
||||||
|
);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -323,8 +336,6 @@ async function getActive() {
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -416,6 +427,7 @@ watch(
|
||||||
async (n) => {
|
async (n) => {
|
||||||
if (n == true) {
|
if (n == true) {
|
||||||
getActive();
|
getActive();
|
||||||
|
fetchPositionUes();
|
||||||
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
|
if (props?.dataRows?.node !== null && props?.dataRows?.nodeId !== null) {
|
||||||
await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId);
|
await fetchPosFind(props?.dataRows?.node, props?.dataRows?.nodeId);
|
||||||
if (positionId.value) {
|
if (positionId.value) {
|
||||||
|
|
@ -430,6 +442,18 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const positionUse = ref<string[]>([]);
|
||||||
|
function fetchPositionUes() {
|
||||||
|
http
|
||||||
|
.get(config.API.apppointmentPositionUse())
|
||||||
|
.then((res) => {
|
||||||
|
positionUse.value = res.data.result;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => isAll.value,
|
() => isAll.value,
|
||||||
(value, oldVal) => {
|
(value, oldVal) => {
|
||||||
|
|
|
||||||
|
|
@ -436,7 +436,7 @@ onMounted(() => {
|
||||||
v-close-popup
|
v-close-popup
|
||||||
v-if="
|
v-if="
|
||||||
props.row.draftOrgEmployeeStatus === null ||
|
props.row.draftOrgEmployeeStatus === null ||
|
||||||
props.row.draftOrgEmployeeStatus === 'PENDING'
|
props.row.draftOrgEmployeeStatus === 'WAITTING'
|
||||||
"
|
"
|
||||||
@click.pervent="onClickSelectPos(props.row)"
|
@click.pervent="onClickSelectPos(props.row)"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue