จัดโค้ดวินัย

This commit is contained in:
setthawutttty 2023-12-25 16:31:24 +07:00
parent 71d3b54ef0
commit 7262000680
37 changed files with 492 additions and 697 deletions

View file

@ -1,27 +1,17 @@
<script setup lang="ts">
import {
ref,
computed,
watchEffect,
onMounted,
watch,
type PropType,
} from "vue";
import { ref, computed, watchEffect, 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 { useRouter, useRoute } from "vue-router";
import type { DataListRow } from "@/modules/11_discipline/interface/request/result";
import { useRoute } from "vue-router";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
const route = useRoute();
const optionsType = ref<[]>([]);
const idPath = ref<string>(route.params.id as string);
const type = ref<string>("");
const rows = ref<DataListRow[]>([]);
@ -79,8 +69,7 @@ const saveOrder = () => {
}
};
//
const Ordersave = async () => {
// const id = selected.value.map((r) => r.id);
async function Ordersave(){
const persons = selected.value.map((r) => r.id);
if (props.title == "ส่งไปออกคำสั่งลงโทษทางวินัย") {
@ -127,21 +116,18 @@ const emit = defineEmits([
"update:selected",
"update:type",
]);
const updateInput = (value: any) => {
emit("update:filterKeyword2", value);
};
//
const Reset = () => {
function Reset(){
emit("update:filterKeyword2", "");
};
const updateInputType = (value: any) => {
emit("update:type", value);
};
//----()------//
const optionsType = ref<[]>([]);
const fecthTypeOption = async () => {
async function fecthTypeOption(){
showLoader();
await http
.get(config.API.typeOrder())
@ -174,14 +160,13 @@ watchEffect(() => {
if (props.Modal === true) {
selected.value = [];
type.value = "";
// console.log(props.data.status)
if (props.title == "ส่งไปออกคำสั่งลงโทษทางวินัย") {
rows.value = props.data.persons.filter(
(item: any) => item.status !== "REPORT"
);
} else if (props.title == "ส่งไปออกคำสั่งงดโทษ/เพิ่มโทษ") {
rows.value = props.data.persons.filter(
(item: any) => item.status == "REPORT" && item.statusDiscard == 'NEW'
(item: any) => item.status == "REPORT" && item.statusDiscard == "NEW"
);
}
}

View file

@ -28,71 +28,14 @@ const { showLoader, hideLoader, messageError } = mixin;
const router = useRouter();
const route = useRoute();
const id = ref<string>(route.params.id as string);
const titlePopup = ref<string>('')
/**
* นทกขอมลทเเกไข
* @param id ระบ คคล
*/
const onSubmit = async (id: string) => {
console.log("edit");
router.push(`/discipline-result`);
};
const modal = ref<boolean>(false);
const filterKeyword = ref<string>("");
/** ฟังชั่นปิด dialog */
function closeModal() {
modal.value = false;
}
/** ยืนยัน ส่งไปออกคำสั่ง */
function sentIssue(title:string) {
modal.value = true;
titlePopup.value = title
}
const titlePopup = ref<string>("");
const idInvestigate = ref<string>("");
const idComplaint = ref<string>("");
const status = ref<string>("");
const modal = ref<boolean>(false);
const dataResult = ref<DataListRow[]>([]);
/** function เรียกรายละเอียดผลการพิจารณาทางวินัย*/
async function fetchDetailResult() {
showLoader();
await http
.get(config.API.listResultById(id.value))
.then((res) => {
dataResult.value = res.data.result;
status.value = res.data.result.status;
idComplaint.value = res.data.result.idComplaint;
idInvestigate.value = res.data.result.idInvestigate;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
const filterKeyword = ref<string>("");
const dataDisciplinary = ref<object>([]);
/** function เรียกรายละเอียดสอบสวนความผิดทางวินัย*/
async function fetchDetailDisciplinary() {
showLoader();
await http
.get(config.API.disciplineDisciplinaryById(id.value))
.then((res) => {
dataDisciplinary.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
const dataInvestigatefacts = reactive<FormInvestigateFact>({
id: "",
@ -121,8 +64,103 @@ const dataInvestigatefacts = reactive<FormInvestigateFact>({
respondentType: "",
organizationId: "",
persons: [],
investigationExtendHistory:[]
investigationExtendHistory: [],
});
const personObjComplaint = reactive<ArrayPerson>({
id: "",
personId: "",
idcard: "",
name: "",
prefix: "",
firstName: "",
lastName: "",
posNo: "",
position: "",
positionLevel: "",
salary: null,
organization: "",
});
const fileListObjComplaint = reactive<ArrayFileList>({
id: "",
pathName: "",
fileName: "",
});
const dataComplaints = reactive<FormDataComplaint>({
id: "",
respondentType: "",
organizationId: "",
consideredAgency: "",
title: "",
description: "",
dateReceived: null,
dateConsideration: null,
offenseDetails: "",
levelConsideration: "",
dateNotification: null,
complaintFrom: "",
appellant: "",
documentFile: null,
status: "",
persons: [personObjComplaint],
result: "",
disciplineComplaintDocs: [fileListObjComplaint],
});
/** ฟังชั่นปิด dialog */
function closeModal() {
modal.value = false;
}
/**
* นทกขอมลทเเกไข
* @param id ระบ คคล
*/
async function onSubmit() {
router.push(`/discipline-result`);
}
/** ยืนยัน ส่งไปออกคำสั่ง */
function sentIssue(title: string) {
modal.value = true;
titlePopup.value = title;
}
/** function เรียกรายละเอียดผลการพิจารณาทางวินัย*/
async function fetchDetailResult() {
showLoader();
await http
.get(config.API.listResultById(id.value))
.then((res) => {
dataResult.value = res.data.result;
status.value = res.data.result.status;
idComplaint.value = res.data.result.idComplaint;
idInvestigate.value = res.data.result.idInvestigate;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function เรียกรายละเอียดสอบสวนความผิดทางวินัย*/
async function fetchDetailDisciplinary() {
showLoader();
await http
.get(config.API.disciplineDisciplinaryById(id.value))
.then((res) => {
dataDisciplinary.value = res.data.result;
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** function เรียกรายละเอียดสืบสวนข้อเท็จจริง*/
async function fetchDetailInvestigate() {
showLoader();
@ -166,45 +204,6 @@ async function fetchDetailInvestigate() {
});
}
const personObjComplaint = reactive<ArrayPerson>({
id: "",
personId: "",
idcard: "",
name: "",
prefix: "",
firstName: "",
lastName: "",
posNo: "",
position: "",
positionLevel: "",
salary: null,
organization: "",
});
const fileListObjComplaint = reactive<ArrayFileList>({
id: "",
pathName: "",
fileName: "",
});
const dataComplaints = reactive<FormDataComplaint>({
id: "",
respondentType: "",
organizationId: "",
consideredAgency: "",
title: "",
description: "",
dateReceived: null,
dateConsideration: null,
offenseDetails: "",
levelConsideration: "",
dateNotification: null,
complaintFrom: "",
appellant: "",
documentFile: null,
status: "",
persons: [personObjComplaint],
result: "",
disciplineComplaintDocs: [fileListObjComplaint],
});
/** function เรียกรายละเอียดเรื่องร้องเรียน*/
async function fetchDetailComplaints() {
showLoader();
@ -238,12 +237,6 @@ async function fetchDetailComplaints() {
});
}
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
onMounted(async () => {
store.tabMenu = "result";
await fetchDetailResult();
});
watch(
() => store.tabMenu,
async () => {
@ -261,6 +254,12 @@ watch(
fetchFunction && (await fetchFunction());
}
);
/** โหลดข้อมูลเมื่อเข้าหน้านี้ */
onMounted(async () => {
store.tabMenu = "result";
await fetchDetailResult();
});
</script>
<template>
<div class="col-xs-12 col-sm-12 col-md-11">
@ -331,7 +330,6 @@ watch(
</q-tab-panel>
</q-tab-panels>
</q-card>
<!-- <Form :on-submit="onSubmit" :data="data" /> -->
</div>
<DialogSendToCommand

View file

@ -1,12 +1,9 @@
div
<script setup lang="ts">
import { ref, onMounted, reactive, watch } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
// import DialogAddPersonal from "@/components/Dialogs/AddPersonal.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useInvestigateDisStore } from "@/modules/11_discipline/store/InvestigateDisStore";
import { useDisciplineResultStore } from "@/modules/11_discipline/store/ResultStore";
@ -23,12 +20,17 @@ import type {
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,showLoader,dialogRemove } = mixin;
const {
hideLoader,
dialogConfirm,
success,
messageError,
showLoader,
dialogRemove,
} = mixin;
const router = useRouter();
const route = useRoute();
@ -38,6 +40,7 @@ const isSave = ref<boolean>(false); // มีการแก้ไขรอบ
const respondentType = ref<string>("");
const organizationId = ref<string>("");
const consideredAgency = ref<string>("");
const organizationOption = ref<DataOption[]>([]);
/** ตัวแปร ref สำหรับแสดง validate */
const detailRef = ref<Object | null>(null);
@ -57,11 +60,6 @@ const props = defineProps({
},
});
const ArrayFile = reactive<FileArray>({
id: "",
fileName: "",
pathName: "",
});
/** ข้อมูล v-model ของฟอร์ม */
const formData = reactive<FormData>({
resultDescription: "",
@ -78,19 +76,6 @@ const objectdisciplinary: FormRef = {
resultDescription: detailRef,
};
const organizationOption = ref<DataOption[]>([]);
async function addPerson(data: any) {
await mainStore.fetchData(data);
console.log(mainStore.rowsAdd);
toggleModal();
}
function handleSave(returnData: any) {
addPerson(returnData);
toggleModal();
}
/** function เรียกรายชื่อหน่วยงาน*/
async function fetchOrganization() {
await http
@ -171,7 +156,8 @@ watch(
formData.oc = props.data.resultOc;
formData.disciplineType = props.data.resultDisciplineType;
formData.titleType = props.data.resultTitleType;
formData.disciplineDisciplinary_DocResults = props.data.disciplineDisciplinary_DocResults;
formData.disciplineDisciplinary_DocResults =
props.data.disciplineDisciplinary_DocResults;
formData.year = props.data.resultYear ?? 0;
mainStore.rowsAdd = props.data.persons;
await fetchDatadetail();
@ -191,13 +177,6 @@ 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
*/
@ -210,7 +189,6 @@ function uploadFile() {
http
.put(config.API.upLoadFileResult(id.value), Data)
.then((res) => {
console.log(res);
success($q, "อัปโหลดไฟล์สำเร็จ");
props.fetchData();
// router.push(`/discipline/complaints`);
@ -250,8 +228,6 @@ function confirmDelete(docid: string) {
props.fetchData();
});
}
onMounted(async () => {});
</script>
<template>
<div class="row q-col-gutter-sm">
@ -335,19 +311,6 @@ onMounted(async () => {});
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">
@ -375,7 +338,6 @@ onMounted(async () => {});
col.label
}}</span>
</q-th>
<!-- <q-th auto-width></q-th> -->
</q-tr>
</template>
<template v-slot:body="props">
@ -414,20 +376,6 @@ onMounted(async () => {});
{{ 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>
@ -535,15 +483,6 @@ onMounted(async () => {});
>
</div>
</q-card>
<!-- <DialogAddPersonal
title="ผู้ถูกร้องเรียน"
:mainData="mainStore.rowsAdd"
:modal="modalPerson"
btn-title="เพิ่มรายชื่อผู้ถูกร้องเรียน"
:close="toggleModal"
:save="addPerson"
@returnData="handleSave"
/> -->
</form>
</div>
<!-- พโหลดไฟล -->

View file

@ -12,7 +12,7 @@ import type { Pagination } from "@/modules/03_recruiting/interface/index/Main";
const $q = useQuasar(); // show dialog
const router = useRouter();
//search data table
const mixin = useCounterMixin();
const store = useDisciplineResultStore();
const { showLoader, hideLoader, messageError } = mixin;

View file

@ -1,6 +1,5 @@
<script setup lang="ts">
import { ref, useAttrs, watch } from "vue";
import type { Pagination } from "@/modules/04_registry/interface/index/Main";
const table = ref<any>(null);
const filterRef = ref<any>(null);
@ -59,10 +58,6 @@ const emit = defineEmits([
"update:queryString",
]);
function updateInput(value: string | number | null) {
emit("update:inputfilter", value);
}
function updateVisible(value: []) {
emit("update:inputvisible", value);
}
@ -99,19 +94,8 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
<template>
<div class="q-pb-sm row q-col-gutter-sm">
<div class="q-gutter-sm" v-if="nornmalData == true">
<!-- <q-btn
to="/discipline-result/add"
size="12px"
flat
round
color="add"
icon="mdi-plus"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn> -->
</div>
<q-space />
<!-- นหาขอความใน table -->
<q-input
standout
dense
@ -133,7 +117,6 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
/>
</template>
</q-input>
<!-- แสดงคอลมนใน table -->
<q-select
:model-value="inputvisible"
@update:model-value="updateVisible"