แก้ไขผลการพิจารณาทางวินัย

This commit is contained in:
setthawutttty 2023-12-01 15:44:16 +07:00
parent d1f0d753ba
commit 5a28025906
6 changed files with 361 additions and 193 deletions

View file

@ -72,4 +72,6 @@ export default {
suspendById: (id: string) => `${suspend}/${id}`,
suspendReport: () => `${suspend}/report`,
reportresult:(id:string)=>`${disciplineMain}/result/report/${id}`,
};

View file

@ -1,10 +1,21 @@
<script setup lang="ts">
import { ref, computed, watchEffect, onMounted, watch } from "vue";
import {
ref,
computed,
watchEffect,
onMounted,
watch,
type PropType,
} from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponseData } from "@/modules/05_placement/interface/response/Transfer";
import type { OpType } from "@/modules/05_placement/interface/response/Main";
import type {
DataListRow,
personType,
} from "@/modules/11_discipline/interface/request/result";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http";
@ -13,113 +24,23 @@ import config from "@/app.config";
const $q = useQuasar();
const selected = ref<ResponseData[]>([]);
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
const { showLoader, success, messageError, dialogConfirm, hideLoader,dialogMessageNotify } = mixin;
//
const visibleColumns2 = ref<string[]>([
"no",
"fullname",
"position",
"positionLevel",
"organizationPositionOld",
"organization",
"statustext",
"dateText",
]);
const columns2 = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "fullname",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "position",
align: "left",
label: "ตำแหน่งในสายงาน",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "positionLevel",
align: "left",
label: "ระดับ",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "organizationPositionOld",
align: "left",
label: "สังกัด",
sortable: true,
field: "organizationPositionOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "organization",
align: "left",
label: "หน่วยงานที่ขอโอนไป",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
{
name: "dateText",
align: "left",
label: "วันที่ดำเนินการ",
sortable: true,
field: "dateText",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
sortOrder: "da",
},
{
name: "statustext",
align: "left",
label: "สถานะ",
sortable: true,
field: "statustext",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
sort: (a: string, b: string) =>
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
},
]);
const props = defineProps({
data:Array,
data: {
type: Object,
require: true,
default: [],
},
columns: {
type: Array,
default: [],
},
visibleColumns: {
type: Array,
default: [],
},
Modal: Boolean,
closeModal: Function,
getData: Function,
@ -137,12 +58,16 @@ const checkSelected = computed(() => {
//popup
const saveOrder = () => {
dialogConfirm(
$q,
() => Ordersave(),
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
);
if(props.type){
dialogConfirm(
$q,
() => Ordersave(),
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
);
}else{
dialogMessageNotify($q,'กรุณาเลือกประเภทคำสั่ง')
}
};
//
const Ordersave = async () => {
@ -150,10 +75,10 @@ const Ordersave = async () => {
const body = {
id,
};
console.log(body)
showLoader();
await http
.post(config.API.transferReport, body)
.put(config.API.reportresult(props.type as string), body)
.then((res: any) => {
success($q, "ส่งไปออกคำสั่งสำเร็จ");
props.closeModal?.();
@ -193,7 +118,9 @@ const fecthTypeOption = async () => {
.then((res) => {
optionsType.value = res.data.result.filter(
(e: OpType) =>
e.commandCode === "C-PM-26" || e.commandCode === "C-PM-27" || e.commandCode === "C-PM-28"
e.commandCode === "C-PM-26" ||
e.commandCode === "C-PM-27" ||
e.commandCode === "C-PM-28"
);
})
.catch((e) => {
@ -207,18 +134,12 @@ const fecthTypeOption = async () => {
watchEffect(() => {
if (props.Modal === true) {
selected.value = [];
// rows2.value = props.data.persons
}
});
watch(()=>props.data,()=>{
if(props.data){
const data = props.data.persons
console.log(data)
}
})
onMounted(async () => {
await fecthTypeOption();
});
</script>
<template>
@ -277,7 +198,7 @@ onMounted(async () => {
</template>
</q-input>
<q-select
v-model="visibleColumns2"
v-model="props.visibleColumns"
multiple
outlined
dense
@ -285,7 +206,7 @@ onMounted(async () => {
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns2"
:options="props.columns"
option-value="name"
options-cover
style="min-width: 150px"
@ -296,11 +217,11 @@ onMounted(async () => {
</div>
<d-table
:columns="columns2"
:rows="rows2"
:columns="props.columns"
:rows="props.data.persons"
:filter="filterKeyword2"
row-key="id"
:visible-columns="visibleColumns2"
:visible-columns="props.visibleColumns"
selection="multiple"
v-model:selected="selected"
>
@ -312,7 +233,6 @@ onMounted(async () => {
v-model="scope.selected"
/>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td>
@ -323,33 +243,19 @@ onMounted(async () => {
v-model="props.selected"
/>
</q-td>
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="fullname" :props="props">
{{ props.row.fullname }}
</q-td>
<q-td key="position" :props="props">
{{ props.row.position }}
</q-td>
<q-td key="positionLevel" :props="props">
{{ props.row.positionLevel }}
</q-td>
<q-td key="organizationPositionOld" :props="props">
<div class="table_ellipsis">
{{ props.row.organizationPositionOld }}
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
</q-td>
<q-td key="organization" :props="props">
<div class="table_ellipsis">
<div
v-else-if="col.name === 'organization'"
class="table_ellipsis"
>
{{ props.row.organization }}
</div>
</q-td>
<q-td key="dateText" :props="props">
{{ props.row.dateText }}
</q-td>
<q-td key="statustext" :props="props">
{{ props.row.statustext }}
<div v-else>
{{ col.value }}
</div>
</q-td>
</q-tr>
</template>

View file

@ -6,7 +6,7 @@ import FormComplaints from "@/modules/11_discipline/components/1_Complaint/Form.
import FormInvestigatefacts from "@/modules/11_discipline/components/2_InvestigateFacts/Form.vue"; //
import FormDisciplinary from "@/modules/11_discipline/components/3_InvestigateDisciplinary/Form.vue"; //
import FormResult from "@/modules/11_discipline/components/4_Result/Form.vue"; //
import type { FormData } from "@/modules/11_discipline/interface/request/result";
import type { DataListRow } from "@/modules/11_discipline/interface/request/result";
import type {
FormData as FormDataComplaint,
ArrayPerson,
@ -18,7 +18,9 @@ import { useCounterMixin } from "@/stores/mixin";
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
import { useQuasar } from "quasar";
import DialogSendToCommand from "@/modules/11_discipline/components/4_Result/DialogSendToCommand.vue";
import { useDisciplineMainStore } from "@/modules/11_discipline/store";
const mainStore = useDisciplineMainStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const store = useDisciplineResultStore();
@ -28,7 +30,6 @@ const route = useRoute();
const id = ref<string>(route.params.id as string);
const type = ref<string>("");
/**
* นทกขอมลทเเกไข
* @param id ระบ คคล
@ -60,7 +61,7 @@ function sentIssue() {
// );
}
const dataResult = ref<Object[]>([]);
const dataResult = ref<DataListRow[]>([]);
/** function เรียกรายละเอียดผลการพิจารณาทางวินัย*/
async function fetchDetailResult() {
showLoader();
@ -322,6 +323,8 @@ watch(
v-model:Modal="modal"
:closeModal="closeModal"
:rows2="[]"
:columns="mainStore.columnsDirector"
:visibleColumns="mainStore.visibleColumnsDirector"
:data="dataResult"
v-model:filterKeyword2="filterKeyword"
:getData="getData"

View file

@ -1,4 +1,4 @@
<script setup lang="ts">
div<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
@ -7,15 +7,23 @@ import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore";
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
import { useDisciplineMainStore } from "@/modules/11_discipline/store";
import type {
FormData,
FormRef,
DataOption,
DataOptionRes,
} from "@/modules/11_discipline/interface/request/result";
const mainStore = useDisciplineMainStore();
const modalPerson = ref<boolean>(false);
const toggleModal = () => (modalPerson.value = !modalPerson.value);
const investigateDis = useInvestigateDisStore();
const { fecthDirector } = investigateDis;
const isReadonly = ref<boolean>(false); //
const dataStore = useDisciplineResultStore();
const mixin = useCounterMixin();
const { date2Thai, hideLoader, dialogConfirm, success, messageError } = mixin;
const router = useRouter();
@ -23,7 +31,10 @@ const route = useRoute();
const $q = useQuasar();
const id = ref<string>(route.params.id as string);
const isSave = ref<boolean>(false); //
const respondentType = ref<string>("");
const organizationId = ref<string>("");
const consideredAgency = ref<string>("");
/** ตัวแปร ref สำหรับแสดง validate */
const detailRef = ref<Object | null>(null);
@ -53,6 +64,28 @@ const objectdisciplinary: FormRef = {
resultDescription: detailRef,
};
const organizationOption = ref<DataOption[]>([]);
/** function เรียกรายชื่อหน่วยงาน*/
async function fetchOrganization() {
await http
.get(config.API.typeOc())
.then((res) => {
const data = res.data.result;
organizationOption.value = data.map((e: DataOptionRes) => ({
id: e.organizationId,
name: e.organizationName,
}));
})
.catch((err) => {
messageError($q, err);
});
}
async function selectComplainant(val: string) {
organizationId.value = "";
consideredAgency.value = "";
}
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
function validateForm() {
const hasError = [];
@ -109,51 +142,224 @@ async function fetchDatadetail() {
watch(
() => props.data,
async () => {
console.log(props.data);
respondentType.value = props.data.respondentType;
mainStore.rowsAdd = props.data.persons
await fetchDatadetail();
await fetchOrganization();
}
);
/** ฟังก์ชั่นเช็คการแก้ไขฟอร์มแล้วไม่ได้กดบันทึก */
function changeFormData() {
isSave.value = true;
}
function deletePerson(id: string) {
changeFormData();
const dataRow = mainStore.rowsAdd;
const updatedRows = dataRow.filter((item: any) => item.id !== id);
mainStore.rowsAdd = updatedRows;
}
/**
* งขอมลจำลองไปย store
*/
onMounted(async () => {});
</script>
<template>
<div class="col-xs-12 col-sm-12 col-md-11">
<form @submit.prevent="validateForm">
<div class="col-12">
<q-card>
<div class="col-12 row q-pa-md">
<div class="col-12 row q-col-gutter-md">
<q-input
type="textarea"
class="col-12"
dense
outlined
ref="detailRef"
v-model="formData.resultDescription"
for="#detail"
label="สรุปผลการพิจารณา"
hide-bottom-space
:rules="[(val) => !!val || `${'กรุณากรอกกรณีมีความผิด'}`]"
lazy-rules
/>
</div>
</div>
<q-separator />
<div class="row col-12 q-pa-sm">
<q-space />
<q-btn
for="ButtonOnSubmit"
id="formSubmit"
color="secondary"
label="บันทึก"
type="submit"
><q-tooltip>บทกขอม</q-tooltip></q-btn
<form @submit.prevent="validateForm">
<q-card>
<div class="q-pa-md">
<div class="row col-12 q-gutter-sm">
<div class="col-xs-12 col-sm-2">
<q-select
for="SelectrespondentType"
v-model="respondentType"
ref="respondentTypeRef"
dense
outlined
label="ผู้ถูกร้องเรียน"
option-value="id"
option-label="name"
emit-value
use-input
map-options
hide-bottom-space
:options="dataStore.complainantoptions"
:rules="[(val) => !!val || `${'กรุณาเลือกผู้ร้องเรียน'}`]"
lazy-rules
@update:model-value="selectComplainant(respondentType)"
@filter="(inputValue: any,
doneFn: Function) => dataStore.filterSelector(inputValue, doneFn, 'filterrespondentType'
)"
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
</div>
</q-card>
<div
class="col-xs-12 col-sm-3"
v-if="respondentType === 'ORGANIZATION'"
id="organizationId"
>
<q-select
for="inputOffice"
name="organizationId"
ref="organizationIdRef"
dense
hide-bottom-space
outlined
option-label="name"
option-value="id"
emit-value
map-options
v-model="organizationId"
:options="organizationOption"
label="เลือกสำนักงาน"
:rules="[(val) => !!val || `${'กรุณาเลือกสำนักงาน'}`]"
lazy-rules
/>
</div>
<div class="row col-12" v-if="respondentType === 'PERSON'">
<q-card
bordered
class="row col-12"
style="border: 1px solid #d6dee1"
>
<div
class="col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
>
กรองเรยน
<q-btn
v-if="!isReadonly"
size="12px"
flat
round
dense
color="add"
class="q-ml-sm"
@click="toggleModal"
icon="mdi-plus"
>
<q-tooltip>เพมผกรองเรยน</q-tooltip>
</q-btn>
</div>
<div class="col-12"><q-separator /></div>
<div class="col-xs-12 q-pa-sm">
<d-table
ref="table"
:columns="mainStore.columnsRespondent"
:rows="mainStore.rowsAdd"
row-key="idcard"
flat
bordered
:paging="true"
dense
class="custom-header-table"
:visible-columns="mainStore.visibleColumnsRespondent"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th
v-for="col in props.cols"
:key="col.name"
:props="props"
style="color: #000000; font-weight: 500"
>
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width></q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'info'">
<q-btn
size="14px"
flat
round
dense
color="info"
icon="info"
@click="
router.push(`/registry/${props.row.personId}`)
"
><q-tooltip
>อมลในทะเบยนประว</q-tooltip
></q-btn
>
</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>
<q-btn
v-if="!isReadonly"
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>
</div>
</q-card>
</div>
<q-input
type="textarea"
class="col-12"
dense
outlined
ref="detailRef"
v-model="formData.resultDescription"
for="#detail"
label="สรุปผลการพิจารณา"
hide-bottom-space
:rules="[(val) => !!val || `${'กรุณากรอกกรณีมีความผิด'}`]"
lazy-rules
/>
</div>
</div>
</form>
</div>
<q-separator />
<div class="row col-12 q-pa-sm">
<q-space />
<q-btn
for="ButtonOnSubmit"
id="formSubmit"
color="secondary"
label="บันทึก"
type="submit"
><q-tooltip>บทกขอม</q-tooltip></q-btn
>
</div>
</q-card>
</form>
</template>

View file

@ -7,4 +7,36 @@ interface FormRef {
[key: string]: any;
}
export type { FormData, FormRef };
interface DataOption {
id: string;
name: string;
}
interface DataOptionRes {
organizationId: string;
organizationName: string;
}
interface DataListRow {
id: string
idInvestigate: string
idComplaint: string
respondentType: string
persons: PersonType
organizationId: string
resultDescription: string
}
interface PersonType{
id: string
idcard: string
name: string
prefix: string
firstName: string
lastName: string
position: string
positionLevel: string
salary: number
personId: string
posNo: string
organization: string
}
export type { FormData, FormRef,DataOption,DataOptionRes,personType,DataListRow};

View file

@ -10,9 +10,10 @@ import type {
DataResult,
DataResultList,
} from "@/modules/11_discipline/interface/response/result";
import { useCounterMixin } from "@/stores/mixin";
import { useDisciplineMainStore } from "@/modules/11_discipline/store";
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
const storeMain = useDisciplineMainStore();
const { date2Thai } = mixin;
@ -25,6 +26,21 @@ export const useDisciplineResultStore = defineStore(
const rows2 = ref<directorType[]>([]);
const selected = ref<directorType[]>([]);
const complainantoptions = ref<DataOption[]>(
storeMain.complainantoptionsMain
);
function filterSelector(val: string, update: Function, type: string) {
update(() => {
const needle = val.toLowerCase();
if (type === "filterrespondentType") {
complainantoptions.value = storeMain.complainantoptionsMain.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
}
async function fetchList(data: DataResult[]) {
const datalist: DataResultList[] = data.map((e: DataResult) => ({
id: e.id,
@ -47,6 +63,7 @@ export const useDisciplineResultStore = defineStore(
rows.value = datalist;
}
async function fecthDirector(data: directorType[]) {
let datalistDirector: directorType[] = data.map((e: directorType) => ({
nameDirector: e.nameDirector,
@ -239,6 +256,8 @@ export const useDisciplineResultStore = defineStore(
columns,
visibleColumnsDirector,
columnsDirector,
complainantoptions,
filterSelector
};
}
);