|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示
. N% E/ {( C! q1 i4 W' B! j1 Y结果如下,点击Change Management标签,自动弹出统计界面
" m* M& n9 a1 V2 T! d6 f' [& ? o# j% U- w: b" p+ v( T& k, D* `
2 j( Q5 B2 ~" }1 ?% X- {" Z
( n9 m# V; o1 h
6 l. E P- J, V% e% B" ?( g/ @/ j x' d( c: L; d0 O0 ?9 S
(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名
4 G. @8 R/ S& j. M7 _4 X0 w
# s1 y& V$ J5 U. t1 C |1 K! X
6 V( ^- N( }# c8 M- S: x4 \. Q(2)关联一个 on load的事件,使用 JavaScript 的方式
- x, G8 A% n& b
" [* r+ B3 `/ _: d% ^
4 F6 \3 G3 y: [, T! R
(3)对整个事件进行代码
8 d9 j! s) I. i+ F! Z
! L. e+ M- M! `8 ]% i
: H' Y1 G% v6 K5 F7 d1 ?完成后即可看到相关效果。* n& o1 C, U3 m, }" N1 }
; q- N: P3 F8 B
代码如下:2 M! x: W" D& R3 U
9 Z3 d" x; V# P2 N \0 ^# M5 L( S( d
//get the ECR Collection
: G4 |- i+ ~5 H5 zvar newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;1 \! Y- p9 W2 X. ]) P+ l2 S
var currentItem = null;
" U- z1 c' j4 P" P( }; hvar currentState ="";
7 n" w- S/ p9 J: U5 s$ u# jvar innovator = aras.newIOMInnovator();
+ t- a6 ^4 h+ Q$ Qvar item = innovator.newItem("ECR","get");( i& l" Z1 o# r- m
item.setAttribute("select","state");6 C X# Q. J) s- e" ]3 U1 S
var ecr_items = item.apply(); ^ C, E+ q1 |& t
var totalCount = ecr_items.GetItemCount();
9 q( Q7 A0 o* d& m, ?/ @$ p* s `) rfor( i=0; i<totalCount; i++)
7 a$ ]( p) w ^9 c N7 n: _% |{ 8 y3 N# P+ _' G! ?. C& f. E
current_item = ecr_items.getItemByIndex(i); 7 l/ @+ R7 Z9 o" A% X: n ~
current_state = current_item.getProperty("state");
/ E% o2 ?( R5 m/ ~+ Z5 a# R swiTCh(current_state) & Y* L& l4 |2 N3 c" l+ x/ |7 Y( E
{ & A% X: X9 g! `8 M4 i7 i
case "New":6 K% w( S6 {$ X
newCount++;5 C# a9 m( W" I3 @+ P. E# Z2 H$ I
break;: B$ |1 [, E/ i5 {/ B" ?
case "Submitted":
J& g$ w& E% }+ |- J submittedCount++;
( U" b& J( W8 I) f9 q+ z! w break;
- q% p2 i( r) S$ [4 E" N case "In Review": 5 F; a1 T2 Q: n6 Y, ?! n+ m* a
reviewedCount++;
( Y6 d% c z! e0 J0 F2 Y) n/ C break;
8 c% Z5 ?5 u( H case "Released": 3 }% J6 T% a: z* E1 |
releasedCount++; 4 `) L2 k6 w3 w4 h! ^( p
break;
7 \ V0 A- u9 P7 g! ] case "Cancelled":
' o# i+ a! |2 N5 s9 u7 S% F cancelCount++; * w+ l1 ]1 r. t! w5 v+ W
break;
# s2 V' E/ @% ?: z2 @ }
& @* I+ y- Z3 B* `- S9 K! ^+ W/ r0 `}
5 {2 G' m7 h2 u g, `$ t$ Jdocument.getElementById("MainDataForm").textNew.value=newCount;
P# j. j2 A1 k" I+ e* @$ @document.getElementById("MainDataForm").textSubmitted.value=submittedCount;
# D! ~% M9 n: A/ t% w7 S, hdocument.getElementById("MainDataForm").textReviewed.value=reviewedCount;& j/ ?7 V1 m% s8 `# i6 F' g
document.getElementById("MainDataForm").textReleased.value=releasedCount;. ~" O4 \4 c, c3 ]. z
document.getElementById("MainDataForm").textCancelled.value=cancelCount;2 Q5 z% N# p) k: U4 f
document.getElementById("MainDataForm").textTotal.value=totalCount;; p8 X. T B& B
" d! E$ ^+ u! |4 }7 U$ p& ^ U7 S
|
|