diff --git a/src/api/18_command/api.command.ts b/src/api/18_command/api.command.ts index 5ac4d9740..9d524ca2b 100644 --- a/src/api/18_command/api.command.ts +++ b/src/api/18_command/api.command.ts @@ -10,5 +10,5 @@ export default { commandAction: (commandId: string, type: string) => `${command}/${type}/${commandId}`, - commandSalaryList:(command:string)=>`${commandSalary}/list&commandSysId=${command}` + commandSalaryList:(command:string)=>`${commandSalary}/list?commandSysId=${command}` }; diff --git a/src/modules/18_command/components/Step/1_Detail.vue b/src/modules/18_command/components/Step/1_Detail.vue index 6bcdc97b3..6fc6b9918 100644 --- a/src/modules/18_command/components/Step/1_Detail.vue +++ b/src/modules/18_command/components/Step/1_Detail.vue @@ -29,10 +29,7 @@ const props = defineProps({ const commandId = ref(route.params.id.toString()); //ID คำสั่ง // ฟอร์มข้อมูล -const formData = reactive({ - id: "", - status: "", - commandTypeName: "", +let formData = reactive({ commandNo: "", commandYear: null, detailHeader: "", @@ -41,7 +38,6 @@ const formData = reactive({ issue: null, commandAffectDate: null, //วันที่ลงนาม commandExcecuteDate: null, //วันที่คำสั่งมีผล - commandSysId: "", // ประเภท คำสั่ง }); const modalPreview = ref(false); //แสดงตัวอย่าง @@ -69,14 +65,16 @@ async function onSubmit() { /** * ทำงานเมื่อ Components ถูกเรียกใช้งาน */ -watch( - () => props.formCommandList, - () => { - const list = props.formCommandList; - console.log("🚀 ~ props.formCommandList:", props.formCommandList) - console.log("🚀 ~ onMounted ~ list:", list); - } -); +onMounted(() => { + formData.commandNo = props.formCommandList.commandNo; + formData.commandYear = props.formCommandList.commandYear; + formData.detailHeader = props.formCommandList.detailHeader; + formData.detailBody = props.formCommandList.detailBody; + formData.detailFooter = props.formCommandList.detailFooter; + formData.issue = props.formCommandList.issue; + formData.commandAffectDate = props.formCommandList.commandAffectDate; + formData.commandExcecuteDate = props.formCommandList.commandExcecuteDate; +}); /** * ฟังก์ชันที่ต้องการนำฟังก์ชันออกไปใช้ใน Components แม่ @@ -90,7 +88,6 @@ defineExpose({
- {{ props.formCommandList }}
("isChangeData", { required: true }); / const props = defineProps({ onCheckChangeData: { type: Function, required: true }, fetchDataCommandList: { type: Function, required: true }, - formCommandList: { type: Object, required: true }, + commandSysId: { type: String, required: true }, }); -const formData = reactive({ - id: "", - status: "", - commandTypeName: "", - commandNo: "", - commandYear: null, - detailHeader: "", - detailBody: "", - detailFooter: "", - issue: null, - commandAffectDate: null, //วันที่ลงนาม - commandExcecuteDate: null, //วันที่คำสั่งมีผล - commandSysId: "", // ประเภท คำสั่ง -}); +const ListCommandSalary = ref([]); const posNoOptions = ref(storePosSalary.optionPos); const templatePos = ref(""); @@ -142,16 +129,20 @@ function filterSelector(val: string, update: Function, filtername: string) { } } -function getCommandSalaryList() { +function getCommandSalaryList(type: string) { + showLoader(); http - .get(config.API.commandSalaryList("PLACEMENT")) + .get(config.API.commandSalaryList(type)) .then((res) => { - console.log(res.data.result); + const data = res.data.result; + ListCommandSalary.value = data; }) .catch((e) => { messageError($q, e); }) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); } function onSubmit() {} @@ -164,11 +155,9 @@ defineExpose({ }); onMounted(() => { - if (props.formCommandList) { - const list = props.formCommandList; - console.log("🚀 ~ onMounted ~ list:", list); + if (props.commandSysId) { + getCommandSalaryList(props.commandSysId); } - getCommandSalaryList(); }); @@ -187,7 +176,7 @@ onMounted(() => { v-model="templatePos" :label="`${'ต้นแบบ (template) ตำแหน่ง'}`" option-label="name" - :options="posNoOptions" + :options="ListCommandSalary" option-value="name" hide-bottom-space emit-value diff --git a/src/modules/18_command/components/Step/4_Attached.vue b/src/modules/18_command/components/Step/4_Attached.vue index 9eb0bbb65..5de06a85d 100644 --- a/src/modules/18_command/components/Step/4_Attached.vue +++ b/src/modules/18_command/components/Step/4_Attached.vue @@ -1,19 +1,369 @@ + + diff --git a/src/modules/18_command/interface/request/Main.ts b/src/modules/18_command/interface/request/Main.ts index d3078342c..631bc9149 100644 --- a/src/modules/18_command/interface/request/Main.ts +++ b/src/modules/18_command/interface/request/Main.ts @@ -12,8 +12,8 @@ interface FormCommand { } interface FormDataDetail { - id: string; - status: string; + id?: string; + status?: string; commandNo: string; commandYear: number | null; detailHeader: string; @@ -22,8 +22,17 @@ interface FormDataDetail { issue: string | null; commandAffectDate: Date | null; commandExcecuteDate: Date | null; - commandSysId: string; - commandTypeName: string; + commandSysId?: string; + commandTypeName?: string; } -export type { FormQuery, FormCommand, FormDataDetail }; +interface ListCommandSalaryType { + id: string; + createdAt: Date|null; + lastUpdatedAt: Date|null; + createdFullName: string; + lastUpdateFullName: string; + name: string; + commandSysId: string; +} +export type { FormQuery, FormCommand, FormDataDetail,ListCommandSalaryType }; diff --git a/src/modules/18_command/views/detail.vue b/src/modules/18_command/views/detail.vue index 9bfbc06d0..aa5d21797 100644 --- a/src/modules/18_command/views/detail.vue +++ b/src/modules/18_command/views/detail.vue @@ -23,6 +23,7 @@ const router = useRouter(); const route = useRoute(); const commandId = ref(route.params.id.toString()); //ID คำสั่ง const store = useCommandDetail(); +const isMomFirst = ref(false); const childDetailRef = ref | null>(null); //ref components รายละเอียดคำสั่ง const childListPersonsRef = ref | null>(null); //ref components รายชื่อผู้ออกคำสั่ง @@ -31,7 +32,7 @@ const childReceivedCopyRef = ref | null>( ); //ref components รายชื่อผู้ได้รับสำเนาคำสั่ง const childAttachedRef = ref | null>(null); //ref components คำสั่งและบัญชีแนบท้าบ -const tabs = ref("Detail"); //Tab +const tabs = ref("Main"); //Tab const readonly = ref(route.name === "commandViewDetailPage"); //อ่านได้อย่างเดียว const isChangeData = ref(false); //การเปลี่ยนแปลงของข้อมูล //รายการ Tab ละเอียดคำสั่ง @@ -49,7 +50,7 @@ const tabsManu = ref([ { label: "พรีวิวคำสั่ง", name: "Attached" }, ]); -const formCommandList = reactive({ +let formCommandList = reactive({ id: "", status: "", commandTypeName: "", @@ -84,19 +85,7 @@ async function fetchDataCommandList() { .get(config.API.commandAction(commandId.value, "tab1")) .then(async (res) => { const data = await res.data.result; - formCommandList.id = data.id; - formCommandList.status = data.status; - formCommandList.commandTypeName = data.commandTypeName; - formCommandList.commandNo = data.commandNo; - formCommandList.commandYear = data.commandYear; - formCommandList.detailHeader = data.detailHeader; - formCommandList.detailBody = data.detailBody; - formCommandList.detailFooter = data.detailFooter; - formCommandList.issue = data.issue; - formCommandList.commandAffectDate = data.commandAffectDate; - formCommandList.commandExcecuteDate = data.commandExcecuteDate; - formCommandList.commandSysId = data.commandSysId; - + formCommandList = data; isChangeData.value = false; }) .catch((err) => { @@ -204,7 +193,7 @@ onMounted(async () => { ref="childListPersonsRef" v-model:is-change-data="isChangeData" :on-check-change-data="onCheckChangeData" - :form-command-list="formCommandList" + :command-sys-id="formCommandList.commandSysId as string" :fetch-data-command-list="fetchDataCommandList" />