detail_modal.ejs 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. <!--标段设置-标段属性-->
  2. <div class="modal fade" id="bd-set-1" data-backdrop="static">
  3. <div class="modal-dialog" role="document">
  4. <div class="modal-content">
  5. <div class="modal-header">
  6. <h5 class="modal-title">标段属性</h5>
  7. </div>
  8. <div class="modal-height-500" style="overflow-y: auto">
  9. <div class="modal-body">
  10. <ul class="nav nav-tabs nav-justified mb-2">
  11. <li class="nav-item">
  12. <a class="nav-link active" data-toggle="tab" href="#htxx" role="tab" aria-selected="true">合同信息</a>
  13. </li>
  14. <li class="nav-item">
  15. <a class="nav-link" data-toggle="tab" href="#cjdw" role="tab" aria-selected="false">参建单位</a>
  16. </li>
  17. <li class="nav-item">
  18. <a class="nav-link" data-toggle="tab" href="#jscs" role="tab">技术参数</a>
  19. </li>
  20. </ul>
  21. <div class="tab-content">
  22. <div class="tab-pane active" id="htxx">
  23. <div class="form-group">
  24. <div class="row">
  25. <div class="col-12 mb-2">
  26. <div class="input-group input-group-sm">
  27. <div class="input-group-prepend">
  28. <span class="input-group-text">建设项目名称</span>
  29. </div>
  30. <input type="text" class="form-control" value="项目A" id="build-name" maxlength="100">
  31. </div>
  32. </div>
  33. <div class="col-12 mb-2">
  34. <div class="input-group input-group-sm">
  35. <div class="input-group-prepend">
  36. <span class="input-group-text" style="width:90px">合同编号</span>
  37. </div>
  38. <input type="text" class="form-control" value="" id="deal-code" maxlength="100">
  39. </div>
  40. </div>
  41. <div class="col-12">
  42. <div class="input-group input-group-sm">
  43. <div class="input-group-prepend">
  44. <span class="input-group-text" style="width:90px">合同名称</span>
  45. </div>
  46. <input type="text" class="form-control" value="" id="deal-name" maxlength="100">
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="tab-pane" id="cjdw">
  53. <div class="form-group mb-4">
  54. <label>建设单位:</label>
  55. <div class="row">
  56. <div class="col-12 mb-2">
  57. <div class="input-group input-group-sm">
  58. <div class="input-group-prepend">
  59. <span class="input-group-text">单位名称</span>
  60. </div>
  61. <input type="text" class="form-control" value="" id="build-company" maxlength="100">
  62. </div>
  63. </div>
  64. <div class="col-6 pr-0">
  65. <div class="input-group input-group-sm">
  66. <div class="input-group-prepend">
  67. <span class="input-group-text">法人代表</span>
  68. </div>
  69. <input type="text" class="form-control" value="" id="build-corporation" maxlength="100">
  70. </div>
  71. </div>
  72. <div class="col-6">
  73. <div class="input-group input-group-sm">
  74. <div class="input-group-prepend">
  75. <span class="input-group-text">签订日期</span>
  76. </div>
  77. <input type="date" class="form-control" value="" id="build-date">
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. <div class="form-group mb-4">
  83. <label>承包单位1:</label>
  84. <div class="row">
  85. <div class="col-12 mb-2">
  86. <div class="input-group input-group-sm">
  87. <div class="input-group-prepend">
  88. <span class="input-group-text">单位名称</span>
  89. </div>
  90. <input type="text" class="form-control" value="" id="contract1-company" maxlength="100">
  91. </div>
  92. </div>
  93. <div class="col-6 pr-0">
  94. <div class="input-group input-group-sm">
  95. <div class="input-group-prepend">
  96. <span class="input-group-text">法人代表</span>
  97. </div>
  98. <input type="text" class="form-control" value="" id="contract1-corporation" maxlength="100">
  99. </div>
  100. </div>
  101. <div class="col-6">
  102. <div class="input-group input-group-sm">
  103. <div class="input-group-prepend">
  104. <span class="input-group-text">签订日期</span>
  105. </div>
  106. <input type="date" class="form-control" value="" id="contract1-date">
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="form-group mb-4">
  112. <label>承包单位2:</label>
  113. <div class="row">
  114. <div class="col-12 mb-2">
  115. <div class="input-group input-group-sm">
  116. <div class="input-group-prepend">
  117. <span class="input-group-text">单位名称</span>
  118. </div>
  119. <input type="text" class="form-control" value="" id="contract2-company" maxlength="100">
  120. </div>
  121. </div>
  122. <div class="col-6 pr-0">
  123. <div class="input-group input-group-sm">
  124. <div class="input-group-prepend">
  125. <span class="input-group-text">法人代表</span>
  126. </div>
  127. <input type="text" class="form-control" value="" id="contract2-corporation" maxlength="100">
  128. </div>
  129. </div>
  130. <div class="col-6">
  131. <div class="input-group input-group-sm">
  132. <div class="input-group-prepend">
  133. <span class="input-group-text">签订日期</span>
  134. </div>
  135. <input type="date" class="form-control" value="" id="contract2-date">
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. <div class="form-group mb-4">
  141. <label>监理单位1:</label>
  142. <div class="row">
  143. <div class="col-12 mb-2">
  144. <div class="input-group input-group-sm">
  145. <div class="input-group-prepend">
  146. <span class="input-group-text">单位名称</span>
  147. </div>
  148. <input type="text" class="form-control" value="" id="supervision1-company" maxlength="100">
  149. </div>
  150. </div>
  151. <div class="col-6 pr-0">
  152. <div class="input-group input-group-sm">
  153. <div class="input-group-prepend">
  154. <span class="input-group-text">法人代表</span>
  155. </div>
  156. <input type="text" class="form-control" value="" id="supervision1-corporation" maxlength="100">
  157. </div>
  158. </div>
  159. <div class="col-6">
  160. <div class="input-group input-group-sm">
  161. <div class="input-group-prepend">
  162. <span class="input-group-text">签订日期</span>
  163. </div>
  164. <input type="date" class="form-control" value="" id="supervision1-date">
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. <div class="form-group">
  170. <label>监理单位2:</label>
  171. <div class="row">
  172. <div class="col-12 mb-2">
  173. <div class="input-group input-group-sm">
  174. <div class="input-group-prepend">
  175. <span class="input-group-text">单位名称</span>
  176. </div>
  177. <input type="text" class="form-control" value="" id="supervision2-company" maxlength="100">
  178. </div>
  179. </div>
  180. <div class="col-6 pr-0">
  181. <div class="input-group input-group-sm">
  182. <div class="input-group-prepend">
  183. <span class="input-group-text">法人代表</span>
  184. </div>
  185. <input type="text" class="form-control" value="" id="supervision2-corporation" maxlength="100">
  186. </div>
  187. </div>
  188. <div class="col-6">
  189. <div class="input-group input-group-sm">
  190. <div class="input-group-prepend">
  191. <span class="input-group-text">签订日期</span>
  192. </div>
  193. <input type="date" class="form-control" value="" id="supervision2-date">
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="tab-pane" id="jscs">
  200. <div class="form-group">
  201. <div class="row">
  202. <div class="col-6 pr-0 mb-2">
  203. <div class="input-group input-group-sm">
  204. <div class="input-group-prepend">
  205. <span class="input-group-text">公路等级</span>
  206. </div>
  207. <select class="form-control" id="load-level">
  208. <option>高速公路</option>
  209. <option>一级公路</option>
  210. <option>二级公路</option>
  211. <option>三级公路</option>
  212. <option>四级公路</option>
  213. </select>
  214. </div>
  215. </div>
  216. <div class="col-6">
  217. <div class="input-group input-group-sm">
  218. <div class="input-group-prepend">
  219. <span class="input-group-text" style="width:90px">长度(KM)</span>
  220. </div>
  221. <input type="text" class="form-control" value="" id="length" min="0" max="10000"
  222. oninput="limitDealParamLength(this)" onchange="checkNumberValid(this)">
  223. </div>
  224. </div>
  225. <div class="col-6 pr-0 mb-2">
  226. <div class="input-group input-group-sm">
  227. <div class="input-group-prepend">
  228. <span class="input-group-text">起始桩号</span>
  229. </div>
  230. <input type="text" class="form-control" value="" id="start-peg" maxlength="100">
  231. </div>
  232. </div>
  233. <div class="col-6">
  234. <div class="input-group input-group-sm">
  235. <div class="input-group-prepend">
  236. <span class="input-group-text" style="width:90px">终止桩号</span>
  237. </div>
  238. <input type="text" class="form-control" value="" id="end-peg" maxlength="100">
  239. </div>
  240. </div>
  241. <div class="col-6 pr-0 mb-2">
  242. <div class="input-group input-group-sm">
  243. <div class="input-group-prepend">
  244. <span class="input-group-text" style="width:66px">车道数</span>
  245. </div>
  246. <input type="text" class="form-control" value="" id="lane-count" maxlength="100">
  247. </div>
  248. </div>
  249. <div class="col-6">
  250. <div class="input-group input-group-sm">
  251. <div class="input-group-prepend">
  252. <span class="input-group-text" style="width:90px">合同工期</span>
  253. </div>
  254. <input type="text" class="form-control" value="" id="deal-period" maxlength="100">
  255. </div>
  256. </div>
  257. <div class="col-6 pr-0 mb-2">
  258. <div class="input-group input-group-sm">
  259. <div class="input-group-prepend">
  260. <span class="input-group-text">开工日期</span>
  261. </div>
  262. <input type="date" class="form-control" value="" id="start-date">
  263. </div>
  264. </div>
  265. <div class="col-6">
  266. <div class="input-group input-group-sm">
  267. <div class="input-group-prepend">
  268. <span class="input-group-text">计划完工日期</span>
  269. </div>
  270. <input type="date" class="form-control" value="" id="plan-end-date">
  271. </div>
  272. </div>
  273. </div>
  274. </div>
  275. </div>
  276. </div>
  277. </div>
  278. </div>
  279. <div class="modal-footer">
  280. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  281. <button type="button" class="btn btn-sm btn-primary" onclick="post1();">确认修改</button>
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. <% if (((tender.ledger_status === audit.ledger.status.uncheck || tender.ledger_status === audit.ledger.status.checkNo) && tender.user_id === ctx.session.sessionUser.accountId)
  287. || (lastStage && lastStage.user_id === ctx.session.sessionUser.accountId && (lastStage.status === audit.stage.status.checkNo || lastStage.status === audit.stage.status.uncheck))) { %>
  288. <!--标段设置-小数位数-->
  289. <div class="modal fade" id="bd-set-2" data-backdrop="static">
  290. <div class="modal-dialog" role="document">
  291. <div class="modal-content">
  292. <div class="modal-header">
  293. <h5 class="modal-title">小数位数</h5>
  294. </div>
  295. <div class="modal-body">
  296. <div class="form-group">
  297. <label>全局设置</label>
  298. <div class="row">
  299. <div class="col-4">
  300. <div class="input-group input-group-sm">
  301. <div class="input-group-prepend">
  302. <span class="input-group-text">单价</span>
  303. </div>
  304. <input type="number" class="form-control" value="3" id="decimal-up"
  305. min="0" max="4" maxlength="1" oninput="limitDecimal(this)">
  306. </div>
  307. </div>
  308. <div class="col-4">
  309. <div class="input-group input-group-sm">
  310. <div class="input-group-prepend">
  311. <span class="input-group-text">金额</span>
  312. </div>
  313. <input type="number" class="form-control" value="2" id="decimal-tp"
  314. oninput="limitDecimal(this)" min="0" max="4" maxlength="1">
  315. </div>
  316. </div>
  317. </div>
  318. </div>
  319. <div class="form-group">
  320. <label>单独设置</label>
  321. <div class="row">
  322. <div class="col-auto mt-1">
  323. <div class="form-group form-check pl-0">
  324. <div class="custom-control custom-switch">
  325. <input type="checkbox" class="custom-control-input" id="decimal-pay">
  326. <label class="custom-control-label" for="decimal-pay">合同支付</label>
  327. </div>
  328. </div>
  329. </div>
  330. <div class="col-4">
  331. <div class="input-group input-group-sm">
  332. <div class="input-group-prepend">
  333. <span class="input-group-text">金额</span>
  334. </div>
  335. <input type="number" class="form-control" value="2" id="decimal-pay-tp"
  336. oninput="limitDecimal(this)" min="0" max="4" maxlength="1">
  337. </div>
  338. </div>
  339. </div>
  340. </div>
  341. </div>
  342. <div class="modal-footer">
  343. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  344. <button type="button" class="btn btn-sm btn-primary" onclick="post2();">确认修改</button>
  345. </div>
  346. </div>
  347. </div>
  348. </div>
  349. <!--标段设置-清单精度-->
  350. <div class="modal fade" id="bd-set-3" data-backdrop="static">
  351. <div class="modal-dialog" role="document">
  352. <div class="modal-content">
  353. <div class="modal-header">
  354. <h5 class="modal-title">数量精度</h5>
  355. </div>
  356. <div class="modal-body">
  357. <div class="form-group" id="precision-spread" style="height: 397px; width: 465px;">
  358. </div>
  359. </div>
  360. <div class="modal-footer">
  361. <div id="hint-3" class="text-danger fa fa-exclamation-circle" style="display: none;"></div>
  362. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  363. <button type="button" class="btn btn-sm btn-primary" onclick="post3();">确认修改</button>
  364. </div>
  365. </div>
  366. </div>
  367. </div>
  368. <% } else { %>
  369. <!--标段设置-小数位数-->
  370. <div class="modal fade" id="bd-set-2" data-backdrop="static">
  371. <div class="modal-dialog" role="document">
  372. <div class="modal-content">
  373. <div class="modal-header">
  374. <h5 class="modal-title">小数位数</h5>
  375. </div>
  376. <div class="modal-body">
  377. <div class="form-group">
  378. <label>全局设置</label>
  379. <div class="row">
  380. <div class="col-4">
  381. <div class="input-group input-group-sm">
  382. <div class="input-group-prepend">
  383. <span class="input-group-text">单价</span>
  384. </div>
  385. <input type="number" class="form-control" value="3" id="decimal-up" readonly="">
  386. </div>
  387. </div>
  388. <div class="col-4">
  389. <div class="input-group input-group-sm">
  390. <div class="input-group-prepend">
  391. <span class="input-group-text">金额</span>
  392. </div>
  393. <input type="number" class="form-control" value="2" id="decimal-tp" readonly="">
  394. </div>
  395. </div>
  396. </div>
  397. </div>
  398. <div class="form-group">
  399. <label>单独设置</label>
  400. <div class="row">
  401. <div class="col-auto mt-1">
  402. <div class="form-group form-check pl-0">
  403. <div class="custom-control custom-switch">
  404. <input type="checkbox" class="custom-control-input" id="decimal-pay" readonly="">
  405. <label class="custom-control-label" for="decimal-pay">合同支付</label>
  406. </div>
  407. </div>
  408. </div>
  409. <div class="col-4">
  410. <div class="input-group input-group-sm">
  411. <div class="input-group-prepend">
  412. <span class="input-group-text">金额</span>
  413. </div>
  414. <input type="number" class="form-control" value="2" id="decimal-pay-tp" readonly="">
  415. </div>
  416. </div>
  417. </div>
  418. </div>
  419. </div>
  420. <div class="modal-footer">
  421. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">确定</button>
  422. </div>
  423. </div>
  424. </div>
  425. </div>
  426. <!--标段设置-清单精度-->
  427. <div class="modal fade" id="bd-set-3" data-backdrop="static">
  428. <div class="modal-dialog" role="document">
  429. <div class="modal-content">
  430. <div class="modal-header">
  431. <h5 class="modal-title">数量精度</h5>
  432. </div>
  433. <div class="modal-body">
  434. <div class="sjs-option-height" id="precision-spread" style="height: 397px; width: 465px;">
  435. </div>
  436. </div>
  437. <div class="modal-footer">
  438. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">确定</button>
  439. </div>
  440. </div>
  441. </div>
  442. </div>
  443. <% } %>
  444. <% if (!lastStage || (lastStage.order === 1 && lastStage.user_id === ctx.session.sessionUser.accountId && (lastStage.status === audit.stage.status.checkNo || lastStage.status === audit.stage.status.uncheck))) { %>
  445. <!--标段设置-合同参数-->
  446. <div class="modal fade" id="bd-set-4" data-backdrop="static">
  447. <div class="modal-dialog" role="document">
  448. <div class="modal-content">
  449. <div class="modal-header">
  450. <h5 class="modal-title">合同参数</h5>
  451. </div>
  452. <div class="modal-body">
  453. <div class="form-group">
  454. <!--默认显示-->
  455. <div class="form-group" id="param-spread" style="height: 230px; width: 465px;">
  456. </div>
  457. </div>
  458. </div>
  459. <div class="modal-footer">
  460. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  461. <button type="button" class="btn btn-sm btn-primary" onclick="post4()">确认修改</button>
  462. </div>
  463. </div>
  464. </div>
  465. </div>
  466. <% } else { %>
  467. <!--标段设置-合同参数-->
  468. <div class="modal fade" id="bd-set-4" data-backdrop="static">
  469. <div class="modal-dialog" role="document">
  470. <div class="modal-content">
  471. <div class="modal-header">
  472. <h5 class="modal-title">合同参数</h5>
  473. </div>
  474. <div class="modal-body">
  475. <div class="form-group">
  476. <!--默认显示-->
  477. <div class="form-group" id="param-spread" style="height: 230px; width: 465px;">
  478. </div>
  479. </div>
  480. </div>
  481. <div class="modal-footer">
  482. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">确定</button>
  483. </div>
  484. </div>
  485. </div>
  486. </div>
  487. <% } %>
  488. <!--标段设置-显示设置-->
  489. <div class="modal fade" id="bd-set-5" data-backdrop="static">
  490. <div class="modal-dialog" role="document">
  491. <div class="modal-content">
  492. <div class="modal-header">
  493. <h5 class="modal-title">显示设置</h5>
  494. </div>
  495. <div class="modal-body">
  496. <div class="form-group">
  497. <div class="custom-control custom-checkbox mb-2">
  498. <input type="checkbox" class="form-check-input" id="ledger-dgn-qty" checked="">
  499. <label class="form-check-label" for="ledger-dgn-qty">项目节数量</label>
  500. </div>
  501. <div class="custom-control custom-checkbox">
  502. <input type="checkbox" class="form-check-input" id="ledger-cl-qty" checked="">
  503. <label class="form-check-label" for="ledger-cl-qty">错漏增减</label>
  504. </div>
  505. </div>
  506. </div>
  507. <div class="modal-footer">
  508. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  509. <button type="button" class="btn btn-sm btn-primary" onclick="post5()">确认修改</button>
  510. </div>
  511. </div>
  512. </div>
  513. </div>
  514. <!--标段设置-章节设置-->
  515. <div class="modal fade" id="bd-set-6" data-backdrop="static">
  516. <div class="modal-dialog" role="document">
  517. <div class="modal-content">
  518. <div class="modal-header">
  519. <h5 class="modal-title">章节设置</h5>
  520. </div>
  521. <div class="modal-body">
  522. <div class="form-group" id="chapter-spread" style="height: 330px; width: 465px;">
  523. </div>
  524. </div>
  525. <div class="modal-footer">
  526. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">取消</button>
  527. <button type="button" class="btn btn-sm btn-primary" onclick="post6()">确认修改</button>
  528. </div>
  529. </div>
  530. </div>
  531. </div>
  532. <script>
  533. let property = JSON.parse('<%- JSON.stringify(tenderInfo) %>');
  534. let ledgerChecked = <%- tender.ldeger_status === audit.ledger.status.checked %>;
  535. let firstStageChecked = <%- lastStage !== undefined && lastStage !== null && (lastStage.order > 1 || (lastStage.order === 1 && lastStage.status === audit.stage.status.checked)) %>;
  536. // 根据Min Max限制Input输入
  537. function limitInputMinMax (obj) {
  538. if (_.toNumber(obj.value) > _.toNumber(obj.max)) {
  539. obj.value = obj.max;
  540. }
  541. if(_.toNumber(obj.value) < _.toNumber(obj.min)) {
  542. obj.value = obj.min;
  543. }
  544. }
  545. // 根据Maxlength限制input输入
  546. function limitMaxLength (obj) {
  547. if (obj.value.length > obj.maxLength) {
  548. obj.value = obj.value.substr(0, obj.maxLength);
  549. }
  550. }
  551. // 根据正则限制输入
  552. function limitReg(obj, reg) {
  553. obj.value = obj.value.replace(reg, '');
  554. }
  555. // 小数位数 input 输入限制
  556. function limitDecimal(obj) {
  557. limitReg(obj, /[^\d]/g);
  558. limitMaxLength(obj);
  559. limitInputMinMax(obj);
  560. }
  561. function limitDealParamLength(obj) {
  562. limitReg(obj, /[^\d\.]/g); // 过滤数字和.
  563. limitReg(obj, /\.{2,}/g); // 过滤第二个.
  564. limitInputMinMax(obj);
  565. }
  566. function checkNumberValid(obj) {
  567. const value = _.toNumber(obj.value);
  568. obj.value = value ? value : '';
  569. }
  570. // 属性
  571. function loadCommonProperty () {
  572. // 合同信息
  573. $('#build-name').val(property.deal_info.buildName);
  574. $('#deal-code').val(property.deal_info.dealCode);
  575. $('#deal-name').val(property.deal_info.dealName);
  576. // 参建单位
  577. // 建设单位
  578. $('#build-company').val(property.construction_unit.build.company);
  579. $('#build-corporation').val(property.construction_unit.build.corporation);
  580. $('#build-date').val(property.construction_unit.build.date);
  581. // 承包单位1
  582. $('#contract1-company').val(property.construction_unit.contract1.company);
  583. $('#contract1-corporation').val(property.construction_unit.contract1.corporation);
  584. $('#contract1-date').val(property.construction_unit.contract1.date);
  585. // 承包单位2
  586. $('#contract2-company').val(property.construction_unit.contract2.company);
  587. $('#contract2-corporation').val(property.construction_unit.contract2.corporation);
  588. $('#contract2-date').val(property.construction_unit.contract2.date);
  589. // 监理单位1
  590. $('#supervision1-company').val(property.construction_unit.supervision1.company);
  591. $('#supervision1-corporation').val(property.construction_unit.supervision1.corporation);
  592. $('#supervision1-date').val(property.construction_unit.supervision1.date);
  593. // 监理单位2
  594. $('#supervision2-company').val(property.construction_unit.supervision2.company);
  595. $('#supervision2-corporation').val(property.construction_unit.supervision2.corporation);
  596. $('#supervision2-date').val(property.construction_unit.supervision2.date);
  597. // 技术参数
  598. $('#loadLevel').val(property.tech_param.loadLevel);
  599. $('#length').val(property.tech_param.loadLength);
  600. $('#start-peg').val(property.tech_param.startPeg);
  601. $('#end-peg').val(property.tech_param.endPeg);
  602. $('#lane-count').val(property.tech_param.laneCount);
  603. $('#deal-period').val(property.tech_param.dealPeriod);
  604. $('#start-date').val(property.tech_param.startDate);
  605. $('#plan-end-date').val(property.tech_param.planEndDate);
  606. }
  607. $('#bd-set-1').on('show.bs.modal', function () {
  608. loadCommonProperty();
  609. })
  610. function post1 () {
  611. const prop = {
  612. deal_info: {
  613. buildName: $('#build-name').val(),
  614. dealCode: $('#deal-code').val(),
  615. dealName: $('#deal-name').val(),
  616. },
  617. construction_unit: {
  618. build: {
  619. company: $('#build-company').val(),
  620. corporation: $('#build-corporation').val(),
  621. date: $('#build-date').val(),
  622. },
  623. contract1: {
  624. company: $('#contract1-company').val(),
  625. corporation: $('#contract1-corporation').val(),
  626. date: $('#contract1-date').val(),
  627. },
  628. contract2: {
  629. company: $('#contract2-company').val(),
  630. corporation: $('#contract2-corporation').val(),
  631. date: $('#contract2-date').val(),
  632. },
  633. supervision1: {
  634. company: $('#supervision1-company').val(),
  635. corporation: $('#supervision1-corporation').val(),
  636. date: $('#supervision1-date').val(),
  637. },
  638. supervision2: {
  639. company: $('#supervision2-company').val(),
  640. corporation: $('#supervision2-corporation').val(),
  641. date: $('#supervision2-date').val(),
  642. },
  643. },
  644. tech_param: {
  645. loadLevel: _.toNumber($('#loadLevel').val()),
  646. loadLength: _.toNumber($('#length').val()),
  647. startPeg: $('#start-peg').val(),
  648. endPeg: $('#end-peg').val(),
  649. laneCount: _.toNumber($('#lane-count').val()),
  650. dealPeriod: $('#deal-period').val(),
  651. startDate: $('#start-date').val(),
  652. planEndDate: $('#plan-end-date').val(),
  653. }
  654. };
  655. const tenderId = window.location.pathname.split('/')[2];
  656. postData('/tender/' + tenderId + '/save', prop, function (data) {
  657. setReadOnly('#v-pills-1', true);
  658. property.deal_info = data.deal_info;
  659. property.construction_unit = data.construction_unit;
  660. property.tech_param = data.tech_param;
  661. $('#bd-set-1').modal('hide');
  662. });
  663. }
  664. // 小数位数
  665. function loadCalculateProperty () {
  666. $('#decimal-up').val(property.decimal.up);
  667. $('#decimal-tp').val(property.decimal.tp);
  668. $('#decimal-pay')[0].checked = property.decimal.pay;
  669. $('#decimal-pay-tp').val(property.decimal.payTp);
  670. }
  671. $('#bd-set-2').on('show.bs.modal', function () {
  672. loadCalculateProperty();
  673. });
  674. function post2() {
  675. const prop = {
  676. decimal: {
  677. up: _.toNumber($('#decimal-up').val()),
  678. tp: _.toNumber($('#decimal-tp').val()),
  679. pay: $('#decimal-pay')[0].checked,
  680. payTp: _.toNumber($('#decimal-pay-tp').val()),
  681. }
  682. };
  683. if (ledgerChecked) {
  684. if (prop.decimal.up < property.decimal.up) {
  685. toastr.warning('台账已审批完成,单价的小数位数,不可小于' + property.decimal.up);
  686. return;
  687. }
  688. if (prop.decimal.tp < property.decimal.tp) {
  689. toastr.warning('台账已审批完成,金额的小数位数,不可小于' + property.decimal.tp);
  690. return;
  691. }
  692. }
  693. if (firstStageChecked) {
  694. if (property.decimal.pay) {
  695. if (!prop.decimal.pay) {
  696. toastr.warning('第一期已审批完成,不可取消合同支付单独设置');
  697. return;
  698. }
  699. if (prop.decimal.payTp < property.decimal.payTp) {
  700. toastr.warning('第一期已审批完成,单独设置的合同支付小数位数,不可小于' + property.decimal.payTp);
  701. return;
  702. }
  703. } else {
  704. if (prop.decimal.pay) {
  705. toastr.warning('第一期已审批完成,合同支付不可单独设置');
  706. return;
  707. }
  708. }
  709. }
  710. const tenderId = window.location.pathname.split('/')[2];
  711. postData('/tender/' + tenderId + '/save', prop, function (data) {
  712. property.decimal = data.decimal;
  713. $('#bd-set-2').modal('hide');
  714. }, null, true);
  715. }
  716. // 清单精度
  717. const precisionObj = (function () {
  718. const spread = SpreadJsObj.createNewSpread($('#precision-spread')[0]);
  719. spread.options.showVerticalScrollbar = false;
  720. spread.options.showHorizontalScrollbar = false;
  721. const sheet = spread.getActiveSheet();
  722. SpreadJsObj.protectedSheet(sheet);
  723. //sheet.options.rowHeaderVisible = false;
  724. //sheet.options.colHeaderVisible = false;
  725. sheet.setText(0, 0, '单位', spreadNS.SheetArea.colHeader);
  726. sheet.setText(0, 1, '精度', spreadNS.SheetArea.colHeader);
  727. sheet.setRowHeight(0, 32, spreadNS.SheetArea.colHeader);
  728. const vStyle = new spreadNS.Style();
  729. vStyle.font = '12px 微软雅黑';
  730. sheet.setDefaultStyle(vStyle, spreadNS.SheetArea.viewport);
  731. const xStyle = new spreadNS.Style();
  732. xStyle.font = '12px 微软雅黑';
  733. xStyle.vAlign = 1;
  734. xStyle.hAlign = 1;
  735. sheet.setDefaultStyle(xStyle, spreadNS.SheetArea.colHeader);
  736. const yStyle = new spreadNS.Style();
  737. yStyle.font = '12px 微软雅黑';
  738. yStyle.vAlign = 1;
  739. yStyle.hAlign = 1;
  740. sheet.setDefaultStyle(yStyle, spreadNS.SheetArea.rowHeader);
  741. SpreadJsObj.massOperationSheet(sheet, function () {
  742. sheet.defaults.rowHeight = 21;
  743. sheet.setColumnCount(2);
  744. sheet.setRowCount(13);
  745. sheet.setColumnWidth(0, 100);
  746. sheet.setColumnWidth(1, 60);
  747. sheet.getRange(0, 0, 13, 1).vAlign(1).backColor('#e4e7ea').locked(true);
  748. sheet.getRange(0, 1, 13, 1).vAlign(1).hAlign(2);
  749. sheet.setText(0, 0, 't');
  750. sheet.setText(1, 0, 'km');
  751. sheet.setText(2, 0, 'm');
  752. sheet.setText(3, 0, 'm2');
  753. sheet.setText(4, 0, 'm3');
  754. sheet.setText(5, 0, 'kg');
  755. sheet.setText(6, 0, '个');
  756. sheet.setText(7, 0, '台');
  757. sheet.setText(8, 0, '套');
  758. sheet.setText(9, 0, '棵');
  759. sheet.setText(10, 0, '组');
  760. sheet.setText(11, 0, '系统');
  761. sheet.setText(12, 0, '其他未列单位');
  762. const lineBorder = new spreadNS.LineBorder('#dee2e6', spreadNS.LineStyle.thin);
  763. sheet.getRange(0, 0, 13, 2).setBorder(lineBorder, {all: true});
  764. sheet.getRange(0, 0, 13, 2).formatter('@');
  765. sheet.setSelection(0, 1, 1, 1);
  766. });
  767. spread.bind(spreadNS.Events.EditEnded, function (e, info) {
  768. const value = _.toNumber(info.editingText);
  769. if (!_.isInteger(value)) {
  770. toastr.warning('请输入0-6的整数');
  771. sheet.setText(info.row, info.col, '0');
  772. } else if (value > 6) {
  773. toastr.warning('请输入0-6的整数');
  774. sheet.setText(info.row, info.col, '6');
  775. } else if (value < 0) {
  776. toastr.warning('请输入0-6的整数');
  777. sheet.setText(info.row, info.col, '0');
  778. }
  779. });
  780. SpreadJsObj.addDeleteBind(spread, function (sheet) {
  781. const sel = sheet.getSelections()[0];
  782. let calc = false;
  783. if (sel) {
  784. for (let iRow = sel.row, iRowLength = sel.row + sel.rowCount; iRow < iRowLength; iRow++) {
  785. if (iRow === 3) continue;
  786. for (let iCol = sel.col, iColLength = sel.col + sel.colCount; iCol < iColLength; iCol++) {
  787. if (iCol !== 2) continue;
  788. sheet.setText(iRow, iCol, '0');
  789. if (iRow === 1 || iRow === 2) calc = true;
  790. }
  791. }
  792. }
  793. if (calc) calcHtjMinusZlj();
  794. });
  795. spread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {
  796. let bHint = false;
  797. for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
  798. const curRow = info.cellRange.row + iRow;
  799. for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
  800. const curCol = info.cellRange.col + iCol;
  801. const value = _.toNumber(info.sheet.getText(curRow, curCol));
  802. if (_.isNaN(value) || !_.isInteger(value)) {
  803. bHint = true;
  804. info.sheet.setText(curRow, curCol, '0');
  805. } else if (value > 6) {
  806. bHint = true;
  807. info.sheet.setText(curRow, curCol, '6');
  808. } else if (value < 0) {
  809. bHint = true;
  810. info.sheet.setText(curRow, curCol, '0');
  811. }
  812. }
  813. }
  814. if (bHint) {
  815. toastr.warning('请输入0-6的整数');
  816. }
  817. });
  818. function loadPrecisonProperty() {
  819. $('#hint-3').hide();
  820. sheet.setValue(0, 1, property.precision.t.value);
  821. sheet.setValue(1, 1, property.precision.km.value);
  822. sheet.setValue(2, 1, property.precision.m.value);
  823. sheet.setValue(3, 1, property.precision.m2.value);
  824. sheet.setValue(4, 1, property.precision.m3.value);
  825. sheet.setValue(5, 1, property.precision.kg.value);
  826. sheet.setValue(6, 1, property.precision.ge.value);
  827. sheet.setValue(7, 1, property.precision.tai.value);
  828. sheet.setValue(8, 1, property.precision.tao.value);
  829. sheet.setValue(9, 1, property.precision.ke.value);
  830. sheet.setValue(10, 1, property.precision.zu.value);
  831. sheet.setValue(11, 1, property.precision.xitong.value);
  832. sheet.setValue(12, 1, property.precision.other.value);
  833. }
  834. function setReadOnly(readOnly) {
  835. sheet.getRange(0, 1, 13, 1).locked(readOnly);
  836. }
  837. function getNewPrecisionData() {
  838. const precision = JSON.parse(JSON.stringify(property.precision));
  839. precision.t.value = _.toNumber(sheet.getText(0, 1));
  840. precision.km.value = _.toNumber(sheet.getText(1, 1));
  841. precision.m.value = _.toNumber(sheet.getText(2, 1));
  842. precision.m2.value = _.toNumber(sheet.getText(3, 1));
  843. precision.m3.value = _.toNumber(sheet.getText(4, 1));
  844. precision.kg.value = _.toNumber(sheet.getText(5, 1));
  845. precision.ge.value = _.toNumber(sheet.getText(6, 1));
  846. precision.tai.value = _.toNumber(sheet.getText(7, 1));
  847. precision.tao.value = _.toNumber(sheet.getText(8, 1));
  848. precision.ke.value = _.toNumber(sheet.getText(9, 1));
  849. precision.zu.value = _.toNumber(sheet.getText(10, 1));
  850. precision.xitong.value = _.toNumber(sheet.getText(11, 1));
  851. precision.other.value = _.toNumber(sheet.getText(12, 1));
  852. return precision;
  853. }
  854. function checkPrecisionMinLimit(precision, limit) {
  855. for (const unit of precision) {
  856. if (precision[unit].value < limit[unit].value) {
  857. if (precision[unit].unit) {
  858. toastr.warning('台账已审批通过,清单精度不可减少,单位为' + limit[unit].unit + '的清单的精度不可小于' + limit[unit].value);
  859. } else {
  860. toastr.warning('台账已审批通过,清单精度不可减少,其他清单的精度不可小于' + limit[unit].value);
  861. }
  862. return false;
  863. }
  864. }
  865. return true;
  866. };
  867. return {loadPrecisonProperty, setReadOnly, getNewPrecisionData, checkPrecisionMinLimit};
  868. })();
  869. $('#bd-set-3').on('show.bs.modal', function () {
  870. <% if (((tender.ledger_status !== audit.ledger.status.uncheck && tender.ledger_status !== audit.ledger.status.checkNo) || tender.user_id !== ctx.session.sessionUser.accountId)
  871. && (!lastStage || lastStage.user_id !== ctx.session.sessionUser.accountId || (lastStage.status !== audit.stage.status.checkNo || lastStage.status !== audit.stage.status.uncheck))) { %>
  872. precisionObj.setReadOnly(true);
  873. <% } %>
  874. precisionObj.loadPrecisonProperty();
  875. });
  876. function post3 () {
  877. const prop = { precision: precisionObj.getNewPrecisionData() };
  878. if (ledgerChecked && !precisionObj.checkPrecisionMinLimit(prop.precision, property.precision)) return;
  879. const tenderId = window.location.pathname.split('/')[2];
  880. postData('/tender/' + tenderId + '/save', prop, function (data) {
  881. property.precision = data.precision;
  882. $('#bd-set-3').modal('hide');
  883. }, null, true);
  884. }
  885. // 合同参数
  886. const dealObj = (function () {
  887. const spread = SpreadJsObj.createNewSpread($('#param-spread')[0]);
  888. spread.options.showVerticalScrollbar = false;
  889. spread.options.showHorizontalScrollbar = false;
  890. const sheet = spread.getActiveSheet();
  891. SpreadJsObj.protectedSheet(sheet);
  892. const vStyle = new spreadNS.Style();
  893. vStyle.font = '12px 微软雅黑';
  894. sheet.setDefaultStyle(vStyle, spreadNS.SheetArea.viewport);
  895. SpreadJsObj.massOperationSheet(sheet, function () {
  896. sheet.options.rowHeaderVisible = false;
  897. sheet.options.colHeaderVisible = false;
  898. sheet.defaults.rowHeight = 25;
  899. sheet.setColumnCount(3);
  900. sheet.setRowCount(6);
  901. sheet.setColumnWidth(0, 1);
  902. sheet.setColumnWidth(1, 200);
  903. sheet.setColumnWidth(2, 200);
  904. sheet.setRowHeight(0, 1);
  905. sheet.getRange(1, 1, 5, 1).vAlign(1).backColor('#e4e7ea').locked(true);
  906. sheet.getRange(1, 2, 5, 1).vAlign(1).hAlign(2).locked(true);
  907. sheet.setText(1, 1, '签约合同价');
  908. sheet.setText(2, 1, '暂列金额');
  909. sheet.setText(3, 1, '签约合同价(不含暂列金)');
  910. sheet.setText(4, 1, '签约开工预付款');
  911. sheet.setText(5, 1, '签约材料预付款');
  912. const lineBorder = new spreadNS.LineBorder('#6a696e', spreadNS.LineStyle.thin);
  913. sheet.getRange(0, 0, 6, 3).setBorder(lineBorder, {all: true});
  914. sheet.getRange(0, 0, 6, 3).formatter('@');
  915. sheet.setSelection(1, 2, 1, 1);
  916. });
  917. function calcHtjMinusZlj() {
  918. const htj = _.toNumber(sheet.getText(1, 2));
  919. const zlj = _.toNumber(sheet.getText(2, 2));
  920. sheet.setValue(3, 2, ZhCalc.sub(zlj, htj));
  921. }
  922. spread.bind(spreadNS.Events.EditEnded, function (e, info) {
  923. const value = _.toNumber(info.editingText);
  924. if (_.isNaN(value)) {
  925. toastr.warning('请输入不超过万亿的数字');
  926. info.sheet.setText(info.row, info.col, '0');
  927. } else if (value > Math.pow(10, 13)) {
  928. toastr.warning('请输入不超过万亿的数字');
  929. info.sheet.setText(info.row, info.col, '0');
  930. }
  931. if (info.row === 1 || info.row === 2) {
  932. calcHtjMinusZlj();
  933. }
  934. });
  935. SpreadJsObj.addDeleteBind(spread, function (sheet) {
  936. const sel = sheet.getSelections()[0];
  937. let calc = false;
  938. if (sel) {
  939. for (let iRow = sel.row, iRowLength = sel.row + sel.rowCount; iRow < iRowLength; iRow++) {
  940. if (iRow === 3) continue;
  941. for (let iCol = sel.col, iColLength = sel.col + sel.colCount; iCol < iColLength; iCol++) {
  942. if (iCol !== 2) continue;
  943. sheet.setText(iRow, iCol, '0');
  944. if (iRow === 1 || iRow === 2) calc = true;
  945. }
  946. }
  947. }
  948. if (calc) calcHtjMinusZlj();
  949. });
  950. spread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {
  951. let bHint = false;
  952. for (let iRow = 0; iRow < info.cellRange.rowCount; iRow++) {
  953. const curRow = info.cellRange.row + iRow;
  954. for (let iCol = 0; iCol < info.cellRange.colCount; iCol++) {
  955. const curCol = info.cellRange.col + iCol;
  956. const value = _.toNumber(info.sheet.getText(curRow, curCol));
  957. if (_.isNaN(value) || value > Math.pow(10, 13)) {
  958. bHint = true;
  959. info.sheet.setText(curRow, curCol, '0');
  960. }
  961. }
  962. }
  963. if (bHint) {
  964. toastr.warning('请输入不超过万亿的数字');
  965. }
  966. calcHtjMinusZlj();
  967. });
  968. function loadDealProperty() {
  969. $('#hint-4').hide();
  970. sheet.setValue(1, 2, property.deal_param.contractPrice);
  971. sheet.setValue(2, 2, property.deal_param.zanLiePrice);
  972. sheet.setValue(3, 2, ZhCalc.sub(property.deal_param.zanLiePrice, property.deal_param.contractPrice));
  973. sheet.setValue(4, 2, property.deal_param.startAdvance);
  974. sheet.setValue(5, 2, property.deal_param.materialAdvance);
  975. }
  976. function setReadOnly (readOnly) {
  977. sheet.getCell(1, 2).locked(readOnly);
  978. sheet.getCell(2, 2).locked(readOnly);
  979. sheet.getCell(4, 2).locked(readOnly);
  980. sheet.getCell(5, 2).locked(readOnly);
  981. }
  982. function getNewDealData () {
  983. const result = {};
  984. result.contractPrice = _.toNumber(sheet.getText(1, 2));
  985. result.zanLiePrice = _.toNumber(sheet.getText(2, 2));
  986. result.startAdvance = _.toNumber(sheet.getText(4, 2));
  987. result.materialAdvance = _.toNumber(sheet.getText(5, 2));
  988. return result;
  989. }
  990. return { loadDealProperty, setReadOnly, getNewDealData, };
  991. })();
  992. $('#bd-set-4').on('show.bs.modal', function () {
  993. dealObj.loadDealProperty();
  994. if (firstStageChecked) {
  995. dealObj.setReadOnly(true);
  996. }
  997. });
  998. function post4 () {
  999. if (firstStageChecked) return;
  1000. const prop = { deal_param: dealObj.getNewDealData() };
  1001. const tenderId = window.location.pathname.split('/')[2];
  1002. postData('/tender/' + tenderId + '/save', prop, function (data) {
  1003. property.deal_param = data.deal_param;
  1004. $('bd-set-4').modal('hide');
  1005. });
  1006. }
  1007. // 显示设置
  1008. function loadDisplayProperty () {
  1009. $('#ledger-dgn-qty')[0].checked = property.display.ledger.dgnQty;
  1010. $('#ledger-cl-qty')[0].checked = property.display.ledger.clQty;
  1011. }
  1012. $('#bd-set-5').on('show.bs.modal', function () {
  1013. loadDisplayProperty();
  1014. });
  1015. function post5 () {
  1016. const prop = {
  1017. display: {
  1018. ledger: { dgnQty: $('#ledger-dgn-qty')[0].checked, clQty: $('#ledger-cl-qty')[0].checked, },
  1019. },
  1020. };
  1021. const tenderId = window.location.pathname.split('/')[2];
  1022. postData('/tender/' + tenderId + '/save', prop, function (data) {
  1023. property.display = data.display;
  1024. $('#bd-set-5').modal('hide');
  1025. });
  1026. }
  1027. // 章节设置
  1028. const chapterObj = (function () {
  1029. const spreadSetting = {
  1030. cols: [
  1031. {title: '章节', colSpan: '1', rowSpan: '1', field: 'code', hAlign: 0, width: 100, formatter: '@', readOnly: true},
  1032. {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 230, formatter: '@', readOnly: true},
  1033. ],
  1034. emptyRows: 0,
  1035. headRows: 1,
  1036. headRowHeight: [32],
  1037. defaultRowHeight: 21,
  1038. headerFont: '12px 微软雅黑',
  1039. font: '12px 微软雅黑',
  1040. };
  1041. const spread = SpreadJsObj.createNewSpread($('#chapter-spread')[0]);
  1042. spread.options.showVerticalScrollbar = false;
  1043. spread.options.showHorizontalScrollbar = false;
  1044. SpreadJsObj.initSheet(spread.getActiveSheet(), spreadSetting);
  1045. function checkSheetData(sheet) {
  1046. let hint = '';
  1047. for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
  1048. const cell = sheet.getCell(iRow, 1);
  1049. const defaultStype = sheet.getDefaultStyle();
  1050. if (cell.text().length > 50) {
  1051. cell.backColor('#f8d7da');
  1052. hint = '章节名称的长度超出范围,请重新输入';
  1053. } else {
  1054. cell.backColor(defaultStype.backColor);
  1055. }
  1056. }
  1057. if (hint === '') {
  1058. $('#hint-6').hide();
  1059. } else {
  1060. $('#hint-6').html('<i class="fa fa-smile-o mr-2"></i>' + hint).show();
  1061. }
  1062. }
  1063. spread.bind(spreadNS.Events.EditEnding, function (e, info) {
  1064. checkSheetData(info.sheet);
  1065. });
  1066. spread.bind(spreadNS.Events.ClipboardPasted, function (e, info) {
  1067. checkSheetData(info.sheet);
  1068. });
  1069. function loadChapterProperty() {
  1070. SpreadJsObj.loadSheetData(spread.getActiveSheet(), SpreadJsObj.DataType.Data, property.chapter);
  1071. $('#hint-6').hide();
  1072. const sheet = spread.getActiveSheet();
  1073. const defaultStype = sheet.getDefaultStyle();
  1074. sheet.getRange(0, 0, sheet.getRowCount(), sheet.getColumnCount()).backColor(defaultStype.backColor);
  1075. }
  1076. function setReadOnly(readOnly) {
  1077. SpreadJsObj.resetFieldReadOnly(spread.getActiveSheet(), 'name', readOnly);
  1078. }
  1079. function getNewChapterData() {
  1080. const result = [];
  1081. const sheet = spread.getActiveSheet();
  1082. for (let iRow = 0; iRow < sheet.getRowCount(); iRow++) {
  1083. const data = {};
  1084. for (let iCol = 0; iCol < sheet.getColumnCount(); iCol++) {
  1085. const col = spreadSetting.cols[iCol];
  1086. data[col.field] = sheet.getText(iRow, iCol);
  1087. if (col.field === 'name') {
  1088. if (data.name.length > 50) {
  1089. return null;
  1090. }
  1091. }
  1092. }
  1093. result.push(data);
  1094. }
  1095. return result;
  1096. }
  1097. return { loadChapterProperty, setReadOnly, getNewChapterData, }
  1098. })();
  1099. $('#bd-set-6').on('show.bs.modal', function () {
  1100. chapterObj.loadChapterProperty();
  1101. chapterObj.setReadOnly(false);
  1102. });
  1103. function post6 () {
  1104. const chapter = chapterObj.getNewChapterData();
  1105. if (!chapter) { return; }
  1106. const tenderId = window.location.pathname.split('/')[2];
  1107. postData('/tender/' + tenderId + '/save', { chapter: chapter }, function (data) {
  1108. property.chapter = data.chapter;
  1109. $('#bd-set-6').modal('hide');
  1110. });
  1111. }
  1112. </script>