This commit is contained in:
Warunee Tamkoo 2024-09-11 18:06:04 +07:00
parent 9ab3001ff0
commit f68c4af30b
6 changed files with 261 additions and 34 deletions

View file

@ -15,6 +15,7 @@ import type {
import Header from "@/components/DialogHeader.vue";
import PageOrder from "@/modules/05_command/components/ViewPdf.vue";
import TemplateDetail from "@/modules/05_command/components/FormTemplate.vue";
const $q = useQuasar();
const mixin = useCounterMixin();
@ -28,18 +29,20 @@ const {
messageError,
} = mixin;
const inActive = ref<string>(""); //Select Active/InActive
const isActive = ref<string>(""); //
// options
const activeOptions = ref<ActiveOptions[]>([
{
value: "Active",
value: true,
label: "Active",
},
{
value: "InActive",
value: false,
label: "InActive",
},
]);
// Tabs
const tabs = ref<Tabs[]>([
{
value: "order",
@ -49,25 +52,32 @@ const tabs = ref<Tabs[]>([
value: "account",
label: "บัญชีแนบท้าย",
},
{
value: "template",
label: "ข้อความต้นแบบ",
},
]);
const idOrder = ref<string>("");
const activeOrderId = ref<string>("");
const idOrder = ref<string>(""); // Id
const activeOrderId = ref<string>(""); // Id
const name = ref<string>(""); //
const listOrder = ref<ListOrder[]>([]); // list
const status = ref<boolean>(false); //
const isEdit = ref<boolean>(false); // true/false
const modelDialogActive = ref<boolean>(false); // model
const dialogFormCommand = ref<boolean>(false); // model
/** search Active / InActive */
function searchActive(val: string) {
/**
* งกนคนหาคำส ตามสถานะ
* @param val สถานะ true/false
*/
function searchByStatus(val: string) {
console.log(val);
}
/** เปิด dialog */
function onDialogAdd() {
isEdit.value = false;
modelDialogActive.value = true;
dialogFormCommand.value = true;
}
/**
* เป dialog Edit
@ -79,7 +89,7 @@ function onDialogEdit(data: ListOrder) {
status.value = data.status;
isEdit.value = true;
modelDialogActive.value = true;
dialogFormCommand.value = true;
}
/**
@ -102,7 +112,7 @@ function onDelete(id: string) {
function closeDialog() {
idOrder.value = "";
isEdit.value = false;
modelDialogActive.value = false;
dialogFormCommand.value = false;
name.value = "";
status.value = false;
}
@ -174,14 +184,14 @@ onMounted(() => {
<q-select
outlined
dense
v-model="inActive"
v-model="isActive"
class="inputgreen"
label="สถานะการใช้งาน"
:options="activeOptions"
option-label="label"
option-value="value"
emit-value
@update:model-value="searchActive"
@update:model-value="searchByStatus"
></q-select>
</div>
</div>
@ -294,6 +304,12 @@ onMounted(() => {
:id-order="activeOrderId"
/>
</q-tab-panel>
<q-tab-panel name="template">
<TemplateDetail
v-model:type="store.currentTab"
:command-id="activeOrderId"
/>
</q-tab-panel>
</q-tab-panels>
</div>
<div v-else style="height: auto; max-width: 100%; max-height: 90vh">
@ -315,11 +331,11 @@ onMounted(() => {
</div>
</div>
<q-dialog v-model="modelDialogActive" persistent>
<q-dialog v-model="dialogFormCommand" persistent>
<q-card class="col-12" style="min-width: 30%">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<Header
:tittle="isEdit ? 'แก้ไขข้อมูลคำสั่ง' : 'เพิ่มข้อมูลคำสั่ง'"
:tittle="isEdit ? 'แก้ไขคำสั่ง' : 'เพิ่มคำสั่ง'"
:close="closeDialog"
/>
<q-separator />