Kaynağa Gözat

Merge branch 'fix/attendance_js' into 'wrdp'

考勤,前端新增周末设置

See merge request o2oa/o2oa!2600
胡起 5 yıl önce
ebeveyn
işleme
9f9987d39a

+ 7 - 0
o2web/source/x_component_Attendance/$Main/navi.json

@@ -154,6 +154,13 @@
         "target": "_blank",
         "target": "_blank",
         "title": "申诉设置",
         "title": "申诉设置",
         "action": "openAppSetting"
         "action": "openAppSetting"
+      },
+      {
+        "id" : "40.45",
+        "access" : "admin",
+        "target" : "_blank",
+        "title" : "周末设置",
+        "action" : "openWeekendSetting"
       }
       }
     ]
     ]
   }
   }

+ 172 - 0
o2web/source/x_component_Attendance/$WeekendSetting/default/css.wcss

@@ -0,0 +1,172 @@
+{
+
+
+
+  "createMarkNode": {
+    "width": "100%",
+    "height": "100%",
+    "opacity": 0.6,
+    "position": "absolute",
+    "background-color": "#CCC",
+    "top": "0px",
+    "left": "0px"
+  },
+  "createAreaNode": {
+    "position": "absolute",
+    "opacity": 0,
+    "top": "0px",
+    "z-index" : 10
+  },
+  "createNode": {
+    "background-color": "#FFF",
+    //"width": "95%",
+    //"max-width": "600px",
+    "box-shadow": "0px 0px 20px #999",
+    "margin": "auto",
+    "border-radius": "4px",
+    "border": "3px solid #666",
+    "overflow": "hidden"
+  },
+  "createContainerNode": {
+    "background-color": "#FFF",
+    // "width": "95%",
+    //"max-width": "600px",
+    "overflow": "hidden"
+  },
+  "createNewNode": {
+    "width": "47px",
+    "height": "47px",
+    "background": "url(/x_component_Attendance/$PermissionExplorer/default/icon/new.png) no-repeat"
+  },
+  "createIconNode": {
+    "width": "47px",
+    "height": "47px"
+  },
+  "createEditNode": {
+    "width": "47px",
+    "height": "47px"
+  },
+  "createFormNode": {
+    "border-radius": "8px",
+    "border": "0px solid #666",
+    "width": "70%",
+    "max-width": "450px",
+    "margin": "auto",
+    "font-size": "16px",
+    "color": "#666",
+    "font-family": "Microsoft YaHei"
+  },
+
+  "createTableContainer" : {
+    "overflow" : "hidden",
+    //"margin-bottom" : "10px",
+    "overflow" : "hidden"
+  },
+  "createTableArea" : {
+
+  },
+  "editTableHead" : {
+    "height": "50px",
+    "line-height": "50px",
+    "text-align": "center",
+    "min-width": "80px",
+    "font-size":"20px",
+    "font-weight": "bold"
+  },
+  "editTableTitle" : {
+    "height": "30px",
+    "line-height": "30px",
+    "text-align": "left"
+  },
+  "editTableValue" : {
+    "text-align": "left"
+  },
+  "inputStyle" : {
+    "width": "99%",
+    "border":"1px solid #999",
+    "background-color":"#FFF",
+    "border-radius": "3px",
+    "box-shadow": "0px 0px 6px #CCC",
+    "height": "26px"
+  },
+  "inputTextAreaStyle" : {
+    "width": "99%",
+    "border":"1px solid #999",
+    "background-color":"#FFF",
+    "border-radius": "3px",
+    "box-shadow": "0px 0px 6px #CCC",
+    "height": "40px"
+  },
+  "inputTimeStyle" : {
+    "width": "99%",
+    "border":"1px solid #999",
+    "background":"url(/x_component_Attendance/$SelfHoliday/default/icon/calendar.png) 98% center no-repeat",
+    "border-radius": "3px",
+    "box-shadow": "0px 0px 6px #CCC",
+    "height": "26px"
+  },
+  "inputPersonStyle" : {
+    "width": "99%",
+    "border":"1px solid #999",
+    "background":"url(/x_component_Attendance/$SelfHoliday/default/icon/selectperson.png) 98% center no-repeat",
+    "border-radius": "3px",
+    "box-shadow": "0px 0px 6px #CCC",
+    "height": "26px"
+  },
+
+  "createOkActionNode": {
+    "height": "30px",
+    "width": "60px",
+    "cursor": "pointer",
+    "float": "right",
+    "line-height": "30px",
+    "padding-left": "65px",
+    "font-size": "16px",
+    "font-family": "Microsoft YaHei",
+    "border-radius": "3px",
+    "border": "1px solid #354f67",
+    "color": "#FFF",
+    "margin-right": "20px",
+    "margin-top": "20px",
+    "box-shadow": "0px 0px 0px #666",
+    "background": "url(/x_component_Attendance/$PermissionExplorer/default/icon/editOk_bg.png) no-repeat"
+  },
+  "createDenyActionNode": {
+    "height": "30px",
+    "width": "60px",
+    "cursor": "pointer",
+    "float": "right",
+    "line-height": "30px",
+    "padding-left": "40px",
+    "margin-right": "20px",
+    "font-size": "16px",
+    "font-family": "Microsoft YaHei",
+    "border-radius": "3px",
+    "color": "#FFF",
+    "margin-top": "20px",
+    "box-shadow": "0px 0px 0px #666",
+    "border": "1px solid #999",
+    "background": "url(/x_component_Attendance/$PermissionExplorer/default/icon/editCancel_bg.png) no-repeat"
+  },
+  "createCancelActionNode": {
+    "height": "30px",
+    "width": "60px",
+    "cursor": "pointer",
+    "float": "right",
+    "line-height": "30px",
+    "padding-left": "30px",
+    "margin-right": "20px",
+    "font-size": "16px",
+    "font-family": "Microsoft YaHei",
+    "border-radius": "3px",
+    "color": "#FFF",
+    "margin-top": "20px",
+    "box-shadow": "0px 0px 0px #666",
+    "border": "1px solid #999",
+    "background-color" : "#666"
+  },
+  "checkBox" : {
+    "margin-right" : "5px",
+    "font-size" : "14px"
+  }
+}

BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/agree.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/agree_over.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/calendar.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/create.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/delete.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/delete_over.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/deny.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/deny_over.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/editCancel_bg.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/editOk_bg.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/new.png


BIN
o2web/source/x_component_Attendance/$WeekendSetting/default/icon/selectperson.png


+ 6 - 0
o2web/source/x_component_Attendance/Main.js

@@ -324,6 +324,12 @@ MWF.xApplication.Attendance.Main = new Class({
 			setting.edit();
 			setting.edit();
 		}.bind(this));
 		}.bind(this));
 	},
 	},
+	openWeekendSetting : function(){
+		MWF.xDesktop.requireApp("Attendance", "WeekendSetting", function(){
+			var setting = new MWF.xApplication.Attendance.WeekendSetting(this,this.restActions);
+			setting.edit();
+		}.bind(this));
+	},
 	openAddressSetting: function () {
 	openAddressSetting: function () {
 		MWF.xDesktop.requireApp("Attendance", "AddressExplorer", function () {
 		MWF.xDesktop.requireApp("Attendance", "AddressExplorer", function () {
 			this.clearContent();
 			this.clearContent();

+ 250 - 0
o2web/source/x_component_Attendance/WeekendSetting.js

@@ -0,0 +1,250 @@
+
+MWF.xDesktop.requireApp("Template", "MForm", null, false);
+MWF.xApplication.Attendance.WeekendSetting = new Class({
+    Extends: MWF.widget.Common,
+    options:{
+        style : "default"
+    },
+    initialize: function(app, actions, options){
+        this.setOptions(options);
+        this.app = app;
+        this.path = "/x_component_Attendance/$WeekendSetting/";
+        this.cssPath = "/x_component_Attendance/$WeekendSetting/"+this.options.style+"/css.wcss";
+        this._loadCss();
+
+        this.actions = actions;
+        this.load();
+    },
+    load: function(){
+        this.app.restActions.listSetting(function(json){
+            if( json.data && json.data.length>0){
+                this.data = json.data;
+            }
+        }.bind(this),null,false);
+        if( !this.data ){
+            this.data = [];
+        }
+    },
+    decodeData : function( data ){
+        //{
+        //    'configCode':'APPEALABLE',
+        //    'configName':'申诉功能启用状态',
+        //    'configValue':'false',
+        //    'ordernumber':1
+        //}
+        var json = {};
+        this.dataJson = {};
+        data.each( function(d){
+            json[d.configCode] = d.configValue;
+            this.dataJson[d.configCode] = d;
+        }.bind(this));
+        //alert(JSON.stringify(json))
+        return json;
+    },
+    encodeData : function( orgData, data ){
+        var arr = [];
+        for( var d in data ){
+            if( this.itemTemplate[d] ){
+                var flag = false;
+                for( var i=0; i<orgData.length;i++ ){
+                    if( orgData[i].configCode == d ){
+                        flag = true;
+                        orgData[i].configValue = data[d];
+                        arr.push( Object.clone(orgData[i]) );
+                    }
+                }
+                if( !flag ){
+                    arr.push( {
+                        configCode : d,
+                        configValue : data[d],
+                        configName : this.itemTemplate[d].text
+                    } )
+                }
+            }
+        };
+       // alert(JSON.stringify(arr))
+        return arr;
+    },
+    open: function(e){
+        this.isNew = false;
+        this.isEdited = false;
+        this._open();
+    },
+    create: function(){
+        this.isNew = true;
+        this._open();
+    },
+    edit: function(){
+        this.isEdited = true;
+        this._open();
+    },
+    _open : function(){
+        this.createMarkNode = new Element("div", {
+            "styles": this.css.createMarkNode,
+            "events": {
+                "mouseover": function(e){e.stopPropagation();},
+                "mouseout": function(e){e.stopPropagation();}
+            }
+        }).inject(this.app.content, "after");
+
+        this.createAreaNode = new Element("div", {
+            "styles": this.css.createAreaNode
+        });
+
+        this.createNode();
+
+        this.createAreaNode.inject(this.createMarkNode, "after");
+        this.createAreaNode.fade("in");
+
+        this.setCreateNodeSize();
+        this.setCreateNodeSizeFun = this.setCreateNodeSize.bind(this);
+        this.addEvent("resize", this.setCreateNodeSizeFun);
+    },
+    createNode: function(){
+        var _self = this;
+
+        this.createNode = new Element("div", {
+            "styles": this.css.createNode
+        }).inject(this.createAreaNode);
+
+        //
+        //this.createIconNode = new Element("div", {
+        //    "styles": this.isNew ? this.css.createNewNode : this.css.createIconNode
+        //}).inject(this.createNode);
+
+        this.createContainerNode = new Element("div", {
+            "styles": this.css.createContainerNode
+        }).inject(this.createNode);
+
+
+        this.setScrollBar( this.createContainerNode );
+
+
+        this.createFormNode = new Element("div", {
+            "styles": this.css.createFormNode
+        }).inject(this.createContainerNode);
+
+        this.createTableContainer = new Element("div", {
+            "styles": this.css.createTableContainer
+        }).inject(this.createFormNode);
+
+        this.createTableArea = new Element("div", {
+            "styles": this.css.createTableArea
+        }).inject(this.createTableContainer);
+
+
+        var table = new Element("table", {
+            "width" : "100%", "border" : "0", "cellpadding" : "5", "cellspacing" : "0",  "styles" : this.css.editTable, "class" : "editTable"
+        }).inject( this.createTableArea );
+
+
+        var d = this.decodeData( this.data );
+
+
+        var html = "<table width='100%' bordr='0' cellpadding='5' cellspacing='0' styles='formTable'>"+
+            "<tr><td colspan='4' styles='formTableHead'>周末设置</td></tr>" +
+            "<tr><td styles='formTableTitle' lable='ATTENDANCE_WEEKEND'></td>"+
+            "    <td styles='formTableValue' item='ATTENDANCE_WEEKEND'></td>"+
+            "</table>";
+        html = html+"<span style='font-size:12px'>"+this.dataJson.ATTENDANCE_WEEKEND.description+"</span>"
+        this.createTableArea.set("html",html);
+        this.itemTemplate = {
+            ATTENDANCE_WEEKEND : { text : "周末选择",
+                type : "select",
+                value : d.ATTENDANCE_WEEKEND ,
+                selectValue :this.dataJson.ATTENDANCE_WEEKEND.selectContent.split("|") ,//["周六","周日"]
+                /*event : {
+                    change : function( item, ev ){
+                        this.createTableArea.getElement("[item='valueArea']").setStyle( "display" , (item.getValue() == "汇报对象") ? "none" : "" );
+                    }.bind(this)
+                }*/
+            }
+        };
+        this.document = new MForm( this.createTableArea, this.data, {
+            style : "popup",
+            isEdited : this.isEdited || this.isNew,
+            itemTemplate : this.itemTemplate
+        }, this.app,this.css);
+        this.document.load();
+
+        this.cancelActionNode = new Element("div", {
+            "styles": this.css.createCancelActionNode,
+            "text": "取消"
+        }).inject(this.createFormNode);
+
+
+        this.cancelActionNode.addEvent("click", function(e){
+            this.cancelCreate(e);
+        }.bind(this));
+
+        if( this.isNew || this.isEdited ){
+            this.createOkActionNode = new Element("div", {
+                "styles": this.css.createOkActionNode,
+                "text": "确定"
+            }).inject(this.createFormNode);
+
+            this.createOkActionNode.addEvent("click", function(e){
+                this.okCreate(e);
+            }.bind(this));
+        }
+
+    },
+    setCreateNodeSize: function(){
+        var size = this.app.node.getSize();
+        var allSize = this.app.content.getSize();
+
+        var height = "270";
+        var width = "600";
+
+        this.createAreaNode.setStyles({
+            "width": ""+size.x+"px",
+            "height": ""+size.y+"px"
+        });
+        var hY = height;
+        var mY = (size.y-height)/2;
+        this.createNode.setStyles({
+            "height": ""+hY+"px",
+            "margin-top": ""+mY+"px",
+            "width" : ""+width+"px"
+        });
+
+        this.createContainerNode.setStyles({
+            "height": ""+hY+"px"
+        });
+
+        var iconSize = this.createIconNode ? this.createIconNode.getSize() : {x:0,y:0};
+        var formMargin = hY-iconSize.y-60;
+        this.createFormNode.setStyles({
+            "height": ""+formMargin+"px",
+            "margin-top": ""+60+"px"
+        });
+    },
+    cancelCreate: function(e){
+        this.createMarkNode.destroy();
+        this.createAreaNode.destroy();
+        delete this;
+    },
+    okCreate: function(e){
+        var data = this.document.getResult(true,",",true,false,false);
+        if(data){
+            var arr = this.encodeData( this.data, data );
+            this.save( arr );
+        }
+    },
+    save: function( arr ){
+        var flag = true;
+        arr.each( function( d ){
+            this.app.restActions.saveSetting( d, function(json){
+                if( json.type == "ERROR" ){
+                    this.app.notice( json.message  , "error");
+                    flag = false;
+                }
+            }.bind(this), null, false);
+        }.bind(this));
+        if( flag ){
+            this.createMarkNode.destroy();
+            this.createAreaNode.destroy();
+            this.app.notice( "保存成功" , "success");
+        }
+    }
+});