<#assign base=request.contextPath />
<#import "../common/defaultLayout.ftl" as defaultLayout>
<@defaultLayout.layout>
<div class="admin-content">
    <div class="admin-content-body">
        <div class="am-cf am-padding">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">项目立项(概算)表</strong></div>
        </div>

        <form method="post" class="am-form" id="pmsForm" action="${base}/project/estimateAddSave" data-am-validator>
            <!--选项卡（tabs）begin-->
            <div class="am-tabs am-margin" data-am-tabs>
                <ul class="am-tabs-nav am-nav am-nav-tabs">
                    <li class="am-active"><a href="#tab1">项目基本信息</a></li>
                    <li><a href="#tab2">项目其他信息</a></li>
                </ul>
                <div class="am-tabs-bd">
                    <div class="am-tab-panel am-fade am-in am-active" id="tab1">
                    <#--<input name="permissionID" id="permissionID" type="hidden" value="${permissionID!}" />-->
                        <!--验证表单元素（validate) begin-->
                        <input name="id" id="id" type="hidden" value="${projectId}" />
                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>部门名称</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <span>${dept.name}</span>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目编号</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <span>保存后默认提供</span>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目名称</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" id="name" class="am-input" data-validate-async data-validation-message="请输入项目名称（1000字符以内）"
                                       name="name" placeholder="请输入项目名称（1000字符以内）" maxlength="1000"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目类型</div>
                            <div class="am-u-sm-6 am-u-md-6" style="font-size: small">
                                <select data-am-selected id="type" name="type" >
                                    <option value="1" >工程集成类</option>
                                    <option value="2" >设备集成类</option>
                                    <#--                                    <option value="3" >战略合作类</option>-->
                                </select>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目计划开始时间</div>
                            <div class="am-u-sm-2 am-u-md-2">
                                <div class="am-form-group am-form-icon">
                                    <i class="am-icon-calendar"></i>
                                    <input type="text" class="am-form-field am-input-sm" id="startDate"
                                           name="startDate" autocomplete="off"
                                           value="" placeholder="项目计划开始时间"
                                           data-am-datepicker required>
                                </div>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>
                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目计划结束时间</div>
                            <div class="am-u-sm-2 am-u-md-2">
                                <div class="am-form-group am-form-icon">
                                    <i class="am-icon-calendar"></i>
                                    <input type="text" class="am-form-field am-input-sm" id="endDate"
                                           name="endDate" autocomplete="off"
                                           value="" placeholder="项目计划结束时间"
                                           data-am-datepicker required>
                                </div>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资模式</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <select data-am-selected id="underwrittenMode" name="underwrittenMode">
                                    <option value="1" >A类-不垫资（战略合作）</option>
                                    <option value="2" >B类-不垫资（背靠背）</option>
                                    <option value="3" >C类-垫资（账期覆盖）</option>
                                    <option value="4" >D类-垫资（账期不覆盖）</option>
                                </select>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

<#--                        <div class="am-g am-form-group am-margin-top">-->
<#--                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>合作对象</div>-->
<#--                            <div class="am-u-sm-6 am-u-md-6">-->
<#--                                <input type="text" class="am-input" data-validate-async data-validation-message="请输入合作对象"-->
<#--                                       name="collaborator" id="collaborator" placeholder="请输入合作对象" maxlength="20"-->
<#--                                       value="" />-->
<#--                            </div>-->

<#--                            <div class="am-form-file am-text-xs">-->
<#--                                <button type="button" class="am-btn am-btn-primary am-btn-sm">-->
<#--                                    <i class="am-icon-cloud-upload"></i> 上传附件-->
<#--                                </button>-->
<#--                                <input id="fileupload_button_icon" type="file" name="files[]" multiple>-->
<#--                            </div>-->
<#--                            <!-- The global progress bar &ndash;&gt;-->
<#--                            <div id="progress-area-icon" class="am-margin-top-sm am-hide">-->
<#--                                <div id="progress-text-icon" class="am-text-xs am-text-right"></div>-->
<#--                                <div id="progress" class="am-progress am-progress-xs">-->
<#--                                    <div class="am-progress-bar" style="width: 0%"></div>-->
<#--                                </div>-->
<#--                            </div>-->
<#--                        </div>-->

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目把握度</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <select data-am-selected id="certainty" name="certainty">
                                    <option value="1" >A：基本确定中标，待签合同，合同签订中</option>
                                    <option value="2" >B：客户产品参数、商务评分、商务资质引导成功</option>
                                    <option value="3" >C：项目初期引导阶段</option>
                                </select>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>行业场景应用</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="am-input" data-validate-async data-validation-message="请输入行业场景应用"
                                       name="industryScenario" id="industryScenario" placeholder="请输入行业场景应用" maxlength="20"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>客户名称</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="am-input" data-validate-async data-validation-message="请输入客户名称（1000字符以内）"
                                       name="customer" id="customer" placeholder="请输入客户名称（1000字符以内）" maxlength="1000"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>终端客户名称</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="am-input" data-validate-async data-validation-message="请输入终端客户名称（1000字符以内）"
                                       name="terminalCustomer" id="terminalCustomer" placeholder="请输入终端客户名称（1000字符以内）" maxlength="1000"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>合同金额</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="number am-input" data-validate-async data-validation-message="请输入合同金额"
                                       name="contractAmount" id="contractAmount" placeholder="单位（元）" maxlength="16"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目毛利</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="number am-input" data-validate-async data-validation-message="请输入项目毛利"
                                       name="grossProfit" id="grossProfit" placeholder="单位（元）" maxlength="16"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目毛利率</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="number am-input" data-validate-async data-validation-message="请输入项目毛利率"
                                       name="grossProfitMargin" id="grossProfitMargin" placeholder="单位（%）" maxlength="16"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">华智产品金额</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="number am-input" data-validation-message="华智产品金额"
                                       name="huazhiProductAmount" id="huazhiProductAmount" placeholder="单位（元）" maxlength="16" value="" />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">汇智产品金额</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="number am-input" data-validation-message="汇智产品金额"
                                       name="huizhiProductAmount" id="huizhiProductAmount" placeholder="单位（元）" maxlength="16" value="" />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">华三产品金额</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="number am-input" data-validation-message="华三产品金额"
                                       name="huasanProductAmount" id="huasanProductAmount" placeholder="单位（元）" maxlength="16" value="" />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right">其他产品金额</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" class="number am-input" data-validation-message="请输入其他产品金额"
                                       name="ziguangOtherAmount" id="ziguangOtherAmount" placeholder="单位（元）" maxlength="16" value="" />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>价值及风险</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <textarea rows="5" cols="20" id="valueRisk" name="valueRisk" maxlength="1000"
                                          class="am-input" data-validate-async data-validation-message="请输入价值及风险"
                                          placeholder="请输入价值及风险" required
                                ></textarea>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>
                    </div>
                    <!--验证表单元素（validate end-->
                </div>

                <div class="am-tabs-bd">
                    <div class="am-tab-panel am-fade am-in" id="tab2">

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目负责人</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="text" id="principal" class="am-input" data-validate-async data-validation-message="请输入项目负责人"
                                       name="principal" placeholder="请输入项目负责人" maxlength="20"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>预计合同签订时间</div>
                            <div class="am-u-sm-2 am-u-md-2">
                                <div class="am-form-group am-form-icon">
                                    <i class="am-icon-calendar"></i>
                                    <input type="text" class="am-form-field am-input-sm" id="contractTime"
                                           name="contractTime" autocomplete="off"
                                           value="" placeholder="预计合同签订时间"
                                           data-am-datepicker required>
                                </div>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>
                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目计划招标时间</div>
                            <div class="am-u-sm-2 am-u-md-2">
                                <div class="am-form-group am-form-icon">
                                    <i class="am-icon-calendar"></i>
                                    <input type="text" class="am-form-field am-input-sm" id="bidsTime"
                                           name="bidsTime" autocomplete="off"
                                           value="" placeholder="项目计划招标时间"
                                           data-am-datepicker required>
                                </div>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>是否二次合作</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <select data-am-selected id="isSecond" name="isSecond">
                                    <option value="1" >是</option>
                                    <option value="2" >否</option>
                                </select>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>签单方式</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <select data-am-selected id="signType" name="signType">
                                    <option value="1" >紫光汇智直接投标</option>
                                </select>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>项目解决方案</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <select data-am-selected id="resolvePlan" name="resolvePlan">
                                    <option value="1" >公共服务(智慧交通、雪亮工程、治安防控体系等)</option>
                                    <option value="2" >泛行业(智慧园区、智慧医疗、智慧工地等)</option>
                                    <option value="3" >其他生态</option>
                                </select>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资利息</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="number" class="am-input" data-validate-async data-validation-message="请输入垫资利息"
                                       name="advanceInterestAmount" placeholder="单位（元）" maxlength="16"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>
                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>垫资峰值</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <input type="number" class="am-input" data-validate-async data-validation-message="请输入垫资峰值"
                                       name="advancePeakAmount" placeholder="单位（元）" maxlength="16"
                                       value="" required />
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>主合同收款条款</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <textarea rows="3" cols="20" id="mainContractCollectionTerms" name="mainContractCollectionTerms" maxlength="1000"
                                          class="am-input" data-validate-async data-validation-message="请输入收款条款"
                                          placeholder="请输入收款条款" required
                                ></textarea>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>主合同具体解决方案</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <textarea rows="3" cols="20" id="mainContractResolvePlan" name="mainContractResolvePlan" maxlength="1000"
                                          class="am-input" data-validate-async data-validation-message="请输入具体解决方案"
                                          placeholder="请输入具体解决方案" required
                                ></textarea>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>

                        <div class="am-g am-form-group am-margin-top">
                            <div class="am-u-sm-4 am-u-md-2 am-text-right"><span style="color: red;">*</span>计收计划</div>
                            <div class="am-u-sm-6 am-u-md-6">
                                <textarea rows="3" cols="20" id="CalculationCollection" name="CalculationCollection" maxlength="1000"
                                          class="am-input" data-validate-async data-validation-message="按照开票金额及时间罗列计收计划"
                                          placeholder="按照开票金额及时间罗列计收计划" required
                                ></textarea>
                            </div>
                            <div class="am-u-sm-2 am-u-md-4 input-msg"></div>
                        </div>
<#--                <div class="am-tabs-bd">-->
<#--                    <div class="am-tab-panel am-fade am-in" id="tab2">-->
<#--                        <span class="am-text-lg">收入</span>-->
<#--                        <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">-->
<#--                            <tbody>-->
<#--                                <tr class="am-text-lg">-->
<#--                                    <td>类别</td>-->
<#--                                    <td>费用</td>-->
<#--                                    <td>含税金额（元）</td>-->
<#--                                    <td>不含税金额（元）</td>-->
<#--                                    <td>税率</td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>收入</td>-->
<#--                                    <td>设备类</td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="incomeDeviceTaxInclude" id="incomeDeviceTaxInclude"></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="incomeDeviceTaxExclude" id="incomeDeviceTaxExclude" readonly></td>-->
<#--                                    <td>-->
<#--                                        <select data-am-selected name="incomeDeviceSelect" id="incomeDeviceSelect">-->
<#--                                        <option value="0">0%</option>-->
<#--                                        <option value="0.01">1%</option>-->
<#--                                        <option value="0.03">3%</option>-->
<#--                                        <option value="0.06">6%</option>-->
<#--                                        <option value="0.09">9%</option>-->
<#--                                        <option value="0.13">13%</option>-->
<#--                                        <option value="自定义">自定义</option>-->
<#--                                    </select>-->
<#--                                    </td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>收入</td>-->
<#--                                    <td>工程类</td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="incomeEngineerTaxInclude" id="incomeEngineerTaxInclude"></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="incomeEngineerTaxExclude" id="incomeEngineerTaxExclude" readonly></td>-->
<#--                                    <td>-->
<#--                                        <select data-am-selected name="incomeEngineerSelect" id="incomeEngineerSelect">-->
<#--                                            <option value="0">0%</option>-->
<#--                                            <option value="0.01">1%</option>-->
<#--                                            <option value="0.03">3%</option>-->
<#--                                            <option value="0.06">6%</option>-->
<#--                                            <option value="0.09">9%</option>-->
<#--                                            <option value="0.13">13%</option>-->
<#--                                            <option value="自定义">自定义</option>-->
<#--                                        </select>-->
<#--                                    </td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>收入</td>-->
<#--                                    <td>服务类</td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="incomeServiceTaxInclude" id="incomeServiceTaxInclude"></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="incomeServiceTaxExclude" id="incomeServiceTaxExclude" readonly></td>-->
<#--                                    <td>-->
<#--                                        <select data-am-selected name="incomeServiceSelect" id="incomeServiceSelect">-->
<#--                                            <option value="0">0%</option>-->
<#--                                            <option value="0.01">1%</option>-->
<#--                                            <option value="0.03">3%</option>-->
<#--                                            <option value="0.06">6%</option>-->
<#--                                            <option value="0.09">9%</option>-->
<#--                                            <option value="0.13">13%</option>-->
<#--                                            <option value="自定义">自定义</option>-->
<#--                                        </select>-->
<#--                                    </td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>合计</td>-->
<#--                                    <td></td>-->
<#--                                    <td><input type="text" class="number" name="incomeTotalTaxInclude" readonly title="此列累计"></td>-->
<#--                                    <td><input type="text" class="number" name="incomeTotalTaxExclude" readonly title="此列累计"></td>-->
<#--                                    <td>/</td>-->
<#--                                </tr>-->
<#--                            </tbody>-->
<#--                        </table>-->
<#--                        <span class="am-text-lg">成本</span>-->
<#--                        <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">-->
<#--                            <tbody>-->
<#--                                <tr class="am-text-lg">-->
<#--                                    <td>类别</td>-->
<#--                                    <td>费用</td>-->
<#--                                    <td>费用项目</td>-->
<#--                                    <td>含税金额（元）</td>-->
<#--                                    <td>不含税金额（元）</td>-->
<#--                                    <td>税率</td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>成本</td>-->
<#--                                    <td>采购成本</td>-->
<#--                                    <td>设备</td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costPurchaseDeviceTaxInclude" id="costPurchaseDeviceTaxInclude"></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costPurchaseDeviceTaxExclude" id="costPurchaseDeviceTaxExclude" readonly></td>-->
<#--                                    <td>-->
<#--                                        <select data-am-selected name="costPurchaseDeviceSelect" id="costPurchaseDeviceSelect">-->
<#--                                            <option value="0">0%</option>-->
<#--                                            <option value="0.01">1%</option>-->
<#--                                            <option value="0.03">3%</option>-->
<#--                                            <option value="0.06">6%</option>-->
<#--                                            <option value="0.09">9%</option>-->
<#--                                            <option value="0.13">13%</option>-->
<#--                                            <option value="自定义">自定义</option>-->
<#--                                        </select>-->
<#--                                    </td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>成本</td>-->
<#--                                    <td>采购成本</td>-->
<#--                                    <td>施工</td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costPurchaseBuildTaxInclude" id="costPurchaseBuildTaxInclude"></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costPurchaseBuildTaxExclude" id="costPurchaseBuildTaxExclude" readonly></td>-->
<#--                                    <td>-->
<#--                                        <select data-am-selected name="costPurchaseBuildSelect" id="costPurchaseBuildSelect">-->
<#--                                            <option value="0">0%</option>-->
<#--                                            <option value="0.01">1%</option>-->
<#--                                            <option value="0.03">3%</option>-->
<#--                                            <option value="0.06">6%</option>-->
<#--                                            <option value="0.09">9%</option>-->
<#--                                            <option value="0.13">13%</option>-->
<#--                                            <option value="自定义">自定义</option>-->
<#--                                        </select>-->
<#--                                    </td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>成本</td>-->
<#--                                    <td>采购成本</td>-->
<#--                                    <td>服务</td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costPurchaseServiceTaxInclude" id="costPurchaseServiceTaxInclude"></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costPurchaseServiceTaxExclude" id="costPurchaseServiceTaxExclude" readonly></td>-->
<#--                                    <td>-->
<#--                                        <select data-am-selected name="costPurchaseServiceSelect" id="costPurchaseServiceSelect">-->
<#--                                            <option value="0">0%</option>-->
<#--                                            <option value="0.01">1%</option>-->
<#--                                            <option value="0.03">3%</option>-->
<#--                                            <option value="0.06">6%</option>-->
<#--                                            <option value="0.09">9%</option>-->
<#--                                            <option value="0.13">13%</option>-->
<#--                                            <option value="自定义">自定义</option>-->
<#--                                        </select>-->
<#--                                    </td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>成本</td>-->
<#--                                    <td>采购成本</td>-->
<#--                                    <td>其他</td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costPurchaseOtherTaxInclude" id="costPurchaseOtherTaxInclude"></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costPurchaseOtherTaxExclude" id="costPurchaseOtherTaxExclude" readonly></td>-->
<#--                                    <td>-->
<#--                                        <select data-am-selected name="costPurchaseOtherSelect" id="costPurchaseOtherSelect">-->
<#--                                            <option value="0">0%</option>-->
<#--                                            <option value="0.01">1%</option>-->
<#--                                            <option value="0.03">3%</option>-->
<#--                                            <option value="0.06">6%</option>-->
<#--                                            <option value="0.09">9%</option>-->
<#--                                            <option value="0.13">13%</option>-->
<#--                                            <option value="自定义">自定义</option>-->
<#--                                        </select>-->
<#--                                    </td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>成本</td>-->
<#--                                    <td>项目管理成本</td>-->
<#--                                    <td>项目管理成本</td>-->
<#--                                    <td><input type="text" class="number" name="costProjectManageTaxInclude" id="costProjectManageTaxInclude" readonly></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costProjectManageTaxExclude" id="costProjectManageTaxExclude"></td>-->
<#--                                    <td>/</td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>成本</td>-->
<#--                                    <td>其他</td>-->
<#--                                    <td><input type="text" id="otherName" maxlength="50" data-validate-async data-validation-message="请输入其他类的名称（50字符以内）"-->
<#--                                               value="" name="otherName" placeholder="请输入其他类的名称（50字符以内）"/> </td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costOtherOtherTaxInclude" id="costOtherOtherTaxInclude"></td>-->
<#--                                    <td><input type="text" class="number" maxlength="16" name="costOtherOtherTaxExclude" id="costOtherOtherTaxExclude" readonly></td>-->
<#--                                    <td>-->
<#--                                        <select data-am-selected name="costOtherOtherSelect" id="costOtherOtherSelect">-->
<#--                                            <option value="0">0%</option>-->
<#--                                            <option value="0.01">1%</option>-->
<#--                                            <option value="0.03">3%</option>-->
<#--                                            <option value="0.06">6%</option>-->
<#--                                            <option value="0.09">9%</option>-->
<#--                                            <option value="0.13">13%</option>-->
<#--                                            <option value="自定义">自定义</option>-->
<#--                                        </select>-->
<#--                                    </td>-->
<#--                                </tr>-->
<#--                                <tr>-->
<#--                                    <td>合计</td>-->
<#--                                    <td></td>-->
<#--                                    <td></td>-->
<#--                                    <td><input type="text" class="number" name="costTotalTaxInclude" readonly title="此列累计"></td>-->
<#--                                    <td><input type="text" class="number" name="costTotalTaxExclude" readonly title="此列累计"></td>-->
<#--                                    <td>/</td>-->
<#--                                </tr>-->
<#--                            </tbody>-->
<#--                        </table>-->
<#--                        <span class="am-text-lg">管理</span>-->
<#--                        <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">-->
<#--                            <tbody>-->
<#--                            <tr class="am-text-lg">-->
<#--                                <td>类别</td>-->
<#--                                <td>费用项目</td>-->
<#--                                <td>不含税金额（元）</td>-->
<#--                            </tr>-->
<#--                            <tr>-->
<#--                                <td>财务费用</td>-->
<#--                                <td>资金占用成本</td>-->
<#--                                <td><input type="text" class="number" maxlength="16" name="costExpropriationTaxExclude" id="costExpropriationTaxExclude"></td>-->
<#--                            </tr>-->
<#--                            <tr>-->
<#--                                <td>公司管理费用</td>-->
<#--                                <td></td>-->
<#--                                <td><input type="text" class="number" maxlength="16" name="costCompanyManageTaxExclude" id="costCompanyManageTaxExclude"></td>-->
<#--                            </tr>-->
<#--                            </tbody>-->
<#--                        </table>-->

<#--                        <span class="am-text-lg">利润率计算</span>-->
<#--                        <table class="am-table am-table-bordered am-table-radius table-main" style="padding:0;">-->
<#--                            <tbody>-->
<#--                            <tr class="am-text-lg">-->
<#--                                <td>类别</td>-->
<#--                                <td></td>-->
<#--                            </tr>-->
<#--                            <tr>-->
<#--                                <td>项目毛利（元）</td>-->
<#--                                <td><input type="text" class="number" name="projectGrossProfit" readonly title="收入总计（不含税）-成本总计（不含税）-财务费用总计（不含税）"></td>-->
<#--                            </tr>-->
<#--                            <tr>-->
<#--                                <td>项目毛利率（%）</td>-->
<#--                                <td><input type="text" class="number" name="projectGrossProfitRate" readonly title="毛利（不含税）/收入总计（不含税）"></td>-->
<#--                            </tr>-->
<#--                            <tr>-->
<#--                                <td>项目贡献利润（元）</td>-->
<#--                                <td><input type="text" class="number" name="projectContributionProfit" readonly title="项目毛利（不含税）-公司管理费用总计（不含税）"></td>-->
<#--                            </tr>-->
<#--                            <tr>-->
<#--                                <td>项目贡献利润率（%）</td>-->
<#--                                <td><input type="text" class="number" name="projectContributionProfitRate" readonly title="贡献利润（不含税）/收入总计（不含税）"></td>-->
<#--                            </tr>-->
<#--                            </tbody>-->
<#--                        </table>-->
<#--                    </div>-->
<#--                    <!--验证表单元素（validate end&ndash;&gt;-->
<#--                </div>-->
                    </div>
                </div>
            </div>
            <!--选项卡（tabs）end-->
            <div class="am-margin">
                <button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="javascript:history.go(-1);">返回上一级</button>
                <button type="button" class="am-btn am-btn-primary am-btn-xs" id="saveDraft">保存草稿</button>
                <button type="button" class="am-btn am-btn-primary am-btn-xs" id="saveApprove">提交审核</button>
            </div>
        </form>

    </div>
</div>
<script src="${base}/assets/js/project_common.js"></script>
<script src="${base}/assets/js/project_estimate.js"></script>
<script>
    var result = 0;
    var projectNoResult = 0;
    var rateResult = 0;
    var check = 0;
    $(function () {
        calIncomeAndCost();
        $("#saveDraft").click(function () {
            check = 0;
            $("#saveDraft").attr('disabled',true);
            checkIfFillIn();
            if (check == 1) {
                $("#saveDraft").attr('disabled', false);
                return;
            }
            setTimeout(function () {
                $("#saveDraft").attr('disabled', false);
            }, 5000);
            $("#pmsForm").attr("action","${base}/project/estimateAddSave");
            $("#pmsForm").submit();

        });
        $("#saveApprove").click(function () {
            check = 0;
            $("#saveApprove").attr('disabled',true);
            checkIfFillIn();
            if (check == 1) {
                $("#saveApprove").attr('disabled', false);
                return;
            }
            setTimeout(function () {
                $("#saveApprove").attr('disabled', false);
            }, 5000);
            $("#pmsForm").attr("action","${base}/project/estimateAddSaveAndApprove");
            $("#pmsForm").submit();
        });
    });

    function checkIfFillIn() {
        var startTime = $("#startDate").val();
        var endTime = $("#endDate").val();
        var name = $("#name").val();
        var customer = $("#customer").val();
        var terminalCustomer = $("#terminalCustomer").val();
        var contractAmount = $("#contractAmount").val();
        var industryScenario = $("#industryScenario").val();
        var mainContractCollectionTerms = $("#mainContractCollectionTerms").val();
        var valueRisk = $("#valueRisk").val();

        var incomeDeviceTaxInclude = $("#incomeDeviceTaxInclude").val();
        var incomeDeviceTaxExclude = $("#incomeDeviceTaxExclude").val();
        var incomeEngineerTaxInclude = $("#incomeEngineerTaxInclude").val();
        var incomeEngineerTaxExclude = $("#incomeEngineerTaxExclude").val();
        var incomeServiceTaxInclude = $("#incomeServiceTaxInclude").val();
        var incomeServiceTaxExclude = $("#incomeServiceTaxExclude").val();
        var costPurchaseDeviceTaxInclude = $("#costPurchaseDeviceTaxInclude").val();
        var costPurchaseDeviceTaxExclude = $("#costPurchaseDeviceTaxExclude").val();
        var costPurchaseBuildTaxInclude = $("#costPurchaseBuildTaxInclude").val();
        var costPurchaseBuildTaxExclude = $("#costPurchaseBuildTaxExclude").val();
        var costPurchaseServiceTaxInclude = $("#costPurchaseServiceTaxInclude").val();
        var costPurchaseServiceTaxExclude = $("#costPurchaseServiceTaxExclude").val();
        var costPurchaseOtherTaxInclude = $("#costPurchaseOtherTaxInclude").val();
        var costPurchaseOtherTaxExclude = $("#costPurchaseOtherTaxExclude").val();
        var costCompanyManageTaxExclude  = $("#costCompanyManageTaxExclude ").val();
        var costProjectManageTaxExclude  = $("#costProjectManageTaxExclude ").val();
        var costOtherOtherTaxInclude  = $("#costOtherOtherTaxInclude").val();
        var costOtherOtherTaxExclude  = $("#costOtherOtherTaxExclude").val();

        if (startTime.length <= 0) {
            window.confirm('项目计划开始时间不能为空');
            check = 1;
            return;
        }

        if (endTime.length <= 0) {
            window.confirm('项目计划结束时间不能为空');
            check = 1;
            return;
        }

        if (startTime > endTime) {
            window.confirm('开始日期应早于结束日期');
            check = 1;
            return;
        }

        if (projectNo.length <= 0) {
            window.confirm('项目编号不能为空');
            check = 1;
            return;
        }

        checkProjectNo();
        if (projectNoResult == 1) {
            window.confirm('项目编号已存在');
            check = 1;
            return;
        }

        if (name.length <= 0) {
            window.confirm('项目名称不能为空');
            check = 1;
            return;
        }

        checkName();
        if (result == 1) {
            window.confirm('项目名称已存在');
            check = 1;
            return;
        }

        if (customer == undefined || customer.length <= 0 ) {
            window.confirm('客户名称不能为空');
            check = 1;
            return;
        }

        if (terminalCustomer == undefined || terminalCustomer.length <= 0) {
            window.confirm('终端客户名称不能为空');
            check = 1;
            return;
        }

        if (contractAmount == undefined || contractAmount.length <= 0) {
            window.confirm('合同金额不能为空');
            check = 1;
            return;
        }

        if (industryScenario == undefined || industryScenario.length <= 0) {
            window.confirm('行业应用场景不能为空');
            check = 1;
            return;
        }

        if (mainContractCollectionTerms == undefined || mainContractCollectionTerms.length <= 0) {
            window.confirm('主合同收款条款不能为空');
            check = 1;
            return;
        }

        if (valueRisk == undefined || valueRisk.length <= 0) {
            window.confirm('价值及风险不能为空');
            check = 1;
            return;
        }

        /*if (incomeDeviceTaxInclude == '' || incomeDeviceTaxExclude == '' || incomeEngineerTaxInclude == '' || incomeEngineerTaxExclude == '' ||
            incomeServiceTaxInclude == '' || incomeServiceTaxExclude == '' || costPurchaseDeviceTaxInclude == '' || costPurchaseDeviceTaxExclude == '' ||
            costPurchaseBuildTaxInclude == '' || costPurchaseBuildTaxExclude == '' || costPurchaseServiceTaxInclude == '' || costPurchaseServiceTaxExclude == '' ||
            costPurchaseOtherTaxInclude == '' || costPurchaseOtherTaxExclude == '' || costProjectManageTaxExclude == '' || costExpropriationTaxExclude == '' ||
            costCompanyManageTaxExclude == '') {
            window.confirm('请完善项目详细信息');
            check = 1;
            return;
        }

        if (changeToNumber(incomeDeviceTaxInclude) < changeToNumber(incomeDeviceTaxExclude)) {
            window.confirm('设备类收入含税金额应大于不含税金额');
            check = 1;
            return;
        }

        if (changeToNumber(incomeEngineerTaxInclude) < changeToNumber(incomeEngineerTaxExclude)) {
            window.confirm('工程类收入含税金额应大于不含税金额');
            check = 1;
            return;
        }

        if (changeToNumber(incomeServiceTaxInclude) < changeToNumber(incomeServiceTaxExclude)) {
            window.confirm('服务类收入含税金额应大于不含税金额');
            check = 1;
            return;
        }

        if (changeToNumber(costPurchaseDeviceTaxInclude) < changeToNumber(costPurchaseDeviceTaxExclude)) {
            window.confirm('设备类采购成本含税金额应大于不含税金额');
            check = 1;
            return;
        }

        if (changeToNumber(costPurchaseBuildTaxInclude) < changeToNumber(costPurchaseBuildTaxExclude)) {
            window.confirm('施工类采购成本含税金额应大于不含税金额');
            check = 1;
            return;
        }

        if (changeToNumber(costPurchaseServiceTaxInclude) < changeToNumber(costPurchaseServiceTaxExclude)) {
            window.confirm('服务类采购成本含税金额应大于不含税金额');
            check = 1;
            return;
        }

        if (changeToNumber(costPurchaseOtherTaxInclude) < changeToNumber(costPurchaseOtherTaxExclude)) {
            window.confirm('其他类采购成本含税金额应大于不含税金额');
            check = 1;
            return;
        }

        if (changeToNumber(costOtherOtherTaxInclude) < changeToNumber(costOtherOtherTaxExclude)) {
            window.confirm('其他成本含税金额应大于不含税金额');
            check = 1;
            return;
        }*/

        checkRate();
        if (rateResult == 1) {
            window.confirm('项目年利率未填写或小于等于0，请联系管理员配置');
            check = 1;
            return;
        }
    }

    function checkName () {
        var name = $("#name").val();
        var id = $("#id").val();
        $.ajax({
            url: "${base}/project/checkName",
            data: {name: name, id: id},
            type: "post",
            dataType: "json",
            async: false,
            success: function (data) {
                result = data.status;
            }
        });
    };

    function checkProjectNo () {
        var projectNo = $("#projectNo").val();
        var id = $("#id").val();
        $.ajax({
            url: "${base}/project/checkProjectNo",
            data: {projectNo: projectNo, id: id},
            type: "post",
            dataType: "json",
            async: false,
            success: function (data) {
                projectNoResult = data.status;
            }
        });
    };

    function checkRate () {
        $.ajax({
            url: "${base}/sys/config/checkRate",
            type: "get",
            dataType: "json",
            async: false,
            success: function (data) {
                rateResult = data.status;
            }
        });
    };

    function changeToNumber(value) {
        value = value.replace(/[^\-\d.]/g, ""); //清除“-”、“数字”和“.”以外的字符
        value = value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
        return Number(value);
    }
</script>
</@defaultLayout.layout>















