fun.ejs 46 KB

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