<!-- 设置计算式 -->
<div id="set-count" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog" id="setRuleForm">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">设置规则</h5>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            </div>
            <div class="modal-body">
                <h5>当前规则：</h5>
                <h5 id="rule">
                    <span class="badge badge-light" title="合价">合价 </span>
                    <span class="badge badge-light" title="/">/ </span>
                    <span class="badge badge-light" title="路线总长度">路线总长度 </span>
                    <a href="javascript:void(0);" class="text-danger" title="移除" id="delParam"><i class="fa fa-remove"></i></a>
                </h5>
                <div class="form-group">
                    <select id="paramType" class="form-control">
                        <option>全局参数</option>
                        <option>本项目节参数</option>
                        <option>计算式</option>
                    </select>
                </div>
                <!--全局参数-->
                <div class="form-group" id="globalParams" name="param">
                    <select class="form-control">
                        <% for (const p of globalParams) { %>
                        <option value="<%= p.code %>"><%= p.name %></option>
                        <% } %>
                    </select>
                </div>
                <!--本项目节参数-->
                <div class="form-group" id="nodeParams" name="param" style="display: none;">
                    <select class="form-control">
                        <% for (const p of nodeParams) { %>
                        <option value="<%= p.code %>"><%= p.name %></option>
                        <% } %>
                    </select>
                </div>
                <!--计算式-->
                <div class="form-group" id="calcParams" name="param" style="display: none;">
                    <select class="form-control">
                        <option value="+">+</option>
                        <option value="-">-</option>
                        <option value="*">*</option>
                        <option value="/">/</option>
                        <option value="(">(</option>
                        <option value=")">)</option>
                    </select>
                </div>
                <button id="addParam" class="btn btn-outline-primary">添加</button>
                <div id="paramAlert" class="alert alert-danger mt-3" role="alert" style="display: none;">
                    2个参数之间需要一个计算式
                </div>
            </div>
            <div class="modal-footer">
                <button id="ruleOk" class="btn btn-primary">确定</button>
                <button class="btn btn-secondary" data-dismiss="modal" aria-hidden="true">取消</button>
            </div>
        </div>
    </div>
</div>
<!-- 导入项目节 -->
<div id="upload" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
    <form class="modal-dialog" action="/template/uploadExcel?_csrf=<%= ctx.csrf %>" method="post" enctype="multipart/form-data">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">导入项目节</h5>
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label for="exampleFormControlFile1">上传项目节文件</label>
                    <div class="form-control">
                        <input class="form-control-file" name="file" type="file">
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary">确认导入</button>
                <button class="btn btn-secondary" data-dismiss="modal" aria-hidden="true">关闭</button>
            </div>
        </div>
    </form>
</div>
<script>
    const globalParams = <%- JSON.stringify(globalParams) %>;
    const nodeParams = <%- JSON.stringify(nodeParams) %>;
    const calcParams = [
        { code: '+', name: '+'},
        { code: '-', name: '-'},
        { code: '*', name: '*'},
        { code: '/', name: '/'},
        { code: '(', name: '('},
        { code: ')', name: ')'}
    ];
</script>
<script src="/public/js/template.js"></script>