รายการคำสั่งและ Template ส่งฟิลเพิ่ม
This commit is contained in:
parent
370599e61c
commit
c3a8f47b84
3 changed files with 43 additions and 83 deletions
|
|
@ -74,6 +74,8 @@ async function fetchDocumentTemplate(dataTemple: DataTemplateDetail) {
|
|||
detailBody: dataTemple.detailBody,
|
||||
detailFooter: dataTemple.detailFooter,
|
||||
commandDate: "..................",
|
||||
commandAffectDate: "..................",
|
||||
commandExcecuteDate: "..................",
|
||||
name: "....................................",
|
||||
position: "ผู้อำนวยการสำนัก/เขต",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@ interface ActiveOptions {
|
|||
interface ListOrder {
|
||||
id: string;
|
||||
commandCode: string;
|
||||
subtitle: string;
|
||||
name: string;
|
||||
isActive: boolean;
|
||||
isAttachment: boolean;
|
||||
category?: string;
|
||||
commandSysId: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue