|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示
8 L7 B3 k5 S% Q3 f T结果如下,点击Change Management标签,自动弹出统计界面5 g9 i3 K9 ]9 N/ B6 X
5 g# N7 [6 I* y0 \
/ J# @" j* ~' |
* ~+ J6 m& P; @* u! D/ }
* P6 F3 b) B& C4 O3 w5 e
- }# A: b8 b' D) F3 J& j; ]. Q(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名: f) ^7 t: r6 x+ Z7 [5 W
) \9 f- q, U" ^& _
. V5 }4 ?( U9 `! o2 }# c9 Q(2)关联一个 on load的事件,使用 JavaScript 的方式
# J6 t3 _. h. d5 t3 ^2 ] v
" L7 E+ q! p" [/ e/ r8 H$ B; G! o# Z
6 N. w4 x- ?1 @$ {! B(3)对整个事件进行代码
! B5 d1 ~# V! h) x9 i' E+ O
4 m- E5 ~+ V5 w" V2 n' S6 }3 |9 J1 W9 n, p2 p( Q/ `& C
完成后即可看到相关效果。# m" F( |' o" f" @& y4 b4 e3 ^
/ q- w- k$ V' w/ t& ^代码如下:+ j* S% T- V+ `* ?5 V$ O
# L* G _7 x: c7 c" C//get the ECR Collection
- ~, A9 S. j1 z" H% Q( \ Z3 uvar newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;
/ w( m- y2 a8 E4 @4 j+ o" Vvar currentItem = null;( v6 X. C: T, }/ Z! z& l
var currentState ="";8 o1 g7 i2 j" a6 U" ~. ]1 m
var innovator = aras.newIOMInnovator();
& b. }6 h3 w5 k+ a) Y2 [/ l1 q- d7 e6 Ovar item = innovator.newItem("ECR","get");
9 g# Q9 G) Z) B8 Yitem.setAttribute("select","state");
4 E9 y J: H) }2 V+ ?var ecr_items = item.apply();$ e9 Q$ ?" R" ^0 T- t
var totalCount = ecr_items.GetItemCount();( v* B3 I2 o8 S5 e9 m7 Z! W( z: h
for( i=0; i<totalCount; i++) & D( _% c0 y0 S/ T
{
+ G j* I$ H% d. W( B- V3 y current_item = ecr_items.getItemByIndex(i);
4 T7 h) g! S9 C% D! x9 W current_state = current_item.getProperty("state");
1 D/ Y) U3 s$ a% {+ B swiTCh(current_state) L, y- g; N& i2 y$ s
{ % b5 b& Z3 v P- \# l
case "New":5 x0 ?9 Y9 ]7 t6 r! \
newCount++;* M9 B- k# d% |5 o7 Y+ |
break;
0 d, ^! j/ X6 Z& \( q1 b case "Submitted":
H6 A, _# Q" g: O1 c, a submittedCount++; 6 [! `& v: N6 l% N2 x Z
break;
% p2 X+ q5 P* i& ^) v- N$ `4 e case "In Review":
3 ^' q7 b; Y% _# S5 n1 S' c# @ reviewedCount++; : t% v! w, e* m$ ~; m9 [
break; 7 R9 f P5 I; i* N" l6 Z# Q0 z- C
case "Released":
6 i+ I8 Z/ O. g releasedCount++;
' `( ~ r7 z A y D1 _: L break;
1 S' w1 B$ E2 x* N+ _ case "Cancelled":
4 ?2 t5 U9 }, v. m5 v! V4 c% U cancelCount++; K; r) a3 j/ z# p% g; f
break;
3 B! D2 X& N# {% } C4 S3 K, L3 s }
* d5 L9 y' C4 L: c: B}% G5 [4 \2 q0 S
document.getElementById("MainDataForm").textNew.value=newCount;! T) d# q0 g2 i4 W( G( l, G
document.getElementById("MainDataForm").textSubmitted.value=submittedCount;
0 B& C* a# i8 r# ]# Kdocument.getElementById("MainDataForm").textReviewed.value=reviewedCount;' Y+ K) \! U6 V
document.getElementById("MainDataForm").textReleased.value=releasedCount;
! O# q2 ^$ k N4 b( H1 z1 `document.getElementById("MainDataForm").textCancelled.value=cancelCount;
6 D3 m0 I& `6 K2 udocument.getElementById("MainDataForm").textTotal.value=totalCount;3 F6 }; ~) l6 V9 m; Z9 B
$ K/ o' D& D3 n& m; j* z
|
|