แก้ไข บัค store , ปรับ component รูปภาพ

This commit is contained in:
Thanit Konmek 2023-08-04 12:29:38 +07:00
parent b663eedb09
commit c53e6b5359
5 changed files with 160 additions and 82 deletions

View file

@ -115,11 +115,14 @@ import http from "@/plugins/http";
import config from "@/app.config";
import type { treeTab } from "@/modules/04_registry/interface/index/Main";
import type { ResponseTree } from "@/modules/02_organizational/interface/response/Mapping";
import { useDataStore } from "@/stores/data";
const dataStore = useDataStore();
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const router = useRouter();
const route = useRoute();
const { selectedReport2, expandedReport2, changeTreeReport2 } = dataStore;
const { date2Thai, success, dateToISO, modalError, showLoader, hideLoader } =
mixin;
const filter = ref<string>(""); //search data table
@ -279,14 +282,9 @@ const nodeTree = async () => {
const data = res.data.result;
nodesTree.value = data;
if (data.length > 0) {
selected.value =
dataStore.selectedReport2 == ""
? data[0].id
: dataStore.selectedReport2;
selected.value = selectedReport2 == "" ? data[0].id : selectedReport2;
expanded.value =
dataStore.expandedReport2.length == 0
? [data[0].id]
: dataStore.expandedReport2;
expandedReport2.length == 0 ? [data[0].id] : expandedReport2;
}
})
.catch((e: any) => {})
@ -301,7 +299,7 @@ const onSelected = async (id: string) => {
};
const clickTree = () => {
dataStore.changeTreeReport2(expanded.value, selected.value);
changeTreeReport2(expanded.value, selected.value);
};
const onHistory = async () => {

View file

@ -144,11 +144,13 @@ import ProfileTable from "@/modules/04_registry/components/TableProfile.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
// import { jsontoexcel } from "vue-table-to-excel";
import { useDataStore } from "@/stores/data";
const dataStore = useDataStore();
const $q = useQuasar();
const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const { changeTreeRegister, selectedRegister, expandedRegister } = dataStore;
const mixin = useCounterMixin();
const { date2Thai, messageError, typeRetire, showLoader, hideLoader } = mixin;
@ -1162,7 +1164,7 @@ const onSelected = async (id: string) => {
};
const clickTree = () => {
dataStore.changeTreeRegister(expanded.value, selected.value);
changeTreeRegister(expanded.value, selected.value);
};
const nodeTree = async () => {
@ -1173,14 +1175,9 @@ const nodeTree = async () => {
const data = res.data.result;
nodesTree.value = data;
if (data.length > 0) {
selected.value =
dataStore.selectedRegister == ""
? data[0].id
: dataStore.selectedRegister;
selected.value = selectedRegister == "" ? data[0].id : selectedRegister;
expanded.value =
dataStore.expandedRegister.length == 0
? [data[0].id]
: dataStore.expandedRegister;
expandedRegister.length == 0 ? [data[0].id] : expandedRegister;
}
})
.catch((e: any) => {

View file

@ -5,7 +5,12 @@
<Information v-model:statusEdit="statusEdit" :statusAdd="false" />
</div>
<div id="government" name="16" class="row col-12 q-mt-md">
<Government v-model:statusEdit="statusEdit" :statusAdd="false" />
<Government
v-model:statusEdit="statusEdit"
:statusAdd="false"
profileType="test"
employeeClass="test"
/>
</div>
<div id="address" name="17" class="row col-12 q-mt-md">
<Address v-model:statusEdit="statusEdit" :statusAdd="false" />
@ -14,7 +19,7 @@
<Family v-model:statusEdit="statusEdit" :statusAdd="false" />
</div>
<div id="certicate" name="15" class="row col-12 q-mt-md">
<Certicate v-model:statusEdit="statusEdit" />
<Certicate v-model:statusEdit="statusEdit" profileType="test" />
</div>
<div id="education" name="2" class="row col-12 q-mt-md">
<EducationVue v-model:statusEdit="statusEdit" />
@ -70,6 +75,7 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import Image from "@/components/information/Image.vue";
import Information from "@/components/information/Information.vue";
import Government from "@/components/information/Government.vue";

View file

@ -282,10 +282,10 @@ const columns2 = ref<QTableProps["columns"]>([
},
]);
const openModalTree = (pid: string) => {
modalTree.value = true;
personalId.value = pid;
const openModalTree = (id: string) => {
personalId.value = id;
personal.value = [];
modalTree.value = true;
};
const closeModalTree = async () => {
@ -293,8 +293,10 @@ const closeModalTree = async () => {
modalTree.value = false;
};
const nextPage = (id: string) => {
router.push(`/receive/${id}`);
const nextPage = (row: any) => {
router.push({
path: `/receive/${row.personalId}`,
});
};
</script>
<template>
@ -367,57 +369,42 @@ const nextPage = (id: string) => {
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
key="no"
:props="props"
@click="nextPage(props.row.personalId)"
>
<q-td key="no" :props="props" @click="nextPage(props.row)">
{{ props.rowIndex + 1 }}
</q-td>
<q-td
key="fullname"
:props="props"
@click="nextPage(props.row.personalId)"
@click="nextPage(props.row)"
>
{{ props.row.fullname }}
</q-td>
<q-td
key="position"
:props="props"
@click="nextPage(props.row.personalId)"
@click="nextPage(props.row)"
>
{{ props.row.position }}
</q-td>
<q-td
key="positionLevel"
:props="props"
@click="nextPage(props.row.personalId)"
@click="nextPage(props.row)"
>
{{ props.row.positionLevel }}
</q-td>
<q-td
key="oc"
:props="props"
@click="nextPage(props.row.personalId)"
>
<q-td key="oc" :props="props" @click="nextPage(props.row)">
{{ props.row.oc }}
</q-td>
<q-td
key="agency"
:props="props"
@click="nextPage(props.row.personalId)"
>
<q-td key="agency" :props="props" @click="nextPage(props.row)">
{{ props.row.agency }}
</q-td>
<q-td
key="status"
:props="props"
@click="nextPage(props.row.personalId)"
>
<q-td key="status" :props="props" @click="nextPage(props.row)">
{{ props.row.status }}
</q-td>
<q-td auto-width>