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

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

@ -3,7 +3,6 @@ import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import Form from '@/modules/11_discipline/components/6_BasicInformation/Channel/Form.vue'
@ -23,24 +22,11 @@ const {
success,
dialogMessageNotify,
} = mixin;
const router = useRouter();
const route = useRoute();
//form data input
const edit = ref<boolean>(false);
/**
* เรยกขอมลจากรายการ
*/
onMounted(async () => {});
const fetchData = async () => {};
/**
* ลบขอม
* @param id ไอดของขอมลทองการลบ
*/
const deleteData = async (id: string) => {};
/* บันทึกข้อมูล**/
function onSubmit(channelReturn:string){
dialogConfirm($q,()=>saveData(channelReturn))
@ -67,7 +53,7 @@ function saveData(channelReturn:string){
/**
* อนกลบหนารายการ
*/
const clickBack = () => {
function clickBack(){
router.push(`/discipline/channel`);
};
</script>

View file

@ -15,13 +15,6 @@ const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader, dialogConfirm, success } = mixin;
/**
* เรยกใชงาน fetchData เพอดงขอม
*/
onMounted(() => {
fetchData();
});
/**
* get อมลเกากรณแกไขขอม
*/
@ -71,6 +64,13 @@ function putData(type: string) {
router.push(`/discipline/channel`);
});
}
/**
* เรยกใชงาน fetchData เพอดงขอม
*/
onMounted(() => {
fetchData();
});
</script>
<template>
<div class="col-xs-12 col-sm-12 col-md-11">

View file

@ -1,6 +1,5 @@
<script setup lang="ts">
import { ref, useAttrs, onMounted } from "vue";
import type { QTableProps } from "quasar";
import router from "@/router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
@ -39,7 +38,7 @@ const pagination = ref({
/**
* clickไปหนาเพมchanel
*/
const clickAdd = () => {
function clickAdd(){
dataStore.getType('')
router.push(`/discipline/channel/add`);
};

View file

@ -15,13 +15,6 @@ const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader, dialogConfirm, success } = mixin;
/**
* เรยกใชงาน fetchData เพอดงขอม
*/
onMounted(() => {
fetchData();
});
/**
* get อมลเกากรณแกไขขอม
*/
@ -38,7 +31,7 @@ const data = reactive<FormData>({
/**
* งคาจาก api
*/
const fetchData = async () => {
async function fetchData(){
showLoader();
await http
.get(config.API.directorbyId(personalId.value))
@ -89,6 +82,13 @@ function putData(formData: FormData) {
router.push(`/discipline/director`);
});
}
/**
* เรยกใชงาน fetchData เพอดงขอม
*/
onMounted(() => {
fetchData();
});
</script>
<template>
<div class="col-xs-12 col-sm-12 col-md-11">

View file

@ -70,10 +70,28 @@ watch(props.data, async () => {
});
/**
* ตรวจสอบขอมลกอนสงไปย api
*/
const prefixRef = ref<object | null>(null);
const firstnameRef = ref<object | null>(null);
const lastnameRef = ref<object | null>(null);
const positionRef = ref<object | null>(null);
const phoneRef = ref<object | null>(null);
const emailRef = ref<object | null>(null);
const formRef: FormRef = {
prefix: prefixRef,
firstname: firstnameRef,
lastname: lastnameRef,
position: positionRef,
phone: phoneRef,
email: emailRef,
};
/**
* เพมบคลากร
*/
function addEmployee() {
function addEmployee() {
if (idCard.value.length === 13) {
console.log("idCard===>", idCard.value);
showLoader();
@ -111,24 +129,6 @@ function addEmployee() {
}
}
/**
* ตรวจสอบขอมลกอนสงไปย api
*/
const prefixRef = ref<object | null>(null);
const firstnameRef = ref<object | null>(null);
const lastnameRef = ref<object | null>(null);
const positionRef = ref<object | null>(null);
const phoneRef = ref<object | null>(null);
const emailRef = ref<object | null>(null);
const formRef: FormRef = {
prefix: prefixRef,
firstname: firstnameRef,
lastname: lastnameRef,
position: positionRef,
phone: phoneRef,
email: emailRef,
};
/** ฟังชั่นตรวจสอบความถูกต้องก่อน บันทึก */
function onValidate() {
const hasError = [];

View file

@ -1,7 +1,5 @@
<script setup lang="ts">
import { ref, useAttrs, onMounted, watch } from "vue";
import type { QTableProps } from "quasar";
import router from "@/router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useDisciplineDirectorDataStore } from "@/modules/11_discipline/store/DirectorStore";
@ -11,20 +9,19 @@ import http from "@/plugins/http";
const $q = useQuasar();
const dataStore = useDisciplineDirectorDataStore();
const mixin = useCounterMixin();
const {
messageError,
showLoader,
hideLoader,
dialogConfirm,
dialogRemove,
success,
} = mixin;
const { messageError, showLoader, hideLoader, dialogRemove, success } = mixin;
const currentPage = ref<number>(1);
const maxPage = ref<number>(1);
const page = ref<number>(1);
const rowsPerPage = ref<number>(10);
/**
* นหาในตาราง
*/
const filterKeyword = ref<string>("");
const filterRef = ref<HTMLInputElement | null>(null);
/**
*pagination ของตาราง
*/
@ -34,16 +31,22 @@ const pagination = ref({
rowsPerPage: rowsPerPage.value,
});
watch(() => currentPage.value,() => {
rowsPerPage.value = pagination.value.rowsPerPage;
getList();
});
watch(
() => currentPage.value,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
getList();
}
);
watch(()=>pagination.value.rowsPerPage,()=>{
rowsPerPage.value = pagination.value.rowsPerPage;
currentPage.value = 1
getList();
})
watch(
() => pagination.value.rowsPerPage,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
currentPage.value = 1;
getList();
}
);
async function getList() {
showLoader();
await http
@ -56,7 +59,7 @@ async function getList() {
)
.then((res) => {
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
const data = res.data.result.data
const data = res.data.result.data;
dataStore.fetchData(data);
})
.catch((e) => {
@ -94,19 +97,6 @@ async function deleteData(id: string) {
});
}
/**
* งขอมลจำลองไปย store
*/
onMounted(() => {
getList();
// get store
});
/**
* นหาในตาราง
*/
const filterKeyword = ref<string>("");
const filterRef = ref<HTMLInputElement | null>(null);
function resetFilter() {
filterKeyword.value = "";
if (filterRef.value) {
@ -114,10 +104,18 @@ function resetFilter() {
}
}
function filterFn(){
getList()
console.log('enter',filterKeyword.value)
function filterFn() {
getList();
console.log("enter", filterKeyword.value);
}
/**
* งขอมลจำลองไปย store
*/
onMounted(() => {
getList();
// get store
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">