|
@@ -929,18 +929,14 @@ $(document).ready(() => {
|
|
const gcl_id = leaf.gcl_id ? leaf.gcl_id : '';
|
|
const gcl_id = leaf.gcl_id ? leaf.gcl_id : '';
|
|
const mx_id = leaf.mx_id ? leaf.mx_id : '';
|
|
const mx_id = leaf.mx_id ? leaf.mx_id : '';
|
|
const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : (gcl.leafXmjs.length > 1 && gcl.name ? gcl.name : undefined);
|
|
const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : (gcl.leafXmjs.length > 1 && gcl.name ? gcl.name : undefined);
|
|
- const isChecked = data_bwmx.indexOf(
|
|
|
|
- leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' +
|
|
|
|
|
|
+ const pushMsg = leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' +
|
|
(leaf.dwgc ? leaf.dwgc : '') + '!_!' + (leaf.fbgc ? leaf.fbgc : '') + '!_!' + (leaf.fxgc ? leaf.fxgc : '')
|
|
(leaf.dwgc ? leaf.dwgc : '') + '!_!' + (leaf.fbgc ? leaf.fbgc : '') + '!_!' + (leaf.fxgc ? leaf.fxgc : '')
|
|
+ '!_!' + (leaf.gcl_id ? leaf.gcl_id : '0') + '!_!' + (leaf.mx_id ? leaf.mx_id : '') + '!_!' +
|
|
+ '!_!' + (leaf.gcl_id ? leaf.gcl_id : '0') + '!_!' + (leaf.mx_id ? leaf.mx_id : '') + '!_!' +
|
|
- (bwmx !== undefined ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity) !== -1 && isCheck ?
|
|
|
|
- 'checked' : '';
|
|
|
|
|
|
+ (bwmx !== undefined ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity;
|
|
|
|
+ const isChecked = data_bwmx.indexOf(pushMsg) !== -1 && isCheck ? 'checked ' : '';
|
|
const existGcl = _.find(changeList, {gcl_id: leaf.gcl_id, bwmx: (bwmx ? bwmx : leaf.jldy ? leaf.jldy : ''), oamount: leaf.quantity});
|
|
const existGcl = _.find(changeList, {gcl_id: leaf.gcl_id, bwmx: (bwmx ? bwmx : leaf.jldy ? leaf.jldy : ''), oamount: leaf.quantity});
|
|
const isUsed = existGcl ? _.find(changeUsedData, { cbid: existGcl.id }) : null;
|
|
const isUsed = existGcl ? _.find(changeUsedData, { cbid: existGcl.id }) : null;
|
|
- const isOldChaRu = changeOrder && isChecked && data_charu.indexOf(leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' +
|
|
|
|
- (leaf.dwgc ? leaf.dwgc : '') + '!_!' + (leaf.fbgc ? leaf.fbgc : '') + '!_!' + (leaf.fxgc ? leaf.fxgc : '')
|
|
|
|
- + '!_!' + (leaf.gcl_id ? leaf.gcl_id : '0') + '!_!' + (leaf.mx_id ? leaf.mx_id : '') + '!_!' +
|
|
|
|
- (bwmx !== undefined ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity) === -1;
|
|
|
|
|
|
+ const isOldChaRu = changeOrder && isChecked && data_charu.indexOf(pushMsg) === -1;
|
|
const isDisabled = isUsed || isOldChaRu ? 'disabled ' : '';
|
|
const isDisabled = isUsed || isOldChaRu ? 'disabled ' : '';
|
|
codeHtml += '<tr quantity="' + quantity + '" gcl_id="' + gcl_id + '" mx_id="' + mx_id + '">' +
|
|
codeHtml += '<tr quantity="' + quantity + '" gcl_id="' + gcl_id + '" mx_id="' + mx_id + '">' +
|
|
'<td class="text-center">' + (index+1) + (leaf.cid ? '<i class="text-danger" style="font-weight: 900">*</i>' : '') + '</td>' +
|
|
'<td class="text-center">' + (index+1) + (leaf.cid ? '<i class="text-danger" style="font-weight: 900">*</i>' : '') + '</td>' +
|
|
@@ -956,7 +952,10 @@ $(document).ready(() => {
|
|
searchCodeList.push(leaf.code + '|!|' + (leaf.jldy ? leaf.jldy: '') + '|!|' + (bwmx !== undefined ? bwmx : ''));
|
|
searchCodeList.push(leaf.code + '|!|' + (leaf.jldy ? leaf.jldy: '') + '|!|' + (bwmx !== undefined ? bwmx : ''));
|
|
}
|
|
}
|
|
} else if (!isDeal && isCheck) {
|
|
} else if (!isDeal && isCheck) {
|
|
- codeHtml = '<tr quantity="'+ $(this).children('td').eq(5).text() +'" gcl_id="" mx_id=""><td class="text-center">1</td><td colspan="7" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox" checked></td></tr>';
|
|
|
|
|
|
+ const pushMsg = '0*;*' + $(this).children('td').eq(5).text();
|
|
|
|
+ const isChecked = data_bwmx.indexOf(pushMsg) !== -1 && isCheck ? 'checked ' : '';
|
|
|
|
+ const isDisabeld = changeOrder && isChecked && data_charu.indexOf(pushMsg) === -1 ? 'disabled ' : '';
|
|
|
|
+ codeHtml = '<tr quantity="'+ $(this).children('td').eq(5).text() +'" gcl_id="" mx_id=""><td class="text-center">1</td><td colspan="7" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox" ' + isChecked + isDisabeld +'></td></tr>';
|
|
}
|
|
}
|
|
$('#code-list').attr('data-index', parseInt($(this).children('td').eq(0).text()));
|
|
$('#code-list').attr('data-index', parseInt($(this).children('td').eq(0).text()));
|
|
$('#code-input').val('');
|
|
$('#code-input').val('');
|
|
@@ -1136,12 +1135,40 @@ $(document).ready(() => {
|
|
});
|
|
});
|
|
$('#list-input').on('blur', function () {
|
|
$('#list-input').on('blur', function () {
|
|
const select = parseInt($('#select-list').val());
|
|
const select = parseInt($('#select-list').val());
|
|
- const value = $(this).val();
|
|
|
|
|
|
+ const value = _.trim($(this).val());
|
|
|
|
+ const valueList = _.slice(_.without(_.uniq(value.split(' ')), ''), 0, 10);
|
|
|
|
+ console.log(valueList);
|
|
|
|
+ // 判断是否存在多个分词,以换行或空格分隔,多个则显示左侧菜单
|
|
|
|
+ if (value !== '' && valueList.length > 1) {
|
|
|
|
+ if (_.without(_.uniq(value.split(' ')), '').length > 10) {
|
|
|
|
+ toastr.warning('最多筛选以空格分割的前10个不重复关键词');
|
|
|
|
+ }
|
|
|
|
+ $('#table-list').addClass('col-9').removeClass('col-12');
|
|
|
|
+ $('#table-list').siblings('.col-3').show();
|
|
|
|
+ $('#list-search-keyword').html('<a href="javascript:void(0);" data-keyword="" class="list-group-item list-group-item-action active">全部</a>');
|
|
|
|
+ for (const v of valueList) {
|
|
|
|
+ $('#list-search-keyword').append(`<a href="javascript:void(0);" data-keyword="${v}" class="list-group-item list-group-item-action">${v}</a>`);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ $('#table-list').addClass('col-12').removeClass('col-9');
|
|
|
|
+ $('#table-list').siblings('.col-3').hide();
|
|
|
|
+ $('#list-search-keyword').html('<a href="javascript:void(0);" data-keyword="" class="list-group-item list-group-item-action active">全部</a>');
|
|
|
|
+ }
|
|
let showListData = changeListData;
|
|
let showListData = changeListData;
|
|
if (select === 1 && value !== '') {
|
|
if (select === 1 && value !== '') {
|
|
$(this).siblings('a').show();
|
|
$(this).siblings('a').show();
|
|
showListData = _.filter(changeListData, function (c) {
|
|
showListData = _.filter(changeListData, function (c) {
|
|
- return ((c.code && c.code.indexOf(value) !== -1) || (c.name && c.name.indexOf(value) !== -1)) && c.cid;
|
|
|
|
|
|
+ let flag = false;
|
|
|
|
+ if (c.cid) {
|
|
|
|
+ for(const v of valueList) {
|
|
|
|
+ if ((c.code && c.code.indexOf(v) !== -1) || (c.name && c.name.indexOf(v) !== -1)) {
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return flag;
|
|
|
|
+ // return ((c.code && c.code.indexOf(value) !== -1) || (c.name && c.name.indexOf(value) !== -1)) && c.cid;
|
|
});
|
|
});
|
|
} else if (select === 1 && value === '') {
|
|
} else if (select === 1 && value === '') {
|
|
$(this).siblings('a').hide();
|
|
$(this).siblings('a').hide();
|
|
@@ -1151,7 +1178,15 @@ $(document).ready(() => {
|
|
} else if (value !== '') {
|
|
} else if (value !== '') {
|
|
$(this).siblings('a').show();
|
|
$(this).siblings('a').show();
|
|
showListData = _.filter(changeListData, function (c) {
|
|
showListData = _.filter(changeListData, function (c) {
|
|
- return (c.code && c.code.indexOf(value) !== -1) || (c.name && c.name.indexOf(value) !== -1);
|
|
|
|
|
|
+ let flag = false;
|
|
|
|
+ for(const v of valueList) {
|
|
|
|
+ if ((c.code && c.code.indexOf(v) !== -1) || (c.name && c.name.indexOf(v) !== -1)) {
|
|
|
|
+ flag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return flag;
|
|
|
|
+ // return (c.code && c.code.indexOf(value) !== -1) || (c.name && c.name.indexOf(value) !== -1);
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
$(this).siblings('a').hide();
|
|
$(this).siblings('a').hide();
|
|
@@ -1163,6 +1198,29 @@ $(document).ready(() => {
|
|
$('#code-list').html('');
|
|
$('#code-list').html('');
|
|
$('#code-select-all').prop('checked', false);
|
|
$('#code-select-all').prop('checked', false);
|
|
});
|
|
});
|
|
|
|
+ // 检索关键字切换
|
|
|
|
+ $('body').on('click', '#list-search-keyword a', function () {
|
|
|
|
+ if (!$(this).hasClass('active')) {
|
|
|
|
+ const keyword = $(this).attr('data-keyword');
|
|
|
|
+ console.log(keyword);
|
|
|
|
+ $(this).siblings().removeClass('active');
|
|
|
|
+ $(this).addClass('active');
|
|
|
|
+ if (keyword === '') {
|
|
|
|
+ $('#list-input').blur();
|
|
|
|
+ } else {
|
|
|
|
+ const select = parseInt($('#select-list').val());
|
|
|
|
+ const showListData = _.filter(changeListData, function (c) {
|
|
|
|
+ return ((c.code && c.code.indexOf(keyword) !== -1) || (c.name && c.name.indexOf(keyword) !== -1)) && (select === 1 ? c.cid : 1);
|
|
|
|
+ });
|
|
|
|
+ makeListTable(changeListData, showListData);
|
|
|
|
+ $('#table-list-select tr').removeClass('table-warning');
|
|
|
|
+ $('#code-input').val('');
|
|
|
|
+ $('#code-input').siblings('a').hide();
|
|
|
|
+ $('#code-list').html('');
|
|
|
|
+ $('#code-select-all').prop('checked', false);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
// 回车提交
|
|
// 回车提交
|
|
$('#code-input').on('keypress', function () {
|
|
$('#code-input').on('keypress', function () {
|
|
if(window.event.keyCode === 13) {
|
|
if(window.event.keyCode === 13) {
|
|
@@ -1194,6 +1252,10 @@ $(document).ready(() => {
|
|
makeListTable(changeListData, showListData);
|
|
makeListTable(changeListData, showListData);
|
|
$('#table-list-select tr').removeClass('table-warning');
|
|
$('#table-list-select tr').removeClass('table-warning');
|
|
$('#code-list').html('');
|
|
$('#code-list').html('');
|
|
|
|
+ $('#table-list').addClass('col-12').removeClass('col-9');
|
|
|
|
+ $('#table-list').siblings('.col-3').hide();
|
|
|
|
+ $('#list-search-keyword').html('');
|
|
|
|
+ $('#list-search-keyword').siblings('a').addClass('active');
|
|
} else {
|
|
} else {
|
|
makeCodeTable();
|
|
makeCodeTable();
|
|
}
|
|
}
|