|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示) C3 p! M* j9 ?! ~: u6 y5 B) M; L
结果如下,点击Change Management标签,自动弹出统计界面! f2 l- o: X$ _1 ?2 |& J9 K' _6 w
6 ~) B3 ~% I" p6 h9 {
+ ^/ z: v- O8 X) m- U) Y" U# V
- Y @& h* @) l/ l/ K1 L
+ W# J, s8 Q6 ^5 R) F' W" Q; y+ m: A3 v. n ?. x7 L# V
(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名
6 I, `/ I2 \+ H( c) c- V; k) t$ X, a h* A1 `% c' [8 d- R3 J5 u+ l
0 P7 H6 b* T$ q% Y
(2)关联一个 on load的事件,使用 JavaScript 的方式0 n8 e7 H( F8 G# T# v
. b/ |7 f" S/ q; x+ \3 G8 L
- e k, G& \: J0 ~
(3)对整个事件进行代码' B+ l8 a: q8 G* z' a
@, {9 x9 O2 f' c
) F+ [& Q) j, Z" v, V! J; V
完成后即可看到相关效果。4 o0 x7 P9 b4 _0 O A& E
; P, h0 T. f6 [+ D+ D; d" a代码如下:0 ~+ u, Z7 V; e% b: O. i! X
; M0 V; Q. l& l+ ~3 E8 B//get the ECR Collection( B! u3 P2 p* j
var newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;
* ]3 Q, G# I$ B- e$ bvar currentItem = null;
' R8 V1 `( L8 z% o, E" o; [# Zvar currentState ="";
( |5 V8 u j% c5 cvar innovator = aras.newIOMInnovator();; [, v0 r& Q" O( |/ r' ~
var item = innovator.newItem("ECR","get");
: U: m3 S2 J8 n" c6 a8 Oitem.setAttribute("select","state");; R: q- e: K+ w) l! h1 }
var ecr_items = item.apply();5 y0 a4 v" e4 k! B$ D
var totalCount = ecr_items.GetItemCount();
0 ^4 i8 k- g8 z7 ^$ }0 w+ [for( i=0; i<totalCount; i++)
6 {9 i Y6 ^: W/ }8 z; ?* g: k! u{ % G3 p2 ~& {- B) D7 D8 f3 \" i
current_item = ecr_items.getItemByIndex(i); : v: r4 x6 }4 x' C; l$ x
current_state = current_item.getProperty("state"); I( P% h A8 w- c6 ]" W
swiTCh(current_state)
0 A# X! Z, g \: D1 f1 J6 m {
7 `7 V5 B; M8 r. [8 `) Y case "New":
1 J+ Z! J+ f0 O) ` newCount++;7 J5 V' L; \) z( K: ~6 x
break;
/ c l: P0 m# e1 t% l case "Submitted": . G# `& J6 L% O3 x6 i) U- S' z
submittedCount++;
1 c7 J/ f' m9 v" N7 b' d H break;
8 n8 Y( k3 c9 @, s7 m3 Y% i case "In Review": $ p u+ Z7 m5 o7 b
reviewedCount++; # ?0 `! Y" X) f5 h% W; {9 ?
break;
# s4 L0 m0 k; x case "Released": * R8 c4 X# j g( @& Y R4 d5 n
releasedCount++; " h$ J- q* u+ M
break;
" y( y$ F- F+ {" a% z$ F case "Cancelled":
$ s t+ R! J$ _' v cancelCount++;
8 i; l: C3 m' X% k4 M& t5 y: u break; 8 E3 f7 f0 l( U2 X* W
}: ~' @! U; S- C1 _; q; W
}0 u* s2 o3 D4 o
document.getElementById("MainDataForm").textNew.value=newCount;
$ O, N2 ], h$ A; _! mdocument.getElementById("MainDataForm").textSubmitted.value=submittedCount;
9 ?: g- {! N e9 Q/ }document.getElementById("MainDataForm").textReviewed.value=reviewedCount;
( G' n7 F$ h" U! D4 Idocument.getElementById("MainDataForm").textReleased.value=releasedCount;& C/ k4 g1 H, s* L. g6 j
document.getElementById("MainDataForm").textCancelled.value=cancelCount;+ ~# g$ p0 c ^% E, f
document.getElementById("MainDataForm").textTotal.value=totalCount;5 V6 g9 n3 X7 T- E1 m
8 w: B: `' y: \) X |
|