แก้ แสดง สังกัด

This commit is contained in:
setthawutttty 2025-03-20 16:58:30 +07:00
parent 708170a2e5
commit fcaf891197
17 changed files with 93 additions and 83 deletions

View file

@ -16,7 +16,7 @@ import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
/** use*/ /** use*/
const { findOrgNameOld, findOrgName, textTranForm } = useCounterMixin(); const { findOrgNameOld, findOrgName } = useCounterMixin();
/** propsDataProfile*/ /** propsDataProfile*/
const props = defineProps({ const props = defineProps({
@ -166,7 +166,7 @@ watch(
<div class="col-12"> <div class="col-12">
<div class="col-12 text-top">งก</div> <div class="col-12 text-top">งก</div>
<div class="col-12 text-detail text-html"> <div class="col-12 text-detail text-html">
{{ textTranForm(profile.organization) }} {{ profile.organization }}
</div> </div>
</div> </div>
</div> </div>

View file

@ -22,7 +22,7 @@ const mixin = useCounterMixin();
const router = useRouter(); const router = useRouter();
const $q = useQuasar(); const $q = useQuasar();
const retireDate = ref<Date>(); const retireDate = ref<Date>();
const { showLoader, hideLoader, messageError, date2Thai,textTranForm } = mixin; const { showLoader, hideLoader, messageError, date2Thai } = mixin;
const isEmployee = defineModel("isEmployee", { type: String }); const isEmployee = defineModel("isEmployee", { type: String });
const empType = ref<string>("officer"); const empType = ref<string>("officer");
@ -374,7 +374,7 @@ async function fetchProfile(id: string, avatarName: string) {
<q-input <q-input
borderless borderless
readonly readonly
:model-value="goverment.oc === '' ? '-' : textTranForm(goverment.oc)" :model-value="goverment.oc === '' ? '-' : goverment.oc"
label="สังกัด" label="สังกัด"
autogrow autogrow
></q-input> ></q-input>

View file

@ -18,7 +18,7 @@ const {
showLoader, showLoader,
hideLoader, hideLoader,
dialogConfirm, dialogConfirm,
findOrgChildName, findOrgChildNameHtml,
} = mixin; } = mixin;
const route = useRoute(); const route = useRoute();
const retireld_params = route.params.id; const retireld_params = route.params.id;
@ -107,7 +107,7 @@ async function fecthProfile() {
e.posTypeName && e.posLevelName e.posTypeName && e.posLevelName
? e.posTypeName + " (" + e.posLevelName + ")" ? e.posTypeName + " (" + e.posLevelName + ")"
: "-", : "-",
organizationOrganization: findOrgChildName(e), organizationOrganization: findOrgChildNameHtml(e),
})); }));
}) })
.catch((err) => { .catch((err) => {
@ -139,7 +139,7 @@ async function fecthProfile() {
e.posTypeName && e.posLevelName e.posTypeName && e.posLevelName
? e.posTypeName + " (" + e.posLevelName + ")" ? e.posTypeName + " (" + e.posLevelName + ")"
: "-", : "-",
organizationOrganization: findOrgChildName(e), organizationOrganization: findOrgChildNameHtml(e),
})); }));
}) })
.catch((err) => { .catch((err) => {

View file

@ -33,7 +33,7 @@ const dataMapToSend = computed(() => {
})); }));
}); });
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogConfirm, date2Thai, onSearchDataTable, textTranForm } = mixin; const { dialogConfirm, date2Thai, onSearchDataTable } = mixin;
/** props*/ /** props*/
const props = defineProps({ const props = defineProps({
@ -118,9 +118,11 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld", field: "organizationPositionOld",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${row.organizationPositionOld.replace(/\n/g, " ")}`; // copy
}, // format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
// },
}, },
{ {
name: "datetext", name: "datetext",
@ -164,7 +166,6 @@ const modalCommand = ref<boolean>(false);
/** popup ยืนยันส่งัว */ /** popup ยืนยันส่งัว */
function saveOrder() { function saveOrder() {
dialogConfirm( dialogConfirm(
$q, $q,
() => { () => {
@ -275,7 +276,7 @@ watch(
> >
{{ {{
props.row.organizationPositionOld props.row.organizationPositionOld
? textTranForm(props.row.organizationPositionOld) ? props.row.organizationPositionOld
: "-" : "-"
}} }}
</div> </div>

View file

@ -30,7 +30,6 @@ const {
hideLoader, hideLoader,
onSearchDataTable, onSearchDataTable,
findOrgName, findOrgName,
textTranForm,
} = mixin; } = mixin;
/** Table */ /** Table */
@ -106,9 +105,11 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld", field: "organizationPositionOld",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${row.organizationPositionOld.replace(/\n/g, " ")}`; // copy
}, // format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
// },
}, },
{ {
name: "datetext", name: "datetext",
@ -393,7 +394,7 @@ onMounted(async () => {
> >
{{ {{
props.row.organizationPositionOld props.row.organizationPositionOld
? textTranForm(props.row.organizationPositionOld) ? props.row.organizationPositionOld
: "-" : "-"
}} }}
</div> </div>

View file

@ -33,7 +33,7 @@ const dataMapToSend = computed(() => {
})); }));
}); });
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogConfirm, date2Thai, onSearchDataTable, textTranForm } = mixin; const { dialogConfirm, date2Thai, onSearchDataTable } = mixin;
/** props*/ /** props*/
const props = defineProps({ const props = defineProps({
@ -119,9 +119,11 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld", field: "organizationPositionOld",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${row.organizationPositionOld.replace(/\n/g, " ")}`; // copy
}, // format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
// },
}, },
{ {
name: "datetext", name: "datetext",
@ -275,7 +277,7 @@ watch(
> >
{{ {{
props.row.organizationPositionOld props.row.organizationPositionOld
? textTranForm(props.row.organizationPositionOld) ? props.row.organizationPositionOld
: "-" : "-"
}} }}
</div> </div>

View file

@ -28,8 +28,7 @@ const {
date2Thai, date2Thai,
showLoader, showLoader,
hideLoader, hideLoader,
onSearchDataTable, onSearchDataTable
textTranForm,
} = mixin; } = mixin;
/** Table */ /** Table */
@ -105,9 +104,11 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld", field: "organizationPositionOld",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${row.organizationPositionOld.replace(/\n/g, " ")}`; // copy
}, // format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
// },
}, },
{ {
name: "datetext", name: "datetext",
@ -388,7 +389,7 @@ onMounted(async () => {
> >
{{ {{
props.row.organizationPositionOld props.row.organizationPositionOld
? textTranForm(props.row.organizationPositionOld) ? props.row.organizationPositionOld
: "-" : "-"
}} }}
</div> </div>

View file

@ -52,7 +52,6 @@ const {
hideLoader, hideLoader,
date2Thai, date2Thai,
onSearchDataTable, onSearchDataTable,
textTranForm,
} = mixin; } = mixin;
/** คอลัมน์ */ /** คอลัมน์ */
@ -106,9 +105,11 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld", field: "organizationPositionOld",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${row.organizationPositionOld.replace(/\n/g, " ")}`; // copy
}, // format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
// },
}, },
{ {
name: "createdAt", name: "createdAt",
@ -263,7 +264,7 @@ watchEffect(() => {
<div v-else-if="col.name == 'org'" class="text-html"> <div v-else-if="col.name == 'org'" class="text-html">
{{ {{
props.row.organizationPositionOld props.row.organizationPositionOld
? textTranForm(props.row.organizationPositionOld) ? props.row.organizationPositionOld
: "-" : "-"
}} }}
</div> </div>

View file

@ -52,7 +52,6 @@ const {
hideLoader, hideLoader,
date2Thai, date2Thai,
onSearchDataTable, onSearchDataTable,
textTranForm,
} = mixin; } = mixin;
/** คอลัมน์ */ /** คอลัมน์ */
@ -106,9 +105,11 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld", field: "organizationPositionOld",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${row.organizationPositionOld.replace(/\n/g, " ")}`; // copy
}, // format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
// },
}, },
{ {
name: "createdAt", name: "createdAt",
@ -266,7 +267,7 @@ watchEffect(() => {
> >
{{ {{
props.row.organizationPositionOld props.row.organizationPositionOld
? textTranForm(props.row.organizationPositionOld) ? props.row.organizationPositionOld
: "-" : "-"
}} }}
</div> </div>

View file

@ -29,7 +29,6 @@ const {
success, success,
onSearchDataTable, onSearchDataTable,
dialogRemove, dialogRemove,
textTranForm,
} = mixin; } = mixin;
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
@ -105,9 +104,11 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld", field: "organizationPositionOld",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${row.organizationPositionOld.replace(/\n/g, " ")}`; // copy
}, // format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
// },
}, },
{ {
name: "createdAt", name: "createdAt",
@ -380,7 +381,7 @@ onMounted(async () => {
> >
{{ {{
props.row.organizationPositionOld props.row.organizationPositionOld
? textTranForm(props.row.organizationPositionOld) ? props.row.organizationPositionOld
: "-" : "-"
}} }}
</div> </div>

View file

@ -29,7 +29,6 @@ const {
success, success,
onSearchDataTable, onSearchDataTable,
dialogRemove, dialogRemove,
textTranForm,
} = mixin; } = mixin;
const modal = ref<boolean>(false); const modal = ref<boolean>(false);
@ -105,9 +104,11 @@ const columns = ref<QTableProps["columns"]>([
field: "organizationPositionOld", field: "organizationPositionOld",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${row.organizationPositionOld.replace(/\n/g, " ")}`; // copy
}, // format(val, row) {
// return `${row.organizationPositionOld.replace(/\n/g, " ")}`;
// },
}, },
{ {
name: "createdAt", name: "createdAt",
@ -386,7 +387,7 @@ onMounted(async () => {
> >
{{ {{
props.row.organizationPositionOld props.row.organizationPositionOld
? textTranForm(props.row.organizationPositionOld) ? props.row.organizationPositionOld
: "-" : "-"
}} }}
</div> </div>

View file

@ -94,6 +94,9 @@ const columns = ref<QTableProps["columns"]>([
field: "profileType", field: "profileType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${mainStore.convertType(row.profileType)}`;
},
}, },
{ {
name: "idcard", name: "idcard",
@ -116,7 +119,7 @@ const columns = ref<QTableProps["columns"]>([
{ {
name: "posNo", name: "posNo",
align: "left", align: "left",
label: "ตำแหน่งเลขที่", label: "เลขที่ตำแหน่ง",
sortable: true, sortable: true,
field: "posNo", field: "posNo",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",

View file

@ -352,9 +352,9 @@ onMounted(async () => {
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
v-model="data.positionType" v-model="data.positionType"
:rules="[(val:string) => !!val || `${'กรุณากรอกประเภทตำแหน่ง'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่งประเภท'}`]"
hide-bottom-space hide-bottom-space
:label="`${'ประเภทตำแหน่ง'}`" :label="`${'ตำแหน่งประเภท'}`"
/> />
</div> </div>
</div> </div>
@ -384,9 +384,9 @@ onMounted(async () => {
:readonly="!edit" :readonly="!edit"
:borderless="!edit" :borderless="!edit"
v-model="data.posNo" v-model="data.posNo"
:rules="[(val:string) => !!val || `${'กรุณากรอกตำแหน่งเลขที่'}`]" :rules="[(val:string) => !!val || `${'กรุณากรอกเลขที่ตำแหน่ง'}`]"
hide-bottom-space hide-bottom-space
:label="`${'ตำแหน่งเลขที่'}`" :label="`${'เลขที่ตำแหน่ง'}`"
/> />
</div> </div>
</div> </div>

View file

@ -102,7 +102,7 @@ const columns = ref<QTableProps["columns"]>([
{ {
name: "positionLevel", name: "positionLevel",
align: "left", align: "left",
label: "ประเภทตำแหน่ง", label: "ตำแหน่งประเภท",
sortable: true, sortable: true,
field: "positionLevel", field: "positionLevel",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
@ -236,7 +236,8 @@ watch(
); );
function convertType(val: string) { function convertType(val: string) {
switch (val) { const data = val?.toLocaleUpperCase();
switch (data) {
case "OFFICER": case "OFFICER":
return "ข้าราชการ กทม. สามัญ"; return "ข้าราชการ กทม. สามัญ";
case "EMPLOYEE": case "EMPLOYEE":
@ -410,7 +411,8 @@ onMounted(async () => {
</div> </div>
<div <div
v-else-if="col.name === 'organization'" v-else-if="col.name === 'organization'"
class="table_ellipsis" class="text-html"
style="width: 250px"
> >
{{ props.row.organization ? props.row.organization : "-" }} {{ props.row.organization ? props.row.organization : "-" }}
</div> </div>

View file

@ -218,13 +218,6 @@ watch(
<div v-if="col.name == 'no'"> <div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }} {{ props.rowIndex + 1 }}
</div> </div>
<div v-else-if="col.name === 'profileType'">
{{
props.row.profileType
? mainStore.convertType(props.row.profileType)
: "-"
}}
</div>
<div v-else> <div v-else>
{{ col.value ? col.value:'-' }} {{ col.value ? col.value:'-' }}
</div> </div>

View file

@ -53,6 +53,9 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
field: "profileType", field: "profileType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${convertType(row.profileType)}`;
},
}, },
{ {
name: "idcard", name: "idcard",
@ -75,7 +78,7 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
{ {
name: "posNo", name: "posNo",
align: "left", align: "left",
label: "ตำแหน่งเลขที่", label: "เลขที่ตำแหน่ง",
sortable: true, sortable: true,
field: "posNo", field: "posNo",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
@ -108,7 +111,7 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) { format(val, row) {
return val ? val.toLocaleString() : '-'; return val ? val.toLocaleString() : "-";
}, },
}, },
{ {
@ -146,7 +149,6 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
// style: "font-size: 14px", // style: "font-size: 14px",
// }, // },
const columnsDirector = ref<QTableProps["columns"]>([ const columnsDirector = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
align: "left", align: "left",
@ -164,6 +166,9 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
field: "profileType", field: "profileType",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) {
return `${convertType(row.profileType)}`;
},
}, },
{ {
name: "idcard", name: "idcard",
@ -186,7 +191,7 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
{ {
name: "posNo", name: "posNo",
align: "left", align: "left",
label: "ตำแหน่งเลขที่", label: "เลขที่ตำแหน่ง",
sortable: true, sortable: true,
field: "posNo", field: "posNo",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
@ -430,7 +435,7 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
* @param data * @param data
*/ */
async function fetchData(data: ArrayPersonAdd[], type?: string) { async function fetchData(data: ArrayPersonAdd[], type?: string) {
console.log("🚀 ~ fetchData ~ data:", data) console.log("🚀 ~ fetchData ~ data:", data);
const dataList: any = data.map((item: any) => ({ const dataList: any = data.map((item: any) => ({
profileType: item.profileType profileType: item.profileType
? item.profileType ? item.profileType
@ -470,17 +475,20 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
posLevelId: item.posLevelId, posLevelId: item.posLevelId,
posLevelName: item.posLevelName, posLevelName: item.posLevelName,
rootDnaId:item.rootDnaId, rootDnaId: item.rootDnaId,
child1DnaId:item.child1DnaId, child1DnaId: item.child1DnaId,
child2DnaId:item.child2DnaId, child2DnaId: item.child2DnaId,
child3DnaId:item.child3DnaId, child3DnaId: item.child3DnaId,
child4DnaId:item.child4DnaId, child4DnaId: item.child4DnaId,
})); }));
const newItems = dataList.filter( const newItems = dataList.filter(
(newItem: any) => !rowsAdd.value.some((existingItem: any) => existingItem.personId === newItem.personId) (newItem: any) =>
!rowsAdd.value.some(
(existingItem: any) => existingItem.personId === newItem.personId
)
); );
// เพิ่มข้อมูลใหม่เข้า rowsAdd // เพิ่มข้อมูลใหม่เข้า rowsAdd
rowsAdd.value = [...rowsAdd.value, ...newItems]; rowsAdd.value = [...rowsAdd.value, ...newItems];
} }
@ -530,7 +538,8 @@ export const useDisciplineMainStore = defineStore("disciplineMainStore", () => {
} }
function convertType(val: string) { function convertType(val: string) {
switch (val) { const data = val?.toLocaleUpperCase();
switch (data) {
case "OFFICER": case "OFFICER":
return "ข้าราชการ กทม. สามัญ"; return "ข้าราชการ กทม. สามัญ";
case "EMPLOYEE": case "EMPLOYEE":

View file

@ -1248,11 +1248,6 @@ export const useCounterMixin = defineStore("mixin", () => {
} }
} }
function textTranForm(val: string) {
return (val.match(/[^()\s]+(?:\s*\([^()]+\))?|\([^()]+\)/g) || []).join(
"\n"
);
}
function pathRegistryEmp(routeName: string) { function pathRegistryEmp(routeName: string) {
return routeName return routeName
? routeName === "registryNewByid" ? routeName === "registryNewByid"
@ -1396,6 +1391,5 @@ export const useCounterMixin = defineStore("mixin", () => {
findOrgNameHtml, findOrgNameHtml,
findOrgNameOldHtml, findOrgNameOldHtml,
findOrgChildNameHtml, findOrgChildNameHtml,
textTranForm
}; };
}); });