api รายการสืบสวนข้อเท็จจริง

This commit is contained in:
setthawutttty 2023-11-24 17:49:25 +07:00
parent 691a989c16
commit 3c5fcc029b
14 changed files with 1025 additions and 383 deletions

View file

@ -16,12 +16,10 @@ const router = useRouter();
/** บันทึกข้อมูล */
async function onSubmit(data: any) {
/** post */
console.log(data)
showLoader();
http
.post(config.API.complaintAdd(), data)
.then((res) => {
console.log(res)
success($q, "บันทึกข้อมูลสำเร็จ");
router.push(`/discipline/complaints/${res.data.result}`);
})

View file

@ -69,7 +69,7 @@ const data = reactive<FormData>({
documentFile: null,
status: "",
persons: [personOj],
result: '',
result: "",
disciplineComplaintDocs: [fileListOj],
});
@ -158,7 +158,6 @@ async function getData() {
data.result = dataList.result;
data.disciplineComplaintDocs = dataList.disciplineComplaintDocs;
console.log("list", data.id);
})
.catch((e) => {
messageError($q, e);
@ -173,7 +172,6 @@ async function onSubmit(data: any) {
http
.put(config.API.complaintbyId(id.value), data)
.then((res) => {
console.log(res);
success($q, "บันทึกข้อมูลสำเร็จ");
router.push(`/discipline/complaints`);
})
@ -183,19 +181,12 @@ async function onSubmit(data: any) {
.finally(async () => {
hideLoader();
});
console.log("edit", data);
// router.push(`/discipline/complaints`);
}
/** ยืนยัน มีมูลส่งไปสืบสวน */
function sentInvestigate() {
modalPopup.value = true;
// dialogConfirm(
// $q,
// () => confirmSentInvestigate(),
// "",
// "?"
// );
}
function closePopup() {
@ -222,11 +213,6 @@ function cancelInvestigate() {
);
}
/** ฟังชั่น มีมูลส่งไปสืบสวน*/
function confirmSentInvestigate() {
console.log("sent");
}
/** ฟังชั่น ยุติเรื่อง*/
function confirmEndInvestigate() {
showLoader();
@ -236,12 +222,11 @@ function confirmEndInvestigate() {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q,e);
messageError($q, e);
})
.finally(async () => {
await getData();
});
console.log("sent");
}
/** ฟังชั่น ยกเลิกการยุติเรื่อง*/
@ -250,7 +235,7 @@ function confirmCancelInvestigate() {
http
.get(config.API.complaintResume(id.value))
.then((res) => {
getData()
getData();
})
.catch((e) => {
messageError($q, e);
@ -258,19 +243,18 @@ function confirmCancelInvestigate() {
.finally(() => {
hideLoader();
});
console.log("sent");
}
function emitPerson(data:ArrayPerson[]){
console.log('person',data)
const dataMapId = data.map((item:ArrayPerson) =>
item.personId
)
console.log('id',dataMapId)
showLoader();
/**
* งขอม จาก component เเล update
* @param data person data
*/
function emitPerson(data: ArrayPerson[]) {
const dataMapId = data.map((item: ArrayPerson) => item.personId);
showLoader();
http
.put(config.API.complaintApprove(id.value),{
persons:dataMapId
.put(config.API.complaintApprove(id.value), {
persons: dataMapId,
})
.then((res) => {
router.push(`/discipline/complaints`);
@ -282,24 +266,9 @@ function emitPerson(data:ArrayPerson[]){
hideLoader();
});
}
// function sentApprove() {
// // showLoader();
// // http
// // .put(config.API.complaintApprove(id.value))
// // .then((res) => {
// // router.push(`/discipline/complaints`);
// // })
// // .catch((e) => {
// // messageError($q, e);
// // })
// // .finally(() => {
// // hideLoader();
// // });
// console.log("sent");
// }
/** เรียกใช้งาน ฟังชั่น ตอนเริ่มโหลดหน้า */
onMounted(() => {
console.log(data);
// fetchData();
getData();
});
@ -341,11 +310,11 @@ onMounted(() => {
</div>
</div>
<Form
:on-submit="onSubmit"
:data="data"
:get-data="getData"
<Form :on-submit="onSubmit" :data="data" :get-data="getData" />
<Popup
:modal="modalPopup"
:close="closePopup"
@return-person="emitPerson"
/>
<Popup :modal="modalPopup" :close="closePopup" @return-person="emitPerson"/>
</div>
</template>

View file

@ -228,42 +228,6 @@ const visibleColumns = ref<string[]>([
"organization",
]);
/**
* บคาผกรองเรยน
* @param val คคล หนวยงาน กทม
*/
async function selectComplainant(val: string) {
formData.organizationId = "";
formData.consideredAgency = "";
if (val === "0") {
await fetchListname(); // function fetchListname
} else if (val === "1") {
await fetchOffice(); // function fetchOffice
}
}
/** เรียกรายชื่อ */
async function fetchListname() {
const listName = [
{
id: "1",
name: "นายเอ",
},
{
id: "2",
name: "นายบี",
},
{
id: "3",
name: "นายชี",
},
];
selectComplainantTpye(listName);
}
/** เรียกโครงสร้างสำนักงาน */
async function fetchOffice() {}
/**
* งชนอปโหลดไฟล
* @param documentFile ไฟลบมา
@ -379,6 +343,7 @@ function confirmDelete(id: string) {
watch(props.data, async () => {
fileList.value = props.data.disciplineComplaintDocs;
complainstStore.fetchComplainstAdd(props.data.persons);
formData.id = props.data.id;
formData.respondentType = props.data.respondentType;
formData.organizationId = props.data.organizationId;
@ -467,7 +432,6 @@ onMounted(() => {
:options="complainstStore.complainantoptions"
:rules="[(val) => !!val || `${'กรุณาเลือกผู้ร้องเรียน'}`]"
lazy-rules
@update:model-value="selectComplainant(formData.respondentType)"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'filterrespondentType'
)"