รายการคำสั่งและ Template ส่งฟิลเพิ่ม

This commit is contained in:
STW_TTTY\stwtt 2024-09-20 16:57:13 +07:00
parent 370599e61c
commit c3a8f47b84
3 changed files with 43 additions and 83 deletions

View file

@ -74,6 +74,8 @@ async function fetchDocumentTemplate(dataTemple: DataTemplateDetail) {
detailBody: dataTemple.detailBody,
detailFooter: dataTemple.detailFooter,
commandDate: "..................",
commandAffectDate: "..................",
commandExcecuteDate: "..................",
name: "....................................",
position: "ผู้อำนวยการสำนัก/เขต",
},

View file

@ -25,8 +25,10 @@ interface ActiveOptions {
interface ListOrder {
id: string;
commandCode: string;
subtitle: string;
name: string;
isActive: boolean;
isAttachment: boolean;
category?: string;
commandSysId: string;
}

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { ref, onMounted, watch, computed } from "vue";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
@ -32,19 +32,6 @@ const childTemplateDetailRef = ref<InstanceType<typeof TemplateDetail> | null>(
); //ref components
const childPageOrderRef = ref<InstanceType<typeof PageOrder> | null>(null); //ref components
const isActive = ref<boolean>(true); //
// options
const activeOptions = ref<ActiveOptions[]>([
{
value: true,
label: "Active",
},
{
value: false,
label: "InActive",
},
]);
// Tabs
const tabs = ref<Tabs[]>([
{
@ -61,12 +48,24 @@ const tabs = ref<Tabs[]>([
},
]);
/** เมื่อ แนบท้ายเป็น false ตัด tab attachment ออก */
const filteredTabs = computed(() =>
isAttachmentShow.value
? tabs.value
: tabs.value.filter((tab) => tab.value !== "attachment")
);
const isActive = ref<boolean>(true); //
const isAttachment = ref<boolean>(true); //
const isAttachmentShow = ref<boolean>(true); // show/off
const dataCategory = ref<DateOption[]>([]); //
const categoryOP = ref<DateOption[]>([]); // options
const commandId = ref<string>(""); // Id
const activeCommandId = ref<string>(""); // Id
const name = ref<string>(""); //
const subtitle = ref<string>(""); //
const category = ref<string>(""); //
const listOrder = ref<ListOrder[]>([]); // list
const status = ref<boolean>(false); //
@ -148,31 +147,12 @@ function onDialogEdit(data: ListOrder) {
name.value = data.name;
status.value = data.isActive;
category.value = data.commandSysId;
subtitle.value = data.subtitle;
isEdit.value = true;
isAttachment.value = data.isAttachment;
dialogFormCommand.value = true;
}
// /**
// *
// * @param id id
// */
// function onDelete(id: string) {
// dialogRemove($q, () => {
// showLoader();
// http
// .delete(config.API.commandType + `/${id}`)
// .then(async () => {
// await fetchCommandType();
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// hideLoader();
// });
// });
// }
/**
* dialog
*/
@ -194,8 +174,10 @@ function onSubmit() {
await http
.put(config.API.commandType + `/${commandId.value}`, {
name: name.value,
subtitle: subtitle.value,
commandSysId: category.value,
isActive: status.value,
isAttachment: isAttachment.value,
})
.then(async () => {
await fetchCommandType();
@ -215,6 +197,7 @@ function onSubmit() {
* เก id list คำสงทเลอก เพอใช class
*/
function selectInbox(data: ListOrder) {
isAttachmentShow.value = data.isAttachment;
activeCommandId.value = data.id;
fetchDataCommandTypeId(data.id);
}
@ -232,7 +215,6 @@ async function fetchDataCommandTypeId(id: string) {
dataTemplateDetail.value = data;
await Promise.all([
childTemplateDetailRef?.value?.fetchData(data),
// childPageOrderRef?.value?.fetchDocumentTemplate(data),
]);
})
.catch((err) => {
@ -280,18 +262,6 @@ onMounted(async () => {
<div class="col-4">
<q-card bordered style="min-height: 100%">
<div class="row items-center q-pa-sm">
<!-- <div class="col-2">
<q-btn
flat
dense
round
icon="add"
color="primary"
@click="onDialogAdd()"
>
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
</div> -->
<q-space />
<div class="col-12 col-md-6 q-py-sm">
<div class="row items-center no-wrap justify-end">
@ -320,6 +290,9 @@ onMounted(async () => {
<q-item-section>
<q-item-label>
{{ item.name }}
<q-item-label caption>{{
item.subtitle ? item.subtitle : ""
}}</q-item-label>
</q-item-label>
</q-item-section>
<q-item-section side center @click.stop>
@ -331,40 +304,6 @@ onMounted(async () => {
dense
@click="onDialogEdit(item)"
/>
<!-- <q-menu transition-show="jump-down" transition-hide="jump-up">
<q-list dense style="min-width: 160px">
<q-item
clickable
v-close-popup
@click="onDialogEdit(item)"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-icon color="edit" size="xs" name="mdi-pencil" />
</q-item-section>
<q-item-section>แกไข</q-item-section>
</q-item>
<q-separator />
<q-item
clickable
v-close-popup
@click="onDelete(item.id)"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
<q-icon color="red" size="xs" name="mdi-delete" />
</q-item-section>
<q-item-section>ลบ</q-item-section>
</q-item>
</q-list>
</q-menu> -->
<!-- </q-icon> -->
</q-item-section>
</q-item>
</q-list>
@ -405,7 +344,7 @@ onMounted(async () => {
class="text-body2 text-grey-7"
>
<q-tab
v-for="tab in tabs"
v-for="tab in filteredTabs"
:key="tab.value"
v-on:click="store.currentTab = tab.value"
:label="tab.label"
@ -485,6 +424,16 @@ onMounted(async () => {
hide-bottom-space
></q-input>
</div>
<div class="col-12">
<q-input
outlined
dense
v-model="subtitle"
label="คำอธิบาย"
class="inputgreen"
hide-bottom-space
></q-input>
</div>
<div class="col-12">
<q-select
class="inputgreen"
@ -522,6 +471,13 @@ onMounted(async () => {
</label>
</div>
</div>
<div class="col-12">
<q-checkbox
v-model="isAttachment"
label="บัญชีแนบท้าย"
size="sm"
/>
</div>
</div>
</q-card-section>
<q-separator />