123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <% 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;*/
- /*}*/
- @-moz-document url-prefix() {
- table {
- table-layout: fixed;
- }
- }
- .customize-header tr th .th-inner{
- padding: 0.3rem!important;
- }
- </style>
- <div class="modal fade" id="add-cy" 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">
- <input type="hidden" id="tender_id" />
- <div class="dropdown">
- <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 %>">
- <% 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="mt-1" style="height:300px">
- <table id="construction-audit-table" class="table table-bordered" data-height="300" data-toggle="table">
- <thead class="text-center customize-header">
- <tr>
- <th width="100">成员名称</th>
- <th width="150">职位</th>
- <th>填报人</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody id="construction-audit-list" class="text-center">
- </tbody>
- </table>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">关闭</button>
- </div>
- </div>
- </div>
- </div>
- <!-- 弹窗删除权限用户 -->
- <div class="modal fade" id="del-construction-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>
- <script src="/public/js/bootstrap/bootstrap-table.min.js"></script>
- <script src="/public/js/bootstrap/locales/bootstrap-table-zh-CN.min.js"></script>
- <script>
- $(function () {
- let timer = null
- let oldSearchVal = null
- 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}">`
- 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'));
- console.log(id);
- if (!isNaN(id) && id !== 0) {
- postData(`/sp/${spid}/construction/${$('#tender_id').val()}/audit/save`, {type: 'add-audit', id: id}, function (result) {
- setList(result);
- })
- }
- });
- let first = 1;
- $('#add-cy').on('shown.bs.modal', function () {
- if (first) {
- const option = {
- locale: 'zh-CN',
- height: 300,
- }
- $("#construction-audit-table").bootstrapTable('destroy').bootstrapTable(option);
- first = 0;
- }
- const tid = $('#tender_id').val();
- if (tid) {
- postData(`/sp/${spid}/construction/${$('#tender_id').val()}/audit/save`, { type: 'list' }, function (result) {
- setList(result);
- });
- }
- });
- $('body').on('click', '.get-audits', function () {
- const tid = $(this).data('tid');
- $('#tender_id').val(tid);
- $('#construction-audit-list').html('');
- });
- function setList(datas) {
- let list = '';
- for (const ca of datas) {
- list += `<tr>
- <td>${ca.name}</td>
- <td>${ca.role}</td>
- <td>
- <input type="checkbox" class="report-checkbox" data-type="is_report" value="${ca.id}" ${ca.is_report ? 'checked' : ''}>
- </td>
- <td>
- <a href="#del-construction-audit" data-toggle="modal" data-target="#del-construction-audit" class="btn btn-outline-danger btn-sm ml-1 del-construction-audit-a" data-id="${ca.id}">移除</a>
- </td>
- </tr>`;
- }
- $('#construction-audit-list').html(list);
- $("#construction-audit-table").bootstrapTable('resetView');
- }
- $('body').on('click', '.del-construction-audit-a', function () {
- $('#del-audit-ids').val($(this).attr('data-id'));
- $('#del-construction-audit').modal('show');
- });
- $('#del-audit-btn').click(function () {
- let uids = $('#del-audit-ids').val();
- postData(`/sp/${spid}/construction/${$('#tender_id').val()}/audit/save`, { type: 'del-audit', id: uids.split(',') }, function (result) {
- // toastr.success(`成功添加 位用户`);
- $('#del-construction-audit').modal('hide');
- setList(result);
- })
- });
- // 上报人权限勾选
- $('body').on('click', '.report-checkbox', function () {
- const type = $(this).attr('data-type');
- const value = $(this).is(':checked') ? 1 : 0;
- const id = parseInt($(this).val());
- const updateInfo = {
- id,
- is_report: $(this).is(':checked'),
- }
- postData(`/sp/${spid}/construction/${$('#tender_id').val()}/audit/save`, { type: 'save-report', updateData: updateInfo }, function (result) {
- })
- });
- });
- </script>
- <% } %>
|