neirong.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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="/lib/bootstrap/css/bootstrap.min.css">
  9. <!--<link rel="stylesheet" href="../../web/css/bootstrap/themes.css">-->
  10. <link rel="stylesheet" href="/web/maintain/bills_lib/css/main.css">
  11. <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">
  12. <!--spread-->
  13. <link rel="stylesheet" href="/lib/spreadjs/sheets/css/gc.spread.sheets.excel2013lightGray.10.0.1.css">
  14. <!--zTree-->
  15. <link rel="stylesheet" href="/lib/ztree/css/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 id="aStdBills" class="nav-link px-3" href="stdBills">清单</a>
  27. </li>
  28. <li class="nav-item">
  29. <a class="nav-link active px-3" href="javascript: void(0);">工作内容</a>
  30. </li>
  31. <li class="nav-item">
  32. <a id="aStdItems" class="nav-link px-3" href="stdItems">项目特征</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="tools-bar">
  43. </nav>
  44. <div class="main-data" id="spreadAllJobs">
  45. </div>
  46. </div>
  47. <div class="main-side col-lg-5 p-0">
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. <!--弹出添加-->
  54. <div class="modal fade" id="add" data-backdrop="static" style="display: none;" aria-hidden="true">
  55. <div class="modal-dialog" role="document">
  56. <div class="modal-content">
  57. <div class="modal-header">
  58. <h5 class="modal-title">添加定额</h5>
  59. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  60. <span aria-hidden="true">×</span>
  61. </button>
  62. </div>
  63. <div class="modal-body">
  64. <form>
  65. <div class="form-group">
  66. <label>编码</label>
  67. <input class="form-control" placeholder="输入编码" type="text">
  68. </div>
  69. <div class="form-group">
  70. <label>名称</label>
  71. <input class="form-control" placeholder="输入名称" type="text">
  72. </div>
  73. <div class="form-group">
  74. <label>单位</label>
  75. <select class="form-control"><option>选择单位</option><option>m3</option></select>
  76. </div>
  77. <div class="form-group">
  78. <label>基价</label>
  79. <input class="form-control" placeholder="输入基价" type="number">
  80. </div>
  81. <div class="form-group">
  82. <label>显示名称(以%s表示参数)</label>
  83. <input class="form-control" placeholder="输入显示名称" type="text">
  84. </div>
  85. <div class="form-group">
  86. <label>默认取费专业</label>
  87. <input class="form-control" placeholder="输入取费专业" type="text">
  88. </div>
  89. </form>
  90. </div>
  91. <div class="modal-footer">
  92. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  93. <a href="" class="btn btn-primary">添加</a>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. <!--弹出编辑-->
  99. <div class="modal fade" id="edit" data-backdrop="static" style="display: none;" aria-hidden="true">
  100. <div class="modal-dialog" role="document">
  101. <div class="modal-content">
  102. <div class="modal-header">
  103. <h5 class="modal-title">编辑定额</h5>
  104. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  105. <span aria-hidden="true">×</span>
  106. </button>
  107. </div>
  108. <div class="modal-body">
  109. <form>
  110. <div class="form-group">
  111. <label>编码</label>
  112. <input class="form-control" placeholder="输入编码" type="text" value="AA0001">
  113. </div>
  114. <div class="form-group">
  115. <label>名称</label>
  116. <input class="form-control" placeholder="输入名称" type="text" value="人工挖土方">
  117. </div>
  118. <div class="form-group">
  119. <label>单位</label>
  120. <select class="form-control"><option>m3</option></select>
  121. </div>
  122. <div class="form-group">
  123. <label>基价</label>
  124. <input class="form-control" placeholder="输入基价" type="number" value="880.84">
  125. </div>
  126. <div class="form-group">
  127. <label>显示名称(以%s表示参数)</label>
  128. <input class="form-control" placeholder="输入显示名称" type="text" value="人工挖土方">
  129. </div>
  130. <div class="form-group">
  131. <label>默认取费专业</label>
  132. <input class="form-control" placeholder="输入取费专业" type="text" value="1">
  133. </div>
  134. </form>
  135. </div>
  136. <div class="modal-footer">
  137. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  138. <a href="" class="btn btn-primary">确定</a>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <!--弹出删除-->
  144. <div class="modal fade" id="del" data-backdrop="static" style="display: none;" aria-hidden="true">
  145. <div class="modal-dialog" role="document">
  146. <div class="modal-content">
  147. <div class="modal-header">
  148. <h5 class="modal-title">删除确认</h5>
  149. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  150. <span aria-hidden="true">×</span>
  151. </button>
  152. </div>
  153. <div class="modal-body">
  154. <h5 class="text-danger">删除后无法恢复,确认是否删除?</h5>
  155. </div>
  156. <div class="modal-footer">
  157. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  158. <a href="" class="btn btn-danger">删除</a>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. <!--弹出提示窗口-->
  164. <button id="alertBtn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#alertDiv" style="display: none"></button>
  165. <div class="modal fade" id="alertDiv" data-backdrop="static" style="display: none;" aria-hidden="true">
  166. <input type="hidden" value="123">
  167. <div class="modal-dialog" role="document">
  168. <div class="modal-content">
  169. <div class="modal-header">
  170. <h5 class="modal-title">警告</h5>
  171. <button type="button" id="alertCls" class="close" data-dismiss="modal" aria-label="Close">
  172. <span aria-hidden="true">×</span>
  173. </button>
  174. </div>
  175. <div class="modal-body">
  176. <h5 class="text-danger" id="alertTxt">编号不存在,请重新输入!</h5>
  177. </div>
  178. <div class="modal-footer">
  179. <button type="button" class="btn btn-danger" id="alertCof" data-dismiss="modal">确认</button>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. <!-- JS. -->
  185. <script src="/lib/spreadjs/sheets/gc.spread.sheets.all.10.0.1.min.js"></script>
  186. <script>GC.Spread.Sheets.LicenseKey = "559432293813965#A0y3iTOzEDOzkjMyMDN9UTNiojIklkI1pjIEJCLi4TPB9mM5AFNTd4cvZ7SaJUVy3CWKtWYXx4VVhjMpp7dYNGdx2ia9sEVlZGOTh7NRlTUwkWR9wEV4gmbjBDZ4ElR8N7cGdHVvEWVBtCOwIGW0ZmeYVWVr3mI0IyUiwCMzETN8kzNzYTM0IicfJye&Qf35VfiEzRwEkI0IyQiwiIwEjL6ByUKBCZhVmcwNlI0IiTis7W0ICZyBlIsIyNyMzM5ADI5ADNwcTMwIjI0ICdyNkIsIibj9SbvNmL4N7bjRnch56ciojIz5GRiwiI8+Y9sWY9QmZ0Jyp96uL9v6L0wap9biY9qiq95q197Wr9g+89iojIh94Wiqi";</script>
  187. <script src="/lib/jquery/jquery.min.js"></script>
  188. <script src="/lib/tether/tether.min.js"></script>
  189. <script src="/lib/bootstrap/bootstrap.min.js"></script>
  190. <script src="/web/maintain/bills_lib/scripts/global.js"></script>
  191. <script src="/web/maintain/bills_lib/scripts/set_sheets.js"></script>
  192. <script src="/web/maintain/bills_lib/scripts/bills_lib_ajax.js"></script>
  193. <script src="/web/maintain/bills_lib/scripts/tools.js"></script>
  194. <script src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
  195. <script src="/web/maintain/bills_lib/scripts/bills_lib_setting.js"></script>
  196. <script src="/web/maintain/bills_lib/scripts/db_controller.js"></script>
  197. <SCRIPT type="text/javascript">
  198. let billsLibId = getQueryString("billsLibId");
  199. tools.redirect(billsLibId, 'stdBillsmain');
  200. let spreadAllJobs = new GC.Spread.Sheets.Workbook($('#spreadAllJobs')[0], {sheetCount: 1});
  201. let orgJobData;
  202. let maxJobNumer;
  203. let maxJobsNumber;
  204. let sheetJobsDatas;
  205. $(document).ready(function(){
  206. $('#aStdBills').attr('href', function(){
  207. return 'stdBills?billsLibId=' + billsLibId;
  208. });
  209. $('#aStdItems').attr('href', function(){
  210. return 'stdItems?billsLibId=' + billsLibId;
  211. });
  212. billsAjax.getStdBillsLibName(billsLibId);
  213. buildAllJobs(spreadAllJobs, totalJobsSetting);
  214. });
  215. function buildAllJobs(spreadAllJobs, setting){
  216. setSheet.initSheet(spreadAllJobs, setting, true);
  217. myKey.downKey(spreadAllJobs);
  218. myKey.enterKey(spreadAllJobs);
  219. TREE_SHEET_HELPER.loadSheetHeader(setting, spreadAllJobs.getActiveSheet());
  220. jobsAjax.getJobContent(billsLibId, function(datas){
  221. spreadAllJobs.getActiveSheet().suspendPaint();
  222. let len = datas.length;
  223. for(var i=0; i<len; i++){
  224. setting.cols.forEach(function(col, colIdx){
  225. spreadAllJobs.getActiveSheet().setTag(i, colIdx, datas[i].id, GC.Spread.Sheets.SheetArea.viewport);
  226. if(datas[i][col.data.field]){
  227. spreadAllJobs.getActiveSheet().getCell(i, colIdx, GC.Spread.Sheets.SheetArea.viewport).value(datas[i][col.data.field]);
  228. }
  229. else {
  230. spreadAllJobs.getActiveSheet().getCell(i, colIdx, GC.Spread.Sheets.SheetArea.viewport).value('');
  231. }
  232. });
  233. }
  234. spreadAllJobs.getActiveSheet().resumePaint();
  235. let totalJobs = createObj.newJobs();
  236. totalJobs.loadJobs(null, datas);
  237. tools.getBillsIds(function(ids){
  238. myKey.delKey(spreadAllJobs, ids, totalJobs, setting, 'totalJobs');
  239. bindSheet(totalJobs, spreadAllJobs.getActiveSheet(), setting);
  240. pasteJobs(spreadAllJobs.getActiveSheet(), totalJobs);
  241. });
  242. });
  243. }
  244. function bindSheet(totalJobs, sheet, setting){
  245. setSheet.setMaxRowCount(sheet, totalJobs.jobsArr);
  246. mainAjax.getMaxNumber(billsLibId, 'jobs', function(result){
  247. if(result.length === 0){
  248. maxJobsNumber = 0;
  249. }
  250. else {
  251. maxJobsNumber = result[0].code;
  252. }
  253. orgJobData = sheet.getCell(0, 0).value();
  254. totalJobsController.eiditData(totalJobs, sheet, setting);
  255. });
  256. }
  257. function pasteJobs(sheet, totalJobs){
  258. sheetJobsDatas = tools.getsheetDatas(sheet, 'total');
  259. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, function(sender, args){
  260. const colIdx = 1;
  261. let orgRow = args.cellRange.row, orgCol = args.cellRange.col, rowCount = args.cellRange.rowCount, colCount = args.cellRange.colCount;
  262. let maxRow = orgRow + rowCount - 1, maxCol = orgCol + colCount -1;
  263. let pasteDatas = [], uncrossedDatas = [], crossedDatas = [];
  264. for(let i = orgRow; i<= maxRow; i++){
  265. for(let j =0; j<=1; j++){
  266. let filed = j === 0 ? 'code' : 'content';
  267. if(sheet.getCell(i, j).value()){
  268. let unitData = {
  269. billsLibId: billsLibId,
  270. rowIdx: i,
  271. colIdx: j,
  272. field: filed,
  273. data: sheet.getCell(i, j).value(),
  274. type: 'Create'
  275. };
  276. pasteDatas.push(unitData);
  277. }
  278. }
  279. }
  280. let uniqPasteDatas = tools.uniqObjArr(pasteDatas);
  281. tools.resetRowIdx(uniqPasteDatas, orgRow);
  282. for(let i=0; i< uniqPasteDatas.length; i++){
  283. let crossedData;
  284. let flag = true;
  285. sheetJobsDatas.forEach(function(orgData){
  286. if(uniqPasteDatas[i].rowIdx === orgData.rowIdx && uniqPasteDatas[i].colIdx === orgData.colIdx){
  287. flag = false;
  288. crossedData = {
  289. billsLibId: billsLibId,
  290. rowIdx: uniqPasteDatas[i].rowIdx,
  291. colIdx: uniqPasteDatas[i].colIdx,
  292. field: uniqPasteDatas[i].field,
  293. orgId: orgData.id,
  294. data: uniqPasteDatas[i].data,
  295. type: 'Update'
  296. }
  297. }
  298. });
  299. if(flag){
  300. uncrossedDatas.push(uniqPasteDatas[i]);
  301. }
  302. else{
  303. crossedDatas.push(crossedData);
  304. }
  305. }
  306. let encapDatas = tools.encapTotalJobsDatas(sheet, totalJobs, uncrossedDatas, crossedDatas);
  307. if(encapDatas.updateDatas.length > 0 || encapDatas.createDatas.length >0){
  308. jobsAjax.pasteJobs(encapDatas, function(datas){
  309. pasteController.pasteJobsFront(sheet, totalJobs,datas);
  310. });
  311. }
  312. else{
  313. tools.reshowData(sheet, totalJobs.jobsArr, totalJobsSetting, true);
  314. }
  315. });
  316. }
  317. </SCRIPT>
  318. </body>
  319. <script type="text/javascript">
  320. autoFlashHeight();
  321. </script>
  322. </html>