ส่งหนังสือเวียน
This commit is contained in:
parent
64152f72d9
commit
e39809b0d0
3 changed files with 77 additions and 50 deletions
|
|
@ -20,6 +20,8 @@ export default {
|
||||||
//RetirementDeceased ถึงแก่กรรม
|
//RetirementDeceased ถึงแก่กรรม
|
||||||
listDeceased: () => `${retirement}/deceased`,
|
listDeceased: () => `${retirement}/deceased`,
|
||||||
detailDeceased: (id: string) => `${retirement}/deceased/${id}`,
|
detailDeceased: (id: string) => `${retirement}/deceased/${id}`,
|
||||||
|
detailByidDeceased: (id: string) => `${retirement}/deceased/detail/${id}`,
|
||||||
|
notiDeceased: (id: string) => `${retirement}/deceased/noti/${id}`,
|
||||||
|
|
||||||
// RetirementResign ระบบลาออก
|
// RetirementResign ระบบลาออก
|
||||||
listResign: () => `${retirement}/resign`,
|
listResign: () => `${retirement}/resign`,
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,8 @@ import type { treeTab } from "@/modules/05_placement/interface/index/Main";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
|
||||||
ResponseOrganiz,
|
import type { requestSendNoti,DataCopyOrder,ResponseOrganiz } from "@/modules/06_retirement/interface/response/Deceased";
|
||||||
ResponseCopyOrder,
|
|
||||||
DataCopyOrder,
|
|
||||||
} from "@/modules/05_placement/interface/response/Order";
|
|
||||||
import type { RequestCopyOrder } from "@/modules/05_placement/interface/request/Order";
|
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
@ -160,9 +156,24 @@ const rows = ref<DataCopyOrder[]>([]);
|
||||||
const editRows = ref<DataCopyOrder[]>([]);
|
const editRows = ref<DataCopyOrder[]>([]);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await conditionId();
|
await getData();
|
||||||
|
// await getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getList = async () => {
|
||||||
|
showLoader();
|
||||||
|
await http.get(config.API.detailByidDeceased(profileId.value))
|
||||||
|
.then((res) => {
|
||||||
|
const data = res.data.result
|
||||||
|
console.log(data)
|
||||||
|
}).catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(async () => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
const listModal = async (id: string) => {
|
const listModal = async (id: string) => {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
|
|
@ -192,40 +203,31 @@ const listModal = async (id: string) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const conditionId = async () => {
|
|
||||||
const id = route.params.orderid
|
|
||||||
? route.params.orderid.toString()
|
|
||||||
: localStorage.getItem("orderId")
|
|
||||||
? localStorage.getItem("orderId")
|
|
||||||
: null;
|
|
||||||
if (id !== null) {
|
|
||||||
await getData(id);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getData = async (id: string) => {
|
const getData = async () => {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.copyOrderId(id))
|
.get(config.API.detailByidDeceased(profileId.value))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
// console.log(data);
|
// console.log(data);
|
||||||
let list: DataCopyOrder[] = [];
|
let list: DataCopyOrder[] = [];
|
||||||
data.map((r: ResponseCopyOrder) => {
|
data.map((r: any) => {
|
||||||
let selectCopyOrder = [];
|
let selectCopyOrder = [];
|
||||||
if (r.emailChannel) {
|
if (r.isSendMail) {
|
||||||
selectCopyOrder.push(1);
|
selectCopyOrder.push(1);
|
||||||
}
|
}
|
||||||
if (r.inboxChannel) {
|
if (r.isSendInbox) {
|
||||||
selectCopyOrder.push(2);
|
selectCopyOrder.push(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
list.push({
|
list.push({
|
||||||
personalId: r.personalId ?? "",
|
id:r.id,
|
||||||
name: r.name ?? "",
|
personalId: r.profileId ?? "",
|
||||||
idCard: r.idCard ?? "",
|
name:`${r.prefix}${r.firstName} ${r.lastName}`,
|
||||||
position: r.position ?? "",
|
idCard: r.citizenId ?? "",
|
||||||
unit: r.unit ?? "",
|
position: r.positionName ?? "",
|
||||||
|
unit: r.organizationName ?? "-",
|
||||||
send: "",
|
send: "",
|
||||||
mutiselect: selectCopyOrder,
|
mutiselect: selectCopyOrder,
|
||||||
});
|
});
|
||||||
|
|
@ -250,29 +252,22 @@ const getData = async (id: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const saveData = async () => {
|
const saveData = async () => {
|
||||||
// console.log("select", selectedModal.value);
|
|
||||||
const id = route.params.orderid
|
|
||||||
? route.params.orderid.toString()
|
|
||||||
: localStorage.getItem("orderId")
|
|
||||||
? localStorage.getItem("orderId")
|
|
||||||
: null;
|
|
||||||
if (id !== null) {
|
|
||||||
showLoader();
|
showLoader();
|
||||||
|
const persons = selectedModal.value.map(item => ({ profileId: item.profileId }));
|
||||||
|
const dataToSend = { Persons: persons };
|
||||||
await http
|
await http
|
||||||
.post(config.API.copyOrderPersonsId(id), selectedModal.value)
|
.put(config.API.detailByidDeceased(profileId.value), dataToSend)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
// const data = res.data.result;
|
|
||||||
// console.log(res);
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
await conditionId();
|
|
||||||
clickClose();
|
clickClose();
|
||||||
// hideLoader();
|
getData();
|
||||||
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetFilter = () => {
|
const resetFilter = () => {
|
||||||
|
|
@ -304,6 +299,7 @@ const clickAdd = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const clickDelete = (id: string) => {
|
const clickDelete = (id: string) => {
|
||||||
|
console.log(id)
|
||||||
dialogRemove(
|
dialogRemove(
|
||||||
$q,
|
$q,
|
||||||
() => deleteData(id),
|
() => deleteData(id),
|
||||||
|
|
@ -335,10 +331,8 @@ const onSelected = async (id: string) => {
|
||||||
|
|
||||||
const deleteData = async (id: string) => {
|
const deleteData = async (id: string) => {
|
||||||
await http
|
await http
|
||||||
.delete(config.API.copyOrderId(id))
|
.delete(config.API.detailByidDeceased(id))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
// const data = res.data.result;
|
|
||||||
// console.log(res);
|
|
||||||
success($q, "ลบข้อมูลสำเร็จ");
|
success($q, "ลบข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
@ -346,7 +340,7 @@ const deleteData = async (id: string) => {
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
// hideLoader();
|
// hideLoader();
|
||||||
await conditionId();
|
await getData();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -361,18 +355,19 @@ const saveDataCopyOrder = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchSaveCopyOrder = async () => {
|
const fetchSaveCopyOrder = async () => {
|
||||||
let list: RequestCopyOrder[] = [];
|
let list: requestSendNoti[] = [];
|
||||||
rows.value.map((r: DataCopyOrder) => {
|
rows.value.map((r: DataCopyOrder) => {
|
||||||
list.push({
|
list.push({
|
||||||
personalId: r.personalId,
|
profileId: r.personalId,
|
||||||
emailChannel: r.mutiselect.includes(1),
|
isSendMail: r.mutiselect.includes(1),
|
||||||
inboxChannel: r.mutiselect.includes(2),
|
isSendInbox: r.mutiselect.includes(2),
|
||||||
|
isSendNotification: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.put(config.API.copyOrder, list)
|
.put(config.API.notiDeceased(profileId.value), {Persons:list})
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
next();
|
next();
|
||||||
|
|
@ -382,6 +377,7 @@ const fetchSaveCopyOrder = async () => {
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
getData()
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -514,13 +510,14 @@ const updateData = (row: DataCopyOrder) => {
|
||||||
</q-select>
|
</q-select>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td auto-width>
|
<q-td auto-width>
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
dense
|
dense
|
||||||
size="12px"
|
size="12px"
|
||||||
flat
|
flat
|
||||||
round
|
round
|
||||||
color="red"
|
color="red"
|
||||||
@click="clickDelete(props.row.personalId)"
|
@click="clickDelete(props.row.id)"
|
||||||
icon="mdi-delete"
|
icon="mdi-delete"
|
||||||
>
|
>
|
||||||
<q-tooltip>ลบข้อมูล</q-tooltip>
|
<q-tooltip>ลบข้อมูล</q-tooltip>
|
||||||
|
|
@ -628,6 +625,7 @@ const updateData = (row: DataCopyOrder) => {
|
||||||
:filter="filterModal"
|
:filter="filterModal"
|
||||||
row-key="profileId"
|
row-key="profileId"
|
||||||
selection="multiple"
|
selection="multiple"
|
||||||
|
|
||||||
v-model:selected="selectedModal"
|
v-model:selected="selectedModal"
|
||||||
>
|
>
|
||||||
<template v-slot:header-selection="scope">
|
<template v-slot:header-selection="scope">
|
||||||
|
|
|
||||||
27
src/modules/06_retirement/interface/response/Deceased.ts
Normal file
27
src/modules/06_retirement/interface/response/Deceased.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
interface requestSendNoti {
|
||||||
|
profileId: string;
|
||||||
|
isSendMail: boolean;
|
||||||
|
isSendInbox: boolean;
|
||||||
|
isSendNotification: boolean;
|
||||||
|
}
|
||||||
|
interface DataCopyOrder {
|
||||||
|
id:string;
|
||||||
|
personalId: string;
|
||||||
|
name: string;
|
||||||
|
idCard: string;
|
||||||
|
position: string;
|
||||||
|
unit: string;
|
||||||
|
send: string;
|
||||||
|
mutiselect: number[];
|
||||||
|
}
|
||||||
|
interface ResponseOrganiz {
|
||||||
|
firstName: string;
|
||||||
|
idCard: string;
|
||||||
|
lastName: string;
|
||||||
|
name: string;
|
||||||
|
position: string;
|
||||||
|
prefixId: string;
|
||||||
|
profileId: string;
|
||||||
|
unit: string;
|
||||||
|
}
|
||||||
|
export type { requestSendNoti,DataCopyOrder,ResponseOrganiz };
|
||||||
Loading…
Add table
Add a link
Reference in a new issue