|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示
3 A" }) F0 Y, ?& C, |结果如下,点击Change Management标签,自动弹出统计界面
! Q8 R X) C: J& f9 i: B! w. S5 v1 u" A3 q3 b4 w
. I/ l E+ G5 r+ ^, Z
2 _! @* ?- {9 z% G1 `4 {
* A- W( ^$ q& t6 G/ \6 E: M# V2 p* g; P- `7 S# l b: M5 y
(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名7 u- @" y, g7 E0 P, ]
) `/ Z7 `2 y7 V
- N' K: Q1 B+ Y. m& y( r- M(2)关联一个 on load的事件,使用 JavaScript 的方式; i: i2 V: X8 o2 k( T
7 Z: R. y V. w
3 }7 v, H- D2 O# D; f3 u" U# i$ b' ](3)对整个事件进行代码+ p8 h; @- h. P; p* P8 c# f
9 t( ~- r4 S1 x5 }" e& e2 c, Z
+ @# V, ^1 R7 Z完成后即可看到相关效果。
: G7 [ l% n9 x! t6 x7 Z* x4 N7 M5 g& u
4 A- R1 a8 ~7 m代码如下:3 ]5 t7 E: F/ e! R9 {; J; A
0 Z) @9 R( P# x( z
//get the ECR Collection
* x% Z( V) z3 a9 i. [- Rvar newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;
7 _& p' x& z, Q+ `& W7 f& Vvar currentItem = null;2 S9 L O: f5 _2 U$ L
var currentState ="";+ E6 n, @6 k& ?0 R; N
var innovator = aras.newIOMInnovator();
6 O0 l( U7 n4 K4 X q+ d" Avar item = innovator.newItem("ECR","get");
k* _1 `( G' X4 j4 W5 @" Y% vitem.setAttribute("select","state");
9 r; a7 ~/ _( i, Vvar ecr_items = item.apply();
+ F+ s. C$ K" Xvar totalCount = ecr_items.GetItemCount();) @$ C7 d a$ o6 m8 v
for( i=0; i<totalCount; i++)
( K1 a/ Y- I4 [{
8 q7 p1 m5 K5 h current_item = ecr_items.getItemByIndex(i);
* q- g e; M- o0 a( J! g current_state = current_item.getProperty("state"); o8 ?3 `% [- M) c+ n1 _: M5 [
swiTCh(current_state)
* b) m2 o9 {1 J; B {
: H* N3 Y7 K- O5 V case "New":
6 t8 ]* d* q; O newCount++;' p* @+ u+ |% v+ ]( z, f- `6 C( l
break;
9 J" b) q9 }/ F9 f5 [, d5 g5 N3 C case "Submitted":
9 g. z& [8 W6 E8 G submittedCount++;
9 m) l; _( l9 w/ V" h break; 5 r5 `' N0 v# r
case "In Review":
+ b9 h" q/ x5 l9 s% A0 w reviewedCount++; 3 m1 f) @1 Q: e5 n% e$ r2 v
break;
Z: N: U4 c, U1 y+ D) k case "Released": * X' c) C3 i3 ]( R+ w0 d. Z
releasedCount++; ) d) Y( k3 F' U3 x/ W
break;
! {4 D, y) w: u. w case "Cancelled": 2 `( H3 a m* x3 Z2 t5 D) c/ D
cancelCount++;
: I4 L& i h; ~8 M( j. L break;
) P1 |; w/ `: z9 a- y7 b }! j7 a) ?& }. m, z5 D- G7 ^
}: A' D( i# Q, w* b
document.getElementById("MainDataForm").textNew.value=newCount;
7 x, x. Q4 E$ ldocument.getElementById("MainDataForm").textSubmitted.value=submittedCount;2 q y" `) Z: v3 @
document.getElementById("MainDataForm").textReviewed.value=reviewedCount;
& f2 b( M/ M# `: Wdocument.getElementById("MainDataForm").textReleased.value=releasedCount;
3 y3 e8 ~/ m9 {9 w& L: Cdocument.getElementById("MainDataForm").textCancelled.value=cancelCount;2 s% }9 f5 y2 Q9 c; B. r
document.getElementById("MainDataForm").textTotal.value=totalCount;2 s5 g. y1 R# E& v5 v: M5 ]
) r0 t5 a' {, ~$ M ?% y7 Z# B I |
|