|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示+ E) C3 T9 k5 c8 h$ D" m) x8 c) ?
结果如下,点击Change Management标签,自动弹出统计界面" V- ^) [4 ~" r2 M
, t9 r1 D2 ]( h( k* n$ ^, W X
, t0 [0 B B! g# a9 a# A+ L# Q K8 r
% c0 l% q, b" R; S: V, A& p, b: ]* w+ U6 O9 R8 o
(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名7 r1 [9 V# ~5 W8 B$ H
) z% W7 H7 m% M$ N2 |$ M* G
3 }2 \' j7 E: ](2)关联一个 on load的事件,使用 JavaScript 的方式; V& f4 _1 s* [' F+ e- r" \
' f1 X8 t. o" B1 K: g; V$ S" D: m8 `$ {4 e- n
(3)对整个事件进行代码) L% @6 d3 ^4 L! C
* }" z7 A- n% s7 [, m0 @' E; W% A5 e5 _& b; h" B8 F
完成后即可看到相关效果。& S- V v- W9 c" x, y' j' T
! y+ ~% `; i! l" ^ `代码如下:
; h3 n) g9 _3 S5 L- V# m4 C% V3 p- }% X. Z% r ^, I& k4 g( x
//get the ECR Collection
9 `2 _' W6 f' J" ivar newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;
# F4 W9 V. E; Q! j+ ~$ F/ _, ]0 u( Tvar currentItem = null;
0 ]' l+ z6 [( x6 M8 |! ivar currentState ="";: Z. J9 _+ X$ ^" L/ O# G4 R
var innovator = aras.newIOMInnovator();2 ~% _3 |' F2 f k
var item = innovator.newItem("ECR","get");
' {# \) x" b- t7 mitem.setAttribute("select","state");; z* x" U1 W6 U$ U7 A# e/ b4 Z* V
var ecr_items = item.apply();6 U0 u3 w! @3 F5 @8 u* C) c' @
var totalCount = ecr_items.GetItemCount();$ |$ @) W7 N& b" S2 q1 U9 E
for( i=0; i<totalCount; i++) 2 s* K7 d; v4 ^* y+ \7 k0 S
{ 9 L3 K* i0 S$ w% [
current_item = ecr_items.getItemByIndex(i); # x3 Z0 W, N' z
current_state = current_item.getProperty("state"); . u, i4 |, c$ ~
swiTCh(current_state) # E4 K6 v! _ |
{ u! k, |; B/ W) s6 n6 ] z1 W
case "New":
' f3 N; f& K: u: r2 }- t7 F3 `$ i newCount++;
/ N3 u3 Y$ S/ f break;
) m# W- h5 ~4 w. Z. m; I1 h3 E case "Submitted": 9 J. l. j0 d6 i6 _# f$ Y
submittedCount++;
% e, s! ~ Y G break; ' I2 ]& q1 W+ z' g5 B* `
case "In Review": 6 o+ z T+ u ?6 o5 n
reviewedCount++;
! z- k1 Q8 R% I, R8 S: K break; 9 E+ ~. v8 N2 J! \2 H
case "Released":
4 ~$ M$ B; J% `* Z; r. E releasedCount++;
3 `; F& \) n2 t& t break;
8 e% u. r# D- ?! k case "Cancelled":
) I, X" M, f) c/ z8 V! z9 @ cancelCount++; & e% B1 V* A8 ~' Q
break; 1 J/ }4 @% B3 m I
}6 g2 K# {+ G+ f
}/ h) x& P! X1 |4 s8 z6 G
document.getElementById("MainDataForm").textNew.value=newCount;$ y5 [' g U3 O: E* _" U
document.getElementById("MainDataForm").textSubmitted.value=submittedCount;: l% s% l6 H( p. N! d( p! o
document.getElementById("MainDataForm").textReviewed.value=reviewedCount;
0 t9 J4 `5 {* g" |6 tdocument.getElementById("MainDataForm").textReleased.value=releasedCount;' }4 H" L' j# p( C* i3 r8 I
document.getElementById("MainDataForm").textCancelled.value=cancelCount;
% k) t+ A! Z" `- T1 s# n' v( p1 Ndocument.getElementById("MainDataForm").textTotal.value=totalCount;% U8 H1 r% L9 r
; M1 k0 K$ b# A! {4 n* J W |
|