diff --git a/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue b/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue index 443217e45..d83017e3f 100644 --- a/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue +++ b/src/modules/06_retirement/components/02_resign/DialogSendToCommand.vue @@ -5,10 +5,12 @@ import { useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; import { useRetirementDataStore } from "@/modules/06_retirement/store/Main"; import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow"; +import { useCommandMainStore } from "@/modules/18_command/store/Main"; import type { PropType } from "vue"; import type { QTableProps } from "quasar"; import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main"; +import type { ListCommand } from "@/modules/18_command/interface/index/Main"; import DialogHeader from "@/components/DialogHeader.vue"; import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue"; @@ -16,6 +18,7 @@ import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCom /** use */ const $q = useQuasar(); const stroe = useRetirementDataStore(); +const storeCommand = useCommandMainStore(); const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore(); const { statusText } = stroe; const selected = ref([]); @@ -47,6 +50,10 @@ const props = defineProps({ cancel: { type: Boolean, default: false }, }); +const commandType = ref(""); +const commandMainOp = ref([]); //ข้อมูลรายการคำสั่ง +const commandOp = ref([]); //ตัวเลือกคำสั่ง + //Table const filterKeyword = defineModel("filterKeyword", { required: true }); const rowsData = ref([]); @@ -169,6 +176,11 @@ const visibleColumns = ref([ ]); const modalCommand = ref(false); +const isDisable = computed(() => { + return props.mainTabs === "1" + ? selected.value.length === 0 || commandType.value === "" + : selected.value.length === 0; +}); /** popup ยืนยันส่งัว */ function saveOrder() { @@ -210,6 +222,19 @@ async function fetchCheckOfficer() { } } +/** + * ฟิลเตอร์ คำสั่ง + * @param val ค่าจาก Input + * @param update Funtion quasar + */ +function filterSelector(val: string, update: Function) { + update(() => { + commandOp.value = commandMainOp.value.filter( + (v: ListCommand) => v.name.indexOf(val) > -1 + ); + }); +} + watch( () => props.modal, async (val) => { @@ -231,6 +256,11 @@ watch( rowsData.value = data ? data : []; rowsDataMain.value = data ? data : []; + commandType.value = ""; + const dataCommandTypes = await storeCommand.getCommandTypes(); + commandMainOp.value = dataCommandTypes.filter( + (e: ListCommand) => e.code === "C-PM-17" || e.code === "C-PM-48" + ); } else { rowsData.value = []; rowsDataMain.value = []; @@ -238,6 +268,7 @@ watch( } ); +