อัตรากำลังลูกจ้างประจำ ฯ => refactor code
This commit is contained in:
parent
7e2350eef8
commit
81e0a82b0e
18 changed files with 377 additions and 188 deletions
|
|
@ -117,5 +117,5 @@ export default {
|
||||||
* รายการเมนู
|
* รายการเมนู
|
||||||
*/
|
*/
|
||||||
orgPermissions: `${organization}/permission/menu`,
|
orgPermissions: `${organization}/permission/menu`,
|
||||||
|
orgPermissionsSys: `${organization}/permission`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,4 +18,23 @@ interface ChildLevelTree {
|
||||||
[key: string]: ChildConfig[];
|
[key: string]: ChildConfig[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { ListMenu, ChildLevelTree, ChildConfig };
|
interface DataPermissions {
|
||||||
|
id: string;
|
||||||
|
roleDescription: string;
|
||||||
|
roleName: string;
|
||||||
|
roles: DataRoles[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DataRoles {
|
||||||
|
attrIsCreate: boolean;
|
||||||
|
attrIsDelete: boolean;
|
||||||
|
attrIsGet: boolean;
|
||||||
|
attrIsList: boolean;
|
||||||
|
attrIsUpdate: boolean;
|
||||||
|
attrOwnership: string;
|
||||||
|
attrPrivilege: string;
|
||||||
|
authSysId: string;
|
||||||
|
parentNode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type { ListMenu, ChildLevelTree, ChildConfig, DataPermissions };
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import type {
|
||||||
DataOption,
|
DataOption,
|
||||||
FormPositionSelect,
|
FormPositionSelect,
|
||||||
RowDetailPositions,
|
RowDetailPositions,
|
||||||
FormPositionSelectRef,
|
|
||||||
ListMenu,
|
ListMenu,
|
||||||
} from "@/modules/02_organizationalNew/interface/index/Main";
|
} from "@/modules/02_organizationalNew/interface/index/Main";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -114,14 +113,6 @@ const rowsPositionSelect = ref<RowDetailPositions[]>([]);
|
||||||
const prefixNoRef = ref<Object | null>(null);
|
const prefixNoRef = ref<Object | null>(null);
|
||||||
const positionNoRef = ref<Object | null>(null);
|
const positionNoRef = ref<Object | null>(null);
|
||||||
|
|
||||||
const positionNameRef = ref<Object | null>(null);
|
|
||||||
const positionFieldRef = ref<Object | null>(null);
|
|
||||||
const positionTypeRef = ref<Object | null>(null);
|
|
||||||
const positionLevelRef = ref<Object | null>(null);
|
|
||||||
const positionExecutiveRef = ref<Object | null>(null);
|
|
||||||
const positionExecutiveFieldRef = ref<Object | null>(null);
|
|
||||||
const positionAreaRef = ref<Object | null>(null);
|
|
||||||
|
|
||||||
const formData = reactive<FormDataPosition>({
|
const formData = reactive<FormDataPosition>({
|
||||||
shortName: props.shortName,
|
shortName: props.shortName,
|
||||||
prefixNo: "",
|
prefixNo: "",
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ const formData = reactive<FormPositionFilter>({
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ข้อมูลธฟิสำ Table
|
* ข้อมูล Table
|
||||||
*/
|
*/
|
||||||
const row = ref<Position[]>([]);
|
const row = ref<Position[]>([]);
|
||||||
const rowResult = ref<SeaechResult[]>([]);
|
const rowResult = ref<SeaechResult[]>([]);
|
||||||
|
|
@ -403,7 +403,9 @@ function clearPosition() {
|
||||||
formData.positionLevel = "";
|
formData.positionLevel = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** callback function ทำงานเมื่อเปิด popup*/
|
/**
|
||||||
|
* callback function ทำงานเมื่อเปิด popup
|
||||||
|
*/
|
||||||
watch(
|
watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
async () => {
|
async () => {
|
||||||
|
|
@ -439,7 +441,9 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/** callback function ทำงานการค้นหาข้อมุลคนครองเมื่อมีการ update Pagination*/
|
/**
|
||||||
|
* callback function ทำงานการค้นหาข้อมุลคนครองเมื่อมีการ update Pagination
|
||||||
|
*/
|
||||||
watch([() => page.value, () => pageSize.value], () => {
|
watch([() => page.value, () => pageSize.value], () => {
|
||||||
searchData();
|
searchData();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,33 +4,48 @@ import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importType
|
||||||
|
*/
|
||||||
import type {
|
import type {
|
||||||
ResGroup,
|
ResGroup,
|
||||||
ResLevel,
|
ResLevel,
|
||||||
} from "@/modules/01_metadataNew/interface/response/positionEmployee/Main";
|
} from "@/modules/01_metadataNew/interface/response/positionEmployee/Main";
|
||||||
import type { ObjectPosRef } from "@/modules/01_metadataNew/interface/index/positionEmployee";
|
import type { ObjectPosRef } from "@/modules/01_metadataNew/interface/index/positionEmployee";
|
||||||
import type { DataOption } from "@/modules/16_positionEmployee/interface/index/Main";
|
import type { DataOption } from "@/modules/16_positionEmployee/interface/index/Main";
|
||||||
|
|
||||||
import type { OptionType } from "@/modules/16_positionEmployee/interface/response/organizational";
|
import type { OptionType } from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importComponents
|
||||||
|
*/
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importStore
|
||||||
|
*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
const isSpecial = ref<boolean>(false);
|
/**
|
||||||
|
* use
|
||||||
|
*/
|
||||||
|
const $q = useQuasar();
|
||||||
|
const mixin = useCounterMixin();
|
||||||
|
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* props
|
||||||
|
*/
|
||||||
|
const modal = defineModel<boolean>("modalAdd", { required: true });
|
||||||
|
const isEditCheck = defineModel<boolean>("isEdit", { required: true });
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
emitSearch: Function,
|
emitSearch: Function,
|
||||||
getData: Function,
|
getData: Function,
|
||||||
data: Object,
|
data: Object,
|
||||||
levelOp: Object,
|
levelOp: Object,
|
||||||
});
|
});
|
||||||
const modal = defineModel<boolean>("modalAdd", { required: true });
|
|
||||||
const isEditCheck = defineModel<boolean>("isEdit", { required: true });
|
|
||||||
const $q = useQuasar();
|
|
||||||
const mixin = useCounterMixin();
|
|
||||||
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
|
|
||||||
|
|
||||||
const isDisValidate = ref<boolean>(false);
|
const isDisValidate = ref<boolean>(false);
|
||||||
|
const isSpecial = ref<boolean>(false);
|
||||||
const formDataPos = reactive({
|
const formDataPos = reactive({
|
||||||
posName: "",
|
posName: "",
|
||||||
posTypeName: "",
|
posTypeName: "",
|
||||||
|
|
@ -49,7 +64,9 @@ const posTypeMain = ref<ResGroup[]>([]);
|
||||||
const posTypeOp = ref<DataOption[]>([]);
|
const posTypeOp = ref<DataOption[]>([]);
|
||||||
const posLevelOp = ref<DataOption[]>([]);
|
const posLevelOp = ref<DataOption[]>([]);
|
||||||
|
|
||||||
/** ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม */
|
/**
|
||||||
|
* ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม
|
||||||
|
*/
|
||||||
function validateFormPositionEdit() {
|
function validateFormPositionEdit() {
|
||||||
isDisValidate.value = false;
|
isDisValidate.value = false;
|
||||||
const hasError = [];
|
const hasError = [];
|
||||||
|
|
@ -80,9 +97,9 @@ async function submit() {
|
||||||
? config.API.orgEmployeePos
|
? config.API.orgEmployeePos
|
||||||
: config.API.orgEmployeePosById(props?.data?.id);
|
: config.API.orgEmployeePosById(props?.data?.id);
|
||||||
await http[!isEditCheck.value ? "post" : "put"](url, body);
|
await http[!isEditCheck.value ? "post" : "put"](url, body);
|
||||||
success($q, "บันทีกข้อมูลสำเร็จ");
|
await props.emitSearch?.(formDataPos.posName, "positionName");
|
||||||
props.emitSearch?.(formDataPos.posName, "positionName");
|
await success($q, "บันทีกข้อมูลสำเร็จ");
|
||||||
close();
|
await close();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
|
|
@ -4,22 +4,17 @@ import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importType
|
||||||
|
*/
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
FormDataPosition,
|
FormDataPosition,
|
||||||
FormPositionRef,
|
FormPositionRef,
|
||||||
DataOption,
|
DataOption,
|
||||||
FormPositionSelect,
|
|
||||||
RowDetailPositions,
|
RowDetailPositions,
|
||||||
FormPositionSelectRef,
|
|
||||||
ListMenu,
|
ListMenu,
|
||||||
} from "@/modules/16_positionEmployee/interface/index/Main";
|
} from "@/modules/16_positionEmployee/interface/index/Main";
|
||||||
import type {
|
|
||||||
OptionType,
|
|
||||||
OptionLevel,
|
|
||||||
OptionExecutive,
|
|
||||||
DataPosition,
|
|
||||||
} from "@/modules/16_positionEmployee/interface/response/organizational";
|
|
||||||
import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational";
|
import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational";
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
import DialogAddPosition from "@/modules/16_positionEmployee/components/DialogAddPosition.vue";
|
import DialogAddPosition from "@/modules/16_positionEmployee/components/DialogAddPosition.vue";
|
||||||
|
|
@ -705,7 +700,6 @@ watch(
|
||||||
{{ col.value }}
|
{{ col.value }}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
||||||
</q-tr>
|
</q-tr>
|
||||||
</template>
|
</template>
|
||||||
</d-table>
|
</d-table>
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,42 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importType
|
||||||
|
*/
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type { HistoryPos } from "@/modules/16_positionEmployee/interface/response/organizational";
|
import type { HistoryPos } from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importCompoonents
|
||||||
|
*/
|
||||||
import Header from "@/components/DialogHeader.vue";
|
import Header from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* import*Store
|
||||||
|
*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* use
|
||||||
|
*/
|
||||||
const store = usePositionEmp();
|
const store = usePositionEmp();
|
||||||
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* props
|
||||||
|
*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
|
const props = defineProps({
|
||||||
|
rowId: {
|
||||||
|
type: String,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
|
|
@ -73,15 +95,13 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
]);
|
]);
|
||||||
const rows = ref<any[]>([]);
|
const rows = ref<any[]>([]);
|
||||||
|
|
||||||
const props = defineProps({
|
/**
|
||||||
rowId: {
|
* function เรียกข้อมูลประวัติตำแหน่ง
|
||||||
type: String,
|
* @param id
|
||||||
},
|
*/
|
||||||
});
|
function fetchHistoryPos(id: string) {
|
||||||
|
|
||||||
async function fetchHistoryPos(id: string) {
|
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.orgPosHistory(id))
|
.get(config.API.orgPosHistory(id))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data: HistoryPos[] = res.data.result;
|
const data: HistoryPos[] = res.data.result;
|
||||||
|
|
@ -102,6 +122,9 @@ async function fetchHistoryPos(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* callback function ทำงานเมื่อ modal === true
|
||||||
|
*/
|
||||||
watch(
|
watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importType
|
||||||
|
*/
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
OrgTree,
|
OrgTree,
|
||||||
|
|
@ -15,11 +18,20 @@ import type {
|
||||||
} from "@/modules/16_positionEmployee/interface/request/organizational";
|
} from "@/modules/16_positionEmployee/interface/request/organizational";
|
||||||
import type { DataTree } from "@/modules/16_positionEmployee/interface/index/organizational";
|
import type { DataTree } from "@/modules/16_positionEmployee/interface/index/organizational";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importCompoonents
|
||||||
|
*/
|
||||||
import HeaderDialog from "@/components/DialogHeader.vue";
|
import HeaderDialog from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* import*Store
|
||||||
|
*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* use
|
||||||
|
*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = usePositionEmp();
|
const store = usePositionEmp();
|
||||||
const {
|
const {
|
||||||
|
|
@ -31,13 +43,15 @@ const {
|
||||||
success,
|
success,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* props
|
||||||
|
*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
|
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
|
||||||
const totalPage = defineModel<number>("totalPage", { required: true });
|
const totalPage = defineModel<number>("totalPage", { required: true });
|
||||||
const nodeTree = defineModel<OrgTree[]>("nodeTree", { required: true });
|
const nodeTree = defineModel<OrgTree[]>("nodeTree", { required: true });
|
||||||
const columns = defineModel<QTableProps[]>("columns", {});
|
const columns = defineModel<QTableProps[]>("columns", {});
|
||||||
const rows = defineModel<PosMaster2[]>("rows", { required: true });
|
const rows = defineModel<PosMaster2[]>("rows", { required: true });
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
fetchDataTree: {
|
fetchDataTree: {
|
||||||
type: Function,
|
type: Function,
|
||||||
|
|
@ -66,11 +80,17 @@ const levelTree = ref<number>(0);
|
||||||
const filterTable = ref<string>("");
|
const filterTable = ref<string>("");
|
||||||
const selectedFilter = ref<PosMaster2[]>([]);
|
const selectedFilter = ref<PosMaster2[]>([]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function รีเช็ด filter
|
||||||
|
*/
|
||||||
function resetFilter() {
|
function resetFilter() {
|
||||||
filterTree.value = "";
|
filterTree.value = "";
|
||||||
filterRef.value.focus();
|
filterRef.value.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เลือกข้อมูลหน่วยงาน
|
||||||
|
*/
|
||||||
function updateSelected(data: DataTree) {
|
function updateSelected(data: DataTree) {
|
||||||
levelTree.value = data.orgLevel;
|
levelTree.value = data.orgLevel;
|
||||||
selectedTree.value = data.orgTreeId;
|
selectedTree.value = data.orgTreeId;
|
||||||
|
|
@ -82,6 +102,9 @@ const isDisable = computed(() => {
|
||||||
} else return false;
|
} else return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ยืนยันการย้ายแหน่งจากหน่วยงาน/ส่วนราชการปัจจุบัน
|
||||||
|
*/
|
||||||
function onClickMovePos() {
|
function onClickMovePos() {
|
||||||
if (selectedTree.value === "" || selectedTree.value === null) {
|
if (selectedTree.value === "" || selectedTree.value === null) {
|
||||||
dialogMessageNotify($q, "กรุณาเลือกหน่วยงานที่จะย้ายไป");
|
dialogMessageNotify($q, "กรุณาเลือกหน่วยงานที่จะย้ายไป");
|
||||||
|
|
|
||||||
|
|
@ -26,16 +26,6 @@ function close() {
|
||||||
<q-separator />
|
<q-separator />
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<div class="q-px-md">
|
<div class="q-px-md">
|
||||||
<!-- <div class="row q-col-gutter-sm q-mb-xs">
|
|
||||||
<div class="col-4 text-bold">
|
|
||||||
<div>
|
|
||||||
<p>ตำแหน่งเลขที่</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-8 text-grey-8">
|
|
||||||
<p>{{ prosp?.dataDetailPos?.posMasterNo }}</p>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<div class="row q-col-gutter-sm q-mb-xs">
|
<div class="row q-col-gutter-sm q-mb-xs">
|
||||||
<div class="col-4 text-bold">
|
<div class="col-4 text-bold">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
/** importType*/
|
/**
|
||||||
|
* importType
|
||||||
|
*/
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
Position,
|
Position,
|
||||||
|
|
@ -22,14 +24,20 @@ import type {
|
||||||
TypePos,
|
TypePos,
|
||||||
} from "@/modules/16_positionEmployee/interface/response/organizational";
|
} from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||||
|
|
||||||
/** importCompoonents*/
|
/**
|
||||||
|
* importCompoonents
|
||||||
|
*/
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
/** import*Store*/
|
/**
|
||||||
|
* import*Store
|
||||||
|
*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
||||||
|
|
||||||
/** use*/
|
/**
|
||||||
|
* use
|
||||||
|
*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = usePositionEmp();
|
const store = usePositionEmp();
|
||||||
const {
|
const {
|
||||||
|
|
@ -41,7 +49,9 @@ const {
|
||||||
dialogMessageNotify,
|
dialogMessageNotify,
|
||||||
} = useCounterMixin();
|
} = useCounterMixin();
|
||||||
|
|
||||||
/** props*/
|
/**
|
||||||
|
* props
|
||||||
|
*/
|
||||||
const modal = defineModel<boolean>("modal", { required: true });
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
fetchActive: {
|
fetchActive: {
|
||||||
|
|
@ -60,7 +70,6 @@ const props = defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
const isReadonly = ref<boolean>(false); // อ่านได้อย่างเดียว
|
||||||
const isDisValidate = ref<boolean>(false);
|
|
||||||
const typeOpsMain = ref<DataOption[]>([]);
|
const typeOpsMain = ref<DataOption[]>([]);
|
||||||
const levelOpsMain = ref<DataOption[]>([]);
|
const levelOpsMain = ref<DataOption[]>([]);
|
||||||
const typeOps = ref<DataOption[]>([]);
|
const typeOps = ref<DataOption[]>([]);
|
||||||
|
|
@ -78,7 +87,11 @@ const formData = reactive<FormPositionFilter>({
|
||||||
status: "",
|
status: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
/** Table*/
|
/**
|
||||||
|
* ข้อมูล Table
|
||||||
|
*/
|
||||||
|
const row = ref<Position[]>([]);
|
||||||
|
const rowResult = ref<SeaechResult[]>([]);
|
||||||
const visibleColumnsResult = ref<String[]>([
|
const visibleColumnsResult = ref<String[]>([
|
||||||
"no",
|
"no",
|
||||||
"citizenId",
|
"citizenId",
|
||||||
|
|
@ -182,18 +195,20 @@ const columnsResult = ref<QTableProps["columns"]>([
|
||||||
style: "font-size: 14px",
|
style: "font-size: 14px",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const row = ref<Position[]>([]);
|
|
||||||
const rowResult = ref<SeaechResult[]>([]);
|
|
||||||
|
|
||||||
/** function closePopup*/
|
/**
|
||||||
|
* function closePopup
|
||||||
|
*/
|
||||||
function close() {
|
function close() {
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function เรียกข้อมูลประเภทตำแหน่ง*/
|
/**
|
||||||
async function fetchType() {
|
* function เรียกข้อมูลประเภทตำแหน่ง
|
||||||
|
*/
|
||||||
|
function fetchType() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.orgEmployeeType)
|
.get(config.API.orgEmployeeType)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
dataLevel.value = res.data.result;
|
dataLevel.value = res.data.result;
|
||||||
|
|
@ -222,7 +237,9 @@ function inputEdit(val: boolean) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function เรียกข้แมูลระดับตำแหน่ง*/
|
/**
|
||||||
|
* function เรียกข้แมูลระดับตำแหน่ง
|
||||||
|
*/
|
||||||
function updateSelectType(val: string) {
|
function updateSelectType(val: string) {
|
||||||
const listLevel: any = dataLevel.value.find((e: TypePos) => e.id === val);
|
const listLevel: any = dataLevel.value.find((e: TypePos) => e.id === val);
|
||||||
levelOpsMain.value = listLevel?.posLevels.map((e: OptionLevel) => ({
|
levelOpsMain.value = listLevel?.posLevels.map((e: OptionLevel) => ({
|
||||||
|
|
@ -233,7 +250,9 @@ function updateSelectType(val: string) {
|
||||||
formData.positionLevel = "";
|
formData.positionLevel = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม */
|
/**
|
||||||
|
* ฟังก์ชั่นตรวจสอบความถูกต้องของข้อมูลในฟอร์ม
|
||||||
|
*/
|
||||||
function validateForm() {
|
function validateForm() {
|
||||||
if (selected.value.length === 0) {
|
if (selected.value.length === 0) {
|
||||||
dialogMessageNotify($q, "กรุณาเลือกรายการตำแหน่ง");
|
dialogMessageNotify($q, "กรุณาเลือกรายการตำแหน่ง");
|
||||||
|
|
@ -244,7 +263,9 @@ function validateForm() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function ยืนยันการบันทึกข้อมูล */
|
/**
|
||||||
|
* function ยืนยันการบันทึกข้อมูล
|
||||||
|
*/
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -281,8 +302,11 @@ const page = ref<number>(1);
|
||||||
const pageSize = ref<number>(10);
|
const pageSize = ref<number>(10);
|
||||||
const totalPage = ref<number>(0);
|
const totalPage = ref<number>(0);
|
||||||
const selectedProfile = ref<SeaechResult[]>([]);
|
const selectedProfile = ref<SeaechResult[]>([]);
|
||||||
/** functiuon ค้นหาคนครอง */
|
|
||||||
async function searchData() {
|
/**
|
||||||
|
* functiuon ค้นหาคนครอง
|
||||||
|
*/
|
||||||
|
function searchData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
const reqBody = {
|
const reqBody = {
|
||||||
posTypeId: formData.positionType, // id ประเภทตำแหน่ง
|
posTypeId: formData.positionType, // id ประเภทตำแหน่ง
|
||||||
|
|
@ -292,7 +316,7 @@ async function searchData() {
|
||||||
pageSize: pageSize.value, //*จำนวนแถวต่อหน้า
|
pageSize: pageSize.value, //*จำนวนแถวต่อหน้า
|
||||||
keyword: formData.personal, //นามสกุล ชื่อ สกุล เลขบัตร
|
keyword: formData.personal, //นามสกุล ชื่อ สกุล เลขบัตร
|
||||||
};
|
};
|
||||||
await http
|
http
|
||||||
.post(config.API.orgSearchProfileEmp, reqBody)
|
.post(config.API.orgSearchProfileEmp, reqBody)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
totalPage.value = Math.ceil(res.data.result.total / pageSize.value);
|
totalPage.value = Math.ceil(res.data.result.total / pageSize.value);
|
||||||
|
|
@ -315,13 +339,17 @@ async function searchData() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function update PageSize*/
|
/**
|
||||||
|
* function update PageSize
|
||||||
|
*/
|
||||||
function updatePagination(newPagination: NewPagination) {
|
function updatePagination(newPagination: NewPagination) {
|
||||||
pageSize.value = newPagination.rowsPerPage;
|
pageSize.value = newPagination.rowsPerPage;
|
||||||
page.value = 1;
|
page.value = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function เคลียร์Form*/
|
/**
|
||||||
|
* function เคลียร์Form
|
||||||
|
*/
|
||||||
function clearForm() {
|
function clearForm() {
|
||||||
formData.positionType = "";
|
formData.positionType = "";
|
||||||
formData.positionLevel = "";
|
formData.positionLevel = "";
|
||||||
|
|
@ -334,13 +362,17 @@ function clearForm() {
|
||||||
isSit.value = false;
|
isSit.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function เคลียร์ตำแหน่ง*/
|
/**
|
||||||
|
* function เคลียร์ตำแหน่ง
|
||||||
|
*/
|
||||||
function clearPosition() {
|
function clearPosition() {
|
||||||
formData.positionType = "";
|
formData.positionType = "";
|
||||||
formData.positionLevel = "";
|
formData.positionLevel = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** callback function ทำงานเมื่อเปิด popup*/
|
/**
|
||||||
|
* callback function ทำงานเมื่อเปิด popup
|
||||||
|
*/
|
||||||
watch(
|
watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
async () => {
|
async () => {
|
||||||
|
|
@ -376,7 +408,9 @@ watch(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/** callback function ทำงานการค้นหาข้อมุลคนครองเมื่อมีการ update Pagination*/
|
/**
|
||||||
|
* callback function ทำงานการค้นหาข้อมุลคนครองเมื่อมีการ update Pagination
|
||||||
|
*/
|
||||||
watch([() => page.value, () => pageSize.value], () => {
|
watch([() => page.value, () => pageSize.value], () => {
|
||||||
searchData();
|
searchData();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,42 @@ import { ref, watch, defineProps } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import type { QTableProps } from "quasar";
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importType
|
||||||
|
*/
|
||||||
|
import type { QTableProps } from "quasar";
|
||||||
|
import type { DataSortPos } from "@/modules/02_organizationalNew/interface/index/organizational";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importComponents
|
||||||
|
*/
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* importStore
|
||||||
|
*/
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* use
|
||||||
|
*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = usePositionEmp();
|
const store = usePositionEmp();
|
||||||
const { dialogConfirm, showLoader, success, hideLoader, messageError } =
|
const { dialogConfirm, showLoader, success, hideLoader, messageError } =
|
||||||
useCounterMixin();
|
useCounterMixin();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* props
|
||||||
|
*/
|
||||||
const modal = defineModel<boolean>("sortPosition", { required: true });
|
const modal = defineModel<boolean>("sortPosition", { required: true });
|
||||||
const rows = ref<any[]>([]);
|
const props = defineProps({
|
||||||
|
fetchDataTable: Function,
|
||||||
|
});
|
||||||
|
|
||||||
|
/** ข้อมูล Table*/
|
||||||
|
const rows = ref<DataSortPos[]>([]);
|
||||||
const columns = ref<QTableProps["columns"]>([
|
const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "name",
|
name: "name",
|
||||||
|
|
@ -28,22 +50,22 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const props = defineProps({
|
/**
|
||||||
fetchDataTable: Function,
|
* fiunction จัดลำดับ
|
||||||
});
|
* @param from ตำแหน่งปัจุบัน
|
||||||
|
* @param to ตำแหน่งที่จะย้ายไป
|
||||||
function onDrop(from: any, to: any) {
|
*/
|
||||||
onDropRow(from, to);
|
function onDrop(from: number, to: number) {
|
||||||
}
|
|
||||||
|
|
||||||
function onDropRow(from: any, to: any) {
|
|
||||||
rows.value.splice(to, 0, rows.value.splice(from, 1)[0]);
|
rows.value.splice(to, 0, rows.value.splice(from, 1)[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function บันทึกการจัดลำดับ
|
||||||
|
*/
|
||||||
function save() {
|
function save() {
|
||||||
dialogConfirm($q, () => {
|
dialogConfirm($q, () => {
|
||||||
const data = rows.value;
|
const data = rows.value;
|
||||||
const dataId = data.map((item: any) => item.id);
|
const dataId = data.map((item: DataSortPos) => item.id);
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
.post(config.API.orgPosSortEmp, {
|
.post(config.API.orgPosSortEmp, {
|
||||||
|
|
@ -51,10 +73,10 @@ function save() {
|
||||||
type: store.level,
|
type: store.level,
|
||||||
sortId: dataId,
|
sortId: dataId,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async () => {
|
||||||
|
await props.fetchDataTable?.(store.treeId, store.level, false);
|
||||||
|
await success($q, "บันทึกข้อมูลสำเร็จ");
|
||||||
modal.value = false;
|
modal.value = false;
|
||||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
|
||||||
props.fetchDataTable?.(store.treeId, store.level, false);
|
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
|
|
@ -65,6 +87,9 @@ function save() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เรียกรายการข้อมูลตำแหน่ง
|
||||||
|
*/
|
||||||
function getData() {
|
function getData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -79,6 +104,7 @@ function getData() {
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const dataList = res.data.result.data;
|
const dataList = res.data.result.data;
|
||||||
|
|
||||||
const dataMap = dataList.map((item: any) => ({
|
const dataMap = dataList.map((item: any) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: `${item.orgShortname}${
|
name: `${item.orgShortname}${
|
||||||
|
|
@ -100,6 +126,9 @@ function getData() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* callback function ทำงานเมื่อ modal = true ทำการเรียกข้อมูลตำแหน่ง
|
||||||
|
*/
|
||||||
watch(
|
watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ const selectedTree = ref<string>("");
|
||||||
const filterRef = ref();
|
const filterRef = ref();
|
||||||
const levelTree = ref<number>(0);
|
const levelTree = ref<number>(0);
|
||||||
|
|
||||||
/** function เรียกข้อมูล Tree แบบ ปัจจุบัน*/
|
/**
|
||||||
|
* function เรียกข้อมูล Tree แบบ ปัจจุบัน
|
||||||
|
*/
|
||||||
async function fetchTree() {
|
async function fetchTree() {
|
||||||
showLoader();
|
showLoader();
|
||||||
const id: string = store.activeId ? store.activeId?.toString() : "";
|
const id: string = store.activeId ? store.activeId?.toString() : "";
|
||||||
|
|
@ -66,16 +68,20 @@ async function fetchTree() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** resetFilterTree*/
|
/**
|
||||||
|
* resetFilterTree
|
||||||
|
*/
|
||||||
function resetFilter() {
|
function resetFilter() {
|
||||||
filterTree.value = "";
|
filterTree.value = "";
|
||||||
filterRef.value.focus();
|
filterRef.value.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function เลือกหน่วยงาน*/
|
/**
|
||||||
|
* function เลือกหน่วยงาน
|
||||||
|
*/
|
||||||
async function updateSelected(data: DataTree) {
|
async function updateSelected(data: DataTree) {
|
||||||
levelTree.value = data.orgLevel;
|
levelTree.value = await data.orgLevel;
|
||||||
selectedTree.value = data.orgTreeId;
|
selectedTree.value = await data.orgTreeId;
|
||||||
reqMaster.id = await data.orgTreeId;
|
reqMaster.id = await data.orgTreeId;
|
||||||
reqMaster.type = await data.orgLevel;
|
reqMaster.type = await data.orgLevel;
|
||||||
await fetchTable();
|
await fetchTable();
|
||||||
|
|
@ -116,7 +122,9 @@ const reqMaster = reactive<FilterMaster>({
|
||||||
const totalRow = ref<number>(0);
|
const totalRow = ref<number>(0);
|
||||||
const selectedPos = ref<PosMaster[]>([]);
|
const selectedPos = ref<PosMaster[]>([]);
|
||||||
|
|
||||||
/** function เรียกข้อมูล Table Position*/
|
/**
|
||||||
|
* function เรียกข้อมูล Table Position
|
||||||
|
*/
|
||||||
async function fetchTable() {
|
async function fetchTable() {
|
||||||
selectedPos.value = [];
|
selectedPos.value = [];
|
||||||
await http
|
await http
|
||||||
|
|
@ -148,13 +156,17 @@ function updatePagination(newPagination: NewPagination) {
|
||||||
reqMaster.page = 1;
|
reqMaster.page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** funcion ค้นหาข้อมูลใน Table*/
|
/**
|
||||||
|
funcion ค้นหาข้อมูลใน Table
|
||||||
|
*/
|
||||||
async function filterKeyword() {
|
async function filterKeyword() {
|
||||||
reqMaster.page = 1;
|
reqMaster.page = await 1;
|
||||||
fetchTable();
|
await fetchTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function ยืนยันกาสืบทอดตำแหน่ง */
|
/**
|
||||||
|
* function ยืนยันกาสืบทอดตำแหน่ง
|
||||||
|
*/
|
||||||
function onClickConfirm() {
|
function onClickConfirm() {
|
||||||
if (selectedPos.value.length === 0) {
|
if (selectedPos.value.length === 0) {
|
||||||
dialogMessageNotify($q, "กรุณาเลือกตำแหน่งสืบทอด");
|
dialogMessageNotify($q, "กรุณาเลือกตำแหน่งสืบทอด");
|
||||||
|
|
@ -186,20 +198,26 @@ function onClickConfirm() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** callblck function ทำการ fetch ข้อมูล tree เมื่อเปิด popup*/
|
/**
|
||||||
|
* callblck function ทำการ fetch ข้อมูล tree เมื่อเปิด popup
|
||||||
|
*/
|
||||||
watch(
|
watch(
|
||||||
() => modal.value,
|
() => modal.value,
|
||||||
async () => {
|
() => {
|
||||||
modal.value ? await fetchTree() : clearForm();
|
modal.value ? fetchTree() : clearForm();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
|
/**
|
||||||
|
* callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า
|
||||||
|
*/
|
||||||
watch([() => reqMaster.page, () => reqMaster.pageSize], async () => {
|
watch([() => reqMaster.page, () => reqMaster.pageSize], async () => {
|
||||||
await fetchTable();
|
await fetchTable();
|
||||||
});
|
});
|
||||||
|
|
||||||
/** function clear ข้อมูล*/
|
/**
|
||||||
|
* function clear ข้อมูล
|
||||||
|
*/
|
||||||
function clearForm() {
|
function clearForm() {
|
||||||
nodeTree.value = [];
|
nodeTree.value = [];
|
||||||
rows.value = [];
|
rows.value = [];
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
|
|
||||||
/** importType*/
|
/** importType*/
|
||||||
|
|
||||||
import type { OrgTree } from "@/modules/16_positionEmployee/interface/response/organizational";
|
import type { OrgTree } from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||||
import type { DataTree } from "@/modules/16_positionEmployee/interface/index/organizational";
|
import type { DataTree } from "@/modules/16_positionEmployee/interface/index/organizational";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,21 @@ import config from "@/app.config";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import genreport from "@/plugins/genreportxlsx";
|
import genreport from "@/plugins/genreportxlsx";
|
||||||
|
|
||||||
/** importType*/
|
/**
|
||||||
|
* importType
|
||||||
|
*/
|
||||||
import type { QTableProps } from "quasar";
|
import type { QTableProps } from "quasar";
|
||||||
import type {
|
import type {
|
||||||
ListMenu,
|
ListMenu,
|
||||||
NewPagination,
|
NewPagination,
|
||||||
} from "@/modules/16_positionEmployee/interface/index/Main";
|
} from "@/modules/16_positionEmployee/interface/index/Main";
|
||||||
import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational";
|
import type { FilterMaster } from "@/modules/16_positionEmployee/interface/request/organizational";
|
||||||
import type {
|
import type { PosMaster2 } from "@/modules/16_positionEmployee/interface/response/organizational";
|
||||||
PosMaster2,
|
|
||||||
OrgTree,
|
|
||||||
} from "@/modules/16_positionEmployee/interface/response/organizational";
|
|
||||||
import type { DataPosition } from "@/modules/16_positionEmployee/interface/index/organizational";
|
import type { DataPosition } from "@/modules/16_positionEmployee/interface/index/organizational";
|
||||||
|
|
||||||
/** importComponents*/
|
/**
|
||||||
|
* importComponents
|
||||||
|
*/
|
||||||
import DialogFormPosotion from "@/modules/16_positionEmployee/components/DialogFormPosition.vue";
|
import DialogFormPosotion from "@/modules/16_positionEmployee/components/DialogFormPosition.vue";
|
||||||
import DialogPositionDetail from "@/modules/16_positionEmployee/components/DialogPositionDetail.vue";
|
import DialogPositionDetail from "@/modules/16_positionEmployee/components/DialogPositionDetail.vue";
|
||||||
import DialogSort from "@/modules/16_positionEmployee/components/DialogSortPosition.vue";
|
import DialogSort from "@/modules/16_positionEmployee/components/DialogSortPosition.vue";
|
||||||
|
|
@ -27,23 +28,29 @@ import DialogHistoryPos from "@/modules/16_positionEmployee/components/DialogHis
|
||||||
import DialogSelectPerson from "@/modules/16_positionEmployee/components/DialogSelectPerson.vue";
|
import DialogSelectPerson from "@/modules/16_positionEmployee/components/DialogSelectPerson.vue";
|
||||||
import DialogSuccession from "@/modules/16_positionEmployee/components/DialogSuccession.vue";
|
import DialogSuccession from "@/modules/16_positionEmployee/components/DialogSuccession.vue";
|
||||||
|
|
||||||
/** importStore*/
|
/**
|
||||||
|
* importStore
|
||||||
|
*/
|
||||||
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
import { usePositionEmp } from "@/modules/16_positionEmployee/store/organizational";
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ues
|
||||||
|
*/
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const store = usePositionEmp();
|
const store = usePositionEmp();
|
||||||
const { showLoader, hideLoader, messageError, success, dialogRemove } =
|
const { showLoader, hideLoader, messageError, success, dialogRemove } =
|
||||||
useCounterMixin();
|
useCounterMixin();
|
||||||
|
|
||||||
/** prosp*/
|
/**
|
||||||
|
* prosp
|
||||||
|
*/
|
||||||
const nodeTree = defineModel<any>("nodeTree", { required: true });
|
const nodeTree = defineModel<any>("nodeTree", { required: true });
|
||||||
const orgLevel = defineModel<number>("orgLevel", { required: true });
|
const orgLevel = defineModel<number>("orgLevel", { required: true });
|
||||||
const treeId = defineModel<string>("treeId", { required: true });
|
const treeId = defineModel<string>("treeId", { required: true });
|
||||||
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
|
const reqMaster = defineModel<FilterMaster>("reqMaster", { required: true });
|
||||||
const totalPage = defineModel<number>("totalPage", { required: true });
|
const totalPage = defineModel<number>("totalPage", { required: true });
|
||||||
const posMaster = defineModel<PosMaster2[]>("posMaster", { required: true });
|
const posMaster = defineModel<PosMaster2[]>("posMaster", { required: true });
|
||||||
// const shortName = defineModel<string>("shortName", { required: true });
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
filterKeyword: { type: Function, require: true, default: () => {} },
|
filterKeyword: { type: Function, require: true, default: () => {} },
|
||||||
fetchDataTable: {
|
fetchDataTable: {
|
||||||
|
|
@ -63,7 +70,17 @@ const props = defineProps({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const modalSelectPerson = ref<boolean>(false);
|
/**
|
||||||
|
* modal popup
|
||||||
|
*/
|
||||||
|
const dialogDetail = ref<boolean>(false); // รายละเอียดตำแหน่ง
|
||||||
|
const modalSelectPerson = ref<boolean>(false); // เลือกคนครอง
|
||||||
|
const dialogPosition = ref<boolean>(false); // อัตรากำลัง
|
||||||
|
const modalSort = ref<boolean>(false); // จัดลำดับ
|
||||||
|
const modalDialogMMove = ref<boolean>(false); // ย้ายตำแหน่ง
|
||||||
|
const modalDialogSuccession = ref<boolean>(false); // สืบทอดตำแหน่ง
|
||||||
|
const modalDialogHistoryPos = ref<boolean>(false); // ประวัติตำแหน่ง
|
||||||
|
|
||||||
const rowId = ref<string>("");
|
const rowId = ref<string>("");
|
||||||
const actionType = ref<string>("");
|
const actionType = ref<string>("");
|
||||||
/** ListMenu Table*/
|
/** ListMenu Table*/
|
||||||
|
|
@ -86,32 +103,6 @@ const listMenu = ref<ListMenu[]>([
|
||||||
type: "MOVE",
|
type: "MOVE",
|
||||||
color: "blue-10",
|
color: "blue-10",
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// label: "สืบทอดตำแหน่ง",
|
|
||||||
// icon: "mdi-account-multiple-outline",
|
|
||||||
// type: "INHERIT",
|
|
||||||
// color: "deep-orange",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: "ประวัติตำแหน่ง",
|
|
||||||
// icon: "history",
|
|
||||||
// type: "HISTORY",
|
|
||||||
// color: "deep-purple",
|
|
||||||
// },
|
|
||||||
]);
|
|
||||||
const document = ref<any>([
|
|
||||||
{
|
|
||||||
name: "บัญชี 1",
|
|
||||||
val: "report1",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "บัญชี 2",
|
|
||||||
val: "report2",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "บัญชี 3",
|
|
||||||
val: "report3",
|
|
||||||
},
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/** columns*/
|
/** columns*/
|
||||||
|
|
@ -172,7 +163,6 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const dialogPosition = ref<boolean>(false);
|
|
||||||
/**
|
/**
|
||||||
* function openPopup เพิ่มอัตรากำลัง
|
* function openPopup เพิ่มอัตรากำลัง
|
||||||
* @param type ประเภท
|
* @param type ประเภท
|
||||||
|
|
@ -184,7 +174,6 @@ function onClickPosition(type: string, id: string) {
|
||||||
dialogPosition.value = !dialogPosition.value;
|
dialogPosition.value = !dialogPosition.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dialogDetail = ref<boolean>(false);
|
|
||||||
const dataDetailPos = ref<DataPosition[]>([]);
|
const dataDetailPos = ref<DataPosition[]>([]);
|
||||||
/**
|
/**
|
||||||
* function ดูรายละเอียดประวัติตำแหน่ง
|
* function ดูรายละเอียดประวัติตำแหน่ง
|
||||||
|
|
@ -218,13 +207,13 @@ function onClickDelete(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const modalSort = ref<boolean>(false);
|
/**
|
||||||
/** fdunction จัดลำดับตำแหน่ง */
|
* fdunction จัดลำดับตำแหน่ง
|
||||||
|
*/
|
||||||
function onClickSort() {
|
function onClickSort() {
|
||||||
modalSort.value = true;
|
modalSort.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modalDialogMMove = ref<boolean>(false);
|
|
||||||
const typeMove = ref<string>("");
|
const typeMove = ref<string>("");
|
||||||
/**
|
/**
|
||||||
* function openPopup ย้ายตำแหน่ง
|
* function openPopup ย้ายตำแหน่ง
|
||||||
|
|
@ -237,7 +226,6 @@ function onClickMovePos(id: string, type: string) {
|
||||||
rowId.value = id;
|
rowId.value = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modalDialogHistoryPos = ref<boolean>(false);
|
|
||||||
/**
|
/**
|
||||||
* function ดูประวัติตำแหน่ง
|
* function ดูประวัติตำแหน่ง
|
||||||
* @param id ID ตำแหน่ง
|
* @param id ID ตำแหน่ง
|
||||||
|
|
@ -256,13 +244,17 @@ function updatePagination(newPagination: NewPagination) {
|
||||||
reqMaster.value.page = 1;
|
reqMaster.value.page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function openPopup เลือกตนครอง*/
|
/**
|
||||||
|
* function openPopup เลือกตนครอง
|
||||||
|
*/
|
||||||
function openSelectPerson(data: DataPosition[]) {
|
function openSelectPerson(data: DataPosition[]) {
|
||||||
modalSelectPerson.value = true;
|
modalSelectPerson.value = true;
|
||||||
dataDetailPos.value = data;
|
dataDetailPos.value = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ลบคนครอง */
|
/**
|
||||||
|
* ลบคนครอง
|
||||||
|
*/
|
||||||
function removePerson(id: string) {
|
function removePerson(id: string) {
|
||||||
dialogRemove(
|
dialogRemove(
|
||||||
$q,
|
$q,
|
||||||
|
|
@ -291,14 +283,17 @@ function removePerson(id: string) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const modalDialogSuccession = ref<boolean>(false);
|
/**
|
||||||
/** function openPopup สืบทอดตำแหน่ง*/
|
* function openPopup สืบทอดตำแหน่ง
|
||||||
|
*/
|
||||||
function onClickInherit(id: string) {
|
function onClickInherit(id: string) {
|
||||||
modalDialogSuccession.value = !modalDialogSuccession.value;
|
modalDialogSuccession.value = !modalDialogSuccession.value;
|
||||||
rowId.value = id;
|
rowId.value = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ดึงข้อมูลสถิติจำนวนด้านบน*/
|
/**
|
||||||
|
* ดึงข้อมูลสถิติจำนวนด้านบน
|
||||||
|
*/
|
||||||
function getSummary() {
|
function getSummary() {
|
||||||
showLoader();
|
showLoader();
|
||||||
http
|
http
|
||||||
|
|
@ -331,22 +326,6 @@ function getSummary() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function DownloadReport*/
|
|
||||||
async function onClickDownloadReport(val: string, name: string) {
|
|
||||||
showLoader();
|
|
||||||
await http
|
|
||||||
.get(config.API.orgReportEmp(val))
|
|
||||||
.then((res) => {
|
|
||||||
const data = res.data.result;
|
|
||||||
if (data) {
|
|
||||||
genreport(data, name);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
messageError($q, err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const pagination = ref({
|
const pagination = ref({
|
||||||
page: reqMaster.value.page,
|
page: reqMaster.value.page,
|
||||||
rowsPerPage: reqMaster.value.pageSize,
|
rowsPerPage: reqMaster.value.pageSize,
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,12 @@ const store = usePositionEmp();
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
|
||||||
const nodeTree = ref<OrgTree[]>(); // ข้อมูล Tree
|
const nodeTree = ref<OrgTree[]>([]); // ข้อมูล Tree
|
||||||
const nodeId = ref<string>(""); // id ของ Tree
|
const nodeId = ref<string>(""); // id ของ Tree
|
||||||
const orgLevel = ref<number>(0); // levelTree
|
const orgLevel = ref<number>(0); // levelTree
|
||||||
const isLoad = ref<boolean>(false); // loadTable
|
const isLoad = ref<boolean>(false); // loadTable
|
||||||
const isLoadTree = ref<boolean>(false); // loadTable
|
const isLoadTree = ref<boolean>(false); // loadTable
|
||||||
const mainTree = ref<OrgTree>();
|
const mainTree = ref<OrgTree>();
|
||||||
|
|
||||||
const selected = ref<string>("");
|
const selected = ref<string>("");
|
||||||
|
|
||||||
const reqMaster = reactive<FilterMaster>({
|
const reqMaster = reactive<FilterMaster>({
|
||||||
|
|
@ -53,10 +52,10 @@ const shortName = ref<string>("");
|
||||||
* function fetch ข้อมูลของ Tree
|
* function fetch ข้อมูลของ Tree
|
||||||
* @param id id โครงสร้าง
|
* @param id id โครงสร้าง
|
||||||
*/
|
*/
|
||||||
async function fetchDataTree(id: string) {
|
function fetchDataTree(id: string) {
|
||||||
isLoadTree.value = false;
|
isLoadTree.value = false;
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
http
|
||||||
.get(config.API.orgByid(id.toString()))
|
.get(config.API.orgByid(id.toString()))
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
|
|
@ -78,9 +77,8 @@ async function fetchDataTree(id: string) {
|
||||||
* @param id idTree
|
* @param id idTree
|
||||||
* @param level levelTree
|
* @param level levelTree
|
||||||
*/
|
*/
|
||||||
async function fetchDataTable(id: string, level: number, action: boolean) {
|
function fetchDataTable(id: string, level: number, action: boolean) {
|
||||||
searchAndReplaceOrgName(nodeTree.value, id);
|
searchAndReplaceOrgName(nodeTree.value, id);
|
||||||
|
|
||||||
orgLevel.value = level;
|
orgLevel.value = level;
|
||||||
reqMaster.id = id;
|
reqMaster.id = id;
|
||||||
reqMaster.type = level;
|
reqMaster.type = level;
|
||||||
|
|
@ -99,7 +97,7 @@ async function fetchDataTable(id: string, level: number, action: boolean) {
|
||||||
if (action === true) {
|
if (action === true) {
|
||||||
isLoad.value = true;
|
isLoad.value = true;
|
||||||
}
|
}
|
||||||
await http
|
http
|
||||||
.post(config.API.orgPosMasterListEmp, reqMaster)
|
.post(config.API.orgPosMasterListEmp, reqMaster)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
posMaster.value = [];
|
posMaster.value = [];
|
||||||
|
|
@ -127,7 +125,9 @@ async function fetchDataTable(id: string, level: number, action: boolean) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ดึงข้อมูลสถิติจำนวนด้านบน*/
|
/**
|
||||||
|
* ดึงข้อมูลสถิติจำนวนด้านบน
|
||||||
|
*/
|
||||||
function getSummary() {
|
function getSummary() {
|
||||||
http
|
http
|
||||||
.post(config.API.orgSummaryEmp, {
|
.post(config.API.orgSummaryEmp, {
|
||||||
|
|
@ -152,13 +152,20 @@ function getSummary() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** funcion ค้นหาข้อมูลใน Table*/
|
/**
|
||||||
async function filterKeyword() {
|
* funcion ค้นหาข้อมูลใน Table
|
||||||
|
*/
|
||||||
|
function filterKeyword() {
|
||||||
reqMaster.page = 1;
|
reqMaster.page = 1;
|
||||||
action1.value === false &&
|
action1.value === false &&
|
||||||
fetchDataTable(reqMaster.id, reqMaster.type, false);
|
fetchDataTable(reqMaster.id, reqMaster.type, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function ค้นหาชือ
|
||||||
|
* @param data ข้อมูล Tree
|
||||||
|
* @param targetId tree
|
||||||
|
*/
|
||||||
function searchAndReplaceOrgName(data: any, targetId: string) {
|
function searchAndReplaceOrgName(data: any, targetId: string) {
|
||||||
for (const child of data) {
|
for (const child of data) {
|
||||||
if (child.orgTreeId === targetId) {
|
if (child.orgTreeId === targetId) {
|
||||||
|
|
@ -173,20 +180,26 @@ function searchAndReplaceOrgName(data: any, targetId: string) {
|
||||||
return false; // Not found in this branch
|
return false; // Not found in this branch
|
||||||
}
|
}
|
||||||
|
|
||||||
/**lifecycle Hook*/
|
/**
|
||||||
|
* lifecycle Hook
|
||||||
|
*/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
store.activeId && (await fetchDataTree(store.activeId));
|
store.activeId && (await fetchDataTree(store.activeId));
|
||||||
}, 200);
|
}, 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า*/
|
/**
|
||||||
|
* callblck function ทำการ fetch ข้อมูล Table เมื่อมีการเปลี่ยนหน้า
|
||||||
|
*/
|
||||||
watch([() => reqMaster.page, () => reqMaster.pageSize], () => {
|
watch([() => reqMaster.page, () => reqMaster.pageSize], () => {
|
||||||
action1.value === false &&
|
action1.value === false &&
|
||||||
fetchDataTable(reqMaster.id, reqMaster.type, false);
|
fetchDataTable(reqMaster.id, reqMaster.type, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
/** callblck function ทำการ fetch ข้อมูล Table เมื่อแสดงตำแหน่งทั้งหมด*/
|
/**
|
||||||
|
* callblck function ทำการ fetch ข้อมูล Table เมื่อแสดงตำแหน่งทั้งหมด
|
||||||
|
*/
|
||||||
watch(
|
watch(
|
||||||
() => reqMaster.isAll,
|
() => reqMaster.isAll,
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,24 @@ interface FormPositionFilter {
|
||||||
status: string;
|
status: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DataSortPos {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
posMasterNo: number;
|
||||||
|
posMasterNoPrefix: string;
|
||||||
|
posMasterNoSuffix: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DataSortAgency {
|
||||||
|
name: string;
|
||||||
|
orgLevel: number;
|
||||||
|
orgRevisionId: string;
|
||||||
|
orgRootId: string;
|
||||||
|
orgTreeId: string;
|
||||||
|
orgTreeName: string;
|
||||||
|
orgTreeShortName: string;
|
||||||
|
}
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
DataPosition,
|
DataPosition,
|
||||||
Position,
|
Position,
|
||||||
|
|
@ -104,4 +122,6 @@ export type {
|
||||||
DataTree,
|
DataTree,
|
||||||
SeaechResult,
|
SeaechResult,
|
||||||
FormPositionFilter,
|
FormPositionFilter,
|
||||||
|
DataSortPos,
|
||||||
|
DataSortAgency,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,16 @@ import { defineStore } from "pinia";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* importType
|
* importType
|
||||||
*/
|
*/
|
||||||
import type { ListMenu, ChildLevelTree } from "@/interface/response/main";
|
import type {
|
||||||
|
ListMenu,
|
||||||
|
ChildLevelTree,
|
||||||
|
DataPermissions,
|
||||||
|
} from "@/interface/response/main";
|
||||||
|
|
||||||
export const useMenuDataStore = defineStore("menuUse", () => {
|
export const useMenuDataStore = defineStore("menuUse", () => {
|
||||||
|
/****************** เมนู **************************/
|
||||||
/** รายการเมนู*/
|
/** รายการเมนู*/
|
||||||
const menuList = ref<ListMenu[]>([
|
const menuList = ref<ListMenu[]>([
|
||||||
{
|
{
|
||||||
|
|
@ -113,8 +118,23 @@ export const useMenuDataStore = defineStore("menuUse", () => {
|
||||||
menuList.value.push(...data);
|
menuList.value.push(...data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************** สิทธิ์ **************************/
|
||||||
|
const dataPermissions = ref<DataPermissions>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function เรียก
|
||||||
|
* @param data ข้อมูลสิทธิ์
|
||||||
|
*/
|
||||||
|
function fetchDataPermission(data: DataPermissions) {
|
||||||
|
dataPermissions.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
/****************** เมนู **************************/
|
||||||
fetchListMenu,
|
fetchListMenu,
|
||||||
menuList,
|
menuList,
|
||||||
|
/****************** สิทธิ์ **************************/
|
||||||
|
fetchDataPermission,
|
||||||
|
dataPermissions,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -233,6 +233,7 @@ const activeBtn = () => {
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchSys();
|
await fetchSys();
|
||||||
|
await fetchPermissionsSys();
|
||||||
|
|
||||||
if (keycloak.tokenParsed) {
|
if (keycloak.tokenParsed) {
|
||||||
await fetchroleUser(keycloak.tokenParsed.role);
|
await fetchroleUser(keycloak.tokenParsed.role);
|
||||||
|
|
@ -518,6 +519,21 @@ function fetchSys() {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function fetch รายการเมนูทั้งหมด
|
||||||
|
*/
|
||||||
|
function fetchPermissionsSys() {
|
||||||
|
http
|
||||||
|
.get(config.API.orgPermissionsSys)
|
||||||
|
.then((res) => {
|
||||||
|
|
||||||
|
storeMenu.fetchDataPermission(res.data.result)
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- โครงเว็บ -->
|
<!-- โครงเว็บ -->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue