main_col_lib.js 22 KB

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