compilation.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406
  1. /**
  2. * 编办管理相关js
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/28
  6. * @version
  7. */
  8. const delayTime = 500;
  9. let keyupTime;
  10. function delayKeyup(callback) {
  11. let nowTime = Date.now();
  12. keyupTime = nowTime;
  13. setTimeout(function () {
  14. if (nowTime - keyupTime == 0 && callback) {
  15. callback();
  16. }
  17. }, delayTime);
  18. }
  19. $(document).ready(function () {
  20. let isAdding = false;
  21. let model = "";
  22. let section =
  23. $(".nav-tabs li.active > a").text() === "建议估算" ? "suggestion" : "bill";
  24. let id = $("#compilation-id").val();
  25. // 计价规则页面初始化数据
  26. if ($("#save-lib").length > 0) {
  27. initCompilation();
  28. }
  29. // 计价类型选择
  30. $(".nav-tabs li > a").click(function () {
  31. section = $(this).attr("aria-controls");
  32. });
  33. // 新增编办
  34. $("#add-compilation").click(function () {
  35. try {
  36. let data = getAndValidData(model);
  37. let url = "/compilation/add";
  38. if (model === "all") {
  39. // 新增编办操作
  40. $.ajax({
  41. url: url,
  42. type: "post",
  43. data: { name: data.name },
  44. error: function () {
  45. isAdding = false;
  46. },
  47. beforeSend: function () {
  48. isAdding = true;
  49. },
  50. success: function (response) {
  51. isAdding = false;
  52. if (response.err === 0) {
  53. window.location.reload();
  54. } else {
  55. let msg = response.msg === undefined ? "未知错误" : response.msg;
  56. alert(msg);
  57. }
  58. },
  59. });
  60. } else {
  61. // 新增标准清单/定额库
  62. let addLib = {
  63. name: data[model].name,
  64. id: data[model].id,
  65. };
  66. // 判断是否有重复的数据
  67. if (
  68. $(
  69. "input:hidden[name='" +
  70. model +
  71. "_lib'][data-id='" +
  72. addLib.id +
  73. "']"
  74. ).length > 0
  75. ) {
  76. alert("重复添加数据!");
  77. return false;
  78. }
  79. let removeHtml =
  80. '<a class="pull-right text-danger remove-lib" data-model="' +
  81. model +
  82. '" ' +
  83. 'title="移除"><span class="glyphicon glyphicon-remove"></span></a>';
  84. let tmpHtml =
  85. '<p class="form-control-static">' +
  86. removeHtml +
  87. addLib.name +
  88. '<input type="hidden" data-id="' +
  89. addLib.id +
  90. "\" name='" +
  91. model +
  92. "_lib' value='" +
  93. JSON.stringify(addLib) +
  94. "'>" +
  95. "</p>";
  96. $("." + model + "-list").append(tmpHtml);
  97. $("#addcompilation").modal("hide");
  98. }
  99. } catch (error) {
  100. alert(error);
  101. }
  102. });
  103. $("#addTaxGroupBtn").click(function () {
  104. $("#groupEditType").val("add");
  105. $("#taxType").val("");
  106. $("#program_lib").val("");
  107. $("#template_lib").val("");
  108. $("#col_lib").val("");
  109. $("#fee_lib").val("");
  110. });
  111. //新增计税组合
  112. $("#add-group").click(function () {
  113. let taxMap = { 1: "一般计税", 2: "简易计税" };
  114. let actionType = $("#groupEditType").val();
  115. let groupData = getTaxGroupData();
  116. let groupIndex = getGroupIndex(groupData); //用来做重复判断
  117. if (!_.isEmpty(groupData)) {
  118. //重复判断 todo
  119. if ($("input[data-id = " + groupIndex + "]").length <= 0) {
  120. let taxName = groupData.taxType ? taxMap[groupData.taxType] : "";
  121. let p_name = groupData.program_lib
  122. ? groupData.program_lib.displayName
  123. : "";
  124. let t_name = groupData.template_lib ? groupData.template_lib.name : "";
  125. let c_name = groupData.col_lib ? groupData.col_lib.name : "";
  126. let f_name = groupData.fee_lib ? groupData.fee_lib.name : "";
  127. let htmlString =
  128. "<tr class='taxGroup_tr'><td><span>" +
  129. taxName +
  130. "</span></td>" +
  131. "<td><span>" +
  132. p_name +
  133. "</span></td>" +
  134. "<td><span>" +
  135. t_name +
  136. "</span></td>" +
  137. "<td><span>" +
  138. c_name +
  139. "</span></td>" +
  140. "<td><span>" +
  141. f_name +
  142. "</span></td>" +
  143. "<td> <a class='btn btn-link btn-sm' style='padding: 0px' onclick='editTaxGroup(this)'> 编辑</a>/<a class='btn btn-link btn-sm ' style='padding: 0px' onclick='deleteTableTr(this,\"taxGroup_tr\")'>删除</a> " +
  144. "<input type='hidden' name='tax_group' data-id ='" +
  145. groupIndex +
  146. "' value='" +
  147. JSON.stringify(groupData) +
  148. "'>" +
  149. "</td>" +
  150. "</tr>";
  151. if (actionType == "add") {
  152. $("#tax_group_tbody").append(htmlString);
  153. } else if (actionType == "modify") {
  154. let oldIndex = $("#groupIndex").val();
  155. let parentTr = $("input[data-id = " + oldIndex + "]").parents(
  156. ".taxGroup_tr"
  157. );
  158. parentTr.after(htmlString);
  159. parentTr.remove();
  160. }
  161. } else {
  162. alert("已存在相同的组合!");
  163. }
  164. }
  165. $("#addTaxGroup").modal("hide");
  166. });
  167. $("#ration_lib-search-box").on("input", function () {
  168. var keyword = $(this).val().toLowerCase().trim(); // 获取输入的关键字并转为小写
  169. // 遍历所有option元素
  170. $('select[name="ration_lib"] option').each(function () {
  171. var optionText = $(this).text().toLowerCase(); // 获取option的文本并转为小写
  172. // 如果option文本包含关键字,则显示,否则隐藏
  173. if (optionText.indexOf(keyword) !== -1) {
  174. $(this).show();
  175. } else {
  176. $(this).hide();
  177. }
  178. });
  179. });
  180. //新增定额库
  181. $("#add-ration").click(function () {
  182. const options = $("select[name='ration_lib']").children("option:selected");
  183. let alertArr = [];
  184. let htmlString = "";
  185. for (const option of options) {
  186. const rationLib = $(option).val();
  187. const rationLibString = $(option).text();
  188. if (!rationLib) {
  189. alertString.push(`“${rationLibString}”为无效定额库`);
  190. continue;
  191. }
  192. if (
  193. $("input:hidden[name=ration_lib][data-id = " + rationLib + "]").length >
  194. 0
  195. ) {
  196. alertArr.push(`“${rationLibString}”已存在`);
  197. continue;
  198. }
  199. const tem = {
  200. id: rationLib,
  201. name: rationLibString,
  202. onlyProfession: false,
  203. isDefault: false,
  204. };
  205. htmlString += `
  206. <tr class='ration_tr' draggable="true">
  207. <td><span class="cursor-default">${tem.name}</span></td>
  208. <td><label class="form-check-label"> <input class="form-check-input" name="ration_onlyProfession" value="${
  209. tem.id
  210. }" type="checkbox"></td>
  211. <td><label class="form-check-label"> <input class="form-check-input" name="ration_isDefault" value="${
  212. tem.id
  213. }" type="radio"></td>
  214. <td>
  215. <a class='btn btn-link btn-sm ' style="padding: 0px" onclick='deleteTableTr(this,"ration_tr")'>删除</a>
  216. <input type="hidden" name="ration_lib" data-id="${
  217. tem.id
  218. }" value='${JSON.stringify(tem)}'>
  219. </td>
  220. </tr>`;
  221. }
  222. if (alertArr.length) {
  223. alert(alertArr.join("\n"));
  224. } else {
  225. $("#ration_tbody").append(htmlString);
  226. $("#addRation").modal("hide");
  227. }
  228. });
  229. // 复制定额库
  230. $("#copy-lib-confirm").click(async function () {
  231. try {
  232. $.bootstrapLoading.start();
  233. const [valuationID, engineeringID] = window.location.pathname
  234. .split("/")
  235. .slice(-2);
  236. await ajaxPost("/compilation/copyRationLibs", {
  237. valuationID,
  238. engineeringID,
  239. });
  240. } catch (err) {
  241. console.log(err);
  242. } finally {
  243. $.bootstrapLoading.end();
  244. }
  245. });
  246. // 拖动排序
  247. const dragSelector = ".ration_tr[draggable=true]";
  248. const rationBodySelector = "#ration_tbody";
  249. const wrapper = $(".panel-content")[0];
  250. let dragged;
  251. let rID = null;
  252. const scrollStep = 6;
  253. // 表格数据过多的时候,靠下方的条目想要移动到上方,需要滚动条滚动到相应位置,滚动条向上滚动需要代码自行处理
  254. function scroll(ele, step) {
  255. wrapper.scrollTop -= step;
  256. rID = window.requestAnimationFrame(() => {
  257. scroll(ele, step);
  258. });
  259. }
  260. // 动态绑定(新增的也能监听到)
  261. $(rationBodySelector).on("drag", dragSelector, function (ev) {
  262. const { clientX, clientY } = ev;
  263. const dom = document.elementFromPoint(clientX, clientY);
  264. if (dom.tagName === "H2" && !rID) {
  265. rID = window.requestAnimationFrame(() => {
  266. scroll(wrapper, scrollStep);
  267. });
  268. } else if (dom.tagName !== "H2" && rID) {
  269. window.cancelAnimationFrame(rID);
  270. rID = null;
  271. }
  272. });
  273. $(rationBodySelector).on("dragstart", dragSelector, function (ev) {
  274. dragged = this;
  275. $(this).addClass("dragging");
  276. ev.originalEvent.dataTransfer.effectAllowed = "move";
  277. });
  278. $(rationBodySelector).on("dragend", dragSelector, function (ev) {
  279. $(this).removeClass("dragging");
  280. if (rID) {
  281. window.cancelAnimationFrame(rID);
  282. rID = null;
  283. }
  284. });
  285. $(rationBodySelector).on("dragover", dragSelector, function (ev) {
  286. ev.preventDefault(); // 必须调用此方法,否则drop事件不触发
  287. });
  288. $(rationBodySelector).on("dragenter", dragSelector, function (ev) {
  289. if (this !== dragged) {
  290. $(this).addClass("highlight");
  291. }
  292. });
  293. $(rationBodySelector).on("dragleave", dragSelector, function (ev) {
  294. if (this !== dragged) {
  295. $(this).removeClass("highlight");
  296. }
  297. });
  298. $(rationBodySelector).on("drop", dragSelector, function (ev) {
  299. $(this).removeClass("highlight");
  300. $(this).after($(dragged));
  301. });
  302. // 新增计价规则
  303. $("#add-valuation").click(function () {
  304. try {
  305. if (id === "") {
  306. throw "页面数据有误";
  307. }
  308. let name = $("input[name='valuation_name']").val();
  309. if (name === "") {
  310. throw "请填写计价规则名称";
  311. }
  312. $.ajax({
  313. url: "/compilation/add-valuation",
  314. type: "post",
  315. data: { name: name, id: id, section: section },
  316. error: function () {
  317. isAdding = false;
  318. },
  319. beforeSend: function () {
  320. isAdding = true;
  321. },
  322. success: function (response) {
  323. isAdding = false;
  324. if (response.err === 0) {
  325. window.location.reload();
  326. } else {
  327. let msg = response.msg === undefined ? "未知错误" : response.msg;
  328. alert(msg);
  329. }
  330. },
  331. });
  332. } catch (error) {
  333. alert(error);
  334. return false;
  335. }
  336. });
  337. // 添加
  338. $(".add-compilation").click(function () {
  339. model = $(this).data("model");
  340. $("#addcompilation .modal-body > div").hide();
  341. switch (model) {
  342. case "all":
  343. $("#name-area").show();
  344. $("#add-compilation-title").text("添加新费用定额");
  345. break;
  346. case "bill":
  347. $("#bill-area").show();
  348. $("#add-compilation-title").text("添加标准清单");
  349. break;
  350. case "ration":
  351. $("#ration-area").show();
  352. $("#add-compilation-title").text("添加定额库");
  353. break;
  354. case "glj":
  355. $("#glj-area").show();
  356. $("#add-compilation-title").text("添加定额库");
  357. break;
  358. case "billsGuidance":
  359. $("#billsGuidance-area").show();
  360. $("#add-compilation-title").text("添加清单指引库");
  361. break;
  362. case "fee":
  363. $("#fee-area").show();
  364. $("#add-compilation-title").text("添加费率标准");
  365. break;
  366. case "artificial":
  367. $("#artificial-area").show();
  368. $("#add-compilation-title").text("添加人工系数");
  369. break;
  370. case "program":
  371. $("#program-area").show();
  372. $("#add-compilation-title").text("添加计算程序");
  373. break;
  374. case "feature":
  375. $("#feature-area").show();
  376. $("#add-compilation-title").text("添加工程特征");
  377. break;
  378. case "info":
  379. $("#info-area").show();
  380. $("#add-compilation-title").text("添加基本信息");
  381. break;
  382. case "progressive":
  383. $("#progressive-area").show();
  384. $("#add-compilation-title").text("添加累进区间");
  385. break;
  386. case "vvTax":
  387. $("#vvTax-area").show();
  388. $("#add-compilation-title").text("添加车船税");
  389. break;
  390. case "billCode":
  391. $("#billCode-area").show();
  392. $("#add-compilation-title").text("添加递延清单库");
  393. break;
  394. }
  395. $("#addcompilation").modal("show");
  396. });
  397. // 保存专业工程标准库
  398. $("#save-lib").click(function () {
  399. if (validLib()) {
  400. $("form").submit();
  401. }
  402. });
  403. // 保存计价规则
  404. $("#save-valuation").click(function () {
  405. $("#saveValuation").submit();
  406. });
  407. // 移除操作
  408. $(
  409. ".bill-list, .ration-list, .glj-list, .fee-list, .artificial-list, .program-list, .billsGuidance-list,.feature-list,.info-list,.progressive-list,.vvTax-list,.billCode-list"
  410. ).on("click", ".remove-lib", function () {
  411. $(this).parent().remove();
  412. });
  413. //更改描述
  414. $("#description").change(function () {
  415. let description = $(this).val();
  416. $.ajax({
  417. url: "/compilation/setDescription",
  418. type: "post",
  419. dataType: "json",
  420. data: { id: id, description: description },
  421. success: function (response) {
  422. if (response.err !== 0) {
  423. alert("更改失败");
  424. }
  425. },
  426. });
  427. });
  428. //更改代码覆盖路径
  429. $("#overWriteUrl").change(function () {
  430. let overWriteUrl = $(this).val();
  431. if (overWriteUrl == "") overWriteUrl = undefined;
  432. $.ajax({
  433. url: "/compilation/setOverWriteUrl",
  434. type: "post",
  435. dataType: "json",
  436. data: { id: id, overWriteUrl: overWriteUrl },
  437. success: function (response) {
  438. if (response.err !== 0) {
  439. alert("更改失败");
  440. }
  441. },
  442. });
  443. });
  444. //例题建设项目ID, 用英文字符;分隔建设项目ID
  445. $("#example").keyup(function () {
  446. let exampleVal = $(this).val();
  447. let tempExample = exampleVal.split(/[;,;]/g),
  448. example = [];
  449. for (let te of tempExample) {
  450. if (te.trim() !== "") {
  451. example.push(te.trim());
  452. }
  453. }
  454. example = Array.from(new Set(example));
  455. delayKeyup(function () {
  456. $.ajax({
  457. url: "/compilation/setExample",
  458. type: "post",
  459. dataType: "json",
  460. data: { id: id, example: example },
  461. success: function (response) {
  462. if (response.err !== 0) {
  463. alert("更改失败");
  464. }
  465. },
  466. });
  467. });
  468. });
  469. // 计价规则启用/禁止
  470. $(".enable").click(function () {
  471. let goingChangeStatus = switchChange($(this));
  472. let id = $(this).data("id");
  473. if (id === undefined || id === "" || isAdding) {
  474. return false;
  475. }
  476. $.ajax({
  477. url: "/compilation/valuation/" + section + "/enable",
  478. type: "post",
  479. dataType: "json",
  480. data: { id: id, enable: goingChangeStatus },
  481. error: function () {
  482. isAdding = false;
  483. switchChange($(this));
  484. },
  485. beforeSend: function () {
  486. isAdding = true;
  487. },
  488. success: function (response) {
  489. isAdding = false;
  490. if (response.err !== 0) {
  491. switchChange($(this));
  492. alert("更改失败");
  493. }
  494. },
  495. });
  496. });
  497. // 设置适用类型
  498. $(".fileType").change(function () {
  499. let id = $(this).data("id");
  500. if (id === undefined || id === "" || isAdding) {
  501. return false;
  502. }
  503. let fileTypes = [];
  504. let oldVal = $(this).attr("checked");
  505. if (oldVal) {
  506. $(this).removeAttr("checked");
  507. } else {
  508. $(this).attr("checked", "checked");
  509. }
  510. if ($("#" + id + "_suggest_gusuan").attr("checked")) fileTypes.push(16);
  511. if ($("#" + id + "_gusuan").attr("checked")) fileTypes.push(15);
  512. if ($("#" + id + "_estimate").attr("checked")) fileTypes.push(5);
  513. if ($("#" + id + "_submission").attr("checked")) fileTypes.push(1);
  514. if ($("#" + id + "_three_bill_budget").attr("checked")) fileTypes.push(18);
  515. if ($("#" + id + "_bill_budget").attr("checked")) fileTypes.push(19);
  516. if ($("#" + id + "_changeBudget").attr("checked")) fileTypes.push(4);
  517. if ($("#" + id + "_settlement").attr("checked")) fileTypes.push(10);
  518. let current = $(this);
  519. console.log(id, this);
  520. $.ajax({
  521. url: "/compilation/valuation/" + section + "/fileTypes",
  522. type: "post",
  523. dataType: "json",
  524. data: { id: id, fileTypes: fileTypes },
  525. error: function () {
  526. //恢复原值
  527. if (oldVal) {
  528. current.attr("checked", "checked");
  529. } else {
  530. current.removeAttr("checked");
  531. }
  532. },
  533. success: function (response) {
  534. if (response.err !== 0) {
  535. switchChange($(this));
  536. alert("更改失败");
  537. }
  538. },
  539. });
  540. });
  541. //计价规则删除
  542. $("#delete-confirm").click(function () {
  543. let id = $("#del").attr("selectedId");
  544. if (id === undefined || id === "") {
  545. return false;
  546. }
  547. window.location.href = `/compilation/valuation/${section}/delete/${id}`;
  548. });
  549. // 发布编办
  550. $("#release").click(function () {
  551. let id = $(this).data("id");
  552. let status = $(this).data("status");
  553. status = parseInt(status);
  554. if (isAdding || id === "" || isNaN(status)) {
  555. return false;
  556. }
  557. $.ajax({
  558. url: "/compilation/release",
  559. type: "post",
  560. data: { id: id, status: status },
  561. dataType: "json",
  562. error: function () {
  563. isAdding = false;
  564. },
  565. beforeSend: function () {
  566. isAdding = true;
  567. },
  568. success: function (response) {
  569. isAdding = false;
  570. if (response.err === 0) {
  571. window.location.reload();
  572. } else {
  573. let msg = response.msg === undefined ? "未知错误" : response.msg;
  574. alert(msg);
  575. }
  576. },
  577. });
  578. });
  579. //添加工程专业
  580. $("#addEngineerConfirm").click(async function () {
  581. if ($("#name").val() == "") {
  582. $("#nameError").show();
  583. return;
  584. }
  585. if ($("#feeName").val() == "") {
  586. $("#feeNameError").show();
  587. return;
  588. }
  589. if ($("#engineeringInput").val() == "") {
  590. $("#engineeringError").show();
  591. return;
  592. }
  593. if ($("#projectEngineering").val() == "") {
  594. $("#projectError").show();
  595. return;
  596. }
  597. $("#addEngineerConfirm").attr("disabled", true); //防止重复提交
  598. $("#addEngineerForm").submit();
  599. });
  600. //
  601. // CLD 办事处选择
  602. $("#category-select").change(function () {
  603. $.ajax({
  604. url: "/compilation/changeCategory",
  605. type: "post",
  606. data: { id: id, category: $(this).val() },
  607. dataType: "json",
  608. success: function (response) {
  609. if (response.error !== 0) {
  610. alert("更改失败");
  611. }
  612. },
  613. });
  614. });
  615. // 选择默认所在地
  616. $("#location-select").change(function () {
  617. $.ajax({
  618. url: "/compilation/changeLocation",
  619. type: "post",
  620. data: { id: id, location: $(this).val() },
  621. dataType: "json",
  622. success: function (response) {
  623. if (response.error !== 0) {
  624. alert("更改失败");
  625. }
  626. },
  627. });
  628. });
  629. // 选择编办类型
  630. $("#type-select").change(function () {
  631. $.ajax({
  632. url: "/compilation/changeCompilation",
  633. type: "post",
  634. data: { id: id, update: { type: $(this).val() } },
  635. dataType: "json",
  636. success: function (response) {
  637. if (response.error !== 0) {
  638. alert("更改失败");
  639. }
  640. },
  641. });
  642. });
  643. // 修改是否提供免费版
  644. $("#freeUse").change(function (val) {
  645. $.ajax({
  646. url: "/compilation/changeFreeUse",
  647. type: "post",
  648. data: { id: id, freeUse: $(this).prop("checked") },
  649. dataType: "json",
  650. success: function (response) {
  651. if (response.error !== 0) {
  652. alert("更改失败");
  653. }
  654. },
  655. });
  656. });
  657. // 选择编办类型
  658. $("#customMade").change(function () {
  659. $.ajax({
  660. url: "/compilation/changeCompilation",
  661. type: "post",
  662. data: { id: id, update: { customMade: $(this).prop("checked") } },
  663. dataType: "json",
  664. success: function (response) {
  665. if (response.error !== 0) {
  666. alert("更改失败");
  667. }
  668. },
  669. });
  670. });
  671. //更改版本号
  672. $("#edition").change(function () {
  673. let edition = $(this).val();
  674. $.ajax({
  675. url: "/compilation/setEdition",
  676. type: "post",
  677. dataType: "json",
  678. data: { id: id, edition: edition },
  679. success: function (response) {
  680. if (response.err !== 0) {
  681. alert("更改失败");
  682. }
  683. },
  684. });
  685. });
  686. //更改序号
  687. $("#serialNumber").change(function () {
  688. let serialNumber = Number($(this).val());
  689. $.ajax({
  690. url: "/compilation/setSerialNumber",
  691. type: "post",
  692. dataType: "json",
  693. data: { id: id, serialNumber: serialNumber },
  694. success: function (response) {
  695. if (response.err !== 0) {
  696. alert("更改失败");
  697. }
  698. },
  699. });
  700. });
  701. });
  702. /**
  703. * 初始化
  704. *
  705. * @return {void|boolean}
  706. */
  707. function initCompilation() {
  708. let billListData = billList === undefined ? [] : JSON.parse(billList);
  709. let rationLibData = rationList === undefined ? [] : JSON.parse(rationList);
  710. let gljLibData = gljList === undefined ? [] : JSON.parse(gljList);
  711. let feeLibData = feeRateList === undefined ? [] : JSON.parse(feeRateList);
  712. let artificialCoefficientData =
  713. artificialCoefficientList === undefined
  714. ? []
  715. : JSON.parse(artificialCoefficientList);
  716. let programData = programList === undefined ? [] : JSON.parse(programList);
  717. let billsGuidanceData =
  718. billsGuidanceList === undefined ? [] : JSON.parse(billsGuidanceList);
  719. let billTemplateData =
  720. billTemplateList == undefined ? [] : JSON.parse(billTemplateList);
  721. let mainTreeColData =
  722. mainTreeColList == undefined ? [] : JSON.parse(mainTreeColList);
  723. let featureData = featureList == undefined ? [] : JSON.parse(featureList);
  724. let infoData = infoList == undefined ? [] : JSON.parse(infoList);
  725. let progressiveData =
  726. progressiveList == undefined ? [] : JSON.parse(progressiveList);
  727. let vvTaxData = vvTaxList == undefined ? [] : JSON.parse(vvTaxList);
  728. let billCodeData = billCodeList == undefined ? [] : JSON.parse(billCodeList);
  729. /*mainTreeCol = mainTreeCol !== '' ? mainTreeCol.replace(/\n/g, '\\n') : mainTreeCol;
  730. billsTemplateData = billsTemplateData.replace(/\n/g, '\\n');
  731. let mainTreeColObj = mainTreeCol === '' ? {} : JSON.parse(mainTreeCol);
  732. // 初始化 造价书列设置
  733. colSpread = TREE_SHEET_HELPER.createNewSpread($('#main-tree-col')[0]);
  734. let billsTemplateTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1});
  735. billsTemplateTree.loadDatas(JSON.parse(billsTemplateData));
  736. if (mainTreeCol !== '' && mainTreeColObj.cols.length > 0) {
  737. TREE_SHEET_HELPER.loadSheetHeader(mainTreeColObj, colSpread.getActiveSheet());
  738. TREE_SHEET_HELPER.showTreeData(mainTreeColObj, colSpread.getActiveSheet(), billsTemplateTree);
  739. }*/
  740. /*
  741. if (billListData.length <= 0 || rationLibData.length <= 0 || gljLibData.length <= 0) {
  742. return false;
  743. } */
  744. // 标准清单
  745. let html = "";
  746. for (let tmp of billListData) {
  747. let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + "</option>";
  748. html += tmpHtml;
  749. }
  750. $("select[name='standard_bill']").children("option").first().after(html);
  751. // 定额库
  752. html = "";
  753. for (let tmp of rationLibData) {
  754. let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + "</option>";
  755. html += tmpHtml;
  756. }
  757. $("select[name='ration_lib']").html(html);
  758. // 工料机库
  759. html = "";
  760. for (let tmp of gljLibData) {
  761. let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + "</option>";
  762. html += tmpHtml;
  763. }
  764. $("select[name='glj_lib']").children("option").first().after(html);
  765. // 清单指引库
  766. html = "";
  767. for (let tmp of billsGuidanceData) {
  768. let tmpHtml = '<option value="' + tmp.ID + '">' + tmp.name + "</option>";
  769. html += tmpHtml;
  770. }
  771. $("select[name='billsGuidance_lib']").children("option").first().after(html);
  772. // 人工系数标准库
  773. html = "";
  774. for (let tmp of artificialCoefficientData) {
  775. let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + "</option>";
  776. html += tmpHtml;
  777. }
  778. $("select[name='artificial_lib']").children("option").first().after(html);
  779. // 计算程序标准库
  780. html = "";
  781. for (let tmp of programData) {
  782. let tmpHtml =
  783. '<option value="' + tmp.id + '">' + tmp.displayName + "</option>";
  784. html += tmpHtml;
  785. }
  786. $("select[name='program_lib']").children("option").first().after(html);
  787. //模板库
  788. html = "";
  789. for (let tmp of billTemplateData) {
  790. let tmpHtml = '<option value="' + tmp.ID + '">' + tmp.name + "</option>";
  791. html += tmpHtml;
  792. }
  793. $("select[name='template_lib']").children("option").first().after(html);
  794. //列设置
  795. html = "";
  796. for (let tmp of mainTreeColData) {
  797. let tmpHtml = '<option value="' + tmp.ID + '">' + tmp.name + "</option>";
  798. html += tmpHtml;
  799. }
  800. $("select[name='col_lib']").children("option").first().after(html);
  801. // 费率标准库
  802. html = "";
  803. for (let tmp of feeLibData) {
  804. let tmpHtml = '<option value="' + tmp.id + '">' + tmp.name + "</option>";
  805. html += tmpHtml;
  806. }
  807. $("select[name='fee_lib']").children("option").first().after(html);
  808. //工程特征库
  809. html = "";
  810. for (let tmp of featureData) {
  811. let tmpHtml = '<option value="' + tmp.ID + '">' + tmp.name + "</option>";
  812. html += tmpHtml;
  813. }
  814. $("select[name='feature_lib']").children("option").first().after(html); //工程特征库
  815. //基本信息库
  816. html = "";
  817. for (let tmp of infoData) {
  818. let tmpHtml = '<option value="' + tmp.ID + '">' + tmp.name + "</option>";
  819. html += tmpHtml;
  820. }
  821. $("select[name='info_lib']").children("option").first().after(html);
  822. //累进区间库
  823. html = "";
  824. for (let tmp of progressiveData) {
  825. let tmpHtml = '<option value="' + tmp.ID + '">' + tmp.name + "</option>";
  826. html += tmpHtml;
  827. }
  828. $("select[name='progressive_lib']").children("option").first().after(html);
  829. //车船税文件
  830. html = "";
  831. for (let tmp of vvTaxData) {
  832. let tmpHtml = '<option value="' + tmp.ID + '">' + tmp.name + "</option>";
  833. html += tmpHtml;
  834. }
  835. $("select[name='vvTax_lib']").children("option").first().after(html);
  836. //递延清单库文件
  837. html = "";
  838. for (let tmp of billCodeData) {
  839. let tmpHtml = '<option value="' + tmp.ID + '">' + tmp.name + "</option>";
  840. html += tmpHtml;
  841. }
  842. $("select[name='billCode_lib']").children("option").first().after(html);
  843. }
  844. /**
  845. * 校验数据
  846. *
  847. * @param {String} model
  848. * @return {Object}
  849. */
  850. function getAndValidData(model) {
  851. let name = $("input[name='compilation_name']").val();
  852. let standardBill = $("select[name='standard_bill']")
  853. .children("option:selected")
  854. .val();
  855. let rationLib = $("select[name='ration_lib']")
  856. .children("option:selected")
  857. .val();
  858. let gljLib = $("select[name='glj_lib']").children("option:selected").val();
  859. // let feeLib = $("select[name='fee_lib']").children("option:selected").val();
  860. let artificialLib = $("select[name='artificial_lib']")
  861. .children("option:selected")
  862. .val();
  863. let programLib = $("select[name='program_lib']")
  864. .children("option:selected")
  865. .val();
  866. let billsGuidanceLib = $("select[name='billsGuidance_lib']")
  867. .children("option:selected")
  868. .val();
  869. let featureLib = $("select[name='feature_lib']")
  870. .children("option:selected")
  871. .val();
  872. let infoLib = $("select[name='info_lib']").children("option:selected").val();
  873. let progressiveLib = $("select[name='progressive_lib']")
  874. .children("option:selected")
  875. .val();
  876. let vvTaxLib = $("select[name='vvTax_lib']")
  877. .children("option:selected")
  878. .val();
  879. let billCodeLib = $("select[name='billCode_lib']")
  880. .children("option:selected")
  881. .val();
  882. if (name === "" && model === "all") {
  883. throw "编办名字不能为空";
  884. }
  885. if (model === "bill" && (standardBill === "" || standardBill === undefined)) {
  886. throw "请选择标准清单库";
  887. }
  888. if (model === "ration" && (rationLib === "" || rationLib === undefined)) {
  889. throw "请选择定额库";
  890. }
  891. if (model === "feature" && (featureLib === "" || featureLib === undefined)) {
  892. throw "请选择工程特征库";
  893. }
  894. if (
  895. model === "progressive" &&
  896. (progressiveLib === "" || progressiveLib === undefined)
  897. ) {
  898. throw "请选择累进区间库";
  899. }
  900. if (model === "vvTax" && (vvTaxLib === "" || vvTaxLib === undefined)) {
  901. throw "请选择车船税文件";
  902. }
  903. if (
  904. model === "billCode" &&
  905. (billCodeLib === "" || billCodeLib === undefined)
  906. ) {
  907. throw "请选择递延清单库文件";
  908. }
  909. if (model === "glj" && (gljLib === "" || gljLib === undefined)) {
  910. throw "请选择人材机库";
  911. }
  912. if (
  913. model === "artificial" &&
  914. (artificialLib === "" || artificialLib === undefined)
  915. ) {
  916. throw "请选择人工系数库";
  917. }
  918. if (model === "program" && (programLib === "" || programLib === undefined)) {
  919. throw "请选择计算程序";
  920. }
  921. if (
  922. model === "billsGuidance" &&
  923. (billsGuidanceLib === "" || billsGuidanceLib === undefined)
  924. ) {
  925. throw "请选择清单指引库";
  926. }
  927. let standardBillString = $("select[name='standard_bill']")
  928. .children("option:selected")
  929. .text();
  930. let rationLibString = $("select[name='ration_lib']")
  931. .children("option:selected")
  932. .text();
  933. let gljLibString = $("select[name='glj_lib']")
  934. .children("option:selected")
  935. .text();
  936. // let feeLibString = $("select[name='fee_lib']").children("option:selected").text();
  937. let artificialString = $("select[name='artificial_lib']")
  938. .children("option:selected")
  939. .text();
  940. let programString = $("select[name='program_lib']")
  941. .children("option:selected")
  942. .text();
  943. let billsGuidanceString = $("select[name='billsGuidance_lib']")
  944. .children("option:selected")
  945. .text();
  946. let featrueString = $("select[name='feature_lib']")
  947. .children("option:selected")
  948. .text();
  949. let infoString = $("select[name='info_lib']")
  950. .children("option:selected")
  951. .text();
  952. let progressiveString = $("select[name='progressive_lib']")
  953. .children("option:selected")
  954. .text();
  955. let vvTaxString = $("select[name='vvTax_lib']")
  956. .children("option:selected")
  957. .text();
  958. let billCodeLibString = $("select[name='billCode_lib']")
  959. .children("option:selected")
  960. .text();
  961. let result = {
  962. name: name,
  963. bill: {
  964. id: standardBill,
  965. name: standardBillString,
  966. },
  967. ration: {
  968. id: rationLib,
  969. name: rationLibString,
  970. },
  971. glj: {
  972. id: gljLib,
  973. name: gljLibString,
  974. },
  975. /* fee: {
  976. id: feeLib,
  977. name: feeLibString
  978. },*/
  979. artificial: {
  980. id: artificialLib,
  981. name: artificialString,
  982. },
  983. program: {
  984. id: programLib,
  985. name: programString,
  986. },
  987. billsGuidance: {
  988. id: billsGuidanceLib,
  989. name: billsGuidanceString,
  990. },
  991. feature: {
  992. id: featureLib,
  993. name: featrueString,
  994. },
  995. info: {
  996. id: infoLib,
  997. name: infoString,
  998. },
  999. progressive: {
  1000. id: progressiveLib,
  1001. name: progressiveString,
  1002. },
  1003. vvTax: {
  1004. id: vvTaxLib,
  1005. name: vvTaxString,
  1006. },
  1007. billCode: {
  1008. id: billCodeLib,
  1009. name: billCodeLibString,
  1010. },
  1011. };
  1012. return result;
  1013. }
  1014. /**
  1015. * 验证标准库数据
  1016. *
  1017. * @return {boolean}
  1018. */
  1019. function validLib() {
  1020. let result = false;
  1021. try {
  1022. let valuationName = $("input[name='name']").val();
  1023. if (valuationName === "") {
  1024. throw "请填写计价规则名称";
  1025. }
  1026. let engineering = $("select[name='engineering']").val();
  1027. if (engineering === "" || engineering <= 0) {
  1028. throw "请选择工程专业";
  1029. }
  1030. //按新需求,清单库、定额库等不做非空验证
  1031. /* if ($("input:hidden[name='bill_lib']").length <= 0) {
  1032. throw '请添加标准清单';
  1033. }
  1034. if ($("input:hidden[name='ration_lib']").length <= 0) {
  1035. throw '请添加定额库';
  1036. }
  1037. if ($("input:hidden[name='glj_lib']").length <= 0) {
  1038. throw '请添加人材机库';
  1039. }
  1040. if ($("input:hidden[name='fee_lib']").length <= 0) {
  1041. throw '请添加费率标准';
  1042. }
  1043. if ($("input:hidden[name='artificial_lib']").length <= 0) {
  1044. throw '请添加人工系数';
  1045. }
  1046. if ($("input:hidden[name='program_lib']").length <= 0) {
  1047. throw '请添加计算程序';
  1048. }
  1049. if ($("input:hidden[name='billsGuidance_lib']").length <= 0) {
  1050. throw '请添加清单指引库';
  1051. }*/
  1052. result = true;
  1053. } catch (error) {
  1054. alert(error);
  1055. result = false;
  1056. }
  1057. return result;
  1058. }
  1059. /**
  1060. * 切换switch效果
  1061. *
  1062. * @param {Object} element
  1063. * @return {boolean}
  1064. */
  1065. function switchChange(element) {
  1066. // 第一个元素判断当前的状态
  1067. let firstButton = element.children("button").first();
  1068. let secondButton = element.children("button").eq(1);
  1069. let currentStatus = firstButton.is(":disabled");
  1070. if (currentStatus) {
  1071. // 当前为true切换到false
  1072. firstButton
  1073. .removeClass("btn-success")
  1074. .removeClass("disabled")
  1075. .addClass("btn-default")
  1076. .removeAttr("disabled");
  1077. firstButton.text("开启");
  1078. secondButton
  1079. .removeClass("btn-default")
  1080. .addClass("btn-danger")
  1081. .addClass("disabled")
  1082. .attr("disabled", "disabled");
  1083. secondButton.text("已禁用");
  1084. } else {
  1085. // 当前false切换到true
  1086. firstButton
  1087. .removeClass("btn-default")
  1088. .addClass("btn-success")
  1089. .addClass("disabled")
  1090. .attr("disabled", "disabled");
  1091. firstButton.text("已开启");
  1092. secondButton
  1093. .removeClass("btn-danger")
  1094. .removeClass("disabled")
  1095. .addClass("btn-default")
  1096. .removeAttr("disabled");
  1097. secondButton.text("禁用");
  1098. }
  1099. return !currentStatus;
  1100. }
  1101. /* function editEngineer(selector) {
  1102. let engineerName = $(selector).prev("span").text();
  1103. let parentDiv = $(selector).parent("div");
  1104. parentDiv.next("div").find("input").val(engineerName);
  1105. parentDiv.hide();
  1106. parentDiv.next("div").show();
  1107. } */
  1108. function editEngineer(selector, key) {
  1109. let editText = $(selector).prev("span").text();
  1110. let parentDiv = $(selector).parent("div");
  1111. let width = key == "seq" ? 70 : 200;
  1112. parentDiv.next("div").css("width", width);
  1113. parentDiv.next("div").find("input").val(editText);
  1114. parentDiv.hide();
  1115. parentDiv.next("div").show();
  1116. }
  1117. /* function confirmUpdate(selector, engineerID) {
  1118. let inputDiv = $(selector).parents(".input_group_div");
  1119. let input = $(selector).parent(".input-group-btn").prev("input");
  1120. let oldValue = inputDiv.prev("div").find("span").text();
  1121. let newValue = input.val();
  1122. let key = input.attr("name");
  1123. if (newValue == "" || newValue == oldValue || !engineerID) {
  1124. inputDiv.prev("div").show();
  1125. inputDiv.hide();
  1126. return;
  1127. }
  1128. let updateData = {};
  1129. updateData[key] = newValue;
  1130. updateEngineer(engineerID, updateData, function () {
  1131. inputDiv.prev("div").find("span").text(newValue);
  1132. });
  1133. inputDiv.prev("div").show();
  1134. inputDiv.hide();
  1135. } */
  1136. function confirmUpdate(selector, engineerID) {
  1137. let inputDiv = $(selector).parents(".input_group_div");
  1138. let input = $(selector).parent(".input-group-btn").prev("input");
  1139. let oldValue = inputDiv.prev("div").find("span").text();
  1140. let newValue = input.val();
  1141. let key = input.attr("name");
  1142. if (newValue == oldValue || !engineerID) {
  1143. //不做非空判断
  1144. inputDiv.prev("div").show();
  1145. inputDiv.hide();
  1146. return;
  1147. }
  1148. let updateData = {};
  1149. updateData[key] = newValue;
  1150. updateEngineer(engineerID, updateData, function () {
  1151. if (key == "seq") {
  1152. window.location.reload();
  1153. } else {
  1154. inputDiv.prev("div").find("span").text(newValue);
  1155. }
  1156. });
  1157. inputDiv.prev("div").show();
  1158. inputDiv.hide();
  1159. }
  1160. function deleteEngineerClick(engineerID, element) {
  1161. hintBox.infoBox(
  1162. "操作确认",
  1163. "是否删除所选工程专业?",
  1164. 2,
  1165. async function () {
  1166. try {
  1167. let result = await ajaxPost("/compilation/delete-engineer", {
  1168. id: engineerID,
  1169. });
  1170. $(element).parent("td").parent("tr").remove();
  1171. } catch (err) {
  1172. console.log(err);
  1173. }
  1174. },
  1175. null,
  1176. ["确定", "取消"],
  1177. false
  1178. );
  1179. }
  1180. function copyEngineerClick(engineerID) {
  1181. hintBox.infoBox(
  1182. "操作确认",
  1183. "是否拷贝所选工程专业?",
  1184. 2,
  1185. async function () {
  1186. try {
  1187. await ajaxPost("/compilation/copy-engineer", { id: engineerID });
  1188. window.location.reload();
  1189. } catch (err) {
  1190. console.log(err);
  1191. }
  1192. },
  1193. null,
  1194. ["确定", "取消"],
  1195. false
  1196. );
  1197. }
  1198. function engineerVisibleChange(checkBox, engineerID) {
  1199. if (engineerID) {
  1200. updateEngineer(engineerID, { visible: checkBox.checked });
  1201. }
  1202. }
  1203. function updateEngineer(engineerID, data, callback) {
  1204. CommonAjax.post(
  1205. "/compilation/update-engineer",
  1206. { id: engineerID, updateData: data },
  1207. function (data) {
  1208. if (callback) {
  1209. callback();
  1210. }
  1211. }
  1212. );
  1213. }
  1214. function editTaxGroup(ele) {
  1215. $("#groupEditType").val("modify");
  1216. let groupData = $(ele).nextAll("input[name = 'tax_group']").val();
  1217. groupData = JSON.parse(groupData);
  1218. if (!_.isEmpty(groupData)) {
  1219. $("#taxType").val(groupData.taxType ? groupData.taxType : "");
  1220. $("#program_lib").val(
  1221. groupData.program_lib ? groupData.program_lib.id : ""
  1222. );
  1223. $("#template_lib").val(
  1224. groupData.template_lib ? groupData.template_lib.id : ""
  1225. );
  1226. $("#col_lib").val(groupData.col_lib ? groupData.col_lib.id : "");
  1227. $("#fee_lib").val(groupData.fee_lib ? groupData.fee_lib.id : "");
  1228. } else {
  1229. $("#taxType").val("");
  1230. $("#program_lib").val("");
  1231. $("#template_lib").val("");
  1232. $("#col_lib").val("");
  1233. $("#fee_lib").val("");
  1234. }
  1235. $("#groupIndex").val(getGroupIndex(groupData));
  1236. $("#addTaxGroup").modal({ show: true });
  1237. }
  1238. function deleteTableTr(ele, classString) {
  1239. let parentTr = $(ele).parents(`.${classString}`);
  1240. parentTr.remove();
  1241. }
  1242. function getGroupIndex(groupData) {
  1243. //用来做唯一标识
  1244. let index = "";
  1245. if (groupData) {
  1246. if (groupData.taxType) index = index + groupData.taxType;
  1247. if (groupData.program_lib) index = index + groupData.program_lib.id;
  1248. if (groupData.template_lib) index = index + groupData.template_lib.id;
  1249. if (groupData.col_lib) index = index + groupData.col_lib.id;
  1250. if (groupData.fee_lib) index = index + groupData.fee_lib.id;
  1251. }
  1252. return index;
  1253. }
  1254. function getTaxGroupData() {
  1255. let programData =
  1256. programList === undefined ? [] : _.indexBy(JSON.parse(programList), "id");
  1257. let billTemplateData =
  1258. billTemplateList == undefined
  1259. ? []
  1260. : _.indexBy(JSON.parse(billTemplateList), "ID");
  1261. let mainTreeColData =
  1262. mainTreeColList == undefined
  1263. ? []
  1264. : _.indexBy(JSON.parse(mainTreeColList), "ID");
  1265. let feeLibData =
  1266. feeRateList === undefined ? [] : _.indexBy(JSON.parse(feeRateList), "id");
  1267. let groupData = {};
  1268. if ($("#taxType").val() !== "") {
  1269. groupData.taxType = $("#taxType").val();
  1270. }
  1271. if ($("#program_lib").val() !== "") {
  1272. let program = programData[$("#program_lib").val()];
  1273. if (program) {
  1274. groupData.program_lib = {
  1275. id: program.id,
  1276. name: program.name,
  1277. displayName: program.displayName,
  1278. };
  1279. }
  1280. }
  1281. if ($("#template_lib").val() !== "") {
  1282. let template = billTemplateData[$("#template_lib").val()];
  1283. if (template) {
  1284. groupData.template_lib = {
  1285. id: template.ID,
  1286. name: template.name,
  1287. };
  1288. }
  1289. }
  1290. if ($("#col_lib").val() !== "") {
  1291. let col = mainTreeColData[$("#col_lib").val()];
  1292. if (col) {
  1293. groupData.col_lib = {
  1294. id: col.ID,
  1295. name: col.name,
  1296. };
  1297. }
  1298. }
  1299. if ($("#fee_lib").val() !== "") {
  1300. let feeRate = feeLibData[$("#fee_lib").val()];
  1301. if (feeRate) {
  1302. groupData.fee_lib = {
  1303. id: feeRate.id,
  1304. name: feeRate.name,
  1305. };
  1306. }
  1307. }
  1308. return groupData;
  1309. }
  1310. function intChecking(e, elemt) {
  1311. //限制输入正整数
  1312. let code = e.which || e.keyCode;
  1313. if (code == 46 || code == 45) {
  1314. //不能输入小数点和-号
  1315. e.preventDefault();
  1316. }
  1317. if (elemt.value == "" && code == 48) {
  1318. //当输入框为空时不能输入0
  1319. e.preventDefault();
  1320. }
  1321. }