|
@@ -1276,6 +1276,20 @@
|
|
|
// cid: category && category[0].value ? category[0].id : ,
|
|
|
// }
|
|
|
// const categoryName =
|
|
|
+ if (category && category.length > 0) {
|
|
|
+ if (category[0] && category[0].value.length > 0) {
|
|
|
+ for (const [i, fc] of category[0].value.entries()) {
|
|
|
+ const fcCategory = {cid: fc.cid, value: fc.id};
|
|
|
+ if (_.findIndex(tenders, function (item) {
|
|
|
+ return _.findIndex(item.category, fcCategory) !== -1;
|
|
|
+ }) === -1) {
|
|
|
+ $('#first-category .select-cate').eq(i + 1).hide();
|
|
|
+ } else {
|
|
|
+ $('#first-category .select-cate').eq(i + 1).show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
setData(tenders, 0);
|
|
|
})
|
|
|
|
|
@@ -1540,11 +1554,6 @@
|
|
|
$('#third-category').hide();
|
|
|
$('#first-category').children('button').attr('data-cid', '').attr('data-value', '');
|
|
|
} else {
|
|
|
- if (category[1] && category[1].value.length > 0) {
|
|
|
- $('#second-category').show();
|
|
|
- $('#third-category').hide();
|
|
|
- $('#second-category').children('button').text('全部').attr('data-cid', '').attr('data-value', '');
|
|
|
- }
|
|
|
// 获取第一层已选类别
|
|
|
const firstCategory = { cid: parseInt($(this).data('cid')), value: parseInt(id) };
|
|
|
$('#first-category').children('button').attr('data-cid', $(this).data('cid')).attr('data-value', id);
|
|
@@ -1552,6 +1561,21 @@
|
|
|
return _.findIndex(item.category, firstCategory) !== -1;
|
|
|
})
|
|
|
categoryIndex = 1;
|
|
|
+ if (category[1] && category[1].value.length > 0) {
|
|
|
+ $('#second-category').show();
|
|
|
+ $('#third-category').hide();
|
|
|
+ $('#second-category').children('button').text('全部').attr('data-cid', '').attr('data-value', '');
|
|
|
+ for (const [i,sc] of category[1].value.entries()) {
|
|
|
+ const scCategory = { cid: sc.cid, value: sc.id };
|
|
|
+ if (_.findIndex(newTenderList, function (item) {
|
|
|
+ return _.findIndex(item.category, scCategory) !== -1;}) === -1) {
|
|
|
+ $('#second-category .select-cate').eq(i+1).hide();
|
|
|
+ } else {
|
|
|
+ $('#second-category .select-cate').eq(i+1).show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// categoryList.push(firstCategory);
|
|
|
}
|
|
|
setData(newTenderList, categoryIndex);
|
|
@@ -1573,10 +1597,6 @@
|
|
|
if (!id) {
|
|
|
$('#third-category').hide();
|
|
|
} else {
|
|
|
- if (category[2] && category[2].value.length > 0) {
|
|
|
- $('#third-category').show();
|
|
|
- $('#third-category').children('button').text('全部').attr('data-cid', '').attr('data-value', '');
|
|
|
- }
|
|
|
// 获取第二层已选类别
|
|
|
const secondCategory = { cid: parseInt($(this).data('cid')), value: parseInt(id) };
|
|
|
$('#second-category').children('button').attr('data-cid', $(this).data('cid')).attr('data-value', id);
|
|
@@ -1584,6 +1604,19 @@
|
|
|
return _.findIndex(item.category, secondCategory) !== -1;
|
|
|
});
|
|
|
categoryIndex = 2;
|
|
|
+ if (category[2] && category[2].value.length > 0) {
|
|
|
+ $('#third-category').show();
|
|
|
+ $('#third-category').children('button').text('全部').attr('data-cid', '').attr('data-value', '');
|
|
|
+ for (const [i,sc] of category[2].value.entries()) {
|
|
|
+ const tcCategory = { cid: sc.cid, value: sc.id };
|
|
|
+ if (_.findIndex(newTenderList, function (item) {
|
|
|
+ return _.findIndex(item.category, tcCategory) !== -1;}) === -1) {
|
|
|
+ $('#third-category .select-cate').eq(i+1).hide();
|
|
|
+ } else {
|
|
|
+ $('#third-category .select-cate').eq(i+1).show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// categoryList.push(secondCategory);
|
|
|
}
|
|
|
setData(newTenderList, categoryIndex);
|