<%@ 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">
        var validateForm;
        function doSubmit(obj){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            if(validateForm.form()){
                console.log(obj);
                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);
                    }
                }
            });
        });
	</script>
</head>
<body>
<div class="wrapper wrapper-content">
	<div class="single-form">
		<div class="container">
			<form:form id="inputForm" modelAttribute="workContractInfo" action="${ctx}/workcontractinfo/workContractInfo/invalidateContractSaveAudit" method="post" class="form-horizontal">
				<form:hidden path="id"/>
				<form:hidden path="home"/>
				<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"/>
				<c:set var="status" value="${workContractInfo.act.status}" />

				<div class="tabs-container">
					<div class="tab-content">
						<div id="tab-11" class="tab-pane active">
							<div class="form-group layui-row first lw9">
								<div class="form-group-label"><h2>项目合同信息</h2></div>
								<c:if test="${workContractInfo.ext == 0}">
									<div class="layui-item layui-col-sm6">
										<label class="layui-form-label">合同来源：</label>
										<div class="layui-input-block">
											<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="投标项目"/>
										</div>
									</div>
									<div class="layui-item layui-col-sm6">
										<label class="layui-form-label lw9">合同编号：</label>
										<div class="layui-input-block">
											<div class="input-group">
												<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.contractNum}"/>
												<span class="input-group-btn">
											<label class="form-status"><c:choose><c:when test="${ empty workContractInfo.contractState}">新添</c:when><c:otherwise>${fns:getDictLabel(workContractInfo.contractState, 'audit_completion_state','')}</c:otherwise>	</c:choose></label>
										</span>
											</div>
										</div>
									</div>
									<div class="layui-item layui-col-sm6">
										<label class="layui-form-label">投标项目：</label>
										<div class="layui-input-block">
											<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.project.projectName}"/>
										</div>
									</div>
								</c:if>
								<c:if test="${workContractInfo.ext != 0}">
									<div class="layui-item layui-col-sm6">
										<label class="layui-form-label">合同来源：</label>
										<div class="layui-input-block">
											<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="非投标项目"/>
										</div>
									</div>
									<div class="layui-item layui-col-sm6">
										<label class="layui-form-label lw9">合同编号：</label>
										<div class="layui-input-block">
											<div class="input-group">
												<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.contractNum}"/>
												<span class="input-group-btn">
											<label class="form-status"><c:choose><c:when test="${ empty workContractInfo.contractState}">新添</c:when><c:otherwise>${fns:getDictLabel(workContractInfo.contractState, 'audit_completion_state','')}</c:otherwise>	</c:choose></label>
										</span>
											</div>
										</div>
									</div>
								</c:if>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">总合同名称：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.totalContractName}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">合同名称：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.name}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line"><span class="require-item">*</span>合 同 金 额 (元)预计金额：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatNumber value="${workContractInfo.contractPrice}" pattern="#,#00.00"/>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">工程分类：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${fns:getMainDictLabel(workContractInfo.contractType, 'contract_type', '')}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">主委托方：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.client.name}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">签订日期：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatDate value="${workContractInfo.contractDate}" pattern="yyyy年MM月dd日"/>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">合同生效日期：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatDate value="${workContractInfo.effectiveDate}" pattern="yyyy年MM月dd日" type="date" dateStyle="full"/>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">合同终止日期：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatDate value="${workContractInfo.closingDate}" pattern="yyyy年MM月dd日" type="date" dateStyle="full"/>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">对方合同编号：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.anotherContractNum}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line lw9">工程投资额(万元)：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatNumber value="${workContractInfo.investmentAmount}" pattern="#,#00.00"/>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label lw9">归档状态：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${fns:getDictLabel(workContractInfo.recordState, 'record_state','')}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label ">合同类型：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${fns:getMainDictLabel(workContractInfo.contractTypeDoc, 'contract_info_type', '')}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label ">创建时间：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatDate value="${workContractInfo.createDate}" pattern="yyyy年MM月dd日" type="date" dateStyle="full"/>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm12 with-textarea">
									<label class="layui-form-label">付款摘要：</label>
									<div class="layui-input-block">
										<textarea htmlEscape="false" rows="4" readonly="true" maxlength="1000" class="form-control" >${workContractInfo.summaryPayment}</textarea>
									</div>
								</div>
								<div class="layui-item layui-col-sm12 with-textarea">
									<label class="layui-form-label">合同特别条款：</label>
									<div class="layui-input-block">
										<textarea htmlEscape="false" rows="4" readonly="true" maxlength="1000" class="form-control" >${workContractInfo.contractSpecial}</textarea>
									</div>
								</div>
								<%--<div class="layui-item layui-col-sm12 with-textarea">
									<label class="layui-form-label">合同类型说明：</label>
									<div class="layui-input-block">
										<textarea htmlEscape="false" rows="4" readonly="true" maxlength="1000" class="form-control" >${workContractInfo.contractTypeDoc}</textarea>
									</div>
								</div>--%>
								<div class="layui-item layui-col-sm12 with-textarea">
									<label class="layui-form-label">备注：</label>
									<div class="layui-input-block">
										<textarea htmlEscape="false" rows="4" readonly="true" maxlength="1000" class="form-control" >${workContractInfo.remarks}</textarea>
									</div>
								</div>
								<div class="layui-item layui-col-sm12 with-textarea">
									<label class="layui-form-label">作废原因：</label>
									<div class="layui-input-block">
										<textarea htmlEscape="false" rows="4" readonly="true" maxlength="1000" class="form-control" >${workContractInfo.alterInfo.reason}</textarea>
									</div>
								</div>
							</div>

							<div class="form-group layui-row">
								<div class="form-group-label"><h2>委托方列表</h2></div>
								<div class="layui-item layui-col-xs12 form-table-container" >
									<table id="contentTable4" class="table table-bordered table-condensed no-bottom-margin details">
										<thead>
										<tr>
											<th width="30%">委托方名称</th>
											<th width="20%">客户性质</th>
											<th width="20%">所属行业</th>
											<th width="30%">所属地区</th>
										</tr>
										</thead>
										<tbody id="workClientInfoList">
											<c:if test="${not empty workContractInfo.workClientInfoList}">
											<c:forEach items="${workContractInfo.workClientInfoList}" var="casePeopleNorm" varStatus="index">
												<tr id="workClientInfoList${index.index}">
													<td class="hide">
														<input id="workClientInfoList${index.index}_id" name="workClientInfoList[${index.index}].id" type="hidden" value="${casePeopleNorm.id}"/>
													</td>
													<td>
															<%--<input id="workClientInfoList${index.index}_name" name="workClientInfoList[${index.index}].name" type="text" value="${casePeopleNorm.name}" readonly="true"   class="form-control "/>--%>
															${casePeopleNorm.name}
													</td>
													<td>

															${fns:getMainDictLabel(casePeopleNorm.companyType, 'company_type', '')}
													</td>
													<td>
															<%--<form:select id="workClientInfoList${index.index}_companyIndustry" path="workClientInfoList[${index.index}].companyIndustry" disabled="true" readonly="true" class="form-control">
                                                                <form:option value="" label=""/>
                                                                <form:options items="${fns:getDictList('company_industry')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                                            </form:select>--%>
															${fns:getMainDictLabel(casePeopleNorm.companyIndustry, 'company_industry', '')}
													</td>
													<td>
															<%--<input id="workClientInfoList${index.index}_area" name="workClientInfoList[${index.index}].area.name" type="text" value="${casePeopleNorm.area.name}"  readonly="true"  class="form-control "/>--%>
															${casePeopleNorm.area.name}
													</td>
												</tr>
											</c:forEach>
											</c:if>
										</tbody>
									</table>
								</div>
							</div>
							<div class="form-group layui-row">
								<div class="form-group-label"><h2>合同附件表</h2></div>
								<div class="layui-item layui-col-xs12 form-table-container" >
									<table id="contentTable" class="table table-bordered table-condensed no-bottom-margin details">
										<thead>
										<tr>

											<th>文件</th>
											<th>上传人</th>
											<th>上传时间</th>
											<th width="180px">操作</th>
										</tr>
										</thead>
										<tbody>
											<c:choose>
											<c:when test="${not empty workContractInfo.workAttachments}">
											<c:forEach items="${workContractInfo.workAttachments}" var="workClientAttachment" varStatus="status">
												<tr>
														<%--<td>${status.index + 1}</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" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
														</c:when>
														<c:otherwise>
															<c:choose>
																<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
																	<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','95%','95%','1')">${workClientAttachment.attachmentName}</a></td>
																</c:when>
																<c:otherwise>
																	<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','95%','95%')">${workClientAttachment.attachmentName}</a></td>
																</c:otherwise>
															</c:choose>
														</c:otherwise>
													</c:choose>
													<td>${workClientAttachment.createBy.name}</td>
													<td><fmt:formatDate value="${workClientAttachment.createDate}" pattern="yyyy-MM-dd"/></td>
													<td  class="op-td">
														<a href="javascript:location.href='${ctx}/workcontractinfo/workContractInfo/downLoadAttach?file='+encodeURIComponent(encodeURIComponent('${workClientAttachment.url}'));" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>

													</td>
												</tr>
											</c:forEach>
											</c:when>
												<c:otherwise>
													<tr>
														<td colspan="4" align="center">暂无数据</td>
													</tr>
												</c:otherwise>
											</c:choose>
										</tbody>
									</table>
								</div>
							</div>
						</div>

						<div id="tab-22" class="tab-pane">

							<div class="form-group layui-row first lw14">
								<div class="form-group-label"><h2>评审基础信息</h2></div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label">时间要求：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.workContractReview.timeRequirements}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label">特殊要求：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workContractInfo.workContractReview.specialRequirements}"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label">客户要求是否合法：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.isLegitimate eq 1}">是</c:when><c:otherwise>否</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line">客户诚信度的初步判断：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.credibility eq 1}">低</c:when><c:when test="${workContractInfo.workContractReview.credibility eq 2}">中</c:when><c:otherwise>高</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label">风险初步评价：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<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>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line">被服务对象所处行业环境：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.serviceObjectIndustry eq 1}">正常</c:when><c:otherwise>不正常</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line">与服务有关的客户资料能否恰当获取：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.isProperAcquisition eq 1}">是</c:when><c:otherwise>否</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line">人员是否能专业胜任：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.isUserQualified eq 1}">是</c:when><c:otherwise>否</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line">是否需要借助外部专家力量：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.isLegitimate eq 1}">需要</c:when><c:otherwise>不需要</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line">设备能否满足项目要求：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.isEquipmentMeetRequirements eq 1}">需要</c:when><c:otherwise>不需要</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line">时间能否满足客户需求：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.isTimeMeetRequirements eq 1}">需要</c:when><c:otherwise>不需要</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm6">
									<label class="layui-form-label double-line">合同是否可以签定：</label>
									<div class="layui-input-block">
										<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:choose><c:when test="${workContractInfo.workContractReview.isContractSignature eq 1}">需要</c:when><c:otherwise>不需要</c:otherwise></c:choose>"/>
									</div>
								</div>
								<div class="layui-item layui-col-sm12">
									<label class="layui-form-label">备注信息：</label>
									<div class="layui-input-block">
										<textarea htmlEscape="false" rows="4" readonly="true" maxlength="1000" class="form-control" >${workContractInfo.workContractReview.remarks}</textarea>
									</div>
								</div>
							</div>
							<div class="form-group layui-row">
								<div class="form-group-label"><h2>合同评审附件信息</h2></div>
								<div class="layui-item layui-col-xs12 form-table-container" >
									<table id="contentTable2" class="table table-bordered table-condensed no-bottom-margin details">
										<thead>
										<tr>
											<th>文件</th>
											<th>上传人</th>
											<th>上传时间</th>
											<th width="180px">操作</th>
										</tr>
										</thead>
										<tbody>
										<c:choose>
											<c:when test="${not empty workContractInfo.workContractReview.workAttachments}">
												<c:forEach items="${workContractInfo.workContractReview.workAttachments}" var="workClientAttachment" varStatus="status">
													<tr>
															<%--<td>${status.index + 1}</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" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
															</c:when>
															<c:otherwise>
																<c:choose>
																	<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
																		<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','95%','95%','1')">${workClientAttachment.attachmentName}</a></td>
																	</c:when>
																	<c:otherwise>
																		<td><a href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','95%','95%')">${workClientAttachment.attachmentName}</a></td>
																	</c:otherwise>
																</c:choose>
															</c:otherwise>
														</c:choose>
														<td>${workClientAttachment.createBy.name}</td>
														<td><fmt:formatDate value="${workClientAttachment.createDate}" pattern="yyyy-MM-dd"/></td>
														<td  class="op-td">
															<a href="javascript:location.href='${ctx}/workcontractinfo/workContractInfo/downLoadAttach?file='+encodeURIComponent(encodeURIComponent('${workClientAttachment.url}'));" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
														</td>
													</tr>
												</c:forEach>
											</c:when>
											<c:otherwise>
												<tr>
													<td colspan="4" align="center">暂无数据</td>
												</tr>
											</c:otherwise>
										</c:choose>
										</tbody>
									</table>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="form-group layui-row">
					<div class="form-group-label"><h2>审批意见</h2></div>
					<div class="layui-item layui-col-xs12 with-textarea" >
						<label class="layui-form-label">审批意见：</label>
						<div class="layui-input-block">
							<form:textarea path="act.comment" class="form-control" rows="4" maxlength="127" />
							<input type="file" name="upload_files" style="display: none;">
						</div>
					</div>
				</div>
			</form:form>
			<div class="form-group layui-row">
				<div class="form-group-label"><h2>审批流程</h2></div>
				<div class="layui-item layui-col-xs12 form-table-container" >
					<act:flowChart procInsId="${workContractInfo.act.procInsId}"/>
					<act:histoicFlow procInsId="${workContractInfo.act.procInsId}"/>
				</div>
			</div>
		</div>
	</div>
</body>
</html>