|
|
@@ -467,7 +467,7 @@ $(document).ready(() => {
|
|
|
if (compareObj.finalInfo) {
|
|
|
this.selectTree.datas.forEach(x => {
|
|
|
x.selected = compareObj.finalInfo.tender.indexOf(x.tid + '') >= 0;
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
const sfSpreadSetting = {
|
|
|
cols: [
|
|
|
@@ -486,11 +486,31 @@ $(document).ready(() => {
|
|
|
selectedBackColor: '#fffacd',
|
|
|
readOnly: true,
|
|
|
};
|
|
|
- this.spread = SpreadJsObj.createNewSpread($('#sf-spread')[0]);
|
|
|
+ this.spread = SpreadJsObj.createNewSpread($('#sf-tender-spread')[0]);
|
|
|
this.sheet = this.spread.getActiveSheet();
|
|
|
SpreadJsObj.initSheet(this.sheet, sfSpreadSetting);
|
|
|
SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Tree, this.selectTree);
|
|
|
|
|
|
+ this.contractTree = createNewPathTree('base', { id: 'contract_id', pid: 'contract_pid', order: 'order', level: 'level', fullPath: 'full_path', rootId: -1 });
|
|
|
+ this.contractTree.loadDatas(contract);
|
|
|
+ this.contractSpread = SpreadJsObj.createNewSpread($('#sf-contract-spread')[0]);
|
|
|
+ this.contractSheet = this.contractSpread.getActiveSheet();
|
|
|
+ SpreadJsObj.initSheet(this.contractSheet, {
|
|
|
+ cols: [
|
|
|
+ {title: '选择', colSpan: '1', rowSpan: '1', field: 'selected', hAlign: 1, width: 40, formatter: '@', cellType: 'checkbox'},
|
|
|
+ {title: '编号', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 120, formatter: '@', cellType: 'tree'},
|
|
|
+ {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 200, formatter: '@'},
|
|
|
+ ],
|
|
|
+ emptyRows: 0,
|
|
|
+ headRows: 1,
|
|
|
+ headRowHeight: [32],
|
|
|
+ defaultRowHeight: 21,
|
|
|
+ headerFont: '12px 微软雅黑',
|
|
|
+ font: '12px 微软雅黑',
|
|
|
+ readOnly: true,
|
|
|
+ });
|
|
|
+ SpreadJsObj.loadSheetData(this.contractSheet, SpreadJsObj.DataType.Tree, this.contractTree);
|
|
|
+
|
|
|
this.spread.bind(spreadNS.Events.ButtonClicked, function (e, info) {
|
|
|
if (!info.sheet.zh_setting) return;
|
|
|
|
|
|
@@ -502,6 +522,24 @@ $(document).ready(() => {
|
|
|
SpreadJsObj.reloadColData(info.sheet, 0);
|
|
|
});
|
|
|
|
|
|
+ this.contractSpread.bind(spreadNS.Events.ButtonClicked, function (e, info) {
|
|
|
+ if (!info.sheet.zh_setting) return;
|
|
|
+
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ if (col.field !== 'selected') return;
|
|
|
+
|
|
|
+ const node = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ self.selectContract(node, !node[col.field]);
|
|
|
+ SpreadJsObj.reloadColData(info.sheet, 0);
|
|
|
+ });
|
|
|
+
|
|
|
+ $('[name=sf-tab]').click(function() {
|
|
|
+ const content = this.getAttribute('href');
|
|
|
+ if (content === '#sf-contract') {
|
|
|
+ self.contractSpread.refresh();
|
|
|
+ }
|
|
|
+ if (content === '#sf-tender') self.spread.refresh();
|
|
|
+ });
|
|
|
|
|
|
$('#sf-select-all').click(function() {
|
|
|
for (const n of self.selectTree.nodes) {
|
|
|
@@ -527,7 +565,8 @@ $(document).ready(() => {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- const data = { final_id: compareObj.curFinalId(), id: rela, final_type: $('[name=final_type]:checked').val(), stage };
|
|
|
+ const contracts = self.getSelectContracts();
|
|
|
+ const data = { final_id: compareObj.curFinalId(), id: rela, final_type: $('[name=final_type]:checked').val(), stage, contracts };
|
|
|
postData(window.location.pathname + '/final', data, function(result, msg) {
|
|
|
compareObj.loadFinalData(result, msg);
|
|
|
$('#select-final').modal('hide');
|
|
|
@@ -549,6 +588,19 @@ $(document).ready(() => {
|
|
|
p.selected = select;
|
|
|
}
|
|
|
}
|
|
|
+ selectContract(node, select) {
|
|
|
+ const posterity = this.contractTree.getPosterity(node);
|
|
|
+ posterity.unshift(node);
|
|
|
+ for (const p of posterity) {
|
|
|
+ if (p) p.selected = select;
|
|
|
+ }
|
|
|
+ if (select) {
|
|
|
+ const parents = this.contractTree.getAllParents(node);
|
|
|
+ for(const p of parents) {
|
|
|
+ if (p) p.selected = select;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
getSelects() {
|
|
|
const select = [];
|
|
|
for (const n of this.selectTree.nodes) {
|
|
|
@@ -556,6 +608,10 @@ $(document).ready(() => {
|
|
|
}
|
|
|
return select;
|
|
|
}
|
|
|
+ getSelectContracts() {
|
|
|
+ const select = this.contractTree.nodes.filter(x => { return !!x.selected; }).map(x => { return x.id; });
|
|
|
+ return select;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$('#select-final').on('shown.bs.modal', () => {
|