<!DOCTYPE html>
<html lang="en" 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">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form" action="" lay-filter="formDemo">
            <div class="layui-form-item" style="margin: 20px 0px 0px 5px">
                <input type="text" style="width: 70px; border: 0px" value="费用申请：" readonly>
                <input type="text" name="xm" id="xm" style="width: 1000px; border: 0px" readonly>
            </div>
            <div class="layui-form-item" style="margin: 20px 0px 0px 5px">
                <input type="text" style="width: 70px; border: 0px" value="科研费号：" readonly>
                <input type="text" name="kyfh" id="kyfh" style="width: 1000px; border: 0px" readonly>
            </div>

            <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

            <!-- 右侧悬浮按钮 -->
            <div class="layui-form layuimini-form" style="padding-bottom: 100px">
                <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>
<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="@{/js/lay-config.js}" charset="utf-8"></script>
<script th:src="@{/lib/xm-select-v1.2.2/xm-select.js}" charset="utf-8"></script>
<script th:inline="javascript" type="text/javascript">
    AjaxUtil.ctx = /*[[@{/}]]*/'';
    layui.use(['form', 'table'], function () {

        var form = layui.form,
            table = layui.table;

        var xmApprove = parent.getXmApproval();
        $("#xm").val(xmApprove.xm);
        $.ajax({
            url: AjaxUtil.ctx + 'staBudgetapproval/getBhById/' + xmApprove.xmid,
            method: 'post',
            success: function (result) {
                $("#kyfh").val(result.message);
            }

        })
        form.render();

        var currTable = table.render({
            elem: '#currentTableId',
            url: AjaxUtil.ctx + 'prjApproverecord/spList/' + xmApprove.xmid+'/sta_BudgetApproval',
            method: 'post',
            // toolbar: '#toolbarDemo',
            // defaultToolbar: ['filter', 'exports', 'print'],
            cols: [
                [
                    {type: 'numbers', align: 'center'},
                    {field: 'zt', width: '15%', title: '审批状态'},
                    // {field: 'tjrxm', width: '10%', title: '提交人'},
                    {field: 'tjsj', width: '16%', title: '提交时间', align: 'center'},
                    {
                        field: 'wc', width: '6%', title: '完成', align: 'center', templet: function (d) {
                            if (1 == d.wc) {
                                return '<span class="layui-badge layui-bg-blue">是</span>';
                            } else {
                                return '<span class="layui-badge layui-bg-orange">否</span>';
                            }
                        }
                    },
                    {field: 'shrxm', width: '10%', title: '审核人', align: 'center'},
                    {field: 'shsj', width: '16%', title: '审核时间', align: 'center'},
                    {field: 'spcz', width: '8%', title: '审批操作', align: 'center'},
                    {field: 'yj', title: '意见'}
                ]
            ],
            sortName: 'jtsj',
            autoSort: false,
            limits: [10, 15, 20, 25, 50, 100],
            limit: 10,
            page: true,
            skin: 'grid',
            parseData: function (res) { //res 即为原始返回的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.rows //解析数据列表
                };
            }
        });

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