<%@ page language="java" import="java.util.*" pageEncoding="gbk" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
    <%@include file="../../../../frame/assets/header-all.jsp" %>
    <script type="text/javascript" src="../../../nhyw/js/jquery.form.js"></script>
    <style>
        * {
            font-size: 13px
        }

        .form-line .text-content {
            width: 120px;
        }

        body {
            margin: 0
        }

        .line {
            position: relative;
            float: left;
            padding: 8px 0px 8px 50px;
            border-left: 0 !important;
        }

        .line span {
            float: left
        }

        input {
            border: 1px solid #888;
            vertical-align: middle
        }

        .file {
            position: absolute;
            left: 90px;
            top: 8px;
            display: none;
            filter: alpha(opacity=0);
            opacity: 0
        }

        .file1 {
            padding: 6px 13px;
            display: block;
            float: left;
            background: #67c23a;
            color: #fff;
            z-index: 1;
            margin-left: 5px;
            vertical-align: middle;
            cursor: pointer
        }

        .inputstyle {
            width: 180px;
            height: 26px;
            border: 1px solid #888;
            z-index: 99
        }

        .fail {
            padding: 0 5px;
        }

        .datagrid-body {
            height: 85px !important;
        }
    </style>
</head>
<body class="easyui-layout">
<form id="childform" class="easyui-form" data-options="novalidate:true">
    <input id="xh" type="hidden"/>
    <div class="form-line clearfix">
        <div class="fl">
            <span class="text-content"><em class="must"></em>人员：</span>
            <input class="easyui-combobox" id="rymc">
            <input id="rybh" type="hidden"/>
        </div>
    </div>
    <div class="form-line clearfix">
        <div class="fl">
            <span class="text-content"><em class="must"></em>评价月份：</span>
            <input id="pjyf" class="easyui-datebox" data-options="required:false,validType:'length[0,40]'">
        </div>
    </div>
    <div class="form-line clearfix">
        <div class="fl">
            <span class="text-content">评价分数：</span>
            <input type="text" id="score" class="easyui-numberbox" value="1" precision="0" min="0" max="100"
                   data-options="min:0,precision:2">
        </div>
    </div>


    <div class="form-line clearfix">
        <div class="fl">
            <span class="text-content">备注：</span>
            <input id="bz" class="easyui-textbox" data-options="multiline:true" style="width:200px;height:100px"
                   missingMessage="备注必填项">
        </div>
    </div>
</form>
</body>
</html>
<script type="text/javascript">
    var winId = $.getUrlParam("winId");
    var records = top.$("#" + winId).panel("options").data;
    $(function () {
        getmonth("pjyf");
        $('#rymc').combobox({
            url: 'ywrepairjobinfoAction!getReportUser.do',    // 查询部门下有审批工单权限的人
            textField: "yhmc",
            valueField: "yhzh",
            value: ""
        });
        setTimeout(loadValue, 500);
    });

    function loadValue() {
        if (records) {
            $("#rymc").combobox("setValue", records.rybh);
            $("#rybh").val(records.rybh);
            $("#xh").val(records.xh);
            $("#pjyf").textbox("setValue", records.pjyf);
            $("#score").textbox("setValue", records.score);
            $("#bz").textbox("setValue", records.bz);
        }
    }

    function getmonth(id) {
        var db1 = document.getElementById(id);
        var db = $(db1);
        db.datebox({
            onShowPanel: function () {//显示日趋选择对象后再触发弹出月份层的事件，初始化时没有生成月份层
                span.trigger('click'); //触发click事件弹出月份层
                //fix 1.3.x不选择日期点击其他地方隐藏在弹出日期框显示日期面板
                if (p.find('div.calendar-menu').is(':hidden')) p.find('div.calendar-menu').show();
                if (!tds) setTimeout(function () {//延时触发获取月份对象，因为上面的事件触发和对象生成有时间间隔
                    tds = p.find('div.calendar-menu-month-inner td');
                    tds.click(function (e) {
                        e.stopPropagation(); //禁止冒泡执行easyui给月份绑定的事件
                        var year = /\d{4}/.exec(span.html())[0];//得到年份
                        var month = parseInt($(this).attr('abbr'), 10); //月份，这里不需要+1
                        month = month < 10 ? '0' + month : month;
                        db.datebox('hidePanel')//隐藏日期对象
                            .datebox('setValue', year + '-' + month); //设置日期的值
                    });
                }, 0);
                yearIpt.unbind();//解绑年份输入框中任何事件
            },
            parser: function (s) {
                if (!s) return new Date();
                var arr = s.split('-');
                return new Date(parseInt(arr[0], 10), parseInt(arr[1], 10) - 1, 1);
            },

            formatter: function (d) {
                return d.getFullYear() + '-' + (d.getMonth() + 1);
            }
        });
        var p = db.datebox('panel'), //日期选择对象
            tds = false, //日期选择对象中月份
            aToday = p.find('a.datebox-current'),
            yearIpt = p.find('input.calendar-menu-year'),//年份输入框//显示月份层的触发控件
            span = aToday.length ? p.find('div.calendar-title span') ://1.3.x版本
                p.find('span.calendar-text'); //1.4.x版本
        if (aToday.length) {//1.3.x版本，取消Today按钮的click事件，重新绑定新事件设置日期框为今天，防止弹出日期选择面板
            aToday.unbind('click').click(function () {
                var now = new Date();
                now = now < 10 ? '0' + now : now;
                db.datebox('hidePanel').datebox('setValue', now.getFullYear() + '-' + (now.toString() + 1));
            });
        }
    }
</script>
