ปรับ เรื่องร้องเรียน

This commit is contained in:
setthawutttty 2023-11-27 16:16:04 +07:00
parent cc2e45666e
commit facadbd837
6 changed files with 73 additions and 14 deletions

View file

@ -366,7 +366,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;
@ -403,20 +403,22 @@ function upLoadFileDoc() {
.then((res) => {
console.log(res);
success($q, "บันทึกข้อมูลสำเร็จ");
router.push(`/discipline/complaints`);
props.getData();
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
formData.documentFile = null
});
console.log("file", formData.documentFile, formData.id);
}
async function addPerson(data: any) {
await complainstStore.fetchComplainstAdd(data);
toggleModal();
console.log(data)
await complainstStore.fetchComplainstAdd(data);
}
function getOc() {
@ -425,6 +427,19 @@ function getOc() {
complainstStore.ocListFn(data);
});
}
function deletePerson(id: string) {
dialogRemove($q, () => removePerson(id));
}
function removePerson(id: string) {
const dataRow = complainstStore.rowsAdd;
const updatedRows = dataRow.filter((item: any) => item.id !== id);
success($q,'ลบข้อมูลสำเร็จ')
complainstStore.rowsAdd = updatedRows;
}
onMounted(() => {
getOc();
complainstStore.columns = columns.value;
@ -575,6 +590,7 @@ onMounted(() => {
col.label
}}</span>
</q-th>
<q-th auto-width v-if="formData.status === 'NEW'"></q-th>
</q-tr>
</template>
<template v-slot:body="props">
@ -595,10 +611,29 @@ onMounted(() => {
>
{{ col.value }}
</div>
<div
v-else-if="col.name === 'organization'"
class="table_ellipsis"
>
{{ props.row.organization }}
</div>
<div v-else>
{{ col.value }}
</div>
</q-td>
<q-td auto-width v-if="formData.status === 'NEW'">
<q-btn
size="12px"
flat
round
dense
color="red"
class="q-ml-sm"
icon="mdi-delete-outline"
@click="deletePerson(props.row.id)"
><q-tooltip>ลบผกรองเรยน</q-tooltip></q-btn
>
</q-td>
</q-tr>
</template>
</d-table>
@ -978,6 +1013,7 @@ onMounted(() => {
><q-tooltip>ดาวนโหลดไฟล</q-tooltip></q-btn
>
<q-btn
v-if="formData.status === 'NEW'"
size="12px"
flat
round
@ -991,6 +1027,13 @@ onMounted(() => {
</q-item>
</q-list>
</div>
<div v-if="fileList.length === 0">
<q-card class="bg-grey-4 q-ma-sm q-py-md" bordered>
<p class="text-subtitle1 text-center q-ma-none text-bold">
ไมรายการเอกสาร
</p>
</q-card>
</div>
</q-card>
</div>