แก้อัพไฟล์
This commit is contained in:
parent
15c1c2038f
commit
e92997302b
13 changed files with 448 additions and 108 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import env from "../index";
|
import env from "../index";
|
||||||
|
|
||||||
const registryNew = `${env.API_URI}/org/profile`;
|
const registryNew = `${env.API_URI}/org/profile`;
|
||||||
|
const org = `${env.API_URI}/org`;
|
||||||
const metadata = `${env.API_URI}/org/metadata/`;
|
const metadata = `${env.API_URI}/org/metadata/`;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -42,6 +43,10 @@ export default {
|
||||||
profileNewInsign: (type: string) => `${registryNew}${type}/insignia`,
|
profileNewInsign: (type: string) => `${registryNew}${type}/insignia`,
|
||||||
profileNewInsignByProfileId: (profileId: string, type: string) =>
|
profileNewInsignByProfileId: (profileId: string, type: string) =>
|
||||||
`${registryNew}${type}/insignia/${profileId}`,
|
`${registryNew}${type}/insignia/${profileId}`,
|
||||||
|
|
||||||
|
orgInsigniaActive: () =>
|
||||||
|
`${org}/insignia/insignia-type/active`,
|
||||||
|
|
||||||
profileNewInsignById: (dataId: string, type: string) =>
|
profileNewInsignById: (dataId: string, type: string) =>
|
||||||
`${registryNew}${type}/insignia/${dataId}`,
|
`${registryNew}${type}/insignia/${dataId}`,
|
||||||
profileNewInsignHisById: (dataId: string, type: string) =>
|
profileNewInsignHisById: (dataId: string, type: string) =>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,9 @@ import type {
|
||||||
DataOption,
|
DataOption,
|
||||||
DataOptionInsignia,
|
DataOptionInsignia,
|
||||||
InsigniaOps,
|
InsigniaOps,
|
||||||
|
InsigniasType,
|
||||||
|
InsigniasTypeSub,
|
||||||
|
ResFileData,
|
||||||
} from "@/modules/04_registryPerson/interface/index/Main";
|
} from "@/modules/04_registryPerson/interface/index/Main";
|
||||||
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/Insignia";
|
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/Insignia";
|
||||||
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Insignia";
|
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Insignia";
|
||||||
|
|
@ -37,7 +40,9 @@ const {
|
||||||
onSearchDataTable,
|
onSearchDataTable,
|
||||||
} = mixin;
|
} = mixin;
|
||||||
|
|
||||||
const fileUpload = ref<File>();
|
const isUpload = ref<boolean>(false);
|
||||||
|
const fileUpload = ref<File | null>(null);
|
||||||
|
const fileData = ref<ResFileData | null>(null);
|
||||||
const uploadUrl = ref<string>("");
|
const uploadUrl = ref<string>("");
|
||||||
/** props*/
|
/** props*/
|
||||||
const isLeave = defineModel<boolean>("isLeave", {
|
const isLeave = defineModel<boolean>("isLeave", {
|
||||||
|
|
@ -76,8 +81,10 @@ const OpsFilter = ref<InsigniaOps>({
|
||||||
insigniaOptions: [],
|
insigniaOptions: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const insigniaOptions = ref<any[]>([]);
|
const insigniaOptions = ref<InsigniasType[]>([]);
|
||||||
const insigniaOptionsMain = ref<any[]>([]);
|
const insigniaOptionsMain = ref<InsigniasType[]>([]);
|
||||||
|
const insigniaOptionsName = ref<InsigniasTypeSub[]>([]);
|
||||||
|
const insigniaOptionsNameMain = ref<InsigniasTypeSub[]>([]);
|
||||||
//ต้วลือกรายการครื่องราช
|
//ต้วลือกรายการครื่องราช
|
||||||
const Ops = ref<InsigniaOps>({
|
const Ops = ref<InsigniaOps>({
|
||||||
insigniaOptions: [],
|
insigniaOptions: [],
|
||||||
|
|
@ -118,7 +125,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
field: "insigniaId",
|
field: "insigniaId",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format: (v) => Ops.value.insigniaOptions.find((r) => r.id === v)?.name,
|
format: (v) => store.allNameInsignia.find((r) => r.id === v)?.name,
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
|
|
@ -305,7 +312,7 @@ const columnsHistory = ref<QTableProps["columns"]>([
|
||||||
field: "insigniaId",
|
field: "insigniaId",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
format: (v) => Ops.value.insigniaOptions.find((r) => r.id === v)?.name,
|
format: (v) => store.allNameInsignia.find((r) => r.id === v)?.name,
|
||||||
sort: (a: string, b: string) =>
|
sort: (a: string, b: string) =>
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
|
|
@ -487,18 +494,21 @@ async function fetchData() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** fetch ข้อมูลเครื่องราชอิสริยาภรณ์*/
|
/** ดึง */
|
||||||
async function fetchInsignia() {
|
async function getInsigniaActive() {
|
||||||
showLoader();
|
showLoader();
|
||||||
try {
|
http
|
||||||
const res = await http.get(config.API.insigniaOrg);
|
.get(config.API.orgInsigniaActive())
|
||||||
const data = res.data.result;
|
.then((res) => {
|
||||||
mapInsigniaOption(data);
|
const data = res.data.result;
|
||||||
} catch (error) {
|
mapInsigniaOption(data);
|
||||||
messageError($q, error);
|
})
|
||||||
} finally {
|
.catch((e) => {
|
||||||
hideLoader();
|
messageError($q, e);
|
||||||
}
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -514,15 +524,18 @@ async function addEditData(editStatus: boolean = false) {
|
||||||
const method = editStatus ? "patch" : "post";
|
const method = editStatus ? "patch" : "post";
|
||||||
const reqBody: RequestItemsObject = {
|
const reqBody: RequestItemsObject = {
|
||||||
...insigniaForm,
|
...insigniaForm,
|
||||||
|
isUpload: !isEdit.value ? undefined : isUpload.value,
|
||||||
profileEmployeeId:
|
profileEmployeeId:
|
||||||
!editStatus && empType.value !== "" ? profileId.value : undefined,
|
!editStatus && empType.value !== "" ? profileId.value : undefined,
|
||||||
|
|
||||||
profileId:
|
profileId:
|
||||||
!editStatus && empType.value === "" ? profileId.value : undefined,
|
!editStatus && empType.value === "" ? profileId.value : undefined,
|
||||||
|
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
await http[method](url, reqBody).then(async (res) => {
|
await http[method](url, reqBody).then(async (res) => {
|
||||||
if (fileUpload.value && res.data.result) {
|
if ((fileUpload.value && id.value) || res.data.result) {
|
||||||
await uploadProfile(res.data.result);
|
await uploadProfile(id.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -574,19 +587,37 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
||||||
"Content-Type": file.type,
|
"Content-Type": file.type,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async (res) => {
|
||||||
fileUpload.value = undefined;
|
if (res.status == 200) {
|
||||||
|
await isUploadFn();
|
||||||
|
}
|
||||||
|
fileUpload.value = null;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isUploadFn() {
|
||||||
|
await http
|
||||||
|
.patch(config.API.profileNewInsignById(id.value, empType.value), {
|
||||||
|
isUpload: fileUpload.value ? true : false,
|
||||||
|
})
|
||||||
|
.then(async (res) => {})
|
||||||
|
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันโหลไฟลเอกสารหลักฐาน
|
* ฟังก์ชันโหลไฟลเอกสารหลักฐาน
|
||||||
* @param id รายการที่ต้องการโหลด
|
* @param id รายการที่ต้องการโหลด
|
||||||
*/
|
*/
|
||||||
async function onDownloadFile(id: string) {
|
async function onDownloadFile(id: string, isLoad: boolean = true) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
|
|
@ -599,8 +630,11 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.downloadUrl;
|
const data = res.data;
|
||||||
window.open(data, "_blank");
|
fileData.value = data;
|
||||||
|
if (isLoad) {
|
||||||
|
window.open(data.downloadUrl, "_blank");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -631,13 +665,28 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
|
||||||
insigniaForm.refCommandDate = row.refCommandDate;
|
insigniaForm.refCommandDate = row.refCommandDate;
|
||||||
insigniaForm.refCommandNo = row.refCommandNo;
|
insigniaForm.refCommandNo = row.refCommandNo;
|
||||||
insigniaForm.note = row.note;
|
insigniaForm.note = row.note;
|
||||||
|
isUpload.value = row.isUpload;
|
||||||
|
|
||||||
const insigniaTypeFilter = insigniaOptionsMain.value.filter(
|
if (isUpload.value) {
|
||||||
(r: any) => r.typeId === insigniaType.value
|
onDownloadFile(row.id, false);
|
||||||
|
}
|
||||||
|
const list = store.insigniaTypeOpMain;
|
||||||
|
|
||||||
|
const insigniaTypeFilter = list.filter(
|
||||||
|
(r: InsigniasType) => r.id === insigniaType.value
|
||||||
);
|
);
|
||||||
if (insigniaTypeFilter.length > 0) {
|
if (insigniaTypeFilter.length > 0) {
|
||||||
OpsFilter.value.insigniaOptions = insigniaTypeFilter;
|
const type = insigniaTypeFilter;
|
||||||
insigniaOptions.value = OpsFilter.value.insigniaOptions;
|
const name = insigniaTypeFilter[0].insignias.map(
|
||||||
|
(item: InsigniasTypeSub) => ({
|
||||||
|
...item,
|
||||||
|
name: `${item.name} (${item.shortName})`,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
insigniaOptions.value = type;
|
||||||
|
insigniaOptionsMain.value = type;
|
||||||
|
insigniaOptionsName.value = name;
|
||||||
|
insigniaOptionsNameMain.value = name;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clearData();
|
clearData();
|
||||||
|
|
@ -687,29 +736,46 @@ function onSubmit() {
|
||||||
* @param refData type ที่กำหนด ของ input นั้นๆ
|
* @param refData type ที่กำหนด ของ input นั้นๆ
|
||||||
*/
|
*/
|
||||||
function filterSelector(val: string, update: Function, refData: string) {
|
function filterSelector(val: string, update: Function, refData: string) {
|
||||||
switch (refData) {
|
if (refData == "type") {
|
||||||
case "insigniaOptions":
|
update(() => {
|
||||||
update(() => {
|
insigniaOptions.value = store.insigniaTypeOpMain.filter(
|
||||||
insigniaOptions.value = OpsFilter.value.insigniaOptions.filter(
|
(v: DataOption) => v.name.indexOf(val) > -1
|
||||||
(v: DataOption) => v.name.indexOf(val) > -1
|
);
|
||||||
);
|
});
|
||||||
});
|
} else if (refData == "insigniaOptions") {
|
||||||
break;
|
update(() => {
|
||||||
default:
|
insigniaOptionsName.value = insigniaOptionsNameMain.value.filter(
|
||||||
break;
|
(v: DataOption) => v.name.indexOf(val) > -1
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ค้นหาลำดับชั้น*/
|
/** ค้นหาลำดับชั้น*/
|
||||||
function insigniaTypeSelection(check: boolean) {
|
function insigniaTypeSelection(check: boolean, id: string) {
|
||||||
if (check) {
|
if (check) {
|
||||||
insigniaForm.insigniaId = "";
|
insigniaForm.insigniaId = "";
|
||||||
}
|
const data = store.insigniaTypeOpMain.find(
|
||||||
const insigniaTypeFilter = insigniaOptionsMain.value.filter(
|
(item: InsigniasType) => item.id == id
|
||||||
(r: any) => r.typeId === insigniaType.value
|
);
|
||||||
);
|
if (data) {
|
||||||
if (insigniaTypeFilter.length > 0) {
|
const listData = data.insignias.map((item: InsigniasTypeSub) => ({
|
||||||
OpsFilter.value.insigniaOptions = insigniaTypeFilter;
|
id: item.id,
|
||||||
|
createdAt: item.createdAt,
|
||||||
|
createdUserId: item.createdUserId,
|
||||||
|
lastUpdatedAt: item.lastUpdatedAt,
|
||||||
|
lastUpdateUserId: item.lastUpdateUserId,
|
||||||
|
createdFullName: item.createdFullName,
|
||||||
|
lastUpdateFullName: item.lastUpdateFullName,
|
||||||
|
name: `${item.name} (${item.shortName})`,
|
||||||
|
shortName: item.shortName,
|
||||||
|
level: item.level,
|
||||||
|
isActive: item.isActive,
|
||||||
|
note: item.note,
|
||||||
|
insigniaTypeId: item.insigniaTypeId,
|
||||||
|
}));
|
||||||
|
insigniaOptionsNameMain.value = listData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -729,7 +795,9 @@ function clearData() {
|
||||||
insigniaForm.refCommandNo = "";
|
insigniaForm.refCommandNo = "";
|
||||||
insigniaForm.refCommandDate = null;
|
insigniaForm.refCommandDate = null;
|
||||||
insigniaForm.note = "";
|
insigniaForm.note = "";
|
||||||
fileUpload.value = undefined;
|
fileUpload.value = null;
|
||||||
|
isUpload.value = false;
|
||||||
|
fileData.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function serchDataTable() {
|
function serchDataTable() {
|
||||||
|
|
@ -751,10 +819,9 @@ function serchDataTableHistory() {
|
||||||
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
/** ทำงานเมื่อ Components ถูกเรียกใช้งาน*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchData();
|
await fetchData();
|
||||||
store.insigniaOption.length === 0 ? await fetchInsignia() : "";
|
store.insigniaTypeOpMain.length === 0 ? await getInsigniaActive() : "";
|
||||||
Ops.value.insigniaOptions = store.insigniaOption;
|
|
||||||
|
|
||||||
insigniaOptionsMain.value = store.insigniaOption;
|
insigniaOptionsMain.value = store.insigniaTypeOpMain;
|
||||||
insigniaOptions.value = store.insigniaOption;
|
insigniaOptions.value = store.insigniaOption;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -1064,12 +1131,12 @@ onMounted(async () => {
|
||||||
v-model="insigniaType"
|
v-model="insigniaType"
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
:label="`${'ลำดับชั้น'}`"
|
:label="`${'ลำดับชั้น'}`"
|
||||||
:options="store.insigniaTypeOp"
|
:options="insigniaOptions"
|
||||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกลำดับชั้น'}`]"
|
:rules="[(val:string) => !!val || `${'กรุณาเลือกลำดับชั้น'}`]"
|
||||||
@filter="(inputValue:string,
|
@filter="(inputValue:string,
|
||||||
doneFn:Function) => filterSelector(inputValue, doneFn,'insigniaOptions'
|
doneFn:Function) => filterSelector(inputValue, doneFn,'type'
|
||||||
) "
|
) "
|
||||||
@update:modelValue="insigniaTypeSelection(true)"
|
@update:modelValue="(val:any)=>insigniaTypeSelection(true,val)"
|
||||||
>
|
>
|
||||||
<template v-slot:no-option>
|
<template v-slot:no-option>
|
||||||
<q-item>
|
<q-item>
|
||||||
|
|
@ -1098,7 +1165,7 @@ onMounted(async () => {
|
||||||
v-model="insigniaForm.insigniaId"
|
v-model="insigniaForm.insigniaId"
|
||||||
class="inputgreen"
|
class="inputgreen"
|
||||||
:label="`${'ชื่อเครื่องราชฯ'}`"
|
:label="`${'ชื่อเครื่องราชฯ'}`"
|
||||||
:options="insigniaOptions"
|
:options="insigniaOptionsName"
|
||||||
:rules="[(val:string) => !!val || `${'กรุณาเลือกชื่อเครื่องราชฯ'}`]"
|
:rules="[(val:string) => !!val || `${'กรุณาเลือกชื่อเครื่องราชฯ'}`]"
|
||||||
@filter="(inputValue:string,
|
@filter="(inputValue:string,
|
||||||
doneFn:Function) => filterSelector(inputValue, doneFn,'insigniaOptions'
|
doneFn:Function) => filterSelector(inputValue, doneFn,'insigniaOptions'
|
||||||
|
|
@ -1288,6 +1355,7 @@ onMounted(async () => {
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-md-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<q-uploader
|
<q-uploader
|
||||||
|
v-if="!isUpload"
|
||||||
color="gray"
|
color="gray"
|
||||||
type="file"
|
type="file"
|
||||||
flat
|
flat
|
||||||
|
|
@ -1360,6 +1428,31 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-uploader>
|
</q-uploader>
|
||||||
|
|
||||||
|
<q-list bordered dense separator v-else class="full-width">
|
||||||
|
<q-item>
|
||||||
|
<q-item-section> {{ fileData?.fileName }}</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<div class="row">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="primary"
|
||||||
|
icon="mdi-download"
|
||||||
|
@click="onDownloadFile(id)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="grey"
|
||||||
|
icon="close"
|
||||||
|
@click="isUpload = false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@ import config from "@/app.config";
|
||||||
|
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/DeclarationHonor";
|
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/DeclarationHonor";
|
||||||
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
|
import type {
|
||||||
|
DataOption,
|
||||||
|
ResFileData,
|
||||||
|
} from "@/modules/04_registryPerson/interface/index/Main";
|
||||||
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/DeclarationHonor";
|
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/DeclarationHonor";
|
||||||
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
@ -34,13 +37,14 @@ const profileId = ref<string>(
|
||||||
route.params.id ? route.params.id.toString() : ""
|
route.params.id ? route.params.id.toString() : ""
|
||||||
);
|
);
|
||||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||||
|
const isUpload = ref<boolean>(false);
|
||||||
|
const fileUpload = ref<File | null>(null);
|
||||||
|
const fileData = ref<ResFileData | null>(null);
|
||||||
/** props*/
|
/** props*/
|
||||||
const isLeave = defineModel<boolean>("isLeave", {
|
const isLeave = defineModel<boolean>("isLeave", {
|
||||||
required: true,
|
required: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const fileUpload = ref<File>();
|
|
||||||
const uploadUrl = ref<string>("");
|
const uploadUrl = ref<string>("");
|
||||||
|
|
||||||
const typeOp = ref<DataOption[]>([
|
const typeOp = ref<DataOption[]>([
|
||||||
|
|
@ -282,6 +286,7 @@ async function addEditData(editStatus: boolean = false) {
|
||||||
const method = editStatus ? "patch" : "post";
|
const method = editStatus ? "patch" : "post";
|
||||||
const reqBody: RequestItemsObject = {
|
const reqBody: RequestItemsObject = {
|
||||||
...declHonorForm,
|
...declHonorForm,
|
||||||
|
isUpload: !isEdit.value ? undefined : isUpload.value,
|
||||||
profileEmployeeId:
|
profileEmployeeId:
|
||||||
!editStatus && empType.value !== "" ? profileId.value : undefined,
|
!editStatus && empType.value !== "" ? profileId.value : undefined,
|
||||||
profileId:
|
profileId:
|
||||||
|
|
@ -295,8 +300,8 @@ async function addEditData(editStatus: boolean = false) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await http[method](url, reqBody).then(async (res) => {
|
await http[method](url, reqBody).then(async (res) => {
|
||||||
if (fileUpload.value && res.data.result) {
|
if ((fileUpload.value && id.value) || res.data.result) {
|
||||||
await uploadProfile(res.data.result);
|
await uploadProfile(id.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await fetchData();
|
await fetchData();
|
||||||
|
|
@ -352,19 +357,38 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
||||||
"Content-Type": file.type,
|
"Content-Type": file.type,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async (res) => {
|
||||||
fileUpload.value = undefined;
|
if (res.status == 200) {
|
||||||
|
await isUploadFn();
|
||||||
|
}
|
||||||
|
fileUpload.value = null;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isUploadFn() {
|
||||||
|
await http
|
||||||
|
.patch(config.API.profileNewHonorById(id.value, empType.value), {
|
||||||
|
isUpload: fileUpload.value ? true : false,
|
||||||
|
isDate: declHonorForm.isDate === "true" ? true : false,
|
||||||
|
})
|
||||||
|
.then(async (res) => {})
|
||||||
|
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันโหลไฟลเอกสารหลักฐาน
|
* ฟังก์ชันโหลไฟลเอกสารหลักฐาน
|
||||||
* @param id รายการที่ต้องการโหลด
|
* @param id รายการที่ต้องการโหลด
|
||||||
*/
|
*/
|
||||||
async function onDownloadFile(id: string) {
|
async function onDownloadFile(id: string, isLoad: boolean = true) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
|
|
@ -377,8 +401,11 @@ async function onDownloadFile(id: string) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.downloadUrl;
|
const data = res.data;
|
||||||
window.open(data, "_blank");
|
fileData.value = data;
|
||||||
|
if (isLoad) {
|
||||||
|
window.open(data.downloadUrl, "_blank");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -404,6 +431,12 @@ function onClickOpenDialog(editStatus: boolean = false, row?: ResponseObject) {
|
||||||
declHonorForm.refCommandDate = row.refCommandDate;
|
declHonorForm.refCommandDate = row.refCommandDate;
|
||||||
declHonorForm.type = row.type;
|
declHonorForm.type = row.type;
|
||||||
declHonorForm.isDate = row.isDate ? "true" : "false";
|
declHonorForm.isDate = row.isDate ? "true" : "false";
|
||||||
|
|
||||||
|
isUpload.value = row.isUpload;
|
||||||
|
|
||||||
|
if (isUpload.value) {
|
||||||
|
onDownloadFile(row.id, false);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
clearData();
|
clearData();
|
||||||
}
|
}
|
||||||
|
|
@ -456,6 +489,10 @@ function clearData() {
|
||||||
declHonorForm.type = "";
|
declHonorForm.type = "";
|
||||||
declHonorForm.refCommandDate = null;
|
declHonorForm.refCommandDate = null;
|
||||||
declHonorForm.isDate = "false";
|
declHonorForm.isDate = "false";
|
||||||
|
|
||||||
|
fileUpload.value = null;
|
||||||
|
isUpload.value = false;
|
||||||
|
fileData.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function serchDataTable() {
|
function serchDataTable() {
|
||||||
|
|
@ -890,6 +927,7 @@ onMounted(() => {
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-md-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<q-uploader
|
<q-uploader
|
||||||
|
v-if="!isUpload"
|
||||||
color="gray"
|
color="gray"
|
||||||
type="file"
|
type="file"
|
||||||
flat
|
flat
|
||||||
|
|
@ -962,6 +1000,31 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-uploader>
|
</q-uploader>
|
||||||
|
|
||||||
|
<q-list bordered dense separator v-else class="full-width">
|
||||||
|
<q-item>
|
||||||
|
<q-item-section> {{ fileData?.fileName }}</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<div class="row">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="primary"
|
||||||
|
icon="mdi-download"
|
||||||
|
@click="onDownloadFile(id)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="grey"
|
||||||
|
icon="close"
|
||||||
|
@click="isUpload = false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/index/performSpecialWork";
|
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/index/performSpecialWork";
|
||||||
|
import type { ResFileData } from "@/modules/04_registryPerson/interface/index/Main";
|
||||||
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWorkHistory.vue";
|
import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/04_PerformSpecialWorkHistory.vue";
|
||||||
|
|
@ -33,8 +34,13 @@ const profileId = ref<string>(
|
||||||
route.params.id ? route.params.id.toString() : ""
|
route.params.id ? route.params.id.toString() : ""
|
||||||
);
|
);
|
||||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||||
const fileUpload = ref<File>();
|
|
||||||
const uploadUrl = ref<string>("");
|
const uploadUrl = ref<string>("");
|
||||||
|
|
||||||
|
const isUpload = ref<boolean>(false);
|
||||||
|
const fileUpload = ref<File | null>(null);
|
||||||
|
const fileData = ref<ResFileData | null>(null);
|
||||||
|
|
||||||
/** props*/
|
/** props*/
|
||||||
const isLeave = defineModel<boolean>("isLeave", {
|
const isLeave = defineModel<boolean>("isLeave", {
|
||||||
required: true,
|
required: true,
|
||||||
|
|
@ -51,7 +57,8 @@ const dutyData = reactive<RequestItemsObject>({
|
||||||
detail: "", //รายละเอียด
|
detail: "", //รายละเอียด
|
||||||
reference: "", //เอกสารอ้างอิง
|
reference: "", //เอกสารอ้างอิง
|
||||||
refCommandNo: "", //เลขที่คำสั่ง
|
refCommandNo: "", //เลขที่คำสั่ง
|
||||||
refCommandDate: null, //'เอกสารอ้างอิง (ลงวันที่)'
|
refCommandDate: null, //'เอกสารอ้างอิง (ลงวันที่)',
|
||||||
|
isUpload: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mode = ref<string>("table"); //การแสดงผล Table card
|
const mode = ref<string>("table"); //การแสดงผล Table card
|
||||||
|
|
@ -158,6 +165,12 @@ function openDialogEdit(props: RequestItemsObject) {
|
||||||
dutyData.reference = props.reference;
|
dutyData.reference = props.reference;
|
||||||
dutyData.refCommandNo = props.refCommandNo;
|
dutyData.refCommandNo = props.refCommandNo;
|
||||||
dutyData.refCommandDate = props.refCommandDate;
|
dutyData.refCommandDate = props.refCommandDate;
|
||||||
|
|
||||||
|
isUpload.value = props.isUpload;
|
||||||
|
|
||||||
|
if (isUpload.value && props.id) {
|
||||||
|
onDownloadFile(props.id, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -179,7 +192,11 @@ function closeDialog() {
|
||||||
dutyData.reference = "";
|
dutyData.reference = "";
|
||||||
dutyData.refCommandNo = "";
|
dutyData.refCommandNo = "";
|
||||||
dutyData.refCommandDate = null;
|
dutyData.refCommandDate = null;
|
||||||
fileUpload.value = undefined;
|
fileUpload.value = null;
|
||||||
|
|
||||||
|
fileUpload.value = null;
|
||||||
|
isUpload.value = false;
|
||||||
|
fileData.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** fetch ข้อมูลรายการพิเศษ*/
|
/** fetch ข้อมูลรายการพิเศษ*/
|
||||||
|
|
@ -211,6 +228,7 @@ function addData() {
|
||||||
reference: dutyData.reference,
|
reference: dutyData.reference,
|
||||||
refCommandNo: dutyData.refCommandNo,
|
refCommandNo: dutyData.refCommandNo,
|
||||||
refCommandDate: dutyData.refCommandDate,
|
refCommandDate: dutyData.refCommandDate,
|
||||||
|
isUpload: !edit.value ? undefined : isUpload.value,
|
||||||
};
|
};
|
||||||
http
|
http
|
||||||
.post(config.API.profileNewDuty(empType.value), body)
|
.post(config.API.profileNewDuty(empType.value), body)
|
||||||
|
|
@ -239,8 +257,8 @@ function editData(idData: string) {
|
||||||
profileId: undefined,
|
profileId: undefined,
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
if (fileUpload.value && res.data.result) {
|
if (fileUpload.value && id.value) {
|
||||||
await uploadProfile(res.data.result);
|
await uploadProfile(id.value);
|
||||||
}
|
}
|
||||||
await fetchData(profileId.value);
|
await fetchData(profileId.value);
|
||||||
await success($q, "บันทึกข้อมูลสำเร็จ");
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
|
@ -297,19 +315,37 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
||||||
"Content-Type": file.type,
|
"Content-Type": file.type,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async (res) => {
|
||||||
fileUpload.value = undefined;
|
if (res.status == 200) {
|
||||||
|
await isUploadFn();
|
||||||
|
}
|
||||||
|
fileUpload.value = null;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isUploadFn() {
|
||||||
|
await http
|
||||||
|
.patch(config.API.profileNewDutyByDutyId(id.value, empType.value), {
|
||||||
|
isUpload: fileUpload.value ? true : false,
|
||||||
|
})
|
||||||
|
.then(async (res) => {})
|
||||||
|
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันโหลไฟลเอกสารหลักฐาน
|
* ฟังก์ชันโหลไฟลเอกสารหลักฐาน
|
||||||
* @param id รายการที่ต้องการโหลด
|
* @param id รายการที่ต้องการโหลด
|
||||||
*/
|
*/
|
||||||
async function onDownloadFile(id: string) {
|
async function onDownloadFile(id: string, isLoad: boolean = true) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
|
|
@ -322,8 +358,11 @@ async function onDownloadFile(id: string) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.downloadUrl;
|
const data = res.data;
|
||||||
window.open(data, "_blank");
|
fileData.value = data;
|
||||||
|
if (isLoad) {
|
||||||
|
window.open(data.downloadUrl, "_blank");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -756,6 +795,7 @@ onMounted(() => {
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-md-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<q-uploader
|
<q-uploader
|
||||||
|
v-if="!isUpload"
|
||||||
color="gray"
|
color="gray"
|
||||||
type="file"
|
type="file"
|
||||||
flat
|
flat
|
||||||
|
|
@ -828,6 +868,31 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-uploader>
|
</q-uploader>
|
||||||
|
|
||||||
|
<q-list bordered dense separator v-else class="full-width">
|
||||||
|
<q-item>
|
||||||
|
<q-item-section> {{ fileData?.fileName }}</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<div class="row">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="primary"
|
||||||
|
icon="mdi-download"
|
||||||
|
@click="onDownloadFile(id)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="grey"
|
||||||
|
icon="close"
|
||||||
|
@click="isUpload = false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,10 @@ async function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
config.API.file("ระบบทะเบียนประวัติ", "เอกสาร ก.พ.7", profileId.value)
|
config.API.file("ระบบทะเบียนประวัติ", "เอกสารหลักฐานเพิ่มเติม", profileId.value)
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("ระบบทะเบียนประวัติ", "เอกสาร ก.พ.7", profileId.value)
|
console.log("ระบบทะเบียนประวัติ", "เอกสารหลักฐานเพิ่มเติม", profileId.value)
|
||||||
fileList.value = res.data;
|
fileList.value = res.data;
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
@ -73,7 +73,7 @@ function clickUpload(file: any) {
|
||||||
.post(
|
.post(
|
||||||
config.API.file(
|
config.API.file(
|
||||||
"ระบบทะเบียนประวัติ",
|
"ระบบทะเบียนประวัติ",
|
||||||
"เอกสาร ก.พ.7",
|
"เอกสารหลักฐานเพิ่มเติม",
|
||||||
profileId.value
|
profileId.value
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
|
|
@ -135,7 +135,7 @@ function downloadFile(fileName: string) {
|
||||||
.get(
|
.get(
|
||||||
config.API.fileByFile(
|
config.API.fileByFile(
|
||||||
"ระบบทะเบียนประวัติ",
|
"ระบบทะเบียนประวัติ",
|
||||||
"เอกสาร ก.พ.7",
|
"เอกสารหลักฐานเพิ่มเติม",
|
||||||
profileId.value,
|
profileId.value,
|
||||||
fileName
|
fileName
|
||||||
)
|
)
|
||||||
|
|
@ -163,7 +163,7 @@ function deleteFile(fileName: string) {
|
||||||
.delete(
|
.delete(
|
||||||
config.API.fileByFile(
|
config.API.fileByFile(
|
||||||
"ระบบทะเบียนประวัติ",
|
"ระบบทะเบียนประวัติ",
|
||||||
"เอกสาร ก.พ.7",
|
"เอกสารหลักฐานเพิ่มเติม",
|
||||||
profileId.value,
|
profileId.value,
|
||||||
fileName
|
fileName
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import { useCounterMixin } from "@/stores/mixin";
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/SpecialSkill";
|
import type { RequestItemsObject } from "@/modules/04_registryPerson/interface/request/SpecialSkill";
|
||||||
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/SpecialSkill";
|
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/SpecialSkill";
|
||||||
|
import type { ResFileData } from "@/modules/04_registryPerson/interface/index/Main";
|
||||||
|
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
|
|
@ -35,9 +36,12 @@ const profileId = ref<string>(
|
||||||
route.params.id ? route.params.id.toString() : ""
|
route.params.id ? route.params.id.toString() : ""
|
||||||
);
|
);
|
||||||
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? ""));
|
||||||
const fileUpload = ref<File>();
|
|
||||||
const uploadUrl = ref<string>("");
|
|
||||||
|
|
||||||
|
const uploadUrl = ref<string>("");
|
||||||
|
const isUpload = ref<boolean>(false);
|
||||||
|
const fileUpload = ref<File | null>(null);
|
||||||
|
const fileData = ref<ResFileData | null>(null);
|
||||||
|
const isEdit = ref<boolean>(false);
|
||||||
const mode = ref<string>("table"); //การแสดงของ Table card
|
const mode = ref<string>("table"); //การแสดงของ Table card
|
||||||
/**
|
/**
|
||||||
* props
|
* props
|
||||||
|
|
@ -227,7 +231,11 @@ function clearForm() {
|
||||||
specialSkill.field = "";
|
specialSkill.field = "";
|
||||||
specialSkill.reference = "";
|
specialSkill.reference = "";
|
||||||
specialSkill.remark = "";
|
specialSkill.remark = "";
|
||||||
fileUpload.value = undefined;
|
isEdit.value = false;
|
||||||
|
|
||||||
|
fileUpload.value = null;
|
||||||
|
isUpload.value = false;
|
||||||
|
fileData.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -242,6 +250,12 @@ function editForm(row: any) {
|
||||||
specialSkill.reference = row.reference;
|
specialSkill.reference = row.reference;
|
||||||
specialSkill.remark = row.remark;
|
specialSkill.remark = row.remark;
|
||||||
dialog.value = true;
|
dialog.value = true;
|
||||||
|
isEdit.value = true;
|
||||||
|
isUpload.value = row.isUpload;
|
||||||
|
|
||||||
|
if (isUpload.value) {
|
||||||
|
onDownloadFile(row.id, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function fetch ข้อมูลความสามรรถพิเศษ*/
|
/** function fetch ข้อมูลความสามรรถพิเศษ*/
|
||||||
|
|
@ -291,6 +305,7 @@ async function addData() {
|
||||||
dateEnd: null,
|
dateEnd: null,
|
||||||
profileId: empType.value === "" ? id.value : undefined,
|
profileId: empType.value === "" ? id.value : undefined,
|
||||||
profileEmployeeId: empType.value !== "" ? id.value : undefined,
|
profileEmployeeId: empType.value !== "" ? id.value : undefined,
|
||||||
|
isUpload: !isEdit.value ? undefined : isUpload.value,
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
if (fileUpload.value && res.data.result) {
|
if (fileUpload.value && res.data.result) {
|
||||||
|
|
@ -322,8 +337,8 @@ async function editData(idData: string) {
|
||||||
profileId: undefined,
|
profileId: undefined,
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
if (fileUpload.value && res.data.result) {
|
if (fileUpload.value && id.value) {
|
||||||
await uploadProfile(res.data.result);
|
await uploadProfile(id.value);
|
||||||
}
|
}
|
||||||
await fetchData(id.value);
|
await fetchData(id.value);
|
||||||
await success($q, "บันทึกข้อมูลสำเร็จ");
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
|
@ -380,19 +395,37 @@ async function uploadFileURL(uploadUrl: string, file: any) {
|
||||||
"Content-Type": file.type,
|
"Content-Type": file.type,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(async (res) => {
|
||||||
fileUpload.value = undefined;
|
if (res.status == 200) {
|
||||||
|
await isUploadFn();
|
||||||
|
}
|
||||||
|
fileUpload.value = null;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function isUploadFn() {
|
||||||
|
await http
|
||||||
|
.patch(config.API.profileNewAbilityByAbilityId(editId.value, empType.value), {
|
||||||
|
isUpload: fileUpload.value ? true : false,
|
||||||
|
})
|
||||||
|
.then(async (res) => {})
|
||||||
|
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันโหลไฟลเอกสารหลักฐาน
|
* ฟังก์ชันโหลไฟลเอกสารหลักฐาน
|
||||||
* @param id รายการที่ต้องการโหลด
|
* @param id รายการที่ต้องการโหลด
|
||||||
*/
|
*/
|
||||||
async function onDownloadFile(id: string) {
|
async function onDownloadFile(id: string, isLoad: boolean = true) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(
|
.get(
|
||||||
|
|
@ -405,8 +438,11 @@ async function onDownloadFile(id: string) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.downloadUrl;
|
const data = res.data;
|
||||||
window.open(data, "_blank");
|
fileData.value = data;
|
||||||
|
if (isLoad) {
|
||||||
|
window.open(data.downloadUrl, "_blank");
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -419,6 +455,7 @@ async function onDownloadFile(id: string) {
|
||||||
/** function ปิด popup ข้อมูลความสามารถพิเศษ*/
|
/** function ปิด popup ข้อมูลความสามารถพิเศษ*/
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
dialog.value = false;
|
dialog.value = false;
|
||||||
|
clearForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function ปิด popup รายการประวัติ*/
|
/** function ปิด popup รายการประวัติ*/
|
||||||
|
|
@ -590,7 +627,7 @@ onMounted(() => {
|
||||||
dense
|
dense
|
||||||
round
|
round
|
||||||
icon="mdi-file-document-outline"
|
icon="mdi-file-document-outline"
|
||||||
@click="onDownloadFile(props.row.id)"
|
@click="onDownloadFile(props.row.profileId)"
|
||||||
>
|
>
|
||||||
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
<q-tooltip>ดาวน์โหลด</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
@ -713,6 +750,7 @@ onMounted(() => {
|
||||||
<div class="col-xs-12 col-sm-12 col-md-12">
|
<div class="col-xs-12 col-sm-12 col-md-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<q-uploader
|
<q-uploader
|
||||||
|
v-if="!isUpload"
|
||||||
color="gray"
|
color="gray"
|
||||||
type="file"
|
type="file"
|
||||||
flat
|
flat
|
||||||
|
|
@ -785,6 +823,31 @@ onMounted(() => {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-uploader>
|
</q-uploader>
|
||||||
|
|
||||||
|
<q-list bordered dense separator v-else class="full-width">
|
||||||
|
<q-item>
|
||||||
|
<q-item-section> {{ fileData?.fileName }}</q-item-section>
|
||||||
|
<q-item-section avatar>
|
||||||
|
<div class="row">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="primary"
|
||||||
|
icon="mdi-download"
|
||||||
|
@click="onDownloadFile(id)"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="grey"
|
||||||
|
icon="close"
|
||||||
|
@click="isUpload = false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,41 @@ interface Request {
|
||||||
topic: string;
|
topic: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface InsigniasType {
|
||||||
|
id: string;
|
||||||
|
createdAt: Date;
|
||||||
|
createdUserId: string;
|
||||||
|
lastUpdatedAt: Date;
|
||||||
|
lastUpdateUserId: string;
|
||||||
|
createdFullName: string;
|
||||||
|
lastUpdateFullName: string;
|
||||||
|
name: string;
|
||||||
|
isActive: boolean;
|
||||||
|
insignias: InsigniasTypeSub[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InsigniasTypeSub {
|
||||||
|
id:string;
|
||||||
|
createdAt:Date;
|
||||||
|
createdUserId:string;
|
||||||
|
lastUpdatedAt:Date;
|
||||||
|
lastUpdateUserId:string;
|
||||||
|
createdFullName:string;
|
||||||
|
lastUpdateFullName:string;
|
||||||
|
name:string;
|
||||||
|
shortName:string;
|
||||||
|
level:string;
|
||||||
|
isActive:string;
|
||||||
|
note:string;
|
||||||
|
insigniaTypeId:string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ResFileData {
|
||||||
|
downloadUrl: string;
|
||||||
|
fileName: string;
|
||||||
|
path: string;
|
||||||
|
pathname: string;
|
||||||
|
}
|
||||||
export type {
|
export type {
|
||||||
Pagination,
|
Pagination,
|
||||||
DataOption,
|
DataOption,
|
||||||
|
|
@ -97,4 +132,8 @@ export type {
|
||||||
DataOptionEducation,
|
DataOptionEducation,
|
||||||
DataOptionEducationLevel,
|
DataOptionEducationLevel,
|
||||||
Request,
|
Request,
|
||||||
|
|
||||||
|
InsigniasType,
|
||||||
|
InsigniasTypeSub,
|
||||||
|
ResFileData
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ interface RequestItemsObject {
|
||||||
reference: string;
|
reference: string;
|
||||||
refCommandNo: string;
|
refCommandNo: string;
|
||||||
refCommandDate: Date | null;
|
refCommandDate: Date | null;
|
||||||
|
isUpload: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MyObjectRef {
|
interface MyObjectRef {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ interface RequestItemsObject {
|
||||||
refCommandNo: string;
|
refCommandNo: string;
|
||||||
type: string;
|
type: string;
|
||||||
isDate: boolean | string;
|
isDate: boolean | string;
|
||||||
|
isUpload?: boolean|undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { RequestItemsObject };
|
export type { RequestItemsObject };
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ interface RequestItemsObject {
|
||||||
refCommandNo: string;
|
refCommandNo: string;
|
||||||
note: string;
|
note: string;
|
||||||
profileEmployeeId?: string | null;
|
profileEmployeeId?: string | null;
|
||||||
|
isUpload?: boolean | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { RequestItemsObject };
|
export type { RequestItemsObject };
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ interface ResponseObject {
|
||||||
profileId: string;
|
profileId: string;
|
||||||
type: string;
|
type: string;
|
||||||
refCommandDate: Date;
|
refCommandDate: Date;
|
||||||
|
isUpload: boolean;
|
||||||
refCommandNo: string;
|
refCommandNo: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ interface ResponseObject {
|
||||||
volumeNo: string;
|
volumeNo: string;
|
||||||
refCommandDate: Date | null;
|
refCommandDate: Date | null;
|
||||||
refCommandNo: string;
|
refCommandNo: string;
|
||||||
|
isUpload: boolean;
|
||||||
note: string;
|
note: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,37 @@
|
||||||
import { ref, computed } from "vue";
|
import { ref, computed } from "vue";
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import type { DataOptionInsignia,DataOption } from "@/modules/04_registryPerson/interface/index/Main";
|
import type {
|
||||||
|
DataOptionInsignia,
|
||||||
|
DataOption,
|
||||||
|
InsigniasType,
|
||||||
|
InsigniasTypeSub,
|
||||||
|
} from "@/modules/04_registryPerson/interface/index/Main";
|
||||||
import type { ResponseObject as Insignia } from "@/modules/07_insignia/interface/response/Main";
|
import type { ResponseObject as Insignia } from "@/modules/07_insignia/interface/response/Main";
|
||||||
|
|
||||||
export const useInsigniaDataStore = defineStore("insigniaDataStore", () => {
|
export const useInsigniaDataStore = defineStore("insigniaDataStore", () => {
|
||||||
const insigniaOption = ref<DataOptionInsignia[]>([]);
|
const insigniaOption = ref<InsigniasType[]>([]);
|
||||||
const insigniaTypeOp = ref<DataOption[]>([]);
|
|
||||||
const insigniaTypeOpMain = ref<DataOption[]>([]);
|
|
||||||
|
|
||||||
function mapInsigniaOption(resData: any) {
|
const insigniaTypeOp = ref<InsigniasType[]>([]);
|
||||||
insigniaTypeOp.value = Array.from(
|
const insigniaTypeOpMain = ref<InsigniasType[]>([]);
|
||||||
new Map(
|
const allNameInsignia = ref<InsigniasTypeSub[]>([]);
|
||||||
resData.map((item:any) => [item.insigniaTypeName, { id: item.insigniaTypeId, name: item.insigniaTypeName }])
|
|
||||||
).values()
|
|
||||||
) as DataOption[];
|
|
||||||
|
|
||||||
insigniaOption.value = [];
|
function mapInsigniaOption(resData: InsigniasType[]) {
|
||||||
resData.map((r: Insignia) => {
|
insigniaTypeOpMain.value = resData;
|
||||||
insigniaOption.value.push({
|
insigniaTypeOp.value = resData;
|
||||||
id: r.id.toString(),
|
|
||||||
name: r.name.toString() + ` (${r.shortName})`,
|
allNameInsignia.value = resData
|
||||||
typeId: r.insigniaTypeId.toString(),
|
.flatMap((item: InsigniasType) => item.insignias)
|
||||||
typeName: r.insigniaTypeName.toString(),
|
.map((i: InsigniasTypeSub) => ({
|
||||||
});
|
...i,
|
||||||
});
|
name: `${i.name} (${i.shortName})`,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return { insigniaOption, mapInsigniaOption,insigniaTypeOp };
|
return {
|
||||||
|
insigniaOption,
|
||||||
|
mapInsigniaOption,
|
||||||
|
insigniaTypeOp,
|
||||||
|
insigniaTypeOpMain,
|
||||||
|
allNameInsignia,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue