<!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">
            <!-- loop typeArray -->
            <table class="table table-striped table-hover">
                <legend><a href="#" data-toggle="modal" id="del_{{typeArray' value.stid}}"
                           stid="{{typeArray' value.stid}}" stname="{{typeArray' value.stname}}"
                           class="fR btn btn-link colGray">删除标段类型</a>{{typeArray' value.stname}}，key：{{typeArray' value.stkey}}
                </legend>
                <thead>
                <tr>
                    <th width="40">id</th>
                    <th>标段名称</th>
                    <th>创建人</th>
                    <th>标段总额</th>
                    <th>标段状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <!-- loop typeArray' value.datarows -->
                <!-- if {{typeArray' value' value.stid}} == {{typeArray' value.stid}} -->
                <tr>
                    <td>{{typeArray' value' value.pmid}}</td>
                    <td><a href="/manage/item/{{typeArray' value' value.pmid}}/period">{{typeArray' value' value.pmname}}</a></td>
                    <th>{{typeArray' value' value.name}}{{typeArray' value' value.company}}</th>
                    <td>{{typeArray' value' value.contracttotal}}</td>
                    <th><span
                            class="colOrange">#{{typeArray' value' value.num}} {{typeArray' value' value.status}}</span>
                    </th>
                    <td><a href="#" id="delsec_{{typeArray' value' value.pmid}}" pmid="{{typeArray' value' value.pmid}}" proname="{{typeArray' value' value.pmname}}" class="colGray" data-toggle="modal">删除</a></td>
                </tr>
                <!-- endif -->
                <!-- endloop -->
                </tbody>
            </table>
            <!-- endloop -->
        </div>
    </div>
</div>
<!--删除标段不可删除-->
<div class="modal fade" id="delsection">
    <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>
                <h4 class="modal-title">删除标段确认</h4>
            </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="delsection2">
    <div class="modal-dialog">
        <div class="modal-content">
            <input id="pmid" type="hidden" name="pmid" value="0"/>
            <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="tippro"></p>
                <p>删除后，将无法恢复。</p>
                <p>请谨慎操作！</p>
            </div>
            <div class="modal-footer">
                <a id="delsecok" class="btn btn-danger">确认</a>
                <button class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
<!--删除标段不可删除-->
<div class="modal fade" id="deltype">
    <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>
                <h4 class="modal-title">删除标段类型确认</h4>
            </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="deltype2">
    <div class="modal-dialog">
        <div class="modal-content">
            <input id="stid" type="hidden" name="stid" value="0"/>
            <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="deltypeok"  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_']").click(function () {
            var stid = $(this).attr('stid');
            var stname = $(this).attr('stname');
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"type": 'del', "stid": stid},
                url: "{{rootUrl}}manage/item/{{pid}}/section",
                success: function (data) {
                    if (data['status'] == "1") {
                        $("#deltype").modal('show');
                    } else {
                        $("#stid").val(stid);
                        $("#tip").html("确认删除标段类型“" + stname + "”？");
                        $("#deltype2").modal('show');
                    }

                }
            });
        });
        $("#deltypeok").click(function () {
            var stid = $("#stid").val();
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"type": 'delpro', "stid": stid},
                url: "{{rootUrl}}manage/item/{{pid}}/section",
                success: function (data) {
                    if (data['status'] == "ok") {
                        $("#deltype2").modal('hide');
                        window.location.href = "{{rootUrl}}manage/item/{{pid}}/section";
                    }
                }
            });
        });

        $("a[id^='delsec_']").click(function () {
            var pmid = $(this).attr('pmid');
            var proname = $(this).attr('proname');
            $.ajax({
                type: "POST",
                dataType: "json",
                cache: false,
                data: {"type": 'delmcheck', "pmid": pmid},
                url: "{{rootUrl}}manage/item/{{pid}}/section",
                success: function (data) {
                    if (data['status'] == "1") {
                        $("#delsection").modal('show');
                    } else {
                        $("#pmid").val(pmid);
                        $("#tippro").html("确认删除标段“" + proname + "”？");
                        $("#delsection2").modal('show');
                    }

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