main_col_lib.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. /**
  2. * Created by zhang on 2018/7/14.
  3. */
  4. $(document).ready(function() {
  5. $('#add').on('show.bs.modal', function () {
  6. $('#compilationSels').empty();
  7. mainAjax.getCompilationList();
  8. });
  9. // 保存按钮
  10. $("#addMainCol").click(function() {
  11. let name = $('#name').val();
  12. if(name==''){
  13. $("#nameError").show();
  14. return;
  15. }else {
  16. $("#addMainCol").addClass("disabled");//防止重复提交
  17. $("#addMainLibForm").submit();
  18. }
  19. });
  20. //删除按钮
  21. $("#delete").click(function() {
  22. let libID = $("#libID_del").val();
  23. let delCount = parseInt($("#delCount").val());
  24. delCount = delCount+1;
  25. $("#delCount").val(delCount)
  26. if(delCount == 3){//连续点3次才做真删除
  27. if(libID!=""){
  28. CommonAjax.post("/mainTreeCol/deleteLibByID",{ID:libID},function (data) {
  29. if(data.ok){
  30. $("#"+libID).parent(".libTr").remove();
  31. }
  32. $("#del").modal('hide');
  33. });
  34. }
  35. }
  36. });
  37. $('.lock').click(function () {
  38. lockUtil.handleLockClick($(this));
  39. });
  40. });
  41. let colEditSpread = null;
  42. let mainTreeCol = null;
  43. function getMainColLib(ID) {
  44. CommonAjax.post("/mainTreeCol/getLibByID",{libID:ID},function (data) {
  45. console.log(data);
  46. $("#renameText").val(data.name);
  47. mainTreeCol = data.main_tree_col;
  48. $("#libID").val(ID);
  49. $("#set-column").modal({show:true});
  50. });
  51. }
  52. function showDeleteModal(ID){
  53. $("#libID_del").val(ID);
  54. $("#delCount").val(0);
  55. $("#del").modal({show:true});
  56. }
  57. /**
  58. * Created by Mai on 2017/8/14.
  59. */
  60. let ColSettingObj = {
  61. colSetting: null,
  62. DEFAULT_TITLE_STYLE: null,
  63. DEFAULT_DATA_STYLE: null,
  64. cellType: {
  65. getText: null,
  66. cellType: null,
  67. readOnly: null,
  68. checkBox: null
  69. },
  70. Rows: {data: 0, filedName: 0, getText: 1, wordWrap: 2, cellType: 3, width: 4, readOnly: 5, showHint: 6, visible: 7, customize: 8},
  71. columnValueChanged: function (e, info) {
  72. let that = ColSettingObj;
  73. info.colList.forEach(function (iCol) {
  74. info.sheet.setValue(that.colSetting.headRows + that.Rows.width, iCol, info.sheet.getColumnWidth(iCol), GC.Spread.Sheets.SheetArea.viewport);
  75. });
  76. },
  77. valueChanged: function (e, info) {
  78. let that = ColSettingObj;
  79. if (info.row === that.colSetting.headRows + that.Rows.width) {
  80. info.sheet.setColumnWidth(info.col, info.newValue, GC.Spread.Sheets.SheetArea.viewport);
  81. }
  82. },
  83. selectionChanged: function (e, info) {
  84. let that = ColSettingObj, sel = info.newSelections[0];
  85. if (sel.row <= that.colSetting.headRows) {
  86. $('.btn-toolbar').removeClass('disabled');
  87. $('#font').val(info.sheet.getCell(sel.row, sel.col, GC.Spread.Sheets.SheetArea.viewport).font());
  88. } else {
  89. $('.btn-toolbar').addClass('disabled');
  90. }
  91. },
  92. getCellStyle: function (font, hAlign, vAlign) {
  93. var style = new GC.Spread.Sheets.Style();
  94. style.font = font;
  95. style.hAlign = hAlign;
  96. style.vAlign = vAlign;
  97. style.wordWrap = true;
  98. return style;
  99. },
  100. getSettingItems: function (type, items) {
  101. let events = MainTreeCol[type];
  102. for (let prop in events) {
  103. if (typeof(events[prop]) === 'function') {
  104. items.push(type + '.' + prop);
  105. }
  106. }
  107. },
  108. initCellType: function () {
  109. this.cellType.readOnly = new GC.Spread.Sheets.CellTypes.ComboBox();
  110. let readOnlyItems = [true, false];
  111. this.getSettingItems('readOnly', readOnlyItems);
  112. this.cellType.readOnly.items(readOnlyItems);
  113. this.cellType.getText = new GC.Spread.Sheets.CellTypes.ComboBox();
  114. let getTextItems = [];
  115. this.getSettingItems('getText', getTextItems);
  116. this.cellType.getText.items(getTextItems);
  117. this.cellType.cellType = new GC.Spread.Sheets.CellTypes.ComboBox();
  118. let cellTypeItems = [];
  119. this.getSettingItems('cellType', cellTypeItems)
  120. this.cellType.cellType.items(cellTypeItems);
  121. this.cellType.checkBox = new GC.Spread.Sheets.CellTypes.CheckBox();
  122. },
  123. initSheet: function (sheet, setting) {
  124. let initColProperty = function (iRow, title) {
  125. sheet.setText(setting.headRows + iRow, 0, title, GC.Spread.Sheets.SheetArea.rowHeader);
  126. sheet.addSpan(setting.headRows + iRow, 0, 1, 2, GC.Spread.Sheets.SheetArea.rowHeader);
  127. };
  128. sheet.setColumnCount(2, GC.Spread.Sheets.SheetArea.rowHeader);
  129. sheet.setColumnWidth(0, 80, GC.Spread.Sheets.SheetArea.rowHeader);
  130. sheet.setColumnWidth(1, 70, GC.Spread.Sheets.SheetArea.rowHeader);
  131. sheet.setRowCount(setting.headRows + this.Rows.customize + 1);
  132. sheet.setText(setting.headRows + this.Rows.data, 0, 'Data', GC.Spread.Sheets.SheetArea.rowHeader);
  133. sheet.setStyle(setting.headRows + this.Rows.data, -1, this.DEFAULT_DATA_STYLE);
  134. sheet.addSpan(setting.headRows + this.Rows.data, 0, this.Rows.wordWrap + 1, 1, GC.Spread.Sheets.SheetArea.rowHeader);
  135. sheet.setText(setting.headRows + this.Rows.filedName, 1, 'FieldName', GC.Spread.Sheets.SheetArea.rowHeader);
  136. sheet.setText(setting.headRows + this.Rows.getText, 1, 'getText', GC.Spread.Sheets.SheetArea.rowHeader);
  137. sheet.setText(setting.headRows + this.Rows.wordWrap, 1, 'wordWrap', GC.Spread.Sheets.SheetArea.rowHeader);
  138. initColProperty(this.Rows.width, 'Width');
  139. initColProperty(this.Rows.readOnly, 'ReadOnly');
  140. initColProperty(this.Rows.showHint, 'ShowHint');
  141. initColProperty(this.Rows.visible, 'Visible');
  142. initColProperty(this.Rows.cellType, 'CellType');
  143. initColProperty(this.Rows.customize, 'Customize');
  144. },
  145. initColSetting: function (setting) {
  146. this.DEFAULT_TITLE_STYLE = this.getCellStyle('Arial', GC.Spread.Sheets.HorizontalAlign.center, GC.Spread.Sheets.VerticalAlign.center);
  147. this.DEFAULT_DATA_STYLE = this.getCellStyle('Arial', GC.Spread.Sheets.HorizontalAlign.left, GC.Spread.Sheets.VerticalAlign.center);
  148. this.initCellType();
  149. $('#empty-rows').val(setting.emptyRows);
  150. $('#col-count').val(setting.cols ? setting.cols.length : 0);
  151. $('#header-row-count').val(setting.headRows);
  152. colEditSpread = new GC.Spread.Sheets.Workbook($('#colEditSpread')[0], {sheetCount: 1});
  153. colEditSpread.getActiveSheet().setRowCount(0);
  154. colEditSpread.getActiveSheet().setColumnCount(0);
  155. colEditSpread.options.tabStripVisible = false;
  156. colEditSpread.bind(GC.Spread.Sheets.Events.ColumnWidthChanged, this.columnValueChanged);
  157. colEditSpread.bind(GC.Spread.Sheets.Events.ValueChanged, this.valueChanged);
  158. colEditSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, this.selectionChanged);
  159. colEditSpread.getActiveSheet().suspendPaint();
  160. this.initSheet(colEditSpread.getActiveSheet(), setting);
  161. this.setColCount(this.colSetting.cols.length);
  162. this.setHeaderRowCount(this.colSetting.headRows);
  163. // headerHeight
  164. for (let iRow in this.colSetting.headRowHeight) {
  165. colEditSpread.getActiveSheet().setRowHeight(iRow, this.colSetting.headRowHeight[iRow], GC.Spread.Sheets.SheetArea.viewport);
  166. }
  167. if (setting.treeCol >= 0) {
  168. $('#is-tree')[0].checked = true;
  169. $('#tree-col-div').removeClass('hidden');
  170. $('#tree-col').val(setting.treeCol);
  171. } else {
  172. $('#is-tree')[0].checked = false;
  173. $('#tree-col-div').addClass('hidden');
  174. }
  175. if (setting.cols) {
  176. let sheet = colEditSpread.getActiveSheet(), iRow;
  177. for (let iCol = 0; iCol < setting.cols.length; iCol++) {
  178. let col = setting.cols[iCol], iRow = 0;
  179. // header
  180. for (let i in col.head.spanCols) {
  181. if (col.head.spanCols[i] !== 0) {
  182. let cell = sheet.getCell(iRow, iCol, GC.Spread.Sheets.SheetArea.viewport);
  183. cell.value(col.head.titleNames[i]).font(col.head.font[i]).hAlign(col.head.hAlign[i]).vAlign(col.head.vAlign[i]);
  184. }
  185. if (col.head.spanCols[i] > 1 || col.head.spanRows[i] > 1) {
  186. sheet.addSpan(iRow, iCol, col.head.spanRows[i], col.head.spanCols[i], GC.Spread.Sheets.SheetArea.viewport);
  187. }
  188. iRow += col.head.spanRows[i];
  189. };
  190. // data
  191. // field
  192. let cell = sheet.getCell(this.colSetting.headRows + this.Rows.data, iCol, GC.Spread.Sheets.SheetArea.viewport);
  193. cell.value(col.data.field).font(col.data.font).hAlign(col.data.hAlign).vAlign(col.data.vAlign);
  194. // getText
  195. cell = sheet.getCell(this.colSetting.headRows + this.Rows.getText, iCol, GC.Spread.Sheets.SheetArea.viewport);
  196. cell.cellType(this.cellType.getText).value(col.data.getText).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
  197. // wordWrap
  198. cell = sheet.getCell(this.colSetting.headRows + this.Rows.wordWrap, iCol, GC.Spread.Sheets.SheetArea.viewport);
  199. cell.cellType(this.cellType.checkBox).value(col.data.wordWrap).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
  200. // cellType
  201. cell = sheet.getCell(this.colSetting.headRows + this.Rows.cellType, iCol, GC.Spread.Sheets.SheetArea.viewport);
  202. cell.cellType(this.cellType.cellType).value(col.data.cellType).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
  203. // 列宽
  204. sheet.setColumnWidth(iCol, col.width);
  205. sheet.setValue(this.colSetting.headRows + this.Rows.width, iCol, sheet.getColumnWidth(iCol), GC.Spread.Sheets.SheetArea.viewport);
  206. // readonly
  207. cell = sheet.getCell(this.colSetting.headRows + this.Rows.readOnly, iCol, GC.Spread.Sheets.SheetArea.viewport);
  208. cell.cellType(this.cellType.readOnly).value(col.readOnly).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
  209. // showHint
  210. cell = sheet.getCell(this.colSetting.headRows + this.Rows.showHint, iCol, GC.Spread.Sheets.SheetArea.viewport);
  211. cell.cellType(this.cellType.checkBox).value(col.showHint).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
  212. // visible
  213. cell = sheet.getCell(this.colSetting.headRows + this.Rows.visible, iCol, GC.Spread.Sheets.SheetArea.viewport);
  214. cell.cellType(this.cellType.checkBox).value(col.visible).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
  215. // customize
  216. cell = sheet.getCell(this.colSetting.headRows + this.Rows.customize, iCol, GC.Spread.Sheets.SheetArea.viewport);
  217. cell.cellType(this.cellType.checkBox).value(col.customize).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
  218. }
  219. }
  220. colEditSpread.getActiveSheet().resumePaint();
  221. let cell = colEditSpread.getActiveSheet().getCell(0, 0, GC.Spread.Sheets.SheetArea.viewport);
  222. if (cell) {
  223. $('#font').val(cell.font());
  224. }
  225. },
  226. setColCount: function (count) {
  227. let sheet = colEditSpread.getActiveSheet();
  228. let orgCount = sheet.getColumnCount();
  229. sheet.setColumnCount(count);
  230. for (let iCol = orgCount; iCol < count; iCol++) {
  231. for (let iRow = 0; iRow < this.colSetting.headRows; iRow ++) {
  232. sheet.setStyle(iRow, iCol, this.DEFAULT_TITLE_STYLE);
  233. }
  234. sheet.getCell(this.colSetting.headRows + this.Rows.getText, iCol).cellType(this.cellType.getText).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
  235. sheet.getCell(this.colSetting.headRows + this.Rows.wordWrap, iCol).cellType(this.cellType.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
  236. sheet.getCell(this.colSetting.headRows + this.Rows.cellType, iCol).cellType(this.cellType.cellType).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
  237. sheet.setValue(this.colSetting.headRows + this.Rows.width, iCol, sheet.getColumnWidth(iCol), GC.Spread.Sheets.SheetArea.viewport);
  238. sheet.getCell(this.colSetting.headRows + this.Rows.readOnly, iCol).cellType(this.cellType.readOnly).hAlign(GC.Spread.Sheets.HorizontalAlign.right);
  239. sheet.setValue(this.colSetting.headRows + this.Rows.readOnly, iCol, false, GC.Spread.Sheets.SheetArea.viewport);
  240. sheet.getCell(this.colSetting.headRows + this.Rows.showHint, iCol).cellType(this.cellType.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
  241. sheet.getCell(this.colSetting.headRows + this.Rows.visible, iCol).cellType(this.cellType.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center).value(true);
  242. sheet.getCell(this.colSetting.headRows + this.Rows.customize, iCol).cellType(this.cellType.checkBox).hAlign(GC.Spread.Sheets.HorizontalAlign.center).value(false);
  243. }
  244. },
  245. setHeaderRowCount: function (count) {
  246. let sheet = colEditSpread.getActiveSheet(), orgCount = this.colSetting.headRows;
  247. if (count < orgCount) {
  248. sheet.deleteRows(count, orgCount - count);
  249. } else if (count > orgCount) {
  250. sheet.addRows(orgCount, count - orgCount);
  251. sheet.addSpan(0, 0, count, 1, GC.Spread.Sheets.SheetArea.rowHeader);
  252. for (let iRow = orgCount; iRow < count; iRow++) {
  253. sheet.setStyle(iRow, -1, this.DEFAULT_TITLE_STYLE);
  254. }
  255. }
  256. },
  257. getActualCellRange: function (cellRange, rowCount, columnCount) {
  258. let spreadNS = GC.Spread.Sheets;
  259. if (cellRange.row == -1 && cellRange.col == -1) {
  260. return new spreadNS.Range(0, 0, rowCount, columnCount);
  261. }
  262. else if (cellRange.row == -1) {
  263. return new spreadNS.Range(0, cellRange.col, rowCount, cellRange.colCount);
  264. }
  265. else if (cellRange.col == -1) {
  266. return new spreadNS.Range(cellRange.row, 0, cellRange.rowCount, columnCount);
  267. }
  268. return cellRange;
  269. },
  270. // 批量操作Spread选择的单元格
  271. controlSelectCells: function (spread, control) {
  272. let sheet = colEditSpread.getActiveSheet();
  273. let sel = sheet.getSelections(), i, j;
  274. sel = this.getActualCellRange(sel[sel.length - 1], sheet.getRowCount(), sheet.getColumnCount());
  275. for (i = 0; i < sel.rowCount; i++) {
  276. for (j = 0; j < sel.colCount; j++) {
  277. control(sheet.getCell(sel.row + i, sel.col + j));
  278. }
  279. }
  280. },
  281. generateColSetting: function () {
  282. let setting = {}, sheet = colEditSpread.getActiveSheet();
  283. setting.emptyRows = parseInt($('#empty-rows').val());
  284. setting.headRows = parseInt($('#header-row-count').val());
  285. if ($('#is-tree')[0].checked) {
  286. setting.treeCol = parseInt($('#tree-col').val());
  287. }
  288. setting.headRowHeight = [];
  289. for (let iRow = 0; iRow < setting.headRows; iRow++) {
  290. setting.headRowHeight.push(sheet.getRowHeight(iRow, GC.Spread.Sheets.SheetArea.viewport));
  291. };
  292. setting.cols = [];
  293. for (let iCol = 0; iCol < sheet.getColumnCount(); iCol++) {
  294. let col = {};
  295. col.width = sheet.getColumnWidth(iCol);
  296. col.readOnly = sheet.getValue(setting.headRows + this.Rows.readOnly, iCol) || false;
  297. if (sheet.getValue(setting.headRows + this.Rows.showHint, iCol)) {
  298. col.showHint = sheet.getValue(setting.headRows + this.Rows.showHint, iCol) || false;
  299. }
  300. col.visible = sheet.getValue(setting.headRows + this.Rows.visible, iCol) || false;
  301. col.customize = sheet.getValue(setting.headRows + this.Rows.customize, iCol) || false;
  302. col.head = {};
  303. col.head.titleNames = [];
  304. col.head.spanCols = [];
  305. col.head.spanRows = [];
  306. col.head.vAlign = [];
  307. col.head.hAlign = [];
  308. col.head.font = [];
  309. for (let iRow = 0; iRow < setting.headRows; iRow++) {
  310. let cell = sheet.getCell(iRow, iCol);
  311. col.head.titleNames.push(cell.text());
  312. let span = sheet.getSpan(iRow, iCol);
  313. if (span) {
  314. if (span.col === iCol && span.row === iRow) {
  315. col.head.spanCols.push(span.colCount);
  316. col.head.spanRows.push(span.rowCount);
  317. } else {
  318. col.head.spanCols.push(0);
  319. col.head.spanRows.push(1);
  320. }
  321. } else {
  322. col.head.spanCols.push(1);
  323. col.head.spanRows.push(1);
  324. }
  325. col.head.vAlign.push(cell.vAlign());
  326. col.head.hAlign.push(cell.hAlign());
  327. col.head.font.push(cell.font());
  328. }
  329. col.data = {};
  330. let cell = sheet.getCell(setting.headRows, iCol);
  331. col.data.field = cell.text();
  332. col.data.vAlign = cell.vAlign();
  333. col.data.hAlign = cell.hAlign();
  334. col.data.font = cell.font();
  335. // getText
  336. cell = sheet.getCell(setting.headRows + this.Rows.getText, iCol);
  337. if (cell.text() !== '') {
  338. col.data.getText = cell.text();
  339. }
  340. // wordWrap
  341. col.data.wordWrap = sheet.getValue(setting.headRows + this.Rows.wordWrap, iCol) || false;
  342. // cellType
  343. cell = sheet.getCell(setting.headRows + this.Rows.cellType, iCol);
  344. if (cell.text() !== '') {
  345. col.data.cellType = cell.text();
  346. }
  347. setting.cols.push(col);
  348. }
  349. return setting;
  350. }
  351. };
  352. $('#set-column').on('shown.bs.modal', function () {
  353. if(colEditSpread) colEditSpread.destroy();
  354. ColSettingObj.colSetting = mainTreeCol;
  355. ColSettingObj.initColSetting(ColSettingObj.colSetting);
  356. });
  357. /*$('#set-glj-col').on('show.bs.modal', function () {
  358. let glj_col_setting = JSON.parse($("#glj_col").val());
  359. if(glj_col_setting.showAdjustPrice){
  360. $('#adjustPrice_cb').prop('checked',true);
  361. }else {
  362. $('#adjustPrice_cb').prop('checked',false);
  363. }
  364. });*/
  365. $('#set-glj-comf').click(function () {
  366. let showAdjustPrice = $('#adjustPrice_cb').prop('checked');
  367. let glj_col_setting = {
  368. showAdjustPrice :showAdjustPrice
  369. };
  370. $("#glj_col").val(JSON.stringify(glj_col_setting));
  371. });
  372. $('#col-count').change(function () {
  373. ColSettingObj.setColCount(parseInt($(this).val()));
  374. });
  375. $('#header-row-count').change(function () {
  376. ColSettingObj.setHeaderRowCount(parseInt($(this).val()));
  377. ColSettingObj.colSetting.headRows = parseInt($(this).val());
  378. });
  379. $('#is-tree').click(function () {
  380. if (this.checked) {
  381. $('#tree-col-div').removeClass('hidden');
  382. } else {
  383. $('#tree-col-div').addClass('hidden');
  384. }
  385. });
  386. $('#merge').click(function () {
  387. let sheet = colEditSpread.getActiveSheet();
  388. let sel = sheet.getSelections();
  389. if (sel.length > 0) {
  390. sel = ColSettingObj.getActualCellRange(sel[sel.length - 1], sheet.getRowCount(), sheet.getColumnCount());
  391. if (sel.row + sel.rowCount > ColSettingObj.colSetting.headRows) {
  392. alert('仅HeaderTitle部分可以合并单元格');
  393. } else {
  394. sheet.addSpan(sel.row, sel.col, sel.rowCount, sel.colCount);
  395. //sheet.setTag(sel.row, sel.col, 1);
  396. }
  397. }
  398. });
  399. $('#unmerge').click(function () {
  400. let sheet = colEditSpread.getActiveSheet();
  401. let sel = sheet.getSelections();
  402. if (sel.length > 0) {
  403. sel = ColSettingObj.getActualCellRange(sel[sel.length - 1], sheet.getRowCount(), sheet.getColumnCount());
  404. sheet.suspendPaint();
  405. for (var i = 0; i < sel.rowCount; i++) {
  406. for (var j = 0; j < sel.colCount; j++) {
  407. sheet.removeSpan(i + sel.row, j + sel.col);
  408. }
  409. }
  410. sheet.resumePaint();
  411. }
  412. });
  413. $('#save-col-setting').click(function () {
  414. ColSettingObj.colSetting = ColSettingObj.generateColSetting();
  415. let mainTreeColString = JSON.stringify(ColSettingObj.colSetting);
  416. let libID = $("#libID").val();
  417. let name = $('#renameText').val();
  418. if(libID!=''){
  419. if(name ==''){
  420. $("#renameError").show();
  421. return;
  422. }else {
  423. CommonAjax.post("/mainTreeCol/saveLib",{query:{ID:libID},data:{name:name,main_tree_col:mainTreeColString}},function (data) {
  424. $("#"+libID).text(data.name);
  425. $('#set-column').modal('hide');
  426. });
  427. }
  428. }
  429. /*let billsTemplateTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1});
  430. billsTemplateTree.loadDatas(JSON.parse(billsTemplateData));
  431. TREE_SHEET_HELPER.loadSheetHeader(ColSettingObj.colSetting, colSpread.getActiveSheet());
  432. TREE_SHEET_HELPER.showTreeData(ColSettingObj.colSetting, colSpread.getActiveSheet(), billsTemplateTree);*/
  433. });
  434. $('#h-left').click(function () {
  435. ColSettingObj.controlSelectCells(colEditSpread, function (cell) {
  436. cell.hAlign(GC.Spread.Sheets.HorizontalAlign.left);
  437. });
  438. });
  439. $('#h-center').click(function () {
  440. ColSettingObj.controlSelectCells(colEditSpread, function (cell) {
  441. cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
  442. });
  443. });
  444. $('#h-right').click(function () {
  445. ColSettingObj.controlSelectCells(colEditSpread, function (cell) {
  446. cell.hAlign(GC.Spread.Sheets.HorizontalAlign.right);
  447. });
  448. });
  449. $('#v-top').click(function () {
  450. ColSettingObj.controlSelectCells(colEditSpread, function (cell) {
  451. cell.vAlign(GC.Spread.Sheets.VerticalAlign.top);
  452. });
  453. });
  454. $('#v-center').click(function () {
  455. ColSettingObj.controlSelectCells(colEditSpread, function (cell) {
  456. cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
  457. });
  458. });
  459. $('#v-bottom').click(function () {
  460. ColSettingObj.controlSelectCells(colEditSpread, function (cell) {
  461. cell.vAlign(GC.Spread.Sheets.VerticalAlign.bottom);
  462. });
  463. });
  464. $('#set-font').click(function () {
  465. var sFont = $('#font').val();
  466. ColSettingObj.controlSelectCells(colEditSpread, function (cell) {
  467. cell.font(sFont);
  468. });
  469. });