|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示$ P6 i9 e6 K `" R
结果如下,点击Change Management标签,自动弹出统计界面" q) y: R* Q# h' N/ c j' S0 t
' B k0 C: {' Q$ ~. \1 X6 s
% L* ^# _! L- s5 l3 [ d# L3 ?/ |2 R6 X/ b. W h0 v
, A! k! x* R3 A+ g" M4 ^
* n: U8 P% k8 v7 a* T3 a(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名. m, S% v( T5 b' S
3 d2 r; e5 }, }" i( P
8 Y! w' }! S, Z4 M5 k. a
(2)关联一个 on load的事件,使用 JavaScript 的方式
; ~% ^. A) ^- s1 {' m
3 S6 |7 }. N0 t" Z1 t2 q
& _- V4 ]. u# V8 k \. x: D(3)对整个事件进行代码
% s2 ?9 m* _# O3 `: }
( M! c3 i7 P' e1 Z( }1 j
" m$ Q6 n' \- Y完成后即可看到相关效果。/ R3 b! b5 v( q$ J
8 R7 f8 w% ]1 \* W7 N, k+ T代码如下:4 R1 g3 B, W* r, T' w
( ]6 r* b8 I0 Y `% p8 i//get the ECR Collection
. S" C9 P. N5 j: d2 B) ^var newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;# ?1 w! L/ F& S$ ^$ S
var currentItem = null;
+ \' n) b; C" w/ M+ p2 k/ d* Yvar currentState ="";* v) \" N" b, v. G1 ?. W
var innovator = aras.newIOMInnovator();4 |/ s( T: L. X4 ]- \5 r% B/ [4 {9 j
var item = innovator.newItem("ECR","get");! K6 E6 _3 d! u9 J0 i
item.setAttribute("select","state");8 g) X0 u: {1 Y+ C8 F1 K; b
var ecr_items = item.apply();
' N! {( f7 h% `/ B/ H/ \var totalCount = ecr_items.GetItemCount();
7 h6 [+ X! [9 @( J- g* X$ P" qfor( i=0; i<totalCount; i++)
5 H- y/ o: z8 {, V) Z, S: j{
7 l# r$ U: V- R7 i6 p! K current_item = ecr_items.getItemByIndex(i); 8 u4 B$ g2 D: {& Q) q6 }
current_state = current_item.getProperty("state"); * z) u( f2 g, m+ ]; K
swiTCh(current_state) 2 H0 V1 v% |9 |; _8 W4 [
{
3 @' L' R7 o. s6 w) Y case "New":# P7 i" F3 d! _4 X1 t
newCount++;
1 o9 N1 w9 @! S% X {# U; g break;0 ^4 P+ g& ?6 L2 a8 X
case "Submitted": # S1 M0 Y/ H) o8 y3 a
submittedCount++;
' ^2 {0 f% d F break;
) R# ]8 V" w4 d case "In Review": % Z1 J/ T& n! Q# D! J
reviewedCount++;
9 O! M0 P! b) B$ F; [- u# D break;
; N6 G/ k n1 W8 s case "Released": 9 w. p9 v" m3 f' [/ G. t1 B
releasedCount++; + a5 C5 ~; ?0 n9 Z J
break; & y: W1 }" w' e5 p% a" [
case "Cancelled": " t1 J+ n" _+ i% I5 z" y0 \5 v
cancelCount++;
/ P7 w$ T- w/ H& D' {% `7 ?! h break;
$ r- C% x, I* ^1 L4 I+ L" L3 ` }
7 B! |2 E8 X1 O t3 M6 i" H# J}0 o) d+ S. d$ h" z) S& S
document.getElementById("MainDataForm").textNew.value=newCount;6 f4 ? o8 ^" c! ?% k/ i2 W3 i- \
document.getElementById("MainDataForm").textSubmitted.value=submittedCount;. t1 _8 b( h) e; B& h) \6 H$ x
document.getElementById("MainDataForm").textReviewed.value=reviewedCount;% s8 o9 N: W; X. c6 _$ I1 w
document.getElementById("MainDataForm").textReleased.value=releasedCount;5 @5 r& w6 J' ^6 N- F5 m1 \& w
document.getElementById("MainDataForm").textCancelled.value=cancelCount;
/ ^' c1 D* o5 ^* q& e/ K, V8 \' edocument.getElementById("MainDataForm").textTotal.value=totalCount;
4 f6 S8 X* l# v# R# P0 r8 B$ T- Q. A6 X( Z! W1 L
|
|