Refactoring code module 11_discipline

This commit is contained in:
STW_TTTY\stwtt 2024-09-19 16:37:16 +07:00
parent 202fbf27b6
commit 9653ae78cb
58 changed files with 1021 additions and 1305 deletions

View file

@ -1,27 +1,30 @@
<script setup lang="ts">
import { ref, useAttrs, onMounted } from "vue";
import { ref, onMounted } from "vue";
import router from "@/router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useDisciplineChannelDataStore } from "@/modules/11_discipline/store/ChannelStore";
import config from "@/app.config";
import http from "@/plugins/http";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useDisciplineChannelDataStore } from "@/modules/11_discipline/store/ChannelStore";
import type { typeItem } from "@/modules/11_discipline/interface/response/channel";
import { checkPermission } from "@/utils/permissions";
import Header from "@/components/DialogHeader.vue";
const $q = useQuasar(); // noti quasar
const dataStore = useDisciplineChannelDataStore();
const mixin = useCounterMixin();
const { dialogRemove, showLoader, messageError, hideLoader, success } = mixin;
const modal = ref<boolean>(false);
const isEdit = ref<boolean>(false);
const isRead = ref<boolean>(false);
const isId = ref<string>("");
const channel = ref<string>("");
const dataStore = useDisciplineChannelDataStore();
const mixin = useCounterMixin();
const { dialogRemove, showLoader, messageError, hideLoader, success } = mixin;
const $q = useQuasar(); // noti quasar
/**
* นหาในตาราง
*/
@ -38,7 +41,6 @@ const resetFilter = () => {
*pagination ของตาราง
*/
const pagination = ref({
// sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
@ -114,15 +116,7 @@ async function deleteData(id: string) {
});
}
/**
* ไปหน แกไข
* @param id type
*/
function editPage(data: typeItem) {
dataStore.getType(data.name);
router.push(`/discipline/channel/${data.id}`);
}
/** ปิด popup */
function closeDialog() {
modal.value = false;
channel.value = "";
@ -130,6 +124,7 @@ function closeDialog() {
isRead.value = false;
}
/** class input */
function inputEdit(val: boolean) {
return {
"full-width cursor-pointer ": val,
@ -137,6 +132,7 @@ function inputEdit(val: boolean) {
};
}
/** บันทึกช่องทางการร้องเรียน */
function onSubmit() {
const url = isEdit.value
? config.API.complaintChannelbyId(isId.value)