'use strict';
/**
*
*
* @author Mai
* @date 2019/2/27
* @version
*/
$(document).ready(function () {
let timer = null
let oldSearchVal = null
$('#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 && cur_uid !== item.id && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
html += `
`
group.groupList.forEach(item => {
if (item.id !== cur_uid) {
html += `
${item.name}${item.mobile || ''}
${item.role || ''}
`
}
});
html += '
'
})
$('.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'));
if (id) {
postData(preUrl + '/audit/add', { auditorId: id }, (datas) => {
const html = [];
// 如果是重新上报,添加到重新上报列表中
const auditorshtml = [];
for (const [index,data] of datas.entries()) {
if (index !== 0) {
html.push('