feat(resign): add commandType C-PM-48

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-06-11 14:02:11 +07:00
parent baadd296cb
commit f6f2c18d0f

View file

@ -5,10 +5,12 @@ import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useRetirementDataStore } from "@/modules/06_retirement/store/Main"; import { useRetirementDataStore } from "@/modules/06_retirement/store/Main";
import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow"; import { useRoleWorkflowDataStore } from "@/stores/roleWorkflow";
import { useCommandMainStore } from "@/modules/18_command/store/Main";
import type { PropType } from "vue"; import type { PropType } from "vue";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main"; 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 DialogHeader from "@/components/DialogHeader.vue";
import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue"; import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCommand.vue";
@ -16,6 +18,7 @@ import DialogCreateCommand from "@/modules/18_command/components/DialogCreateCom
/** use */ /** use */
const $q = useQuasar(); const $q = useQuasar();
const stroe = useRetirementDataStore(); const stroe = useRetirementDataStore();
const storeCommand = useCommandMainStore();
const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore(); const { fetchDataCheckIsoffice } = useRoleWorkflowDataStore();
const { statusText } = stroe; const { statusText } = stroe;
const selected = ref<ResponseItems[]>([]); const selected = ref<ResponseItems[]>([]);
@ -47,6 +50,10 @@ const props = defineProps({
cancel: { type: Boolean, default: false }, cancel: { type: Boolean, default: false },
}); });
const commandType = ref<string>("");
const commandMainOp = ref<ListCommand[]>([]); //
const commandOp = ref<ListCommand[]>([]); //
//Table //Table
const filterKeyword = defineModel<string>("filterKeyword", { required: true }); const filterKeyword = defineModel<string>("filterKeyword", { required: true });
const rowsData = ref<ResponseItems[]>([]); const rowsData = ref<ResponseItems[]>([]);
@ -169,6 +176,11 @@ const visibleColumns = ref<string[]>([
]); ]);
const modalCommand = ref<boolean>(false); const modalCommand = ref<boolean>(false);
const isDisable = computed(() => {
return props.mainTabs === "1"
? selected.value.length === 0 || commandType.value === ""
: selected.value.length === 0;
});
/** popup ยืนยันส่งัว */ /** popup ยืนยันส่งัว */
function saveOrder() { 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( watch(
() => props.modal, () => props.modal,
async (val) => { async (val) => {
@ -231,6 +256,11 @@ watch(
rowsData.value = data ? data : []; rowsData.value = data ? data : [];
rowsDataMain.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 { } else {
rowsData.value = []; rowsData.value = [];
rowsDataMain.value = []; rowsDataMain.value = [];
@ -238,6 +268,7 @@ watch(
} }
); );
</script> </script>
<template> <template>
<q-dialog v-model="props.modal" persistent> <q-dialog v-model="props.modal" persistent>
<q-card style="min-width: 85%"> <q-card style="min-width: 85%">
@ -249,6 +280,33 @@ watch(
<q-card-section> <q-card-section>
<div class="row col-12 q-col-gutter-sm"> <div class="row col-12 q-col-gutter-sm">
<div class="col-12 row"> <div class="col-12 row">
<q-select
v-if="props.mainTabs === '1'"
v-model="commandType"
dense
outlined
label="ประเภทคำสั่ง"
:options="commandOp"
option-label="name"
option-value="code"
emit-value
map-options
use-input
hide-selected
fill-input
@update:model-value="onSearch"
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn
) "
>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey">
ไมอม
</q-item-section>
</q-item>
</template>
</q-select>
<q-space /> <q-space />
<q-input <q-input
borderless borderless
@ -332,7 +390,7 @@ watch(
<q-btn <q-btn
label="ส่งไปออกคำสั่ง" label="ส่งไปออกคำสั่ง"
@click="saveOrder" @click="saveOrder"
:disable="selected.length === 0" :disable="isDisable"
color="public" color="public"
/> />
</q-card-actions> </q-card-actions>
@ -341,7 +399,7 @@ watch(
<DialogCreateCommand <DialogCreateCommand
v-model:modal="modalCommand" v-model:modal="modalCommand"
:command-type-code="props.mainTabs === '1' ? 'C-PM-17' : 'C-PM-41'" :command-type-code="props.mainTabs === '1' ? commandType : 'C-PM-41'"
:persons="dataMapToSend" :persons="dataMapToSend"
:fetch-data="props.fecthList" :fetch-data="props.fecthList"
/> />