|
@@ -1213,7 +1213,8 @@ $(document).ready(function() {
|
|
|
this.curTender = null;
|
|
this.curTender = null;
|
|
|
this.curFiles = [];
|
|
this.curFiles = [];
|
|
|
this.tenderFileType = [];
|
|
this.tenderFileType = [];
|
|
|
- this.tenderTree = null;
|
|
|
|
|
|
|
+ this.loaded = false;
|
|
|
|
|
+ this.loadingPromise = null;
|
|
|
this.spread = null;
|
|
this.spread = null;
|
|
|
this.sheet = null;
|
|
this.sheet = null;
|
|
|
|
|
|
|
@@ -1238,17 +1239,6 @@ $(document).ready(function() {
|
|
|
readOnly: true, selectedBackColor: '#e8f4fd',
|
|
readOnly: true, selectedBackColor: '#e8f4fd',
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- this.spread = SpreadJsObj.createNewSpread($('#rela-tender')[0]);
|
|
|
|
|
- this.sheet = this.spread.getActiveSheet();
|
|
|
|
|
- SpreadJsObj.initSheet(this.sheet, this.spreadSetting);
|
|
|
|
|
-
|
|
|
|
|
- this.spread.bind(spreadNS.Events.SelectionChanged, async function(e, info) {
|
|
|
|
|
- const node = SpreadJsObj.getSelectObject(self.sheet);
|
|
|
|
|
- if (node && (!self.curTender || self.curTender.tmt_id !== node.tmt_id)) {
|
|
|
|
|
- await self.setCurTender(node);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
$('body').on('click', '[name=rf-check]', function() {
|
|
$('body').on('click', '[name=rf-check]', function() {
|
|
|
self.selectFile(this.getAttribute('rfid'), this.checked);
|
|
self.selectFile(this.getAttribute('rfid'), this.checked);
|
|
|
});
|
|
});
|
|
@@ -1256,6 +1246,12 @@ $(document).ready(function() {
|
|
|
$('#tf-sub-type').change(function() { self.selectTfSubType(this.value); });
|
|
$('#tf-sub-type').change(function() { self.selectTfSubType(this.value); });
|
|
|
$('#tf-stage').change(function() { self.selectTfStage(this.value); });
|
|
$('#tf-stage').change(function() { self.selectTfStage(this.value); });
|
|
|
$('#tf-select').change(function() { self.selectTfId(this.value); });
|
|
$('#tf-select').change(function() { self.selectTfId(this.value); });
|
|
|
|
|
+ $('#rela-file-ok').off('click.filesjsRela').on('click.filesjsRela', function() {
|
|
|
|
|
+ const selectFiles = self.getSelectRelaFile();
|
|
|
|
|
+ filingSjs.relaFiles(selectFiles, function() {
|
|
|
|
|
+ $('#rela-file').modal('hide');
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
_convertTenderData(data) {
|
|
_convertTenderData(data) {
|
|
|
const tenderPathTree = Tender2Tree.convert(data.category, data.tenders, null, null, function(node, source) {
|
|
const tenderPathTree = Tender2Tree.convert(data.category, data.tenders, null, null, function(node, source) {
|
|
@@ -1268,7 +1264,7 @@ $(document).ready(function() {
|
|
|
if (!parent && node.tmt_pid !== -1 && node.tmt_pid !== '-1') continue;
|
|
if (!parent && node.tmt_pid !== -1 && node.tmt_pid !== '-1') continue;
|
|
|
const hasChild = tenderPathTree.nodes.some(x => x.tmt_pid === node.tmt_id);
|
|
const hasChild = tenderPathTree.nodes.some(x => x.tmt_pid === node.tmt_id);
|
|
|
result.push({
|
|
result.push({
|
|
|
- tmt_id: node.tmt_id, tmt_pid: parent ? parent.tmt_id : -1,
|
|
|
|
|
|
|
+ id: node.tmt_id, tmt_id: node.tmt_id, tmt_pid: parent ? parent.tmt_id : -1,
|
|
|
sort: node.sort || 0, level: node.level || 0,
|
|
sort: node.sort || 0, level: node.level || 0,
|
|
|
is_leaf: !hasChild, full_path: '', name: node.name, source_node: node,
|
|
is_leaf: !hasChild, full_path: '', name: node.name, source_node: node,
|
|
|
});
|
|
});
|
|
@@ -1292,18 +1288,34 @@ $(document).ready(function() {
|
|
|
}
|
|
}
|
|
|
async showRelaFile() {
|
|
async showRelaFile() {
|
|
|
$('#rela-filing-hint').html(`当前目录:${filingSjs.getCurFilingFullPath()}`);
|
|
$('#rela-filing-hint').html(`当前目录:${filingSjs.getCurFilingFullPath()}`);
|
|
|
- if (!this.tenderTree) {
|
|
|
|
|
- const data = await postDataAsync('file/rela/tender', {});
|
|
|
|
|
- this._tenderRawData = data;
|
|
|
|
|
- const convertedData = this._convertTenderData(data);
|
|
|
|
|
- this.tenderPathTree.loadDatas(convertedData);
|
|
|
|
|
- SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Tree, this.tenderPathTree);
|
|
|
|
|
|
|
+ this._initSpread();
|
|
|
|
|
+ if (!this.loaded) {
|
|
|
|
|
+ $('#rela-file-hint').text('正在加载标段数据...');
|
|
|
|
|
+ if (!this.loadingPromise) {
|
|
|
|
|
+ this.loadingPromise = postDataAsync('file/rela/tender', {}).then(data => {
|
|
|
|
|
+ this._tenderRawData = data;
|
|
|
|
|
+ const convertedData = this._convertTenderData(data);
|
|
|
|
|
+ this.tenderPathTree.loadDatas(convertedData);
|
|
|
|
|
+ SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Tree, this.tenderPathTree);
|
|
|
|
|
+ this.loaded = true;
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ this.loadingPromise = null;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ await this.loadingPromise;
|
|
|
}
|
|
}
|
|
|
|
|
+ this.spread.refresh();
|
|
|
this.clearFileSelect();
|
|
this.clearFileSelect();
|
|
|
this.refreshSelectHint();
|
|
this.refreshSelectHint();
|
|
|
- if (this.tenderPathTree.nodes.length > 0) {
|
|
|
|
|
- this.sheet.setActiveCell(0, 0);
|
|
|
|
|
- await this.setCurTender(this.tenderPathTree.nodes[0]);
|
|
|
|
|
|
|
+ const firstTender = this.tenderPathTree.nodes.find(node => node.source_node && node.source_node.tid);
|
|
|
|
|
+ if (firstTender) {
|
|
|
|
|
+ await this.setCurTender(firstTender);
|
|
|
|
|
+ this.sheet.setActiveCell(this.tenderPathTree.nodes.indexOf(firstTender), 0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.curTender = null;
|
|
|
|
|
+ this.curFiles = [];
|
|
|
|
|
+ $('#cur-tender-hint').text('');
|
|
|
|
|
+ $('#rf-files').html('<tr><td colspan="3" class="text-center text-muted">暂无可引用标段</td></tr>');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
clearFileSelect() {
|
|
clearFileSelect() {
|
|
@@ -1529,6 +1541,21 @@ $(document).ready(function() {
|
|
|
}
|
|
}
|
|
|
return data;
|
|
return data;
|
|
|
}
|
|
}
|
|
|
|
|
+ _initSpread() {
|
|
|
|
|
+ if (this.spread) return;
|
|
|
|
|
+ const self = this;
|
|
|
|
|
+ const container = $('#rela-tender')[0];
|
|
|
|
|
+ if (!container) throw new Error('引用文件标段列表容器不存在');
|
|
|
|
|
+ this.spread = SpreadJsObj.createNewSpread(container);
|
|
|
|
|
+ this.sheet = this.spread.getActiveSheet();
|
|
|
|
|
+ SpreadJsObj.initSheet(this.sheet, this.spreadSetting);
|
|
|
|
|
+ this.spread.bind(spreadNS.Events.SelectionChanged, async function(e, info) {
|
|
|
|
|
+ const node = SpreadJsObj.getSelectObject(self.sheet);
|
|
|
|
|
+ if (node && (!self.curTender || self.curTender.tmt_id !== node.tmt_id)) {
|
|
|
|
|
+ await self.setCurTender(node);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -2300,7 +2327,15 @@ $(document).ready(function() {
|
|
|
// 引用文件
|
|
// 引用文件
|
|
|
const relaFileLoader = new RelaFileLoader();
|
|
const relaFileLoader = new RelaFileLoader();
|
|
|
$('#rela-file').on('show.bs.modal', function() {
|
|
$('#rela-file').on('show.bs.modal', function() {
|
|
|
- relaFileLoader.showRelaFile(this.getAttribute('content'));
|
|
|
|
|
|
|
+ $('#rela-file-hint').text('正在加载标段数据...');
|
|
|
|
|
+ }).on('shown.bs.modal', async function() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await relaFileLoader.showRelaFile();
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error(error);
|
|
|
|
|
+ $('#rela-file-hint').text('标段数据加载失败,请关闭后重试');
|
|
|
|
|
+ toastr.error('标段数据加载失败,请重试');
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 授权用户
|
|
// 授权用户
|