unknown 5 лет назад
Родитель
Сommit
122c9c8efd

+ 153 - 0
o2web/source/x_component_Selector/Script.js

@@ -0,0 +1,153 @@
+MWF.xApplication.Selector = MWF.xApplication.Selector || {};
+MWF.xDesktop.requireApp("Selector", "Person", null, false);
+MWF.xApplication.Selector.Script = new Class({
+    Extends: MWF.xApplication.Selector.Person,
+    options: {
+        "style": "default",
+        "count": 0,
+        "title": MWF.xApplication.Selector.LP.selectScript,
+        "values": [],
+        "names": [],
+        "expand": false,
+        "forceSearchInItem" : true
+    },
+    loadSelectItems: function(addToNext){
+        this.processAction.listApplications(function(json){
+            json.data.each(function(data){
+                if (!data.scriptList){
+                    this.designerAction.listScript(data.id, function(scriptJson){
+                        data.scriptList = scriptJson.data;
+                    }.bind(this), null, false);
+                }
+                if (data.scriptList && data.scriptList.length){
+                    var category = this._newItemCategory(data, this, this.itemAreaNode);
+                    data.scriptList.each(function(d){
+                        d.applicationName = data.name;
+                        var item = this._newItem(d, this, category.children);
+                        this.items.push(item);
+                    }.bind(this));
+                }
+            }.bind(this));
+        }.bind(this));
+    },
+    _scrollEvent: function(y){
+        return true;
+    },
+    _getChildrenItemIds: function(data){
+        return data.scriptList || [];
+    },
+    _newItemCategory: function(data, selector, item, level){
+        return new MWF.xApplication.Selector.Script.ItemCategory(data, selector, item, level)
+    },
+
+    _listItemByKey: function(callback, failure, key){
+        return false;
+    },
+    _getItem: function(callback, failure, id, async){
+        this.queryAction.getTable(function(json){
+            if (callback) callback.apply(this, [json]);
+        }.bind(this), failure, ((typeOf(id)==="string") ? id : id.id), async);
+    },
+    _newItemSelected: function(data, selector, item){
+        return new MWF.xApplication.Selector.Script.ItemSelected(data, selector, item)
+    },
+    _listItemByPinyin: function(callback, failure, key){
+        return false;
+    },
+    _newItem: function(data, selector, container, level){
+        return new MWF.xApplication.Selector.Script.Item(data, selector, container, level);
+    }
+});
+MWF.xApplication.Selector.Script.Item = new Class({
+    Extends: MWF.xApplication.Selector.Person.Item,
+    _getShowName: function(){
+        return this.data.name;
+    },
+    _setIcon: function(){
+        this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/default/icon/attr.png)");
+    },
+    loadSubItem: function(){
+        return false;
+    },
+    checkSelectedSingle: function(){
+        var selectedItem = this.selector.options.values.filter(function(item, index){
+            if (typeOf(item)==="object"){
+                if( this.data.id && item.id ){
+                    return this.data.id === item.id;
+                }
+                //return (this.data.id === item.id) || (this.data.name === item.name) ;
+            }
+            //if (typeOf(item)==="object") return (this.data.id === item.id) || (this.data.name === item.name) ;
+            if (typeOf(item)==="string") return (this.data.id === item) || (this.data.name === item);
+            return false;
+        }.bind(this));
+        if (selectedItem.length){
+            this.selectedSingle();
+        }
+    },
+    checkSelected: function(){
+
+        var selectedItem = this.selector.selectedItems.filter(function(item, index){
+            if( item.data.id && this.data.id){
+                return item.data.id === this.data.id;
+            }else{
+                return item.data.name === this.data.name;
+            }
+            //return (item.data.id === this.data.id) || (item.data.name === this.data.name);
+        }.bind(this));
+        if (selectedItem.length){
+            //selectedItem[0].item = this;
+            selectedItem[0].addItem(this);
+            this.selectedItem = selectedItem[0];
+            this.setSelected();
+        }
+    }
+});
+
+MWF.xApplication.Selector.Script.ItemSelected = new Class({
+    Extends: MWF.xApplication.Selector.Person.ItemSelected,
+    _getShowName: function(){
+        return this.data.name;
+    },
+    _setIcon: function(){
+        this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/default/icon/attr.png)");
+    },
+    check: function(){
+        if (this.selector.items.length){
+            var items = this.selector.items.filter(function(item, index){
+                //return (item.data.id === this.data.id) || (item.data.name === this.data.name);
+                if( item.data.id && this.data.id){
+                    return item.data.id === this.data.id;
+                }else{
+                    return item.data.name === this.data.name;
+                }
+            }.bind(this));
+            this.items = items;
+            if (items.length){
+                items.each(function(item){
+                    item.selectedItem = this;
+                    item.setSelected();
+                }.bind(this));
+            }
+        }
+    }
+});
+
+MWF.xApplication.Selector.Script.ItemCategory = new Class({
+    Extends: MWF.xApplication.Selector.Person.ItemCategory,
+    _getShowName: function(){
+        return this.data.name;
+    },
+    createNode: function(){
+        this.node = new Element("div", {
+            "styles": this.selector.css.selectorItemCategory_department
+        }).inject(this.container);
+    },
+    _setIcon: function(){
+        this.iconNode.setStyle("background-image", "url("+"../x_component_Selector/$Selector/default/icon/applicationicon.png)");
+    },
+    _hasChild: function(){
+        return (this.data.scriptList && this.data.scriptList.length);
+    },
+    check: function(){}
+});

+ 1 - 0
o2web/source/x_component_Selector/lp/zh-cn.js

@@ -16,6 +16,7 @@ MWF.xApplication.Selector.LP = MWF.SelectorLP = {
     "selectCMSApplication": "选择内容管理应用",
     "selectCMSCategory": "选择内容管理栏目",
     "noSelectableItemText" : "无待选项",
+    "selectScript" : "选择脚本",
 
     "searchDescription" : "搜索内容",
 

+ 18 - 1
o2web/source/x_component_process_FormDesigner/Module/Form/form.html

@@ -24,11 +24,28 @@
                 <!--</td>-->
             <!--</tr>-->
             <tr>
-                <td class="editTableTitle">表单样式:</td>
+                <td class="editTableTitle" rowspan="2">表单样式:</td>
+                <td class="editTableValue">
+                    <input type="radio" onclick="if (this.checked) {
+                        $('text{$.pid}formStyleTypeTr').setStyle('display', '');
+                        $('text{$.pid}formStyleTypeCustomTr').setStyle('display', 'none');
+                    }" name="formStyleTypeType" value="default" text{($.formStyleTypeType!='custom' )?'checked':''}/>系统
+                    <input type="radio" onclick="if (this.checked) {
+                        $('text{$.pid}formStyleTypeTr').setStyle('display', 'none');
+                        $('text{$.pid}formStyleTypeCustomTr').setStyle('display', '');
+                    }" name="formStyleTypeType" value="custom" text{($.formStyleTypeType=='custom')?'checked':''}/>自定义
+                </td>
+            </tr>
+            <tr id="text{$.pid}formStyleTypeTr" style="display: text{($.submitFormType!='custom')?'':'none'}">
                 <td class="editTableValue">
                     <select class="MWFFormStyle" name="formStyleType"></select>
                 </td>
             </tr>
+            <tr id="text{$.pid}formStyleTypeCustomTr" style="display: text{($.submitFormType=='custom')?'':'none'}">
+                <td class="editTableValue">
+                   <div class="MWFScriptSelect" name="formStyleCustom"></div>
+                </td>
+            </tr>
             <tr>
                 <td class="editTableTitle">图标:</td>
                 <td class="editTableValue"><div class="MWFIcon" name="formIcon"></div></td>

+ 27 - 0
o2web/source/x_component_process_FormDesigner/Property.js

@@ -1210,6 +1210,7 @@ debugger;
         var querystatNodes = this.propertyContent.getElements(".MWFQueryStatSelect");
         var fileNodes = this.propertyContent.getElements(".MWFImageFileSelect");
         var processFileNodes = this.propertyContent.getElements(".MWFProcessImageFileSelect");
+        var scriptNodes = this.propertyContent.getElements(".MWFScriptSelect");
 
         MWF.xDesktop.requireApp("process.ProcessDesigner", "widget.PersonSelector", function(){
             personIdentityNodes.each(function(node){
@@ -1278,6 +1279,15 @@ debugger;
                 });
             }.bind(this));
 
+            scriptNodes.each(function(node){
+                new MWF.xApplication.process.ProcessDesigner.widget.PersonSelector(node, this.form.designer, {
+                    "type": "Script",
+                    "count": 1,
+                    "names": [this.data[node.get("name")]],
+                    "onChange": function(ids){this.saveScriptSelectItem(node, ids);}.bind(this)
+                });
+            }.bind(this));
+
             fileNodes.each(function(node){
                 var d = this.data[node.get("name")];
                 var data = d || {};
@@ -1349,6 +1359,23 @@ debugger;
     },
     removeViewItem: function(node, item){
 
+    },
+    saveScriptSelectItem: function(node, ids){
+        if (ids[0]){
+            var view = ids[0].data;
+            var data = {
+                "name": view.name,
+                "alias": view.alias,
+                "id": view.id,
+                "appName" : view.appName || view.applicationName || view.query,
+                "appId": view.appId,
+                "application": view.application || view.query
+            };
+            this.data[node.get("name")] = data;
+        }else{
+            this.data[node.get("name")] = null;
+        }
+        // if (this.module._checkView) this.module._checkView();
     },
     removeDutyItem: function(node, item){
         if (item.data.id){

+ 4 - 0
o2web/source/x_component_process_ProcessDesigner/widget/PersonSelector.js

@@ -87,6 +87,8 @@ MWF.xApplication.process.ProcessDesigner.widget.PersonSelector = new Class({
 
                             if (this.options.type.toLowerCase()==="portalfile") this.identitys.push(new MWF.widget.O2File(data, this.node));
                             if (this.options.type.toLowerCase()==="processfile") this.identitys.push(new MWF.widget.O2File(data, this.node));
+
+                            if (this.options.type.toLowerCase()==="script") this.identitys.push(new MWF.widget.O2Other(data, this.node));
                         }.bind(this));
                     }
                 }.bind(this));
@@ -147,6 +149,8 @@ MWF.xApplication.process.ProcessDesigner.widget.PersonSelector = new Class({
                             if (this.options.type.toLowerCase()==="dutyname") this.identitys.push(new MWF.widget.O2Duty(item.data, this.node));
                             if (this.options.type.toLowerCase()==="portalfile") this.identitys.push(new MWF.widget.O2File(item.data, this.node));
                             if (this.options.type.toLowerCase()==="processfile") this.identitys.push(new MWF.widget.O2File(item.data, this.node));
+
+                            if (this.options.type.toLowerCase()==="script") this.identitys.push(new MWF.widget.O2Other(item.data, this.node));
                         }.bind(this));
                         if (this.options.type.toLowerCase()==="duty") {
                             items.each(function(item){