ผูก API ตั้งเวลาเผยแพร่โครงสร้าง
This commit is contained in:
parent
33ec68c868
commit
164240da3e
2 changed files with 31 additions and 5 deletions
|
|
@ -9,5 +9,6 @@ export default {
|
|||
createOrgLevel: (type: string) => `${organization}/${type}`,
|
||||
orgLevelByid: (type: string, id: string) => `${organization}/${type}/${id}`,
|
||||
|
||||
orgSetDateTime:(id:string) => `${organization}/set/publish/${id}`,
|
||||
organizationHistoryNew: `${organization}/history`,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,22 +1,26 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { ref,watch } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import DialogHeader from "@/components/DialogHeader.vue";
|
||||
import type { FormDateTimeRef } from "@/modules/02_organizationalNew/interface/index/Main";
|
||||
import { useOrganizational } from "@/modules/02_organizationalNew/store/organizational";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
const props = defineProps({
|
||||
modal: Boolean,
|
||||
close: Function,
|
||||
});
|
||||
|
||||
const store = useOrganizational()
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const { dialogConfirm, date2Thai } = mixin;
|
||||
const { dialogConfirm, date2Thai,showLoader,hideLoader,messageError,success } = mixin;
|
||||
|
||||
const dateTimeRef = ref<Object | null>(null);
|
||||
|
||||
const dateTime = ref<Date>();
|
||||
const dateTime = ref<Date|null>();
|
||||
|
||||
/** maping ref เข้าตัวแปรเพื่อเตรียมตรวจสอบ */
|
||||
const objectRef: FormDateTimeRef = {
|
||||
|
|
@ -44,16 +48,37 @@ function validateForm() {
|
|||
/** ฟังชั่น บันทึก */
|
||||
function onSubmit() {
|
||||
dialogConfirm($q, () => {
|
||||
console.log(dateTime.value);
|
||||
|
||||
showLoader()
|
||||
http
|
||||
.put(config.API.orgSetDateTime(store.draftId as string),{
|
||||
orgPublishDate:dateTime.value,
|
||||
})
|
||||
.then((res)=>{
|
||||
props.close?.()
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((e)=>{
|
||||
messageError($q,e)
|
||||
})
|
||||
.finally(()=>{
|
||||
hideLoader()
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
watch(()=>props.modal,()=>{
|
||||
if(props.modal === true){
|
||||
dateTime.value = null
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<template>
|
||||
<q-dialog v-model="props.modal" persistent>
|
||||
<q-card style="min-width: 10vw">
|
||||
<form @submit.prevent="validateForm">
|
||||
<DialogHeader :tittle="`ตั้งเวลาเผยแพร่`" :close="props.close" />
|
||||
<DialogHeader :tittle="`วันที่เผยแพร่`" :close="props.close" />
|
||||
<q-separator />
|
||||
|
||||
<q-card-section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue