qingdan.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <meta http-equiv="x-ua-compatible" content="ie=edge">
  7. <title>清单规则编辑器</title>
  8. <link rel="stylesheet" href="web/css/bootstrap/bootstrap.min.css">
  9. <!--<link rel="stylesheet" href="../../web/css/bootstrap/themes.css">-->
  10. <link rel="stylesheet" href="web/css/main.css">
  11. <link rel="stylesheet" href="web/css/font-awesome/font-awesome.min.css">
  12. <!--spread-->
  13. <link rel="stylesheet" href="web/css/spreadjs/gc.spread.sheets.excel2013white.10.0.1.css">
  14. <!--zTree-->
  15. <link rel="stylesheet" href="web/css/ztree/zTreeStyle.css" type="text/css">
  16. </head>
  17. <body>
  18. <div class="header">
  19. <nav class="navbar navbar-toggleable-lg navbar-light bg-faded p-0 ">
  20. <span class="header-logo px-2">清单规则编辑器</span>
  21. <div class="navbar-text"></div>
  22. </nav>
  23. <nav class="navbar navbar-toggleable-lg justify-content-between navbar-light p-0">
  24. <ul class="nav nav-tabs" role="tablist">
  25. <li class="nav-item">
  26. <a class="nav-link active px-3" href="qingdan.html">清单</a>
  27. </li>
  28. <li class="nav-item">
  29. <a class="nav-link px-3" href="neirong.html">工作内容</a>
  30. </li>
  31. <li class="nav-item">
  32. <a class="nav-link px-3" href="tezheng.html">项目特征</a>
  33. </li>
  34. </ul>
  35. </nav>
  36. </div>
  37. <div class="main">
  38. <div class="content" >
  39. <div class="container-fluid">
  40. <div class="row">
  41. <div class="main-content col-lg-7 p-0">
  42. <nav class="navbar sticky-top navbar-toggleable-md navbar-light bg-faded tools-bar">
  43. <div class="collapse navbar-collapse" id="navbarNav">
  44. <ul class="navbar-nav">
  45. <li class="nav-item">
  46. <a class="nav-link text-primary" id="insert" href="javascript: void(0);"><i class="fa fa-share" aria-hidden="true"></i>插入</a>
  47. </li>
  48. <li class="nav-item">
  49. <a class="nav-link text-primary" id ="delete" href="javascript:void (0)"><i class="fa fa-remove" aria-hidden="true"></i>删除</a>
  50. </li>
  51. <li class="nav-item">
  52. <a class="nav-link text-primary" id="upLevel" href="javascript: void(0);"><i class="fa fa-arrow-left" aria-hidden="true"></i>升级</a>
  53. </li>
  54. <li class="nav-item">
  55. <a class="nav-link text-primary" id="downLevl" href="javascript: void(0);"><i class="fa fa-arrow-right" aria-hidden="true"></i>降级</a>
  56. </li>
  57. <li class="nav-item">
  58. <a class="nav-link text-primary" id="upMove" href="javascript: void(0);"><i class="fa fa-arrow-up" aria-hidden="true"></i>上移</a>
  59. </li>
  60. <li class="nav-item">
  61. <a class="nav-link text-primary" id="downMove" href="javascript: void(0);"><i class="fa fa-arrow-down" aria-hidden="true"></i>下移</a>
  62. </li>
  63. </ul>
  64. </div>
  65. </nav>
  66. <div class="main-data" id="spreadBills">
  67. <!--<div id="spreadBills" style="width: 100%; height: 700px;"></div>-->
  68. </div>
  69. </div>
  70. <div class="main-side col-lg-5 p-0">
  71. <div class="container-fluid">
  72. <div class="row">
  73. <div class="col" style="width:50%; height: 100%">
  74. <h5>工作内容</h5>
  75. <div id="spreadJobs" style="width:97%; height: 300px;"></div>
  76. </div>
  77. <div class="col" style="width:50%; height: 100%">
  78. <h5>项目特征</h5>
  79. <div id="spreadItems" style="width: 97%; height: 300px;"></div>
  80. </div>
  81. <div class="w-100"></div>
  82. <div class="col">
  83. <div class="form-group">
  84. <label for="exampleTextarea"><h5>补注:</h5></label>
  85. <textarea class="form-control" id="exampleTextarea" rows="8"></textarea>
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. <!--弹出添加-->
  96. <div class="modal fade" id="add" data-backdrop="static" style="display: none;" aria-hidden="true">
  97. <div class="modal-dialog" role="document">
  98. <div class="modal-content">
  99. <div class="modal-header">
  100. <h5 class="modal-title">添加定额</h5>
  101. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  102. <span aria-hidden="true">×</span>
  103. </button>
  104. </div>
  105. <div class="modal-body">
  106. <form>
  107. <div class="form-group">
  108. <label>编码</label>
  109. <input class="form-control" placeholder="输入编码" type="text">
  110. </div>
  111. <div class="form-group">
  112. <label>名称</label>
  113. <input class="form-control" placeholder="输入名称" type="text">
  114. </div>
  115. <div class="form-group">
  116. <label>单位</label>
  117. <select class="form-control"><option>选择单位</option><option>m3</option></select>
  118. </div>
  119. <div class="form-group">
  120. <label>基价</label>
  121. <input class="form-control" placeholder="输入基价" type="number">
  122. </div>
  123. <div class="form-group">
  124. <label>显示名称(以%s表示参数)</label>
  125. <input class="form-control" placeholder="输入显示名称" type="text">
  126. </div>
  127. <div class="form-group">
  128. <label>默认取费专业</label>
  129. <input class="form-control" placeholder="输入取费专业" type="text">
  130. </div>
  131. </form>
  132. </div>
  133. <div class="modal-footer">
  134. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  135. <a href="" class="btn btn-primary">添加</a>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. <!--弹出编辑-->
  141. <div class="modal fade" id="edit" data-backdrop="static" style="display: none;" aria-hidden="true">
  142. <div class="modal-dialog" role="document">
  143. <div class="modal-content">
  144. <div class="modal-header">
  145. <h5 class="modal-title">编辑定额</h5>
  146. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  147. <span aria-hidden="true">×</span>
  148. </button>
  149. </div>
  150. <div class="modal-body">
  151. <form>
  152. <div class="form-group">
  153. <label>编码</label>
  154. <input class="form-control" placeholder="输入编码" type="text" value="AA0001">
  155. </div>
  156. <div class="form-group">
  157. <label>名称</label>
  158. <input class="form-control" placeholder="输入名称" type="text" value="人工挖土方">
  159. </div>
  160. <div class="form-group">
  161. <label>单位</label>
  162. <select class="form-control"><option>m3</option></select>
  163. </div>
  164. <div class="form-group">
  165. <label>基价</label>
  166. <input class="form-control" placeholder="输入基价" type="number" value="880.84">
  167. </div>
  168. <div class="form-group">
  169. <label>显示名称(以%s表示参数)</label>
  170. <input class="form-control" placeholder="输入显示名称" type="text" value="人工挖土方">
  171. </div>
  172. <div class="form-group">
  173. <label>默认取费专业</label>
  174. <input class="form-control" placeholder="输入取费专业" type="text" value="1">
  175. </div>
  176. </form>
  177. </div>
  178. <div class="modal-footer">
  179. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  180. <a href="" class="btn btn-primary">确定</a>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. <!--弹出删除-->
  186. <div class="modal fade" id="del" data-backdrop="static" style="display: none;" aria-hidden="true">
  187. <div class="modal-dialog" role="document">
  188. <div class="modal-content">
  189. <div class="modal-header">
  190. <h5 class="modal-title">删除确认</h5>
  191. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  192. <span aria-hidden="true">×</span>
  193. </button>
  194. </div>
  195. <div class="modal-body">
  196. <h5 class="text-danger">删除后无法恢复,确认是否删除?</h5>
  197. </div>
  198. <div class="modal-footer">
  199. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  200. <a href="" class="btn btn-danger">删除</a>
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. <!-- JS. -->
  206. <script src="lib/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js"></script>
  207. <script src="lib/jquery/jquery.min.js"></script>
  208. <script src="lib/tether/tether.min.js"></script>
  209. <script src="lib/bootstrap/bootstrap.min.js"></script>
  210. <script src="web/billsLib/scripts/global.js"></script>
  211. <script src="web/billsLib/scripts/setSheets.js"></script>
  212. <script src="web/billsLib/scripts/billsLibAjax.js"></script>
  213. <!--idTree-->
  214. <script src="public/web/idTree.js"></script>
  215. <script src="public/web/tree_sheet_controller.js"></script>
  216. <script src="public/web/tree_sheet_helper.js"></script>
  217. <script src="web/billsLib/scripts/billsLibSetting.js"></script>
  218. <script src="web/billsLib/scripts/billsLibTree.js"></script>
  219. <!--<script src="test/tmp_data/data_15690.js"></script>-->
  220. <script src="test/tmp_data/bills_grid_setting.js"></script>
  221. </body>
  222. <script type="text/javascript">
  223. autoFlashHeight();
  224. var billsTree = billsLibTree.createBillsTree();
  225. var billsLibId = getQueryString("billsLibId");
  226. $(document).ready(function(){
  227. billsAjax.getStdBillsLibName(billsLibId);
  228. billsAjax.getBills(billsLibId);
  229. buildJobs();
  230. buildItems();
  231. });
  232. //test
  233. //test
  234. var dbOperation = {
  235. insert: function(controller){
  236. if(controller.tree.items.length === 0){
  237. billsAjax.createBills(billsLibId, -1 , -1);
  238. controller.insert();
  239. }
  240. else {
  241. var node = controller.tree.selected;
  242. if(node){
  243. var updateId = tagId, createpid = node.getParentID(), createnid = node.getNextSiblingID();
  244. controller.insert();
  245. billsAjax.createBills(billsLibId, createpid, createnid);
  246. billsAjax.updatePNId(updateId, -1, node.getNextSiblingID());
  247. }
  248. else {
  249. var updateNode = controller.tree.roots[controller.tree.roots.length - 1];
  250. var updateId = updateNode.getID();
  251. controller.insert();
  252. billsAjax.createBills(billsLibId, -1, -1);
  253. billsAjax.updatePNId(updateId, -1, updateNode.getNextSiblingID());
  254. }
  255. }
  256. },
  257. delete: function(controller){
  258. var node = controller.tree.selected;
  259. var deleteIds = [];
  260. var getDeleteIds = function(node){
  261. if(node){
  262. deleteIds.push(node.getID());
  263. if(node.children.length > 0){
  264. for(var i=0; i<node.children.length; i++){
  265. getDeleteIds(node.children[i]);
  266. }
  267. }
  268. }
  269. };
  270. getDeleteIds(node);
  271. billsAjax.deleteBills(deleteIds);
  272. controller.delete;
  273. },
  274. upLevel: function(controller){
  275. var node = controller.tree.selected;
  276. if(node){
  277. if(node.parent){
  278. //node
  279. billsAjax.updatePNId(node.getID(), node.parent.getParentID(), node.parent.getNextSiblingID());
  280. //parent
  281. billsAjax.updatePNId(node.getParentID(), null, node.getID());
  282. if(node.nextSibling){
  283. //node.nextSibling
  284. billsAjax.updatePNId(node.getNextSiblingID(), node.getID(), null);
  285. }
  286. if(node.preSibling){
  287. billsAjax.updatePNId(node.preSibling.getID(), null, -1);
  288. }
  289. }
  290. //controllerOp
  291. controller.upLevel();
  292. }
  293. },
  294. downLevel: function(controller){
  295. var node = controller.tree.selected;
  296. if(node){
  297. if(node.preSibling){
  298. billsAjax.updatePNId(node.preSibling.getID(), null, node.getNextSiblingID());
  299. billsAjax.updatePNId(node.getID(), node.preSibling.getID(), -1);
  300. if(node.preSibling.children.length > 0){
  301. billsAjax.updatePNId(node.preSibling.children[node.preSibling.children.length -1].getID(), null, node.getID());
  302. }
  303. controller.downLevel();
  304. }
  305. }
  306. },
  307. upMove: function(controller){
  308. var node = controller.tree.selected;
  309. if(node){
  310. if(node.preSibling){
  311. billsAjax.updatePNId(node.preSibling.getID(), null, node.getNextSiblingID());
  312. billsAjax.updatePNId(node.getID(), null, node.preSibling.getID());
  313. if(node.preSibling.preSibling){
  314. billsAjax.updatePNId(node.preSibling.preSibling.getID(), null, node.getID());
  315. }
  316. controller.upMove();
  317. }
  318. }
  319. },
  320. downMove: function(controller){
  321. var node = controller.tree.selected;
  322. if(node){
  323. if(node.nextSibling){
  324. billsAjax.updatePNId(node.getNextSiblingID(), null, node.getID());
  325. billsAjax.updatePNId(node.getID(), null, node.nextSibling.getNextSiblingID());
  326. if(node.preSibling){
  327. billsAjax.updatePNId(node.preSibling.getID(), null, node.getNextSiblingID());
  328. }
  329. controller.downMove();
  330. }
  331. }
  332. }
  333. }
  334. function nodeOpration(controller,sheet){
  335. $('#insert').click(function(){
  336. //dbOperation.insert(controller, sheet);
  337. controller.insert();
  338. });
  339. $('#delete').click(function(){
  340. controller.delete();
  341. });
  342. $('#upLevel').click(function(){
  343. controller.upLevel();
  344. });
  345. $('#downLevl').click(function(){
  346. controller.downLevel();
  347. });
  348. $('#upMove').click(function(){
  349. controller.upMove();
  350. });
  351. $('#downMove').click(function(){
  352. controller.downMove();
  353. });
  354. }
  355. function showBillsSheet(datas){
  356. var billsSpread = new GC.Spread.Sheets.Workbook($('#spreadBills')[0], {sheetCount: 1});
  357. initSheet(billsSpread);
  358. billsTree.loadDatas(datas);
  359. var controller = TREE_SHEET_CONTROLLER.createNew(billsTree.tree, billsSpread.getActiveSheet(), billsLibSetting);
  360. controller.showTreeData();
  361. nodeOpration(controller, billsSpread.getActiveSheet());
  362. }
  363. function buildBills(){
  364. var spread = new GC.Spread.Sheets.Workbook($("#spreadBills")[0], {sheetCount: 1});
  365. var sheet = spread.getSheet(0);
  366. var chRowCount = 2;
  367. var vpColCount = 4;
  368. var vpRowCount = 27;
  369. sheet.suspendPaint();
  370. sheet.suspendEvent();
  371. initSheet(spread, sheet, chRowCount, vpRowCount, vpColCount );//初始表单设置
  372. setupBillsColHeader(sheet);
  373. setupEvents(spread, sheet);//事件
  374. initRowHeight(sheet);//设置行高
  375. setCell(sheet);//设置文本居中
  376. myCommand(spread, sheet);
  377. setScrollBar(spread, sheet, vpRowCount);
  378. sheet.resumePaint();
  379. sheet.resumeEvent();
  380. }
  381. function setupBillsColHeader(sheet){
  382. var ch = GC.Spread.Sheets.SheetArea.colHeader;
  383. sheet.addSpan(0, 0, 2, 1, ch);
  384. sheet.setValue(0, 0, "编码", ch);
  385. sheet.setColumnWidth(0, 160);
  386. sheet.addSpan(0, 1, 2, 1, ch);
  387. sheet.setValue(0, 1, "名称", ch);
  388. sheet.setColumnWidth(1, 300);
  389. sheet.addSpan(0, 2, 2, 1, ch);
  390. sheet.setValue(0, 2, "计量单位", ch);
  391. sheet.setColumnWidth(2, 160);
  392. sheet.addSpan(0, 3, 2, 1, ch);
  393. sheet.setValue(0, 3, "工程量计算规则", ch);
  394. sheet.setColumnWidth(3, 420);
  395. }
  396. //设置滚动条
  397. /*function setScrollBar(spread, sheet){
  398. var rowCount = sheet.getR
  399. }*/
  400. //
  401. function buildJobs(){
  402. var spread = new GC.Spread.Sheets.Workbook($("#spreadJobs")[0], {sheetCount: 1});
  403. var sheet = spread.getSheet(0);
  404. var chRowCount = 2;
  405. var vpRowCount = 8;
  406. var vpColCount = 2;
  407. sheet.suspendPaint();
  408. sheet.suspendEvent();
  409. initSheet(spread);
  410. setupJobsColHeader(sheet);
  411. //initRowHeight(sheet);
  412. setCell(sheet);
  413. myCommand(spread, sheet);
  414. setScrollBar(spread, sheet, vpRowCount);
  415. sheet.resumePaint();
  416. sheet.resumeEvent();
  417. }
  418. function setupJobsColHeader(sheet){
  419. var ch = GC.Spread.Sheets.SheetArea.colHeader;
  420. sheet.addSpan(0, 0, 2, 1, ch);
  421. sheet.setValue(0, 0, "编号", ch);
  422. sheet.setColumnWidth(0, 100);
  423. sheet.addSpan(0, 1, 2, 1, ch);
  424. sheet.setValue(0, 1, "工作内容", ch);
  425. sheet.setColumnWidth(1, 215);
  426. }
  427. //
  428. function buildItems(){
  429. var spread = new GC.Spread.Sheets.Workbook($("#spreadItems")[0], {sheetCount: 1});
  430. var sheet = spread.getSheet(0);
  431. var chRowCount = 2;
  432. var vpRowCount = 8;
  433. var vpColCount = 2;
  434. sheet.suspendPaint();
  435. sheet.suspendEvent();
  436. initSheet(spread, sheet, chRowCount, vpRowCount, vpColCount);
  437. setupItemsColHeader(sheet);
  438. //initRowHeight(sheet);
  439. setCell(sheet);
  440. myCommand(spread, sheet);
  441. setScrollBar(spread, sheet, vpRowCount);
  442. sheet.resumePaint();
  443. sheet.resumeEvent();
  444. }
  445. function setupItemsColHeader(sheet){
  446. var ch = GC.Spread.Sheets.SheetArea.colHeader;
  447. sheet.addSpan(0, 0, 2, 1, ch);
  448. sheet.setValue(0, 0, "编号", ch);
  449. sheet.setColumnWidth(0, 100);
  450. sheet.addSpan(0, 1, 2, 1, ch);
  451. sheet.setValue(0, 1, "项目特征", ch);
  452. sheet.setColumnWidth(1, 215);
  453. }
  454. function getQueryString(name)
  455. {
  456. var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
  457. var r = window.location.search.substr(1).match(reg);
  458. if(r!=null)return unescape(r[2]); return null;
  459. }
  460. </script>
  461. </html>