|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示
. {( w0 Z# F8 r结果如下,点击Change Management标签,自动弹出统计界面
* L, M8 \# ]6 F; Q( v
" T Q6 R( N# _' O' k
. k, Q* \; E% n# T
8 B% O; G% C, P8 P# T( F' g4 B: v) [( O% I( n* h* n) ?* Z8 J
" w2 ^2 F6 }& T8 v(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名
& c( [! ^8 k5 c$ F& {9 y$ U1 o, n! q' c$ j0 A' x
0 v5 S# y) x' _- t- @(2)关联一个 on load的事件,使用 JavaScript 的方式+ B8 w6 i# Y$ s
( P% e8 C2 b+ ]' q( t
- r8 N+ \! L7 F6 b! z
(3)对整个事件进行代码! p! G* a7 I, g. K. T! O
# v; D; f9 X7 @$ ]4 }; E) W- X
; R' z+ T2 c) M- L
完成后即可看到相关效果。+ u& M* s9 {; X# h) M
) N) f: ] m0 a代码如下:. `3 R0 D a5 _, h
/ l. R. H2 C" I4 t! c$ u5 u" o! W! Y//get the ECR Collection
* n- P! p- q7 R" ^5 X6 Bvar newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;
5 _ G3 w/ i R, ]+ evar currentItem = null;- g1 q3 }' J& x1 Q# K7 W2 m
var currentState ="";6 E. f+ H8 M0 P+ v7 x4 R
var innovator = aras.newIOMInnovator();
% g. e/ d7 ?+ a4 ^$ vvar item = innovator.newItem("ECR","get");1 I! G, q* w0 |! Q# f- k
item.setAttribute("select","state");
% R8 b( Y4 s# B% _% wvar ecr_items = item.apply();
: W. ]! P$ m$ y# Jvar totalCount = ecr_items.GetItemCount();+ y7 P L+ ?2 k
for( i=0; i<totalCount; i++)
" l" R8 o) v2 A{ : h9 e) M0 r0 B$ `
current_item = ecr_items.getItemByIndex(i);
* Z* a6 [; @; A9 b5 `# x current_state = current_item.getProperty("state");
% n( I9 @! M/ _4 L swiTCh(current_state) * W4 L6 o& E1 p$ W
{
! T0 q5 J/ P* s4 J4 n$ K case "New":
) @8 B( I. \1 t- K; c* U* ~1 y newCount++;& K& g; o+ U' |7 A$ w
break;& @" b3 N F2 l' D9 B" C; t
case "Submitted":
& e! [3 p( H4 x L: p: f# e' y submittedCount++;
9 L! O/ E* t* d break; 3 f% I; l. D% Z; P1 y/ M
case "In Review": $ @/ T! B6 l0 y1 _6 o
reviewedCount++; 2 i0 L d) v/ f2 _4 {1 P( L J
break;
! Q% S$ e& [" @- k case "Released": 3 u9 ?# T0 o: e8 J: ^
releasedCount++;
O; J" f4 G f( J' P$ i* H7 a break; . i% l$ ^9 d- F& s5 l
case "Cancelled":
$ @" N, }6 ?" F7 b0 H1 v; ~+ N3 s/ K B cancelCount++; * v) v- T' v6 L0 L2 M; J& S' ?" v, X1 c1 F
break;
" a$ m6 |! w% [( Z }
9 |1 x6 D: D; g9 v}
) N7 u# l0 Y9 i Kdocument.getElementById("MainDataForm").textNew.value=newCount;; K( |5 x# Y5 S, y% A
document.getElementById("MainDataForm").textSubmitted.value=submittedCount; E o# C4 O! J& K7 z
document.getElementById("MainDataForm").textReviewed.value=reviewedCount;
* Y0 c4 Z! L( ?- A! odocument.getElementById("MainDataForm").textReleased.value=releasedCount;8 `. j4 [3 {' y) |: }
document.getElementById("MainDataForm").textCancelled.value=cancelCount;+ U) n% m, n+ ~) f$ G
document.getElementById("MainDataForm").textTotal.value=totalCount;
1 E C. q9 P" }7 l p* w, n% l( Z" o F& D
|
|