Merge branch 'develop' into nice_dev
This commit is contained in:
commit
14a8416359
8 changed files with 393 additions and 243 deletions
|
|
@ -6,4 +6,6 @@ export default {
|
||||||
/** โครงสร้างอัตรากำลัง*/
|
/** โครงสร้างอัตรากำลัง*/
|
||||||
activeOrganization: `${organization}/active`,
|
activeOrganization: `${organization}/active`,
|
||||||
createOrganization: `${organization}/draft`,
|
createOrganization: `${organization}/draft`,
|
||||||
|
|
||||||
|
organizationHistoryNew:`${organization}/history`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,7 @@ export default {
|
||||||
// listInsigniaHistoryId: (id: string) => `${insignia}history/${id}`,
|
// listInsigniaHistoryId: (id: string) => `${insignia}history/${id}`,
|
||||||
// listInsigniaPublished: `${insignia}history/published`,
|
// listInsigniaPublished: `${insignia}history/published`,
|
||||||
// listInsigniaPublishedHistory: `${insignia}history/published-history`,
|
// listInsigniaPublishedHistory: `${insignia}history/published-history`,
|
||||||
|
insigniaTypeNew: `${insigniaType}draft`,
|
||||||
|
insigniaTypeNewId: (id: string) => `${insigniaType}${id}`,
|
||||||
|
insigniaNewId: (id: string) => `${insignia}${id}`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,118 +2,45 @@
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
import InsigniaList from "@/modules/01_metadataNew/components/insignia/InsigniaList.vue";
|
import InsigniaList from "@/modules/01_metadataNew/components/insignia/InsigniaList.vue";
|
||||||
const router = useRouter();
|
|
||||||
const route = useRoute();
|
|
||||||
const nameType = ref<string>("");
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
import { useInsigniaDataStore } from "@/modules/01_metadataNew/stores/InsigniaStore";
|
||||||
import type {
|
import type {
|
||||||
DetailResponse,
|
DetailResponse,
|
||||||
DetailRow,
|
DetailRow,
|
||||||
} from "@/modules/01_metadataNew/interface/response/insignia/Insignia";
|
} from "@/modules/01_metadataNew/interface/response/insignia/Insignia";
|
||||||
|
|
||||||
|
const nameType = ref<string>("");
|
||||||
|
const router = useRouter();
|
||||||
|
const route = useRoute();
|
||||||
|
const $q = useQuasar();
|
||||||
|
const store = useInsigniaDataStore();
|
||||||
const row = ref<DetailRow[]>();
|
const row = ref<DetailRow[]>();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { date2Thai } = mixin;
|
const { date2Thai, messageError, hideLoader, showLoader } = mixin;
|
||||||
const id = ref<string>(route.params.id.toString());
|
const id = ref<string>(route.params.id.toString());
|
||||||
function fetchName(name: string) {
|
const insigniaTypeId = ref<string>("");
|
||||||
nameType.value = name;
|
|
||||||
|
async function fetchData(id: string) {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.insigniaTypeNewId(id))
|
||||||
|
.then(async (res) => {
|
||||||
|
insigniaTypeId.value = res.data.result.name;
|
||||||
|
store.fetchData(res.data.result.insignias, res.data.result.name);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = ref<DetailResponse[]>([
|
onMounted(async () => {
|
||||||
{
|
fetchData(id.value);
|
||||||
id: "1",
|
|
||||||
level: 1,
|
|
||||||
shortName: "จ.ม.",
|
|
||||||
insigniaType: "ชั้นต่ำกว่าสายสะพาย",
|
|
||||||
insigniaTypeId: "1",
|
|
||||||
note: "-",
|
|
||||||
name: "จัตุรถาภรณ์มงกุฎไทย",
|
|
||||||
createdAt: new Date(),
|
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
lastUpdateFullName: "System Administrator",
|
|
||||||
isActive: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "2",
|
|
||||||
level: 1,
|
|
||||||
shortName: "จ.ช.",
|
|
||||||
insigniaType: "ชั้นต่ำกว่าสายสะพาย",
|
|
||||||
insigniaTypeId: "1",
|
|
||||||
note: "-",
|
|
||||||
name: "จัตุรถาภรณ์ช้างเผือก",
|
|
||||||
createdAt: new Date(),
|
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
|
||||||
isActive: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "1",
|
|
||||||
level: 1,
|
|
||||||
shortName: "บ.ม.",
|
|
||||||
insigniaType: "ชั้นสายสะพาย",
|
|
||||||
insigniaTypeId: "2",
|
|
||||||
note: "-",
|
|
||||||
name: "เบญจมาภรณ์มงกุฎไทย",
|
|
||||||
createdAt: new Date(),
|
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
|
||||||
isActive: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "2",
|
|
||||||
level: 1,
|
|
||||||
shortName: "ท.ม.",
|
|
||||||
insigniaType: "ชั้นสายสะพาย",
|
|
||||||
insigniaTypeId: "2",
|
|
||||||
note: "-",
|
|
||||||
name: "ทวีติยาภรณ์มงกุฎไทย",
|
|
||||||
createdAt: new Date(),
|
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
|
||||||
isActive: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "1",
|
|
||||||
level: 1,
|
|
||||||
shortName: "บ.ช.",
|
|
||||||
insigniaType: "เหรียญบำเหน็จในราชการ",
|
|
||||||
insigniaTypeId: "3",
|
|
||||||
note: "-",
|
|
||||||
name: "เบญจมาภรณ์ช้างเผือก",
|
|
||||||
createdAt: new Date(),
|
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
|
||||||
isActive: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "2",
|
|
||||||
level: 1,
|
|
||||||
shortName: "ท.ม.",
|
|
||||||
insigniaType: "เหรียญบำเหน็จในราชการ",
|
|
||||||
insigniaTypeId: "3",
|
|
||||||
note: "-",
|
|
||||||
name: "ทวีติยาภรณ์มงกุฎไทย",
|
|
||||||
createdAt: new Date(),
|
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
lastUpdateFullName: "System Administrator",
|
|
||||||
isActive: true,
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
function fetchData() {
|
|
||||||
const datafilter = data.value.find((e) => e.insigniaTypeId === id.value);
|
|
||||||
console.log(datafilter);
|
|
||||||
datafilter && fetchName(datafilter.insigniaType);
|
|
||||||
const list = data.value.map((e) => ({
|
|
||||||
...e,
|
|
||||||
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
|
|
||||||
lastUpdatedAt: e.lastUpdatedAt ? date2Thai(e.lastUpdatedAt) : "",
|
|
||||||
}));
|
|
||||||
row.value = list.filter((e) => e.insigniaTypeId === id.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
fetchData();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -128,15 +55,11 @@ onMounted(() => {
|
||||||
class="q-mr-sm"
|
class="q-mr-sm"
|
||||||
@click="router.go(-1)"
|
@click="router.go(-1)"
|
||||||
/>
|
/>
|
||||||
รายละเอียดข้อมูลเครื่องราชอิสริยาภรณ์ {{ nameType }}
|
รายการข้อมูลเครื่องราชอิสริยาภรณ์ {{ insigniaTypeId }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<q-card flat bordered>
|
<q-card flat bordered>
|
||||||
<InsigniaList
|
<InsigniaList :data="row" />
|
||||||
:data="row"
|
|
||||||
@update:fetchName="fetchName"
|
|
||||||
:nameType="nameType"
|
|
||||||
/>
|
|
||||||
</q-card>
|
</q-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,23 @@
|
||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
|
import { useInsigniaDataStore } from "@/modules/01_metadataNew/stores/InsigniaStore";
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
const store = useInsigniaDataStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { date2Thai, dialogRemove, dialogConfirm } = mixin;
|
const {
|
||||||
|
date2Thai,
|
||||||
|
dialogRemove,
|
||||||
|
dialogConfirm,
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
messageError,
|
||||||
|
} = mixin;
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
|
|
@ -119,7 +129,8 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
const route = useRoute();
|
||||||
|
const id = ref<string>(route.params.id.toString());
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
const isActive = ref<boolean>(false);
|
const isActive = ref<boolean>(false);
|
||||||
|
|
@ -130,6 +141,7 @@ const insigniaTypeId = ref<string>("");
|
||||||
const nameRef = ref<any>(null);
|
const nameRef = ref<any>(null);
|
||||||
const shortNameRef = ref<any>(null);
|
const shortNameRef = ref<any>(null);
|
||||||
const dialogStatus = ref<string>("");
|
const dialogStatus = ref<string>("");
|
||||||
|
const editId = ref<string>("");
|
||||||
const visibleColumns = ref<string[]>([
|
const visibleColumns = ref<string[]>([
|
||||||
"level",
|
"level",
|
||||||
"name",
|
"name",
|
||||||
|
|
@ -142,11 +154,6 @@ const visibleColumns = ref<string[]>([
|
||||||
"note",
|
"note",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
data: { type: Object },
|
|
||||||
nameType: { type: String },
|
|
||||||
});
|
|
||||||
|
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
dialog.value = false;
|
dialog.value = false;
|
||||||
}
|
}
|
||||||
|
|
@ -157,21 +164,78 @@ function validateForm() {
|
||||||
onSubmit();
|
onSubmit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function fetchData(id: string) {
|
||||||
|
showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.insigniaTypeNewId(id))
|
||||||
|
.then(async (res) => {
|
||||||
|
insigniaTypeId.value = res.data.result.name;
|
||||||
|
store.fetchData(res.data.result.insignias, res.data.result.name);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onMounted(async () => {
|
||||||
|
fetchData(id.value);
|
||||||
|
console.log(id.value);
|
||||||
|
});
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
if (name.value.length > 0 && shortName.value.length > 0) {
|
if (name.value.length > 0 && shortName.value.length > 0) {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
async () => {
|
||||||
console.log("สำเร็จ");
|
dialogStatus.value === "create" ? addData() : editData(editId.value);
|
||||||
closeDialog();
|
closeDialog();
|
||||||
name.value = "";
|
name.value = "";
|
||||||
shortName.value = "";
|
shortName.value = "";
|
||||||
|
isActive.value = false;
|
||||||
|
note.value = "";
|
||||||
},
|
},
|
||||||
"ยืนยันการบันทึกข้อมูล",
|
"ยืนยันการบันทึกข้อมูล",
|
||||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function addData() {
|
||||||
|
await http.post(config.API.insignia, {
|
||||||
|
name: name.value,
|
||||||
|
isActive: isActive.value,
|
||||||
|
shortName: shortName.value,
|
||||||
|
note: note.value == "" ? "-" : "",
|
||||||
|
insigniaTypeId: id.value,
|
||||||
|
});
|
||||||
|
fetchData(id.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function editData(idData: string) {
|
||||||
|
await http.put(config.API.insigniaNewId(idData), {
|
||||||
|
name: name.value,
|
||||||
|
isActive: isActive.value,
|
||||||
|
shortName: shortName.value,
|
||||||
|
note: note.value == "" ? "-" : "",
|
||||||
|
insigniaTypeId: id.value,
|
||||||
|
});
|
||||||
|
fetchData(id.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteData(idData: string) {
|
||||||
|
await http.delete(config.API.insigniaNewId(idData));
|
||||||
|
fetchData(id.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
import { defineEmits } from "vue";
|
||||||
|
|
||||||
|
const emit = defineEmits(["nameType"]);
|
||||||
|
|
||||||
|
const nameType = () => {
|
||||||
|
emit("nameType", insigniaTypeId.value);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -214,7 +278,7 @@ async function onSubmit() {
|
||||||
<d-table
|
<d-table
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="props.data"
|
:rows="store.row"
|
||||||
:filter="filterKeyword"
|
:filter="filterKeyword"
|
||||||
row-key="name"
|
row-key="name"
|
||||||
flat
|
flat
|
||||||
|
|
@ -272,6 +336,11 @@ async function onSubmit() {
|
||||||
() => {
|
() => {
|
||||||
dialogStatus = 'edit';
|
dialogStatus = 'edit';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
|
editId = props.row.id;
|
||||||
|
name = props.row.name;
|
||||||
|
shortName = props.row.shortName;
|
||||||
|
note = props.row.note;
|
||||||
|
isActive = props.row.isActive;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -284,7 +353,12 @@ async function onSubmit() {
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
@click="dialogRemove($q, async () => {})"
|
@click="
|
||||||
|
dialogRemove(
|
||||||
|
$q,
|
||||||
|
async () => await deleteData(props.row.id)
|
||||||
|
)
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<div class="row items-center white">
|
<div class="row items-center white">
|
||||||
|
|
@ -315,7 +389,7 @@ async function onSubmit() {
|
||||||
<q-card-section class="q-pa-none">
|
<q-card-section class="q-pa-none">
|
||||||
<q-input
|
<q-input
|
||||||
outlined
|
outlined
|
||||||
:model-value="nameType"
|
:model-value="insigniaTypeId"
|
||||||
label="ลำดับชั้นเครื่องราชฯ"
|
label="ลำดับชั้นเครื่องราชฯ"
|
||||||
dense
|
dense
|
||||||
lazy-rules
|
lazy-rules
|
||||||
|
|
@ -328,7 +402,7 @@ async function onSubmit() {
|
||||||
ref="nameRef"
|
ref="nameRef"
|
||||||
outlined
|
outlined
|
||||||
v-model="name"
|
v-model="name"
|
||||||
label="ชื่อเครื่องราช"
|
label="ชื่อเครื่องราชฯ"
|
||||||
dense
|
dense
|
||||||
lazy-rules
|
lazy-rules
|
||||||
borderless
|
borderless
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,20 @@ import { useRouter } from "vue-router";
|
||||||
import { useInsigniaDataStore } from "@/modules/01_metadataNew/stores/InsigniaStore";
|
import { useInsigniaDataStore } from "@/modules/01_metadataNew/stores/InsigniaStore";
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const store = useInsigniaDataStore();
|
const store = useInsigniaDataStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogRemove, dialogConfirm } = mixin;
|
const {
|
||||||
|
dialogRemove,
|
||||||
|
dialogConfirm,
|
||||||
|
success,
|
||||||
|
messageError,
|
||||||
|
showLoader,
|
||||||
|
hideLoader,
|
||||||
|
} = mixin;
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "name",
|
name: "name",
|
||||||
|
|
@ -71,6 +80,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
|
const editId = ref<string>("");
|
||||||
const filterKeyword = ref<string>("");
|
const filterKeyword = ref<string>("");
|
||||||
const dialog = ref<boolean>(false);
|
const dialog = ref<boolean>(false);
|
||||||
const isActive = ref<boolean>(false);
|
const isActive = ref<boolean>(false);
|
||||||
|
|
@ -87,34 +97,20 @@ const visibleColumns = ref<string[]>([
|
||||||
|
|
||||||
// const row = ref([]);
|
// const row = ref([]);
|
||||||
|
|
||||||
function fetchData() {
|
async function fetchData() {
|
||||||
const data = [
|
showLoader();
|
||||||
{
|
await http
|
||||||
id: "1",
|
.get(config.API.insigniaTypeNew)
|
||||||
name: "ชั้นต่ำกว่าสายสะพาย",
|
.then(async (res) => {
|
||||||
createdAt: new Date(),
|
console.log(res.data.result);
|
||||||
lastUpdatedAt: new Date(),
|
store.fetchData(res.data.result);
|
||||||
lastUpdateFullName: "สาวิตรี ศรีสมัย",
|
})
|
||||||
isActive: true,
|
.catch((err) => {
|
||||||
},
|
messageError($q, err);
|
||||||
{
|
})
|
||||||
id: "2",
|
.finally(() => {
|
||||||
name: "ชั้นสายสะพาย",
|
hideLoader();
|
||||||
createdAt: new Date(),
|
});
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
lastUpdateFullName: "System Administrator",
|
|
||||||
isActive: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "3",
|
|
||||||
name: "เหรียญบำเหน็จในราชการ",
|
|
||||||
createdAt: new Date(),
|
|
||||||
lastUpdatedAt: new Date(),
|
|
||||||
lastUpdateFullName: "คณะกรรมการ ตรวจรับ",
|
|
||||||
isActive: false,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
store.fetchData(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
@ -129,6 +125,27 @@ function onclickDetail(id: string) {
|
||||||
router.push(`/master-data/insignia/detail/${id}`);
|
router.push(`/master-data/insignia/detail/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function addData() {
|
||||||
|
await http.post(config.API.insigniaType, {
|
||||||
|
name: name.value,
|
||||||
|
isActive: isActive.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function editData(id: string) {
|
||||||
|
await http.put(config.API.insigniaTypeNewId(id), {
|
||||||
|
name: name.value,
|
||||||
|
isActive: isActive.value,
|
||||||
|
});
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function deleteData(id: string) {
|
||||||
|
await http.delete(config.API.insigniaTypeNewId(id));
|
||||||
|
fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
function validateForm() {
|
function validateForm() {
|
||||||
nameRef.value.validate();
|
nameRef.value.validate();
|
||||||
onSubmit();
|
onSubmit();
|
||||||
|
|
@ -139,9 +156,10 @@ async function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
async () => {
|
async () => {
|
||||||
console.log("สำเร็จ");
|
dialogStatus.value === "create" ? addData() : editData(editId.value);
|
||||||
closeDialog();
|
closeDialog();
|
||||||
name.value = "";
|
name.value = "";
|
||||||
|
isActive.value = false;
|
||||||
},
|
},
|
||||||
"ยืนยันการบันทึกข้อมูล",
|
"ยืนยันการบันทึกข้อมูล",
|
||||||
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
|
||||||
|
|
@ -246,6 +264,9 @@ async function onSubmit() {
|
||||||
() => {
|
() => {
|
||||||
dialogStatus = 'edit';
|
dialogStatus = 'edit';
|
||||||
dialog = true;
|
dialog = true;
|
||||||
|
editId = props.row.id;
|
||||||
|
name = props.row.name;
|
||||||
|
isActive = props.row.isActive;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -258,7 +279,12 @@ async function onSubmit() {
|
||||||
</q-item>
|
</q-item>
|
||||||
<q-item clickable>
|
<q-item clickable>
|
||||||
<q-item-section
|
<q-item-section
|
||||||
@click="dialogRemove($q, async () => {})"
|
@click="
|
||||||
|
dialogRemove(
|
||||||
|
$q,
|
||||||
|
async () => await deleteData(props.row.id)
|
||||||
|
)
|
||||||
|
"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
>
|
>
|
||||||
<div class="row items-center white">
|
<div class="row items-center white">
|
||||||
|
|
@ -280,7 +306,7 @@ async function onSubmit() {
|
||||||
<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
|
||||||
:tittle="dialogStatus == 'edit' ? 'แก้ไขข้อมูล' : 'เพิ่มข้อมูล'"
|
:tittle="dialogStatus === 'edit' ? 'แก้ไขข้อมูล' : 'เพิ่มข้อมูล'"
|
||||||
:close="closeDialog"
|
:close="closeDialog"
|
||||||
/>
|
/>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,15 @@ const { date2Thai } = useCounterMixin();
|
||||||
|
|
||||||
export const useInsigniaDataStore = defineStore("insigniaData", () => {
|
export const useInsigniaDataStore = defineStore("insigniaData", () => {
|
||||||
const row = ref<DataRow[]>();
|
const row = ref<DataRow[]>();
|
||||||
function fetchData(data: DataResponse[]) {
|
const name1 = ref<string>("");
|
||||||
console.log(data);
|
function fetchData(data: DataResponse[], insigniaType?: string) {
|
||||||
const list = data.map((e) => ({
|
const list = data.map((e) => ({
|
||||||
...e,
|
...e,
|
||||||
|
insigniaType: insigniaType,
|
||||||
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
|
createdAt: e.createdAt ? date2Thai(e.createdAt) : "",
|
||||||
lastUpdatedAt: e.lastUpdatedAt ? date2Thai(e.lastUpdatedAt) : "",
|
lastUpdatedAt: e.lastUpdatedAt ? date2Thai(e.lastUpdatedAt) : "",
|
||||||
}));
|
}));
|
||||||
console.log(list);
|
console.log("test");
|
||||||
row.value = list;
|
row.value = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,14 @@ import { ref, reactive, watch } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
|
import type { HistoryType } from "@/modules/02_organizationalNew/interface/index/Main";
|
||||||
|
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
import Modal from "@/modules/05_placement/components/AppointEmployee/Modal.vue";
|
||||||
|
import { getDateMeta } from "@fullcalendar/core/internal";
|
||||||
|
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modal: Boolean,
|
modal: Boolean,
|
||||||
|
|
@ -12,102 +19,194 @@ const props = defineProps({
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { dialogConfirm } = mixin;
|
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||||
|
const rows = ref<HistoryType[]>([]);
|
||||||
const rows = ref<any[]>([]);
|
|
||||||
|
|
||||||
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "no",
|
name: "no",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ลำดับ",
|
label: "ลำดับ",
|
||||||
sortable: false,
|
sortable: false,
|
||||||
field: "no",
|
field: "no",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "name",
|
name: "orgRevisionName",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ชื่อ",
|
label: "ชื่อโครงสร้าง",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "name",
|
field: "orgRevisionName",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "lastUpdatedAt",
|
name: "lastUpdatedAt",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "วันที่แก้ไข",
|
label: "วันที่แก้ไข",
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: "lastUpdatedAt",
|
field: "lastUpdatedAt",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
]);
|
name: "orgRevisionIsCurrent",
|
||||||
const visibleColumns = ref<string[]>([
|
align: "center",
|
||||||
"no",
|
label: "โครงสร้างที่ใช้อยู่",
|
||||||
"name",
|
sortable: false,
|
||||||
"lastUpdatedAt",
|
field: "orgRevisionIsCurrent",
|
||||||
]);
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "orgRevisionIsDraft",
|
||||||
|
align: "center",
|
||||||
|
label: "โครงสร้างแบบร่าง",
|
||||||
|
sortable: false,
|
||||||
|
field: "orgRevisionIsDraft",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "orgRevisionCreatedAt",
|
||||||
|
align: "left",
|
||||||
|
label: "วันเริ่มใช้โครงสร้าง",
|
||||||
|
sortable: true,
|
||||||
|
field: "orgRevisionCreatedAt",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const visibleColumns = ref<string[]>([
|
||||||
|
"no",
|
||||||
|
"orgRevisionName",
|
||||||
|
"orgRevisionIsCurrent",
|
||||||
|
"orgRevisionIsDraft",
|
||||||
|
"orgRevisionCreatedAt",
|
||||||
|
]);
|
||||||
|
|
||||||
|
function getDate() {
|
||||||
|
const dataDraft: HistoryType[] = [
|
||||||
|
{
|
||||||
|
orgRevisionId: "00000000-0000-0000-0000-000000000000",
|
||||||
|
orgRevisionName: "xxxx",
|
||||||
|
orgRevisionIsCurrent: true,
|
||||||
|
orgRevisionIsDraft: false,
|
||||||
|
orgRevisionCreatedAt: date2Thai(new Date(),false,true),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
orgRevisionId: "00000000-0000-0000-0000-000000000001",
|
||||||
|
orgRevisionName: "xxx1",
|
||||||
|
orgRevisionIsCurrent: false,
|
||||||
|
orgRevisionIsDraft: true,
|
||||||
|
orgRevisionCreatedAt: date2Thai(new Date(),false,true),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
rows.value = dataDraft;
|
||||||
|
|
||||||
|
// รอ API
|
||||||
|
// showLoader()
|
||||||
|
// http
|
||||||
|
// .get(config.API.organizationHistoryNew)
|
||||||
|
// .then((res)=>{
|
||||||
|
// const dataList = res.data.result
|
||||||
|
// dataList.map((item:HistoryType)=>(
|
||||||
|
// {
|
||||||
|
// orgRevisionId:item.orgRevisionId ? item.orgRevisionId:'-',
|
||||||
|
// orgRevisionName:item.orgRevisionName ? item.orgRevisionName:'-',
|
||||||
|
// orgRevisionIsCurrent:item.orgRevisionIsCurrent ? item.orgRevisionIsCurrent:'-',
|
||||||
|
// orgRevisionIsDraft:item.orgRevisionIsDraft ? item.orgRevisionIsDraft:'-',
|
||||||
|
// orgRevisionCreatedAt:item.orgRevisionCreatedAt ? date2Thai(item.orgRevisionCreatedAt):'-',
|
||||||
|
// }
|
||||||
|
// ))
|
||||||
|
// rows.value = dataList
|
||||||
|
// }).catch((e)=>{
|
||||||
|
// messageError($q,e)
|
||||||
|
// })
|
||||||
|
// .finally(()=>{
|
||||||
|
// hideLoader()
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
watch(
|
||||||
|
() => props.modal,
|
||||||
|
() => {
|
||||||
|
if (props.modal == true) {
|
||||||
|
getDate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="props.modal" persistent>
|
<q-dialog v-model="props.modal" persistent>
|
||||||
<q-card style="min-width: 40vw">
|
<q-card style="min-width: 40vw">
|
||||||
<DialogHeader :tittle="`ประวัติโครงสร้าง`" :close="props.close" />
|
<DialogHeader :tittle="`ประวัติโครงสร้าง`" :close="props.close" />
|
||||||
<q-separator />
|
<q-separator />
|
||||||
|
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="row q-col-gutter-sm">
|
<div class="row q-col-gutter-sm">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<d-table
|
<d-table
|
||||||
ref="table"
|
ref="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
row-key="idcard"
|
row-key="orgRevisionId"
|
||||||
flat
|
flat
|
||||||
bordered
|
bordered
|
||||||
:paging="true"
|
:paging="true"
|
||||||
dense
|
dense
|
||||||
class="custom-header-table"
|
class="custom-header-table"
|
||||||
:visible-columns="visibleColumns"
|
:visible-columns="visibleColumns"
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
<q-th
|
<q-th
|
||||||
v-for="col in props.cols"
|
v-for="col in props.cols"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:props="props"
|
:props="props"
|
||||||
style="color: #000000; font-weight: 500"
|
style="color: #000000; font-weight: 500"
|
||||||
>
|
>
|
||||||
<span class="text-weight-medium">{{ col.label }}</span>
|
<span class="text-weight-medium">{{ col.label }}</span>
|
||||||
</q-th>
|
</q-th>
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:body="props">
|
<template v-slot:body="props">
|
||||||
<q-tr :props="props" class="cursor-pointer">
|
<q-tr :props="props" class="cursor-pointer">
|
||||||
<q-td
|
<q-td
|
||||||
v-for="col in props.cols"
|
v-for="col in props.cols"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
:props="props"
|
:props="props"
|
||||||
>
|
>
|
||||||
<div v-if="col.name == 'no'">
|
<div v-if="col.name == 'no'">
|
||||||
{{ props.rowIndex + 1 }}
|
{{ props.rowIndex + 1 }}
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
|
||||||
{{ col.value }}
|
<div v-else-if="col.name == 'orgRevisionIsCurrent'">
|
||||||
</div>
|
<q-icon
|
||||||
</q-td>
|
:name="props.row.orgRevisionIsCurrent == true ? 'mdi-check':'mdi-close'"
|
||||||
</q-tr>
|
:color="props.row.orgRevisionIsCurrent == true ? 'positive':'red'"
|
||||||
</template>
|
class="text-h5"
|
||||||
</d-table>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="col.name == 'orgRevisionIsDraft'">
|
||||||
|
<q-icon
|
||||||
|
:name="props.row.orgRevisionIsDraft == true ? 'mdi-check':'mdi-close'"
|
||||||
|
:color="props.row.orgRevisionIsDraft == true ? 'positive':'red'"
|
||||||
|
class="text-h5"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-else>
|
||||||
|
{{ col.value }}
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
</q-tr>
|
||||||
|
</template>
|
||||||
|
</d-table>
|
||||||
</div>
|
</div>
|
||||||
</q-card-section>
|
</div>
|
||||||
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -40,18 +40,40 @@ interface FormAgencyRef {
|
||||||
tel: object | null;
|
tel: object | null;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormPositionRef {
|
interface FormPositionRef {
|
||||||
prefixNo: object | null;
|
prefixNo: object | null;
|
||||||
positionNo: object | null;
|
positionNo: object | null;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormDateTimeRef {
|
interface FormDateTimeRef {
|
||||||
dateTime: object | null;
|
dateTime: object | null;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FormNewStructureRef {
|
interface FormNewStructureRef {
|
||||||
orgRevisionName: object | null;
|
orgRevisionName: object | null;
|
||||||
type: object | null;
|
type: object | null;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
export type { Pagination, DataOption, FormDataAgency, FormDataPosition, FormAgencyRef, FormPositionRef, FormDateTimeRef,FormDataNewStructure,FormNewStructureRef };
|
|
||||||
|
interface HistoryType {
|
||||||
|
orgRevisionId: string
|
||||||
|
orgRevisionName: string
|
||||||
|
orgRevisionIsCurrent: boolean
|
||||||
|
orgRevisionIsDraft: boolean
|
||||||
|
orgRevisionCreatedAt: any
|
||||||
|
}
|
||||||
|
export type {
|
||||||
|
Pagination,
|
||||||
|
DataOption,
|
||||||
|
FormDataAgency,
|
||||||
|
FormDataPosition,
|
||||||
|
FormAgencyRef,
|
||||||
|
FormPositionRef,
|
||||||
|
FormDateTimeRef,
|
||||||
|
FormDataNewStructure,
|
||||||
|
FormNewStructureRef,
|
||||||
|
HistoryType
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue