|
@@ -59,7 +59,7 @@ $(document).ready(function() {
|
|
|
setObjEnable($('#delete'), node);
|
|
|
setObjEnable($('#up-move'), node && node.order > 1);
|
|
|
setObjEnable($('#down-move'), node && !tree.isLastSibling(node));
|
|
|
- setObjEnable($('#up-level'), tree.getParent(node));
|
|
|
+ setObjEnable($('#up-level'), node && tree.getParent(node));
|
|
|
setObjEnable($('#down-level'), node && node.order > 1);
|
|
|
},
|
|
|
/**
|
|
@@ -358,15 +358,12 @@ $(document).ready(function() {
|
|
|
ledgerSpread.bind(GC.Spread.Sheets.Events.ClipboardPasted, treeOperationObj.clipboardPasted);
|
|
|
SpreadJsObj.addDeleteBind(ledgerSpread, treeOperationObj.deletePress);
|
|
|
ledgerSpread.bind(GC.Spread.Sheets.Events.ClipboardChanging, function (e, info) {
|
|
|
- info.copyData.html = SpreadJsObj.getFilterCopyHTML(info.sheet);
|
|
|
- info.copyData.text = SpreadJsObj.getFilterCopyText(info.sheet);
|
|
|
- console.log(info.copyData.text);
|
|
|
+ const copyText = SpreadJsObj.getFilterCopyText(info.sheet);
|
|
|
});
|
|
|
ledgerSpread.bind(GC.Spread.Sheets.Events.ClipboardChanged, function (e, info) {
|
|
|
console.log(info.copyData.text);
|
|
|
});
|
|
|
ledgerSpread.bind(GC.Spread.Sheets.Events.ClipboardPasting, function (e, info) {
|
|
|
- console.log(info.pasteData.text);
|
|
|
});
|
|
|
|
|
|
// 绑定 删除等 顶部按钮
|
|
@@ -474,4 +471,89 @@ $(document).ready(function() {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-});
|
|
|
+
|
|
|
+ let stdChapter, stdBills;
|
|
|
+ // 展开收起标准清单
|
|
|
+ $('a', '#std-lib').bind('click', function () {
|
|
|
+ const tab = $(this), tabPanel = $(tab.attr('content'));
|
|
|
+ const showSideTools = function (show) {
|
|
|
+ if (show) {
|
|
|
+ $('.c-body.col-12').removeClass('col-12').addClass('col-8');
|
|
|
+ $('.c-body.col-0').removeClass('col-0').addClass('col-4').show();
|
|
|
+ } else {
|
|
|
+ $('.c-body.col-8').removeClass('col-8').addClass('col-12');
|
|
|
+ $('.c-body.col-4').removeClass('col-4').addClass('col-0').hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!tab.hasClass('active')) {
|
|
|
+ $('a', '#std-lib').removeClass('active');
|
|
|
+ tab.addClass('active');
|
|
|
+ showSideTools(tab.hasClass('active'));
|
|
|
+ $('.tab-content .tab-pane').hide();
|
|
|
+ tabPanel.show();
|
|
|
+ if (tab.attr('content') === '#std-chapter' && !stdChapter) {
|
|
|
+ stdChapter = new stdLib($('#std-chapter-spread')[0], '/std/chapter', {
|
|
|
+ id: 'chapter_id',
|
|
|
+ pid: 'pid',
|
|
|
+ order: 'order',
|
|
|
+ level: 'level',
|
|
|
+ rootId: -1,
|
|
|
+ keys: ['id', 'list_id', 'chapter_id'],
|
|
|
+ }, {
|
|
|
+ cols: [
|
|
|
+ {title: '项目节编号', field: 'code', width: 120, cellType: 'tree'},
|
|
|
+ {title: '名称', field: 'name', width: 230},
|
|
|
+ {title: '单位', field: 'unit', width: 50}
|
|
|
+ ],
|
|
|
+ treeCol: 0,
|
|
|
+ emptyRows: 0
|
|
|
+ });
|
|
|
+ stdChapter.loadLib(1);
|
|
|
+ } else if (tab.attr('content') === '#std-bills' && !stdBills) {
|
|
|
+ stdBills = new stdLib($('#std-bills-spread')[0], '/std/bills', {
|
|
|
+ id: 'bill_id',
|
|
|
+ pid: 'pid',
|
|
|
+ order: 'order',
|
|
|
+ level: 'level',
|
|
|
+ rootId: -1,
|
|
|
+ keys: ['id', 'list_id', 'bill_id']
|
|
|
+ }, {
|
|
|
+ cols: [
|
|
|
+ {title: '清单编号', field: 'code', width: 120, cellType: 'tree'},
|
|
|
+ {title: '名称', field: 'name', width: 230},
|
|
|
+ {title: '单位', field: 'unit', width: 50}
|
|
|
+ ],
|
|
|
+ treeCol: 0,
|
|
|
+ emptyRows: 0
|
|
|
+ });
|
|
|
+ stdBills.loadLib(1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tab.removeClass('active');
|
|
|
+ showSideTools(tab.hasClass('active'));
|
|
|
+ tabPanel.hide();
|
|
|
+ }
|
|
|
+ ledgerSpread.refresh();
|
|
|
+ });
|
|
|
+
|
|
|
+ class stdLib {
|
|
|
+ constructor(obj, url, treeSetting, spreadSetting) {
|
|
|
+ this.obj = obj;
|
|
|
+ this.url = url;
|
|
|
+ this.treeSetting = treeSetting;
|
|
|
+ treeSetting.preUrl = url;
|
|
|
+ this.spreadSetting = spreadSetting;
|
|
|
+ this.spread = SpreadJsObj.createNewSpread(this.obj);
|
|
|
+ SpreadJsObj.initSheet(this.spread.getActiveSheet(), this.spreadSetting);
|
|
|
+ this.pathTree = createNewPathTree(this.treeSetting);
|
|
|
+ }
|
|
|
+ loadLib (listId) {
|
|
|
+ const self = this;
|
|
|
+ postData(this.url+'/get-data', {list_id: listId}, function (data) {
|
|
|
+ self.pathTree.loadDatas(data);
|
|
|
+ SpreadJsObj.loadSheetData(self.spread.getActiveSheet(), 'tree', self.pathTree);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+});
|
|
|
+
|