เพิม interface row

This commit is contained in:
setthawutttty 2023-09-22 11:16:25 +07:00
parent c42400e57c
commit d94531204a
12 changed files with 99 additions and 133 deletions

View file

@ -19,7 +19,15 @@ const myFormPosition = ref<any>();
const selected = ref<string>("");
const selectedFile = ref<string>("");
const dataRespone = ref<any>();
const personal = ref<any>();
const expanded = ref<string[]>([]);
const treeData = ref<Array<any>>([]);
const placementPosition = ref<any>([]);
const search = ref<string>("");
const filterRef = ref<any>(null);
const id = ref<string>("");
const editDataStatus = ref<boolean>(false);
// Set form field
let dataForm = reactive({
personalId: "",
@ -53,7 +61,7 @@ const fetchPublishFile = async () => {
};
// json
const treeData = ref<Array<any>>([]);
const loadTreeData = async () => {
expanded.value = [];
await http
@ -75,7 +83,6 @@ const loadTreeData = async () => {
};
function filterByPersonIdNull(obj: any) {
// console.log(obj);
if (obj.name === null && obj.isCondition != true) {
return true;
}
@ -87,7 +94,7 @@ function filterByPersonIdNull(obj: any) {
}
// position
const placementPosition = ref<any>([]);
const fetchplacementPosition = async () => {
await http
.get(config.API.apppointmentPosition())
@ -99,13 +106,7 @@ const fetchplacementPosition = async () => {
});
};
const search = ref<string>("");
//reset Tree Filter
const filterRef = ref<any>(null);
// const resetFilter = () => {
// search.value = "";
// filterRef.value.focus();
// };
const props = defineProps({
personalId: String,
@ -121,23 +122,19 @@ const myFilterMethod = (node: any, filter: string) => {
const filt = filter;
return (
// ((node.name && node.name == null) || !node.name) &&
(node.name && node.name.indexOf(filt) > -1) ||
(node.organizationName && node.organizationName.indexOf(filt) > -1) ||
(node.positionNum && node.positionNum.indexOf(filt) > -1) ||
(node.positionName && node.positionName.indexOf(filt) > -1) ||
(node.governmentCode &&
node.governmentCode.toString().indexOf(filt) > -1) ||
(node.governmentCode && node.governmentCode.toString().indexOf(filt) > -1) ||
(node.agency && node.agency.indexOf(filt) > -1) ||
(node.government && node.government.indexOf(filt) > -1) ||
(node.department && node.department.indexOf(filt) > -1) ||
(node.pile && node.pile.indexOf(filt) > -1) ||
(node.organizationShortName &&
node.organizationShortName.indexOf(filt) > -1) ||
(node.organizationShortName && node.organizationShortName.indexOf(filt) > -1) ||
(node.positionSideName && node.positionSideName.indexOf(filt) > -1) ||
(node.executivePosition && node.executivePosition.indexOf(filt) > -1) ||
(node.executivePositionSide &&
node.executivePositionSide.indexOf(filt) > -1) ||
(node.executivePositionSide && node.executivePositionSide.indexOf(filt) > -1) ||
(node.positionLevel && node.positionLevel.indexOf(filt) > -1)
);
};
@ -150,17 +147,14 @@ const validateData = async () => {
}
});
};
const id = ref<string>("");
const saveAppoint = async () => {
console.log("save", dataForm);
const saveAppoint = async () => {
myFormPosition.value.validate().then(async (result: boolean) => {
if (props.personalId !== undefined) {
id.value = props.personalId.toString();
}
if (result) {
const dataAppoint = await {
// personalId: props.personalId,
recruitDate: dataForm.containDate,
posNoId: dataForm.posNoId,
positionId: dataForm.positionId,
@ -168,16 +162,11 @@ const saveAppoint = async () => {
positionLineId: dataForm.positionLineId,
positionPathSideId: dataForm.positionPathSideId,
positionTypeId: dataForm.positionTypeId,
// salaryAmount: dataForm.salaryAmount,
// mouthSalaryAmount: dataForm.mouthSalaryAmount,
// positionSalaryAmount: dataForm.positionSalaryAmount,
};
console.log("save appoint===>", dataAppoint);
showLoader();
await http
.put(config.API.appointmentPosition(id.value), dataAppoint)
.then((res) => {
console.log("respone=>", res);
success($q, "บันทึกสำเร็จ");
})
.catch((e) => {
@ -185,7 +174,6 @@ const saveAppoint = async () => {
})
.finally(async () => {
await closeAndClear();
// await resetFilter();
await fetchPublishFile();
await loadTreeData();
await fetchplacementPosition();
@ -195,10 +183,7 @@ const saveAppoint = async () => {
});
};
const editDataStatus = ref<boolean>(false);
const clickEditRow = () => {
editDataStatus.value = true;
};
const closeModal = () => {
if (editDataStatus.value == true) {
dialogConfirm(
@ -227,9 +212,6 @@ const closeAndClear = async () => {
dataForm.positionLineId = "";
dataForm.positionPathSideId = "";
dataForm.positionTypeId = "";
// dataForm.salaryAmount = null;
// dataForm.mouthSalaryAmount = null;
// dataForm.positionSalaryAmount = null;
};
//
const posNoOptions = ref<Object[]>([
@ -275,9 +257,7 @@ const positionLevelOptions = ref<Object[]>([
]);
const selectedPosition = async (data: any) => {
console.log("selecteds", data);
if (data.name == null && selected.value != data.keyId) {
// console.log("selecteds", data);
editDataStatus.value = true;
selected.value = data.keyId;
@ -359,51 +339,40 @@ const selectedPosition = async (data: any) => {
dataForm.positionPathSideId = "";
dataForm.positionTypeId = "";
}
console.log("dataForm", dataForm);
};
const checkPosition = (val: string) => {
const num = placementPosition.value.findIndex((e: string) => e === val);
return num;
};
const personal = ref<any>();
const expanded = ref<string[]>([]);
watch(props, () => {
expanded.value = [];
const dataPersonal = props.personal;
console.log(props.personal);
if (dataPersonal) {
dataPersonal.map((data: any) => {
personal.value = data;
});
console.log("personal", personal.value);
}
// console.log("draft===>", personal.value.draft);
if (personal.value) {
// const findData = dataRespone.value.find(findByPerson);
let findData: any = null;
dataRespone.value.map((x: any) => {
findData = findByPerson(x);
// console.log(findData);
if (findData != null) {
// console.log("findData===>", findData);
selectedPosition(findData);
for (let i = 3; i <= findData.keyId.length; i += 2) {
expanded.value.push(findData.keyId.slice(0, i));
}
}
});
// loadTreeData();
// selectedPosition(findData.children.children.children)
}
});
function findByPerson(element: any): any {
// console.log("searchTree element===>", element)
if (
element.positionNumId &&
element.positionLineId === personal.value.positionLineId &&
@ -472,10 +441,6 @@ function findByPerson(element: any): any {
<div class="text-weight-medium">
{{ prop.node.organizationName }}
</div>
<!--แสดง Total Count PositionNum-->
<!-- <q-badge rounded color="grey-2" text-color="dark"
:label="prop.node.totalPositionCount" /> -->
<q-badge
v-if="prop.node.totalPositionVacant > 0"
rounded
@ -605,8 +570,7 @@ function findByPerson(element: any): any {
:model-value="
date2Thai(new Date(dataForm.containDate))
"
:rules="[ (val: string) =>!!val ||`${'วันที่รายงานตัว'}`,
]"
:rules="[ (val: string) =>!!val ||`${'วันที่รายงานตัว'}`]"
:label="`${'วันที่รายงานตัว'}`"
hide-bottom-space
>
@ -711,55 +675,6 @@ function findByPerson(element: any): any {
map-options
/>
</div>
<!-- <div class="col-sx-12 col-sm-12 col-md-12">
<q-separator inset size="2px" class="q-my-md" />
</div> -->
<!-- <div class="col-xs-6 col-sm-6 col-md-6">
<q-input
outlined
dense
lazy-rules
v-model="dataForm.salaryAmount"
:rules="[(val) => !!val || `${'กรุณากรอกเงินเดือน'}`]"
:label="`${'เงินเดือน'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/>
</div> -->
<!-- <div class="col-xs-6 col-sm-6 col-md-6">
<q-input
outlined
dense
lazy-rules
v-model="dataForm.positionSalaryAmount"
:rules="[
(val) => !!val || `${'กรุณากรอกเงินประจำตำแหน่ง'}`,
]"
:label="`${'เงินประจำตำแหน่ง'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/>
</div> -->
<!-- <div class="col-xs-6 col-sm-6 col-md-6">
<q-input
outlined
dense
lazy-rules
v-model="dataForm.mouthSalaryAmount"
:rules="[
(val) =>
!!val || `${'กรุณากรอกเงินค่าตอบแทนรายเดือน'}`,
]"
:label="`${'เงินค่าตอบแทนรายเดือน'}`"
@update:modelValue="clickEditRow"
type="number"
hide-bottom-space
/>
</div> -->
</div>
</q-scroll-area>
</q-card>
@ -793,6 +708,5 @@ function findByPerson(element: any): any {
background: #a3d3fb48 !important;
font-weight: 600;
border: 1px solid rgba(175, 185, 196, 0.217);
/* box-shadow: 1px 1px 7px 1px rgba(41, 95, 255, 0.15) !important; */
}
</style>

View file

@ -7,7 +7,8 @@ import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store"
import Dialogbody from "@/modules/05_placement/components/AppointMent/Dialogbody.vue"
import DialogOrgTree from "@/modules/05_placement/components/AppointMent/AppointmentModal.vue";
import type { listAppointType,resData,orgFilter } from "@/modules/05_placement/interface/response/AppointMent"
import type { OpType } from "@/modules/05_placement/interface/response/Main"
import http from "@/plugins/http";
import config from "@/app.config";
@ -26,16 +27,16 @@ const {
} = mixin;
const router = useRouter();
const rows = ref<any>([]);
const rows2 = ref<any>([]);
const rows = ref<listAppointType[]>([]);
const rows2 = ref<listAppointType[]>([]);
const modalTree = ref<boolean>(false);
const personal = ref<any[]>([]);
const personalId = ref<string>("");
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const listRecevice = ref<any>([]);
const optionsType = ref<any[]>([]);
const listRecevice = ref<resData[]>([]);
const optionsType = ref<OpType[]>([]);
const type = ref<string>("");
const visibleColumns = ref<string[]>([
@ -147,7 +148,7 @@ const fecthlistappointment = async () => {
.then((res) => {
let response = res.data.result;
listRecevice.value = response;
rows.value = response.map((e: any) => ({
rows.value = response.map((e: resData) => ({
personalId: e.id,
citizenId: e.citizenId,
fullname: e.prefix + e.firstname + " " + e.lastname,
@ -165,11 +166,10 @@ const fecthlistappointment = async () => {
positionPath: e.positionPath,
status: statusText(e.status),
createdAt: date2Thai(e.createdAt),
birthday: e.dateOfBirth == null ? "-" : date2Thai(e.dateOfBirth),
}));
rows2.value = rows.value.filter(
(e: any) =>
(e: orgFilter) =>
e.orgName !== null &&
e.status !== "ส่งรายชื่อไปออกคำสั่ง" &&
e.status !== "ออกคำสั่งเสร็จแล้ว"
@ -189,7 +189,7 @@ const fecthTypeOption = async () => {
.get(config.API.typeOrder())
.then((res) => {
optionsType.value = res.data.result.filter(
(e: any) =>
(e: OpType) =>
e.commandCode === "C-PM-05" ||
e.commandCode === "C-PM-06" ||
e.commandCode === "C-PM-07"
@ -203,7 +203,7 @@ const fecthTypeOption = async () => {
//
const openModalTree = (id: string) => {
personalId.value = id;
personal.value = listRecevice.value.filter((e: any) => e.id === id);
personal.value = listRecevice.value.filter((e) => e.id === id);
modalTree.value = true;
};
//

View file

@ -5,7 +5,8 @@ import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store"
import type { QTableProps } from "quasar";
import type { listMain,listMainAPI,OpType } from "@/modules/05_placement/interface/response/OhterMain"
import type { listMain,listMainAPI } from "@/modules/05_placement/interface/response/OhterMain"
import type { OpType } from "@/modules/05_placement/interface/response/Main"
import http from "@/plugins/http";
import config from "@/app.config";

View file

@ -31,7 +31,7 @@ const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const files = ref<any>();
const listRecevice = ref<any[]>([]);
const listRecevice = ref<ResponseData[]>([]);
const filters = ref<ResponseRow[]>([]);
const rows = ref<ResponseRow[]>([]);
const mixin = useCounterMixin(); //

View file

@ -17,7 +17,7 @@ const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const router = useRouter();
const rows = ref<officerType[]>([]);
const rows2 = ref<any>([]);
const rows2 = ref<officerType[]>([]);
const modal = ref<boolean>(false);
const mixin = useCounterMixin();

View file

@ -21,7 +21,7 @@ const filterRef = ref<any>(null);
const router = useRouter();
const rows = ref<officerType[]>([]);
const rows2 = ref<any>([]);
const rows2 = ref<officerType[]>([]);
const modal = ref<boolean>(false);
const mixin = useCounterMixin();
const {

View file

@ -4,7 +4,7 @@ import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import { useTransferDataStore } from "@/modules/05_placement/store"
import type { QTableProps } from "quasar";
import type { FormMainProbation, FormMainProbation2 } from "@/modules/05_placement/interface/request/Main";
import type { FormMainProbation, FormMainProbation2,mapData } from "@/modules/05_placement/interface/request/Main";
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
import router from "@/router";
@ -296,7 +296,7 @@ const findlist = async (id: string) => {
response2.forEach((e: any) =>
probationlist.value.push({ ...e, probation: false })
);
rows2.value = probationlist.value.map((e: any) => ({
rows2.value = probationlist.value.map((e: mapData) => ({
id: e.id,
fullname: e.fullname,
position: e.position,

View file

@ -65,9 +65,20 @@ interface FormProbationPersonal {
order_number: string,
probation_status: string
}
export type { FormPlacementMainData };
export type { FormOrderPlacementMainData };
export type { FormMainProbation };
export type { FormMainProbation2 };
export type { FormProbationDetail };
export type { FormProbationPersonal };
interface mapData {
id:string
fullname:string
position:string
positionEmployeeLevel:string
oc:string
probation:string
}
export type {
FormPlacementMainData,
FormOrderPlacementMainData,
FormMainProbation,
FormMainProbation2,
FormProbationDetail,
FormProbationPersonal,
mapData,
};

View file

@ -0,0 +1,38 @@
interface listAppointType {
personalId:string
citizenId:number
fullname:string
organizationName:string
orgName:string
organizationShortName:string
positionNumber:string
positionPath:string
status:string
createdAt:string
birthday:string
}
interface resData {
id:string
citizenId:number
prefix:string
firstname:string
lastname:string
organizationName:string
organizationShortName:string
positionNumber:string
positionPath:string
status:string
createdAt:Date
dateOfBirth:Date
}
interface orgFilter{
orgName:string
status:string
}
export type {
listAppointType,
resData,
orgFilter
}

View file

@ -1 +1,6 @@
export type {};
interface OpType {
commandCode:string
}
export type {
OpType
};

View file

@ -44,11 +44,9 @@ interface listMainAPI {
statustext:string
createdAt:Date
}
interface OpType {
commandCode:string
}
export type {
listMain,
listMainAPI,
OpType
}

View file

@ -1,5 +1,4 @@
interface officerType {
no: number;
id: string;
prefix: string;
firstName: string;