---
title: "SC（smart Client）组件编写笔记"
author: "vortexchoo"
date: "2014-01-22T11:36:03Z"
tags: []
categories: ["Web前端"]
slug: "sc-smart-client"
draft: false
lastmod: "2014-01-22T11:36:03Z"
id: 2008128
url: "https://vortexchoo.iteye.com/blog/2008128"
---

\-------------------------------------------------------------------------------------------------------------------------------

isc.ClassFactory.defineClass("processView4SC", "IButton");

isc.processView4SC.addProperties({  
    height:"30", width:"60",  
    rowSpan:"\*", endRow:true, startRow:true,  
    autoDestroy:true,  
    // this is going to be an editable data item  
    shouldSaveValue:false,  
    window:null,  
    processTabSet:null,  
    img:null,  
    vlayout0:null,  
    vlayout1:null,  
    vlayout2:null,  
    vlayout3:null,  
    hlayout0:null,  
    listGrid0:null,  
    listGrid1:null,  
    process\_DS:null,  
    workitem\_DS:null,  
    arg0:"",  
    arg1:"",  
    ID:"",  
    button:null,  
    label\_finish:null,  
    label\_running:null,  
    label\_undo:null,  
    pid:"",  
    // Implement 'createCanvas' to build a ListGrid from which the user may  
    // select items.  
    create: function () {  
        return this.button;  
    },  
    fix:function(){     
        this.img = isc.Img.create({  
            ID:"viewer",  
            width:780,  
            height:360  
        });  
        this.process\_DS=isc.DataSource.create({  
            ID:"process",  
            dataFormat:"xml",  
            dataURL:"/SCProcessViewer/view/queryProcess.do?processInsId="+this.pid,  
            recordXPath:"//processInfo", //&lt;processInfo&gt;&lt;/processInfo&gt;   
             fields:{  
                 process\_ins\_id:{  
                 name:"process\_ins\_id",  
                 type:"text"  
                 },  
                 process\_ins\_name:{  
                 name:"process\_ins\_name",  
                 type:"text"  
                 },  
                 start\_time:{  
                 name:"start\_time",  
                 type:"text"  
                 },  
                 end\_time:{  
                 name:"end\_time",  
                 type:"text"  
                 },  
                 starter:{  
                 name:"starter",  
                 type:"text"  
                 },  
                 description:{  
                 name:"description",  
                 type:"text"  
                 }  
             },  
             operationBindings:[  
                                {operationType:"fetch",  
                                 dataURL:"/SCProcessViewer/view/queryProcess.do?processInsId="+this.pid  
                                 },  
                                {operationType:"add",  
                                 dataURL:""  
                                 },  
                                {operationType:"update",  
                                 dataURL:""  
                                 },  
                                {operationType:"remove",  
                                 dataURL:""  
                                 }  
                            ]  
        });  
        this.workitem\_DS=isc.DataSource.create({  
            ID:"workItem",  
            dataFormat:"xml",  
            dataURL:"/SCProcessViewer/view/queryWorkItem.do?processInsId="+this.pid,  
            recordXPath:"//workItemInfo", //&lt;workItemInfo&gt;&lt;/workItemInfo&gt;   
             fields:{  
                 workitem\_id:{  
                 name:"workitem\_id",  
                 type:"text"  
                 },  
                 process\_ins\_name:{  
                 name:"process\_ins\_name",  
                 type:"text"  
                 },  
                 start\_time:{  
                 name:"start\_time",  
                 type:"text"  
                 },  
                 ids:{  
                 name:"ids",  
                 type:"text"  
                 },  
                 description:{  
                 name:"description",  
                 type:"text"  
                 }  
                 },  
                 operationBindings:[  
                                    {operationType:"fetch",  
                                     dataURL:"/SCProcessViewer/view/queryWorkItem.do?processInsId="+this.pid  
                                     },  
                                    {operationType:"add",  
                                     dataURL:""  
                                     },  
                                    {operationType:"update",  
                                     dataURL:""  
                                     },  
                                    {operationType:"remove",  
                                     dataURL:""  
                                     }  
                                ]  
        });  
        this.listGrid0=isc.ListGrid.create({  
            ID:"processInfo",  
            dataSource:"process",  
            autoDraw:false,  
            fields:[  
            {  
            align:"center",  
            name:"process\_ins\_name",  
            title:"流程名称"  
            },  
            {  
            align:"center",  
            name:"process\_ins\_id",  
            title:"流程编号"  
            },  
            {  
            align:"center",  
            name:"start\_time",  
            title:"流程开始时间"  
            },  
            {  
            align:"center",  
            name:"end\_time",  
            title:"流程结束时间"  
            },  
            {  
            align:"center",  
            name:"starter",  
            title:"流程启动人"  
            },  
            {  
            align:"center",  
            name:"description",  
            title:"描述"  
            }  
            ]  
        });  
         
         
        this.listGrid1=isc.ListGrid.create({  
            ID:"workitemInfo",  
            dataSource:"workItem",  
            autoDraw:false,  
            fields:[  
            {  
            align:"center",  
            name:"workitem\_id",  
            title:"工作项编号"  
            },  
            {  
            align:"center",  
            name:"activity\_ins\_name",  
            title:"当前节点名称"  
            },  
            {  
            align:"center",  
            name:"start\_time",  
            title:"活动开始时间"  
            },  
            {  
            align:"center",  
            name:"ids",  
            title:"流程参与人"  
            },  
            {  
            align:"center",  
            name:"description",  
            title:"描述"  
            }  
            ]  
        });  
        this.vlayout0=isc.VLayout.create({  
            ID:"processVLayout0",  
            autoDraw:false,  
            members:[  
            this.img  
            ]  
            });  
        this.label\_finish=isc.Label.create({  
            height: 25,  
            width:90,  
            backgroundColor: "#76EF5E",  
            align: "center",  
            valign: "center",  
            wrap: false,  
            showEdges: false,  
            showShadow: false,  
            contents: "&lt;font size='2' color='yellow'&gt;完成状态&lt;/font&gt;"  
            });  
        this.label\_running=isc.Label.create({  
            height: 25,  
            width:90,  
            backgroundColor: "#C53712",  
            align: "center",  
            valign: "center",  
            wrap: false,  
            showEdges: false,  
            showShadow: false,  
            contents: "&lt;font size='2' color='yellow'&gt;运行状态&lt;/font&gt;"  
            });  
        this.label\_undo=isc.Label.create({  
            height: 25,  
            width:90,  
            backgroundColor: "#375C90",  
            align: "center",  
            valign: "center",  
            wrap: false,  
            showEdges: false,  
            showShadow: false,  
            contents: "&lt;font size='2' color='yellow'&gt;未执行状态&lt;/font&gt;"  
            });  
        this.vlayout3=isc.VLayout.create({  
            ID:"labelVLayout",  
            autoDraw:false,  
            members:[  
                     this.label\_finish,  
                     this.label\_running,  
                     this.label\_undo  
            ]  
            });  
        this.hlayout0=isc.HLayout.create({  
            ID:"processHLayout0",  
            autoDraw:false,  
            members:[  
            this.vlayout0,  
            this.vlayout3  
            ]  
            });  
        this.vlayout1=isc.VLayout.create({  
            ID:"processVLayout1",  
            autoDraw:false,  
            members:[  
            this.hlayout0,  
            this.listGrid0  
            ]  
            });  
        this.vlayout2=isc.VLayout.create({  
            ID:"processVLayout2",  
            autoDraw:false,  
            members:[  
            this.listGrid1  
            ]  
            });  
        this.processTabSet = isc.TabSet.create({  
            ID:"processTabSet",  
            autoDraw:false,  
            tabs:[  
            {  
                title:"流程图查看",  
                pane:this.vlayout1,  
                ID:"Tab0",  
                click:  
                function(){  
                }  
            },  
            {  
                title:"流程流向查看",  
                pane:this.vlayout2,  
                ID:"Tab2",  
                click:  
                function(){  
                }  
                }  
            ],  
            destroyPanes:false  
            });  
            this.window= isc.Window.create({  
                ID:"processViewWindow",  
                autoDraw:false,  
                items:[  
                   this.processTabSet   
                ],  
                title:"流程明细查看",  
                width:900,  
                height:480,  
                autoCenter:true,  
                showShadow:false,  
                isModal:true,  
                showMinimizeButton:false  
                });  
            this.button=isc.IButton.create({  
                ID:"viewButton",  
                autoDraw:false,  
                title:"查看",  
                click:  
                function(){  
                    this.showProcessView(this.arg0, this.arg1);  
                }  
                });  
    },  
    showProcessView:function(processInsId,loginName){  
        this.arg0 = processInsId;  
        this.arg1 = loginName;  
        this.pid = processInsId;  
        this.fix();  
        this.img.setSrc("/monitor/MonitorServerlet?pinsId="+this.arg0+"&name="+this.arg1);  
        this.listGrid0.fetchData();  
        this.listGrid1.fetchData();  
        this.window.show();  
    },  
    setProcessInsId:function(porcessInsId){  
        this.arg0 = porcessInsId;  
    },  
    setLoginName:function(loginName){  
        this.arg1 = loginName;  
    }  
});