fun.ejs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  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-7">
  13. <div class="row">
  14. <div class="col-6">
  15. <div class="card mb-3">
  16. <div class="card-body">
  17. <h5 class="card-title">超计控制</h5>
  18. <div class="form-group mb-4">
  19. <div>
  20. <div class="form-check">
  21. <input class="form-check-input" type="checkbox" id="ban_over" name="ban_over" <% if (funRela.banOver) { %>checked<% } %> onchange="updateSetting();">
  22. <label class="form-check-label" for="ban_over">超计时限制上报审批/审批通过</label>
  23. </div>
  24. <div class="form-check">
  25. <input class="form-check-input" type="checkbox" id="hint_over" name="hint_over" <% if (funRela.hintOver) { %>checked<% } %> onchange="updateSetting();">
  26. <label class="form-check-label" for="hint_over">超计时标红显示</label>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="col-6">
  34. <div class="card mb-3">
  35. <div class="card-body">
  36. <h5 class="card-title">变更令调用控制</h5>
  37. <div class="form-group mb-4">
  38. <div>
  39. <div class="form-check form-check-inline">
  40. <input class="form-check-input" type="checkbox" id="ban_minus_cb" name="ban_minus_cb" <% if (funRela.banMinusChangeBills) { %>checked<% } %> onchange="updateSetting();">
  41. <label class="form-check-label" for="ban_minus_cb">强制调用负变更(限制上报审批/审批通过)</label>
  42. </div>
  43. <div class="alert-warning p-1"><i class="fa Example of exclamation-circle fa-exclamation-circle "></i> 变更令开始调用后,负变更清单必须在本期全部调用</div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="card mb-3">
  51. <div class="card-body">
  52. <h5 class="card-title">负变更</h5>
  53. <div class="form-group mb-4">
  54. <div>
  55. <div class="form-check form-check-inline">
  56. <input class="form-check-input" type="checkbox" id="minusNoValue" name="minusNoValue" <% if (funRela.minusNoValue) { %>checked<% } %> onchange="updateSetting();">
  57. <label class="form-check-label" for="minusNoValue">计量不计价</label>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="card mb-3">
  64. <div class="card-body">
  65. <h5 class="card-title">合同支付</h5>
  66. <div class="form-group mb-4">
  67. <div>
  68. <div class="form-check form-check-inline">
  69. <input class="form-check-input" type="checkbox" id="lockPayExpr" name="lockPayExpr" <% if (funRela.lockPayExpr) { %>checked<% } %> onchange="updateSetting();">
  70. <label class="form-check-label" for="lockPayExpr">锁定往期带基数计算的合同支付项</label>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <div class="card mb-3 ">
  77. <div class="card-body pb-2">
  78. <div class="row m-0">
  79. <h5 class="card-title">计量期上报</h5>
  80. <div class="pull-right d-inline-block form-group form-check ml-auto">
  81. <div class="custom-control custom-switch">
  82. <input type="checkbox" class="custom-control-input" id="openStageStart" <% if(ctx.session.sessionProject.page_show.openStageStart) { %>checked<% } %> onchange="updateSetting();">
  83. <label class="custom-control-label" for="openStageStart"></label>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="form-group mb-1">
  88. <div>
  89. <div class="input-group input-group-sm mb-2">
  90. <div class="input-group-prepend">
  91. <span class="input-group-text">开始日期:</span>
  92. <span class="input-group-text" style="width: 90px;padding-left: 12px;">每月</span>
  93. </div>
  94. <select class="form-control form-control-sm" id="start_day" style="width: 90px!important;flex: none;" <% if (ctx.session.sessionProject.page_show.openStageStart) { %>disabled<% } %>>
  95. <option value="0">请选择日</option>
  96. <% for (let i = 1; i <= 31;i++) { %>
  97. <option value="<%- i %>" <% if (funSet.stage_start.start_day === i) {%>selected<% } %>><%- i %></option>
  98. <% } %>
  99. </select>
  100. <span class="text-danger mx-2"></span>
  101. </div>
  102. <div class="input-group input-group-sm mb-2">
  103. <div class="input-group-prepend">
  104. <span class="input-group-text">截止日期:</span>
  105. </div>
  106. <select class="form-control form-control-sm" id="end_month" style="width: 90px!important;flex: none;" <% if (ctx.session.sessionProject.page_show.openStageStart) { %>disabled<% } %>>
  107. <option value="0">请选择月</option>
  108. <% for (const i of endMonth) { %>
  109. <option value="<%- i.val %>" <% if (funSet.stage_start.end_month === i.val) {%>selected<% } %> ><%- i.name %></option>
  110. <% } %>
  111. </select>
  112. <select class="form-control form-control-sm" id="end_day" style="width: 90px!important;flex: none;" <% if (ctx.session.sessionProject.page_show.openStageStart) { %>disabled<% } %>>
  113. <option value="0">请选择日</option>
  114. <% for (let i = 1; i <= 31;i++) { %>
  115. <option value="<%- i %>" <% if (funSet.stage_start.end_day === i) {%>selected<% } %>><%- i %></option>
  116. <% } %>
  117. </select>
  118. <span class="text-danger mx-2"></span>
  119. </div>
  120. </div>
  121. </div>
  122. <div class="mt-3">
  123. <label class="form-text alert alert-danger">开启选项后,超出范围内的日期,则不允许上报期计量。</label>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="card mb-3">
  128. <div class="card-body">
  129. <h5 class="card-title">中间计量模式设置</h5>
  130. <div class="form-group mb-4">
  131. <div>
  132. <% for (const i in imType) { %>
  133. <div class="form-check form-check-inline">
  134. <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();">
  135. <label class="form-check-label" for="radio_<%- i %>" name="im_type"><%- imType[i].name %></label>
  136. </div>
  137. <% } %>
  138. </div>
  139. <div class="mt-3">
  140. <label class="form-text alert alert-danger">切换模式,仅对未开始第一期计量的标段生效。</label>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <div class="row">
  146. <div class="col-6">
  147. <div class="card mb-3">
  148. <div class="card-body">
  149. <h5 class="card-title">工程变更</h5>
  150. <div class="alert alert-dark py-1 px-2 mb-2" role="alert">
  151. 页面显示
  152. </div>
  153. <div class="form-group mb-1">
  154. <div class="form-check form-check-inline">
  155. <input class="form-check-input" type="checkbox" id="openChangeProject" <% if(ctx.session.sessionProject.page_show.openChangeProject) { %>checked<% } %> onchange="updateSetting(1);">
  156. <label class="form-check-label" for="openChangeProject">显示「变更立项」页面</label>
  157. </div>
  158. </div>
  159. <div class="form-group mb-1">
  160. <div class="form-check form-check-inline">
  161. <input class="form-check-input" type="checkbox" id="openChangeApply" <% if(ctx.session.sessionProject.page_show.openChangeApply) { %>checked<% } %> onchange="updateSetting(2);">
  162. <label class="form-check-label" for="openChangeApply">显示「变更申请」页面</label>
  163. </div>
  164. </div>
  165. <div class="form-group mb-1">
  166. <div class="form-check form-check-inline">
  167. <input class="form-check-input" type="checkbox" id="openChangePlan" <% if(ctx.session.sessionProject.page_show.openChangePlan) { %>checked<% } %> onchange="updateSetting(3);">
  168. <label class="form-check-label" for="openChangePlan">显示「变更方案」页面</label>
  169. </div>
  170. </div>
  171. <div class="alert alert-dark py-1 px-2 mb-2" role="alert">
  172. 功能设置
  173. </div>
  174. <div class="mb-1">
  175. <div class="form-check form-check-inline">
  176. <input class="form-check-input" type="checkbox" id="inlineCheckbox11" checked disabled>
  177. <label class="form-check-label" for="inlineCheckbox11">开启自定义变更类别</label>
  178. </div>
  179. <a class="pull-right mr-3" href="#bgclass" data-toggle="modal" data-target="#bgclass">设置</a>
  180. </div>
  181. <!-- <div class="mb-1">-->
  182. <!-- <div class="form-check form-check-inline">-->
  183. <!-- <input class="form-check-input" type="checkbox" id="inlineCheckbox12" value="option1">-->
  184. <!-- <label class="form-check-label" for="inlineCheckbox12">开启变更令状态功能 </label>-->
  185. <!-- <a href="" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="变更令提供临时、立项、批复状态,可设置计量上限"><i class="fa fa-question-circle "></i></a>-->
  186. <!-- </div>-->
  187. <!-- <a class="pull-right mr-3" href="#bgstatus" data-toggle="modal" data-target="#bgstatus">设置(未勾选,灰选不可用)</a>-->
  188. <!-- </div>-->
  189. <div class="mb-1">
  190. <div class="form-check form-check-inline">
  191. <input class="form-check-input" type="checkbox" id="openChangeWhiteList" <% if (ctx.session.sessionProject.page_show.openChangeWhiteList) { %>checked<% } %> onchange="updateSetting();">
  192. <label class="form-check-label" for="openChangeWhiteList">开启“添加空白清单”功能</label>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <div class="col-6">
  199. <div class="card mb-3">
  200. <div class="card-body">
  201. <h5 class="card-title">材料调差</h5>
  202. <div class="form-group mb-1">
  203. <div class="form-check form-check-inline">
  204. <input class="form-check-input" type="checkbox" id="openMaterialTax" <% if(ctx.session.sessionProject.page_show.openMaterialTax) { %>checked<% } %> onchange="updateSetting();">
  205. <label class="form-check-label" for="openMaterialTax">使用材料税</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="openMaterialChecklist" <% if(ctx.session.sessionProject.page_show.openMaterialChecklist) { %>checked<% } %> onchange="updateSetting();">
  211. <label class="form-check-label" for="openMaterialChecklist">开启「批量设置调差清单」添加调差工料功能</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="openMaterialSelf" <% if(ctx.session.sessionProject.page_show.openMaterialSelf) { %>checked<% } %> onchange="updateSetting();">
  217. <label class="form-check-label" for="openMaterialSelf">开启调差清单-所属项目节「单独添加工料」功能
  218. <a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="开启该选项,调差清单的所属项目节,允许单独添加工料"><i class="fa fa-question-circle "></i></a></label>
  219. </div>
  220. </div>
  221. <div class="form-group mb-1">
  222. <div class="form-check form-check-inline">
  223. <input class="form-check-input" type="checkbox" id="openMaterialEditForAudit" <% if(ctx.session.sessionProject.page_show.openMaterialEditForAudit) { %>checked<% } %> onchange="updateSetting();">
  224. <label class="form-check-label" for="openMaterialEditForAudit">开启「审核人修改数据」功能
  225. <a href="javascript:void(0);" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="开启该选项,审核人允许修改部分调差工料数据"><i class="fa fa-question-circle "></i></a></label>
  226. </div>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. </div>
  232. <div class="card mb-3">
  233. <div class="card-body">
  234. <h5 class="card-title">动态决算</h5>
  235. <div class="form-group mb-4">
  236. <div>
  237. <div class="form-check form-check-inline">
  238. <input class="form-check-input" type="checkbox" id="need_gcl" name="need_gcl" <% if (funRela.needGcl) { %>checked<% } %> onchange="updateSetting();">
  239. <label class="form-check-label" for="need_gcl">显示清单信息</label>
  240. </div>
  241. </div>
  242. <div class="mt-3">
  243. <label class="form-text alert alert-danger">做施工图三级清单预算时,请进行勾选。</label>
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. <script src="/public/js/setting.js"></script>
  255. <script>
  256. let changeClass = JSON.parse(unescape('<%- escape(JSON.stringify(funSet.change_class)) %>'));
  257. $(() => {
  258. autoFlashHeight();
  259. // 自定义变更类别
  260. $('body').on('click', '#change_class_div input[type="checkbox"]', function () {
  261. if ($(this).is(':checked')) {
  262. $(this).parents('.input-group-prepend').siblings('input').removeAttr('readonly');
  263. } else {
  264. $(this).parents('.input-group-prepend').siblings('input').attr('readonly', true).val('');
  265. }
  266. });
  267. $('body').on('change', '#change_class_div input[type="text"]', function () {
  268. if ($(this).val().length > 8) {
  269. toastr.error('类别名称不能超过8个字符');
  270. }
  271. });
  272. $("#bgclass").on('show.bs.modal', function () {
  273. let html = '';
  274. for (const cc of changeClass) {
  275. html += `<div class="input-group input-group-sm mb-1">
  276. <div class="input-group-prepend">
  277. <div class="input-group-text">
  278. <input type="checkbox" value="${cc.value}" aria-label="Checkbox for following text input" ${cc.checked ? 'checked' : ''}>
  279. </div>
  280. <span class="input-group-text">${cc.name}</span>
  281. </div>
  282. <input type="text" class="form-control" value="${cc.new_name}" ${!cc.checked ? 'readonly' : ''} aria-label="Text input with checkbox" placeholder="">
  283. </div>`;
  284. }
  285. $('#change_class_div').html(html);
  286. });
  287. $('#set_change_class_btn').click(function () {
  288. updateSetting(false, 1);
  289. });
  290. });
  291. const updateSetting = function (tab = false, setChangeClass = false) {
  292. if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 1) {
  293. $('#openChangeApply').prop('checked', true);
  294. $('#openChangePlan').prop('checked', true);
  295. } else if (!$('#openChangeApply')[0].checked && $('#openChangeProject')[0].checked && tab === 2) {
  296. $('#openChangeProject').prop('checked', false);
  297. }
  298. if (!$('#openChangePlan')[0].checked && $('#openChangeApply')[0].checked && tab === 2) {
  299. $('#openChangePlan').prop('checked', true);
  300. } else if (!$('#openChangePlan')[0].checked && $('#openChangeApply')[0].checked && tab === 3) {
  301. $('#openChangeApply').prop('checked', false);
  302. $('#openChangeProject').prop('checked', false);
  303. }
  304. const pushData = {};
  305. if($('#openStageStart')[0].checked) {
  306. // 判断是否已选开始日,截止月日
  307. const startDay = parseInt($('#start_day').val());
  308. const endMonth = parseInt($('#end_month').val());
  309. const endDay = parseInt($('#end_day').val());
  310. let flag = false;
  311. if (startDay === 0) {
  312. $('#start_day').siblings('span').text('请选择日');
  313. flag = true;
  314. } else {
  315. $('#start_day').siblings('span').text('');
  316. }
  317. const endErrorMsg = [];
  318. if (endMonth === 0) {
  319. endErrorMsg.push('请选择月');
  320. flag = true;
  321. }
  322. if (endDay === 0) {
  323. endErrorMsg.push('请选择日');
  324. flag = true;
  325. }
  326. if (endErrorMsg.length > 0) {
  327. $('#end_day').siblings('span').text(endErrorMsg.join(' '));
  328. } else {
  329. // 本月截止日不允许小于开始日
  330. if (endMonth === 1 && startDay > endDay) {
  331. $('#end_day').siblings('span').text('截止日期选择不正确,请重新选择');
  332. flag = true;
  333. } else if (endMonth === 2 && startDay <= endDay){
  334. $('#end_day').siblings('span').text('次月截止日不允许大于开始日');
  335. flag = true;
  336. } else {
  337. $('#end_day').siblings('span').text('');
  338. }
  339. }
  340. if (flag) {
  341. $('#openStageStart')[0].checked = 0;
  342. $('#openStageStart').prop('checked', false);
  343. return;
  344. }
  345. pushData.stage_start = {
  346. start_day: startDay,
  347. end_month: endMonth,
  348. end_day: endDay,
  349. }
  350. $('#start_day').attr('disabled', true);
  351. $('#end_month').attr('disabled', true);
  352. $('#end_day').attr('disabled', true);
  353. } else {
  354. $('#start_day').removeAttr('disabled');
  355. $('#end_month').removeAttr('disabled');
  356. $('#end_day').removeAttr('disabled');
  357. }
  358. if (setChangeClass) {
  359. const change_class = [];
  360. let flag = false;
  361. let allUnchecked = true;
  362. $('#change_class_div .input-group').each(function () {
  363. const one_class = _.find(changeClass, { value: parseInt($(this).find('input[type="checkbox"]').val())});
  364. if ($(this).find('input[type="checkbox"]').is(':checked') && $(this).find('input[type="text"]').val().length > 8) {
  365. toastr.error(one_class.name + ' 类别名称字符不能超过8个');
  366. flag = true;
  367. }
  368. const new_name = $(this).find('input[type="checkbox"]').is(':checked') ? $(this).find('input[type="text"]').val() : '';
  369. if (new_name) {
  370. const classInfo = _.find(changeClass, function(item) {
  371. return item.name === new_name && item.value !== one_class.value;
  372. })
  373. if (classInfo) {
  374. toastr.error(one_class.name + '的类别名称不能与其他变更名称相同');
  375. flag = true;
  376. }
  377. if (_.findIndex(change_class, { new_name }) !== -1) {
  378. toastr.error(one_class.name + '的类别名称不能与其他类别名称相同');
  379. flag = true;
  380. }
  381. }
  382. if ($(this).find('input[type="checkbox"]').is(':checked')) {
  383. allUnchecked = false;
  384. }
  385. const one_updateClass = {
  386. value: one_class.value,
  387. name: one_class.name,
  388. new_name,
  389. checked: $(this).find('input[type="checkbox"]').is(':checked'),
  390. }
  391. change_class.push(one_updateClass);
  392. });
  393. if (flag) {
  394. return;
  395. }
  396. if (allUnchecked) {
  397. toastr.error('至少保留一个变更类别');
  398. return;
  399. }
  400. pushData.change_class = change_class;
  401. }
  402. postData('/setting/fun/update', {
  403. imType: parseInt($('[name=im_type]:checked').val()),
  404. banOver: $('[name=ban_over]')[0].checked,
  405. hintOver: $('#hint_over')[0].checked,
  406. banMinusChangeBills: $('[name=ban_minus_cb]')[0].checked,
  407. minusNoValue: $('[name=minusNoValue]')[0].checked,
  408. lockPayExpr: $('#lockPayExpr')[0].checked,
  409. needGcl: $('#need_gcl')[0].checked,
  410. openChangeProject: $('#openChangeProject')[0].checked,
  411. openChangeApply: $('#openChangeApply')[0].checked,
  412. openChangePlan: $('#openChangePlan')[0].checked,
  413. openChangeWhiteList: $('#openChangeWhiteList')[0].checked,
  414. openMaterialTax: $('#openMaterialTax')[0].checked,
  415. openMaterialChecklist: $('#openMaterialChecklist')[0].checked,
  416. openMaterialSelf: $('#openMaterialSelf')[0].checked,
  417. openMaterialEditForAudit: $('#openMaterialEditForAudit')[0].checked,
  418. openStageStart: $('#openStageStart')[0].checked,
  419. addFunSet: _.size(pushData) !== 0 ? pushData : null,
  420. }, function (result) {
  421. if (setChangeClass) {
  422. changeClass = pushData.change_class;
  423. toastr.success('设置成功');
  424. $('#bgclass').modal('hide');
  425. }
  426. });
  427. }
  428. </script>