You are on page 1of 13

Построение схемы организационной структуры предприятия в

FileMaker c использованием JS-библиотек.

+ + + =
Tables & relations

preferences::
id
Id_group_current
html_staff_diagram
relate_to_1

groups::
Id
name
html_diagram_screen
html_staff_diagram_print
relate_1

persons::
Id
id_person_parent
Id_group
level
sort
name
name_display
html_staff_diagram_row
Template

preferences::html_staff_diagram

JS :

SVG.js # манипуляция с SVG элементами
TreeJS # построение дерева

fmUrlGoToPerson = ##FMPATH##
+"?script=goto_person_from_chart"
+ "&param=" ;

type_chart = ##TYPE## # print / screen

id_group = ##ID_GROUP##

data_str = ##DATA_CHART##

HTML :

div # SVG.js

canvas # TreeJS
Data

persons::html_staff_diagram_row

# Calculation:

id & "@@" &
name & "**" & uuid & "@@" &
id_person_parent & "@@" &
level

179@@Steven C.**652-00@@@@1
Scripts

update html staff diagram

groups::html_diagram_screen =

Substitute (
preferences::html_staff_diagram ;

[ "##FMPATH##" ; "\"fmp://$/" & Get ( FileName ) & "\"" ] ;

[ "##ID_GROUP##" ; groups::id ] ;

[ "##TYPE##" ; "screen" ] ;

[ "##DATA_CHART##" ;
Substitute (
List ( persons::html_staff_diagram_row ) ;
"¶"; "###"
)
];


)
Scripts

goto_person_from_chart

Set Variable [ $data; Value: Get ( ScriptParamter ) ]

Set Variable [ $id_person; Value:
GetValue ( GetValue ( Substitute ( $data; "@@"; ¶ ); 1) )

Set Variable [ $id_group; Value:
GetValue ( GetValue ( Substitute ( $data; "@@"; ¶ ); 1) )

JS :

var param = id_person + "@@" + ID_GROUP
window.location = fmUrlGoToPerson + param;

fmp://$/orgchart?
script=goto_person_from_chart
&param=194@@6
Layout

home page ( preferences )

Web Viewer:

"data:text/html, " &
groups::html_diagram_screen
Web Viewer

JS:

data_str =
“179@@Steven C.**652-00@@@@1###
182@@Sandra N.**013-34@@179@@2###
192@@Andrew I. **416-72@@182@@3###
195@@Dustin C.**427-76@@192@@4###
196@@Adrienne K.**404-06@@192@@4###
193@@Kenneth S.**383-81@@182@@3###...”

[
id = 179
Id_parent = “”
level = 1
text = Steven C.**652-00
],
[
id = 182
Id_parent = 179
level = 2
text = Sandra N.**013-34
]
Demo
Demo
Demo
Спасибо за внимание