<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>合同管理管理</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic}/layer-v2.3/laydate/laydate.js"></script>
	<script type="text/javascript">

		/*暂弃*/
		var validateForm;
        function doSubmit(obj){
            // 回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            $("#contractPrice").val($("#contractPrice").val().replace(/\,/g, ""));
            $("#investmentAmount").val($("#investmentAmount").val().replace(/\,/g, ""));
            if(validateForm.form()){
                if(obj == 1) {
                    $("#flag").val("yes");
                }else {
                    $("#flag").val("no");
                }
                $("#inputForm").submit();
                return true;
            }else {
                parent.layer.msg("信息未填写完整!", {icon: 5});
            }
            return false;
        }
		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            getRandom();
			$("#contractFee").change(function(){
                //状态为其他的时候  添加required样式
                if($(this).val() == "4"){
                    $("#contractFeeDoc").attr("class","form-control required");
                }else{
                    $("#contractFeeDoc").attr("class","form-control");
                }
            });
            /*$("#contractType").change(function(){
                //状态为其他的时候  添加required样式
                if($(this).val() == "5"){
                    $("#contractTypeDoc").attr("class","form-control required");
                }else{
                    $("#contractTypeDoc").attr("class","form-control");
                }
            })*/
            $("#attachment_btn").click(function () {
                $("#attachment_file").click();
            });

            $("input[name='ext']").on('ifChecked', function(event){
                var radioVal = $(this).val();
                if(radioVal == 0){
                    $("#td1").removeClass("hide");
                    $("#td2").addClass("hide");
                    $("#tr1").show()
                    $("#tr2").show()
                }else{
                    $("#td1").addClass("hide");
                    $("#td2").removeClass("hide");
                    $("#tr1").hide()
                    $("#tr2").hide()
                }
            });
            if("${workContractInfo.ext}" == "1"){
                $("#ext1").iCheck('check')
            }else{
                $("#ext").iCheck('check')
            }
		});
        function getRandom(){
            var GetRandomn = 1;
            //js生成时间戳
            var timestamp=new Date().getTime();
            //获取随机范围内数值的函数
            function GetRandom(n){
                //由随机数+时间戳+1组成
                GetRandomn=Math.floor(Math.random()*n+timestamp+1);
            }
            //开始调用，获得一个1-100的随机数
            GetRandom("30");
            if(!$("#contractNum").val()){
                $("#contractNum").val(GetRandomn)
            }
        }
        function insertTitle(tValue){
            var list = "${workContractInfo.workAttachments}";
            var size = (list.split('url')).length-1;
            var files = $("#attachment_file")[0].files;            for(var i = 0;i<files.length;i++) {                var file = files[i];
            var attachmentId = $("#id").val();
            var attachmentFlag = "44";
            console.log(file);
            var timestamp=new Date().getTime();

            var storeAs = "attachment-file/workContractInfo/"+timestamp+"/"+file['name'];
            var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
            var divId = "_attachment";
            $("#addFile"+divId).show();
            multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);}
        }

        function openBill(title,url,width,height,target,formId){
            var frameIndex = parent.layer.getFrameIndex(window.name);
            var urls = url+"&index="+frameIndex;
            if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端，就使用自适应大小弹窗
                width='auto';
                height='auto';
            }else{//如果是PC端，根据用户设置的width和height显示。

            }
            top.layer.open({
                type: 2,
                area: [width, height],
                title: title,
                maxmin: true, //开启最大化最小化按钮
                content: urls ,
                btn: ['确定','关闭'],
                yes: function(index, layero){
                    var body = top.layer.getChildFrame('body', index);
                    var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                    var inputForm = body.find('#inputForm');
                    var top_iframe;
                    if(target){
                        top_iframe = target;//如果指定了iframe，则在改frame中跳转
                    }else{
                        top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
                    }
                    inputForm.attr("target",top_iframe);//表单提交成功后，从服务器返回的url在当前tab中展示
                    inputForm.attr("action","${ctx}/workclientinfo/workClientInfo/contractsave");//表单提交成功后，从服务器返回的url在当前tab中展示
                    var $document = iframeWin.contentWindow.document;

                    formSubmit($document,formId,index);
                },
                cancel: function(index){
                }
            });
        }

        function formSubmit($document,inputForm,index){
            var validateForm = $($document.getElementById(inputForm)).validate({
                submitHandler: function(form){
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function(error, element) {
                    $($document.getElementById("#messageBox")).text("输入有误，请先更正。");
                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
            if(validateForm.form()){
                $($document.getElementById(inputForm)).ajaxSubmit({
                    success:function(data) {
                        var d = data;
                        if(d.msg == "false"){
                            parent.layer.msg("保存客户信息异常!",{icon:2});
                            return false;
                        }
                        $("#clientId").val(d.id);
                        $("#clientName").val(d.name);
                        parent.layer.msg(d.str,{icon:1});
                        top.layer.close(index)
                    }
                });
            }
        }
        function setPNumber(obj){
            $.ajax({
                type:'post',
                url:'${ctx}/workinvoice/workInvoice/getPNumberr',
                data:{
                    "obj":obj
                },
                success:function(data){
                    var d = JSON.parse(data);
                    $("#pNumber").val(d.pNumber);
                }
            })
        }
        //千位符号，保留两位小数
        function toThousands(s){
            if(/[^0-9\.]/.test(s)) return "无效值";
            s=s.replace(/^(\d*)$/,"$1.");
            s=(s+"00").replace(/(\d*\.\d\d)\d*/,"$1");
            s=s.replace(".",",");
            var re=/(\d)(\d{3},)/;
            while(re.test(s))
                s=s.replace(re,"$1,$2");
            s=s.replace(/,(\d\d)$/,".$1");
            return  s.replace(/^\./,"0.")
        }
	</script>
</head>
<body class="hideScroll">
	<form:form id="inputForm" modelAttribute="workContractInfo" enctype="multipart/form-data"  action ="${ctx}/workcontractrecord/workContractRecord/saveAudits" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="act.taskId"/>
		<form:hidden path="act.taskName"/>
		<form:hidden path="act.taskDefKey"/>
		<form:hidden path="act.procInsId"/>
		<form:hidden path="act.procDefId"/>
		<form:hidden id="flag" path="act.flag"/>
		<sys:message content="${message}"/>
		<c:set var="status" value="${workContractInfo.act.status}" />
		<div class="tabs-container">
			<ul class="nav nav-tabs">
				<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" style="margin-top: 25px">合同信息</a>
				</li>
			</ul>
		</div>
		<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
			<tbody>
			<tr>
				<td class="width-15 active"><label class="pull-right">合同来源：</label></td>
				<td class="width-35" colspan="3">
					<input type="radio" class="i-checks" name="ext" checked id="ext" value="0">
					<label for="ext">投标项目</label>
					<input type="radio" class="i-checks" name="ext" id="ext1" value="1">
					<label for="ext1">非投标项目</label>
				</td>
			</tr>
			<tr id="tr2">
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>投标项目：</label></td>
				<td class="width-35" colspan="3" id="td1">
					<input type="hidden" value="" id ="ids">
					<sys:gridselectcallprojectt url="${ctx}/workinvoice/workInvoice/selectprojectt" id="project" name="project.id"  value="${workContractInfo.project.id}"  title="选择投标项目" labelName="workContractInfo.project.projectName"
												labelValue="${workContractInfo.project.projectName}" cssClass="form-control required" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName" ></sys:gridselectcallprojectt>
				</td>
					<%--<td class="width-35 hide" colspan="3" id="td2">
                        <form:input id ="projectName" path="projectName" htmlEscape="false" class="form-control"/>
                    </td>--%>
			</tr>
			<tr id="tr1">
				<td class="width-15 active"><label class="pull-right">投标编号：</label></td>
				<td class="width-35">
					<form:input id ="pNumber" path="project.projectNumber" htmlEscape="false"  readonly="true" class="form-control"/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">总合同名称：</label></td>
				<td class="width-35"  colspan="3">
					<%--<sys:gridselectContract url="${ctx}/workengineeringproject/workEngineeringProject/selectcontractId" type="" isTotal="0" id="totalContractId" name="totalContractId"  value="${workFullManage.workContractInfo.id}"  title="选择合同" labelName="workContractInfo.name"--%>
											<%--labelValue="${workFullManage.workContractInfo.name}" cssClass="form-control" fieldLabels="合同信息id" fieldKeys="name" searchLabel="合同名称" searchKey="name" ></sys:gridselectContract>--%>
					<form:input path="totalContractName" htmlEscape="false" readonly="true"   class="form-control"/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>合同名称：</label></td>
					<%--	<td class="width-35"  colspan="3">--%>
				<td class="width-35">
					<form:input path="name" htmlEscape="false"    class="form-control required"/>
				</td>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>合同金额(元)_预计金额：</label></td>
				<td class="width-35">
					<form:input path="contractPrice" htmlEscape="false"  onchange="this.value=toThousands(this.value)"  class="form-control required number"/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>合同编号：</label></td>
				<td class="width-35">
					<form:input path="contractNum" id="contractNum" htmlEscape="false" readonly="true"   class="form-control required"/>
				</td>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>工程分类：</label></td>
				<td class="width-35">
					<form:select path="contractType" id="contractType" class="form-control required">
						<form:option value="0" label="请选择"/>
						<form:options items="${fns:getMainDictList('contract_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>客户名称：</label></td>
				<td class="width-35">
						<%--<sys:gridselectAhref url="${ctx}/workcontractinfo/workContractInfo/selectclientAhref" id="client" name="client.id"  value="${workContractInfo.client.id}"  title="选择客户" labelName="client.name"
                                        labelValue="${workContractInfo.client.name}" cssClass="form-control required" fieldLabels="客户名称" fieldKeys="name" searchLabel="客户名称" searchKey="name" searchLabel1="联系人" searchKey1="workLinkName"></sys:gridselectAhref>
                    	--%>
					<div style="width: 85%;float: left">
						<sys:gridselectAhref url="${ctx}/workcontractinfo/workContractInfo/selectclientAhref" id="client" name="client.id"  value="${workContractInfo.client.id}"  title="选择客户" labelName="client.name"
											 labelValue="${workContractInfo.client.name}" cssClass="form-control required" fieldLabels="客户名称" fieldKeys="name" searchLabel="客户名称" searchKey="name" searchLabel1="联系人" searchKey1="workLinkName"></sys:gridselectAhref>
					</div>
					<div style="width: 10%;float: right;">
						<a href="javascript:void(0)" onclick="openBill('新增客户管理', '${ctx}/workclientinfo/workClientInfo/form?param=2','80%','80%',false,'inputForm')" class="btn btn-success btn-sm" ><i class="fa fa-plus"></i> 新增</a>
					</div>
				</td>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>签订日期：</label></td>
				<td class="width-35">
					<input class="form-control layer-date laydate-icon required" id="contractDate" name="contractDate" value="<fmt:formatDate value="${workContractInfo.contractDate}" pattern="yyyy-MM-dd"/>" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})">
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>合同生效日期：</label></td>
				<td class="width-35">
					<input class="form-control layer-date laydate-icon required" id="effectiveDate" name="effectiveDate" value="<fmt:formatDate value="${workContractInfo.effectiveDate}" pattern="yyyy-MM-dd"/>" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})">
				</td>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>合同终止日期：</label></td>
				<td class="width-35">
					<input class="form-control layer-date laydate-icon required" id="closingDate" name="closingDate" value="<fmt:formatDate value="${workContractInfo.closingDate}" pattern="yyyy-MM-dd"/>" onclick="laydate({istime: false, format: 'YYYY-MM-DD'})">
				</td>
			</tr>
			<%--<tr>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>合同金额(元）：</label></td>
				<td class="width-35">
					<form:input path="contractPrice" htmlEscape="false"    class="form-control required number "/>
				</td>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>收费标准(元）：</label></td>
				<td class="width-35">
					<form:select path="contractFee" id="contractFee" class="form-control required">
						<form:option value="0" label="请选择"/>
						<form:options items="${fns:getDictList('contract_fee')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
			</tr>--%>
			<%--<tr>
				<td class="width-15 active"><label class="pull-right"><font color="red">*</font>负责公司/部门：</label></td>
				<td class="width-35">
					<sys:treeselect id="chargeCompany" name="chargeCompany" value="${workContractInfo.chargeCompany}" labelName="chargeCompanyName" labelValue="${workContractInfo.chargeCompanyName}"
									title="部门" url="/sys/office/treeData?type=2" cssClass="form-control required" allowClear="true" notAllowSelectParent="true"/>
				</td>

			</tr>--%>
			<tr>
				<td class="width-15 active"><label class="pull-right"> 对方合同编号：</label></td>
				<td class="width-35">
					<form:input path="anotherContractNum" htmlEscape="false" class="form-control "/>
				</td>
				<td class="width-15 active"><label class="pull-right"> 创建人：</label></td>
				<td class="width-35">
						${workContractInfo.createName}
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right"> 履行状态：</label></td>
				<td class="width-35">
					<form:select path="status" class="form-control ">
						<form:option value="1" label="已完成"/>
						<form:option value="0" label="履行中"/>
					</form:select>
				</td>
				<td class="width-15 active"><label class="pull-right"> 投资额(元)：</label></td>
				<td class="width-35">
					<form:input path="investmentAmount" htmlEscape="false" onchange="this.value=toThousands(this.value)" class="form-control number"/>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right"> 建设项目类别：</label></td>
				<td class="width-35">
					<form:select path="constructionProjectType" class="form-control">
						<form:option value="" label=""/>
						<form:options items="${fns:getDictList('construction_project_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
					</form:select>
				</td>
				<td class="width-15 active"><label class="pull-right"> 付款摘要：</label></td>
				<td class="width-35">
					<form:input path="summaryPayment" htmlEscape="false" class="form-control"/>
				</td>
			</tr>

			<tr>
				<td class="width-15 active"><label class="pull-right"> 投资规模：</label></td>
				<td class="width-35" colspan="3">
					<form:textarea path="investmentScale" id="investmentScale" htmlEscape="false" rows="4"    class="form-control"/>
				</td>
			</tr>
			<%--<tr>
				<td class="width-15 active"><label class="pull-right">收费标准说明：</label></td>
				<td class="width-35" colspan="3">
					<form:textarea path="contractFeeDoc" id="contractFeeDoc" htmlEscape="false" rows="4"    class="form-control"/>
				</td>
			</tr>--%>
			<tr>
				<td class="width-15 active"><label class="pull-right">合同特别条款：</label></td>
				<td class="width-35" colspan="3">
					<form:textarea path="contractSpecial" htmlEscape="false" rows="4"    class="form-control "/>
				</td>
			</tr>
		<%--	<tr>
				<td class="width-15 active"><label class="pull-right">合同类型说明：</label></td>
				<td class="width-35" colspan="3">
					<form:textarea path="contractTypeDoc" id="contractTypeDoc" htmlEscape="false" rows="4"    class="form-control "/>
				</td>
			</tr>--%>
			<%--<form:input path="contractState" style="display: none" htmlEscape="false"  readonly="true" value="2" class="form-control "/>--%>
			</tbody>
		</table>
		<div class="tabs-container">
			<ul class="nav nav-tabs">
				<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" style="margin-top: 25px">附件信息</a>
				</li>
			</ul>
		</div>
		<div style="display: inline-block">
			<div id="addFile_attachment" style="display: none">
					<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);"/>
			<a id="attachment_btn" class="btn btn-info btn-xs" ><i class="fa fa-plus"></i> 添加附件</a>
			<span id="attachment_title"></span>
		</div>
		<table id="listAttachment"  style="text-align: center;width: 100%;margin-top:10px;"  class="table table-striped table-bordered table-condensed" >
			<thead>
			<tr>
				<%--<td>序号</td>--%><td>文件名</td><td>上传人</td><td>上传时间</td><td>操作</td>
			</tr>
			</thead>
			<tbody id="file_attachment">
			<c:forEach items="${workContractInfo.workAttachments}" var="workClientAttachment" varStatus="status">
				<tr>
					<%--<td>${status.index + 1}</td>--%>
						<%--<td>${attachment.attachmentName}</td>--%>
					<c:choose>
						<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
							<td><img src="${workClientAttachment.url}" width="50" height="50" alt="${workClientAttachment.attachmentName}"/></td>
						</c:when>
						<c:otherwise>
							<c:choose>
								<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
									<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','80%','80%','1')">${workClientAttachment.attachmentName}</a></td>
								</c:when>
								<c:otherwise>
									<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','80%','80%')">${workClientAttachment.attachmentName}</a></td>
								</c:otherwise>
							</c:choose>
						</c:otherwise>
					</c:choose>
					<td>${workContractInfo.createName}</td>
					<td><fmt:formatDate value="${workContractInfo.createDate}" pattern="yyyy-MM-dd"/></td>
					<td>
						<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="btn btn-success btn-xs">下载</a>

						<%--<a href="javascript:location.href='${ctx}/workcontractinfo/workContractInfo/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="btn btn-success btn-xs">下载</a>
						--%>	<%--<a href="${ctx}/workcontractinfo/workContractInfo/deleteFile?id=${workClientAttachment.id}&file=${workClientAttachment.url}" class="btn btn-success btn-xs">删除</a>--%>
						<%--<a href="${ctx}/workcontractinfo/workContractInfo/deleteFile?id=${workContractInfo.id}&file=${workClientAttachment.url}" onclick="return confirmx('确认要删除该合同管理吗？', this.href)"   class="btn btn-danger btn-xs"><i class="fa fa-trash"></i> 删除</a>
						--%>
						<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
							<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile_attachment')" class="btn btn-danger btn-xs" >删除</a>
						</c:if>
					</td>
				</tr>
			</c:forEach>
			</tbody>
		</table>

		<div class="tabs-container">
			<ul class="nav nav-tabs">
				<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" style="margin-top: 25px">合同评审信息</a>
				</li>
			</ul>
		</div>
		<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
			<tbody>
			<tr>
				<td class="width-15 active"><label class="pull-right">时间要求：</label></td>
				<td class="width-35">
						${workContractInfo.workContractReview.timeRequirements}
				</td>
				<td class="width-15 active"><label class="pull-right">特殊要求：</label></td>
				<td class="width-35">
						${workContractInfo.workContractReview.specialRequirements}
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">客户要求是否合法：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.isLegitimate eq 1}">
							是
						</c:when>
						<c:otherwise>
							否
						</c:otherwise>
					</c:choose>
				</td>
				<td class="width-15 active"><label class="pull-right">客户诚信度的初步判断：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.credibility eq 1}">
							低
						</c:when>
						<c:otherwise>
							高
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">风险初步评价：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.preliminaryRiskAssessmen eq 1}">
							低
						</c:when>
						<c:when test="${workContractInfo.workContractReview.preliminaryRiskAssessmen eq 2}">
							高
						</c:when>
						<c:otherwise>
							中
						</c:otherwise>
					</c:choose>
				</td>
				<td class="width-15 active"><label class="pull-right">被服务对象所处行业环境：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.serviceObjectIndustry eq 1}">
							正常
						</c:when>
						<c:otherwise>
							不正常
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">与服务有关的客户资料能否恰当获取：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.isProperAcquisition eq 1}">
							是
						</c:when>
						<c:otherwise>
							否
						</c:otherwise>
					</c:choose>
				</td>
				<td class="width-15 active"><label class="pull-right">人员是否能专业胜任：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.isUserQualified eq 1}">
							是
						</c:when>
						<c:otherwise>
							否
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">是否需要借助外部专家力量：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.isLegitimate eq 1}">
							需要
						</c:when>
						<c:otherwise>
							不需要
						</c:otherwise>
					</c:choose>
				</td>
				<td class="width-15 active"><label class="pull-right">设备能否满足项目要求：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.isEquipmentMeetRequirements eq 1}">
							是
						</c:when>
						<c:otherwise>
							否
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">时间能否满足客户需求：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.isTimeMeetRequirements eq 1}">
							是
						</c:when>
						<c:otherwise>
							否
						</c:otherwise>
					</c:choose>
				</td>
				<td class="width-15 active"><label class="pull-right">合同是否可以签定：</label></td>
				<td class="width-35">
					<c:choose>
						<c:when test="${workContractInfo.workContractReview.isContractSignature eq 1}">
							是
						</c:when>
						<c:otherwise>
							否
						</c:otherwise>
					</c:choose>
				</td>
			</tr>
			<tr>
				<td class="width-15 active"><label class="pull-right">备注信息：</label></td>
				<td class="width-35" colspan="3">
						${workContractInfo.workContractReview.remarks}
				</td>
			</tr>
			</tbody>
		</table>
		<div class="tabs-container">
			<ul class="nav nav-tabs">
				<li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" style="margin-top: 25px">合同评审附件信息</a>
				</li>
			</ul>
			<div class="tab-content">
				<div id="tab-2" class="tab-pane active">
					<table id="contentTable2" class="table table-striped table-bordered table-condensed">
						</tbody>
						<tr>
							<th class="hide"></th>
							<th width="30%">文件名称</th>
							<th width="30%">上传人</th>
							<th width="30%">上传时间</th>
							<th>操作</th>
						</tr>
						<c:choose>
							<c:when test="${not empty workContractInfo.workContractReview.workAttachments}">
								<c:forEach items="${workContractInfo.workContractReview.workAttachments}" var="workClientAttachment">
									<tr>
										<td class="hide"></td>
										<c:choose>
											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
															   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
												<td><img src="${workClientAttachment.url}" width="50" height="50" alt="${workClientAttachment.attachmentName}"/></td>
											</c:when>
											<c:otherwise>
												<c:choose>
													<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
														<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','80%','80%','1')">${workClientAttachment.attachmentName}</a></td>
													</c:when>
													<c:otherwise>
														<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','80%','80%')">${workClientAttachment.attachmentName}</a></td>
													</c:otherwise>
												</c:choose>
											</c:otherwise>
										</c:choose>
										<td>${workContractInfo.createName}</td>
										<td><fmt:formatDate value="${workContractInfo.createDate}" pattern="yyyy年MM月dd日" type="date" dateStyle="full"/></td>
										<td>
											<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="btn btn-success btn-xs">下载</a>

											<%--<a href="javascript:location.href='${ctx}/workcontractinfo/workContractInfo/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="btn btn-success btn-xs">下载</a>
											--%><c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
												<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile_attachment')" class="btn btn-danger btn-xs" >删除</a>
											</c:if>
										</td>
									</tr>
								</c:forEach>
							</c:when>
							<c:otherwise>
								<tr>
									<td colspan="5" align="center">暂无数据</td>
								</tr>
							</c:otherwise>
						</c:choose>

						</tbody>
						<tbody id="workContractAnnexList">
						</tbody>
					</table>
				</div>
			</div>
		</div>
		</form:form>

	<script type="text/javascript">
        $(function () {
            $("img").not(".upload_ico").each(function () {
                var num = 1 ;
                $(this).click(function () {
                    var flag = num%2;
                    if(flag == 1){
                        $(this).css("width","300px");
                        $(this).css("height","300px");
                        num++;
                    }else if(flag ==0){
                        $(this).css("width","50px");
                        $(this).css("height","50px");
                        num++;
                    }
                })
            });
        })
        //上传
        function upload_image_button(index){
            $("#upload_file_"+index).click();
        }
        function upload_show_image(index){
            var image =$("#upload_file_"+index)[0].files[0];
            var url = window.URL.createObjectURL(image);
            if(image.name.indexOf("jpg") != -1
                || image.name.indexOf("png") != -1
                || image.name.indexOf("jpeg") != -1
                || image.name.indexOf("gif") != -1
                || image.name.indexOf("PNG") != -1){
                url = window.URL.createObjectURL(image);
            }else if(image.name.indexOf("pdf") != -1 || image.name.indexOf("PDF") != -1){
                url = "${ctxStatic}/common/img/pdf5.png";
            }else if(image.name.indexOf("doc") != -1 || image.name.indexOf("DOC") != -1
                || image.name.indexOf("docx") != -1 || image.name.indexOf("DOCX") != -1){
                url = "${ctxStatic}/common/img/word.png";
            }else if(image.name.indexOf("xlsx") != -1 || image.name.indexOf("XLSX") != -1
                || image.name.indexOf("xls") != -1 || image.name.indexOf("XLSX") != -1){
                url = "${ctxStatic}/common/img/excel.png";
            }else{
                url = "${ctxStatic}/common/img/file.jpg";
            }
            $("#upload_image_"+index).attr("src",url);
            var length = $("#upload_image_div :file").length;
            if( index == length &&  length < 5 ){
                upload_image_append(index);
                add_x(index);
            }else if(index == length && length ==5){
                var span = '<span id="upload_close_'+index+'" class="close_ico" style="cursor:pointer; position: absolute;top:-1px;right: -2px; display:inline-block;z-index:1;" onclick="close_img('+index+');"><i class="fa fa-close"></i></span>';
                $("#upload_image_5").before(span);
            }
        }
        function upload_image_append(index){
            var div1 = "<div id='upload_div_"+(index+1)+"' style='float:left;position:relative;width: 64px;height: 57px;margin-left:5px;'>";
            var img = '<img id="upload_image_'+(index+1)+'" class="upload_ico" width="50px" height="50px"  onclick="upload_image_button('+(index+1)+')" src = "${pageContext.request.contextPath}/static/uploadify/upload_ico.png" style="cursor:pointer;width:50px;height:50px;"/>';
            var input = '<input id="upload_file_'+(index+1)+'" type="file" style="display:none;" name="upload_files" onChange="upload_show_image('+(index+1)+')" /><br>';
            var div2 = "</div>";
            $("#upload_image_div").append(div1+img+input+div2);
        }
        function close_img(index) {
            $("#upload_div_"+index).remove();
            var length = $("#upload_image_div :file").length;
            if(length == 0){
                add_div();
            }else if(length == 1){
                var x = $("#upload_image_div").find("span").text();
                if("x" != x){
                    add_div();
                }
            }
        }
        function add_x(index) {
            var span = '<span id="upload_close_'+index+'" class="close_ico" style="cursor:pointer; position: absolute;top:-1px;right: -2px; display:inline-block;z-index:1;" onclick="close_img('+index+');"><i class="fa fa-close"></i></span>';
            $("img:eq(-2)").before(span);
        }
        function add_div() {
            var upload_div_1 =
                '<div id="upload_div_1" style="float: left;position:relative;width: 64px;height: 57px;margin-left:5px;" >'+
                '<img  id="upload_image_1" class="upload_ico" style="cursor:pointer;width:50px;height:50px;"  src="${pageContext.request.contextPath}/static/uploadify/upload_ico.png"  onclick="upload_image_button(1)"/>'+
                '<input id="upload_file_1" type="file" style="display:none"  name="upload_files"  onchange="upload_show_image(1)" /><br>'+
                '</div>';
            $("#upload_image_div").html("").append(upload_div_1);
        }
	</script>
</body>
</html>