ลบ store ออก

This commit is contained in:
STW_TTTY\stwtt 2024-04-04 14:20:39 +07:00
parent 55ce294f79
commit 18a151716e
10 changed files with 269 additions and 356 deletions

View file

@ -5,7 +5,7 @@ import type {
FormAddHistoryEmployee,
FormAddHistoryProject,
} from "@/modules/15_development/interface/request/Main";
import { useDevelopmentDataStoreHistory } from "@/modules/15_development/store/developmentStoreHistory";
import { useDevelopmentDataStore } from "@/modules/15_development/store/developmentStore";
import { useCounterMixin } from "@/stores/mixin";
@ -24,7 +24,7 @@ const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogConfirm, showLoader, hideLoader, messageError, date2Thai } =
mixin;
const store = useDevelopmentDataStoreHistory();
const store = useDevelopmentDataStore();
const modalDialogGov = ref<boolean>(false);
const modalDialogProject = ref<boolean>(false);
@ -88,122 +88,12 @@ const fieldLabelsProject = {
organizingTraining: "หน่วยงานที่รับผิดชอบจัดการอบรม",
};
const visibleColumnsGov = ref<string[]>([
"citizenId",
"name",
"position",
"type",
"level",
"positionSide",
]);
const visibleColumnsProject = ref<string[]>([
"project",
"year",
"organizingTraining",
]);
const columnsGov = ref<QTableProps["columns"]>([
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: true,
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "ชื่อ - นามสกุล",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตําแหน่ง",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "type",
align: "left",
label: "กลุ่มงาน",
sortable: true,
field: "type",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "level",
align: "left",
label: "ระดับชั้นงาน",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const columnsProject = ref<QTableProps["columns"]>([
{
name: "project",
align: "left",
label: "ชื่อโครงการ/กิจกรรม/หลักสูตร",
sortable: true,
field: "project",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "year",
align: "left",
label: "ปีงบประมาณ",
sortable: true,
field: "year",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organizingTraining",
align: "left",
label: "หน่วยงานที่รับผิดชอบ",
sortable: true,
field: "organizingTraining",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/** เปิด dialog ข้าราชการ*/
function openDialogGov() {
store.columns = columnsGov.value;
store.visibleColumns = visibleColumnsGov.value;
modalDialogGov.value = true;
}
/** เปิด dialog โครงการ */
function openDialogProject() {
store.columns = columnsProject.value;
store.visibleColumns = visibleColumnsProject.value;
modalDialogProject.value = true;
}
function getClass() {
return "inputgreen";
}
/** save */
function onSubmit() {
const url = store.status
const url = store.statusEdit
? config.API.developmentHistoryList("employee") + `${id.value}`
: config.API.developmentHistoryAdd("employee");
@ -214,7 +104,7 @@ function onSubmit() {
lastName: formMain.lastName,
citizenId: formMain.citizenId,
position: formMain.position,
// posExecutive:formMain.positionSide,
posExecutive:null,
posLevelId: formMain.posLevelId,
posTypeId: formMain.posTypeId,
@ -224,7 +114,7 @@ function onSubmit() {
};
dialogConfirm($q, () => {
showLoader();
http[store.status ? "put" : "post"](url, body)
http[store.statusEdit ? "put" : "post"](url, body)
.then((res) => {
console.log(res);
router.push(`/development/history`);
@ -274,7 +164,7 @@ function getDataEdit() {
}
onMounted(() => {
if (store.status == true) {
if (store.statusEdit == true) {
console.log(1);
// getDataEdit()
}
@ -293,7 +183,7 @@ onMounted(() => {
@click="router.go(-1)"
/>
<span>{{
store.status
store.statusEdit
? `แก้ไขประวัติฝึกอบรม/ดูงานลูกจ้าง`
: `เพิ่มประวัติฝึกอบรม/ดูงานลูกจ้าง`
}}</span>
@ -311,7 +201,7 @@ onMounted(() => {
color="teal"
label="เลือกลูกจ้าง"
icon="add"
@click="openDialogGov()"
@click="modalDialogGov = true"
/>
</div>
<div class="col-12"><q-separator /></div>
@ -361,7 +251,7 @@ onMounted(() => {
color="teal"
label="เลือกโครงการ"
icon="add"
@click="openDialogProject()"
@click="modalDialogProject = true"
/>
</div>
<div class="col-12"><q-separator /></div>