แก้ค้นหาชื่อ

This commit is contained in:
setthawutttty 2025-01-10 10:28:41 +07:00
parent adc9ae1272
commit b1c06233f6
2 changed files with 22 additions and 5 deletions

View file

@ -12,7 +12,7 @@ export const useDataStore = defineStore("dataMain", () => {
const storeRegistry = useRegistryInFormationStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader } = mixin;
const { messageError, showLoader, hideLoader, findPosMasterNo } = mixin;
// ref() คือการประกาศ state เหมือน vuex
const formData = reactive<ProfileData>({
rank: "",
@ -102,9 +102,7 @@ export const useDataStore = defineStore("dataMain", () => {
formData.posTypeName = data.posTypeName;
formData.posExecutiveName = data.posExecutiveName;
formData.posLevelName = data.posLevelName;
formData.posNo = data.rootShortName
? `${data.rootShortName}${data.posMaster}`
: "";
formData.posNo = findPosMasterNo(data);
storeRegistry.profileId = data.profileId;
}

View file

@ -1082,6 +1082,25 @@ export const useCounterMixin = defineStore("mixin", () => {
return "";
}
}
function findPosMasterNo(obj: any) {
if (obj) {
let shortName =
(obj.child4ShortName != null
? obj.child4ShortName
: obj.child3ShortName != null
? obj.child3ShortName
: obj.child2ShortName != null
? obj.child2ShortName
: obj.child1ShortName != null
? obj.child1ShortName
: obj.rootShortName != null
? obj.rootShortName
: "") + (obj.posMasterNo != null ? obj.posMasterNo : "");
return shortName == "" ? "-" : shortName;
} else {
return "";
}
}
function findOrgNameOld(obj: any) {
if (obj) {
@ -1178,7 +1197,7 @@ export const useCounterMixin = defineStore("mixin", () => {
findOrgName,
findPosMasterNoOld,
findOrgNameOld,
findPosMasterNo,
onSearchDataTable
};
});