|
@@ -11,6 +11,8 @@
|
|
|
$(document).ready(function () {
|
|
|
let timer = null
|
|
|
let oldSearchVal = null
|
|
|
+ let timer2 = null
|
|
|
+ let oldSearchVal2 = null
|
|
|
|
|
|
$('#gr-search').bind('input propertychange', function(e) {
|
|
|
oldSearchVal = e.target.value
|
|
@@ -26,8 +28,8 @@ $(document).ready(function () {
|
|
|
<span class="text-muted">${item.role || ''}</span>
|
|
|
</dd>`
|
|
|
})
|
|
|
- $('.book-list').empty()
|
|
|
- $('.book-list').append(html)
|
|
|
+ $('.search-user-list').empty()
|
|
|
+ $('.search-user-list').append(html)
|
|
|
} else {
|
|
|
if (!$('.acc-btn').length) {
|
|
|
accountGroup.forEach((group, idx) => {
|
|
@@ -46,15 +48,15 @@ $(document).ready(function () {
|
|
|
});
|
|
|
html += '</div>'
|
|
|
})
|
|
|
- $('.book-list').empty()
|
|
|
- $('.book-list').append(html)
|
|
|
+ $('.search-user-list').empty()
|
|
|
+ $('.search-user-list').append(html)
|
|
|
}
|
|
|
}
|
|
|
}, 400);
|
|
|
})
|
|
|
|
|
|
// 添加审批流程按钮逻辑
|
|
|
- $('.book-list').on('click', 'dt', function () {
|
|
|
+ $('.search-user-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') {
|
|
@@ -73,7 +75,7 @@ $(document).ready(function () {
|
|
|
})
|
|
|
|
|
|
// 添加到审批流程中
|
|
|
- $('dl').on('click', 'dd', function () {
|
|
|
+ $('.search-user-list').on('click', 'dd', function () {
|
|
|
const id = parseInt($(this).data('id'));
|
|
|
if (id) {
|
|
|
postData(preUrl + '/audit/add', { auditorId: id }, (datas) => {
|
|
@@ -161,6 +163,104 @@ $(document).ready(function () {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ // 协审人搜索
|
|
|
+ $('#gr-search2').bind('input propertychange', function(e) {
|
|
|
+ oldSearchVal2 = e.target.value;
|
|
|
+ timer2 && clearTimeout(timer2);
|
|
|
+ timer2 = setTimeout(() => {
|
|
|
+ const newVal = $('#gr-search2').val();
|
|
|
+ let html = '';
|
|
|
+ if (newVal && newVal === oldSearchVal2) {
|
|
|
+ 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>`
|
|
|
+ })
|
|
|
+ $('.search-user-list2').empty();
|
|
|
+ $('.search-user-list2').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>'
|
|
|
+ })
|
|
|
+ $('.search-user-list2').empty();
|
|
|
+ $('.search-user-list2').append(html);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 400);
|
|
|
+ })
|
|
|
+
|
|
|
+ // 添加审批流程按钮逻辑
|
|
|
+ $('.search-user-list2').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
|
|
|
+ });
|
|
|
+
|
|
|
+ // 添加到审批流程中
|
|
|
+ $('.search-user-list2').on('click', 'dd', function () {
|
|
|
+ const id = parseInt($(this).data('id'));
|
|
|
+ if (id) {
|
|
|
+ console.log(id);
|
|
|
+ postData(preUrl + '/xsaudit/add', { auditorId: id }, (data) => {
|
|
|
+ const html = [];
|
|
|
+ html.push('<span class="d-inline-block">\n' +
|
|
|
+ ' <span class="badge badge-light">\n' +
|
|
|
+ ' ' + data.name + '\n' +
|
|
|
+ ' <span class="dropdown">\n' +
|
|
|
+ ' <a href="javascript:void(0)" class="btn-sm text-danger px-1" title="移除" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-remove"></i></a>\n' +
|
|
|
+ ' <div class="dropdown-menu">\n' +
|
|
|
+ ' <a class="dropdown-item" href="javascript:void(0);">确认移除审批人?</a>\n' +
|
|
|
+ ' <div class="dropdown-divider"></div>\n' +
|
|
|
+ ' <div class="px-2 py-1 text-center">\n' +
|
|
|
+ ' <button class="btn btn-sm btn-danger" aid="'+ data.aid +'">移除</button>\n' +
|
|
|
+ ' <button class="btn btn-sm btn-secondary">取消</button>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </div>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </span>\n' +
|
|
|
+ ' </span> ');
|
|
|
+ $('#xs-list').append(html.join(''));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 删除审批人
|
|
|
+ $('body').on('click', '#xs-list .btn-danger', function () {
|
|
|
+ const li = $(this).parents('.d-inline-block');
|
|
|
+ const data = {
|
|
|
+ auditorId: parseInt($(this).attr('aid')),
|
|
|
+ };
|
|
|
+ postData(preUrl + '/xsaudit/delete', data, (result) => {
|
|
|
+ li.remove();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
// 退回选择修改审批人流程
|
|
|
$('#hideSp').click(function () {
|
|
|
$('#sp-list').modal('hide');
|