|
|
@@ -12,59 +12,90 @@ $(document).ready(function() {
|
|
|
const ProjectTree = createDragTree(setting.treeSetting);
|
|
|
ProjectTree.loadDatas(setting.source);
|
|
|
const TableObj = $(setting.table);
|
|
|
+ const TableHeaderObj = $(setting.tableHeader);
|
|
|
let tenderTreeShowLevel;
|
|
|
+ let colSetCache;
|
|
|
|
|
|
const Utils = {
|
|
|
+ generateColSetCache: function() {
|
|
|
+ const result = {};
|
|
|
+ colSet.forEach(x => {
|
|
|
+ result[x.field] = { show: x.show, alias: x.alias || x.name };
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ getHeaderHtml: function() {
|
|
|
+ colSetCache = this.generateColSetCache();
|
|
|
+ const html = [];
|
|
|
+ html.push('<tr class="text-center">');
|
|
|
+ if (colSetCache.name.show) html.push('<th style="min-width: 300px">', colSetCache.name.alias, '</th>');
|
|
|
+ if (colSetCache.budget_std.show) html.push('<th width="8%">', colSetCache.budget_std.alias, '</th>');
|
|
|
+ if (colSetCache.tender_count.show) html.push('<th width="5%">', colSetCache.tender_count.alias, '</th>');
|
|
|
+ if (colSetCache.file_count.show) html.push('<th width="5%">', colSetCache.file_count.alias, '<i class="fa fa-question-circle text-primary" data-placement="bottom" data-toggle="tooltip" data-original-title="指资料归集的所有文件个数"></i>', '</th>');
|
|
|
+ if (colSetCache.contract_count.show) html.push('<th width="5%">', colSetCache.contract_count.alias, '<i class="fa fa-question-circle text-primary" data-placement="bottom" data-toggle="tooltip" data-original-title="项目支出合同个数"></i>', '</th>');
|
|
|
+ if (colSetCache.management.show) html.push('<th width="20%">', colSetCache.management.alias, '</th>');
|
|
|
+ if (colSetCache.create_time.show) html.push('<th width="8%">', colSetCache.create_time.alias, '</th>');
|
|
|
+ if (colSetCache.control.show && canEdit) html.push('<th width="20%">', colSetCache.control.alias, '</th>');
|
|
|
+ html.push('</tr>');
|
|
|
+ console.log(html);
|
|
|
+ return html.join('');
|
|
|
+ },
|
|
|
getRowTdHtml: function (node, tree) {
|
|
|
const html = [];
|
|
|
// 名称
|
|
|
- html.push('<td width="20%" class="in-' + node.tree_level + '">');
|
|
|
- if (node.is_folder) {
|
|
|
- if (node.children.length > 0) {
|
|
|
- html.push('<span onselectstart="return false" style="{-moz-user-select:none}" class="fold-switch mr-1" title="收起" id="'+ node.id +'"><i class="fa fa-minus-square-o"></i></span> <i class="fa fa-folder-o"></i> ', node.name);
|
|
|
+ if (colSetCache.name.show) {
|
|
|
+ html.push('<td width="20%" class="in-' + node.tree_level + '">');
|
|
|
+ if (node.is_folder) {
|
|
|
+ if (node.children.length > 0) {
|
|
|
+ html.push('<span onselectstart="return false" style="{-moz-user-select:none}" class="fold-switch mr-1" title="收起" id="'+ node.id +'"><i class="fa fa-minus-square-o"></i></span> <i class="fa fa-folder-o"></i> ', node.name);
|
|
|
+ } else {
|
|
|
+ html.push('<i class="fa fa-folder-o"></i> ', node.name);
|
|
|
+ }
|
|
|
} else {
|
|
|
- html.push('<i class="fa fa-folder-o"></i> ', node.name);
|
|
|
+ html.push(`<span class="text-muted mr-2">${tree.isLastSibling(node) ? '└' : '├'}</span>`);
|
|
|
+ html.push(`<a href="sp/${node.id}/dashboard" name="name" id="${node.id}">`, node.name, '</a>');
|
|
|
}
|
|
|
- } else {
|
|
|
- html.push(`<span class="text-muted mr-2">${tree.isLastSibling(node) ? '└' : '├'}</span>`);
|
|
|
- html.push(`<a href="sp/${node.id}/dashboard" name="name" id="${node.id}">`, node.name, '</a>');
|
|
|
+ html.push('</td>');
|
|
|
}
|
|
|
- html.push('</td>');
|
|
|
// 概预算标准
|
|
|
- if (node.is_folder) {
|
|
|
- html.push(`<td class="text-center"></td>`);
|
|
|
- } else {
|
|
|
- if (node.std_name) {
|
|
|
- html.push(`<td class="text-center">${node.std_name}</td>`);
|
|
|
- } else if (canEdit) {
|
|
|
- html.push(`<td class="text-center"><button class="btn btn-outline-primary btn-sm ml-1" name="set-std">选择</button></td>`);
|
|
|
- } else {
|
|
|
+ if (colSetCache.budget_std.show) {
|
|
|
+ if (node.is_folder) {
|
|
|
html.push(`<td class="text-center"></td>`);
|
|
|
+ } else {
|
|
|
+ if (node.std_name) {
|
|
|
+ html.push(`<td class="text-center">${node.std_name}</td>`);
|
|
|
+ } else if (canEdit) {
|
|
|
+ html.push(`<td class="text-center"><button class="btn btn-outline-primary btn-sm ml-1" name="set-std">选择</button></td>`);
|
|
|
+ } else {
|
|
|
+ html.push(`<td class="text-center"></td>`);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 创建时间
|
|
|
if (node.is_folder) {
|
|
|
- html.push(`<td class="text-center"></td>`);
|
|
|
- html.push(`<td class="text-center"></td>`);
|
|
|
- html.push(`<td class="text-center"></td>`);
|
|
|
- html.push(`<td class="text-center"></td>`);
|
|
|
- html.push(`<td class="text-center"></td>`);
|
|
|
+ if (colSetCache.tender_count.show) html.push(`<td class="text-center"></td>`);
|
|
|
+ if (colSetCache.file_count.show) html.push(`<td class="text-center"></td>`);
|
|
|
+ if (colSetCache.contract_count.show) html.push(`<td class="text-center"></td>`);
|
|
|
+ if (colSetCache.management.show) html.push(`<td class="text-center"></td>`);
|
|
|
+ if (colSetCache.create_time.show) html.push(`<td class="text-center"></td>`);
|
|
|
} else {
|
|
|
// 标段个数
|
|
|
- html.push(`<td class="text-center">${node.tender_count}</td>`);
|
|
|
+ if (colSetCache.tender_count.show) html.push(`<td class="text-center">${node.tender_count}</td>`);
|
|
|
// 文件个数
|
|
|
- html.push(`<td class="text-center">${node.file_count}</td>`);
|
|
|
+ if (colSetCache.file_count.show) html.push(`<td class="text-center">${node.file_count}</td>`);
|
|
|
// 合同个数
|
|
|
- html.push(`<td class="text-center">${node.contract_count}</td>`);
|
|
|
- if (canEdit) {
|
|
|
- html.push(`<td class="text-center">${node.management || ''}<a class="ml-2" href="javascript: void(0)" name="set-management"><i class="fa fa-pencil-square-o "></i></a>${node.management ? '<a class="ml-2" href="javascript: void(0)" name="refresh-management"><i class="fa fa-refresh "></i></a>': ''}</td>`);
|
|
|
- } else {
|
|
|
- html.push(`<td class="text-center">${node.management || ''}</td>`);
|
|
|
+ if (colSetCache.contract_count.show) html.push(`<td class="text-center">${node.contract_count}</td>`);
|
|
|
+ if (colSetCache.management.show) {
|
|
|
+ if (canEdit) {
|
|
|
+ html.push(`<td class="text-center">${node.management || ''}<a class="ml-2" href="javascript: void(0)" name="set-management"><i class="fa fa-pencil-square-o "></i></a>${node.management ? '<a class="ml-2" href="javascript: void(0)" name="refresh-management"><i class="fa fa-refresh "></i></a>': ''}</td>`);
|
|
|
+ } else {
|
|
|
+ html.push(`<td class="text-center">${node.management || ''}</td>`);
|
|
|
+ }
|
|
|
}
|
|
|
- html.push(`<td class="text-center">${moment(node.create_time).format('YYYY-MM-DD')}</td>`);
|
|
|
+ if (colSetCache.create_time.show) html.push(`<td class="text-center">${moment(node.create_time).format('YYYY-MM-DD')}</td>`);
|
|
|
}
|
|
|
// 操作
|
|
|
- if (canEdit) {
|
|
|
+ if (canEdit && colSetCache.control.show) {
|
|
|
html.push(`<td>`);
|
|
|
html.push('<button class="btn btn-outline-primary btn-sm ml-1" name="edit">编辑</button>');
|
|
|
html.push('<button class="btn btn-outline-primary btn-sm ml-1" name="up"><i class="fa fa-arrow-up"></i></button>');
|
|
|
@@ -94,6 +125,7 @@ $(document).ready(function() {
|
|
|
return html.join('');
|
|
|
},
|
|
|
reloadTable: function () {
|
|
|
+ TableHeaderObj.html(Utils.getHeaderHtml());
|
|
|
const html = [];
|
|
|
for (const node of ProjectTree.nodes) {
|
|
|
html.push(Utils.getNodeTrHtml(node, ProjectTree));
|
|
|
@@ -346,6 +378,7 @@ $(document).ready(function() {
|
|
|
treeSetting: { id: 'id', pid: 'tree_pid', level: 'tree_level', order: 'tree_order', rootId: '-1' },
|
|
|
source: projectList,
|
|
|
table: '#projectList',
|
|
|
+ tableHeader: '#projectListHeader',
|
|
|
});
|
|
|
|
|
|
$('#add-folder').on('show.bs.modal', function(e) {
|