<div class="panel-content">
    <div class="panel-title fluid">
        <div class="title-main d-flex justify-content-between">
            <div>
                <div class="btn-group" role="group" aria-label="Basic example">
                    <button type="button" class="btn btn-secondary btn-sm">全部</button>
                    <button type="button" class="btn btn-outline-secondary btn-sm">待上报</button>
                    <button type="button" class="btn btn-outline-secondary btn-sm">审批中</button>
                    <button type="button" class="btn btn-outline-secondary btn-sm">待审批</button>
                    <button type="button" class="btn btn-outline-secondary btn-sm">审批完成</button>
                </div>
                <div class="btn-group dropdown">
                    <button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-filter"></i> 筛选</button>
                    <div class="dropdown-menu">
                        <form class="px-3">
                            <div class="form-group">
                                <select class="form-control form-control-sm">
                                    <option>计量年份</option>
                                    <option>2018</option>
                                    <option>2017</option>
                                    <option>2016</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <select class="form-control form-control-sm">
                                    <option>计量月份</option>
                                    <option>1月</option>
                                    <option>2月</option>
                                    <option>3月</option>
                                    <option>4月</option>
                                    <option>5月</option>
                                    <option>6月</option>
                                    <option>7月</option>
                                    <option>8月</option>
                                    <option>9月</option>
                                    <option>10月</option>
                                    <option>11月</option>
                                    <option>12月</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <select class="form-control form-control-sm">
                                    <option>计量期</option>
                                    <option>14期</option>
                                    <option>13期</option>
                                    <option>12期</option>
                                    <option>11期</option>
                                    <option>10期</option>
                                    <option>9期</option>
                                    <option>8期</option>
                                    <option>7期</option>
                                    <option>6期</option>
                                    <option>5期</option>
                                    <option>4期</option>
                                    <option>3期</option>
                                    <option>2期</option>
                                    <option>1期</option>
                                </select>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div>
                <div class="btn-group">
                    <a href="#add-mj" data-toggle="modal" data-target="#add-mj" class="btn btn-primary btn-sm">添加中间计量</a>
                </div>
                <div class="btn-group">
                    <a href="#setting" data-toggle="modal" data-target="#setting" class="btn btn-outline-primary btn-sm"><i class="fa fa-cog"></i></a>
                </div>
            </div>
        </div>
    </div>
    <div class="content-wrap">
        <div class="c-header p-0 col-12">
        </div>
        <div class="c-body">
            <div class="tab-content">
                <table class="table table-bordered">
                    <thead>
                    <tr><th>计量编号</th><th>计量金额</th><th>计量月份</th><th>所属计量期</th><th>状态</th><th>当前处理人</th><th width="90"></th></tr>
                    </thead>
                    <tbody id="wlist">
                    <% for (const w of works) { %>
                    <tr mid="<%- w.mid %>" code="<%- w.code %>">
                        <td><a href="/measure/work/<%- w.mid %>"><%- w.code %></a></td>
                        <td class="text-right"><%- (w.deal_sum + w.qc_sum).toFixed(2) %></td>
                        <td><%- w.in_time_str %></td>
                        <td><%- w.sid %></td>
                        <td>
                            <% if (w.curAuditor && w.curAuditor.audit_id === ctx.session.sessionUser.accountId) { %>
                            <a href="/measure/audit/<%- w.mid %>" class="btn-primary btn-sm">审批</a>
                            <% } else { %>
                            <span class="<%- auditConst.statusClass[w.status] %>"><%- auditConst.statusString[w.status] %></span>
                            <% } %>
                        </td>
                        <td>
                            <% if (w.curAuditor) { %>
                            <%- w.curAuditor.role %>-<%- w.curAuditor.name %>
                            <% } else { %>
                            <%- w.user.role %>-<%- w.user.name %>
                            <% } %>
                        </td>
                        <td>
                            <% if (w.status === auditConst.status.uncheck) { %>
                            <a href="javascript: void(0);" data-toggle="modal" class="btn btn-outline-primary btn-sm" name="edit">编辑</a>
                            <% } %>
                        </td>
                    </tr>
                    <% } %>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script>
    const userId = <%- ctx.session.sessionUser.accountId %>;
    const auditConst = JSON.parse('<%- JSON.stringify(auditConst) %>');
</script>
<script src="/public/js/measure_wlist.js"></script>