Merge branch 'oat_dev' into develop
This commit is contained in:
commit
0071147fda
2 changed files with 152 additions and 99 deletions
|
|
@ -13,18 +13,18 @@ const store = useInsigniaDataStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
|
|
||||||
// const props = defineProps({
|
|
||||||
// fetchData: {
|
|
||||||
// type: Function,
|
|
||||||
// default: () => "",
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
const insigniaTypeName = defineModel<string>("insigniaTypeName", {
|
const insigniaTypeName = defineModel<string>("insigniaTypeName", {
|
||||||
required: true,
|
required: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { dialogRemove, dialogConfirm, showLoader, hideLoader, messageError } =
|
const {
|
||||||
mixin;
|
dialogRemove,
|
||||||
|
dialogConfirm,
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
messageError,
|
||||||
|
success,
|
||||||
|
} = mixin;
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
|
|
@ -216,26 +216,49 @@ async function addData() {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
fetchData(id.value);
|
fetchData(id.value);
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function editData(idData: string) {
|
async function editData(idData: string) {
|
||||||
await http.put(config.API.insigniaNewIdOrg(idData), {
|
await http
|
||||||
name: name.value,
|
.put(config.API.insigniaNewIdOrg(idData), {
|
||||||
isActive: isActive.value,
|
name: name.value,
|
||||||
shortName: shortName.value,
|
isActive: isActive.value,
|
||||||
note: note.value == "" ? "-" : note.value,
|
shortName: shortName.value,
|
||||||
insigniaTypeId: id.value,
|
note: note.value == "" ? "-" : note.value,
|
||||||
});
|
insigniaTypeId: id.value,
|
||||||
fetchData(id.value);
|
})
|
||||||
|
.then(() => {
|
||||||
|
fetchData(id.value);
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteData(idData: string) {
|
async function deleteData(idData: string) {
|
||||||
await http.delete(config.API.insigniaNewIdOrg(idData));
|
await http
|
||||||
fetchData(id.value);
|
.delete(config.API.insigniaNewIdOrg(idData))
|
||||||
|
.then(() => {
|
||||||
|
fetchData(id.value);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
import { defineEmits } from "vue";
|
import { defineEmits } from "vue";
|
||||||
|
|
@ -382,7 +405,7 @@ const dialogOrder = ref<boolean>(false);
|
||||||
</d-table>
|
</d-table>
|
||||||
|
|
||||||
<q-dialog v-model="dialog" class="dialog" persistent>
|
<q-dialog v-model="dialog" class="dialog" persistent>
|
||||||
<q-card style="min-width: 350px" class="bg-grey-11">
|
<q-card style="min-width: 350px">
|
||||||
<form @submit.prevent="validateForm">
|
<form @submit.prevent="validateForm">
|
||||||
<q-card-section class="flex justify-between" style="padding: 0">
|
<q-card-section class="flex justify-between" style="padding: 0">
|
||||||
<dialog-header
|
<dialog-header
|
||||||
|
|
@ -393,55 +416,59 @@ const dialogOrder = ref<boolean>(false);
|
||||||
|
|
||||||
<q-separator color="grey-4" />
|
<q-separator color="grey-4" />
|
||||||
<q-card-section class="q-pa-none">
|
<q-card-section class="q-pa-none">
|
||||||
<q-input
|
<div class="col-12 q-ma-md">
|
||||||
outlined
|
<q-input
|
||||||
:model-value="insigniaTypeId"
|
outlined
|
||||||
label="ลำดับชั้นเครื่องราชฯ"
|
:model-value="insigniaTypeId"
|
||||||
dense
|
label="ลำดับชั้นเครื่องราชฯ"
|
||||||
lazy-rules
|
dense
|
||||||
borderless
|
lazy-rules
|
||||||
class="col-12 bg-white q-ma-md"
|
borderless
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
<q-input
|
</div>
|
||||||
ref="nameRef"
|
<div class="col-12 q-ma-md">
|
||||||
outlined
|
<q-input
|
||||||
v-model="name"
|
ref="nameRef"
|
||||||
label="ชื่อเครื่องราชฯ"
|
outlined
|
||||||
dense
|
v-model="name"
|
||||||
lazy-rules
|
label="ชื่อเครื่องราชฯ"
|
||||||
borderless
|
dense
|
||||||
class="col-12 bg-white q-ma-md"
|
lazy-rules
|
||||||
:rules="[
|
borderless
|
||||||
(val) => val.length > 0 || 'กรุณากรอกลำดับชั้นเครื่องราชฯ',
|
:rules="[
|
||||||
]"
|
(val) => val.length > 0 || 'กรุณากรอกลำดับชั้นเครื่องราชฯ',
|
||||||
hide-bottom-space
|
]"
|
||||||
/>
|
hide-bottom-space
|
||||||
<q-input
|
/>
|
||||||
ref="shortNameRef"
|
</div>
|
||||||
outlined
|
<div class="col-12 q-ma-md">
|
||||||
v-model="shortName"
|
<q-input
|
||||||
label="ชื่อย่อ"
|
ref="shortNameRef"
|
||||||
dense
|
outlined
|
||||||
lazy-rules
|
v-model="shortName"
|
||||||
borderless
|
label="ชื่อย่อ"
|
||||||
class="col-12 bg-white q-ma-md"
|
dense
|
||||||
:rules="[
|
lazy-rules
|
||||||
(val) => val.length > 0 || 'กรุณากรอกลำดับชั้นเครื่องราชฯ',
|
borderless
|
||||||
]"
|
:rules="[
|
||||||
hide-bottom-space
|
(val) => val.length > 0 || 'กรุณากรอกลำดับชั้นเครื่องราชฯ',
|
||||||
/>
|
]"
|
||||||
<q-input
|
hide-bottom-space
|
||||||
outlined
|
/>
|
||||||
v-model="note"
|
</div>
|
||||||
label="หมายเหตุ"
|
<div class="col-12 q-ma-md">
|
||||||
dense
|
<q-input
|
||||||
type="textarea"
|
outlined
|
||||||
borderless
|
v-model="note"
|
||||||
class="col-12 bg-white q-ma-md"
|
label="หมายเหตุ"
|
||||||
hide-bottom-space
|
dense
|
||||||
/>
|
type="textarea"
|
||||||
|
borderless
|
||||||
|
hide-bottom-space
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="col q-ma-md q-pa-sm bg-white border_custom text-weight-medium"
|
class="col q-ma-md q-pa-sm bg-white border_custom text-weight-medium"
|
||||||
>
|
>
|
||||||
|
|
@ -463,7 +490,6 @@ const dialogOrder = ref<boolean>(false);
|
||||||
unelevated
|
unelevated
|
||||||
label="บันทึก"
|
label="บันทึก"
|
||||||
color="public"
|
color="public"
|
||||||
class="q-px-md"
|
|
||||||
>
|
>
|
||||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,6 @@ const visibleColumns = ref<string[]>([
|
||||||
"isActive",
|
"isActive",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// const row = ref([]);
|
|
||||||
|
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
|
|
@ -125,24 +123,53 @@ function onclickDetail(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addData() {
|
async function addData() {
|
||||||
await http.post(config.API.insigniaTypeOrg, {
|
await http
|
||||||
name: name.value,
|
.post(config.API.insigniaTypeOrg, {
|
||||||
isActive: isActive.value,
|
name: name.value,
|
||||||
});
|
isActive: isActive.value,
|
||||||
fetchData();
|
})
|
||||||
|
.then(() => {
|
||||||
|
fetchData();
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function editData(id: string) {
|
async function editData(id: string) {
|
||||||
await http.put(config.API.insigniaTypeNewIdOrg(id), {
|
await http
|
||||||
name: name.value,
|
.put(config.API.insigniaTypeNewIdOrg(id), {
|
||||||
isActive: isActive.value,
|
name: name.value,
|
||||||
});
|
isActive: isActive.value,
|
||||||
fetchData();
|
})
|
||||||
|
.then(() => {
|
||||||
|
fetchData();
|
||||||
|
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteData(id: string) {
|
async function deleteData(id: string) {
|
||||||
await http.delete(config.API.insigniaTypeNewIdOrg(id));
|
await http
|
||||||
fetchData();
|
.delete(config.API.insigniaTypeNewIdOrg(id))
|
||||||
|
.then(() => {
|
||||||
|
fetchData();
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateForm() {
|
function validateForm() {
|
||||||
|
|
@ -287,7 +314,7 @@ async function onSubmit() {
|
||||||
</d-table>
|
</d-table>
|
||||||
|
|
||||||
<q-dialog v-model="dialog" class="dialog" persistent>
|
<q-dialog v-model="dialog" class="dialog" persistent>
|
||||||
<q-card style="min-width: 350px" class="bg-grey-11">
|
<q-card style="min-width: 350px">
|
||||||
<form @submit.prevent="validateForm">
|
<form @submit.prevent="validateForm">
|
||||||
<q-card-section class="flex justify-between" style="padding: 0">
|
<q-card-section class="flex justify-between" style="padding: 0">
|
||||||
<dialog-header
|
<dialog-header
|
||||||
|
|
@ -298,20 +325,21 @@ async function onSubmit() {
|
||||||
|
|
||||||
<q-separator color="grey-4" />
|
<q-separator color="grey-4" />
|
||||||
<q-card-section class="q-pa-none">
|
<q-card-section class="q-pa-none">
|
||||||
<q-input
|
<div class="col-12 q-ma-md">
|
||||||
ref="nameRef"
|
<q-input
|
||||||
outlined
|
ref="nameRef"
|
||||||
v-model="name"
|
outlined
|
||||||
label="ลำดับชั้นเครื่องราชฯ"
|
v-model="name"
|
||||||
dense
|
label="ลำดับชั้นเครื่องราชฯ"
|
||||||
lazy-rules
|
dense
|
||||||
borderless
|
lazy-rules
|
||||||
class="col-12 bg-white q-ma-md"
|
borderless
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => val.length > 0 || 'กรุณากรอกลำดับชั้นเครื่องราชฯ',
|
(val) => val.length > 0 || 'กรุณากรอกลำดับชั้นเครื่องราชฯ',
|
||||||
]"
|
]"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="col q-ma-md q-pa-sm bg-white border_custom text-weight-medium"
|
class="col q-ma-md q-pa-sm bg-white border_custom text-weight-medium"
|
||||||
>
|
>
|
||||||
|
|
@ -333,7 +361,6 @@ async function onSubmit() {
|
||||||
unelevated
|
unelevated
|
||||||
label="บันทึก"
|
label="บันทึก"
|
||||||
color="public"
|
color="public"
|
||||||
class="q-px-md"
|
|
||||||
>
|
>
|
||||||
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
<q-tooltip>บันทึกข้อมูล</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue