|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示( C N- _0 W$ T& ~; O! R- L6 v
结果如下,点击Change Management标签,自动弹出统计界面
# b' E& M: y$ @' t0 ~9 F- r4 ]" G' w! M2 {) J1 M7 k4 x
1 p7 ~6 a& S# P A
* t. I! `1 ?, l& ~( N7 |/ O' ]9 g
5 _3 U& h0 e5 r$ p# B9 |) _! Z
(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名, s% e [" T% s1 h/ g+ q
( n3 g. _+ J. O" g+ C u1 \
' a0 }2 a: M9 F1 }4 P: \& N(2)关联一个 on load的事件,使用 JavaScript 的方式
" ? P7 z& U9 C6 \9 i9 b7 U
: |! |2 L' R( m$ Z( z& g, W/ }# D8 ~. j% r7 r; X/ D# W7 j) w
(3)对整个事件进行代码
( ^% `5 H" Z6 C5 m) G @
, i7 y- T4 K p3 H
, W; j2 ~3 {3 p! O' w: J完成后即可看到相关效果。; O5 O( q: @) y. k9 J
$ e% s% e/ F0 ?代码如下:
8 w4 Y9 E1 N, G ~7 E
0 n8 K |6 T, ]' C2 i( j//get the ECR Collection Y- |$ U( U. `! V
var newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;( L! {& U: ]; \' w" l
var currentItem = null;+ H$ y9 Y& h, h& L' J( r
var currentState ="";8 b' B: K9 ~0 P" }% N
var innovator = aras.newIOMInnovator();
* M! T0 P: R8 d& g0 O7 {9 jvar item = innovator.newItem("ECR","get");4 n5 d( ?6 G% I, N1 {& y D
item.setAttribute("select","state");
7 N+ o# o R8 Jvar ecr_items = item.apply();' O3 U7 V, }: T l
var totalCount = ecr_items.GetItemCount();
I0 H" ]5 p/ I7 W7 ~' x0 N8 z; Rfor( i=0; i<totalCount; i++) ( {: K3 a \6 L1 L& M" s
{ ! R5 U# U+ A) x5 V% W/ X. R5 C1 E5 Y
current_item = ecr_items.getItemByIndex(i); 7 T9 z6 w& B9 c# L8 L$ _
current_state = current_item.getProperty("state"); 9 X6 o; P r# r' [. L2 Z) P; @
swiTCh(current_state) % o2 M" h% y( W) C3 R
{
8 U0 [3 Y! Y: t Z) E7 b. v$ `7 g case "New":
7 o, ^" M3 k1 m, q newCount++;1 j; i; G) q& g0 d$ w7 S
break;
" p9 I$ k' {+ g# }# W& n2 s' J case "Submitted": 6 b6 }- Z: W/ M
submittedCount++;
7 L/ ?' I3 ~) _ break; . Z! N/ x7 P0 l/ W# H2 j Y. I% f5 D
case "In Review": 6 W3 z4 c) @( b) F
reviewedCount++;
8 u5 p: H3 v9 f8 G+ o* ? break; " O3 d' |; W! }
case "Released":
7 e3 d* C- U. F# L' P4 b! J releasedCount++;
6 X' S, g: ]9 n# E: \2 j4 ]6 O break; ; C, p6 q4 J% h: w9 Y1 ~. q7 M; R
case "Cancelled":
1 [4 \: `8 D6 I, z$ M0 {% N! I cancelCount++;
# S7 m, @! l. S6 f- f break; $ W2 Z7 N; M# B2 [+ w
}4 ?0 {3 ~* S1 K! T' r* |
}
3 `2 z- d- T& O: [8 K2 k7 mdocument.getElementById("MainDataForm").textNew.value=newCount;) j* R2 i5 |5 C% T/ g1 S8 E
document.getElementById("MainDataForm").textSubmitted.value=submittedCount;
" S- N4 ]. s; I9 fdocument.getElementById("MainDataForm").textReviewed.value=reviewedCount;: A8 z y5 @! f. n$ w! I
document.getElementById("MainDataForm").textReleased.value=releasedCount;
/ g% ]+ s" Q% F7 E7 I' _# i; kdocument.getElementById("MainDataForm").textCancelled.value=cancelCount;
% g: U2 E3 Q( D& a! j: t1 h0 k. F5 Rdocument.getElementById("MainDataForm").textTotal.value=totalCount;
; z# W* _- W9 B3 `( \
+ r j! M! Q# d U y$ W0 y |
|