เป้าหมาย: ปรับAPI
This commit is contained in:
parent
29072a7f78
commit
7c7ee7314d
2 changed files with 25 additions and 64 deletions
|
|
@ -26,17 +26,8 @@ import { useCounterMixin } from "@/stores/mixin";
|
|||
const route = useRoute();
|
||||
const projectId = ref<string>(route.params.id.toLocaleString());
|
||||
const $q = useQuasar();
|
||||
const store = useDevelopmentDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const {
|
||||
dialogRemove,
|
||||
dialogConfirm,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
messageError,
|
||||
success,
|
||||
date2Thai,
|
||||
} = mixin;
|
||||
const { dialogRemove, showLoader, hideLoader, messageError, success } = mixin;
|
||||
const groupTargetData: any = reactive({
|
||||
targetData: [{}],
|
||||
});
|
||||
|
|
@ -167,14 +158,14 @@ const formGroupTarget = reactive<FormGroupTargetPlannedGoal>({
|
|||
groupTargetSub: "",
|
||||
position: "",
|
||||
posType: "",
|
||||
level: "",
|
||||
posLevel: "",
|
||||
type: null,
|
||||
amount: null,
|
||||
positions: [
|
||||
{
|
||||
position: "",
|
||||
posTypePlannedId: "",
|
||||
posLevelPlannedId: "",
|
||||
posTypeId: "",
|
||||
posLevelId: "",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
|
@ -213,7 +204,6 @@ async function fetchData(id: string) {
|
|||
.get(config.API.developmentMainTab("tab2", id))
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
|
||||
actualGoals.value = data.actualGoals;
|
||||
actualPeoples.value = data.actualPeoples;
|
||||
plannedGoals.value = data.plannedGoals;
|
||||
|
|
@ -234,8 +224,8 @@ function onClickOpenDialog(type: string, target: string) {
|
|||
(formGroupTarget.positions = [
|
||||
{
|
||||
position: "",
|
||||
posTypePlannedId: "",
|
||||
posLevelPlannedId: "",
|
||||
posTypeId: "",
|
||||
posLevelId: "",
|
||||
},
|
||||
]),
|
||||
(newModalGroupTarget.value = true);
|
||||
|
|
@ -260,8 +250,8 @@ async function onSubmitGroup() {
|
|||
groupTargetSub: formGroupTarget.groupTargetSub,
|
||||
positions: formGroupTarget.positions.map((v) => ({
|
||||
position: v.position ? v.position : "",
|
||||
posTypePlannedId: v.posTypePlannedId ? v.posTypePlannedId : "",
|
||||
posLevelPlannedId: v.posLevelPlannedId ? v.posLevelPlannedId : "",
|
||||
posTypePlannedId: v.posTypeId ? v.posTypeId : "",
|
||||
posLevelPlannedId: v.posLevelId ? v.posLevelId : "",
|
||||
})),
|
||||
type: formGroupTarget.type ? formGroupTarget.type : "",
|
||||
amount: formGroupTarget.amount,
|
||||
|
|
@ -288,7 +278,7 @@ async function onSubmitGroup() {
|
|||
groupTargetSub: formGroupTarget.groupTargetSub,
|
||||
position: formGroupTarget.position,
|
||||
posTypeActualId: formGroupTarget.posType,
|
||||
posLevelActualId: formGroupTarget.level,
|
||||
posLevelActualId: formGroupTarget.posLevel,
|
||||
type: formGroupTarget.type,
|
||||
amount: formGroupTarget.amount,
|
||||
}
|
||||
|
|
@ -386,7 +376,7 @@ function cleanFormData() {
|
|||
formGroupTarget.groupTargetSub = "";
|
||||
formGroupTarget.position = "";
|
||||
formGroupTarget.posType = "";
|
||||
formGroupTarget.level = "";
|
||||
formGroupTarget.posLevel = "";
|
||||
formGroupTarget.type = "";
|
||||
formGroupTarget.amount = null;
|
||||
formGroupRelate.relate = "";
|
||||
|
|
@ -409,7 +399,7 @@ function updatePosTypeName(id: string) {
|
|||
id: e.id,
|
||||
name: e.posLevelName.toString(),
|
||||
})) ?? [];
|
||||
formGroupTarget.level = "";
|
||||
formGroupTarget.posLevel = "";
|
||||
}
|
||||
|
||||
function updateGroupTarget(val: string) {
|
||||
|
|
@ -417,7 +407,7 @@ function updateGroupTarget(val: string) {
|
|||
formGroupTarget.groupTargetSub = "NONE";
|
||||
formGroupTarget.position = "";
|
||||
formGroupTarget.posType = null;
|
||||
formGroupTarget.level = null;
|
||||
formGroupTarget.posLevel = null;
|
||||
} else formGroupTarget.groupTargetSub = "";
|
||||
}
|
||||
|
||||
|
|
@ -431,23 +421,11 @@ function convertNamePeoples(id: string) {
|
|||
return data && data?.name;
|
||||
}
|
||||
|
||||
function convertTypeGoals(row: ResActualGoals) {
|
||||
const posTypeName = posTypeMain.value.find(
|
||||
(e: ResGroup) => e.id === row.posTypeActualId
|
||||
);
|
||||
const posLevelName = posTypeName?.posLevels.find(
|
||||
(e: any) => e.id === row.posLevelActualId
|
||||
);
|
||||
const fullName = posTypeName?.posTypeName + " " + posLevelName?.posLevelName;
|
||||
// return posTypeName && posTypeName?.posTypeName;
|
||||
return fullName;
|
||||
}
|
||||
|
||||
const addGroupTargetData = async () => {
|
||||
formGroupTarget.positions.push({
|
||||
position: "",
|
||||
posTypePlannedId: "",
|
||||
posLevelPlannedId: "",
|
||||
posTypeId: "",
|
||||
posLevelId: "",
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -458,20 +436,6 @@ function deleteTargetData(index: any) {
|
|||
onMounted(() => {
|
||||
fetchType();
|
||||
fetchData(projectId.value);
|
||||
// plannedGoals.value = store.formAddProject.plannedGoals
|
||||
// ? store.formAddProject.plannedGoals
|
||||
// : [];
|
||||
// plannedPeoples.value = store.formAddProject.plannedPeoples
|
||||
// ? store.formAddProject.plannedPeoples
|
||||
// : [];
|
||||
|
||||
// actualGoals.value = store.formAddProject.actualGoals
|
||||
// ? store.formAddProject.actualGoals
|
||||
// : [];
|
||||
|
||||
// actualPeoples.value = store.formAddProject.actualPeoples
|
||||
// ? store.formAddProject.actualPeoples
|
||||
// : [];
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
|
|
@ -538,7 +502,7 @@ onMounted(() => {
|
|||
<div v-if="col.name === 'posTypePlannedId'">
|
||||
<div
|
||||
v-if="props.row.groupTarget !== 'OUTSIDERS'"
|
||||
v-for="row in props.row.plannedGoalPositions"
|
||||
v-for="row in props.row.position"
|
||||
>
|
||||
{{ `- ${row.position} (${row.posType} ${row.posLevel})` }}
|
||||
</div>
|
||||
|
|
@ -566,9 +530,7 @@ onMounted(() => {
|
|||
formGroupTarget.groupTarget = props.row.groupTarget;
|
||||
formGroupTarget.groupTargetSub = props.row.groupTargetSub;
|
||||
formGroupTarget.amount = props.row.amount;
|
||||
formGroupTarget.positions =
|
||||
props.row.plannedGoalPositions;
|
||||
|
||||
formGroupTarget.positions = props.row.position;
|
||||
newModalGroupTarget = true;
|
||||
}
|
||||
"
|
||||
|
|
@ -619,7 +581,6 @@ onMounted(() => {
|
|||
@click="
|
||||
() => {
|
||||
isEdit = true;
|
||||
|
||||
isTarget = 'planned';
|
||||
editId = props.row.id;
|
||||
formGroupRelate.relate = props.row.groupTarget;
|
||||
|
|
@ -735,8 +696,8 @@ onMounted(() => {
|
|||
formGroupTarget.groupTargetSub = props.row.groupTargetSub;
|
||||
formGroupTarget.amount = props.row.amount;
|
||||
formGroupTarget.position = props.row.position;
|
||||
formGroupTarget.posType = props.row.posTypeActualId;
|
||||
formGroupTarget.level = props.row.posLevelActualId;
|
||||
formGroupTarget.posType = props.row.posTypeId;
|
||||
formGroupTarget.posLevel = props.row.posLevelId;
|
||||
modalGroupTarget = true;
|
||||
}
|
||||
"
|
||||
|
|
@ -916,7 +877,7 @@ onMounted(() => {
|
|||
hide-bottom-space
|
||||
lazy-rules
|
||||
class="inputgreen"
|
||||
v-model="formGroupTarget.level"
|
||||
v-model="formGroupTarget.posLevel"
|
||||
:options="
|
||||
posTypeMain.find((v) => formGroupTarget.posType === v.id)
|
||||
?.posLevels || []
|
||||
|
|
@ -1124,7 +1085,7 @@ onMounted(() => {
|
|||
hide-bottom-space
|
||||
lazy-rules
|
||||
class="inputgreen"
|
||||
v-model="items.posTypePlannedId"
|
||||
v-model="items.posTypeId"
|
||||
:options="posTypeOp"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
|
|
@ -1149,9 +1110,9 @@ onMounted(() => {
|
|||
hide-bottom-space
|
||||
lazy-rules
|
||||
class="inputgreen"
|
||||
v-model="items.posLevelPlannedId"
|
||||
v-model="items.posLevelId"
|
||||
:options="
|
||||
posTypeMain.find((v) => items.posTypePlannedId === v.id)
|
||||
posTypeMain.find((v) => items.posTypeId === v.id)
|
||||
?.posLevels || []
|
||||
"
|
||||
option-label="posLevelName"
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ interface FormGroupTargetPlannedGoal {
|
|||
positions: [
|
||||
{
|
||||
position: string;
|
||||
posTypePlannedId: string;
|
||||
posLevelPlannedId: string;
|
||||
posTypeId: string;
|
||||
posLevelId: string;
|
||||
}
|
||||
];
|
||||
plannedGoalPositions?: [
|
||||
|
|
@ -44,7 +44,7 @@ interface FormGroupTargetPlannedGoal {
|
|||
groupTargetSub: string;
|
||||
position: string;
|
||||
posType: string | null;
|
||||
level: string | null;
|
||||
posLevel: string | null;
|
||||
type: string | null;
|
||||
amount: number | null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue