|
@@ -47,6 +47,7 @@ const levelTreeSetting = {
|
|
|
const levelNodes =[];
|
|
|
const tenderTree = [];
|
|
|
let parentId = 0;
|
|
|
+// let hideList = [];
|
|
|
function createTree() {
|
|
|
const zTree = $.fn.zTree.getZTreeObj('treeLevel');
|
|
|
if (zTree) {
|
|
@@ -351,6 +352,37 @@ function bindTenderUrl() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+// function removeValueToCate(cate) {
|
|
|
+// const changeCate = JSON.parse(JSON.stringify(cate));
|
|
|
+// const newCate = [];
|
|
|
+// for (const c of changeCate) {
|
|
|
+// delete c.value;
|
|
|
+// newCate.push(c);
|
|
|
+// }
|
|
|
+// return newCate;
|
|
|
+// }
|
|
|
+//
|
|
|
+// function localHideList() {
|
|
|
+// const pro_cate = getLocalCache('pro_'+ pid + '_category_list');
|
|
|
+// const cate = JSON.stringify(removeValueToCate(category));
|
|
|
+// if (pro_cate && cate === pro_cate) {
|
|
|
+// const userTenderHideList = getLocalCache(uphlname);
|
|
|
+// if (userTenderHideList) {
|
|
|
+// hideList = JSON.parse(userTenderHideList);
|
|
|
+// for (const h of hideList) {
|
|
|
+// const cid = h.sort_id;
|
|
|
+// const node = findTenderTreeNode(parseInt(cid), tenderTree);
|
|
|
+// $('.c-body tr td span[cid="' + cid + '"]').children('i').removeClass('fa-minus-square-o').addClass('fa-plus-square-o');
|
|
|
+// $('.c-body tr td span[cid="' + cid + '"]').attr('title', '展开');
|
|
|
+// doTrStatus(returnItem, 'hide');
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// removeLocalCache(uphlname);
|
|
|
+// setLocalCache('pro_'+ pid + '_category_list', cate);
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
$(document).ready(() => {
|
|
|
autoFlashHeight();
|
|
|
sortCategory();
|
|
@@ -361,6 +393,8 @@ $(document).ready(() => {
|
|
|
initTenderTree();
|
|
|
$('.c-body').html(getTenderTreeHtml());
|
|
|
bindTenderUrl();
|
|
|
+ localHideList();
|
|
|
+
|
|
|
// 分类
|
|
|
$('#cate-set').on('show.bs.modal', function () {
|
|
|
createTree();
|
|
@@ -423,82 +457,95 @@ $(document).ready(() => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- // 展开和收起
|
|
|
- $('body').on('click', '.fold-switch', function () {
|
|
|
- if ($(this).children('i').hasClass('fa-minus-square-o')) {
|
|
|
- $(this).children('i').removeClass('fa-minus-square-o').addClass('fa-plus-square-o');
|
|
|
- $(this).attr('title', '展开');
|
|
|
- const cid = $(this).attr('cid');
|
|
|
- const node = findTenderTreeNode(parseInt(cid), tenderTree);
|
|
|
- doTrStatus(returnItem, 'hide');
|
|
|
- } else {
|
|
|
- $(this).children('i').removeClass('fa-plus-square-o').addClass('fa-minus-square-o');
|
|
|
- $(this).attr('title', '收起');
|
|
|
- const cid = $(this).attr('cid');
|
|
|
- const node = findTenderTreeNode(parseInt(cid), tenderTree);
|
|
|
- doTrStatus(returnItem, 'show');
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 一键展开和收起
|
|
|
- $('body').on('click', '.tree-toggle', function () {
|
|
|
- const item = $(this).attr('data-item');
|
|
|
- for (const tree of tenderTree) {
|
|
|
- if (tree && tree.sort_id !== undefined) {
|
|
|
- const cid = tree.sort_id;
|
|
|
- const node = findTenderTreeNode(parseInt(cid), tenderTree);
|
|
|
- console.log(node);
|
|
|
- console.log(returnItem);
|
|
|
- if (item === 'open') {
|
|
|
- $('.c-body tr td span[cid="' + cid + '"]').children('i').removeClass('fa-plus-square-o').addClass('fa-minus-square-o');
|
|
|
- $('.c-body tr td span[cid="' + cid + '"]').attr('title', '收起');
|
|
|
- doTrStatus(returnItem, 'show', 'all');
|
|
|
- } else if (item === 'hide') {
|
|
|
- $('.c-body tr td span[cid="' + cid + '"]').children('i').removeClass('fa-minus-square-o').addClass('fa-plus-square-o');
|
|
|
- $('.c-body tr td span[cid="' + cid + '"]').attr('title', '展开');
|
|
|
- doTrStatus(returnItem, 'hide', 'all')
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ // // 展开和收起
|
|
|
+ // $('body').on('click', '.fold-switch', function () {
|
|
|
+ // if ($(this).children('i').hasClass('fa-minus-square-o')) {
|
|
|
+ // $(this).children('i').removeClass('fa-minus-square-o').addClass('fa-plus-square-o');
|
|
|
+ // $(this).attr('title', '展开');
|
|
|
+ // const cid = $(this).attr('cid');
|
|
|
+ // const node = findTenderTreeNode(parseInt(cid), tenderTree);
|
|
|
+ // doTrStatus(returnItem, 'hide');
|
|
|
+ // hideList.push({sort_id: cid});
|
|
|
+ // setLocalCache(uphlname, JSON.stringify(hideList));
|
|
|
+ // } else {
|
|
|
+ // $(this).children('i').removeClass('fa-plus-square-o').addClass('fa-minus-square-o');
|
|
|
+ // $(this).attr('title', '收起');
|
|
|
+ // const cid = $(this).attr('cid');
|
|
|
+ // const node = findTenderTreeNode(parseInt(cid), tenderTree);
|
|
|
+ // doTrStatus(returnItem, 'show');
|
|
|
+ // const index = hideList.findIndex(function(item) {
|
|
|
+ // return parseInt(item.sort_id) === parseInt(cid);
|
|
|
+ // });
|
|
|
+ // hideList.splice(index, 1);
|
|
|
+ // setLocalCache(uphlname, JSON.stringify(hideList));
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ //
|
|
|
+ // // 一键展开和收起
|
|
|
+ // $('body').on('click', '.tree-toggle', function () {
|
|
|
+ // const item = $(this).attr('data-item');
|
|
|
+ // hideList = [];
|
|
|
+ // if (item === 'open') {
|
|
|
+ // setLocalCache(uphlname, JSON.stringify(hideList));
|
|
|
+ // }
|
|
|
+ // for (const tree of tenderTree) {
|
|
|
+ // if (tree && tree.sort_id !== undefined) {
|
|
|
+ // const cid = tree.sort_id;
|
|
|
+ // const node = findTenderTreeNode(parseInt(cid), tenderTree);
|
|
|
+ // if (item === 'open') {
|
|
|
+ // $('.c-body tr td span[cid="' + cid + '"]').children('i').removeClass('fa-plus-square-o').addClass('fa-minus-square-o');
|
|
|
+ // $('.c-body tr td span[cid="' + cid + '"]').attr('title', '收起');
|
|
|
+ // doTrStatus(returnItem, 'show', 'all');
|
|
|
+ // } else if (item === 'hide') {
|
|
|
+ // $('.c-body tr td span[cid="' + cid + '"]').children('i').removeClass('fa-minus-square-o').addClass('fa-plus-square-o');
|
|
|
+ // $('.c-body tr td span[cid="' + cid + '"]').attr('title', '展开');
|
|
|
+ // doTrStatus(returnItem, 'hide', 'all');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
});
|
|
|
|
|
|
-function doTrStatus(node, status, all = '') {
|
|
|
- if (status === 'show') {
|
|
|
- $('.c-body').find('tr[pid="'+ node.sort_id +'"]').show();
|
|
|
- if (all === 'all') {
|
|
|
- $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '收起');
|
|
|
- $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-plus-square-o').removeClass('fa-minus-square-o').addClass('fa-minus-square-o');
|
|
|
- }
|
|
|
- } else {
|
|
|
- $('.c-body').find('tr[pid="'+ node.sort_id +'"]').hide();
|
|
|
- if (all === 'all') {
|
|
|
- $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '展开');
|
|
|
- $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-minus-square-o').removeClass('fa-plus-square-o').addClass('fa-plus-square-o');
|
|
|
- }
|
|
|
- }
|
|
|
- // 判断是否还有一层
|
|
|
- if (node.children && all === '') {
|
|
|
- for (const [index,c] of node.children.entries()) {
|
|
|
- const title = $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').eq(index).attr('title');
|
|
|
- if (title === '收起') {
|
|
|
- doTrStatus(c, status);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (node.children && all === 'all') {
|
|
|
- for (const c of node.children) {
|
|
|
- doTrStatus(c, status, 'all');
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-let returnItem;
|
|
|
-const findTenderTreeNode = function(sortId, tree) {
|
|
|
- tree.forEach((item) => {
|
|
|
- if (item.sort_id !== undefined && item.sort_id === sortId) {
|
|
|
- returnItem = item;
|
|
|
- return item;
|
|
|
- } else if (item.children && item.children.length > 0) {
|
|
|
- findTenderTreeNode(sortId, item.children);
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
+// function doTrStatus(node, status, all = '') {
|
|
|
+// if (status === 'show') {
|
|
|
+// $('.c-body').find('tr[pid="'+ node.sort_id +'"]').show();
|
|
|
+// if (all === 'all') {
|
|
|
+// $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '收起');
|
|
|
+// $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-plus-square-o').removeClass('fa-minus-square-o').addClass('fa-minus-square-o');
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// $('.c-body').find('tr[pid="'+ node.sort_id +'"]').hide();
|
|
|
+// if (all === 'all') {
|
|
|
+// if (node.children) {
|
|
|
+// hideList.push({sort_id: node.sort_id});
|
|
|
+// setLocalCache(uphlname, JSON.stringify(hideList));
|
|
|
+// }
|
|
|
+// $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').attr('title', '展开');
|
|
|
+// $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch i').removeClass('fa-minus-square-o').removeClass('fa-plus-square-o').addClass('fa-plus-square-o');
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 判断是否还有一层
|
|
|
+// if (node.children && all === '') {
|
|
|
+// for (const [index,c] of node.children.entries()) {
|
|
|
+// const title = $('.c-body').find('tr[pid="'+ node.sort_id +'"] .fold-switch').eq(index).attr('title');
|
|
|
+// if (title === '收起') {
|
|
|
+// doTrStatus(c, status);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } else if (node.children && all === 'all') {
|
|
|
+// for (const c of node.children) {
|
|
|
+// doTrStatus(c, status, 'all');
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// let returnItem;
|
|
|
+// const findTenderTreeNode = function(sortId, tree) {
|
|
|
+// tree.forEach((item) => {
|
|
|
+// if (item.sort_id !== undefined && item.sort_id === sortId) {
|
|
|
+// returnItem = item;
|
|
|
+// return item;
|
|
|
+// } else if (item.children && item.children.length > 0) {
|
|
|
+// findTenderTreeNode(sortId, item.children);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|