<?xml version="1.0" encoding="UTF-8"?>

<!--
    $Author:WJW
    $Revision: 1.0
    工作流任务列表
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application"
          xmlns:s="leaf.plugin.script" trace="true">
    <a:init-procedure>
    </a:init-procedure>
    <a:view template="default" package="leaf.ui.std">
        <a:link id="widget_to_do_node_approve_history"
                url="${/request/@context_path}/modules/zjwfl/ZJWFL3040/zj_wfl_my_approved_application_history.screen"/>
        <style>
            html, body {
                width: 242px;
                height: 552px;
                margin: 0;
                padding: 0;
            }

            .widget_to_do_wfl {
                box-sizing: border-box;
                width: 242px;
                height: 552px;
                background-color: #fff;
                position: relative;
                border: 1px solid #F0F0F3;
                padding: 0;
                cursor: default;
            }

            .widget_to_do_wfl .search {
            / / height: 50 px;
                /*border-bottom: 1px solid #F0F0F3;*/
                clear: left;
            }

            .widget_to_do_wfl .search .search_content {
                height: 28px;
                margin: 0px 16px;
                background: #FFFFFF;
                box-shadow: 0 1px 4px 0 rgba(90, 127, 255, 0.60);
                border-radius: 5px;
            }
            .widget_to_do_wfl .search .line{
                height: 12px;
                width: 1px;
                background: #ccc;
                position: absolute;
                /*left: 54px;*/
                display: inline-block;
                /* top: 8px; */
                margin-top: 8px;
            }
            .widget_to_do_wfl .search .search_content #wfl_search_to_do_id {
                height: 24px;
                border: none;
                display: inline-block;
                position: absolute;
                /*width: 160px;*/
                margin: 2px 0px 2px 10px;
            }

            .widget_to_do_wfl .search .search_content .search_img {
                width: 15px;
                /*float: left;*/
                display: inline-block;
                margin: 4px;
                cursor: pointer;
            }

            .widget_to_do_wfl .wfl-title {
            / / height: 70 px;
                /*width: 100%;*/
                margin: 18px 0 11px 16px;
                float: left;
            }

            .widget_to_do_wfl .wfl-title .title-desc {
                float: left;
                height: 23px;
                /*border-bottom: 2px solid #657efe;*/
                font-family: NotoSansHans-Medium;
                font-size: 14px;
                font-weight: normal;
                font-stretch: normal;
                letter-spacing: 0px;
                color: #333333;
            }
            .widget_to_do_wfl .wfl-title .title-desc-line{
                width: 29px;
                height: 5px;
                background-color: #657efe;
                position: absolute;
                margin-left: 43px;
                margin-top: 20px;
            }
            .widget_to_do_wfl .wfl-title .title-icon{
                float: left;
                margin-right: 27px;
            }
            .widget_to_do_wfl .wfl-title .title-icon img{
                width: 17px;
            }
            /*.widget_to_do_wfl .wfl-title .switch {*/
            /*margin-left: 16px;*/
            /*width: 97px;*/
            /*/ / border: 1 px solid rgba(75, 80, 90, 0.15);*/
            /*/ / border-radius: 5 px 0 0 5 px;*/
            /*/ / float: right;*/
            /*height: 23px;*/
            /*margin-bottom: 16px;*/
            /*cursor: pointer;*/
            /*}*/

            /*.widget_to_do_wfl .wfl-title .switch .switch_approve {*/
            /*display: block;*/
            /*width: 47px;*/
            /*float: left;*/
            /*font-size: 12px;*/
            /*text-align: center;*/
            /*border: 1px solid rgba(75, 80, 90, 0.15);*/
            /*line-height: 22px;*/
            /*color: rgba(75, 80, 90, 0.75);*/

            /*}*/

            /*.widget_to_do_wfl .wfl-title .switch #switch_unapprove_id {*/
            /*border-bottom-left-radius: 5px;*/
            /*border-top-left-radius: 5px;*/
            /*}*/

            /*.widget_to_do_wfl .wfl-title .switch #switch_approved_id {*/
            /*border-top-right-radius: 5px;*/
            /*border-bottom-right-radius: 5px;*/
            /*margin-left: -1px;*/
            /*}*/

            .widget_to_do_wfl #zjwfl_grid-wraper {
                display: inline-block;
                position: relative;
                height: 329px;
            / / margin: 9 px 0 0 0;
                font-family: PingFangSC-Regular;
                font-size: 12px;
                color: #5A7FFF;
                letter-spacing: 0;
            }

            .widget_to_do_wfl .hls-pagging-grid {
                width: 100%;
                height: 390px;
                -webkit-box-shadow: none;
                box-shadow: none;
            //overflow: auto;
            }

            .widget_to_do_wfl .hls-pagging-grid .grid-title {
                display: none;
            }

            .widget_to_do_wfl .hls-pagging-grid .grid-body {
                padding: 0;
                overflow: auto;
                width: 100%;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table > tr:first-child {
                display: none;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tbody tr:first-child {
                height: 56px;
            / / border-top: 1 px solid #F0F0F3;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table listRow1 {

            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr:hover {
                background: rgba(90, 127, 255, 0.08);
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr img {
                height: 14px;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table-active {
                background: rgba(90, 127, 255, 0.08);
            }

            .widget_to_do_wfl .hls-pagging-grid .grid-foot {
                height: 36px;
                margin-top: 0;
                line-height: 36px;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr {
                height: 56px;
                border-bottom: 1px solid #F0F0F3;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td {
                height: 56px;
                width: 100%;
                padding: 0 16px;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td .listRow1 {
                height: 17px;
                width: 100%;
                margin-bottom: 8px;
                font-family: NotoSansHans-Thin;
                font-size: 12px;
                font-weight: normal;
                font-stretch: normal;
                letter-spacing: 1px;
                color: #333333;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td .listRow1 .workflow_info {
                float: left;
                max-width: 130px;
                overflow: hidden;
                line-height: 17px;
                white-space: nowrap;
                text-overflow: ellipsis;
                font-family: PingFangSC-Regular;
                font-size: 12px;
                cursor: pointer;
                color: rgba(75, 80, 90, 0.75);
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td .listRow1 .date {
                float: right;
                line-height: 17px;
                font-family: NotoSansHans-Thin;
                font-size: 12px;
                font-weight: normal;
                font-stretch: normal;
                letter-spacing: 1px;
                color: #cccccc;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td .listRow2 {
                height: 14px;
                width: 100%;
                cursor: pointer;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td .listRow2 .submit_name {
                float: left;
                font-family: NotoSansHans-Thin;
                font-size: 12px;
                font-weight: normal;
                font-stretch: normal;
                letter-spacing: 1px;
                color: #66ccff;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td .listRow2 .submit_name img {
                margin-right: 8px;
                position: relative;
                top: 1px;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td .listRow2 .goDetail {
                float: right;
                line-height: 14px;
                position: relative;
                top: 1px;
                cursor: pointer;
            }

            .widget_to_do_wfl .hls-pagging-grid .hls-table tr td .clearFloat {
                clear: both;
                height: 0;
                line-height: 0;
                font-size: 0
            }
            .widget_to_do_wfl .hls-pagging-grid .grid-foot .page-message .page_message_num{
                margin-right: 2px;
            }

            .widget_to_do_wfl .hls-pagging-grid .grid-foot .page-message {
                min-width: auto;
                display: none;
            }
        </style>
        <script><![CDATA[
//        leaf.onReady(function () {
//            document.getElementById('switch_unapprove_id').style.border = '1px solid #5A7FFF';
//            document.getElementById('switch_unapprove_id').style.color = '#5A7FFF';
//            document.getElementById('zjwfl_grid_to_do_list-wraper').style.display = 'block';
//            document.getElementById('zjwfl_grid_approved-wraper').style.display = 'none';
//            //document.getElementById('switch_unapprove_id').style.borderRadius = '5px 0 0 5px';
//        })

//        function clickUnapprove() {
//            document.getElementById('switch_approved_id').style.border = '1px solid rgba(75, 80, 90, 0.15)';
//            document.getElementById('switch_approved_id').style.color = 'rgba(75,80,90,0.75)';
//            document.getElementById('zjwfl_grid_approved-wraper').style.display = 'none';
//
//
//            document.getElementById('switch_unapprove_id').style.border = '1px solid #5A7FFF';
//            document.getElementById('switch_unapprove_id').style.color = '#5A7FFF';
//            document.getElementById('zjwfl_grid_to_do_list-wraper').style.display = 'block';
//
//
//        }
//        function clickApprove() {
//            document.getElementById('switch_unapprove_id').style.border = '1px solid rgba(75, 80, 90, 0.15)';
//            document.getElementById('switch_unapprove_id').style.color = 'rgba(75,80,90,0.75)';
//            document.getElementById('zjwfl_grid_to_do_list-wraper').style.display = 'none';
//
//
//            document.getElementById('switch_approved_id').style.border = '1px solid #5A7FFF';
//            document.getElementById('switch_approved_id').style.color = '#5A7FFF';
//            document.getElementById('zjwfl_grid_approved-wraper').style.display = 'block';
//
//        }

        function wfl_to_do(record, index) {

            var html = '';
            html += '<div class="listRow1" >'
                + '<span class="workflow_info" title="' + record.data['workflow_info'] + '">' + record.data['workflow_info'] + '</span>';
            html += '<span class="date">' + formatDate(record.data['creation_date_format']) + '</span>'
                + '<span class="clearFloat"></span></div>'
                + '<div class="listRow2">'
                + '<span class="submit_name">'+"from" +" "+ record.data['submitted_by_name'] + '</span>'
                + '<img class="goDetail" onclick="wfl_winOpen_zjwfl5110_wfl_approve(' + record.data.instance_id + ',' + record.data.node_id + ',' + record.data.record_id + ',' + record.data.workflow_id + ',\'' + record.data.record_type + '\')" src="${/request/@context_path}/leafresource/images/wfl/right_square@2x.png" />'
                + '<span class="clearFloat"></span></div>';
            return html;
        }

//        function wfl_approval_grid_renderer(record, index) {
//            //
//            var html = '';
//            html += '<div class="listRow1" onclick="winOpen_approve_history(' + record.data.instance_id + ',' + record.data.rcpt_record_id + ',' + record.data.approve_record_id + ',\'' + record.data.rcpt_record_type + '\')">'
//                + '<span class="workflow_info" title="' + record.data['document_info'] + '">' + record.data['document_info'] + '</span>';
//            html += '<span class="date">' + formatDate(record.data['approve_date']) + '</span>'
//                + '<span class="clearFloat"></span></div>'
//                + '<div class="listRow2">'
//                + '<span class="submit_name"><img src="${/request/@context_path}/leafresource/images/wfl/user@2x.png"/>' + record.data['user_name'] + '</span>'
//                + '<img class="goDetail" src="${/request/@context_path}/leafresource/images/wfl/right_square@2x.png" />'
//                + '<span class="clearFloat"></span></div>';
//            return html;
//        }
        function formatDate(time) {
            var time = new Date(time).format('yyyy-mm-dd')
            return time;

        }
        function wfl_winOpen_zjwfl5110_wfl_approve(instance_id, node_id, record_id, workflow_id, record_type) {
            var url_type;
            if (record_type == 'NOTICE') {
                url_type = 'NOTICE';
            } else {
                url_type = 'DISPLAY';
            }
            var win = new Leaf.Window({
                id: 'widget_to_do_wfl_approve_win',
                url: '${/request/@context_path}/modules/zjwfl/ZJWFL5110/zj_wfl_approve.lview',
                params: {
                    instance_id: instance_id,
                    node_id: node_id,
                    record_id: record_id,
                    workflow_id: workflow_id,
                    record_type: record_type,
                    url_type: url_type
                },
                title: '工作流审批',
                height: 500,
                width: 860,
                fullScreen: true
            });
            win.on('close', function () {
                //query_zjwfl5110_toDoDs();
                location.reload();
            });
        }

//        function winOpen_approve_history(instance_id, rcpt_record_id, approve_record_id, rcpt_record_type) {
//            var url_type;
//            if (rcpt_record_type == 'NOTICE') {
//                url_type = 'NOTICE';
//            } else {
//                url_type = 'DISPLAY_MY_APPROVED';
//            }
//            var win = new leaf.Window({
//                id: 'node_approve_history_win',
//                url: $('widget_to_do_node_approve_history').getUrl(),
//                params: {
//                    instance_id: instance_id,
//                    rcpt_record_id: rcpt_record_id,
//                    approve_record_id: approve_record_id,
//                    url_type: url_type
//                },
//                title: '单据明细',
//                fullScreen: true
//            });
//            win.on('close', function () {
//                //query_zjwfl5110_toDoDs();
//                location.reload();
//            });
//
//        }

        function searchWfl() {
            var documentInfo = document.getElementById('wfl_search_to_do_id').value;
            //代办事项
            var params = {
                any_info: documentInfo,
                workflow_info: documentInfo,
                document_info: documentInfo
            }
            $('zjwfl_zjwfl5110_to_do_list_ds').qpara = params;
            $('zjwfl_zjwfl5110_to_do_list_ds').query();

        }


        ]]></script>
        <a:dataSets>
            <a:dataSet id="zjwfl_zjwfl5110_to_do_list_ds" autoQuery="true" pageSize="5"
                       model="zjwfl.ZJWFL5110.sdic_wfl_instance_node_recipient">
                <a:fields>
                    <a:field name="instance_id"/>
                    <a:field name="node_id"/>
                    <a:field name="record_id"/>
                    <a:field name="workflow_id"/>
                    <a:field name="record_type"/>
                    <a:field name="workflow_info"/>
                    <a:field name="submitted_by_name"/>
                    <a:field name="creation_date_format"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>

        <div class="widget_to_do_wfl">
            <div class="wfl-title">
                <div class="title-icon"><img src="${/request/@context_path}/leafresource/images/wfl/wfl-icon@2x.png"/></div>
                <div class="title-desc">任务列表</div>
                <div class="title-desc-line"></div>
            </div>
            <div class="search">
                <div class="search_content">
                    <img src="${/request/@context_path}/lib/assets/layouts/layout4/img/search@2x.png" class="search_img" onclick="searchWfl()"/>
                    <div class="line"></div>
                    <input id="wfl_search_to_do_id" class="search_input"/>
                </div>
            </div>
            <div class="workflow_menu_img" ><img style="width: 28px;margin:10px 0 13px 16px;" src="${/request/@context_path}/lib/assets/layouts/layout4/img/to-do@2x.png"/></div>

            <a:hapGrid id="zjwfl_grid_to_do_list" bindTarget="zjwfl_zjwfl5110_to_do_list_ds"
                       canWheel="true">
                <a:columns>
                    <a:column template="wfl_to_do"/>
                </a:columns>
            </a:hapGrid>
        </div>
        <a:screenBody style="display:none"></a:screenBody>
    </a:view>
</a:screen>