<!DOCTYPE html>
<html lang=zh-cn>
<head>
    <meta charset=utf-8>
    <title>纵横计量支付系统</title>
    <meta name=description content=计量支付>
    <meta name=copyright content=smartcost.com.cn>
    <link rel=stylesheet href={{rootUrl}}global/css/bootstrap.css>
    <link rel=stylesheet href={{rootUrl}}global/css/style.css>
    <script src={{rootUrl}}global/js/jquery-1.9.1.min.js></script>
    <script src={{rootUrl}}global/js/bootstrap.js></script>
    <script src={{rootUrl}}global/js/jl.js></script>
</head>
<body>
<div class="wrapHeader">
    <h1 class="mainLogo" title="纵横计量支付"></h1>
    <div class="sysTools"><a title="返回首页" href="index.html"><i class="icon-circle-arrow-left icon-white"></i></a>&nbsp;&nbsp;&nbsp;<a
            title="纵横官网" target="_blank" href="http://smartcost.com.cn"><i class="icon-home icon-white"></i></a></div>
</div>
<!-- include "top" -->
<div class="warpAdmin">
    <!-- include "menu" -->
    <div class="adminContent">
        <div class="adminMain">
            <table class="table table-striped table-hover">
                <legend>项目列表</legend>
                <thead>
                <tr>
                    <th>项目名称</th>
                    <th width="40">id</th>
                    <th>包含标段类型</th>
                    <th>创建人</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <!-- loop pArray -->
                <tr>
                    <td><a href="{{rootUrl}}manage/item/{{pArray' value.pid}}/section">{{pArray' value.pname}}</a></td>
                    <td>{{pArray' value.pid}}</td>
                    <td>{{pArray' value.mnum}}</td>
                    <td>{{pArray' value.uname}}</td>
                    <td><a href="#" id="del_{{pArray' value.pid}}" pid="{{pArray' value.pid}}" proname="{{pArray' value.pname}}"
                           class="colGray" data-toggle="modal">删除</a>
                    </td>
                </tr>
                <!-- endloop -->
                </tbody>
            </table>
        </div>
    </div>
</div>

<!--删除标段不可删除-->
<div class="modal fade" id="delpoj">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h3>删除项目确认</h3>
            </div>
            <div class="modal-body">
                <p>项目下还有标段类型，不能删除该项目。</p>
            </div>
            <div class="modal-footer">
                <button class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
<!--删除标段可删除-->
<div class="modal fade" id="delpoj2">
    <div class="modal-dialog">
        <div class="modal-content">
            <input id="pid" type="hidden" value="0" name="pid"/>
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">删除项目确认</h4>
            </div>
            <div class="modal-body">
                <p id="tip"></p>
                <p>删除后，将无法恢复。</p>
                <p>请谨慎操作！</p>
            </div>
            <div class="modal-footer">
                <a id="delproject" class="btn btn-danger">确认</a>
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">autoFlashHeight();</script>
<script type="text/javascript">
    $(document).ready(function () {
        $("a[id^='del_']").on('click',function () {
            var pid = $(this).attr('pid');
            var pname = $(this).attr('proname');
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"type": 'del', "pid": pid},
                url: "{{rootUrl}}manage/item/index",
                success: function (data) {
                    if (data['status'] == "1") {
                        $("#delpoj").modal('show');
                    } else {
                        $("#pid").val(pid);
                        $("#tip").html("确认删除项目“" + pname + "”？");
                        $("#delpoj2").modal('show');
                    }

                }
            });
        });
        $("#delproject").click(function () {
            var pid = $("#pid").val();
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"type": 'delpro', "pid": pid},
                url: "{{rootUrl}}manage/item/index",
                success: function (data) {
                    if (data['status'] == "ok") {
                        $("#delpoj2").modal('hide');
                        window.location.href = "{{rootUrl}}manage/item/index";
                    }
                }
            });
        });
    });
</script>
</body>
