|
@@ -521,6 +521,78 @@ $(function () {
|
|
|
tenderListOrder.reOrderTenders('', '#copyModalContent', false, tenderList);
|
|
|
initTenderListTree();
|
|
|
$('#add-tender-list').html(getTenderListTreeHtml());
|
|
|
+ $('#search-audit').val('');
|
|
|
+ $('#search-result').text('0/0');
|
|
|
+ $('#up-search').attr('disabled', true);
|
|
|
+ $('#down-search').attr('disabled', true);
|
|
|
+ });
|
|
|
+
|
|
|
+ let timer2 = null;
|
|
|
+ let oldSearchVal2 = null;
|
|
|
+ $('body').on('input propertychange', '#add-ftt input[name="audit-name"]', function(e) {
|
|
|
+ oldSearchVal2 = e.target.value;
|
|
|
+ timer2 && clearTimeout(timer2);
|
|
|
+ timer2 = setTimeout(() => {
|
|
|
+ const newVal = $(this).val();
|
|
|
+ const resultLength = $('#add-tender-list').find('.result').length;
|
|
|
+ if (resultLength > 0) {
|
|
|
+ let content = $('#add-tender-list').html();
|
|
|
+ const replaceStr = $('#add-tender-list').find('.result').eq(0).html();
|
|
|
+ const regExp2 = new RegExp('<span class="result" style="background: yellow;">' + replaceStr + '</span>', 'g');
|
|
|
+ content = content.replace(regExp2, replaceStr);
|
|
|
+ const regExp3 = new RegExp('<span class="result" style="background: orange;">' + replaceStr + '</span>', 'g');
|
|
|
+ content = content.replace(regExp3, replaceStr);
|
|
|
+ $('#add-tender-list').html(content);
|
|
|
+ }
|
|
|
+ $('#search-result').text('0/0');
|
|
|
+ $('#up-search').attr('disabled', true);
|
|
|
+ $('#down-search').attr('disabled', true);
|
|
|
+ if (newVal && newVal === oldSearchVal2) {
|
|
|
+ const regExp = new RegExp(newVal, 'g');
|
|
|
+ for (let i = 0; i < $('#add-tender-list tr').length; i++) {
|
|
|
+ if (_.includes($('#add-tender-list tr').eq(i).children('td').eq(1).html(), newVal)) {
|
|
|
+ $('#add-tender-list tr').eq(i).children('td').eq(1).html($('#add-tender-list tr').eq(i).children('td').eq(1).html().replace(regExp, '<span class="result" style="background: yellow;">' + newVal + '</span>'))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const resultLength2 = $('#add-tender-list').find('.result').length;
|
|
|
+ if (resultLength2 > 0) {
|
|
|
+ $('#add-tender-list').find('.result').eq(0).css('background', 'orange');
|
|
|
+ $('#search-result').text('1/' + resultLength2);
|
|
|
+ $('#up-search').attr('disabled', false);
|
|
|
+ $('#down-search').attr('disabled', false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($('#add-tender-list').find('.result').length > 0) {
|
|
|
+ const X = $('#add-tender-list').find('.result').eq(0).offset().top;
|
|
|
+ $('#add-tender-list').scrollTop(X - $('#add-tender-list').offset().top + $('#add-tender-list').scrollTop() - 30);
|
|
|
+ }
|
|
|
+ }, 400);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#up-search').on('click', function () {
|
|
|
+ const cur = parseInt($('#search-result').text().split('/')[0]);
|
|
|
+ const total = parseInt($('#search-result').text().split('/')[1]);
|
|
|
+ const now = cur - 1 !== 0 ? cur - 1: total;
|
|
|
+ $('#add-tender-list').find('.result').eq(cur-1).css('background', 'yellow');
|
|
|
+ $('#add-tender-list').find('.result').eq(now-1).css('background', 'orange');
|
|
|
+ // $('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html().replace('<span class="result" style="background:orange;">', '<span class="result" style="background:yellow;">'))
|
|
|
+ // $('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html().replace('<span class="result" style="background:yellow;">', '<span class="result" style="background:orange;">'))
|
|
|
+ $('#search-result').text(now + '/' + total);
|
|
|
+ const X = $('#add-tender-list').find('.result').eq(now-1).offset().top;
|
|
|
+ $('#add-tender-list').scrollTop(X - $('#add-tender-list').offset().top + $('#add-tender-list').scrollTop() - 30);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('#down-search').on('click', function () {
|
|
|
+ const cur = parseInt($('#search-result').text().split('/')[0]);
|
|
|
+ const total = parseInt($('#search-result').text().split('/')[1]);
|
|
|
+ const now = cur + 1 > total ? 1: cur + 1;
|
|
|
+ $('#add-tender-list').find('.result').eq(cur-1).css('background', 'yellow');
|
|
|
+ $('#add-tender-list').find('.result').eq(now-1).css('background', 'orange');
|
|
|
+ // $('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[cur-1]).children('td').eq(2).html().replace('<span class="result" style="background:orange;">', '<span class="result" style="background:yellow;">'))
|
|
|
+ // $('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html($('#tender-list tr').eq(searchUser[now-1]).children('td').eq(2).html().replace('<span class="result" style="background:yellow;">', '<span class="result" style="background:orange;">'))
|
|
|
+ $('#search-result').text(now + '/' + total);
|
|
|
+ const X = $('#add-tender-list').find('.result').eq(now-1).offset().top;
|
|
|
+ $('#add-tender-list').scrollTop(X - $('#add-tender-list').offset().top + $('#add-tender-list').scrollTop() -30);
|
|
|
});
|
|
|
})
|
|
|
/**
|