const modStatus = function(tid) {
const tender = tenders.find(x => { return x.id === tid});
if (tender.status === 1) {
if (tender.canFinish) {
$('form', '#mod-status2finish').attr('action', `/tender/${tid}/build`);
$('#mod-status2finish').modal('show');
} else {
$('#mod-status-hint').modal('show');
}
} else {
$('form', '#mod-status2build').attr('action', `/tender/${tid}/build`);
$('#mod-status2build').modal('show');
}
};
const tenderListSpec = (function(){
function getTenderNodeHtml(node, arr, pid) {
const html = [];
html.push('
');
// 名称
html.push('');
if (node.cid) {
html.push(' ');
html.push((node.level === 1 ? '' : ''), node.name, (node.level === 1 ? '' : ''));
} else {
html.push('');
html.push(arr.indexOf(node) === arr.length - 1 ? '└' : '├');
html.push('');
html.push('', node.name, '');
}
html.push(' | ');
// 创建人
html.push('', node.user_name, ' | ');
// 创建时间
html.push('', node.create_time ? moment(node.create_time).format('YYYY-MM-DD HH:mm:ss') : '', ' | ');
// 完成期数
html.push('');
if (!node.cid) {
if (node.progress) {
html.push(node.progress.title);
} else {
html.push(node.lastStage ? '第' + node.lastStage.order + '期' : '第0期');
}
}
html.push(' | ');
// 管理
html.push('');
if (!node.cid) {
html.push('编辑');
const hasStage = node.progress ? node.stage_count > 0 : !!node.lastStage;
if (!hasStage) {
html.push('删除');
} else {
html.push('');
}
if (cache) html.push(`更新缓存`);
html.push(`修改状态`);
}
html.push(' | ');
html.push('
');
return html.join('');
}
function getTenderTreeHeaderHtml() {
const html = [];
const left = $('#sub-menu').css('display') === 'none' ? 56 : 176;
html.push('');
html.push('', '');
html.push('', '标段名称', tenderListOrder.getOrderButton('name'), ' | ');
html.push('', '创建人', ' | ');
html.push('', '创建时间', tenderListOrder.getOrderButton('create_time'), ' | ');
html.push('', '完成期数', ' | ');
html.push('', '管理', ' | ');
html.push('
', '');
return html.join('');
}
return { getTenderNodeHtml, getTenderTreeHeaderHtml }
})();