|  | @@ -0,0 +1,408 @@
 | 
	
		
			
				|  |  | +<% if (auditPermission.folder) { %>
 | 
	
		
			
				|  |  | +<!-- 弹窗新建目录 -->
 | 
	
		
			
				|  |  | +<div class="modal fade" id="add-folder" data-backdrop="static">
 | 
	
		
			
				|  |  | +    <div class="modal-dialog" role="document">
 | 
	
		
			
				|  |  | +        <div class="modal-content">
 | 
	
		
			
				|  |  | +            <div class="modal-header">
 | 
	
		
			
				|  |  | +                <h5 class="modal-title">新建目录</h5>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-body">
 | 
	
		
			
				|  |  | +                <div class="form-group" id="parent_folder" style="display: none">
 | 
	
		
			
				|  |  | +                    <label for="parent_folder_name">父目录名称</label>
 | 
	
		
			
				|  |  | +                    <input type="text" class="form-control form-control-sm" id="parent_folder_name" readonly>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +                <div class="form-group">
 | 
	
		
			
				|  |  | +                    <label for="new_folder_name">目录名称</label>
 | 
	
		
			
				|  |  | +                    <input type="text" class="form-control form-control-sm" id="new_folder_name" placeholder="请输入目录名称" required>
 | 
	
		
			
				|  |  | +                    <div class="invalid-feedback">
 | 
	
		
			
				|  |  | +                        <!--名称超过100个字,请缩减名称-->
 | 
	
		
			
				|  |  | +                    </div>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-footer">
 | 
	
		
			
				|  |  | +                <input type="hidden" id="parent_id" value="0">
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-primary" id="new_folder_btn">确定添加</button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +</div>
 | 
	
		
			
				|  |  | +<% } %>
 | 
	
		
			
				|  |  | +<div class="modal fade" id="edit-name" data-backdrop="static">
 | 
	
		
			
				|  |  | +    <div class="modal-dialog" role="document">
 | 
	
		
			
				|  |  | +        <div class="modal-content">
 | 
	
		
			
				|  |  | +            <div class="modal-header">
 | 
	
		
			
				|  |  | +                <h5 class="modal-title">修改目录</h5>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-body">
 | 
	
		
			
				|  |  | +                <form>
 | 
	
		
			
				|  |  | +                    <div class="form-group">
 | 
	
		
			
				|  |  | +                        <label for="edit_name_input">名称</label>
 | 
	
		
			
				|  |  | +                        <input type="text" class="form-control form-control-sm" id="edit_name_input" placeholder="请输入名称" required>
 | 
	
		
			
				|  |  | +                        <div class="invalid-feedback">
 | 
	
		
			
				|  |  | +                            <!--名称超过100个字,请缩减名称-->
 | 
	
		
			
				|  |  | +                        </div>
 | 
	
		
			
				|  |  | +                    </div>
 | 
	
		
			
				|  |  | +                </form>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-footer">
 | 
	
		
			
				|  |  | +                <input type="hidden" id="edit_name_id" />
 | 
	
		
			
				|  |  | +                <input type="hidden" id="edit_name_type" />
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-primary" id="edit_name_btn">确定修改</button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +</div>
 | 
	
		
			
				|  |  | +<% if (auditPermission.tender) { %>
 | 
	
		
			
				|  |  | +<!-- 弹窗新建标段 -->
 | 
	
		
			
				|  |  | +<div class="modal fade" id="add-tender" data-backdrop="static">
 | 
	
		
			
				|  |  | +    <div class="modal-dialog" role="document">
 | 
	
		
			
				|  |  | +        <div class="modal-content">
 | 
	
		
			
				|  |  | +            <div class="modal-header">
 | 
	
		
			
				|  |  | +                <h5 class="modal-title">新建标段</h5>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-body">
 | 
	
		
			
				|  |  | +                <div class="form-group">
 | 
	
		
			
				|  |  | +                    <label for="add_tender_folder_name">目录名称</label>
 | 
	
		
			
				|  |  | +                    <input type="text" class="form-control form-control-sm" id="add_tender_folder_name" readonly>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +                <div class="form-group">
 | 
	
		
			
				|  |  | +                    <label for="add_tender_name">标段名称</label>
 | 
	
		
			
				|  |  | +                    <input type="text" class="form-control form-control-sm" id="add_tender_name" placeholder="请输入标段名称" required>
 | 
	
		
			
				|  |  | +                    <div class="invalid-feedback">
 | 
	
		
			
				|  |  | +                        <!--名称超过100个字,请缩减名称-->
 | 
	
		
			
				|  |  | +                    </div>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-footer">
 | 
	
		
			
				|  |  | +                <input type="hidden" id="add_tender_folder_id" />
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-primary" id="new_tender_btn">确定添加</button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +</div>
 | 
	
		
			
				|  |  | +<% } %>
 | 
	
		
			
				|  |  | +<!-- 弹窗删除项目 -->
 | 
	
		
			
				|  |  | +<div class="modal fade" id="del-project" data-backdrop="static">
 | 
	
		
			
				|  |  | +    <div class="modal-dialog" role="document">
 | 
	
		
			
				|  |  | +        <div class="modal-content">
 | 
	
		
			
				|  |  | +            <div class="modal-header">
 | 
	
		
			
				|  |  | +                <h5 class="modal-title">删除标段</h5>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-body">
 | 
	
		
			
				|  |  | +                <h6>确认删除 <span></span>?</h6>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-footer">
 | 
	
		
			
				|  |  | +                <input type="hidden" id="del_id" />
 | 
	
		
			
				|  |  | +                <input type="hidden" id="del_type" />
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-danger" id="del_btn">确定删除</button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +</div>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<% if (ctx.session.sessionUser.is_admin) { %>
 | 
	
		
			
				|  |  | +    <link href="/public/css/bootstrap/bootstrap-table.min.css" rel="stylesheet">
 | 
	
		
			
				|  |  | +    <link href="/public/css/bootstrap/bootstrap-table-fixed-columns.min.css" rel="stylesheet">
 | 
	
		
			
				|  |  | +        <style>
 | 
	
		
			
				|  |  | +            /*.bootstrap-table .fixed-table-container.fixed-height:not(.has-footer) {*/
 | 
	
		
			
				|  |  | +                /*border-bottom: 0;*/
 | 
	
		
			
				|  |  | +            /*}*/
 | 
	
		
			
				|  |  | +            /*table {*/
 | 
	
		
			
				|  |  | +                /*table-layout: fixed;*/
 | 
	
		
			
				|  |  | +            /*}*/
 | 
	
		
			
				|  |  | +        </style>
 | 
	
		
			
				|  |  | +<!-- 弹窗编辑项目 -->
 | 
	
		
			
				|  |  | +<div class="modal fade" id="authority-list" data-backdrop="static">
 | 
	
		
			
				|  |  | +    <div class="modal-dialog modal-lg" role="document">
 | 
	
		
			
				|  |  | +        <div class="modal-content">
 | 
	
		
			
				|  |  | +            <div class="modal-header">
 | 
	
		
			
				|  |  | +                <h5 class="modal-title">权限管理</h5>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-body">
 | 
	
		
			
				|  |  | +                <div class="d-flex flex-row bg-graye">
 | 
	
		
			
				|  |  | +                    <div class="p-2">
 | 
	
		
			
				|  |  | +                        <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" id="dropdownMenuButton"
 | 
	
		
			
				|  |  | +                                data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | 
	
		
			
				|  |  | +                            添加用户
 | 
	
		
			
				|  |  | +                        </button>
 | 
	
		
			
				|  |  | +                        <div class="dropdown-menu dropdown-menu-left" aria-labelledby="dropdownMenuButton" style="width:220px">
 | 
	
		
			
				|  |  | +                            <div class="mb-2 p-2"><input class="form-control form-control-sm" placeholder="姓名/手机 检索"
 | 
	
		
			
				|  |  | +                                                         id="gr-search" autocomplete="off"></div>
 | 
	
		
			
				|  |  | +                            <dl class="list-unstyled book-list">
 | 
	
		
			
				|  |  | +                                <% accountGroup.forEach((group, idx) => { %>
 | 
	
		
			
				|  |  | +                                    <dt><a href="javascript: void(0);" class="acc-btn" data-groupid="<%- idx %>"
 | 
	
		
			
				|  |  | +                                           data-type="hide"><i class="fa fa-plus-square"></i></a> <%- group.groupName %></dt>
 | 
	
		
			
				|  |  | +                                    <div class="dd-content" data-toggleid="<%- idx %>">
 | 
	
		
			
				|  |  | +                                        <dd class="border-bottom p-2 mb-0" data-groupid="<%- idx %>"><p class="mb-0 d-flex"><span class="text-primary">该单位下所有组员</span></p></dd>
 | 
	
		
			
				|  |  | +                                        <% group.groupList.forEach(item => { %>
 | 
	
		
			
				|  |  | +                                            <dd class="border-bottom p-2 mb-0 " data-id="<%- item.id %>">
 | 
	
		
			
				|  |  | +                                                <p class="mb-0 d-flex"><span class="text-primary"><%- item.name %></span><span
 | 
	
		
			
				|  |  | +                                                            class="ml-auto"><%- item.mobile %></span></p>
 | 
	
		
			
				|  |  | +                                                <span class="text-muted"><%- item.role %></span>
 | 
	
		
			
				|  |  | +                                            </dd>
 | 
	
		
			
				|  |  | +                                        <% });%>
 | 
	
		
			
				|  |  | +                                    </div>
 | 
	
		
			
				|  |  | +                                <% }) %>
 | 
	
		
			
				|  |  | +                            </dl>
 | 
	
		
			
				|  |  | +                        </div>
 | 
	
		
			
				|  |  | +                    </div>
 | 
	
		
			
				|  |  | +                    <div class="p-2"><a href="javascript:void(0)" id="del-permission-audits-btn">批量删除</a></div>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +                <div style="height:300px">
 | 
	
		
			
				|  |  | +                <table id="permission-audit-table" class="table table-bordered" data-height="300" data-toggle="table">
 | 
	
		
			
				|  |  | +                    <thead>
 | 
	
		
			
				|  |  | +                    <tr>
 | 
	
		
			
				|  |  | +                        <th class="text-center">选择</th>
 | 
	
		
			
				|  |  | +                        <th class="text-center">用户名</th>
 | 
	
		
			
				|  |  | +                        <th class="text-center">单位</th>
 | 
	
		
			
				|  |  | +                        <th class="text-center">添加时间</th>
 | 
	
		
			
				|  |  | +                        <th class="text-center"><input type="checkbox" class="permission-all-checkbox" data-type="tender"> 新建标段</th>
 | 
	
		
			
				|  |  | +                        <th class="text-center"><input type="checkbox" class="permission-all-checkbox" data-type="folder"> 新建目录</th>
 | 
	
		
			
				|  |  | +                        <th class="text-center"><input type="checkbox" class="permission-all-checkbox" data-type="process"> 设置审批流程</th>
 | 
	
		
			
				|  |  | +                        <th class="text-center">操作</th>
 | 
	
		
			
				|  |  | +                    </tr>
 | 
	
		
			
				|  |  | +                    </thead>
 | 
	
		
			
				|  |  | +                    <tbody id="permission-audit-list">
 | 
	
		
			
				|  |  | +                    <% for (const pa of permissionAudits) { %>
 | 
	
		
			
				|  |  | +                    <tr>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><input type="checkbox" name="uid[]" value="<%- pa.id %>"></td>
 | 
	
		
			
				|  |  | +                        <td class="text-left"><%- pa.name %></td>
 | 
	
		
			
				|  |  | +                        <td class="text-left"><%- pa.company %></td>
 | 
	
		
			
				|  |  | +                        <td class="text-left"><%- ctx.helper.formatFullDate(pa.create_time) %></td>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><input type="checkbox" class="permission-checkbox" data-type="tender" value="<%- pa.id %>" <% if (pa.permission_json.tender) { %>checked<% } %>></td>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><input type="checkbox" class="permission-checkbox" data-type="folder" value="<%- pa.id %>" <% if (pa.permission_json.folder) { %>checked<% } %>></td>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><input type="checkbox" class="permission-checkbox" data-type="process" value="<%- pa.id %>" <% if (pa.permission_json.process) { %>checked<% } %>></td>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><a href="javascript:void(0);" class="text-danger del-permission-audit-a" data-id="<%- pa.id %>">移除</a></td>
 | 
	
		
			
				|  |  | +                    </tr>
 | 
	
		
			
				|  |  | +                    <% } %>
 | 
	
		
			
				|  |  | +                    </tbody>
 | 
	
		
			
				|  |  | +                </table>
 | 
	
		
			
				|  |  | +                </div>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-footer">
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-outline-dark" data-dismiss="modal">关闭</button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +</div>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<!-- 弹窗删除权限用户 -->
 | 
	
		
			
				|  |  | +<div class="modal fade" id="del-permission-audit" data-backdrop="static">
 | 
	
		
			
				|  |  | +    <div class="modal-dialog" role="document">
 | 
	
		
			
				|  |  | +        <div class="modal-content">
 | 
	
		
			
				|  |  | +            <div class="modal-header">
 | 
	
		
			
				|  |  | +                <h5 class="modal-title">删除用户</h5>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-body">
 | 
	
		
			
				|  |  | +                <h6>确认删除当前所选用户?</h6>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +            <div class="modal-footer">
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
 | 
	
		
			
				|  |  | +                <input type="hidden" id="del-audit-ids" />
 | 
	
		
			
				|  |  | +                <button type="button" class="btn btn-sm btn-danger" id="del-audit-btn">确定删除</button>
 | 
	
		
			
				|  |  | +            </div>
 | 
	
		
			
				|  |  | +        </div>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +</div>
 | 
	
		
			
				|  |  | +<% } %>
 | 
	
		
			
				|  |  | +<% if (ctx.session.sessionUser.is_admin) { %>
 | 
	
		
			
				|  |  | +    <script src="/public/js/bootstrap/bootstrap-table.min.js"></script>
 | 
	
		
			
				|  |  | +    <script src="/public/js/bootstrap/locales/bootstrap-table-zh-CN.min.js"></script>
 | 
	
		
			
				|  |  | +    <script src="/public/js/bootstrap/bootstrap-table-fixed-columns.min.js"></script>
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +    $(function () {
 | 
	
		
			
				|  |  | +        // $("#permission-audit-table").bootstrapTable('destroy').bootstrapTable({
 | 
	
		
			
				|  |  | +        //     fixedColumns: true,
 | 
	
		
			
				|  |  | +        //     // height:200
 | 
	
		
			
				|  |  | +        //     // fixedNumber: 1 //固定列数
 | 
	
		
			
				|  |  | +        // });
 | 
	
		
			
				|  |  | +        let timer = null
 | 
	
		
			
				|  |  | +        let oldSearchVal = null
 | 
	
		
			
				|  |  | +        let permissionAudits = JSON.parse(unescape('<%- escape(JSON.stringify(permissionAudits)) %>'));
 | 
	
		
			
				|  |  | +        const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
 | 
	
		
			
				|  |  | +        const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
 | 
	
		
			
				|  |  | +        $('#gr-search').bind('input propertychange', function(e) {
 | 
	
		
			
				|  |  | +            oldSearchVal = e.target.value
 | 
	
		
			
				|  |  | +            timer && clearTimeout(timer)
 | 
	
		
			
				|  |  | +            timer = setTimeout(() => {
 | 
	
		
			
				|  |  | +                const newVal = $('#gr-search').val()
 | 
	
		
			
				|  |  | +                let html = ''
 | 
	
		
			
				|  |  | +                if (newVal && newVal === oldSearchVal) {
 | 
	
		
			
				|  |  | +                    accountList.filter(item => item && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
 | 
	
		
			
				|  |  | +                        html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
 | 
	
		
			
				|  |  | +                        <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
 | 
	
		
			
				|  |  | +                                class="ml-auto">${item.mobile || ''}</span></p>
 | 
	
		
			
				|  |  | +                        <span class="text-muted">${item.role || ''}</span>
 | 
	
		
			
				|  |  | +                    </dd>`
 | 
	
		
			
				|  |  | +                    })
 | 
	
		
			
				|  |  | +                    $('.book-list').empty()
 | 
	
		
			
				|  |  | +                    $('.book-list').append(html)
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    if (!$('.acc-btn').length) {
 | 
	
		
			
				|  |  | +                        accountGroup.forEach((group, idx) => {
 | 
	
		
			
				|  |  | +                            if (!group) return
 | 
	
		
			
				|  |  | +                            html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i>
 | 
	
		
			
				|  |  | +                        </a> ${group.groupName}</dt>
 | 
	
		
			
				|  |  | +                        <div class="dd-content" data-toggleid="${idx}">
 | 
	
		
			
				|  |  | +                        <dd class="border-bottom p-2 mb-0" data-groupid="${idx}"><p class="mb-0 d-flex"><span class="text-primary">该单位下所有组员</span></p></dd>`
 | 
	
		
			
				|  |  | +                            group.groupList.forEach(item => {
 | 
	
		
			
				|  |  | +                                    html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
 | 
	
		
			
				|  |  | +                                    <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
 | 
	
		
			
				|  |  | +                                            class="ml-auto">${item.mobile || ''}</span></p>
 | 
	
		
			
				|  |  | +                                    <span class="text-muted">${item.role || ''}</span>
 | 
	
		
			
				|  |  | +                                </dd>`
 | 
	
		
			
				|  |  | +                            });
 | 
	
		
			
				|  |  | +                            html += '</div>'
 | 
	
		
			
				|  |  | +                        })
 | 
	
		
			
				|  |  | +                        $('.book-list').empty()
 | 
	
		
			
				|  |  | +                        $('.book-list').append(html)
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }, 400);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        // 添加到成员中
 | 
	
		
			
				|  |  | +        $('.book-list').on('click', 'dt', function () {
 | 
	
		
			
				|  |  | +            const idx = $(this).find('.acc-btn').attr('data-groupid')
 | 
	
		
			
				|  |  | +            const type = $(this).find('.acc-btn').attr('data-type')
 | 
	
		
			
				|  |  | +            if (type === 'hide') {
 | 
	
		
			
				|  |  | +                $(this).parent().find(`div[data-toggleid="${idx}"]`).show(() => {
 | 
	
		
			
				|  |  | +                    $(this).children().find('i').removeClass('fa-plus-square').addClass('fa-minus-square-o')
 | 
	
		
			
				|  |  | +                    $(this).find('.acc-btn').attr('data-type', 'show')
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                $(this).parent().find(`div[data-toggleid="${idx}"]`).hide(() => {
 | 
	
		
			
				|  |  | +                    $(this).children().find('i').removeClass('fa-minus-square-o').addClass('fa-plus-square')
 | 
	
		
			
				|  |  | +                    $(this).find('.acc-btn').attr('data-type', 'hide')
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            return false
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        // 添加到成员中
 | 
	
		
			
				|  |  | +        $('dl').on('click', 'dd', function () {
 | 
	
		
			
				|  |  | +            const id = parseInt($(this).data('id'));
 | 
	
		
			
				|  |  | +            const groupid = parseInt($(this).data('groupid'));
 | 
	
		
			
				|  |  | +            if (!isNaN(id) && id !== 0) {
 | 
	
		
			
				|  |  | +                postData('/payment/permission/save', { type: 'add-audit', id: id }, function (result) {
 | 
	
		
			
				|  |  | +                    permissionAudits = result;
 | 
	
		
			
				|  |  | +                    setList(permissionAudits);
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +            } else if (!isNaN(groupid) && groupid !== 0) {
 | 
	
		
			
				|  |  | +                const groupAuditList = _.filter(accountList, { account_group: groupid });
 | 
	
		
			
				|  |  | +                const groupAidList = _.map(groupAuditList, 'id');
 | 
	
		
			
				|  |  | +                const groupPAList = _.map(_.filter(permissionAudits, { groupid }), 'id');
 | 
	
		
			
				|  |  | +                const addAidList = _.difference(groupAidList, groupPAList);
 | 
	
		
			
				|  |  | +                console.log(addAidList);
 | 
	
		
			
				|  |  | +                if (addAidList.length > 0) {
 | 
	
		
			
				|  |  | +                    postData('/payment/permission/save', { type: 'add-audit', id: addAidList }, function (result) {
 | 
	
		
			
				|  |  | +                        // toastr.success(`成功添加 位用户`);
 | 
	
		
			
				|  |  | +                        permissionAudits = result;
 | 
	
		
			
				|  |  | +                        setList(permissionAudits);
 | 
	
		
			
				|  |  | +                    })
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    toastr.warning('暂无用户添加');
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        function setList(datas) {
 | 
	
		
			
				|  |  | +            let list = '';
 | 
	
		
			
				|  |  | +            for (const pa of datas) {
 | 
	
		
			
				|  |  | +                list += `<tr>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><input type="checkbox" name="uid[]" value="${pa.id}"></td>
 | 
	
		
			
				|  |  | +                        <td class="text-left">${pa.name}</td>
 | 
	
		
			
				|  |  | +                        <td class="text-left">${pa.company}</td>
 | 
	
		
			
				|  |  | +                        <td class="text-left">${moment(pa.create_time).format('YYYY-MM-DD HH:mm:ss')}</td>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><input type="checkbox" class="permission-checkbox" data-type="tender" value="${pa.id}" ${pa.permission_json.tender ? 'checked' : ''}></td>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><input type="checkbox" class="permission-checkbox" data-type="folder" value="${pa.id}" ${pa.permission_json.folder ? 'checked' : ''}></td>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><input type="checkbox" class="permission-checkbox" data-type="process" value="${pa.id}" ${pa.permission_json.process ? 'checked' : ''}></td>
 | 
	
		
			
				|  |  | +                        <td class="text-center"><a href="javascript:void(0);" class="text-danger del-permission-audit-a" data-id="${pa.id}">移除</a></td>
 | 
	
		
			
				|  |  | +                    </tr>`;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            $('#permission-audit-list').html(list);
 | 
	
		
			
				|  |  | +            $("#permission-audit-table").bootstrapTable('resetView');
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        let first = 1;
 | 
	
		
			
				|  |  | +        $('#authority-list').on('shown.bs.modal', function () {
 | 
	
		
			
				|  |  | +            if (first) {
 | 
	
		
			
				|  |  | +                const option = {
 | 
	
		
			
				|  |  | +                    fixedColumns: true,
 | 
	
		
			
				|  |  | +                    fixedNumber: 1, //固定列数
 | 
	
		
			
				|  |  | +                    locale: 'zh-CN',
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                // if (permissionAudits.length === 0) {
 | 
	
		
			
				|  |  | +                //     option.formatName = function () {
 | 
	
		
			
				|  |  | +                //         return '暂无数据';
 | 
	
		
			
				|  |  | +                //     }
 | 
	
		
			
				|  |  | +                // }
 | 
	
		
			
				|  |  | +                $("#permission-audit-table").bootstrapTable('destroy').bootstrapTable(option);
 | 
	
		
			
				|  |  | +                first = 0;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        $('#del-permission-audits-btn').click(function () {
 | 
	
		
			
				|  |  | +            const checkArray = [];
 | 
	
		
			
				|  |  | +            $('#permission-audit-list input[name="uid[]"]:checked').each(function() {
 | 
	
		
			
				|  |  | +                checkArray.push(parseInt($(this).val())); //向数组中添加元素
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +            console.log(checkArray);
 | 
	
		
			
				|  |  | +            if (checkArray.length === 0) {
 | 
	
		
			
				|  |  | +                toastr.warning('暂无用户被选中');
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                $('#del-audit-ids').val(checkArray.join(','));
 | 
	
		
			
				|  |  | +                $('#del-permission-audit').modal('show');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        $('body').on('click', '.del-permission-audit-a', function () {
 | 
	
		
			
				|  |  | +            $('#del-audit-ids').val($(this).attr('data-id'));
 | 
	
		
			
				|  |  | +            $('#del-permission-audit').modal('show');
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        $('#del-audit-btn').click(function () {
 | 
	
		
			
				|  |  | +            let uids = $('#del-audit-ids').val();
 | 
	
		
			
				|  |  | +            postData('/payment/permission/save', { type: 'del-audit', id: uids.split(',') }, function (result) {
 | 
	
		
			
				|  |  | +                // toastr.success(`成功添加 位用户`);
 | 
	
		
			
				|  |  | +                $('#del-permission-audit').modal('hide');
 | 
	
		
			
				|  |  | +                permissionAudits = result;
 | 
	
		
			
				|  |  | +                setList(permissionAudits);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 权限勾选
 | 
	
		
			
				|  |  | +        $('body').on('click', '.permission-checkbox', function () {
 | 
	
		
			
				|  |  | +            console.log($(this).attr('data-type'), $(this).val(), $(this).is(':checked'));
 | 
	
		
			
				|  |  | +            const type = $(this).attr('data-type');
 | 
	
		
			
				|  |  | +            const value = $(this).is(':checked') ? 1 : 0;
 | 
	
		
			
				|  |  | +            const userInfo = _.find(permissionAudits, { id: parseInt($(this).val()) });
 | 
	
		
			
				|  |  | +            if (!userInfo) {
 | 
	
		
			
				|  |  | +                toastr.error('用户不存在');
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            userInfo.permission_json[type] = value;
 | 
	
		
			
				|  |  | +            const updateInfo = {
 | 
	
		
			
				|  |  | +                id: userInfo.id,
 | 
	
		
			
				|  |  | +                permission_json: userInfo.permission_json,
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            postData('/payment/permission/save', { type: 'save-permission-one', updateData: updateInfo }, function (result) {
 | 
	
		
			
				|  |  | +                // toastr.success(`成功添加 位用户`);
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        $('body').on('click', '.permission-all-checkbox', function () {
 | 
	
		
			
				|  |  | +            console.log($(this).attr('data-type'), $(this).is(':checked'));
 | 
	
		
			
				|  |  | +            const type = $(this).attr('data-type');
 | 
	
		
			
				|  |  | +            const value = $(this).is(':checked') ? 1 : 0;
 | 
	
		
			
				|  |  | +            postData('/payment/permission/save', { type: 'save-permission-all', permission_type: type, value }, function (result) {
 | 
	
		
			
				|  |  | +                // toastr.success(`成功添加 位用户`);
 | 
	
		
			
				|  |  | +                permissionAudits = result;
 | 
	
		
			
				|  |  | +                setList(permissionAudits);
 | 
	
		
			
				|  |  | +            })
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +<% } %>
 |