<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>浏览</title>
    <link rel="stylesheet" th:href="@{/lib/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
    <link rel="stylesheet" th:href="@{/lib/font-awesome-4.7.0/css/font-awesome.min.css}" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<form class="layui-form" action="" lay-filter="formDemo">
    <!--    <div class="layui-tab layui-tab-card">-->
    <!--        <ul class="layui-tab-title">-->
    <!--            <li class="layui-this">常规</li>-->
    <!--            <li>计划</li>-->
    <!--        </ul>-->
    <!--        <div class="layui-tab-content">-->
    <!--常规开始-->
    <!--            <div class="layui-tab-item layui-show">-->
    <!--                <form class="layui-form" action="" lay-filter="formDemo">-->
    <div class="layui-form layuimini-form" style="padding-bottom: 100px">
        <div class="layui-form-item layui-inline" style="width: 100%">
            <label class="layui-form-label" style="width: 80px">年份</label>
            <div class="layui-input-inline" style="width: 360px">
                <input type="hidden" name="id" id="id" class="layui-input" th:value="${feescheme.id}">
                <input type="hidden" name="zb" id="zb" class="layui-input" th:value="${feescheme.zb}">
                <input type="number" id="nf" name="nf" th:value="${feescheme.nf}" class="layui-input" readonly>
            </div>
            <!--<label class="layui-form-label" style="width: 80px">序号</label>
            <div class="layui-input-inline" style="width: 360px">
                <input type="text" id="xh" name="xh" autocomplete="off" th:value="${feescheme.xh}" class="layui-input"
                       readonly>
            </div>-->
        </div>
        <div class="layui-form-item layui-inline" style="width: 100%">
            <label class="layui-form-label" style="width: 80px">出资单位</label>
            <div class="layui-input-inline" style="width: 360px">
                <input type="hidden" name="czdw" id="czdw" th:value="${feescheme.czdw}" class="layui-input">
                <input type="text" id="dwmc" name="dwmc" th:value="${feescheme.dwmc}" class="layui-input" readonly>
            </div>
            <label class="layui-form-label" style="width: 80px">出资金额(万)</label>
            <div class="layui-input-inline" style="width: 360px">
                <input type="number" id="czje" name="czje" th:value="${feescheme.czje}" class="layui-input" readonly>
            </div>
        </div>
        <div class="layui-form-item layui-inline" style="width: 100%">
            <label class="layui-form-label" style="width: 80px">承担单位</label>
            <div class="layuimini-container" style="width: 840px; margin-left: 109px">
                <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"
                       style="padding-top: 0px;margin-top: 0px"></table>
            </div>
        </div>

        <!-- 右侧悬浮按钮 -->
        <div class="right-bottom-btn">
            <button class="layui-btn" lay-filter="cancleBtn">
                <i class="layui-icon layui-icon-close"></i>关闭
            </button>
        </div>
    </div>
    <!--                </form>-->
    <!--            </div>-->
    <!--常规结束-->
    <!--        </div>-->
    <!--    </div>-->
</form>
<script id="tpl1" type="text/html">
    <input type="text" id="mc" name="mc" class="layui-input" readonly>
</script>
<script th:src="@{/lib/jquery-3.4.1/jquery-3.4.1.min.js}" charset="utf-8"></script>
<script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
<script th:src="@{/lib/coco-message/coco-message.js}" charset="utf-8"></script>
<script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
<script th:src="@{/js/lay-config.js}" charset="utf-8"></script>

<script type="text/javascript" th:inline="javascript">
    AjaxUtil.ctx = /*[[@{/}]]*/'';
    var czfaId = -1;
    var updateflag = 0;
    var cdCompany = [];
    layui.use(['form', 'table'], function () {
        var table = layui.table,
            layer = layui.layer;

        czfaId = $("#id").val();

        // 用于存放表格数据
        var dataCompany = new Array();
        $.ajax({
            url: AjaxUtil.ctx + 'prjUndertakecompany/list/' + czfaId,
            type: "post",
            async: false,
            dataType: "json",
            success: function (result) {
                dataCompany = result.data.rows;
            }
        });
        //承担单位
        table.render({
            elem: '#currentTableId',
            data: dataCompany,
            cols: [
                [
                    {type: 'numbers', align: 'center',title: '序号',width: '8%'},
                    {field: 'dwmc', title: '单位', width: '40%'},
                    {field: 'skje', title: '收款金额(万)', width: '18%'},
                    {field: 'bz', title: '备注', width: '20%'}
                ]
            ],
            autoSort: true,
            initSort: {
                field: 'xh', //排序字段
                type: 'asc' //排序方式:desc 降序,asc 升序
            }
        });
        //双击（承担单位）
        table.on('rowDouble(currentTableFilter)', function (obj) {
            var data = obj.data;
            cdCompany = {
                "xh": data.xh,
                "dw": data.dw,
                "dwmc": data.dwmc,
                "skje": data.skje,
                "bz": data.bz
            };

            var index = layer.open({
                title: '浏览承担单位',
                type: 2,
                // maxmin: true,
                shade: 0.2,
                area: [layerwidth + 'px', layerheight + 'px'],
                content: AjaxUtil.ctx + 'prjUndertakecompany/forView',
                end: function () {
                    layer.close(index);
                }
            });
        });

        // 监听取消按钮
        $("button[lay-filter='cancleBtn']").click(function () {
            var iframeIndex = parent.layer.getFrameIndex(window.name);
            parent.layer.close(iframeIndex);
        });
    });

    //设置更新标志
    function setUpdateFlag() {
        updateflag = 1;
    }

    function setCdCompany(company) {
        cdCompany = company;
    }

    function getCdCompany() {
        return cdCompany;
    }
</script>
</body>
</html>