<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<html>
<head>
    <title>施工单位交底界面</title>
    <meta name="decorator" content="ani"/>
    <!-- SUMMERNOTE -->
    <%@include file="/webpage/include/summernote.jsp" %>
    <style type="text/css">
        input::-webkit-input-placeholder {
            color: red !important;
        }

        input::-moz-placeholder { /* Mozilla Firefox 19+ */
            color: red !important;
        }

        input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
            color: red !important;
        }

        input:-ms-input-placeholder { /* Internet Explorer 10-11 */
            color: red !important;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            jp.ajaxForm("#inputForm", function (data) {
                if (data.success) {
                    jp.success(data.msg);
                    jp.go("${ctx}/managementcenter/divide");
                } else {
                    jp.error(data.msg);
                    $("#inputForm").find("button:submit").button("reset");
                }
            });


/*            $(":checked").change(function () {
                var val = this.val();
                console.log(val);
                if (val!="无"||val!="") {
                    $('#policyHandlingInstructions').attr('placeholder', '政策处理描述不能为空');
                } else {
                    $('#policyHandlingInstructions').removeAttr('placeholder');
                }
            });*/



            $('input').change(function () {
                var implementedContent = $('#implementedContent').val();
                if (implementedContent != '') {
                    $('#inconsistentDescription').attr('placeholder', '图纸现场不一致描述不能为空');
                } else {
                    $('#inconsistentDescription').removeAttr('placeholder');
                }
            });

            $("#agree").click(function () {
                jp.prompt("没有问题, 审批意见", function (message) {
                    jp.post("${ctx}/act/task/audit2",
                    {
                        "taskId": "${construction.act.taskId}",
                        "taskName": "${construction.act.taskName}",
                        "taskDefKey": "${construction.act.taskDefKey}",
                        "procInsId": "${construction.act.procInsId}",
                        "procDefId": "${construction.act.procDefId}",
                        "flag": "yes",
                        "comment": window.encodeURI(message)

                    },
                    function (data) {
                        if (data.success) {
                            jp.success(data.msg);
                            jp.go("${ctx}/act/task/todo")
                        }
                    })
                });
            })


            $("#reject").click(function () {
                var implementedContent = $('#implementedContent').val();
                var policyHandlingInstructions = $('#policyHandlingInstructions').val();
                var inconsistentDescription = $('#inconsistentDescription').val();
                var otherProblem = $('#otherProblem').val();
                var val = getVal();
                if (val.indexOf('无') >= 0 && val.indexOf(";") >= 1) {
                    jp.error("无不可以和其它类型一起选择");
                    return false;
                } else {
                    var number = val.indexOf('无');
                    if (val.indexOf('无') != 0){
                        if (policyHandlingInstructions == '') {
                            jp.error("政策处理说明不能为空");
                            return false;
                        }
                    }
                }
                if (implementedContent != '') {
                    if (inconsistentDescription == '') {
                        jp.error('图纸现场不一致描述：');
                        return false;
                    }
                }
                var cId = $("#cId").val();
                jp.prompt("存在问题, 审批意见", function (message) {
                    jp.post("${ctx}/act/task/audit2",
                        {
                            "taskId": "${construction.act.taskId}",
                            "taskName": "${construction.act.taskName}",
                            "taskDefKey": "${construction.act.taskDefKey}",
                            "procInsId": "${construction.act.procInsId}",
                            "procDefId": "${construction.act.procDefId}",
                            "disclose.otherProblem": otherProblem,
                            "disclose.inconsistentDescription": inconsistentDescription,
                            "disclose.policyHandlingInstructions": policyHandlingInstructions,
                            "disclose.implementedContent": implementedContent,
                            "administrationType": val,
                            "cId": cId,
                            "flag": "no",
                            "comment": window.encodeURI(message)
                        },
                        function (data) {
                            if (data.success) {
                                jp.success(data.msg);
                                jp.go("${ctx}/act/task/todo")
                            }
                        })
                });
            });


            $('#startTime').datetimepicker({
                format: "YYYY-MM-DD HH:mm:ss"
            });
            $('#endTime').datetimepicker({
                format: "YYYY-MM-DD HH:mm:ss"
            });
            //富文本初始化
            $('#reason').summernote({
                height: 300,
                lang: 'zh-CN',
                readonly: true,
                callbacks: {
                    onChange: function (contents, $editable) {
                        $("input[name='reason']").val($('#reason').summernote('code'));//取富文本的值
                    }
                }
            });
        });
        function checkboxOnclick(checkbox){
            console.log('1')
        }
        function getVal(groups){
            var chk_value =[];//定义一个数组
            $('input[name="administrationTypeList"]:checked').each(function(){//遍历每一个名字为nodes的复选框，其中选中的执行函数
                chk_value.push($(this).val());//将选中的值添加到数组chk_value中
            });
            groups = chk_value.join(";");
            return groups
        }
    </script>
</head>
<body>
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        <a class="panelButton" href="#" onclick="history.go(-1)"><i class="ti-angle-left"></i> 返回</a>
                    </h3>
                </div>
                <div class="panel-body">
                    <div class="form-group text-center">
                        <%--<h3>${oALeave.act.taskName}</h3>--%>
                    </div>
                    <form:form id="inputForm" modelAttribute="construction" action="${ctx}/managementcenter/divide/save"
                               method="post" class="form-horizontal">
                        <form:hidden path="id"/>
                        <input id="cId" type="hidden" value="${construction.id}">
                        <%--						<input type="text" value="${construction.disclose.channel}">--%>
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">项目号：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.projectId)}
                                </td>
                                <td class="width-15 active"><label class="pull-right">项目名称：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.projectName)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">接收图纸时间：</label></td>
                                <td class="width-35">
                                    <fmt:formatDate value="${construction.acceptDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                                </td>
                                <td class="width-15 active"><label class="pull-right">其他问题描述：</label></td>
                                <td class="width-35">
                                    <form:input id="otherProblem" path="disclose.otherProblem" cssClass="form-control"/>
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">政处类型：</label></td>
                                <td class="width-35">
                                    <form:checkboxes onclick="checkboxOnclick(this)" path="administrationTypeList" items="${fns:getDictList('administrationType')}" itemLabel="label" itemValue="value" htmlEscape="false" cssClass="i-checks required"/>
                                </td>
                                <td class="width-15 active"><label class="pull-right">政策处理描述：</label></td>
                                <td class="width-35">
                                    <form:input id="policyHandlingInstructions"
                                                path="disclose.policyHandlingInstructions" cssClass="form-control"/>
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">已实施内容描述</label></td>
                                <td class="width-35">
									<form:input id="implementedContent" path="disclose.implementedContent" cssClass="form-control"/>
                                </td>
                                <td class="width-15 active"><label class="pull-right"> 图纸现场不一致描述：</label></td>
                                <td class="width-35">
                                    <form:input id="inconsistentDescription" path="disclose.inconsistentDescription"
                                                cssClass="form-control"/>
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">停电线路：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.powerLine)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>停电范围（中间统一用中文分号）：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.blackoutArea)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">项目类型：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.projectType)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>政处初步判断：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.preliminaryJudgment)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">是否含土建（不含钢管杆）：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.civilEngineering)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>钢管杆基础类型：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.baseType)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">是否需要规划报批（150米及以上土建）：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.planApproval)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>设备改造类型：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.transformationType)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">改造设备尺寸及间隔数：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.transformationEquipment)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>是否含新设备命名：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.newNamed)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">是否含变电站新间隔投运：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.putInto)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>是否含非涉电电气施工：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.electricalConstruction)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">图纸标注的带电作业情况：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.theAssignment)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>是否含自动化：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.automation)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">二遥或三遥：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.remote)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font
                                        color="red">*</font>通信方式：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.communicationMode)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">柱开集中或就地：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.inSitu)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>环网柜DTU户外或户内：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.networkCabinet)}
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">站房DTU：</label></td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.station)}
                                </td>
                                <td class="width-15 active"><label class="pull-right"><font color="red">*</font>是否为停电打包项目：</label>
                                </td>
                                <td class="width-35">
                                        ${fns:unescapeHtml(construction.powerFailure)}
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form:form>

                    <div class="row">
                        <div class="col-sm-3"></div>
                        <div class="col-sm-6">
                            <div class="form-group text-center">
                                <input id="reject" class="btn  btn-primary btn-lg btn-danger" type="submit"
                                       value="存在问题"/>
                                <input id="agree" class="btn  btn-primary btn-lg btn-parsley" type="submit"
                                       value="没有问题"/>&nbsp;
                            </div>
                        </div>
                    </div>

                    <c:if test="${not empty construction.id}">
                        <act:flowChart procInsId="${construction.act.procInsId}"/>
                        <act:histoicFlow procInsId="${construction.act.procInsId}"/>
                    </c:if>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>