ปรับ editor

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-13 18:18:23 +07:00
parent 3ad54cf99f
commit c5262bf04d
2 changed files with 63 additions and 19 deletions

View file

@ -74,7 +74,9 @@ async function onSubmit() {
showLoader(); showLoader();
await http await http
.put(config.API.commandAction(commandId.value, "tab1"), formData) .put(config.API.commandAction(commandId.value, "tab1"), formData)
.then(() => {}) .then(() => {
fetchData();
})
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
}) })
@ -87,8 +89,8 @@ async function onSubmit() {
/** /**
* ทำงานเม Components กเรยกใชงาน * ทำงานเม Components กเรยกใชงาน
*/ */
onMounted(() => { onMounted(async () => {
fetchData(); await fetchData();
}); });
/** /**
@ -188,7 +190,18 @@ defineExpose({
<!-- เนอหาคำสงสวนต --> <!-- เนอหาคำสงสวนต -->
<div class="col-12"> <div class="col-12">
<q-card bordered flat> <q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
outlined
dense
v-model="formData.detailHeader"
hide-bottom-space
:label="`${'เนื้อหาคำสั่งส่วนต้น'}`"
@update:model-value="onCheckChangeData()"
type="textarea"
/>
<!-- <q-card bordered flat>
<div class="bg-grey-2 row q-py-sm q-px-md text-bold"> <div class="bg-grey-2 row q-py-sm q-px-md text-bold">
เนอหาคำสงสวนต เนอหาคำสงสวนต
</div> </div>
@ -224,12 +237,23 @@ defineExpose({
</template> </template>
</q-field> </q-field>
</q-card-section> </q-card-section>
</q-card> </q-card> -->
</div> </div>
<!-- เนอหาคำสงสวนกลาง --> <!-- เนอหาคำสงสวนกลาง -->
<div class="col-12"> <div class="col-12">
<q-card bordered flat> <q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
outlined
dense
v-model="formData.detailBody"
hide-bottom-space
:label="`${'เนื้อหาคำสั่งส่วนกลาง'}`"
@update:model-value="onCheckChangeData()"
type="textarea"
/>
<!-- <q-card bordered flat>
<div class="bg-grey-2 row q-py-sm q-px-md text-bold"> <div class="bg-grey-2 row q-py-sm q-px-md text-bold">
เนอหาคำสงสวนกลาง เนอหาคำสงสวนกลาง
</div> </div>
@ -265,12 +289,23 @@ defineExpose({
</template> </template>
</q-field> </q-field>
</q-card-section> </q-card-section>
</q-card> </q-card> -->
</div> </div>
<!-- เนอหาคำสงสวนทาย --> <!-- เนอหาคำสงสวนทาย -->
<div class="col-12"> <div class="col-12">
<q-card bordered flat> <q-input
:class="store.classInput(!store.readonly)"
:readonly="store.readonly"
outlined
dense
v-model="formData.detailFooter"
hide-bottom-space
:label="`${'เนื้อหาคำสั่งส่วนท้าย'}`"
@update:model-value="onCheckChangeData()"
type="textarea"
/>
<!-- <q-card bordered flat>
<div class="bg-grey-2 row q-py-sm q-px-md text-bold"> <div class="bg-grey-2 row q-py-sm q-px-md text-bold">
เนอหาคำสงสวนทาย เนอหาคำสงสวนทาย
</div> </div>
@ -306,7 +341,7 @@ defineExpose({
</template> </template>
</q-field> </q-field>
</q-card-section> </q-card-section>
</q-card> </q-card> -->
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
@ -317,5 +352,8 @@ defineExpose({
<q-btn label="บันทึก" color="public" @click="onSubmit" /> <q-btn label="บันทึก" color="public" @click="onSubmit" />
</q-card-actions> </q-card-actions>
<DialogPerview v-model:modal="modalPreview" /> <DialogPerview
v-model:modal="modalPreview"
v-model:data-template-detail="formData"
/>
</template> </template>

View file

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from "vue"; import { onMounted, ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { VuePDF, usePDF } from "@tato30/vue-pdf"; import { VuePDF, usePDF } from "@tato30/vue-pdf";
import axios from "axios"; import axios from "axios";
@ -17,29 +17,33 @@ const $q = useQuasar();
const { dialogConfirm } = useCounterMixin(); const { dialogConfirm } = useCounterMixin();
const modal = defineModel<boolean>("modal", { required: true }); const modal = defineModel<boolean>("modal", { required: true });
const dataTemplateDetail = defineModel<any>("dataTemplateDetail", {
required: true,
});
const pdfSrc = ref<PDFDocumentLoadingTask | undefined>(); const pdfSrc = ref<PDFDocumentLoadingTask | undefined>();
const numOfPages = ref<number>(0); const numOfPages = ref<number>(0);
const page = ref<number>(1); const page = ref<number>(1);
const vuePDFRef = ref<any>(null); const vuePDFRef = ref<any>(null);
function fetchPDF(type: string = "docx") { async function fetchPDF(type: string = "docx") {
axios await axios
.post( .post(
config.API.reportTemplate + `/${type}`, config.API.reportTemplate + `/${type}`,
{ {
template: "command_test", template: "command_test",
reportName: "docx-report", reportName: "docx-report",
data: { data: {
commandNo: "๑๒๓๔๕", commandNo: dataTemplateDetail.value.commandNo, //
commandYear: "กระผม", commandYear: dataTemplateDetail.value.commandYear, //
commandTitle: "นาย", commandTitle: "นาย",
detailHeader: "Administrator", detailHeader: dataTemplateDetail.value.detailHeader, //
detailBody: "detailBody", detailBody: dataTemplateDetail.value.detailBody, //
detailFooter: "detailFooter", detailFooter: dataTemplateDetail.value.detailFooter, //
commandDate: "", commandDate: "",
name: "Chief Technology Officer", name: "Chief Technology Officer",
position: "Chief Technology Officer", position: "Chief Technology Officer",
issue: dataTemplateDetail.value.issue, //
}, },
}, },
{ {
@ -70,7 +74,9 @@ function onClose() {
} }
onMounted(() => { onMounted(() => {
fetchPDF(); setTimeout(() => {
fetchPDF();
}, 1000);
}); });
</script> </script>