fun.ejs 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. <% include ./sub_menu.ejs %>
  2. <div class="panel-content">
  3. <div class="panel-title">
  4. <div class="title-main">
  5. <h2>功能设置</h2>
  6. </div>
  7. </div>
  8. <div class="content-wrap">
  9. <div class="c-body">
  10. <div class="sjs-height-0">
  11. <div class="row m-0 mt-3">
  12. <div class="col-8">
  13. <div class="row">
  14. <div class="col-6">
  15. <div class="card mb-3">
  16. <div class="card-header d-flex justify-content-between">
  17. <div>超计控制</div>
  18. </div>
  19. <div class="card-body">
  20. <div class="form-group mb-1">
  21. <div>
  22. <div class="form-check">
  23. <input class="form-check-input" type="checkbox" id="ban_over" name="ban_over" <% if (funRela.banOver) { %>checked<% } %> onchange="updateSetting();">
  24. <label class="form-check-label" for="ban_over">超计时限制上报审批/审批通过</label>
  25. </div>
  26. <div class="form-check">
  27. <input class="form-check-input" type="checkbox" id="hint_over" name="hint_over" <% if (funRela.hintOver) { %>checked<% } %> onchange="updateSetting();">
  28. <label class="form-check-label" for="hint_over">超计时标红显示</label>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="col-6">
  36. <div class="card mb-3">
  37. <div class="card-header d-flex justify-content-between">
  38. <div>变更令调用控制</div>
  39. </div>
  40. <div class="card-body">
  41. <div class="form-group mb-1">
  42. <div>
  43. <div class="form-check form-check-inline">
  44. <input class="form-check-input" type="checkbox" id="ban_minus_cb" name="ban_minus_cb" <% if (funRela.banMinusChangeBills) { %>checked<% } %> onchange="updateSetting();">
  45. <label class="form-check-label" for="ban_minus_cb">强制调用负变更(限制上报审批/审批通过)</label>
  46. </div>
  47. <div class="alert-warning p-1"><i class="fa Example of exclamation-circle fa-exclamation-circle "></i> 变更令开始调用后,负变更清单必须在本期全部调用</div>
  48. </div>
  49. <div>
  50. <div class="form-check form-check-inline">
  51. <input class="form-check-input" type="checkbox" id="minusNoValue" name="minusNoValue" <% if (funRela.minusNoValue) { %>checked<% } %> onchange="updateSetting();">
  52. <label class="form-check-label" for="minusNoValue">计量不计价</label>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="row">
  61. <div class="col-6">
  62. <div class="card mb-3">
  63. <div class="card-header d-flex justify-content-between">
  64. <div>合同支付</div>
  65. </div>
  66. <div class="card-body">
  67. <div class="form-group mb-1">
  68. <div>
  69. <div class="form-check">
  70. <input class="form-check-input" type="checkbox" id="lockPayExpr" name="lockPayExpr" <% if (funRela.lockPayExpr) { %>checked<% } %> onchange="updateSetting();">
  71. <label class="form-check-label" for="lockPayExpr">锁定往期带基数计算的合同支付项</label>
  72. </div>
  73. <div class="form-check">
  74. <input class="form-check-input" type="checkbox" id="showMinusCol" name="showMinusCol" <% if (funRela.showMinusCol) { %>checked<% } %> onchange="updateSetting();">
  75. <label class="form-check-label" for="showMinusCol">显示扣款列</label>
  76. </div>
  77. <div class="alert-warning p-1"><i class="fa Example of exclamation-circle fa-exclamation-circle "></i> 隐藏此列不会修改本期应付计算,旧项目请谨慎修改,防止误解</div>
  78. <div class="form-check">
  79. <input class="form-check-input" type="checkbox" id="closeWapYfSf" <% if (ctx.subProject.page_show.closeWapYfSf) { %>checked<% } %> onchange="updateSetting();">
  80. <label class="form-check-label" for="closeWapYfSf">wap关闭「本期支付」相关信息 <a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="本期计量关联的“本期应付“、”本期实付”均不显示"><i class="fa fa-question-circle "></i></a></label>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="col-6">
  88. <div class="card mb-3">
  89. <div class="card-header d-flex justify-content-between">
  90. <div>中间计量模式设置</div>
  91. </div>
  92. <div class="card-body">
  93. <div class="form-group mb-1">
  94. <div>
  95. <% for (const i in imType) { %>
  96. <div class="form-check form-check-inline">
  97. <input class="form-check-input" type="radio" id="radio_<%- i %>" value="<%- imType[i].value %>" <% if (funRela.imType === imType[i].value) { %>checked<% } %> name="im_type" onchange="updateSetting();">
  98. <label class="form-check-label" for="radio_<%- i %>" name="im_type"><%- imType[i].name %></label>
  99. </div>
  100. <% } %>
  101. </div>
  102. <div class="mt-3">
  103. <label class="form-text alert alert-danger">切换模式,仅对未开始第一期计量的标段生效。</label>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <div class="row">
  111. <div class="col-6">
  112. <div class="card mb-3 ">
  113. <div class="card-header d-flex justify-content-between">
  114. <div>计量期上报/审批</div>
  115. </div>
  116. <div class="card-body pb-2">
  117. <div class="form-group mb-1">
  118. <nav class="nav nav-tabs">
  119. <a class="nav-link nav-item active" data-toggle="tab" name="stage-setting" type="audit" onclick="changeSettingTab(this);">审批</a>
  120. <a class="nav-link nav-item" data-toggle="tab" name="stage-setting" type="start" onclick="changeSettingTab(this);">上报</a>
  121. <div class="ml-auto">
  122. <div class="custom-control custom-switch" id="switch-stage-start" style="display: none;">
  123. <input type="checkbox" class="custom-control-input" id="openStageStart" <% if(ctx.subProject.page_show.openStageStart) { %>checked<% } %> onchange="updateSetting();">
  124. <label class="custom-control-label" for="openStageStart"></label>
  125. </div>
  126. <div class="custom-control custom-switch" id="switch-stage-audit">
  127. <input type="checkbox" class="custom-control-input" id="openStageAudit" <% if(ctx.subProject.page_show.openStageAudit) { %>checked<% } %> onchange="updateSetting();">
  128. <label class="custom-control-label" for="openStageAudit"></label>
  129. </div>
  130. </div>
  131. </nav>
  132. <div class="tab-content my-2">
  133. <div class="tab-pane fade active show" id="stage-audit-tab" role="tabpanel" aria-labelledby="home-tab">
  134. <div class="input-group input-group-sm mt-2 col-6">
  135. <div class="input-group-prepend">
  136. <span class="input-group-text">预警:</span>
  137. </div>
  138. <input type="number" class="form-control" value="<%- ctx.subProject.page_show.stageAuditEarly %>" <% if(!ctx.subProject.page_show.openStageAudit) { %>disabled<% } %> id="stage-audit-early" oninput="limitDecimal(this);" min="0" max="30" onchange="updateSetting();">
  139. <div class="input-group-append">
  140. <span class="input-group-text">天</span>
  141. </div>
  142. </div>
  143. <div class="text-muted ml-4 mt-2"><small>审批停留时长符合设置天数(包含节假日),审批流程提醒为预警</small></div>
  144. <div class="input-group input-group-sm mt-2 col-6">
  145. <div class="input-group-prepend">
  146. <span class="input-group-text">紧急:</span>
  147. </div>
  148. <input type="number" class="form-control" value="<%- ctx.subProject.page_show.stageAuditWorry %>" <% if(!ctx.subProject.page_show.openStageAudit) { %>disabled<% } %> id="stage-audit-worry" oninput="limitDecimal(this);" min="0" max="30" onchange="updateSetting();">
  149. <div class="input-group-append">
  150. <span class="input-group-text">天</span>
  151. </div>
  152. </div>
  153. <div class="text-muted ml-4 mt-2"><small>审批停留时长符合设置天数(包含节假日),审批流程提醒为紧急</small></div>
  154. </div>
  155. <div class="tab-pane fade" id="stage-start-tab" role="tabpanel" aria-labelledby="profile-tab">
  156. <div class="input-group input-group-sm mb-2">
  157. <div class="input-group-prepend">
  158. <span class="input-group-text">开始日期:</span>
  159. <span class="input-group-text" style="width: 90px;padding-left: 12px;">每月</span>
  160. </div>
  161. <select class="form-control form-control-sm" id="start_day" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
  162. <option value="0">请选择日</option>
  163. <% for (let i = 1; i <= 31;i++) { %>
  164. <option value="<%- i %>" <% if (funSet.stage_start.start_day === i) {%>selected<% } %>><%- i %></option>
  165. <% } %>
  166. </select>
  167. <span class="text-danger mx-2"></span>
  168. </div>
  169. <div class="input-group input-group-sm mb-2">
  170. <div class="input-group-prepend">
  171. <span class="input-group-text">截止日期:</span>
  172. </div>
  173. <select class="form-control form-control-sm" id="end_month" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
  174. <option value="0">请选择月</option>
  175. <% for (const i of endMonth) { %>
  176. <option value="<%- i.val %>" <% if (funSet.stage_start.end_month === i.val) {%>selected<% } %> ><%- i.name %></option>
  177. <% } %>
  178. </select>
  179. <select class="form-control form-control-sm" id="end_day" style="width: 90px!important;flex: none;" <% if (ctx.subProject.page_show.openStageStart) { %>disabled<% } %>>
  180. <option value="0">请选择日</option>
  181. <% for (let i = 1; i <= 31;i++) { %>
  182. <option value="<%- i %>" <% if (funSet.stage_start.end_day === i) {%>selected<% } %>><%- i %></option>
  183. <% } %>
  184. </select>
  185. <span class="text-danger mx-2"></span>
  186. </div>
  187. <div class="mt-3">
  188. <label class="form-text alert alert-danger">开启选项后,超出范围内的日期,则不允许上报期计量。</label>
  189. </div>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. <div class="col-6">
  197. <div class="card mb-3">
  198. <div class="card-header d-flex justify-content-between">
  199. <div>计量相关设置</div>
  200. </div>
  201. <div class="card-body">
  202. <div class="form-group mb-1">
  203. <div class="form-check form-check-inline">
  204. <input class="form-check-input" type="checkbox" id="openContractExpr" <% if (ctx.subProject.page_show.openContractExpr) { %>checked<% } %> onchange="updateSetting();">
  205. <label class="form-check-label" for="openContractExpr">开启「本期合同计量设置公式」</label>
  206. </div>
  207. </div>
  208. <div class="form-group mb-1">
  209. <div class="form-check form-check-inline">
  210. <input class="form-check-input" type="checkbox" id="close1stStageCheckDealParam" <% if (ctx.subProject.page_show.close1stStageCheckDealParam) { %>checked<% } %> onchange="updateSetting();">
  211. <label class="form-check-label" for="close1stStageCheckDealParam">关闭「开始第一期计量判断合同参数」功能</label>
  212. </div>
  213. </div>
  214. <div class="form-group mb-1">
  215. <div class="form-check form-check-inline">
  216. <input class="form-check-input" type="checkbox" id="openMultiStageCalc" <% if (ctx.subProject.page_show.openMultiStageCalc) { %>checked<% } %> onchange="updateSetting();">
  217. <label class="form-check-label" for="openMultiStageCalc">开启「待上报时,允许新增下一期」功能</label>
  218. </div>
  219. </div>
  220. <div class="form-group mb-1">
  221. <div class="form-check form-check-inline">
  222. <input class="form-check-input" type="checkbox" id="correctCalcContractTp" <% if (ctx.subProject.page_show.correctCalcContractTp) { %>checked<% } %> onchange="updateSetting();">
  223. <label class="form-check-label" for="correctCalcContractTp">开启「反算本期合同计量」功能</label>
  224. <a href="" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="开启此选项,清单最后一次合同计量,将反算本期合同计量金额"><i class="fa fa-question-circle "></i></a>
  225. </div>
  226. </div>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. <div class="row">
  232. <div class="col-6">
  233. <div class="card mb-3">
  234. <div class="card-header d-flex justify-content-between">
  235. <div>工程变更</div>
  236. </div>
  237. <div class="card-body">
  238. <div class="alert alert-dark py-1 px-2 mb-2" role="alert">
  239. 页面显示
  240. </div>
  241. <div class="form-group mb-1">
  242. <div class="form-check form-check-inline">
  243. <input class="form-check-input" type="checkbox" id="openChangeProject" <% if(ctx.subProject.page_show.openChangeProject) { %>checked<% } %> onchange="updateSetting(1);">
  244. <label class="form-check-label" for="openChangeProject">显示「变更立项」页面</label>
  245. </div>
  246. </div>
  247. <div class="form-group mb-1">
  248. <div class="form-check form-check-inline">
  249. <input class="form-check-input" type="checkbox" id="openChangeApply" <% if(ctx.subProject.page_show.openChangeApply) { %>checked<% } %> onchange="updateSetting(2);">
  250. <label class="form-check-label" for="openChangeApply">显示「变更申请」页面</label>
  251. </div>
  252. </div>
  253. <div class="form-group mb-1">
  254. <div class="form-check form-check-inline">
  255. <input class="form-check-input" type="checkbox" id="openChangePlan" <% if(ctx.subProject.page_show.openChangePlan) { %>checked<% } %> onchange="updateSetting(3);">
  256. <label class="form-check-label" for="openChangePlan">显示「变更方案」页面</label>
  257. </div>
  258. </div>
  259. <div class="alert alert-dark py-1 px-2 mb-2" role="alert">
  260. 功能设置
  261. </div>
  262. <div class="mb-1">
  263. <div class="form-check form-check-inline">
  264. <input class="form-check-input" type="checkbox" id="inlineCheckbox11" checked disabled>
  265. <label class="form-check-label" for="inlineCheckbox11">开启自定义变更类别</label>
  266. </div>
  267. <a class="pull-right mr-3" href="#bgclass" data-toggle="modal" data-target="#bgclass">设置</a>
  268. </div>
  269. <div class="mb-1">
  270. <div class="form-check form-check-inline">
  271. <input class="form-check-input" type="checkbox" id="openChangeState" <% if (ctx.subProject.page_show.openChangeState) { %>checked<% } %> onchange="updateSetting();">
  272. <label class="form-check-label" for="openChangeState">开启变更令状态功能 </label>&nbsp;
  273. <a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="变更令提供临时、立项、批复状态,可设置计量上限"><i class="fa fa-question-circle "></i></a>
  274. </div>
  275. <a class="pull-right mr-3 <% if (!ctx.subProject.page_show.openChangeState) { %>text-secondary<% } %>" href="javascript:void(0);" id="openBgStatus">设置</a>
  276. </div>
  277. <div class="mb-1">
  278. <div class="form-check form-check-inline">
  279. <input class="form-check-input" type="checkbox" id="openChangeWhiteList" <% if (ctx.subProject.page_show.openChangeWhiteList) { %>checked<% } %> onchange="updateSetting();">
  280. <label class="form-check-label" for="openChangeWhiteList">开启“添加空白清单”功能</label>
  281. </div>
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. <div class="col-6" <% if (!ctx.subProject.page_show.openMaterial) { %>style="display: none;"<% } %>>
  287. <div class="card mb-3">
  288. <div class="card-header d-flex justify-content-between">
  289. <div>材料调差</div>
  290. </div>
  291. <div class="card-body">
  292. <div class="form-group mb-1">
  293. <div class="form-check form-check-inline">
  294. <input class="form-check-input" type="checkbox" id="openMaterialTax" <% if(ctx.subProject.page_show.openMaterialTax) { %>checked<% } %> onchange="updateSetting();">
  295. <label class="form-check-label" for="openMaterialTax">使用材料税</label>
  296. </div>
  297. </div>
  298. <div class="form-group mb-1">
  299. <div class="form-check form-check-inline">
  300. <input class="form-check-input" type="checkbox" id="openMaterialChecklist" <% if(ctx.subProject.page_show.openMaterialChecklist) { %>checked<% } %> onchange="updateSetting();">
  301. <label class="form-check-label" for="openMaterialChecklist">开启「批量设置调差清单」添加调差工料功能</label>
  302. </div>
  303. </div>
  304. <div class="form-group mb-1">
  305. <div class="form-check form-check-inline">
  306. <input class="form-check-input" type="checkbox" id="openMaterialSelf" <% if(ctx.subProject.page_show.openMaterialSelf) { %>checked<% } %> onchange="updateSetting();">
  307. <label class="form-check-label" for="openMaterialSelf">开启调差清单-所属项目节「单独添加工料」功能
  308. <a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="开启该选项,调差清单的所属项目节,允许单独添加工料"><i class="fa fa-question-circle "></i></a></label>
  309. </div>
  310. </div>
  311. <div class="form-group mb-1">
  312. <div class="form-check form-check-inline">
  313. <input class="form-check-input" type="checkbox" id="openMaterialEditForAudit" <% if(ctx.subProject.page_show.openMaterialEditForAudit) { %>checked<% } %> onchange="updateSetting();">
  314. <label class="form-check-label" for="openMaterialEditForAudit">开启「审核人修改数据」功能
  315. <a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="开启该选项,审核人允许修改部分调差工料数据"><i class="fa fa-question-circle "></i></a></label>
  316. </div>
  317. </div>
  318. <div class="form-group mb-1">
  319. <div class="form-check form-check-inline">
  320. <input class="form-check-input" type="checkbox" id="openMaterialStageRepeat" <% if(ctx.subProject.page_show.openMaterialStageRepeat) { %>checked<% } %> onchange="updateSetting();">
  321. <label class="form-check-label" for="openMaterialStageRepeat">开启「材料调差重复使用计量期」</label>
  322. </div>
  323. </div>
  324. </div>
  325. </div>
  326. </div>
  327. </div>
  328. <div class="card mb-3">
  329. <div class="card-header d-flex justify-content-between">
  330. <div>动态决算</div>
  331. </div>
  332. <div class="card-body">
  333. <div class="form-group mb-4">
  334. <div>
  335. <div class="form-check form-check-inline">
  336. <input class="form-check-input" type="checkbox" id="need_gcl" name="need_gcl" <% if (funRela.needGcl) { %>checked<% } %> onchange="updateSetting();">
  337. <label class="form-check-label" for="need_gcl">显示清单信息</label>
  338. </div>
  339. </div>
  340. <div class="mt-3">
  341. <label class="form-text alert alert-danger">做施工图三级清单预算时,请进行勾选。</label>
  342. </div>
  343. </div>
  344. </div>
  345. </div>
  346. </div>
  347. </div>
  348. </div>
  349. </div>
  350. </div>
  351. </div>
  352. <script src="/public/js/setting.js"></script>
  353. <script>
  354. let changeClass = JSON.parse(unescape('<%- escape(JSON.stringify(funSet.change_class)) %>'));
  355. let changeState = JSON.parse(unescape('<%- escape(JSON.stringify(funSet.change_state)) %>'));
  356. const changeSettingTab = function(tab) {
  357. const type = tab.getAttribute('type');
  358. if (type === 'start') {
  359. $('#switch-stage-start').show();
  360. $('#switch-stage-audit').hide();
  361. $('#stage-start-tab').addClass('active').addClass('show');
  362. $('#stage-audit-tab').removeClass('active').removeClass('show');
  363. } else if (type === 'audit') {
  364. $('#switch-stage-start').hide();
  365. $('#switch-stage-audit').show();
  366. $('#stage-audit-tab').addClass('active').addClass('show');
  367. $('#stage-start-tab').removeClass('active').removeClass('show');
  368. }
  369. }
  370. $(() => {
  371. autoFlashHeight();
  372. // 自定义变更类别
  373. $('body').on('click', '#change_class_div input[type="checkbox"]', function () {
  374. if ($(this).is(':checked')) {
  375. $(this).parents('.input-group-prepend').siblings('input').removeAttr('readonly');
  376. } else {
  377. $(this).parents('.input-group-prepend').siblings('input').attr('readonly', true).val('');
  378. }
  379. });
  380. $('body').on('change', '#change_class_div input[type="text"]', function () {
  381. if ($(this).val().length > 8) {
  382. toastr.error('类别名称不能超过8个字符');
  383. }
  384. });
  385. $("#bgclass").on('show.bs.modal', function () {
  386. let html = '';
  387. for (const cc of changeClass) {
  388. html += `<div class="input-group input-group-sm mb-1">
  389. <div class="input-group-prepend">
  390. <div class="input-group-text">
  391. <input type="checkbox" value="${cc.value}" aria-label="Checkbox for following text input" ${cc.checked ? 'checked' : ''}>
  392. </div>
  393. <span class="input-group-text">${cc.name}</span>
  394. </div>
  395. <input type="text" class="form-control" value="${cc.new_name}" ${!cc.checked ? 'readonly' : ''} aria-label="Text input with checkbox" placeholder="">
  396. </div>`;
  397. }
  398. $('#change_class_div').html(html);
  399. });
  400. $('#set_change_class_btn').click(function () {
  401. updateSetting(false, 1);
  402. });
  403. $('#openBgStatus').click(function () {
  404. if ($('#openChangeState').is(':checked')) {
  405. $('#bgstatus').modal('show');
  406. }
  407. });
  408. $("#bgstatus").on('show.bs.modal', function () {
  409. let html = '';
  410. for (const cs of changeState) {
  411. html += `<tr data-order="${cs.order}">
  412. <td>${cs.name}</td>
  413. <td>
  414. <div class="input-group input-group-sm" style="width:90px">
  415. <input type="number" class="form-control" max="100" min="0" step="1" value="${cs.value}">
  416. <div class="input-group-append">
  417. <span class="input-group-text" id="set_change_state_btn">%</span>
  418. </div>
  419. </div>
  420. </td>
  421. </tr>`;
  422. }
  423. $('#change_state_table').html(html);
  424. });
  425. $('#set_change_state_btn').click(function () {
  426. if ($('#openChangeState').is(':checked')) {
  427. updateSetting(false, 2);
  428. } else {
  429. toastr.error('未开启变更令状态功能,不能设置计量上限默认值');
  430. }
  431. });
  432. });
  433. // 根据Min Max限制Input输入
  434. function limitInputMinMax (obj) {
  435. if (obj.max && _.toNumber(obj.value) > _.toNumber(obj.max)) {
  436. obj.value = obj.max;
  437. }
  438. if(obj.min && _.toNumber(obj.value) < _.toNumber(obj.min)) {
  439. obj.value = obj.min;
  440. }
  441. }
  442. // 根据Maxlength限制input输入
  443. function limitMaxLength (obj) {
  444. if (obj.maxLength >= 0 && obj.value.length > obj.maxLength) {
  445. obj.value = obj.value.substr(0, obj.maxLength);
  446. }
  447. }
  448. // 根据正则限制输入
  449. function limitReg(obj, reg) {
  450. obj.value = obj.value.replace(reg, '');
  451. }
  452. // 小数位数 input 输入限制
  453. function limitDecimal(obj) {
  454. limitReg(obj, /[^\d]/g);
  455. limitMaxLength(obj);
  456. limitInputMinMax(obj);
  457. }
  458. const updateSetting = function (tab = false, set_type = 0) {
  459. if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 1) {
  460. $('#openChangeApply').prop('checked', true);
  461. $('#openChangePlan').prop('checked', true);
  462. } else if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 2) {
  463. $('#openChangeProject').prop('checked', false);
  464. }
  465. if (!$('#openChangePlan')[0].checked && $('#openChangeApply')[0].checked && tab === 2) {
  466. $('#openChangePlan').prop('checked', true);
  467. } else if (!$('#openChangePlan')[0].checked && $('#openChangeApply')[0].checked && tab === 3) {
  468. $('#openChangeApply').prop('checked', false);
  469. $('#openChangeProject').prop('checked', false);
  470. }
  471. const pushData = {};
  472. if($('#openStageStart')[0].checked) {
  473. // 判断是否已选开始日,截止月日
  474. const startDay = parseInt($('#start_day').val());
  475. const endMonth = parseInt($('#end_month').val());
  476. const endDay = parseInt($('#end_day').val());
  477. let flag = false;
  478. if (startDay === 0) {
  479. $('#start_day').siblings('span').text('请选择日');
  480. flag = true;
  481. } else {
  482. $('#start_day').siblings('span').text('');
  483. }
  484. const endErrorMsg = [];
  485. if (endMonth === 0) {
  486. endErrorMsg.push('请选择月');
  487. flag = true;
  488. }
  489. if (endDay === 0) {
  490. endErrorMsg.push('请选择日');
  491. flag = true;
  492. }
  493. if (endErrorMsg.length > 0) {
  494. $('#end_day').siblings('span').text(endErrorMsg.join(' '));
  495. } else {
  496. // 本月截止日不允许小于开始日
  497. if (endMonth === 1 && startDay > endDay) {
  498. $('#end_day').siblings('span').text('截止日期选择不正确,请重新选择');
  499. flag = true;
  500. } else if (endMonth === 2 && startDay <= endDay){
  501. $('#end_day').siblings('span').text('次月截止日不允许大于开始日');
  502. flag = true;
  503. } else {
  504. $('#end_day').siblings('span').text('');
  505. }
  506. }
  507. if (flag) {
  508. $('#openStageStart')[0].checked = 0;
  509. $('#openStageStart').prop('checked', false);
  510. return;
  511. }
  512. pushData.stage_start = {
  513. start_day: startDay,
  514. end_month: endMonth,
  515. end_day: endDay,
  516. }
  517. $('#start_day').attr('disabled', true);
  518. $('#end_month').attr('disabled', true);
  519. $('#end_day').attr('disabled', true);
  520. } else {
  521. $('#start_day').removeAttr('disabled');
  522. $('#end_month').removeAttr('disabled');
  523. $('#end_day').removeAttr('disabled');
  524. }
  525. if ($('#openStageAudit')[0].checked) {
  526. $('#stage-audit-early').removeAttr('disabled');
  527. $('#stage-audit-worry').removeAttr('disabled');
  528. } else {
  529. $('#stage-audit-early').attr('disabled', 'disabled');
  530. $('#stage-audit-worry').attr('disabled', 'disabled');
  531. }
  532. if (set_type === 1) {
  533. // 自定义变更类别
  534. const change_class = [];
  535. let flag = false;
  536. let allUnchecked = true;
  537. $('#change_class_div .input-group').each(function () {
  538. const one_class = _.find(changeClass, { value: parseInt($(this).find('input[type="checkbox"]').val())});
  539. if ($(this).find('input[type="checkbox"]').is(':checked') && $(this).find('input[type="text"]').val().length > 8) {
  540. toastr.error(one_class.name + ' 类别名称字符不能超过8个');
  541. flag = true;
  542. }
  543. const new_name = $(this).find('input[type="checkbox"]').is(':checked') ? $(this).find('input[type="text"]').val() : '';
  544. if (new_name) {
  545. const classInfo = _.find(changeClass, function(item) {
  546. return item.name === new_name && item.value !== one_class.value;
  547. })
  548. if (classInfo) {
  549. toastr.error(one_class.name + '的类别名称不能与其他变更名称相同');
  550. flag = true;
  551. }
  552. if (_.findIndex(change_class, { new_name }) !== -1) {
  553. toastr.error(one_class.name + '的类别名称不能与其他类别名称相同');
  554. flag = true;
  555. }
  556. }
  557. if ($(this).find('input[type="checkbox"]').is(':checked')) {
  558. allUnchecked = false;
  559. }
  560. const one_updateClass = {
  561. value: one_class.value,
  562. name: one_class.name,
  563. new_name,
  564. checked: $(this).find('input[type="checkbox"]').is(':checked'),
  565. }
  566. change_class.push(one_updateClass);
  567. });
  568. if (flag) {
  569. return;
  570. }
  571. if (allUnchecked) {
  572. toastr.error('至少保留一个变更类别');
  573. return;
  574. }
  575. pushData.change_class = change_class;
  576. } else if (set_type === 2) {
  577. // 变更令状态功能-设置计量调用上限
  578. const change_state = [];
  579. let flag = false;
  580. const reg = /^(\d{1,2}|100)$/;
  581. $('#change_state_table tr').each(function () {
  582. const one_state = _.find(changeState, { order: parseInt($(this).attr('data-order'))});
  583. const value = parseFloat($(this).find('input[type="number"]').val());
  584. if (!(_.isNumber(value) && reg.test(value))) {
  585. toastr.error(one_state.name + '的计量上限默认值只能输入0-100之间的整数');
  586. flag = true;
  587. }
  588. const one_updateState = {
  589. order: one_state.order,
  590. name: one_state.name,
  591. value: value,
  592. }
  593. change_state.push(one_updateState);
  594. });
  595. if (flag) {
  596. return;
  597. }
  598. pushData.change_state = change_state;
  599. }
  600. postData('/sp/<%- ctx.subProject.id %>/setting/fun/update', {
  601. imType: parseInt($('[name=im_type]:checked').val()),
  602. banOver: $('[name=ban_over]')[0].checked,
  603. hintOver: $('#hint_over')[0].checked,
  604. banMinusChangeBills: $('[name=ban_minus_cb]')[0].checked,
  605. minusNoValue: $('[name=minusNoValue]')[0].checked,
  606. lockPayExpr: $('#lockPayExpr')[0].checked,
  607. showMinusCol: $('#showMinusCol')[0].checked,
  608. needGcl: $('#need_gcl')[0].checked,
  609. openChangeProject: $('#openChangeProject')[0].checked,
  610. openChangeApply: $('#openChangeApply')[0].checked,
  611. openChangePlan: $('#openChangePlan')[0].checked,
  612. openChangeWhiteList: $('#openChangeWhiteList')[0].checked,
  613. openChangeState: $('#openChangeState')[0].checked,
  614. openMaterialTax: $('#openMaterialTax')[0].checked,
  615. openMaterialChecklist: $('#openMaterialChecklist')[0].checked,
  616. openMaterialSelf: $('#openMaterialSelf')[0].checked,
  617. openMaterialEditForAudit: $('#openMaterialEditForAudit')[0].checked,
  618. openMaterialStageRepeat: $('#openMaterialStageRepeat')[0].checked,
  619. openStageStart: $('#openStageStart')[0].checked,
  620. openContractExpr: $('#openContractExpr')[0].checked,
  621. correctCalcContractTp: $('#correctCalcContractTp')[0].checked,
  622. close1stStageCheckDealParam: $('#close1stStageCheckDealParam')[0].checked,
  623. openMultiStageCalc: $('#openMultiStageCalc')[0].checked,
  624. closeWapYfSf: $('#closeWapYfSf')[0].checked,
  625. addFunSet: _.size(pushData) !== 0 ? pushData : null,
  626. openStageAudit: $('#openStageAudit')[0].checked,
  627. stageAuditEarly: parseInt($('#stage-audit-early').val()),
  628. stageAuditWorry: parseInt($('#stage-audit-worry').val()),
  629. }, function (result) {
  630. if ($('#openChangeState').is(':checked')) {
  631. $('#openBgStatus').removeClass('text-secondary');
  632. } else {
  633. $('#openBgStatus').addClass('text-secondary');
  634. }
  635. if (set_type === 1) {
  636. changeClass = pushData.change_class;
  637. toastr.success('设置成功');
  638. $('#bgclass').modal('hide');
  639. } else if (set_type === 2) {
  640. changeState = pushData.change_state;
  641. toastr.success('设置成功');
  642. $('#bgstatus').modal('hide');
  643. }
  644. });
  645. }
  646. </script>