|
@@ -990,31 +990,40 @@ $(document).ready(function() {
|
|
|
clearFileSelect() {
|
|
|
if (!this.tenderTree) return;
|
|
|
|
|
|
- const nodes = this.tenderTree.getNodes();
|
|
|
- nodes.forEach(node => {
|
|
|
- const x = node.source_node;
|
|
|
- x.selectFiles = [];
|
|
|
- if (x.att) x.att.forEach(la => { la.checked = false });
|
|
|
- if (x.advance) {
|
|
|
- x.advance.forEach(a => {
|
|
|
- if (a.files) a.files.forEach(aa => { aa.checked = false });
|
|
|
- });
|
|
|
- }
|
|
|
- if (x.stage) {
|
|
|
- x.stage.forEach(s => {
|
|
|
- if (s.att) s.att.forEach(sa => { sa.checked = false });
|
|
|
- })
|
|
|
- }
|
|
|
- });
|
|
|
+ const tenderTree = this.tenderTree;
|
|
|
+ const recursiveFun = function(nodes) {
|
|
|
+ if (!nodes || nodes.length === 0) return;
|
|
|
+
|
|
|
+ nodes.forEach(node => {
|
|
|
+ const x = node.source_node;
|
|
|
+ if (x.tid) {
|
|
|
+ x.selectFiles = [];
|
|
|
+ if (x.att) x.att.forEach(la => { la.checked = false });
|
|
|
+ if (x.advance) {
|
|
|
+ x.advance.forEach(a => {
|
|
|
+ if (a.files) a.files.forEach(aa => { aa.checked = false });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (x.stage) {
|
|
|
+ x.stage.forEach(s => {
|
|
|
+ if (s.att) s.att.forEach(sa => { sa.checked = false });
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ recursiveFun(tenderTree.getNodesByParam('tree_pid', node.id, node));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+ recursiveFun(this.tenderTree.getNodes());
|
|
|
}
|
|
|
refreshSelectHint(){
|
|
|
- if (this.curTender) {
|
|
|
+ if (this.curTender && this.curTender.source_node.tid) {
|
|
|
$('#cur-tender-hint').html(`当前标段,已选${this.curTender.source_node.selectFiles.length}文件`);
|
|
|
} else {
|
|
|
$('#cur-tender-hint').html('');
|
|
|
}
|
|
|
- const nodes = this.tenderTree.getNodes();
|
|
|
- const selectTenders = nodes.filter(x => { return x.source_node.selectFiles.length > 0; });
|
|
|
+ const nodes = this.tenderTree.transformToArray(this.tenderTree.getNodes());
|
|
|
+ const selectTenders = nodes.filter(x => { return x.tid && x.source_node.selectFiles.length > 0; });
|
|
|
if (selectTenders.length > 0) {
|
|
|
const count = selectTenders.reduce((rst, x) => { return rst + x.source_node.selectFiles.length; }, 0);
|
|
|
$('#rela-file-hint').html(`已选择${selectTenders.length}个标段,共${count}个文件`);
|
|
@@ -1038,11 +1047,17 @@ $(document).ready(function() {
|
|
|
async showRelaFile(){
|
|
|
$('#rela-filing-hint').html(`当前目录:${filingObj.getCurFilingFullPath()}`);
|
|
|
if (!this.tenderTree) {
|
|
|
- const tenders = await postDataAsync('file/rela/tender', {});
|
|
|
- const sortNodes = tenders.map(x => {
|
|
|
- return { id: x.id, tree_pid: -1, name: x.name, source_node: x, icon: '/public/css/ztree/img/diy/11.png' };
|
|
|
+ const data = await postDataAsync('file/rela/tender', {});
|
|
|
+ const tenderPathTree = Tender2Tree.convert(data.category, data.tenders, null, null, function(node, source) {
|
|
|
+ _.assign(node, source);
|
|
|
+ }, data.selfCategoryLevel);
|
|
|
+ const sortNodes = tenderPathTree.nodes.map(x => {
|
|
|
+ const data = { id: x.tmt_id, tree_pid: x.tmt_pid, name: x.name, source_node: x };
|
|
|
+ if (x.tid) data.icon = '/public/css/ztree/img/diy/11.png';
|
|
|
+ return data;
|
|
|
});
|
|
|
this.tenderTree = this.filingTree = $.fn.zTree.init($('#rela-tender'), this.treeSetting, sortNodes);
|
|
|
+ this.tenderTree.expandAll(true);
|
|
|
}
|
|
|
this.clearFileSelect();
|
|
|
this.refreshSelectHint();
|
|
@@ -1082,7 +1097,7 @@ $(document).ready(function() {
|
|
|
}
|
|
|
refreshTenderFileSubType() {
|
|
|
const type = this.tenderFileType.find(x => { return x.value === this.rfType.type});
|
|
|
- if (type.subType && type.subType.length > 0) {
|
|
|
+ if (type && type.subType && type.subType.length > 0) {
|
|
|
this.rfType.sub_type = type.subType[0].value;
|
|
|
const html= [];
|
|
|
for (const tfst of type.subType) {
|
|
@@ -1102,18 +1117,6 @@ $(document).ready(function() {
|
|
|
}
|
|
|
refreshSelects(tender) {
|
|
|
this.tenderFileType = [];
|
|
|
- this.tenderFileType.push({ value: 'ledger', text: '台账附件' });
|
|
|
- if (tender.stage && tender.stage.length > 0) {
|
|
|
- const stages = tender.stage.map(x => { return {value: x.id, text: `第${x.order}期`}; });
|
|
|
- this.tenderFileType.push({
|
|
|
- value: 'stage', text: '计量期',
|
|
|
- subType: [
|
|
|
- { value: 'att', text: '计量附件', stage: JSON.parse(JSON.stringify(stages)) },
|
|
|
- { value: 'dealPay', text: '合同支付', stage: JSON.parse(JSON.stringify(stages)) },
|
|
|
- { value: 'stageIm', text: '中间计量', stage: JSON.parse(JSON.stringify(stages)) },
|
|
|
- ],
|
|
|
- });
|
|
|
- }
|
|
|
if (tender.advance && tender.advance.length > 0) {
|
|
|
const advanceType = [];
|
|
|
tender.advance.forEach(x => {
|
|
@@ -1128,6 +1131,18 @@ $(document).ready(function() {
|
|
|
value: 'advance', text: '预付款', subType: advanceType
|
|
|
});
|
|
|
}
|
|
|
+ if (tender.tid) this.tenderFileType.push({ value: 'ledger', text: '台账附件' });
|
|
|
+ if (tender.stage && tender.stage.length > 0) {
|
|
|
+ const stages = tender.stage.map(x => { return {value: x.id, text: `第${x.order}期`}; });
|
|
|
+ this.tenderFileType.push({
|
|
|
+ value: 'stage', text: '计量期',
|
|
|
+ subType: [
|
|
|
+ { value: 'att', text: '计量附件', stage: JSON.parse(JSON.stringify(stages)) },
|
|
|
+ { value: 'dealPay', text: '合同支付', stage: JSON.parse(JSON.stringify(stages)) },
|
|
|
+ { value: 'stageIm', text: '中间计量', stage: JSON.parse(JSON.stringify(stages)) },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+ }
|
|
|
if (tender.change && tender.change.length > 0) {
|
|
|
const selects = [];
|
|
|
tender.change.forEach(x => {
|
|
@@ -1138,25 +1153,25 @@ $(document).ready(function() {
|
|
|
if (tender.change_plan && tender.change_plan.length > 0) {
|
|
|
const selects = [];
|
|
|
tender.change_plan.forEach(x => {
|
|
|
- selects.push({ value: x.cpid, text: x.code })
|
|
|
+ selects.push({ value: x.id, text: x.code })
|
|
|
});
|
|
|
this.tenderFileType.push({ value: 'change_plan', text: '变更方案', select: selects });
|
|
|
}
|
|
|
- if (tender.change_project && tender.change_project.length > 0) {
|
|
|
- const selects = [];
|
|
|
- tender.change_project.forEach(x => {
|
|
|
- selects.push({ value: x.cid, text: x.code })
|
|
|
- });
|
|
|
- this.tenderFileType.push({ value: 'change_project', text: '变更立项', select: selects });
|
|
|
- }
|
|
|
if (tender.change_apply && tender.change_apply.length > 0) {
|
|
|
const selects = [];
|
|
|
tender.change_apply.forEach(x => {
|
|
|
- selects.push({ value: x.cid, text: x.code })
|
|
|
+ selects.push({ value: x.id, text: x.code })
|
|
|
});
|
|
|
this.tenderFileType.push({ value: 'change_apply', text: '变更申请', select: selects });
|
|
|
}
|
|
|
- this.rfType = { type: this.tenderFileType[0].value };
|
|
|
+ if (tender.change_project && tender.change_project.length > 0) {
|
|
|
+ const selects = [];
|
|
|
+ tender.change_project.forEach(x => {
|
|
|
+ selects.push({ value: x.id, text: x.code })
|
|
|
+ });
|
|
|
+ this.tenderFileType.push({ value: 'change_project', text: '变更立项', select: selects });
|
|
|
+ }
|
|
|
+ this.rfType = { type: tender.tid ? this.tenderFileType[0].value : '' };
|
|
|
this.refreshTenderFileType();
|
|
|
this.refreshTenderFileSubType();
|
|
|
this.refreshTenderFileStage();
|
|
@@ -1259,7 +1274,7 @@ $(document).ready(function() {
|
|
|
async _loadChangePlanFile() {
|
|
|
const rfType = this.rfType;
|
|
|
const change = this.curTender.source_node.change_plan.find(x => {
|
|
|
- return x.id === rfType.selectId;
|
|
|
+ return x.id == rfType.selectId;
|
|
|
});
|
|
|
if (!change) {
|
|
|
this.curFiles = [];
|
|
@@ -1271,7 +1286,7 @@ $(document).ready(function() {
|
|
|
async _loadChangeProjectFile() {
|
|
|
const rfType = this.rfType;
|
|
|
const change = this.curTender.source_node.change_project.find(x => {
|
|
|
- return x.id === rfType.selectId;
|
|
|
+ return x.id == rfType.selectId;
|
|
|
});
|
|
|
if (!change) {
|
|
|
this.curFiles = [];
|
|
@@ -1283,7 +1298,7 @@ $(document).ready(function() {
|
|
|
async _loadChangeApplyFile() {
|
|
|
const rfType = this.rfType;
|
|
|
const change = this.curTender.source_node.change_apply.find(x => {
|
|
|
- return x.id === rfType.selectId;
|
|
|
+ return x.id == rfType.selectId;
|
|
|
});
|
|
|
if (!change) {
|
|
|
this.curFiles = [];
|
|
@@ -1301,6 +1316,7 @@ $(document).ready(function() {
|
|
|
case 'change_plan': await this._loadChangePlanFile(); break;
|
|
|
case 'change_project': await this._loadChangeProjectFile(); break;
|
|
|
case 'change_apply': await this._loadChangeApplyFile(); break;
|
|
|
+ default: this.curFiles = [];
|
|
|
}
|
|
|
this.initFilesId(this.curFiles);
|
|
|
}
|
|
@@ -1313,9 +1329,9 @@ $(document).ready(function() {
|
|
|
}
|
|
|
getSelectRelaFile() {
|
|
|
const data = [];
|
|
|
- const nodes = this.tenderTree.getNodes();
|
|
|
+ const nodes = this.tenderTree.transformToArray(this.tenderTree.getNodes());
|
|
|
nodes.forEach(node => {
|
|
|
- if (node.source_node.selectFiles.length === 0) return;
|
|
|
+ if (!node.source_node.selectFiles || node.source_node.selectFiles.length === 0) return;
|
|
|
|
|
|
node.source_node.selectFiles.forEach(x => {
|
|
|
data.push({
|