- 浏览: 141428 次
- 性别:
- 来自: 成都
文章分类
最新评论
<?xml version="1.0" encoding="utf-8"?>
<!--添加会商纪录-->
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:an="com.cist.utils.page.action.*"
xmlns:com="com.cist.components.company.*"
xmlns:cdf="com.cist.utils.date.*"
creationComplete="init()"
width="840"
height="397"
title="应急能力评估--{titleStr}"
layout="absolute"
showCloseButton="true"
close="closewindow()">
<mx:Script>
<![CDATA[
import mx.controls.List;
import com.cist.utils.ImageHelper;
import com.cist.BaseWidget;
import com.cist.widgets.UrgencyAssess.CapacityAssessmentWidget;
import com.cist.utils.OpenManager;
import mx.collections.*;
import mx.controls.Alert;
import com.cist.utils.RemoteConnection;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;
import com.cist.utils.page.action.PageUtil;
import com.cist.utils.init.Store;
import mx.controls.DateField;
import mx.printing.*;
import mx.printing.PrintAdvancedDataGrid;
[Bindable]
private var titleStr:String; //窗口标题
[Bindable]
private var isShow:Boolean = false; //是否显示
[Bindable]
private var isShow2:Boolean = false;
[Bindable]
private var update:Object = {};//修改查看基础信息对象
private var selCondition:Object = {};
private var bw:BaseWidget;
private var rc:RemoteObject;
private var obj:Object;
private var condition:Object = {};
private var oldState:String;
private var list:ArrayCollection= new ArrayCollection();
[Bindable]
private var assess:Object = {};
[Bindable]
private var as1:Object = {};
[Bindable]
private var as2:Object = {};
private var byteArray:ByteArray;
private var fileReference:FileReference = new FileReference();
private function init():void{
//upload
fileReference.addEventListener(Event.SELECT,file_selected);
fileReference.addEventListener(ProgressEvent.PROGRESS,progress);
fileReference.addEventListener(Event.COMPLETE,complete);
}
private var fileName:String = "";
private var size:uint = 0;
private function complete(event:Event):void{
size = fileReference.size;
fileName = fileReference.name;
byteArray = fileReference.data;
}
private function progress(event:ProgressEvent):void{
}
private function file_selected(event:Event):void{
try {
fileReference.load();
} catch (err:Error) {
// message.text = "ERROR: zero-byte file";
}
}
//下载导出文档
private function exportdownload():void{
var headname:String = update.name+update.id+".doc";
if(headname!=null&&headname!=""){
var url:String = Store.geturl();
url = url.replace("index.swf","downfile/"+headname);
var urlR:URLRequest = new URLRequest(encodeURI(url));
try{
fileReference.download(urlR,headname);
this.closewindow();
}catch(err:Error){
Alert.show("下载失败");
}
}
}
//删除导出文档
private function exportdelete():void{
var headname:String = update.name+update.id+".doc";
RemoteConnection.getRemote("assessmentService").exportDelete(headname);
this.closewindow();
}
//关闭窗口
private function closewindow():void{
OpenManager.closeTitleWindow(this,true);
}
//窗口标题、MeetingRecord、是否显示、是否可编辑
public function setparamValue(title:String,bw:BaseWidget,isShow:Boolean=false,isShow2:Boolean=false):void{
this.isShow = isShow;
this.bw = bw;
this.titleStr = title;
this.isShow2 = isShow2;
}
public function set up(o:Object):void{
this.update = o;
dpHierarchy = new ArrayCollection([
{Region:update.name, children: [
{Region:"Arizona", children: [
]},
]}
]);
showAS();
}
public function set select(s:String):void{
this.titleStr = s;
}
[Bindable]
private var dpHierarchy:ArrayCollection ;
[Bindable]
private var acc:ArrayCollection ;
public function showAS():void{
var condition :Object= {
name:update.name,
createtime:update.createTime}
RemoteConnection.getRemote("assessmentService",resultHandle).getAssess(condition);
}
public function resultHandle(event:ResultEvent):void{
list = event.result as ArrayCollection;
var aa:ArrayCollection = new ArrayCollection();
var ab:ArrayCollection = new ArrayCollection();
var cc:ArrayCollection = new ArrayCollection();
for(var i:int=0;i<list.length;i++){
var ob:Object = list[i];
if(ob.rank == "1"){
as1 = {v3id:ob.v3id,v4id:ob.v4id, Actual:ob.grade, Estimate:ob.name,con:ob.organization,expert:ob.expert,personal:ob.personnel};
aa.addItem(as1);
}
}
var oo:Object = dpHierarchy.getItemAt(0);
oo.children = aa;
for(var a:int=0;a<aa.length;a++){
for(var j:int=0;j<list.length;j++){
var ob:Object = list[j];
if(ob.rank == "2"){
as2 = {v4id:ob.v4id, Actual:ob.grade, Estimate:ob.name,con:ob.organization,expert:ob.expert,personal:ob.personnel};
ab.addItem(as2);
}
}
var ob:Object = aa.getItemAt(a);
ob.children = ab;
}
for(var b:int=0;b<ab.length;b++){
var bb:ArrayCollection = new ArrayCollection();
for(var j:int=0;j<list.length;j++){
var ob:Object = list[j];
if(ab[b].v4id == ob.v4id&&ob.rank == "3"){
assess = {v4id:ob.v4id,Actual:ob.grade, Estimate:ob.name,con:ob.organization,expert:ob.expert,personal:ob.personnel};
bb.addItem(assess);
}
}
var oa:Object = ab.getItemAt(b);
oa.children = bb;
}
this.acc = aa;
export();
}
//生成word
private function export():void{
var headname:String = update.name + ""+update.id;
var time:String = DateField.dateToString(update.createTime,"YYYY-MM-DD");
var aa:ArrayCollection = new ArrayCollection();
var condition :Object= {headname:headname,time:time,list:this.acc}
rc=RemoteConnection.getRemote("assessmentService");
rc.exportWord(condition);
}
private function doPrint():void {
var printJob:FlexPrintJob = new FlexPrintJob();
var printADG:PrintAdvancedDataGrid =
new PrintAdvancedDataGrid();
printADG.includeInLayout = false;
printADG.source = adg;
addChild(printADG);
if (printJob.start() == false) {
removeChild(printADG);
return;
}
printJob.addObject(printADG, FlexPrintJobScaleType.NONE);
printJob.send();
removeChild(printADG);
}
public function myColStyleFunc(data:Object,col:AdvancedDataGridColumn):Object {
var str:String = data["Actual"];
if(str!=null&&str!=""){
var num:Number =Number(str.charAt(0));
if((1.5<num) && (num<=2.5)){
return {color:0xEEEE55};
}
if((2.5<num) && (num<=3.5)){
return {color:0x00FF00};
}
if((3.5<num) && (num<=4)){
return {color:0x0000FF};
}
if((1.0<num) && (num<=1.5)){
return {color:0xFF0000};
}
return null;
}
return null;
}
]]>
</mx:Script>
<mx:Form width="100%" height="100%">
<mx:AdvancedDataGrid id="adg"
width="100%" height="100%">
<mx:dataProvider>
<mx:HierarchicalData source="{dpHierarchy}"/>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Region" headerText="事件名称"/>
<mx:AdvancedDataGridColumn dataField="v3id" headerText="大类"/>
<mx:AdvancedDataGridColumn dataField="v4id" headerText="属性"/>
<mx:AdvancedDataGridColumn dataField="Estimate" headerText="评分对象"/>
<mx:AdvancedDataGridColumn dataField="Actual" headerText="评分结果" styleFunction="myColStyleFunc"/>
<mx:AdvancedDataGridColumn dataField="con" headerText="所属地区"/>
<mx:AdvancedDataGridColumn dataField="expert" headerText="评估专家"/>
<mx:AdvancedDataGridColumn dataField="personal" headerText="评估人员"/>
</mx:columns>
</mx:AdvancedDataGrid>
<mx:HBox horizontalAlign="right" width="100%">
<mx:Button id="myButton" label="打印文档" click="doPrint()" visible="{isShow2}"/>
<mx:Button id="mybt" label="返回目录" click="exportdelete()" visible="{isShow2}"/>
<mx:Button label="导出文档" click="exportdownload()" visible="{isShow}"/>
<mx:Button label="关闭返回" click="exportdelete()" visible="{isShow}"/>
</mx:HBox>
</mx:Form>
</mx:TitleWindow>
<!--添加会商纪录-->
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:an="com.cist.utils.page.action.*"
xmlns:com="com.cist.components.company.*"
xmlns:cdf="com.cist.utils.date.*"
creationComplete="init()"
width="840"
height="397"
title="应急能力评估--{titleStr}"
layout="absolute"
showCloseButton="true"
close="closewindow()">
<mx:Script>
<![CDATA[
import mx.controls.List;
import com.cist.utils.ImageHelper;
import com.cist.BaseWidget;
import com.cist.widgets.UrgencyAssess.CapacityAssessmentWidget;
import com.cist.utils.OpenManager;
import mx.collections.*;
import mx.controls.Alert;
import com.cist.utils.RemoteConnection;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;
import com.cist.utils.page.action.PageUtil;
import com.cist.utils.init.Store;
import mx.controls.DateField;
import mx.printing.*;
import mx.printing.PrintAdvancedDataGrid;
[Bindable]
private var titleStr:String; //窗口标题
[Bindable]
private var isShow:Boolean = false; //是否显示
[Bindable]
private var isShow2:Boolean = false;
[Bindable]
private var update:Object = {};//修改查看基础信息对象
private var selCondition:Object = {};
private var bw:BaseWidget;
private var rc:RemoteObject;
private var obj:Object;
private var condition:Object = {};
private var oldState:String;
private var list:ArrayCollection= new ArrayCollection();
[Bindable]
private var assess:Object = {};
[Bindable]
private var as1:Object = {};
[Bindable]
private var as2:Object = {};
private var byteArray:ByteArray;
private var fileReference:FileReference = new FileReference();
private function init():void{
//upload
fileReference.addEventListener(Event.SELECT,file_selected);
fileReference.addEventListener(ProgressEvent.PROGRESS,progress);
fileReference.addEventListener(Event.COMPLETE,complete);
}
private var fileName:String = "";
private var size:uint = 0;
private function complete(event:Event):void{
size = fileReference.size;
fileName = fileReference.name;
byteArray = fileReference.data;
}
private function progress(event:ProgressEvent):void{
}
private function file_selected(event:Event):void{
try {
fileReference.load();
} catch (err:Error) {
// message.text = "ERROR: zero-byte file";
}
}
//下载导出文档
private function exportdownload():void{
var headname:String = update.name+update.id+".doc";
if(headname!=null&&headname!=""){
var url:String = Store.geturl();
url = url.replace("index.swf","downfile/"+headname);
var urlR:URLRequest = new URLRequest(encodeURI(url));
try{
fileReference.download(urlR,headname);
this.closewindow();
}catch(err:Error){
Alert.show("下载失败");
}
}
}
//删除导出文档
private function exportdelete():void{
var headname:String = update.name+update.id+".doc";
RemoteConnection.getRemote("assessmentService").exportDelete(headname);
this.closewindow();
}
//关闭窗口
private function closewindow():void{
OpenManager.closeTitleWindow(this,true);
}
//窗口标题、MeetingRecord、是否显示、是否可编辑
public function setparamValue(title:String,bw:BaseWidget,isShow:Boolean=false,isShow2:Boolean=false):void{
this.isShow = isShow;
this.bw = bw;
this.titleStr = title;
this.isShow2 = isShow2;
}
public function set up(o:Object):void{
this.update = o;
dpHierarchy = new ArrayCollection([
{Region:update.name, children: [
{Region:"Arizona", children: [
]},
]}
]);
showAS();
}
public function set select(s:String):void{
this.titleStr = s;
}
[Bindable]
private var dpHierarchy:ArrayCollection ;
[Bindable]
private var acc:ArrayCollection ;
public function showAS():void{
var condition :Object= {
name:update.name,
createtime:update.createTime}
RemoteConnection.getRemote("assessmentService",resultHandle).getAssess(condition);
}
public function resultHandle(event:ResultEvent):void{
list = event.result as ArrayCollection;
var aa:ArrayCollection = new ArrayCollection();
var ab:ArrayCollection = new ArrayCollection();
var cc:ArrayCollection = new ArrayCollection();
for(var i:int=0;i<list.length;i++){
var ob:Object = list[i];
if(ob.rank == "1"){
as1 = {v3id:ob.v3id,v4id:ob.v4id, Actual:ob.grade, Estimate:ob.name,con:ob.organization,expert:ob.expert,personal:ob.personnel};
aa.addItem(as1);
}
}
var oo:Object = dpHierarchy.getItemAt(0);
oo.children = aa;
for(var a:int=0;a<aa.length;a++){
for(var j:int=0;j<list.length;j++){
var ob:Object = list[j];
if(ob.rank == "2"){
as2 = {v4id:ob.v4id, Actual:ob.grade, Estimate:ob.name,con:ob.organization,expert:ob.expert,personal:ob.personnel};
ab.addItem(as2);
}
}
var ob:Object = aa.getItemAt(a);
ob.children = ab;
}
for(var b:int=0;b<ab.length;b++){
var bb:ArrayCollection = new ArrayCollection();
for(var j:int=0;j<list.length;j++){
var ob:Object = list[j];
if(ab[b].v4id == ob.v4id&&ob.rank == "3"){
assess = {v4id:ob.v4id,Actual:ob.grade, Estimate:ob.name,con:ob.organization,expert:ob.expert,personal:ob.personnel};
bb.addItem(assess);
}
}
var oa:Object = ab.getItemAt(b);
oa.children = bb;
}
this.acc = aa;
export();
}
//生成word
private function export():void{
var headname:String = update.name + ""+update.id;
var time:String = DateField.dateToString(update.createTime,"YYYY-MM-DD");
var aa:ArrayCollection = new ArrayCollection();
var condition :Object= {headname:headname,time:time,list:this.acc}
rc=RemoteConnection.getRemote("assessmentService");
rc.exportWord(condition);
}
private function doPrint():void {
var printJob:FlexPrintJob = new FlexPrintJob();
var printADG:PrintAdvancedDataGrid =
new PrintAdvancedDataGrid();
printADG.includeInLayout = false;
printADG.source = adg;
addChild(printADG);
if (printJob.start() == false) {
removeChild(printADG);
return;
}
printJob.addObject(printADG, FlexPrintJobScaleType.NONE);
printJob.send();
removeChild(printADG);
}
public function myColStyleFunc(data:Object,col:AdvancedDataGridColumn):Object {
var str:String = data["Actual"];
if(str!=null&&str!=""){
var num:Number =Number(str.charAt(0));
if((1.5<num) && (num<=2.5)){
return {color:0xEEEE55};
}
if((2.5<num) && (num<=3.5)){
return {color:0x00FF00};
}
if((3.5<num) && (num<=4)){
return {color:0x0000FF};
}
if((1.0<num) && (num<=1.5)){
return {color:0xFF0000};
}
return null;
}
return null;
}
]]>
</mx:Script>
<mx:Form width="100%" height="100%">
<mx:AdvancedDataGrid id="adg"
width="100%" height="100%">
<mx:dataProvider>
<mx:HierarchicalData source="{dpHierarchy}"/>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="Region" headerText="事件名称"/>
<mx:AdvancedDataGridColumn dataField="v3id" headerText="大类"/>
<mx:AdvancedDataGridColumn dataField="v4id" headerText="属性"/>
<mx:AdvancedDataGridColumn dataField="Estimate" headerText="评分对象"/>
<mx:AdvancedDataGridColumn dataField="Actual" headerText="评分结果" styleFunction="myColStyleFunc"/>
<mx:AdvancedDataGridColumn dataField="con" headerText="所属地区"/>
<mx:AdvancedDataGridColumn dataField="expert" headerText="评估专家"/>
<mx:AdvancedDataGridColumn dataField="personal" headerText="评估人员"/>
</mx:columns>
</mx:AdvancedDataGrid>
<mx:HBox horizontalAlign="right" width="100%">
<mx:Button id="myButton" label="打印文档" click="doPrint()" visible="{isShow2}"/>
<mx:Button id="mybt" label="返回目录" click="exportdelete()" visible="{isShow2}"/>
<mx:Button label="导出文档" click="exportdownload()" visible="{isShow}"/>
<mx:Button label="关闭返回" click="exportdelete()" visible="{isShow}"/>
</mx:HBox>
</mx:Form>
</mx:TitleWindow>
相关推荐
在Flex开发中,数据网格(DataGrid)是用于展示大量结构化数据的常用组件。它允许用户以表格的形式查看和操作数据。当我们处理的数据需要进行分类或者分组时,Flex DataGrid 提供了表头分组的功能,这使得数据的展示...
### Flex技术中AdvancedDataGrid使用方法 #### 一、多列排序 在默认情况下,`AdvancedDataGrid`组件会按照数据被添加至其`DataProvider`的顺序来展示数据。与`DataGrid`组件类似,`AdvancedDataGrid`也支持用户在...
在IT行业中,Flex是一种基于ActionScript 3.0和Flash Player的开源框架,主要用于构建富互联网应用程序(RIA)。本文将围绕“Flex 合并单元格”这一主题进行深入探讨,结合给定的标签“源码”和“工具”,我们将讨论...
在Flex开发中,AdvancedDataGrid组件是一个功能强大的数据网格,它可以显示层次结构的数据,并提供了丰富的定制选项。在一些应用场景中,我们可能需要在AdvancedDataGrid中实现带有复选框的树形结构,以便用户可以...
另外,每个DataGrid的列也需要配置为显示复选框,可以通过在Column或AdvancedDataGridColumn中设置dataField属性为“selected”,并指定renderer为CheckBox类型。 在博文《flex在DataGrid中实现checkbox全选或取消...
在Flex 3中,开发者们可以体验到一系列新特性,其中AdvancedDataGrid是一个引人注目的组件,它是DataGrid的增强版。AdvancedDataGrid并非包含在标准的Flex 3 SDK中,因为它与Charting Enhancements一起构成了Flex ...
在Flex中,每列都是一个Column对象,可以通过Column或AdvancedDataGridColumn类来创建。这两个类提供了丰富的属性和方法,以满足各种定制需求。例如,`headerText`属性可以用来设置列头的文本,`width`属性用于设定...
在Flex开发中,AdvancedDataGrid(ADG)是高级数据网格组件,相比普通的DataGrid,它提供了更丰富的功能,如分组、排序、多级表头以及更复杂的列类型。在"Flex--AdvanceDataGrid(列头筛选功能,含ComboBox列、Button...
4. 定义列:通过`<mx:AdvancedDataGridColumn>`标签为网格定义列,包括列标题、数据字段、排序方式等。 5. 配置分组:如果需要数据分组,可以通过`<mx:AdvancedDataGridGroupItem>`来配置分组项。 6. 添加功能:根据...
在Flex框架中,DataGrid是用于展示数据列表的常用组件之一。它提供了丰富的特性来处理数据,包括排序、过滤和自定义渲染等。而在实际应用中,全选和全不选功能是数据列表中常见的需求,尤其是在需要批量操作场景下。...
在Flex4中,修改表格(Spark Tables)的单元格背景色是常见的需求,尤其是在创建数据可视化或用户界面定制时。Flex4引入了全新的组件架构,其中Spark表格组件提供了更多的自定义选项,使得开发者能够轻松地调整...
在创建DataGrid时,我们需要定义列(columns),每一列可以通过Column或AdvancedDataGridColumn对象定义,包括列的标题、宽度、数据字段等属性。 `AdvancedDataGrid`是DataGrid的增强版,提供了更复杂的数据组织和...
Flex是Adobe公司推出的一个开源的应用程序框架,主要用于开发富互联网应用(RIA), 它允许开发人员使用Adobe Flash平台创建应用程序,也可以部署为Web应用或独立应用程序。Flex中的打印操作和分页打印操作是实现数据...
在`Flex_GridFilter.mxml`中,`DataGrid`可能有一个`<mx:AdvancedDataGridColumn>`,其`headerRenderer`包含一个输入框和应用过滤的按钮。用户在输入框中输入过滤条件,点击按钮后,应用过滤函数,更新`DataGrid`...
通过嵌套<mx:AdvancedDataGridColumn>标签定义了不同的列。在示例代码中,定义了一个名为"学校"的列,用来展示学校名称,其余的列则没有在代码片段中完整显示,但可以通过类似的结构来定义。 从示例中可以看出,...
在Flex开发中,AdvancedDataGrid控件是一种强大的数据网格组件,用于展示大量结构化数据。相较于mx:Repeater,AdvancedDataGrid在处理大数据集时提供了更好的性能和用户体验,包括分页、排序、过滤等功能。然而,它...
本人整合的Flex完成datagrid合计平均值等 Footerdatagrid控件,可以锁列(网上流传的大部分版本lockedColumnCount属性无效,不过要注意不要把要合计的列锁住)、动态隐藏列(网上的所有版本在visible等于动态参数的...
如果你正在使用`AdvancedDataGrid`,可能还需要扩展`AdvancedDataGridColumn`类来自定义列的行为,以便在选择改变时正确地更新全选状态。 7. **错误处理和调试**: 在开发过程中,确保对可能出现的问题进行充分的...
这些列通常使用`<mx:AdvancedDataGridColumn>`标签,并设置`isFolder`属性为`true`,表示该列可以被展开或折叠。 4. **事件监听**:监听`click`事件,当用户点击某一列时,检查是否是可展开的列(即`isFolder`为`...
在Flex开发中,DataGrid控件是用于展示数据表格的常用组件。然而,当需要对数据进行更复杂的呈现,如包含复选框、下拉选择框、日期选择器或者自定义视图时,就需要扩展其默认功能。这涉及到对ItemRenderer和...