fix:profileId To citizenId

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-02-03 16:23:08 +07:00
parent 79d1a14ec4
commit ae4e874f42
11 changed files with 68 additions and 18 deletions

View file

@ -19,6 +19,7 @@ const { showLoader, hideLoader, messageError } = useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true });
const command = defineModel<string>("command", { required: true });
const commandId = defineModel<string>("commandId", { required: true });
const citizenId = defineModel<string>("citizenId", { required: true });
const promises = ref<any>([]);
const tab = ref<string>("main"); //tab
@ -37,6 +38,7 @@ function closeDialog() {
modal.value = false;
command.value = "";
commandId.value = "";
citizenId.value = "";
}
/**
@ -88,13 +90,25 @@ async function downloadCover(type: string) {
*/
async function fetchDataCommand(type: string) {
let newType = type === "cover" ? "คำสั่ง" : "แนบท้าย";
const pathAPI =
type === "cover"
? config.API.fileByFile(
"ระบบออกคำสั่ง",
newType,
commandId.value,
newType
)
: config.API.subFileByFileName(
"ระบบออกคำสั่ง",
newType,
commandId.value,
citizenId.value,
newType
);
await http
.get(
config.API.fileByFile("ระบบออกคำสั่ง", newType, commandId.value, newType)
)
.get(pathAPI)
.then(async (res) => {
const data = res.data;
console.log(res);
if (type === "cover") {
dataCover.value = data;

View file

@ -155,7 +155,7 @@ async function uploadFileDoc(
uploadUrl: string,
file: any,
group: string,
profileId?: string
id?: string
) {
const formData = new FormData();
formData.append("file", file);
@ -177,7 +177,7 @@ async function uploadFileDoc(
fileUploadOrder.value = null;
} else {
attachmentList.value.forEach((e) => {
if (e.id === profileId) {
if (e.id === id) {
e.file = null;
}
});
@ -217,13 +217,13 @@ async function fetchDocOrder(type: string) {
});
}
async function fetchDocTailer(type: string, profileId: string) {
async function fetchDocTailer(type: string, id: string) {
await http
.get(config.API.subFile("ระบบออกคำสั่ง", type, commandId.value, profileId))
.get(config.API.subFile("ระบบออกคำสั่ง", type, commandId.value, id))
.then((res) => {
const data = res.data[0];
attachmentList.value.forEach((e) => {
if (e.id === profileId) {
if (e.id === id) {
attachmentFiles.value[e.id] = data;
}
});
@ -245,7 +245,7 @@ function downloadFile(
file: any,
group: string,
isView: boolean = false,
profileId: string
id: string
) {
let type = group === "order" ? "คำสั่ง" : "แนบท้าย";
@ -261,7 +261,7 @@ function downloadFile(
"ระบบออกคำสั่ง",
type,
commandId.value,
profileId,
id,
file.fileName
);
@ -330,7 +330,7 @@ async function fetchLists() {
.then(async (res) => {
const data = await res.data.result;
attachmentList.value = data.commandRecives.map((item: any) => ({
id: item.id,
id: item.citizenId,
name: item.prefix + item.firstName + " " + item.lastName,
file: null,
}));