Merge branch 'nice' into develop

# Conflicts:
#	src/modules/04_registryPerson/views/detailView.vue
This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-18 17:27:47 +07:00
commit 44361da045
46 changed files with 1934 additions and 2231 deletions

View file

@ -1,17 +1,19 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRoute, useRouter } from "vue-router";
import {
checkPermission,
checkPermissionCreate,
checkPermissionList,
} from "@/utils/permissions";
import { useRoute, useRouter } from "vue-router";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import axios from "axios";
import genReport from "@/plugins/genreport";
import avatar from "@/assets/avatar_user.jpg";
/**
* importType
@ -25,16 +27,10 @@ import type { ResponseObject } from "@/modules/04_registryPerson/interface/respo
/**
* importComponents
*/
import CardNotPermission from "@/components/CardNotPermission.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import TabMain from "@/modules/04_registryPerson/components/detail/TabMain.vue";
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
import avatar from "@/assets/avatar_user.jpg";
import CardNotPermission from "@/components/CardNotPermission.vue";
/**
* use
*/
@ -54,23 +50,22 @@ const {
pathRegistryEmp,
} = useCounterMixin();
const isPermission = ref<boolean | null>(null);
const notPermissionMsg = ref<string>("");
const isPermission = ref<boolean | null>(null); //
const notPermissionMsg = ref<string>(""); //
const profileId = ref<string>(route.params.id.toString()); //id profile
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); //
/** ถึงเเก่กรรม */
const dialogPassaway = ref<boolean>(false);
const placeDeathCertificate = ref("");
const deathCertificateNo = ref("");
const dateDeath = ref<Date>(new Date());
const filePassaway = ref<any>(null);
const reasonDeath = ref("");
const dialogPassaway = ref<boolean>(false); //
const filePassaway = ref<any>(null); //
const deathCertificateNo = ref(""); //
const dateDeath = ref<Date>(new Date()); //
const placeDeathCertificate = ref(""); //
const reasonDeath = ref(""); //
const dialogImage = ref<boolean>(false);
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
const formDetail = ref<ResponseObject>();
const dialogImage = ref<boolean>(false); //
const formDetail = ref<ResponseObject>(); //
//
const itemsMenu = ref<DataOptionSys[]>([
{
id: "1",
@ -103,7 +98,7 @@ const itemsMenu = ref<DataOptionSys[]>([
system: "SYS_PLACEMENT_OTHER",
},
]);
//
const itemsMenuEmployee = ref<DataOptionSys[]>([
{
id: "1",
@ -117,15 +112,14 @@ const itemsMenuEmployee = ref<DataOptionSys[]>([
},
]);
const uploadUrl = ref<string>("");
const fileName = ref<string>("");
const profilePicture = ref<string>("");
const profileFile = ref();
const uploadUrl = ref<string>(""); //URL
const fileName = ref<string>(""); //
const profilePicture = ref<string>(""); //
const profileFile = ref(); //
const input = document.createElement("input");
const activeImage = ref<any | null>(null);
const images = ref<any[]>([]);
const imagesAlldata = ref<any[]>([]);
input.type = "file";
input.accept = ".jpg,.png,.tif,.pic";
@ -143,6 +137,9 @@ function imageActive(n: any) {
activeImage.value = n;
}
/**
* งกนอปโหลด
*/
function uploadImg() {
http
.post(config.API.orgProfileAvatarbyType(empType.value), {
@ -159,6 +156,10 @@ function uploadImg() {
.finally(() => {});
}
/**
* งกนสราง path ปโหลไฟล
* @param path
*/
function uploadProfile(path: string) {
http
.post(config.API.fileByPath(path), {
@ -182,6 +183,11 @@ function uploadProfile(path: string) {
});
}
/**
* งกนอปโหลด
* @param uploadUrl path ปโหลไฟล
* @param file ไฟล
*/
function uploadFileURL(uploadUrl: string, file: any) {
showLoader();
axios
@ -202,8 +208,11 @@ function uploadFileURL(uploadUrl: string, file: any) {
});
}
/**
* งกนดงขอมลรปโปรไฟล
* @param id โปรไฟล
*/
function fetchProfile(id: string) {
// showLoader();
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
.then(async (res) => {
@ -212,9 +221,6 @@ function fetchProfile(id: string) {
.catch(() => {
profilePicture.value = avatar;
});
// .finally(() => {
// hideLoader();
// });
}
const reasonStatus = ref<boolean>(false);
@ -254,6 +260,9 @@ const reasonOptions = ref<DataOption[]>([
},
]);
/**
* งกนดงขอมลสวนต
*/
async function fetchDataPersonal() {
showLoader();
await http
@ -301,6 +310,9 @@ async function fetchDataPersonal() {
});
}
/**
* งกนดาวนโหลดไฟล "..7/..1 หร ประวแบบย
*/
async function onClickDownloadKp7(type: string) {
showLoader();
const url =
@ -328,7 +340,7 @@ async function onClickDownloadKp7(type: string) {
}
/**
* วยราชการ
* งกนออกคำสวยราชการ
*/
function helpPost() {
const formData = new FormData();
@ -351,7 +363,7 @@ function helpPost() {
}
/**
* งตวกล
* งกนออกคำสงตวกล
*/
function repatriationPost() {
const formData = new FormData();
@ -374,7 +386,7 @@ function repatriationPost() {
}
/**
* แตงตงเลอน
* งกนออกคำสแตงตงเลอน
*/
function appointPost() {
const formData = new FormData();
@ -397,14 +409,14 @@ function appointPost() {
}
/**
* งเเกกรรม
* งกนออกคำสงเเกกรรม
*/
function clickPassaway() {
dialogPassaway.value = true;
}
/**
* ใหออกจากราชการ
* งกนออกคำสใหออกจากราชการ
*/
function outPost() {
const formData = new FormData();
@ -427,7 +439,7 @@ function outPost() {
}
/**
* นๆ
* งกนออกคำสนๆ
*/
function otherPost() {
const formData = new FormData();
@ -449,6 +461,9 @@ function otherPost() {
});
}
/**
* งกนออกคำสงปรบระดบชนงาน - าย
*/
function appointEmployeePost() {
const formData = new FormData();
formData.append("id", profileId.value);
@ -469,12 +484,8 @@ function appointEmployeePost() {
});
}
function closePassaway() {
dialogPassaway.value = false;
}
/**
* function นยนบนทกขอมลถงแกกรรม
* งกนยนยนบนทกขอมลถงแกกรรม
*/
function clickSaveDeceased() {
dialogConfirm($q, async () => {
@ -502,7 +513,14 @@ function clickSaveDeceased() {
}
/**
* function เป popup เลอกรปภาพ
* งกนป popup งแกกรรม
*/
function closePassaway() {
dialogPassaway.value = false;
}
/**
* งกนเป popup เลอกรปภาพ
*/
function openDialogImg() {
dialogImage.value = true;
@ -510,7 +528,7 @@ function openDialogImg() {
}
/**
* function เรยกขอมลร
* งกเรยกขอมลร
*/
function getImage() {
showLoader();
@ -533,7 +551,7 @@ function getImage() {
}
/**
* function เรยกขอมลร
* งกเรยกขอมลร
* @param dataList
*/
function getImg(dataList: any) {
@ -554,7 +572,7 @@ function getImg(dataList: any) {
}
/**
* funciton Popup เลอกรปภาพ
* งก Popup เลอกรปภาพ
*/
function closeImage() {
dialogImage.value = false;
@ -563,7 +581,7 @@ function closeImage() {
}
/**
* funciotn นยนการลบร
* งกนยนการลบร
* @param id ปภาพ
*/
function deletePhoto(id: string) {
@ -590,7 +608,7 @@ function deletePhoto(id: string) {
}
/**
* function นยนการเลอกร
* งกนยนการเลอกร
*/
function selectAvatarHistory() {
if (activeImage.value == null) {

View file

@ -1,11 +1,22 @@
<script setup lang="ts">
import { ref, reactive, computed, onMounted, watch } from "vue";
import { ref, reactive, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import avatar from "@/assets/avatar_user.jpg";
import { useStructureTree } from "@/stores/structureTree";
/** importType*/
import type {
DataNodeData,
QueryParams,
} from "@/modules/04_registryPerson/interface/request/Main";
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { DataStructureTree } from "@/interface/main";
import type {
DataPerson,
DataType,
@ -13,56 +24,33 @@ import type {
/** importComponents*/
import TableView from "@/modules/04_registryPerson/components/TableView.vue";
import avatar from "@/assets/avatar_user.jpg";
import DialogHeader from "@/components/DialogHeader.vue";
/** importStore*/
import { useRegistryNewDataStore } from "@/modules/04_registryPerson/store";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import { useStructureTree } from "@/stores/structureTree";
const $q = useQuasar();
const store = useRegistryNewDataStore();
const { fetchStructureTree } = useStructureTree();
const { showLoader, hideLoader, messageError } = useCounterMixin();
const route = useRoute();
const mode = ref<"table" | "card">("table");
const filterMain = ref<string>("");
const isShowFilter = ref<boolean>(true);
const isShowBtnFilter = ref<boolean>(false);
const mode = ref<"table" | "card">("table"); //
const empType = ref<string>("officer"); // officer / employee / perm
const dataPersonMain = ref<DataPerson[]>([]); //
const maxPage = ref<number>(1); //
const total = ref<number>(0); //
const isShowBtnFilter = ref<boolean>(false);
// const searchType = ref<string>("fullName");
const node = ref<any>([]);
const expanded = ref<any>([]);
const maxPage = ref<number>(1);
const total = ref<number>(0);
const selectNode = ref<boolean>(false);
const filterMain = ref<string>(""); ///
const node = ref<DataStructureTree[]>([]); //
const expanded = ref<string[]>([]); //
const dataPersonMain = ref<DataPerson[]>([]);
const nodeData = reactive<any>({
page: 1,
pageSize: 10,
round: "",
const selectNode = ref<boolean>(false); //
const nodeData = reactive<DataNodeData>({
name: "เลือกหน่วยงาน/ส่วนราชการ",
keyword: "",
nodeId: null,
node: null,
});
// const conditionTotal = computed(() => {
// let num: string = "";
// if (store.formFilter.isProbation && store.formFilter.isShowRetire) {
// num = "(2)";
// } else if (store.formFilter.isProbation || store.formFilter.isShowRetire) {
// num = "(1)";
// } else "";
// return num;
// });
/**
* function เรยกขอมลตำแหนงประเภท
*/
@ -91,26 +79,12 @@ function fetchOptionGroup() {
});
}
function fetchYearOption() {
if (store.yearOps.length === 0) {
const options = [];
const year = new Date().getFullYear();
for (let i = year - 40; i <= year + 60; i++) {
options.push({ id: i.toString(), name: (i + 543).toString() });
}
if (options) {
store.yearOps.push(...options);
}
}
}
/**
* function fetch รายชอขอมลทะเบยนประว
*/
function fetchDataPerson() {
showLoader();
let queryParams: any = {
let queryParams: QueryParams = {
page: store.formFilter.page,
pageSize: store.formFilter.pageSize,
};
@ -182,7 +156,7 @@ function fetchDataPerson() {
* @param items อมลคน
*/
function insertAvatar(items: DataPerson[]) {
items.map((x: any, index: number) => {
items.map((x: DataPerson, index: number) => {
if (x.avatarName != null) {
http
.get(
@ -209,30 +183,11 @@ function insertAvatar(items: DataPerson[]) {
});
}
/**
* funciotn แสดงตวเลอกเพมเต
*/
// function onClickShowFilter() {
// isShowFilter.value = !isShowFilter.value;
// isShowBtnFilter.value = false;
// if (isShowFilter.value) {
// // fetchLevel();
// fetchYearOption();
// }
// }
/**
* funciotn นหาขอม
*/
function onclickSearch() {
isShowFilter.value = true;
// isShowBtnFilter.value = false;
store.formFilter.page = 1;
if (isShowFilter.value) {
fetchType();
// fetchLevel();
fetchYearOption();
}
store.formFilter.keyword =
store.formFilter.keyword === null ? "" : store.formFilter.keyword;
fetchDataPerson();
@ -242,8 +197,8 @@ function onclickSearch() {
* function เลอกประเภทขาราชการ
* @param item ประเภทขาราชการ
*/
async function selectType() {
empType.value = await (route.name == "registryNew" ? "officer" : "perm");
function selectType() {
empType.value = route.name == "registryNew" ? "officer" : "perm";
if (empType.value !== "officer") {
store.formFilter.isShowRetire = null;
@ -333,7 +288,10 @@ function clearSelect(t: string) {
fetchDataPerson();
}
const isLoad = ref<boolean>(false);
const isLoad = ref<boolean>(false); //
/**
* งกนดงขอโครงสราง
*/
async function fetchTree() {
const data = await fetchStructureTree(route.meta.Key as string);
if (data) {
@ -344,6 +302,9 @@ async function fetchTree() {
}
}
/**
* นหาขอมลรายชอขอมลทะเบยนประวตามหนวยงาน/วนราชการ
*/
function sendNode() {
nodeData.node = store.formFilter.node;
nodeData.nodeId = store.formFilter.nodeId;
@ -352,7 +313,13 @@ function sendNode() {
fetchDataPerson();
}
function updateSelectedTreeMain(data: any) {
/**
* งกนเลอกหนวยงาน/วนราชการ
* @param data อมลหนวยงาน/วนราชการทองการคนหาร
*
* เพอคนหาขอมลตามหนวยงาน/วนราชการ
*/
function updateSelectedTreeMain(data: DataStructureTree) {
if (nodeData.node === data.orgLevel && nodeData.nodeId === data.orgTreeId) {
store.formFilter.node = null;
store.formFilter.nodeId = null;
@ -372,9 +339,11 @@ watch(selectNode, () => {
isLoad.value && hideLoader();
});
/**
* hook เมอมการเรยกใช Components
*/
onMounted(async () => {
selectType();
fetchTree();
await Promise.all([selectType(), fetchTree()]);
});
</script>
@ -438,21 +407,8 @@ onMounted(async () => {
</div>
</div>
</q-form>
<!-- <div v-if="isShowBtnFilter" class="col-12 row q-mt-sm">
<q-btn
flat
label="ตัวเลือกเพิ่มเติม"
icon-right="mdi-tune"
@click="onClickShowFilter"
dense
class="q-px-sm"
></q-btn>
</div> -->
<div
v-if="isShowFilter"
class="row q-mt-sm q-gutter-sm justify-center"
>
<div class="row q-mt-sm q-gutter-sm justify-center">
<q-btn-dropdown
flat
rounded
@ -589,40 +545,6 @@ onMounted(async () => {
label="แสดงตำแหน่งทั้งหมด"
@update:model-value="fetchDataPerson"
/>
<!-- <q-btn-dropdown
v-if="empType === 'officer'"
flat
dense
rounded
label-color="white"
dropdown-icon="mdi-chevron-down"
:label="`เงื่อนไขอื่นๆ ${conditionTotal}`"
class="q-px-sm"
>
<q-list>
<q-item clickable v-close-popup>
<q-item-section>
<q-toggle
v-model="store.formFilter.isProbation"
color="primary"
label="ทดลองปฏิบัติหน้าที่ราชการ"
@update:model-value="fetchDataPerson"
/>
</q-item-section>
</q-item>
<q-item clickable v-close-popup>
<q-item-section>
<q-toggle
v-model="store.formFilter.isShowRetire"
color="primary"
label="แสดงข้อมูลผู้พ้นจากราชการ"
@update:model-value="fetchDataPerson"
/>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown> -->
</div>
<div
@ -655,16 +577,17 @@ onMounted(async () => {
<q-separator />
<q-card-section>
<!-- Components รายการขอมลทะเบยนประว -->
<TableView
v-model:mode="mode"
v-model:form-filter="store.formFilter"
v-model:max-page="maxPage"
:rows="dataPersonMain"
v-model:formFilter="store.formFilter"
v-model:maxPage="maxPage"
:fetchData="fetchDataPerson"
:fetchType="fetchType"
:fetch-data="fetchDataPerson"
:fetch-type="fetchType"
:total="total"
:empType="empType"
:is-filter="isShowBtnFilter"
:emp-type="empType"
/>
</q-card-section>
</q-card>

View file

@ -1,9 +1,12 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useRouter } from "vue-router";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import config from "@/app.config";
import http from "@/plugins/http";
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import { useCounterMixin } from "@/stores/mixin";
/**
* importType
@ -13,18 +16,13 @@ import type {
DataOption,
Pagination,
} from "@/modules/04_registryPerson/interface/index/Main";
import type { DateRequest } from "@/modules/04_registryPerson/interface/response/Main";
/**
* importComponents
*/
import DialogStatus from "@/modules/04_registryPerson/components/requestEdit/DialogStatus.vue";
/**
* importStore
*/
import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit";
import { useCounterMixin } from "@/stores/mixin";
/**
* use
*/
@ -36,12 +34,11 @@ const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
/**
* Table
*/
const rows = ref<any[]>([]);
const page = ref<number>(1);
const pageSize = ref<number>(10);
const rowsTotal = ref<number>(0);
const maxPage = ref<number>(0);
const rows = ref<DateRequest[]>([]); //
const page = ref<number>(1); //
const pageSize = ref<number>(10); //
const rowsTotal = ref<number>(0); //
const maxPage = ref<number>(0); //
const columns = ref<QTableProps["columns"]>([
{
name: "lastUpdatedAt",
@ -114,7 +111,6 @@ const columns = ref<QTableProps["columns"]>([
]);
const visibleColumns = ref<string[]>([
"lastUpdatedAt",
"fullname",
"topic",
"detail",
@ -126,11 +122,11 @@ const visibleColumns = ref<string[]>([
/**
* วแปร
*/
const status = ref<string>("PENDING");
const keyword = ref<string>("");
const statusOption = ref<DataOption[]>(store.optionStatus);
const modalStatus = ref<boolean>(false);
const requestId = ref<string>("");
const status = ref<string>("PENDING"); //
const keyword = ref<string>(""); //
const statusOption = ref<DataOption[]>(store.optionStatus); //
const modalStatus = ref<boolean>(false); //
const requestId = ref<string>(""); //id
/**
* function fetch รายการคำรองขอแกไขทะเบยนประว
@ -186,7 +182,7 @@ function filterOption(val: string, update: Function) {
update(() => {
status.value = val ? "" : status.value;
statusOption.value = store.optionStatus.filter(
(v: any) => v.name.indexOf(val) > -1
(v: DataOption) => v.name.indexOf(val) > -1
);
});
}
@ -262,6 +258,11 @@ function downloadUrl(id: string, fileName: string) {
});
}
/**
* การเปลยนแปลงของ pageSize
*
* เมอมการเปลยนแปลงจำทำการ งชอมลรายการคำรองขอแกไขทะเบยนประวตามจำนวน pageSize
*/
watch(
() => pageSize.value,
() => {
@ -420,8 +421,8 @@ onMounted(() => {
<DialogStatus
v-model:modal="modalStatus"
:fetchData="fetchListRequset"
:requestId="requestId"
:fetch-data="fetchListRequset"
:request-id="requestId"
/>
</template>