|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示
/ _3 \0 }. l* J4 z p1 n g结果如下,点击Change Management标签,自动弹出统计界面
) i4 a3 d$ o0 f/ R& x8 x- L, j7 v8 s8 k: r* @2 u9 Z; ~
& V' u( J, U( q& z5 T
3 W; ~5 ]2 O- h' d. B1 d
- C2 x# a- \6 N1 ?8 G W: l$ c. Z, H: h1 S5 I9 ?
(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名
" |! d5 @' e2 R$ o1 }; s8 A$ N" ?* J0 V6 J# G7 S' r, \$ u
# |* N$ V7 l9 q- q; O) c) L(2)关联一个 on load的事件,使用 JavaScript 的方式- U2 Q9 O$ z d5 m. [% i A
% q6 I" ~6 O, h0 d+ E1 `% C# z- R9 D5 y9 |* K8 _2 m" c; n8 i) g
(3)对整个事件进行代码3 |8 q5 u @. U; u
' j, N3 Q; \0 ^/ f
$ U& k$ T R8 P1 {7 p
完成后即可看到相关效果。4 `- S# y& f9 |7 y: g$ u
& L: S1 J% l6 d! L代码如下:' z, v' C* ^2 B8 F
1 }. X' M" t0 `0 s# G
//get the ECR Collection: F# _+ L( x) I5 }& n9 n1 t
var newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;
/ f, a( K- a- Y! N5 qvar currentItem = null;0 k, s* c$ X7 s, d B) B3 y" z! J
var currentState ="";6 p1 S9 y% j0 C3 s7 f9 J }
var innovator = aras.newIOMInnovator();4 n' K8 h9 s" T |0 D
var item = innovator.newItem("ECR","get");# U' t5 H1 }9 W( S2 A
item.setAttribute("select","state");9 U1 B% A0 E& ?" J: W' N, [
var ecr_items = item.apply();- X6 J4 L/ `% W
var totalCount = ecr_items.GetItemCount();
3 O- O3 l3 a1 F+ o- Cfor( i=0; i<totalCount; i++)
* G6 a2 g" o- l6 o9 R{ + u. I8 d I1 _' K7 S
current_item = ecr_items.getItemByIndex(i);
" L: ^: h: w3 e' Q8 A% ~# Z current_state = current_item.getProperty("state"); ; A7 Z! e5 d# h: b
swiTCh(current_state)
$ o7 ~" [# C( R5 T { " B0 Y! L$ R5 e7 T( x9 _
case "New":
$ s! G) f/ o" T. w newCount++;
, k$ _0 B( W8 v; c9 |5 i! H break;5 z S. h ?9 g5 b9 b
case "Submitted": / O& h6 u1 [6 k) ^
submittedCount++;
1 h) {5 e" o# m% N8 D( Y: I break;
- P! e4 J6 X! { case "In Review":
6 O5 ?1 \7 `# n& o! d reviewedCount++;
6 P( G" z$ [! s& G break;
8 y b/ [/ H1 f& Y2 ]" ]3 H- q case "Released":
! E7 V+ U$ z" O( n# S7 f releasedCount++;
8 x1 l# S) m7 V! w( a6 M* O break;
3 r4 s/ Z+ Q0 m0 D% Q1 s case "Cancelled":
6 j, y! C7 ^7 S6 N5 c+ F$ p0 I0 Q cancelCount++; " s( R7 J2 l6 Y1 z- {2 V
break;
3 _, a: }/ z# n) D }
3 G d1 D5 R* J, X. k2 o}
% Z8 Y Z$ h/ qdocument.getElementById("MainDataForm").textNew.value=newCount;% C: @ q5 H; j7 ?/ D8 N: A+ D: B
document.getElementById("MainDataForm").textSubmitted.value=submittedCount;! F9 S' G& x! u8 Y4 o& M
document.getElementById("MainDataForm").textReviewed.value=reviewedCount;
3 q( g$ P: x" B5 y6 `' G0 Wdocument.getElementById("MainDataForm").textReleased.value=releasedCount;
^$ Q1 ]0 J+ {$ v! k5 _2 Ddocument.getElementById("MainDataForm").textCancelled.value=cancelCount;
! a0 A' c7 T( R3 e% a/ k! g/ ]document.getElementById("MainDataForm").textTotal.value=totalCount;9 W0 Z5 L3 ^) E) S2 N
4 d/ L+ x- K) k
|
|