Merge branch 'dev' of https://github.com/dikstub-rssa/simrs-fe into feat/encounter-adjustment-163

This commit is contained in:
riefive
2025-11-21 14:44:33 +07:00
64 changed files with 900 additions and 412 deletions

No files matched your search

+8 -4
View File
@@ -28,13 +28,15 @@ export function remove(id: number | string) {
return base.remove(path, id, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
export async function getValueLabelList(params: any = null, useCodeAsValue = false): Promise<{ value: string; label: string }[]> {
let data: { value: string; label: string }[] = []
const result = await getList(params)
if (result.success) {
const resultData = result.body?.data || []
data = resultData.map((item: Division) => ({
value: item.id ? Number(item.id) : item.code,
value: useCodeAsValue ? item.code
: item.id ? Number(item.id)
: item.code,
label: item.name,
}))
}
@@ -46,10 +48,12 @@ export async function getValueLabelList(params: any = null): Promise<{ value: st
* @param divisions Array of division objects from API
* @returns TreeItem[]
*/
export function getValueTreeItems(divisions: any[]): TreeItem[] {
export function getValueTreeItems(divisions: any[], byCode = true): TreeItem[] {
return divisions
.map((division: Division) => ({
value: division.id ? String(division.id) : division.code,
value: byCode ? String(division.code)
: String(division.id) ? String(division.id)
: division.code,
label: division.name,
hasChildren: Array.isArray(division.childrens) && division.childrens.length > 0,
children:
+4 -2
View File
@@ -27,13 +27,15 @@ export function remove(id: number | string) {
return base.remove(path, id, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
export async function getValueLabelList(params: any = null, useCodeAsValue = false): Promise<{ value: string; label: string }[]> {
let data: { value: string; label: string }[] = []
const result = await getList(params)
if (result.success) {
const resultData = result.body?.data || []
data = resultData.map((item: Installation) => ({
value: item.id ? Number(item.id) : item.code,
value: useCodeAsValue ? item.code
: item.id ? Number(item.id)
: item.code,
label: item.name,
}))
}
+1 -1
View File
@@ -36,7 +36,7 @@ export async function getValueLabelList(params: any = null, useCodeAsValue = fal
data = resultData.map((item: Specialist) => ({
value: useCodeAsValue ? item.code
: item.id ? Number(item.id)
: item.id,
: item.code,
label: item.name,
parent: item.unit_id ? Number(item.unit_id) : null,
}))
+2 -2
View File
@@ -33,9 +33,9 @@ export async function getValueLabelList(params: any = null, useCodeAsValue = fal
if (result.success) {
const resultData = result.body?.data || []
data = resultData.map((item: Subspecialist) => ({
value: useCodeAsValue ? item.code
value: useCodeAsValue ? item.code
: item.id ? Number(item.id)
: item.id,
: item.code,
label: item.name,
parent: item.specialist_id ? Number(item.specialist_id) : null,
}))
+1 -1
View File
@@ -35,7 +35,7 @@ export async function getValueLabelList(params: any = null, useCodeAsValue = fal
data = resultData.map((item: Unit) => ({
value: useCodeAsValue ? item.code
: item.id ? Number(item.id)
: item.id,
: item.code,
label: item.name,
}))
}