Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-05-01 14:19:46 +07:00
commit 77ae7e5bed
11 changed files with 1590 additions and 1546 deletions

View file

@ -10,9 +10,9 @@ import http from "@/plugins/http";
import config from "@/app.config";
interface ArrayFileList {
id:string
pathName:string
fileName:string
id: string;
pathName: string;
fileName: string;
}
const props = defineProps({
@ -40,7 +40,14 @@ const fileList = ref<ArrayFileList[]>([]);
const $q = useQuasar(); // show dialog
const mixin = useCounterMixin();
const route = useRoute();
const { success, messageError, showLoader, dialogConfirm, hideLoader,dialogRemove } = mixin;
const {
success,
messageError,
showLoader,
dialogConfirm,
hideLoader,
dialogRemove,
} = mixin;
const profileId = ref<string>(
route.params.personalId ? route.params.personalId.toString() : ""
);
@ -51,30 +58,28 @@ const file = ref<any>([]);
const name = ref<string>("");
const dataMain = ref<any>([]);
// const getData = async () => {
// if (props.datainformation) {
// dataMain.value = props.datainformation;
// files.value = dataMain.value.docs;
// }
//
// if (profileId.value) {
// showLoader();
// await http
// .get(config.API.profilePaperId(profileId.value))
// .then((res) => {
// const data = res.data.result;
// files.value = data;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// }
//
// if (profileId.value) {
// showLoader();
// await http
// .get(config.API.profilePaperId(profileId.value))
// .then((res) => {
// const data = res.data.result;
// files.value = data;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// }
// };
const deleteData = async (id: string) => {
@ -229,7 +234,7 @@ async function uploadFileDoc(uploadUrl: string, file: any) {
* ดาวนโหลดลงคไฟล
* @param fileName file name
*/
function downloadFile(fileName: string) {
function downloadFile(fileName: string) {
showLoader();
http
.get(
@ -269,7 +274,6 @@ function deleteFile(fileName: string) {
)
)
.then((res) => {
setTimeout(() => {
getData();
success($q, `ลบไฟล์สำเร็จ`);
@ -286,7 +290,7 @@ function deleteFile(fileName: string) {
}
async function getData() {
showLoader()
showLoader();
await http
.get(
config.API.file("ระบบบรรจุ แต่งตั้ง", "เอกสารหลักฐาน", profileId.value)
@ -298,17 +302,16 @@ async function getData() {
messageError($q, e);
})
.finally(() => {
hideLoader()
hideLoader();
});
}
onMounted(async () => {
await getData();
});
</script>
<template>
<q-card flat bordered class="col-12 row q-px-lg q-py-md">
<q-card flat bordered class="col-12 q-px-lg q-py-md q-mt-md no-border">
<HeaderTop
v-model:edit="edit"
header="เอกสารหลักฐาน"
@ -318,8 +321,7 @@ onMounted(async () => {
:disable="statusEdit"
:save="uploadData"
/>
<q-card class="row col-12">
<q-card class="row col-12">
<div class="row col-12 q-col-gutter-y-sm q-pa-sm">
<div class="col-12 row">
<q-file

View file

@ -139,8 +139,6 @@ function updateSelected(data: TreeMain) {
const isAll = ref<boolean>(false);
const isBlank = ref<boolean>(false);
async function fetchDataTable(id: string, level: number = 0) {
console.log(props.dataRow);
showLoader();
const body = {
node: level,
@ -196,9 +194,6 @@ async function fetchPosFind(level: number, id: string) {
.post(config.API.orgPosFind, body)
.then((res) => {
const data = res.data.result;
console.log(props?.dataRow);
expanded.value = data;
nodeId.value = id;
positionId.value = props?.dataRow?.posmasterId;
@ -224,7 +219,6 @@ async function onClickSubmit() {
} else {
dialogConfirm($q, async () => {
showLoader();
const body = {
personalId: props?.dataRow?.personalId,
node: dataPosMaster.node,
@ -239,6 +233,7 @@ async function onClickSubmit() {
posLevelId: selectedPos.value[0].posLevelId, //
posLevelName: selectedPos.value[0].posLevelName, //
reportingDate: datePos.value,
posmasterId: dataPosMaster.id,
typeCommand: props.typeCommand,
};
@ -277,8 +272,6 @@ watch(
() => modal.value,
async () => {
if (modal.value) {
console.log(props?.dataRow);
await fetchOrganizationActive();
if (props?.dataRow?.node !== null && props?.dataRow?.nodeId !== null) {
await fetchPosFind(props?.dataRow?.node, props?.dataRow?.nodeId);
@ -319,22 +312,18 @@ function filterNodeFn(data: any, id: string) {
watch(
() => isAll.value,
(value, oldVal) => {
console.log("value", value);
console.log("oldVal", oldVal);
isAll.value = value;
fetchDataTable(nodeId.value, nodeLevel.value);
if (value !== oldVal) {
fetchDataTable(nodeId.value, nodeLevel.value);
}
}
);
watch(
() => isBlank.value,
(value, oldVal) => {
console.log("isBlank value", value);
console.log("isBlank oldVal", oldVal);
isBlank.value = value;
fetchDataTable(nodeId.value, nodeLevel.value);
if (value !== oldVal) {
fetchDataTable(nodeId.value, nodeLevel.value);
}
}
);
</script>

View file

@ -234,14 +234,14 @@ function convertBmaOfficer(val: string) {
* แปลงสถานะบรรจ
* @param val type
*/
function convertContainStatus(val: string) {
function convertContainStatus(val: string, type: string = "") {
switch (val) {
case "UN-CONTAIN":
return "ยังไม่บรรจุ";
case "PREPARE-CONTAIN":
return "เตรียมบรรจุ";
return "เตรียม" + (type != "" ? type : "บรรจุ");
case "CONTAIN":
return "บรรจุแล้ว";
return (type != "" ? type : "บรรจุ") + "แล้ว";
case "DISCLAIM":
return "สละสิทธิ์";
default:
@ -249,6 +249,21 @@ function convertContainStatus(val: string) {
}
}
function convertTypeCommand(val: string) {
switch (val) {
case "APPOINTED":
return "บรรจุแต่งตั้ง";
case "APPOINT":
return "แต่งตั้ง";
case "SLIP":
return "เลื่อน";
case "MOVE":
return "ย้าย";
default:
return "";
}
}
/**
* แปลงสถานะการสงรายช
* @param val true/false
@ -322,7 +337,11 @@ async function getTable() {
posLevelCandidateName: data.posLevelCandidateName,
posmasterId: data.posmasterId,
statusName: convertContainStatus(data.statusId),
statusName:
convertContainStatus(data.statusId) +
(data.typeCommand != ""
? convertTypeCommand(data.typeCommand)
: ""),
organizationName:
data.root +
" " +
@ -854,7 +873,9 @@ onMounted(async () => {
</q-item>
<q-item
v-if="
(roleAdmin && props.row.statusId === 'UN-CONTAIN') ||
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
"
@ -884,7 +905,9 @@ onMounted(async () => {
<q-item
v-if="
(roleAdmin && props.row.statusId === 'UN-CONTAIN') ||
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
"
@ -910,7 +933,9 @@ onMounted(async () => {
<q-item
v-if="
(roleAdmin && props.row.statusId === 'UN-CONTAIN') ||
(props.row.bmaOfficer !== 'บุคคลภายนอก' &&
roleAdmin &&
props.row.statusId === 'UN-CONTAIN') ||
(props.row.draft === 'รอส่งตัว' &&
props.row.statusId !== 'DISCLAIM')
"