<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="OA请假单列表" libs=["table"]/>
<div class="container-div" id="_app">
    <div class="row">
    <div class="col-sm-12 search-collapse">
        <@f.form id="form-form">
        <div class="select-list">
            <ul>
                <li>
                    <@ctx.i18n text = "请假人姓名"/>：
                    <input type="text" class="form-control" name="userName"/>
                </li>
                <li>
                    <@ctx.i18n text = "请假天数"/>：
                    <input type="text" class="form-control" name="leaveDays"/>
                </li>
                <li>
                    <@ctx.i18n text = "请假类型"/>：
                    <select name="leaveType" class="form-control">
                        <option value=""><@ctx.i18n text = "所有"/></option>
                    <#list dict.getType('sys_leave_type')>
                        <#items as d>
                            <#if d.status =='0' >
                                <option value="${d.dictValue}" text="${d.dictLabel}"><@ctx.i18n text = "${d.dictLabel}"/></option>
                            </#if>
                        </#items>
                    </#list>
                    </select>
                </li>
                <li>
                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;&nbsp;<@ctx.i18n text = "查询"/></a>
                    <a class="btn btn-warning btn-rounded btn-sm" onclick="opt.form.reset()"><i class="fa fa-refresh"></i>&nbsp;<@ctx.i18n text = "重置"/></a>
                </li>
                </ul>
            </div>
        </@f.form>
    </div>
    <@table id="bootstrap-table">
        <@shiro.hasPermission name="bpm:form:add">
                        <a class="btn btn-success" onclick="opt.operate.add()"><i class="fa fa-plus"></i>&nbsp;<@ctx.i18n text = "新增"/></a>
        </@shiro.hasPermission>
        <@shiro.hasPermission name="bpm:form:del">
            <a class="btn btn-danger multiple disabled" onclick="opt.operate.delAll()">
                <i class="fa fa-remove"></i> <@ctx.i18n text = "删除"/>
            </a>
        </@shiro.hasPermission>
    </@table>
    </div>
</div>
<@footer>
<script type="text/javascript">
    var editFlag = "${permission.hasPermi("bpm:form:edit")}";
    var listFlag = "${permission.hasPermi("bpm:form:add")}";
    var delFlag = "${permission.hasPermi("bpm:form:del")}";
    var visible = ${permission.isPermitteds("bpm:form:edit,
    bpm:form:del,bpm:form:add")?string('true', 'false')};
    var leaveTypeDatas = ${dict.getDictListJson('sys_leave_type')};
    var prefix = baseURL + "bpm/form";

    $(function() {
        var options = {
            url: prefix + "/list",
            addUrl: prefix + "/add",
            editUrl: prefix + "/edit/{id}",
            delUrl: prefix + "/del",
            modalName: "OA请假单",
            uniqueId:    'id'                                   , /* 唯一ID */
            columns: [{
                title: $.i18n.prop("序号"), width: 5, align: "center", formatter: function (value, row, index) {
                    return $.table.serialNumber(index);
                }
            }
                ,{
                    field : 'id'
                    ,title : '<@ctx.i18n text = "主键"/>'
                    ,visible: false
                }
                ,{
                    field : 'userName'
                    ,title : '<@ctx.i18n text = "请假人姓名"/>'
                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ,{
                    field : 'startTime'
                    ,title : '<@ctx.i18n text = "开始时间"/>'
                    ,width: 170
                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ,{
                    field : 'endTime'
                    ,title : '<@ctx.i18n text = "结束时间"/>'
                    ,width: 170
                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ,{
                    field : 'leaveDays'
                    ,title : '<@ctx.i18n text = "请假天数"/>'
                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ,{
                    field : 'leaveType'
                    ,title : '<@ctx.i18n text = "请假类型"/>'
                    ,formatter: function(value, row, index) {
                       return $.table.selectDictLabel(leaveTypeDatas, value);
                    }
                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ,{
                    field : 'leaveReason'
                    ,title : '<@ctx.i18n text = "请假原因"/>'
                    ,formatter: function(value, row, index) {
                        return $.table.tooltip(value, 20);
                    }
                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ,{
                    field : 'status'
                    ,title : '<@ctx.i18n text = "状态"/>'
                }
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ,{
                    title:"<@ctx.i18n text = "操作"/>"
                    ,align: 'left'
                    ,visible:visible
                    ,class:'action'
                    ,formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="' + editFlag + '" href="javascript:void(0)" title="<@ctx.i18n text = "编辑"/>" onclick="opt.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i></a> ');
                        actions.push('<a class="' + delFlag + '" href="javascript:void(0)" title="<@ctx.i18n text = "删除"/>" onclick="opt.operate.del(\'' + row.id + '\')"><i class="fa fa-trash-o"></i></a> ');
                        return actions.join('');
                    }
                }
                ]
            };
            $.table.init(options);
        });
</script>
</@footer>
</@pageTheme>