|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
【Aras Innovator二次开发】创建一个自定义表单在TOC上展示0 _9 c( R" ]* T9 |9 l
结果如下,点击Change Management标签,自动弹出统计界面& r" O; }$ w! l
# W; J/ C( h7 t4 Q2 L
& T- n2 N! B9 F. V
# `4 Z% | q: i4 C
* J+ g" H5 V8 }6 c4 U( T% u4 @: x1 y0 _3 l0 w/ o0 F$ d
(1) 创建一个 Form表单,名字叫 Change Management,添加相应控件,注意控件ID命名
. _2 j9 a5 E# _. \* @
( u) U+ X3 N4 E( o3 H
7 [) }4 N- U( E* A(2)关联一个 on load的事件,使用 JavaScript 的方式
% R4 e/ h! k1 o$ }
8 Z8 ]+ `4 a7 I8 T
$ e% z! F* k4 L: Y3 x(3)对整个事件进行代码 U& [! }. H& K3 Z$ J
6 b$ {9 U& t% A2 o" _
! W6 Y0 x" W" o' ^4 z% p$ _ Z完成后即可看到相关效果。3 V8 P% \$ _! u5 U3 y) n
: W2 W7 i9 `/ l0 N. ?4 C/ V
代码如下:2 o8 W% {, @; H* n0 U4 A0 B, V
; o- g4 s3 t6 R" k. n2 L//get the ECR Collection4 Y6 C0 v7 ?% c8 Z
var newCount=0,submittedCount=0,reviewedCount=0,releasedCount=0,cancelCount=0;5 V+ O1 F5 S6 ?& z0 h$ v
var currentItem = null;8 y: a$ f0 H# t( a3 c
var currentState ="";4 S8 H: V+ H/ a" b# c/ u Y
var innovator = aras.newIOMInnovator(); q7 v; M, u( z
var item = innovator.newItem("ECR","get");
4 |/ W: B/ H1 b& citem.setAttribute("select","state");! q8 T: U! s' k7 }
var ecr_items = item.apply();) u+ W7 `2 @% h
var totalCount = ecr_items.GetItemCount();: d2 L( t" }2 y# Z$ ]
for( i=0; i<totalCount; i++)
( M) L0 w5 v# l+ p1 B{ - V6 U+ _7 V' d+ I) D% a5 R
current_item = ecr_items.getItemByIndex(i); + r" D. D p; n
current_state = current_item.getProperty("state");
4 d! D$ f: `. q* h1 I L) V swiTCh(current_state) & j1 I t0 _% P9 i( g
{
! `( r7 r2 I7 V( i# Z/ X case "New":
0 p* B# Y! w/ j: ^2 B, ~6 G. {/ ] newCount++;. U. z ?( R# R# l3 a- ~
break;; N, n: D# \' N! ^
case "Submitted": " T, C6 C6 S4 i& ?9 T- [2 Q( R! h
submittedCount++; & G$ K4 Z" l! E
break; ' k4 [7 [& \ J9 M7 H" J3 O
case "In Review": ) w" E, S; k6 N% N
reviewedCount++;
9 H, S1 D/ ~- Z, M7 H- \# p6 m7 d break; 0 v$ y6 \+ g' c! X0 w2 J
case "Released":
* H! v9 `9 z' a$ R: A releasedCount++; 0 p, _5 c: d+ [; x! K; E
break;
6 d8 q6 q$ T5 G1 N; _4 j case "Cancelled":
! [) Q; H; C3 g1 Z& ? cancelCount++;
1 i; a$ ?6 ~+ M) B break;
# a9 B. H. U( d2 l' c6 ` }
4 ], t# ]7 S U0 h' i" k& S( w# i}
9 Z$ C$ B# s& L: s/ X: Z, t9 qdocument.getElementById("MainDataForm").textNew.value=newCount;
8 n& y- l2 H2 ?3 I! L" B2 odocument.getElementById("MainDataForm").textSubmitted.value=submittedCount; F% O' p# I8 T
document.getElementById("MainDataForm").textReviewed.value=reviewedCount;
& ^7 y7 q7 Z4 [9 Y# zdocument.getElementById("MainDataForm").textReleased.value=releasedCount;* k9 C9 K& K* q' k
document.getElementById("MainDataForm").textCancelled.value=cancelCount;
. \/ e' C2 H: E7 l( U6 [- B( Vdocument.getElementById("MainDataForm").textTotal.value=totalCount;) m. B2 d6 D* y" Q/ Q% c9 S6 b
* S: a; T( R% F7 U+ E: v4 q- b3 |7 `( }; y
|
|