Refactoring code module 06_retirement

This commit is contained in:
STW_TTTY\stwtt 2024-09-18 15:18:57 +07:00
parent 1225254062
commit ea921b39b0
29 changed files with 730 additions and 823 deletions

View file

@ -1,21 +1,39 @@
<script setup lang="ts">
import { ref, computed, watchEffect } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
/** use */
const $q = useQuasar();
const selected = ref<ResponseItems[]>([]);
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
/** props*/
const props = defineProps({
modal: Boolean,
closeModal: Function,
fecthlist: Function,
rows2: Array,
filterKeyword2: String,
});
/**
* งกนการ Selected Data
*/
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
/** คอลัมน์ */
const columns2 = ref<QTableProps["columns"]>([
@ -132,41 +150,17 @@ const visibleColumns2 = ref<string[]>([
"statustext",
]);
/** props*/
const props = defineProps({
modal: Boolean,
closeModal: Function,
fecthlist: Function,
rows2: Array,
filterKeyword2: String,
});
//reset
const resetFilter = () => {
filterKeyword.value = "";
filterRef.value.focus();
};
/**
* งกนการ Selected Data
*/
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
//popup
const saveOrder = () => {
/** popup ยืนยันส่งัว */
function saveOrder() {
dialogConfirm(
$q,
() => Ordersave(),
"ยืนยันส่งไปออกคำสั่ง",
"ต้องการยืนยันส่งไปออกคำสั่งใช่หรือไม่?"
);
};
//
const Ordersave = async () => {
}
/** ส่งไปออกคำสั่ง */
async function Ordersave() {
const id = selected.value.map((r) => r.id);
const body = {
id,
@ -185,17 +179,18 @@ const Ordersave = async () => {
props.fecthlist?.();
hideLoader();
});
};
}
const emit = defineEmits(["update:filterKeyword2", "update:selected"]);
const updateInput = (value: any) => {
function updateInput(value: any) {
emit("update:filterKeyword2", value);
};
}
//
const Reset = () => {
/** รีเซ็ตค่าในช่องค้นหา */
function Reset() {
emit("update:filterKeyword2", "");
};
}
watchEffect(() => {
if (props.modal === true) {
selected.value = [];