qingdan.html 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  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/maintain/bills_lib/css/main.css">
  10. <link rel="stylesheet" href="/lib/font-awesome/font-awesome.min.css">
  11. <!--spread-->
  12. <link rel="stylesheet" href="/lib/spreadjs/sheets/css/gc.spread.sheets.sc.css">
  13. <link rel="stylesheet" href="/lib/codemirror/codemirror.css">
  14. <link rel="stylesheet" href="/lib/codemirror/material.css">
  15. </head>
  16. <body>
  17. <div class="header">
  18. <nav class="navbar navbar-toggleable-lg navbar-light bg-faded p-0 ">
  19. <span class="header-logo px-2">清单规则编辑器</span>
  20. <div class="navbar-text"></div>
  21. </nav>
  22. <nav class="navbar navbar-toggleable-lg justify-content-between navbar-light p-0">
  23. <ul class="nav nav-tabs" role="tablist">
  24. <li class="nav-item">
  25. <a class="nav-link active px-3" href="javascript: void(0);">清单</a>
  26. </li>
  27. <li class="nav-item">
  28. <a id="aStdJobs" class="nav-link px-3" href="stdJobs">工作内容</a>
  29. </li>
  30. <li class="nav-item">
  31. <a id="aStdItems" class="nav-link px-3" href="stdItems">项目特征</a>
  32. </li>
  33. </ul>
  34. </nav>
  35. </div>
  36. <div class="main">
  37. <div class="content" >
  38. <div class="container-fluid">
  39. <div class="row">
  40. <div class="main-content col-lg-7 p-0">
  41. <nav class="navbar sticky-top navbar-toggleable-md navbar-light bg-faded tools-bar">
  42. <div class="collapse navbar-collapse" id="navbarNav">
  43. <ul class="navbar-nav">
  44. <li class="nav-item">
  45. <a class="nav-link text-primary" doing="false" fcsOnBills="true" id="insert" href="javascript: void(0);"><i class="fa fa-share" aria-hidden="true"></i>插入</a>
  46. </li>
  47. <li class="nav-item">
  48. <a class="nav-link text-primary" doing="false" fcsOnBills="true" id ="delete" href="javascript:void (0)"><i class="fa fa-remove" aria-hidden="true"></i>删除</a>
  49. </li>
  50. <li class="nav-item">
  51. <a class="nav-link text-primary" doing="false" fcsOnBills="true" id="upLevel" href="javascript: void(0);"><i class="fa fa-arrow-left" aria-hidden="true"></i>升级</a>
  52. </li>
  53. <li class="nav-item">
  54. <a class="nav-link text-primary" doing="false" fcsOnBills="true" id="downLevel" href="javascript: void(0);"><i class="fa fa-arrow-right" aria-hidden="true"></i>降级</a>
  55. </li>
  56. <li class="nav-item">
  57. <a class="nav-link text-primary" doing="false" fcsOnBills="true" canMove="false" id="upMove" href="javascript: void(0);"><i class="fa fa-arrow-up" aria-hidden="true"></i>上移</a>
  58. </li>
  59. <li class="nav-item">
  60. <a class="nav-link text-primary" doing="false" fcsOnBills="true" canMove="false" id="downMove" href="javascript: void(0);"><i class="fa fa-arrow-down" aria-hidden="true"></i>下移</a>
  61. </li>
  62. </ul>
  63. </div>
  64. </nav>
  65. <div class="main-data" id="spreadBills">
  66. </div>
  67. </div>
  68. <div class="main-side col-lg-5 p-0">
  69. <div class="container-fluid">
  70. <div style="width:50%; height: 100%; float: left;">
  71. <h5>工作内容</h5>
  72. <div id="spreadJobs" class="ovf-hidden" style="width:97%; height: 300px;"></div>
  73. </div>
  74. <div style="width:50%; height: 100%; float: left;">
  75. <h5>项目特征</h5>
  76. <div id="spreadItems" class="ovf-hidden" style="width: 97%; height: 300px;"></div>
  77. </div>
  78. <!-- <div class="form-group">
  79. <a class="pull-right" href="javacript:void(0);" data-toggle="modal" data-target="#help" >html怎么写?</a>
  80. <label for="exampleTextarea">补注:</label>
  81. <textarea id="exampleTextarea" name="editor" class="form-control" rows="8"></textarea>
  82. </div>-->
  83. <div class="form-group">
  84. <a class="pull-right" href="javacript:void(0);" data-toggle="modal" data-target="#help" >html怎么写?</a>
  85. <a trigger="billsRecharge" class="pull-right mr-3 uploadImgTrigger" href="javacript:void(0);" data-toggle="modal" data-target="#uploadimg" ><i class="fa fa-image"></i>上传图片</a>
  86. <label for="exampleTextarea">补注:</label>
  87. <textarea class="form-control" id="exampleTextarea" rows="8"></textarea>
  88. </div>
  89. <!-- <div class="row">
  90. <div class="col ovf-hidden" style="width:50%; height: 100%; float: left;">
  91. <h5>工作内容</h5>
  92. <div id="spreadJobs" style="width:97%; height: 300px;"></div>
  93. </div>
  94. <div class="col" style="width:50%; height: 100%; float: left;">
  95. <h5>项目特征</h5>
  96. <div id="spreadItems" class="ovf-hidden" style="width: 97%; height: 300px;"></div>
  97. </div>
  98. <div class="w-100"></div>
  99. <div class="col">
  100. <div class="form-group">
  101. <label for="exampleTextarea"><h5>补注:</h5></label>
  102. <textarea class="form-control" id="exampleTextarea" rows="8"></textarea>
  103. </div>
  104. </div>
  105. </div>-->
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <!--弹出添加-->
  113. <div class="modal fade" id="add" data-backdrop="static" style="display: none;" aria-hidden="true">
  114. <div class="modal-dialog" role="document">
  115. <div class="modal-content">
  116. <div class="modal-header">
  117. <h5 class="modal-title">添加定额</h5>
  118. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  119. <span aria-hidden="true">×</span>
  120. </button>
  121. </div>
  122. <div class="modal-body">
  123. <form>
  124. <div class="form-group">
  125. <label>编码</label>
  126. <input class="form-control" placeholder="输入编码" type="text">
  127. </div>
  128. <div class="form-group">
  129. <label>名称</label>
  130. <input class="form-control" placeholder="输入名称" type="text">
  131. </div>
  132. <div class="form-group">
  133. <label>单位</label>
  134. <select class="form-control"><option>选择单位</option><option>m3</option></select>
  135. </div>
  136. <div class="form-group">
  137. <label>基价</label>
  138. <input class="form-control" placeholder="输入基价" type="number">
  139. </div>
  140. <div class="form-group">
  141. <label>显示名称(以%s表示参数)</label>
  142. <input class="form-control" placeholder="输入显示名称" type="text">
  143. </div>
  144. <div class="form-group">
  145. <label>默认取费专业</label>
  146. <input class="form-control" placeholder="输入取费专业" type="text">
  147. </div>
  148. </form>
  149. </div>
  150. <div class="modal-footer">
  151. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  152. <a href="" class="btn btn-primary">添加</a>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. <!--弹出编辑-->
  158. <div class="modal fade" id="edit" data-backdrop="static" style="display: none;" aria-hidden="true">
  159. <div class="modal-dialog" role="document">
  160. <div class="modal-content">
  161. <div class="modal-header">
  162. <h5 class="modal-title">编辑定额</h5>
  163. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  164. <span aria-hidden="true">×</span>
  165. </button>
  166. </div>
  167. <div class="modal-body">
  168. <form>
  169. <div class="form-group">
  170. <label>编码</label>
  171. <input class="form-control" placeholder="输入编码" type="text" value="AA0001">
  172. </div>
  173. <div class="form-group">
  174. <label>名称</label>
  175. <input class="form-control" placeholder="输入名称" type="text" value="人工挖土方">
  176. </div>
  177. <div class="form-group">
  178. <label>单位</label>
  179. <select class="form-control"><option>m3</option></select>
  180. </div>
  181. <div class="form-group">
  182. <label>基价</label>
  183. <input class="form-control" placeholder="输入基价" type="number" value="880.84">
  184. </div>
  185. <div class="form-group">
  186. <label>显示名称(以%s表示参数)</label>
  187. <input class="form-control" placeholder="输入显示名称" type="text" value="人工挖土方">
  188. </div>
  189. <div class="form-group">
  190. <label>默认取费专业</label>
  191. <input class="form-control" placeholder="输入取费专业" type="text" value="1">
  192. </div>
  193. </form>
  194. </div>
  195. <div class="modal-footer">
  196. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  197. <a href="" class="btn btn-primary">确定</a>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. <!--弹出删除-->
  203. <div class="modal fade" id="del" data-backdrop="static" style="display: none;" aria-hidden="true">
  204. <div class="modal-dialog" role="document">
  205. <div class="modal-content">
  206. <div class="modal-header">
  207. <h5 class="modal-title">删除确认</h5>
  208. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  209. <span aria-hidden="true">×</span>
  210. </button>
  211. </div>
  212. <div class="modal-body">
  213. <h5 class="text-danger">删除后无法恢复,确认是否删除?</h5>
  214. </div>
  215. <div class="modal-footer">
  216. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  217. <a href="" class="btn btn-danger">删除</a>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. <!--弹出提示窗口-->
  223. <button id="alertBtn" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#alertDiv" style="display: none"></button>
  224. <div class="modal fade" id="alertDiv" data-backdrop="static" style="display: none;" aria-hidden="true">
  225. <input type="hidden" value="123">
  226. <div class="modal-dialog" role="document">
  227. <div class="modal-content">
  228. <div class="modal-header">
  229. <h5 class="modal-title">警告</h5>
  230. <button type="button" id="alertCls" class="close" data-dismiss="modal" aria-label="Close">
  231. <span aria-hidden="true">×</span>
  232. </button>
  233. </div>
  234. <div class="modal-body">
  235. <h5 class="text-danger" id="alertTxt">编号不存在,请重新输入!</h5>
  236. </div>
  237. <div class="modal-footer">
  238. <button type="button" class="btn btn-danger" id="alertCof" data-dismiss="modal">确认</button>
  239. </div>
  240. </div>
  241. </div>
  242. </div>
  243. <!--删除-->
  244. <div class="modal fade" id="delAlert" data-backdrop="static" style="display: none;" aria-hidden="true">
  245. <input type="hidden" value="123">
  246. <div class="modal-dialog" role="document">
  247. <div class="modal-content">
  248. <div class="modal-header">
  249. <h5 class="modal-title">警告</h5>
  250. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  251. <span aria-hidden="true">×</span>
  252. </button>
  253. </div>
  254. <div class="modal-body">
  255. <h5 class="text-danger" id="delText">是否删除当前清单及其子项?</h5>
  256. </div>
  257. <div class="modal-footer">
  258. <button type="button" class="btn btn-danger" id="delConfirm">确认</button>
  259. <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
  260. </div>
  261. </div>
  262. </div>
  263. </div>
  264. <!--弹出html填写帮助-->
  265. <div class="modal fade" id="help" style="display: none;" aria-hidden="true">
  266. <div class="modal-dialog" role="document">
  267. <div class="modal-content">
  268. <div class="modal-header">
  269. <h5 class="modal-title">html填写帮助</h5>
  270. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  271. <span aria-hidden="true">×</span>
  272. </button>
  273. </div>
  274. <div class="modal-body">
  275. <p class="mb-0">标题:&lt;h3&gt;、&lt;h4&gt;、&lt;h5&gt;</p>
  276. <p class="text-primary mb-0">&lt;h3&gt;标题1&lt;/h3&gt;</p>
  277. <h3>标题1</h3>
  278. <p class="text-primary mb-0">&lt;h4&gt;标题2&lt;/h4&gt;</p>
  279. <h4>标题2</h4>
  280. <p class="text-primary mb-0">&lt;h5&gt;标题3&lt;/h5&gt;</p>
  281. <h5>标题3</h5>
  282. <p class="text-primary mb-0">&lt;p&gt;这是一行文本&lt;/p&gt;</p>
  283. <p>这是一行文本</p>
  284. <p class="mb-0">加粗:&lt;b&gt;</p>
  285. <p class="text-primary mb-0">&lt;p&gt;这是一行&lt;b&gt;文本&lt;/b&gt;&lt;/p&gt;</p>
  286. <p>这是一行<b>文本</b></p>
  287. <p class="mb-0">缩进:text-indent</p>
  288. <p class="text-primary mb-0">&lt;p class="text-indent" &gt;这是一行带缩进的文本&lt;/p&gt;</p>
  289. <p class="text-indent">这是一行带缩进的文本</p>
  290. <p class="mb-0">文本居中:text-center</p>
  291. <p class="text-primary">&lt;p class="text-center" &gt;这是一行文本&lt;/p&gt;</p>
  292. <p class="mb-0">文本居右:text-right</p>
  293. <p class="text-primary">&lt;p class="text-right" &gt;这是一行文本&lt;/p&gt;</p>
  294. <p class="mb-0">文本居左(默认已居左):text-left</p>
  295. <p class="text-primary">&lt;p class="text-left" &gt;这是一行文本&lt;/p&gt;</p>
  296. <p class="mb-0">表格:&lt;table&gt;、&lt;tr&gt;、&lt;th&gt;、&lt;td&gt;</p>
  297. <p class="mb-0 text-primary">&lt;table&gt;</p>
  298. <p class="mb-0 text-primary">&lt;tr&gt;&lt;th&gt;表头1&lt;/th&gt;&lt;th&gt;表头2&lt;/th&gt;&lt;th&gt;表头3&lt;/th&gt;&lt;/tr&gt;</p>
  299. <p class="mb-0 text-primary">&lt;tr&gt;&lt;td&gt;内容1&lt;/td&gt;&lt;td&gt;内容2&lt;/td&gt;&lt;td&gt;内容3&lt;/td&gt;&lt;/tr&gt;</p>
  300. <p class="mb-0 text-primary">&lt;tr&gt;&lt;td&gt;内容4&lt;/td&gt;&lt;td&gt;内容5&lt;/td&gt;&lt;td&gt;内容6&lt;/td&gt;&lt;/tr&gt;</p>
  301. <p class="mb-0 text-primary">&lt;/table&gt;</p>
  302. <p>
  303. <table class="table table-sm table-bordered">
  304. <tr><th>表头1</th><th>表头2</th><th>表头3</th></tr>
  305. <tr><td>内容1</td><td>内容2</td><td>内容3</td></tr>
  306. <tr><td>内容4</td><td>内容5</td><td>内容6</td></tr>
  307. </table>
  308. </p>
  309. <p class="mb-0">合并横向单元格(2格):colspan="2"</p>
  310. <p class="mb-0 text-primary">&lt;table&gt;</p>
  311. <p class="mb-0 text-primary">&lt;tr&gt;&lt;th colspan="2"&gt;表头1表头2&lt;/th&gt;&lt;th&gt;表头3&lt;/th&gt;&lt;/tr&gt;</p>
  312. <p class="mb-0 text-primary">&lt;tr&gt;&lt;td&gt;内容1&lt;/td&gt;&lt;td&gt;内容2&lt;/td&gt;&lt;td&gt;内容3&lt;/td&gt;&lt;/tr&gt;</p>
  313. <p class="mb-0 text-primary">&lt;tr&gt;&lt;td&gt;内容4&lt;/td&gt;&lt;td&gt;内容5&lt;/td&gt;&lt;td&gt;内容6&lt;/td&gt;&lt;/tr&gt;</p>
  314. <p class="mb-0 text-primary">&lt;/table&gt;</p>
  315. <p>
  316. <table class="table table-sm table-bordered">
  317. <tr><th colspan="2">表头1表头2</th><th>表头3</th></tr>
  318. <tr><td>内容1</td><td>内容2</td><td>内容3</td></tr>
  319. <tr><td>内容4</td><td>内容5</td><td>内容6</td></tr>
  320. </table>
  321. </p>
  322. <p class="mb-0">合并竖向单元格(2格):rowspan="2"</p>
  323. <p class="mb-0 text-primary">&lt;table&gt;</p>
  324. <p class="mb-0 text-primary">&lt;tr&gt;&lt;th&gt;表头1&lt;/th&gt;&lt;th&gt;表头2&lt;/th&gt;&lt;th&gt;表头3&lt;/th&gt;&lt;/tr&gt;</p>
  325. <p class="mb-0 text-primary">&lt;tr&gt;&lt;td rowspan="2"&gt;内容1内容4&lt;/td&gt;&lt;td&gt;内容2&lt;/td&gt;&lt;td&gt;内容3&lt;/td&gt;&lt;/tr&gt;</p>
  326. <p class="mb-0 text-primary">&lt;tr&gt;&lt;td&gt;内容5&lt;/td&gt;&lt;td&gt;内容6&lt;/td&gt;&lt;/tr&gt;</p>
  327. <p class="mb-0 text-primary">&lt;/table&gt;</p>
  328. <p>
  329. <table class="table table-sm table-bordered">
  330. <tr><th colspan="2">表头1表头2</th><th>表头3</th></tr>
  331. <tr><td rowspan="2">内容1内容4</td><td>内容2</td><td>内容3</td></tr>
  332. <tr><td>内容5</td><td>内容6</td></tr>
  333. </table>
  334. </p>
  335. </div>
  336. <div class="modal-footer">
  337. <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
  338. </div>
  339. </div>
  340. </div>
  341. </div>
  342. <%include ../../../common/html/uploadImg.html %>
  343. <!-- JS. -->
  344. <script src = "/lib/spreadjs/sheets/gc.spread.sheets.all.11.1.2.min.js"></script>
  345. <script>GC.Spread.Sheets.LicenseKey = '<%- LicenseKey %>';</script>
  346. <script src="/public/web/uuid.js"></script>
  347. <script src="/lib/jquery/jquery.min.js"></script>
  348. <script src="/lib/tether/tether.min.js"></script>
  349. <script src="/lib/bootstrap/bootstrap.min.js"></script>
  350. <script src="/web/maintain/bills_lib/scripts/global.js"></script>
  351. <script src="/public/web/PerfectLoad.js"></script>
  352. <script src="/public/web/common_ajax.js"></script>
  353. <script src="/public/web/sheet/sheet_common.js"></script>
  354. <script src="/web/maintain/bills_lib/scripts/set_sheets.js"></script>
  355. <script src="/web/maintain/bills_lib/scripts/bills_lib_ajax.js"></script>
  356. <!--idTree-->
  357. <script src="/public/web/id_tree.js"></script>
  358. <script src="/public/web/tree_sheet/tree_sheet_controller.js"></script>
  359. <script src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
  360. <script src="/web/maintain/bills_lib/scripts/bills_lib_setting.js"></script>
  361. <script src="/web/maintain/bills_lib/scripts/bills_lib_tree.js"></script>
  362. <script src="/web/maintain/bills_lib/scripts/db_controller.js"></script>
  363. <script src="/web/maintain/bills_lib/scripts/tools.js"></script>
  364. <script src="/lib/codemirror/codemirror.js"></script>
  365. <script src="/lib/codemirror/xml.js"></script>
  366. <script src="/web/common/js/uploadImg.js"></script>
  367. </body>
  368. <script type="text/javascript">
  369. var codeEditor = CodeMirror.fromTextArea(document.getElementById("exampleTextarea"), {
  370. mode: "text/html",
  371. lineNumbers: true,
  372. theme:"material"
  373. });
  374. codeEditor.setSize('auto','350px');
  375. autoFlashHeight();
  376. let userAccount = '<%= userAccount %>';
  377. let maxJobsNumber;
  378. let maxItemsNumber;
  379. let orgJobData;
  380. let orgItemData;
  381. let billsTree = billsLibTree.createBillsTree();
  382. let billsLibId = getQueryString("billsLibId");
  383. let sheetDatas;
  384. let sheetItemsDatas;
  385. let sheetBillsDatas;
  386. tools.redirect(billsLibId, 'stdBillsmain');
  387. let jobsSpread = new GC.Spread.Sheets.Workbook($("#spreadJobs")[0], {sheetCount: 1});
  388. sheetCommonObj.bindEscKey(jobsSpread, [{sheet: jobsSpread.getSheet(0), editStarting: jobsController.onEditStart, editEnded: jobsController.onEditEnded}]);
  389. let itemsSpread = new GC.Spread.Sheets.Workbook($("#spreadItems")[0], {sheetCount: 1});
  390. sheetCommonObj.bindEscKey(itemsSpread, [{sheet: itemsSpread.getSheet(0), editStarting: itemsController.onEditStart, editEnded: itemsController.onEditEnded}]);
  391. $(document).ready(function(){
  392. $("#aStdJobs").attr('href', function(){
  393. return 'stdJobs?billsLibId=' + billsLibId;
  394. });
  395. $('#aStdItems').attr('href', function(){
  396. return 'stdItems?billsLibId=' + billsLibId;
  397. });
  398. billsAjax.getStdBillsLibName(billsLibId);
  399. billsAjax.getBills(billsLibId, function(bills){
  400. showBillsSheet(bills, jobsSpread.getActiveSheet(), itemsSpread.getActiveSheet(), billsLibSetting)
  401. });
  402. buildJobs(jobsSpread, jobsSetting);
  403. buildItems(itemsSpread, itemsSetting);
  404. });
  405. function nodeOpration(controller, totalJobs, totalItems){
  406. let btnInsert = $('#insert');
  407. let btnDelete = $('#delete');
  408. let btnUpLevel = $('#upLevel');
  409. let btnDownLevel = $('#downLevel');
  410. let btnUpMove = $('#upMove');
  411. let btnDownMove = $('#downMove');
  412. dbController.editData(controller);
  413. btnInsert.click(function(){
  414. if(btnInsert.attr('doing') === 'false' && btnInsert.attr('fcsOnBills') === 'true'){
  415. dbController.insert(controller, btnInsert);
  416. tools.clearData(jobsSpread.getActiveSheet());
  417. tools.clearData(itemsSpread.getActiveSheet());
  418. }
  419. });
  420. //删除清单
  421. $('#delConfirm').click(function () {
  422. dbController.delete(controller, btnDelete, totalJobs, totalItems);
  423. $('#delAlert').modal('hide');
  424. });
  425. btnDelete.click(function(){
  426. if(btnDelete.attr('doing') === 'false' && btnDelete.attr('fcsOnBills') === 'true'){
  427. $('#delAlert').modal('show');
  428. }
  429. });
  430. btnUpLevel.click(function(){
  431. if(btnUpLevel.attr('doing') === 'false' && btnUpLevel.attr('fcsOnBills') === 'true'){
  432. dbController.upLevel(controller, btnUpLevel);
  433. }
  434. });
  435. btnDownLevel.click(function(){
  436. if(btnDownLevel.attr('doing') === 'false' && btnDownLevel.attr('fcsOnBills') === 'true'){
  437. dbController.downLevel(controller, btnDownLevel);
  438. }
  439. });
  440. btnUpMove.click(function(){
  441. if(btnUpMove.attr('doing') === 'false' && btnUpMove.attr('fcsOnBills') === 'true'){
  442. dbController.upMove(controller, btnUpMove);
  443. }
  444. //refSheet
  445. else if(btnUpMove.attr('doing') === 'false' && btnUpMove.attr('fcsOnBills') === 'false' && btnUpMove.attr('canMove') === 'true'){
  446. if(controller.tree.selected.field === 'job'){
  447. jobsController.upMove(controller, jobsSpread.getActiveSheet());
  448. }
  449. else if(controller.tree.selected.field === 'item'){
  450. itemsController.upMove(controller, itemsSpread.getActiveSheet());
  451. }
  452. }
  453. });
  454. btnDownMove.click(function(){
  455. if(btnDownMove.attr('doing') === 'false' && btnDownMove.attr('fcsOnBills') === 'true'){
  456. dbController.downMove(controller, btnDownMove);
  457. }
  458. else if(btnDownMove.attr('doing') === 'false' && btnDownMove.attr('fcsOnBills') === 'false' && btnDownMove.attr('canMove') === 'true'){
  459. if(controller.tree.selected.field === 'job'){
  460. jobsController.downMove(controller, jobsSpread.getActiveSheet());
  461. }
  462. else if(controller.tree.selected.field === 'item'){
  463. itemsController.downMove(controller, itemsSpread.getActiveSheet());
  464. }
  465. }
  466. });
  467. }
  468. function showBillsSheet(datas, jobsSheet, itemsSheet, setting) {
  469. let billsSpread = new GC.Spread.Sheets.Workbook($('#spreadBills')[0], {sheetCount: 1});
  470. let billsSheet = billsSpread.getSheet(0);
  471. sheetCommonObj.bindEscKey(billsSpread, [{sheet: billsSpread.getSheet(0), editStarting: dbController.onEditStart, editEnded: dbController.onEditEnded}]);
  472. billsSpread.focus(true);
  473. setSheet.initSheet(billsSpread, setting, true);
  474. myKey.delKey(billsSpread);
  475. billsTree.loadDatas(datas);
  476. let controller = TREE_SHEET_CONTROLLER.createNew(billsTree.tree, billsSpread.getActiveSheet(), setting);
  477. controller.showTreeData();
  478. dbController.controller = controller;
  479. sheetBillsDatas = tools.getsheetDatas(controller.sheet, 'bills', controller);
  480. setSheet.formatter(billsSpread.getActiveSheet());
  481. //setTagId
  482. setTagID(controller, setting);
  483. if (!controller.tree.selected && controller.tree.findNode(controller.sheet.getTag(0, 0, GC.Spread.Sheets.SheetArea.viewport))) {
  484. controller.setTreeSelected(controller.tree.findNode(controller.sheet.getTag(0, 0, GC.Spread.Sheets.SheetArea.viewport)));
  485. }
  486. //刷新节点可进行操作的按钮
  487. refreshBtn(controller);
  488. controller.setTreeSelected(controller.tree.findNode(controller.sheet.getTag(0, 0)));
  489. //粘贴事件
  490. bindPasteBills(controller, billsSpread.getActiveSheet(), setting);
  491. //补注内容改变
  492. rechargeChange(controller);
  493. //焦点控制
  494. switchFcs(controller, controller.sheet, billsSpread, jobsSheet, itemsSheet);
  495. //jobs
  496. jobOperation(controller, jobsSheet, function(totalJobs){
  497. //------关联表粘贴复制
  498. bindPasteRel(jobsSheet, controller, totalJobs, jobsSetting);
  499. //items
  500. itemOperation(controller, itemsSheet, function(totalItems){
  501. bindPasteItemsRel(itemsSheet, controller, totalItems, itemsSetting);
  502. //节点操作
  503. nodeOpration(controller, totalJobs, totalItems);
  504. });
  505. });
  506. }
  507. function switchFcs(controller, billsSheet, billsSpread, jobsSheet, itemsSheet){
  508. let btnInsert = $('#insert');
  509. let btnDelete = $('#delete');
  510. let btnUpMove = $('#upMove');
  511. let btnDownMove = $('#downMove');
  512. let btnUpLevel = $('#upLevel');
  513. let btnDownLevel = $('#downLevel');
  514. billsSheet.bind(GC.Spread.Sheets.Events.CellClick, function (sender, args) {
  515. jobsSheet.clearSelection();
  516. itemsSheet.clearSelection();
  517. billsSpread.focus(true);
  518. jobsSheet.options.isProtected = true;
  519. itemsSheet.options.isProtected = true;
  520. billsSheet.options.isProtected = false;
  521. btnInsert.attr('fcsOnBills', 'true');
  522. btnDelete.attr('fcsOnBills', 'true');
  523. btnUpLevel.attr('fcsOnBills', 'true');
  524. btnDownLevel.attr('fcsOnBills', 'true');
  525. btnUpMove.attr('fcsOnBills', 'true');
  526. btnDownMove.attr('fcsOnBills', 'true');
  527. });
  528. jobsSheet.bind(GC.Spread.Sheets.Events.CellClick, function (sender, args) {
  529. itemsSheet.clearSelection();
  530. jobsSpread.focus(true);
  531. itemsSheet.options.isProtected = true;
  532. billsSheet.options.isProtected = true;
  533. jobsSheet.options.isProtected = false;
  534. controller.tree.selected.args = args;
  535. controller.tree.selected.field = 'job';
  536. tools.btnClose(btnInsert);
  537. tools.btnClose(btnDelete);
  538. tools.btnClose(btnUpLevel);
  539. tools.btnClose(btnDownLevel);
  540. btnInsert.attr('fcsOnBills', 'false');
  541. btnDelete.attr('fcsOnBills', 'false');
  542. btnUpLevel.attr('fcsOnBills', 'false');
  543. btnDownLevel.attr('fcsOnBills', 'false');
  544. btnUpMove.attr('fcsOnBills', 'false');
  545. btnDownMove.attr('fcsOnBills', 'false');
  546. let selected;
  547. if(controller.tree.selected){
  548. selected = controller.tree.selected.jobs[args.row];
  549. }
  550. if(tools.canUpMove(selected, controller.tree.selected.jobs)){
  551. tools.btnAction(btnUpMove);
  552. btnUpMove.attr('canMove', 'true');
  553. }
  554. else{
  555. tools.btnClose(btnUpMove);
  556. btnUpMove.attr('canMove', 'false');
  557. }
  558. if(tools.canDownMove(selected, controller.tree.selected.jobs)){
  559. tools.btnAction(btnDownMove);
  560. btnDownMove.attr('canMove', 'true');
  561. }
  562. else{
  563. tools.btnClose(btnDownMove);
  564. btnDownMove.attr('canMove', 'false');
  565. }
  566. });
  567. itemsSheet.bind(GC.Spread.Sheets.Events.CellClick, function (sender, args) {
  568. jobsSheet.clearSelection();
  569. itemsSpread.focus(true);
  570. jobsSheet.options.isProtected = true;
  571. billsSheet.options.isProtected = true;
  572. itemsSheet.options.isProtected = false;
  573. controller.tree.selected.args = args;
  574. controller.tree.selected.field = 'item';
  575. tools.btnClose(btnInsert);
  576. tools.btnClose(btnDelete);
  577. tools.btnClose(btnUpLevel);
  578. tools.btnClose(btnDownLevel);
  579. btnInsert.attr('fcsOnBills', 'false');
  580. btnDelete.attr('fcsOnBills', 'false');
  581. btnUpLevel.attr('fcsOnBills', 'false');
  582. btnDownLevel.attr('fcsOnBills', 'false');
  583. btnUpMove.attr('fcsOnBills', 'false');
  584. btnDownMove.attr('fcsOnBills', 'false');
  585. let selected;
  586. if(controller.tree.selected){
  587. selected = controller.tree.selected.items[args.row];
  588. }
  589. if(tools.canUpMove(selected, controller.tree.selected.items)){
  590. tools.btnAction(btnUpMove);
  591. btnUpMove.attr('canMove', 'true');
  592. }
  593. else{
  594. tools.btnClose(btnUpMove);
  595. btnUpMove.attr('canMove', 'false');
  596. }
  597. if(tools.canDownMove(selected, controller.tree.selected.items)){
  598. tools.btnAction(btnDownMove);
  599. btnDownMove.attr('canMove', 'true');
  600. }
  601. else{
  602. tools.btnClose(btnDownMove);
  603. btnDownMove.attr('canMove', 'false');
  604. }
  605. });
  606. };
  607. function setTagID(controller, setting){
  608. if(controller.tree.items.length > 0){
  609. let length = controller.tree.items.length;
  610. for(var i=0; i<length; i++){
  611. setting.cols.forEach(function(col, colIdx){
  612. if(controller.tree.items[i].data.ID){
  613. controller.sheet.setTag(i, colIdx, controller.tree.items[i].data.ID);
  614. }
  615. });
  616. }
  617. }
  618. }
  619. function refreshBtn(controller){
  620. controller.bind('refreshBaseActn', function (tree) {
  621. let showButton = function (show, btn) {
  622. tools.btnAction($('#insert'), 'focusOnBills');
  623. if (show) {
  624. tools.btnAction(btn, 'doing');
  625. } else {
  626. tools.btnClose(btn, 'doing');
  627. }
  628. };
  629. showButton(tree.selected && tree.selected.canUpLevel(), $('#upLevel'));
  630. showButton(tree.selected && tree.selected.canDownLevel(), $('#downLevel'));
  631. showButton(tree.selected && tree.selected.canUpMove(), $('#upMove'));
  632. showButton(tree.selected && tree.selected.canDownMove(), $('#downMove'));
  633. showButton(tree.selected ? true : false, $('#delete'));
  634. });
  635. }
  636. function rechargeChange(controller){
  637. codeEditor.on("change", function () {
  638. if(controller.tree.selected){
  639. let newData = codeEditor.getValue();
  640. if(newData !== controller.tree.selected.data.recharge){
  641. rechargeController.updateRechar(controller.tree.selected, newData);
  642. }
  643. }
  644. });
  645. /*$('#exampleTextarea').bind('change', function(){
  646. let newData = $('#exampleTextarea').val();
  647. if(controller.tree.selected){
  648. console.log(controller.tree.selected.data.code)
  649. rechargeController.updateRechar(controller.tree.selected, newData);
  650. }
  651. });*/
  652. }
  653. function jobOperation(controller, jobsSheet, callback){
  654. mainAjax.getMaxNumber(billsLibId, 'jobs', function(result){
  655. if(result.length === 0){
  656. maxJobsNumber = 0;
  657. }
  658. else {
  659. maxJobsNumber = result[0].code;
  660. }
  661. jobsAjax.getJobContent(billsLibId, function(datas){
  662. let totalJobs = createObj.newJobs();
  663. totalJobs.loadJobs(controller.tree.items, datas);
  664. jobsController.totalJobs = totalJobs;
  665. initData(controller, jobsSheet, jobsSetting, 'jobs');
  666. myKey.delKey(jobsSpread, controller, totalJobs, jobsSetting, 'jobs');
  667. bindSheet(controller, jobsSheet, 'jobs', jobsSetting);
  668. jobsController.editData(jobsSheet);
  669. if (callback){
  670. callback(totalJobs);
  671. }
  672. });
  673. });
  674. }
  675. function itemOperation(controller, itemsSheet, callback){
  676. mainAjax.getMaxNumber(billsLibId, 'items', function(result){
  677. if(result.length === 0){
  678. maxItemsNumber = 0;
  679. }
  680. else {
  681. maxItemsNumber = result[0].code;
  682. }
  683. itemsAjax.getItemCharacter(billsLibId, function(datas){
  684. let totalItems = createObj.newItems();
  685. totalItems.loadItems(controller.tree.items, datas);
  686. itemsController.totalItems = totalItems;
  687. initData(controller, itemsSheet, itemsSetting, 'items');
  688. myKey.delKey(itemsSpread, controller, totalItems, itemsSetting, 'items');
  689. bindSheet(controller, itemsSheet, 'items', itemsSetting);
  690. itemsController.editData(itemsSheet);
  691. if(callback){
  692. callback(totalItems)
  693. }
  694. });
  695. });
  696. }
  697. //初始焦点工作表和项目表绑定数据
  698. function initData(controller, sheet, setting, classify){
  699. if(controller.tree.selected){
  700. let arr = controller.tree.selected[classify];
  701. let recharge = controller.tree.selected.data.recharge;
  702. let prefix = classify === 'jobs' ? 'job' : 'item';
  703. if(arr.length > 0){
  704. tools.orderReshowData(sheet, arr, setting, prefix,true);
  705. }
  706. else{
  707. setSheet.setMaxRowCount(sheet, []);
  708. }
  709. if(recharge){
  710. codeEditor.setValue(recharge);
  711. //$('#exampleTextarea').val(recharge);
  712. }
  713. else{
  714. codeEditor.setValue('');
  715. //$('#exampleTextarea').val('');
  716. }
  717. }
  718. }
  719. function bindSheet(controller, sheet, field, setting){
  720. controller.sheet.bind(GC.Spread.Sheets.Events.SelectionChanged, function(sender, args){
  721. if(args.newSelections[0]){
  722. controller.tree.selected = controller.tree.items[args.newSelections[0].row] ? controller.tree.items[args.newSelections[0].row] : null;
  723. }
  724. if(controller.tree.selected && args.oldSelections[0].row !== args.newSelections[0].row|| controller.tree.selected && args.oldSelections[0].row === 0){
  725. //rechargeArea
  726. codeEditor.setValue(controller.tree.selected.data.recharge);
  727. //$('#exampleTextarea').val(controller.tree.selected.data.recharge);
  728. if(field === 'jobs'){
  729. tools.clearData(sheet);
  730. let jobs = controller.tree.selected.jobs;
  731. setSheet.setMaxRowCount(sheet, jobs);
  732. if(jobs.length > 0){
  733. tools.orderReshowData(sheet, jobs, setting, 'job', true);
  734. orgJobData = sheet.getValue(0, 0);
  735. }
  736. //sheetDatas = tools.getsheetDatas(sheet, 'jobs');
  737. }
  738. if(field === 'items'){
  739. tools.clearData(sheet);
  740. let items = controller.tree.selected.items;
  741. setSheet.setMaxRowCount(sheet, items);
  742. if(items.length > 0){
  743. tools.orderReshowData(sheet, items, setting, 'item', true);
  744. orgItemData = sheet.getValue(0, 0);
  745. }
  746. //sheetItemsDatas = tools.getsheetDatas(sheet, 'items');
  747. }
  748. }
  749. });
  750. }
  751. function bindPasteBills(controller, sheet, setting){
  752. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, function (sender, args) {
  753. sheetBillsDatas = tools.getsheetDatas(sheet, 'bills', controller);
  754. let maxCol = args.cellRange.col + args.cellRange.colCount - 1;
  755. //复制的列数超过正确的列数,不可复制
  756. if(maxCol >= billsLibSetting.cols.length){
  757. args.cancel = true;
  758. }
  759. });
  760. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, function(sender, args){
  761. let datas = [], field;
  762. let orgRow = args.cellRange.row, orgCol = args.cellRange.col, rowCount = args.cellRange.rowCount, colCount = args.cellRange.colCount;
  763. let maxRow = orgRow + rowCount - 1, maxCol = orgCol + colCount -1;
  764. let markRow = orgRow, colLen = sheet.getColumnCount(GC.Spread.Sheets.SheetArea.viewport);
  765. let validDatas = tools.getValidDatas(sheet, setting, args);
  766. sheet.suspendPaint();
  767. for(let i =orgRow, j=0; i<= maxRow; i++, j++){
  768. //let id = controller.tree.items[i] ? controller.tree.items[i].getID() : null;
  769. let id = sheet.getTag(i, 0);
  770. if(id && j< validDatas.length){
  771. validDatas[j].ID = id;
  772. for(let k =orgCol; k<= maxCol; k++){
  773. setting.cols.forEach(function(col, colIdx){
  774. if(colIdx === k){
  775. if(validDatas[j][col.data.field]){
  776. sheet.setValue(i, k, validDatas[j][col.data.field]);
  777. sheetBillsDatas.datasIdx['rowIdx'+ i][col.data.field] = validDatas[j][col.data.field];
  778. }
  779. else {
  780. sheet.setValue(i, k, '');
  781. sheetBillsDatas.datasIdx['rowIdx'+ i][col.data.field] = '';
  782. }
  783. }
  784. });
  785. }
  786. }
  787. else if(i < controller.tree.items.length && j>= validDatas.length){
  788. //reshow orgDatas
  789. sheet.setValue(i, 0, sheetBillsDatas.datasIdx['rowIdx'+ i].code + '');
  790. sheet.setValue(i, 1, sheetBillsDatas.datasIdx['rowIdx'+ i].name);
  791. sheet.setValue(i, 2, sheetBillsDatas.datasIdx['rowIdx'+ i].unit);
  792. sheet.setValue(i, 3, sheetBillsDatas.datasIdx['rowIdx'+ i].ruleText);
  793. sheet.setValue(i, 4, sheetBillsDatas.datasIdx['rowIdx'+ i].engineering);
  794. }
  795. else {
  796. sheet.clear(i, 0, 1, sheet.getColumnCount(), GC.Spread.Sheets.SheetArea.viewport,GC.Spread.Sheets.StorageType.data);
  797. }
  798. }
  799. sheet.resumePaint();
  800. billsAjax.pasteBills(userAccount, billsLibId, validDatas);
  801. for(let vData of validDatas){
  802. let node = controller.tree.nodes['id_' + vData.ID];
  803. if(node){
  804. Object.assign(node.data, vData);
  805. }
  806. }
  807. sheet.setRowCount(sheetBillsDatas.datas.length);
  808. });
  809. }
  810. function bindPasteRel(sheet, controller, totalJobs, setting){
  811. //sheetDatas = tools.getsheetDatas(sheet, 'jobs');
  812. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, function (sender, args) {
  813. let maxCol = args.cellRange.col + args.cellRange.colCount - 1;
  814. sheetDatas = tools.getsheetDatas(sheet, 'jobs');
  815. //复制的列数超过正确的列数,不可复制
  816. if(maxCol >= jobsSetting.cols.length){
  817. args.cancel = true;
  818. }
  819. });
  820. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, function(sender, args){
  821. if(controller.tree.selected){
  822. let orgRow = args.cellRange.row, orgCol = args.cellRange.col, rowCount = args.cellRange.rowCount, colCount = args.cellRange.colCount;
  823. let maxRow = orgRow + rowCount - 1, maxCol = orgCol + colCount -1;
  824. let pasteArr = [];
  825. let crossedDatas = [];
  826. let uncrossedDatas = [];
  827. const codeCol = 0;
  828. const contentCol = 1;
  829. for(let i=orgRow; i<=maxRow; i++){
  830. //粘贴编号列,转换成粘贴内容处理
  831. let code = sheet.getCell(i, codeCol).value();
  832. let content = sheet.getCell(i, contentCol).value();
  833. if(code && !content){
  834. let contentByCode = tools.getContentByCode(totalJobs.jobsArr, code);
  835. if(contentByCode){
  836. pasteArr.push(contentByCode);
  837. }
  838. }
  839. if(content){
  840. pasteArr.push(content);
  841. }
  842. }
  843. let uniqPasteArr = tools.uniqArr(pasteArr);
  844. let serialNoUn = tools.getSerialNo(controller.tree.selected.jobs) - 1;
  845. for(let i =orgRow, j=0; i<=uniqPasteArr.length+orgRow-1; i++, j++ ){
  846. let flag = true;
  847. let crossedData;
  848. sheetDatas.forEach(function(rowData){
  849. if(rowData.rowIdx === i && rowData.data !== uniqPasteArr[j]){
  850. flag = false;
  851. let serialNo = tools.getObj(controller.tree.selected.jobs, rowData.id, 'job');
  852. crossedData = {
  853. orgId: rowData.id,
  854. newData: uniqPasteArr[j],
  855. serialNo: serialNo
  856. };
  857. }
  858. });
  859. if(flag){
  860. serialNoUn++;
  861. uncrossedDatas.push({data: uniqPasteArr[j], serialNo: serialNoUn});
  862. }
  863. else {
  864. crossedDatas.push(crossedData);
  865. }
  866. }
  867. let pasteDatas = tools.encapData(uncrossedDatas, crossedDatas, controller, totalJobs);
  868. if(pasteDatas.updateDatas.length > 0 || pasteDatas.createDatas.length > 0){
  869. billsAjax.pasteRel(userAccount, billsLibId, pasteDatas.updateDatas, pasteDatas.createDatas, 'jobs', function(datas){
  870. pasteController.frontOperator(sheet, setting, controller, totalJobs, datas);
  871. });
  872. }
  873. else {
  874. tools.orderReshowData(sheet, controller.tree.selected.jobs, setting, 'job', true);
  875. }
  876. }
  877. else {
  878. tools.clearData(sheet);
  879. }
  880. });
  881. }
  882. function bindPasteItemsRel(sheet, controller, totalItems, setting){
  883. //sheetItemsDatas = tools.getsheetDatas(sheet, 'items');
  884. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasting, function (sender, args) {
  885. let maxCol = args.cellRange.col + args.cellRange.colCount - 1;
  886. sheetItemsDatas = tools.getsheetDatas(sheet, 'items');
  887. //复制的列数超过正确的列数,不可复制
  888. if(maxCol >= itemsSetting.cols.length){
  889. args.cancel = true;
  890. }
  891. });
  892. sheet.bind(GC.Spread.Sheets.Events.ClipboardPasted, function(sender, args){
  893. if(controller.tree.selected){
  894. let orgRow = args.cellRange.row, orgCol = args.cellRange.col, rowCount = args.cellRange.rowCount, colCount = args.cellRange.colCount;
  895. let maxRow = orgRow + rowCount - 1, maxCol = orgCol + colCount -1;
  896. let pasteArr = [];
  897. let crossedDatas = [];
  898. let uncrossedDatas = [];
  899. const codeCol = 0;
  900. const contentCol = 1;
  901. for(let i=orgRow; i<=maxRow; i++){
  902. //编号列转换成内容列处理
  903. let code = sheet.getCell(i, codeCol).value();
  904. let content = sheet.getCell(i, contentCol).value();
  905. if(code && !content){
  906. let contentByCode = tools.getContentByCode(totalItems.itemsArr, code);
  907. if(contentByCode){
  908. pasteArr.push(contentByCode);
  909. }
  910. }
  911. if(content){
  912. pasteArr.push(content);
  913. }
  914. }
  915. let uniqPasteArr = tools.uniqArr(pasteArr);
  916. let serialNoUn = tools.getSerialNo(controller.tree.selected.items) - 1;
  917. for(let i =orgRow, j=0; i<=uniqPasteArr.length+orgRow-1; i++, j++ ){
  918. let flag = true;
  919. let crossedData;
  920. sheetItemsDatas.forEach(function(rowData){
  921. if(rowData.rowIdx === i && rowData.data !== uniqPasteArr[j]){
  922. flag = false;
  923. let serialNo = tools.getObj(controller.tree.selected.items, rowData.id, 'item');
  924. crossedData = {
  925. orgId: rowData.id,
  926. newData: uniqPasteArr[j],
  927. serialNo: serialNo
  928. };
  929. }
  930. });
  931. if(flag){
  932. serialNoUn ++;
  933. uncrossedDatas.push({data: uniqPasteArr[j], serialNo: serialNoUn});
  934. }
  935. else {
  936. crossedDatas.push(crossedData);
  937. }
  938. }
  939. let pasteDatas = tools.encapItemsData(uncrossedDatas, crossedDatas, controller, totalItems);
  940. if(pasteDatas.updateDatas.length > 0 || pasteDatas.createDatas.length > 0){
  941. billsAjax.pasteRel(userAccount, billsLibId, pasteDatas.updateDatas, pasteDatas.createDatas, 'items', function(datas){
  942. pasteController.frontItemsRelOperator(sheet, setting, controller, totalItems, datas);
  943. });
  944. }
  945. else{
  946. tools.orderReshowData(sheet, controller.tree.selected.items, setting, 'item', true);
  947. }
  948. }
  949. else {
  950. tools.clearData(sheet);
  951. }
  952. });
  953. }
  954. function buildJobs(jobsSpread, setting){
  955. setSheet.initSheet(jobsSpread, setting, true);
  956. jobsSpread.getActiveSheet().clearSelection();
  957. myKey.downKey(jobsSpread);
  958. myKey.enterKey(jobsSpread);
  959. TREE_SHEET_HELPER.loadSheetHeader(jobsSetting, jobsSpread.getActiveSheet());
  960. }
  961. function buildItems(itemsSpread, setting){
  962. setSheet.initSheet(itemsSpread, setting, true);
  963. // setSheet.setMaxRowCount(itemsSpread.getActiveSheet(), 10);
  964. itemsSpread.getActiveSheet().clearSelection();
  965. myKey.downKey(itemsSpread);
  966. myKey.enterKey(itemsSpread);
  967. TREE_SHEET_HELPER.loadSheetHeader(itemsSetting, itemsSpread.getActiveSheet());
  968. }
  969. </script>
  970. </html>