|
@@ -1505,3 +1505,227 @@
|
|
|
});
|
|
|
}
|
|
|
</script>
|
|
|
+
|
|
|
+<% if (ctx.session.sessionProject.page_show !== null && parseInt(ctx.session.sessionProject.page_show.xxjd) === 1 && ctx.session.sessionUser.is_admin) { %>
|
|
|
+<!--标段设置-形象进度-->
|
|
|
+<div class="modal fade" id="xxjd-set" 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="alert alert-warning">设置可使用「形象进度」用户</div>
|
|
|
+ <div class="dropdown">
|
|
|
+ <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" id="xxjd_dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
|
+ 添加用户
|
|
|
+ </button>
|
|
|
+ <div class="dropdown-menu" id="xxjd_dropdownMenu" aria-labelledby="xxjd_dropdownMenuButton" style="width:220px">
|
|
|
+ <div class="mb-2 p-2"><input class="form-control form-control-sm gr-search"
|
|
|
+ placeholder="姓名/手机 检索" 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 => { %>
|
|
|
+ <% if (item.id !== ctx.tender.data.user_id) { %>
|
|
|
+ <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="max-height: 300px;overflow: auto">
|
|
|
+ <table class="table table-bordered">
|
|
|
+ <tr><th>用户</th><th>查看</th><th>修改</th><th>移除</th></tr>
|
|
|
+ <tbody id="schedule-users">
|
|
|
+ <% for (const sa of scheduleAuditList) { %>
|
|
|
+ <% const audit = ctx.helper._.find(accountList, { id : sa.audit_id }); %>
|
|
|
+ <% if (audit) { %>
|
|
|
+ <tr data-id="<%- audit.id %>"><td><p class="mb-0 d-flex"><b class="col-3 pl-0"><%- audit.name %></b> <span class="text-muted"><%- audit.mobile %></span><p class="text-muted mb-0"><%- audit.role %></p></td><td>
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" data-zhi="<%- scPermission.show %>" data-id="<%- sa.id %>" id="<%- sa.id %>_customRadio41" name="customCheckbox" class="custom-control-input" <% if (sa.permission !== scPermission.no) { %>checked<% } %>>
|
|
|
+ <label class="custom-control-label" for="<%- sa.id %>_customRadio41"></label>
|
|
|
+ </div>
|
|
|
+ </td><td>
|
|
|
+ <div class="custom-control custom-checkbox mb-2">
|
|
|
+ <input type="checkbox" data-zhi="<%- scPermission.edit %>" data-id="<%- sa.id %>" id="<%- sa.id %>_customRadio42" name="customCheckbox" class="custom-control-input" <% if (sa.permission === scPermission.edit) { %>checked<% } %>>
|
|
|
+ <label class="custom-control-label" for="<%- sa.id %>_customRadio42"></label>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td><a href="javascript:void(0);" class="text-danger remove-schedule-user" data-id="<%- sa.id %>">移除</a></td>
|
|
|
+ </tr>
|
|
|
+ <% } %>
|
|
|
+ <% } %>
|
|
|
+ </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>
|
|
|
+<script>
|
|
|
+ $(function () {
|
|
|
+ const accountGroup = JSON.parse(unescape('<%- escape(JSON.stringify(accountGroup)) %>'));
|
|
|
+ const accountList = JSON.parse(unescape('<%- escape(JSON.stringify(accountList)) %>'));
|
|
|
+ const cur_uid = parseInt('<%- ctx.tender.data.user_id %>');
|
|
|
+ const cur_tenderid = parseInt('<%- ctx.tender.id %>');
|
|
|
+ const scPermission = JSON.parse(unescape('<%- escape(JSON.stringify(scPermission)) %>'));
|
|
|
+ // 形象进度
|
|
|
+ let timer = null;
|
|
|
+ let oldSearchVal = null;
|
|
|
+ $('body').on('input propertychange', '.gr-search', function(e) {
|
|
|
+ oldSearchVal = e.target.value;
|
|
|
+ timer && clearTimeout(timer);
|
|
|
+ timer = setTimeout(() => {
|
|
|
+ const newVal = $(this).val();
|
|
|
+ let html = '';
|
|
|
+ if (newVal && newVal === oldSearchVal) {
|
|
|
+ accountList.filter(item => item && item.id !== cur_uid && (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>`
|
|
|
+ });
|
|
|
+ $('#xxjd_dropdownMenu .book-list').empty();
|
|
|
+ $('#xxjd_dropdownMenu .book-list').append(html);
|
|
|
+ } else {
|
|
|
+ if (!$('#xxjd_dropdownMenu .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 => {
|
|
|
+ if (item.id !== cur_uid) {
|
|
|
+ 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>';
|
|
|
+ });
|
|
|
+ $('#xxjd_dropdownMenu .book-list').empty();
|
|
|
+ $('#xxjd_dropdownMenu .book-list').append(html);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 400);
|
|
|
+ });
|
|
|
+
|
|
|
+ // 添加审批流程按钮逻辑
|
|
|
+ $('body').on('click', '.book-list 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;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 选中用户
|
|
|
+ $('body').on('click', 'dl dd', function () {
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ if (id) {
|
|
|
+ const user = _.find(accountList, function (item) {
|
|
|
+ return item.id === id;
|
|
|
+ });
|
|
|
+ const saIdList = [];
|
|
|
+ for (let i = 0; i < $('#schedule-users tr').length; i++) {
|
|
|
+ saIdList.push(parseInt($('#schedule-users tr').eq(i).data('id')));
|
|
|
+ }
|
|
|
+ if (_.includes(saIdList, id)) {
|
|
|
+ toastr.error('该用户已存在列表中,无需重复添加');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const prop = {
|
|
|
+ audit_id: id,
|
|
|
+ type: 'add',
|
|
|
+ };
|
|
|
+ postData('/tender/' + cur_tenderid + '/schedule/audit/save', prop, function (data) {
|
|
|
+ const html = '<tr data-id="'+ user.id + '"><td><p class="mb-0 d-flex"><b class="col-3 pl-0">'+ user.name + '</b> <span class="text-muted">'+ user.mobile + '</span><p class="text-muted mb-0">'+ user.role + '</p></td><td>\n' +
|
|
|
+ ' <div class="custom-control custom-checkbox mb-2">\n' +
|
|
|
+ ' <input type="checkbox" data-zhi="'+ scPermission.show +'" data-id="'+ data.id + '" id="'+ data.id + '_customRadio41" name="customCheckbox" class="custom-control-input" checked>\n' +
|
|
|
+ ' <label class="custom-control-label" for="'+ data.id + '_customRadio41"></label>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </td><td>\n' +
|
|
|
+ ' <div class="custom-control custom-checkbox mb-2">\n' +
|
|
|
+ ' <input type="checkbox" data-zhi="'+ scPermission.edit +'" data-id="'+ data.id + '" id="'+ data.id + '_customRadio42" name="customCheckbox" class="custom-control-input">\n' +
|
|
|
+ ' <label class="custom-control-label" for="'+ data.id + '_customRadio42"></label>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </td>\n' +
|
|
|
+ ' <td><a href="javascript:void(0);" class="text-danger remove-schedule-user" data-id="'+ data.id + '">移除</a></td>\n' +
|
|
|
+ ' </tr>';
|
|
|
+ $('#schedule-users').append(html);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 移除用户
|
|
|
+ $('body').on('click', '.remove-schedule-user', function () {
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ if (id) {
|
|
|
+ const prop = {
|
|
|
+ id,
|
|
|
+ type: 'del',
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ postData('/tender/' + cur_tenderid + '/schedule/audit/save', prop, function (data) {
|
|
|
+ _self.parents('tr').remove();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 权限更改
|
|
|
+ $('body').on('click', '#schedule-users input[type="checkbox"]', function () {
|
|
|
+ let permission = scPermission.no;
|
|
|
+ const value = parseInt($(this).data('zhi'));
|
|
|
+ if ($(this).is(':checked')) {
|
|
|
+ if (value === scPermission.edit) {
|
|
|
+ permission = scPermission.edit;
|
|
|
+ $(this).parents('td').siblings().find('input').prop('checked', true);
|
|
|
+ } else if (value === scPermission.show) {
|
|
|
+ permission = scPermission.show;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (value === scPermission.edit) {
|
|
|
+ permission = scPermission.show;
|
|
|
+ } else if (value === scPermission.show) {
|
|
|
+ permission = scPermission.no;
|
|
|
+ $(this).parents('td').siblings().find('input').prop('checked', false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ const prop = {
|
|
|
+ id,
|
|
|
+ permission,
|
|
|
+ type: 'edit',
|
|
|
+ };
|
|
|
+ const _self = $(this);
|
|
|
+ postData('/tender/' + cur_tenderid + '/schedule/audit/save', prop, function (data) {
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
+</script>
|
|
|
+<% } %>
|