'use strict';
/**
*
*
* @author Ellisran
* @date 2020/10/09
* @version
*/
$(document).ready(function () {
let timer = null;
let oldSearchVal = null;
const needYB = ['ledger', 'revise', 'change'];
$('body').on('input propertychange', '.gr-search', function(e) {
oldSearchVal = e.target.value;
timer && clearTimeout(timer);
timer = setTimeout(() => {
const newVal = $(this).val();
const code = $(this).attr('data-code');
let html = '';
if (newVal && newVal === oldSearchVal) {
accountList.filter(item => item && (item.id !== cur_uid || (item.id === cur_uid && needYB.indexOf(code) !== -1)) && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
html += `
`;
group.groupList.forEach(item => {
if ((item.id !== cur_uid || (item.id === cur_uid && needYB.indexOf(code) !== -1))) {
html += `
${item.name}${item.mobile || ''}
${item.role || ''}
`;
}
});
html += '
';
});
$('#' + code + '_dropdownMenu .book-list').empty();
$('#' + code + '_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;
});
// 更改审批流程状态
$('.form-check input').on('change', function () {
// 获取所有审批的checked值并更新
const this_status = parseInt($(this).val());
const this_code = $(this).data('code');
const spt = sp_status_list[this_status];
$(this).parents('.form-group').siblings('.alert-warning').text(spt.name + ':' + spt.msg);
// 拼接post json
const prop = {
code: this_code,
status: this_status
};
const _self = $(this);
const tenderId = window.location.pathname.split('/')[2];
postData('/tender/' + tenderId + '/shenpi/save', prop, function (data) {
if (this_status === sp_status.sqspr) {
_self.parents('.form-group').siblings('.lc-show').html('');
} else if (this_status === sp_status.gdspl) {
let addhtml = '\n' + didivhtml +
'
\n';
}
});
let html = '