|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示
F/ k$ i) z9 e: b1 V结果如下,点击Change Management标签,自动弹出统计界面
' Z, t' n4 X) H. \6 g$ X5 U
* P: N1 @4 G4 h% R5 B6 m, j
6 X1 b2 K- x7 [5 R1 \6 ~
8 h9 u6 T2 L/ ]" S B' M, I$ m' y1 T8 ]1 x
& Z2 ?$ e; _1 u7 h) R& _, w1 e4 h' Z(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名
1 S% @0 O, }8 D B. \: x' ^2 `# K' r; Q4 o
: Y+ s# {/ ~% A" W
(2)关联一个 on load的事件,使用 JavaScript 的方式
# ~ o: Z+ k* ]5 \% R: R
6 }& M( d1 T% i# f# E
# S+ V% W! O2 u9 _' m& z) x: }7 x(3)对整个事件进行代码
% b4 F) c, X) W, ?$ A) q, g2 D
2 |! A% e1 s) r! M3 y* A
1 l. N! }# [) y, D完成后即可看到相关效果。
& V' T0 z5 d+ D; _2 ^5 a3 {% w
' e$ y4 B; j( s& G1 Y) {1 H7 ?代码如下:
# N1 U1 X$ G& p
0 s6 a9 }3 W9 R9 s0 Q1 R1 V//get the ECR Collection
0 ^) s0 A! b+ d: D# t* w1 [ ]: `/ _var newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;
. E' M F! N/ ]; a+ Avar currentItem = null;: A$ V6 N! }* `4 S5 {+ I
var currentState ="";
) D- t+ }4 l0 \& L$ f5 Rvar innovator = aras.newIOMInnovator();
3 ~: S" ^6 W8 H4 c( Y0 D. nvar item = innovator.newItem("ECR","get");" L* ^- L; k6 B" ]2 T, }
item.setAttribute("select","state");( J% k% H( _# ~% u" [3 x6 Q
var ecr_items = item.apply(); E4 X2 V D& o: ?8 N( P" }
var totalCount = ecr_items.GetItemCount();
. J5 |$ j1 N' L$ y T4 tfor( i=0; i<totalCount; i++)
, |- N4 j% e9 h/ ^0 K6 G{ D' `/ L5 ?, Q
current_item = ecr_items.getItemByIndex(i);
( [: l0 @* ]3 g" d current_state = current_item.getProperty("state"); ) z4 z4 z u( A( l3 i$ f) `7 B
swiTCh(current_state) " Y( } x0 D: w, ] F
{ ( x( d/ N6 ?- X: v5 I
case "New":
% C+ H$ ?) [- n! B newCount++;% R* g+ [ W1 `
break;0 ~% _, u/ o+ b& q7 N
case "Submitted": n; e( T% k# W+ p% o: \( ~
submittedCount++; / g% P9 g, ?) I- j. P3 G
break;
& b* ^) h+ n( g7 l4 c case "In Review": ( ]% {9 j; H& O) \5 t6 P$ }2 Q8 o
reviewedCount++; " E9 n) ~; ~& u* k% c& a. d
break; 6 k/ g6 T, }) L& `' \. g$ |: |/ U3 y
case "Released": / F* H6 [/ G/ A
releasedCount++; . i7 J2 s+ z/ ^$ S
break;
/ I6 ~0 B$ T+ z0 _& k5 Z case "Cancelled": 7 H3 N# L& H2 v7 C- o* `
cancelCount++;
2 @# ^ G- h% A break; + a& {- x! t& _
}0 X0 o! Y4 f/ \9 P% l: I
}9 D" |* f& S5 ]( K- W5 n4 `6 s
document.getElementById("MainDataForm").textNew.value=newCount;! k( S# R) E x9 a8 Z2 t* l6 I
document.getElementById("MainDataForm").textSubmitted.value=submittedCount;; C/ Z- c: [1 Y# s6 v7 r
document.getElementById("MainDataForm").textReviewed.value=reviewedCount;
& p/ K1 Z& V- v4 hdocument.getElementById("MainDataForm").textReleased.value=releasedCount;, a3 O% S. Q$ J& o
document.getElementById("MainDataForm").textCancelled.value=cancelCount;
1 [; H0 _6 E% u: ndocument.getElementById("MainDataForm").textTotal.value=totalCount;
: V" `- x, E2 Z& h7 x7 n
2 x @$ d% j, t3 ~ |
|