<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>过程控制表管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
            switchType("#tProcessName");
		});
        function switchType(othis){
            if(!$("#tType").val()){
                return
            }
            if($(othis).val() == "设备询价记录"){
                $("#controltype").attr("src","${ctx}/workdevicerecord/workDeviceXjRecord/form?projectId=${projectControlTable.id}&view=view");
            }else if($(othis).val() == "补充资料清单"){
                $("#controltype").attr("src","${ctx}/workinfolist/workInfoList/form?projectId=${projectControlTable.id}&view=view")
            }else if($(othis).val() == "现场踏勘记录"){
                $("#controltype").attr("src","${ctx}/workexplore/workExplore/form?projectId=${projectControlTable.id}&view=view")
            }else if($(othis).val() == "沟通记录表"){
                $("#controltype").attr("src","${ctx}/workcommunicaterecord/workCommunicateRecord/form?projectId=${projectControlTable.id}&view=view")
            }else if($(othis).val() == "工程量计算底稿"){
                $("#controltype").attr("src","${ctx}/workprojectcalc/workProjectCalcDecor/form?projectId=${projectControlTable.id}&view=view")
            }else if($(othis).val() == "交接单"){
                $("#controltype").attr("src","${ctx}/workhandbill/workHandBill/form?projectId=${projectControlTable.id}&view=view")
            }
        }
	</script>

</head>
<body class="hideScroll">
<div class="single-form">
    <div class="container">
		<form:form id="inputForm" modelAttribute="projectControlTable" action="${ctx}/projectcontroltable/projectControlTable/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
        <input type="hidden" name="pfId" id="pfId" value="${projectControlTable.pfId}">
        <div class="form-group layui-row first">
            <div class="form-group-label"><h2>基础信息</h2></div>
            <div class="layui-item layui-col-sm6">
                <label class="layui-form-label"><span class="require-item">*</span>表格名称：</label>
                <div class="layui-input-block">
                    <form:input path="tName" htmlEscape="false"  disabled="true"  class="form-control required" value="${projectControlTable.tName}"/>
                </div>
            </div>
            <div class="layui-item layui-col-sm6">
                <label class="layui-form-label"><span class="require-item">*</span>表格类型：</label>
                <div class="layui-input-block">
                    <input type="text" class="form-control layui-input" id="tProcessName" disabled="disabled" value="${projectControlTable.processName}" />
                    <input type="hidden" id="tType" value="${projectControlTable.tType}">
                </div>
            </div>
            <div class="layui-item layui-col-sm6">
                <label class="layui-form-label">创建时间：</label>
                <div class="layui-input-block">
                    <input id="createDate" name="createDate" type="text" disabled="disabled"  maxlength="20" class="laydate-icondate form-control layer-date required"
                           value="<fmt:formatDate value="${projectControlTable.createDate}"  pattern="yyyy-MM-dd"/>"/>
                </div>
            </div>
            <div class="layui-item layui-col-sm6">
                <label class="layui-form-label">负责人：</label>
                <div class="layui-input-block">
                    <c:choose>
                        <c:when test="${not empty projectControlTable.tUser}">
                            <sys:treeselect id="tUser" name="tUser.id" value="${projectControlTable.tUser.id}" labelName="tUser.name" labelValue="${projectControlTable.tUser.name}"
                                            title="用户" url="/sys/office/treeData?type=3" cssClass="form-control " disabled="disabled" hideBtn="true" allowClear="true" notAllowSelectParent="true"/>
                        </c:when>
                        <c:otherwise>
                            <sys:treeselect id="tUser" name="tUser.id" value="${fns:getUser().id}" labelName="tUser.name" labelValue="${fns:getUser().name}"
                                            title="用户" url="/sys/office/treeData?type=3" cssClass="form-control " disabled="disabled" hideBtn="true" allowClear="true" notAllowSelectParent="true"/>
                        </c:otherwise>
                    </c:choose>
                </div>
            </div>
        </div>
            <%-- 不同类型间切换--%>
        <iframe id="controltype" name="controltype" src="" width="100%" frameborder="0" style="min-height: 300px">

        </iframe>
        <%--<div id="controltype"></div>--%>
            <%-- 不同类型间切换--%>
            <div class="form-group layui-row">
                <div class="form-group-label"><h2>附件信息</h2></div>
                <div id="addFile_attachment" style="display: none" class="upload-progress">
                    <span id="fileName_attachment" ></span>
                    <b><span id="baifenbi_attachment" ></span></b>
                    <div class="progress">
                        <div id="jindutiao_attachment" class="progress-bar" style="width: 0%" aria-valuenow="0">
                        </div>
                    </div>
                </div>
                <input id="attachment_file" type="file" name="attachment_file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitle(this.value);"/>
                <span id="attachment_title"></span>
                <div class="layui-item layui-col-xs12" style="padding:0 16px;">
                    <table id="upTable" class="table table-bordered table-condensed details">
                        <thead>
                        <tr>
                                <%-- <th>序号</th>--%>
                            <th>文件预览</th>
                            <th>上传人</th>
                            <th>上传时间</th>
                        </tr>
                        </thead>
                        <tbody id="file_attachment">
                        <c:forEach items="${projectControlTable.workAttachments}" var = "workAttachment" varStatus="status">
                            <tr>
                                    <%-- <td>${status.index + 1}</td>--%>
                                <c:choose>
                                    <c:when test="${fn:containsIgnoreCase(workAttachment.attachmentName,'jpg')
                                                       or fn:containsIgnoreCase(workAttachment.attachmentName,'png')
                                                       or fn:containsIgnoreCase(workAttachment.attachmentName,'gif')
                                                       or fn:containsIgnoreCase(workAttachment.attachmentName,'bmp')
                                                       or fn:containsIgnoreCase(workAttachment.attachmentName,'jpeg')}">
                                        <td><img src="${workAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workAttachment.url}','90%','90%')" alt="${workAttachment.attachmentName}">
                                    </c:when>
                                    <c:otherwise>
                                        <c:choose>
                                            <c:when test="${fn:containsIgnoreCase(workAttachment.attachmentName,'pdf')}">
                                                <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%','1')">${workAttachment.attachmentName}</a></td>
                                            </c:when>
                                            <c:otherwise>
                                                <td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workAttachment.url}','90%','90%')">${workAttachment.attachmentName}</a></td>
                                            </c:otherwise>
                                        </c:choose>
                                    </c:otherwise>
                                </c:choose>
                                <td>${workAttachment.createBy.name}</td>
                                <td><fmt:formatDate value="${workAttachment.createDate}" type="both"/></td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>

	</form:form>
    </div>
</div>
</body>
</html>