|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示
) |9 M! J+ I: B$ N0 V8 G) q6 C结果如下,点击Change Management标签,自动弹出统计界面
# \) h! `$ S* |* r) ]0 Y% m/ b, i# A* s) S! L- N
+ ^; t& i) w7 o6 _/ u6 a
9 Z8 D8 @7 k$ N* ]( N) l' Y
1 O/ Y, W- t& U8 m
9 ? |# ?) Q5 E L
(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名
V9 w4 |& ^. `6 n8 S
1 }' s: t/ H# O! n
5 \" o! ~. }# f P f; r(2)关联一个 on load的事件,使用 JavaScript 的方式! O2 H1 q$ Q) W1 B# L$ Y
" R( p+ u* D9 ?
& g! K2 k, U" B( L* q9 u1 ~3 r* d(3)对整个事件进行代码
- O F( m# h$ W' t
/ a6 u' }! ^9 l; B. F
( F X* A; [8 i* g( g6 ?+ F
完成后即可看到相关效果。
4 ^2 B' @- j/ D% ^8 x' w3 t2 B. m, j4 H3 a
代码如下:
! Q7 a! v6 w: Q; f) d8 e
+ d) I5 J6 d2 j' Z r//get the ECR Collection
) x& U4 m- Y2 J8 _, P5 Mvar newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;5 I; e2 S5 b2 |- u7 a2 C* M) J: g
var currentItem = null;
3 T3 d8 @% k' N" h1 T& j+ Evar currentState ="";
0 ], Q% `9 |0 c2 ~var innovator = aras.newIOMInnovator();: J4 E3 L& t0 ]1 \' a: W; J
var item = innovator.newItem("ECR","get");" P) Z4 L t$ b/ V* T
item.setAttribute("select","state");5 c1 w# N! S! m; N! L7 R
var ecr_items = item.apply();/ T2 w8 [6 W# o z+ @( s: `, ^
var totalCount = ecr_items.GetItemCount();
O4 Q7 S! }3 `+ E0 D$ @for( i=0; i<totalCount; i++)
+ a: b/ P, _' Q' w L- e{
' R1 T* L4 d8 E- O- B1 q* ?# e/ J+ i current_item = ecr_items.getItemByIndex(i); , r1 K" G$ \3 P1 Z4 k4 W: d
current_state = current_item.getProperty("state"); 4 g7 b% A" j# g$ i; n: e) L
swiTCh(current_state) " z4 d! A" |! g6 a2 B+ ]
{
6 N, X$ N2 f% \ case "New":
w6 a3 H5 p& i. ^! r; _+ y newCount++;1 A- f9 L9 N6 e( m
break;
* A$ {7 _# e" V# i- B case "Submitted":
% }, z7 ?% O x# c. z+ g submittedCount++; 4 b$ O: w( N5 s9 Y3 i
break; , H: m: X5 I: B9 S/ i
case "In Review":
" v- @. @/ }+ M# a# r reviewedCount++;
9 s# D/ H% r# T! l' a8 F2 S0 | break;
/ f1 C0 f# b( u1 [9 N3 G case "Released":
" V4 O4 V' e5 p7 R# U" Y releasedCount++; + X( H& Z: R0 {: y
break;
: F& y" [7 P% P' j9 p case "Cancelled":
: {9 t! O- x1 T0 W cancelCount++; : J9 L$ C; I! Q7 O$ U
break; 1 q( a8 b' S+ F% i5 n
}
2 b3 _0 M) P, H2 z* B! `}2 U( q, g7 P7 V! e# F
document.getElementById("MainDataForm").textNew.value=newCount;
- p8 ^( ^7 ^( V6 P, _document.getElementById("MainDataForm").textSubmitted.value=submittedCount;
& U# v& `7 G5 `$ a- H# i; Q2 c! hdocument.getElementById("MainDataForm").textReviewed.value=reviewedCount;
8 t+ O! C @/ z: T+ {document.getElementById("MainDataForm").textReleased.value=releasedCount;4 y% W- j1 A: m- G) N: Y: q1 e
document.getElementById("MainDataForm").textCancelled.value=cancelCount;0 Y4 L8 R. S7 u2 K: C
document.getElementById("MainDataForm").textTotal.value=totalCount;
$ ?+ s+ i0 ^4 g4 J
+ D2 o5 r# i( C; r, d4 ^+ T! J% P |
|