payment_list.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. $(function () {
  2. autoFlashHeight();
  3. let timer = null;
  4. let oldSearchVal = null;
  5. $('body').on('input propertychange', '.gr-search', function(e) {
  6. oldSearchVal = e.target.value;
  7. timer && clearTimeout(timer);
  8. timer = setTimeout(() => {
  9. const newVal = $(this).val();
  10. const code = $(this).attr('data-code');
  11. let html = '';
  12. if (newVal && newVal === oldSearchVal) {
  13. accountList.filter(item => item && (item.name.indexOf(newVal) !== -1 || (item.mobile && item.mobile.indexOf(newVal) !== -1))).forEach(item => {
  14. html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
  15. <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
  16. class="ml-auto">${item.mobile || ''}</span></p>
  17. <span class="text-muted">${item.role || ''}</span>
  18. </dd>`
  19. });
  20. $('#' + code + '_dropdownMenu .book-list').empty();
  21. $('#' + code + '_dropdownMenu .book-list').append(html);
  22. } else {
  23. if (!$('#' + code + '_dropdownMenu .acc-btn').length) {
  24. accountGroup.forEach((group, idx) => {
  25. if (!group) return;
  26. html += `<dt><a href="javascript: void(0);" class="acc-btn" data-groupid="${idx}" data-type="hide"><i class="fa fa-plus-square"></i>
  27. </a> ${group.groupName}</dt>
  28. <div class="dd-content" data-toggleid="${idx}">`;
  29. group.groupList.forEach(item => {
  30. html += `<dd class="border-bottom p-2 mb-0 " data-id="${item.id}" >
  31. <p class="mb-0 d-flex"><span class="text-primary">${item.name}</span><span
  32. class="ml-auto">${item.mobile || ''}</span></p>
  33. <span class="text-muted">${item.role || ''}</span>
  34. </dd>`;
  35. });
  36. html += '</div>';
  37. });
  38. $('#' + code + '_dropdownMenu .book-list').empty();
  39. $('#' + code + '_dropdownMenu .book-list').append(html);
  40. }
  41. }
  42. }, 400);
  43. });
  44. // 添加审批流程按钮逻辑
  45. $('body').on('click', '.book-list dt', function () {
  46. const idx = $(this).find('.acc-btn').attr('data-groupid');
  47. const type = $(this).find('.acc-btn').attr('data-type');
  48. if (type === 'hide') {
  49. $(this).parent().find(`div[data-toggleid="${idx}"]`).show(() => {
  50. $(this).children().find('i').removeClass('fa-plus-square').addClass('fa-minus-square-o');
  51. $(this).find('.acc-btn').attr('data-type', 'show');
  52. })
  53. } else {
  54. $(this).parent().find(`div[data-toggleid="${idx}"]`).hide(() => {
  55. $(this).children().find('i').removeClass('fa-minus-square-o').addClass('fa-plus-square');
  56. $(this).find('.acc-btn').attr('data-type', 'hide');
  57. })
  58. }
  59. return false;
  60. });
  61. // 选中审批人
  62. $('body').on('click', 'dl dd', function () {
  63. const id = parseInt($(this).attr('data-id'));
  64. if (!id) return;
  65. const this_code = $(this).parents('.dropdown').data('code');
  66. if (_.findIndex(rpt_audit, { uid: id }) !== -1) {
  67. toastr.error('该表单角色已存在,请勿重复添加');
  68. return;
  69. }
  70. const user = _.find(accountList, function (item) {
  71. return item.id === id;
  72. });
  73. $('#' + this_code + '_user').html(`<span>${user.name}</span><i role="button" class="fa fa-close text-danger remove-audit stamp-img" data-code="${this_code}"></i>`);
  74. $(this).parents('.select-audit').hide();
  75. $('#' + this_code + '_user').show();
  76. rpt_audit[this_code].uid = id;
  77. rpt_audit[this_code].name = user.name;
  78. console.log(rpt_audit);
  79. });
  80. // 移除审批人
  81. $('body').on('click', '.remove-audit', function () {
  82. const this_code = parseInt($(this).attr('data-code'));
  83. $('#' + this_code + '_user').html(``);
  84. $('#' + this_code + '_user').hide();
  85. $('#' + this_code + '_user').siblings('.select-audit').show();
  86. rpt_audit[this_code].uid = null;
  87. delete rpt_audit[this_code].name;
  88. console.log(rpt_audit);
  89. });
  90. // 重新加载角色数据
  91. $('#set-bdjs').on('show.bs.modal', function () {
  92. if (old_rpt_audit) {
  93. for (const [i, r] of old_rpt_audit.entries()) {
  94. if (r.uid) {
  95. $('#' + i + '_user').html(`<span>${r.name}</span><i role="button" class="fa fa-close text-danger remove-audit stamp-img" data-code="${i}"></i>`);
  96. $('#' + i + '_user').show();
  97. $('#' + i + '_user').siblings('.select-audit').hide();
  98. } else {
  99. $('#' + i + '_user').html(``);
  100. $('#' + i + '_user').hide();
  101. $('#' + i + '_user').siblings('.select-audit').show();
  102. }
  103. }
  104. }
  105. rpt_audit = _.cloneDeep(old_rpt_audit);
  106. });
  107. // 绑定表单角色
  108. $('#bind_rpt_audit_btn').click(function () {
  109. if (!is_first) {
  110. if (_.findIndex(rpt_audit, { uid: null }) !== -1) {
  111. toastr.error('请绑定所有表单角色再提交');
  112. return;
  113. }
  114. }
  115. postData('/sp/' + spid + '/payment/' + tenderId + '/list/' + trId + '/save', { type: 'rpt_audit', rpt_audit }, function (result) {
  116. toastr.success('设置成功');
  117. old_rpt_audit = _.cloneDeep(rpt_audit);
  118. if (result.is_first) {
  119. $('#first_msg').show();
  120. } else {
  121. $('#first_msg').hide();
  122. }
  123. $('#set-bdjs').modal('hide');
  124. });
  125. });
  126. $('#show-add-btn').click(function () {
  127. if (_.findIndex(old_rpt_audit, { uid: null }) !== -1) {
  128. toastr.error('未配置好表单角色无法新建表单');
  129. $('#set-bdjs').modal('show');
  130. } else {
  131. if (emptySign) {
  132. $('#add-tips').modal('show');
  133. } else {
  134. $('#add-catalogue').modal('show');
  135. }
  136. }
  137. });
  138. $('#add-detail-btn').click(function () {
  139. if (_.trim($('#add-detail-code').val()) === '') {
  140. toastr.error('请输入编号');
  141. return false;
  142. }
  143. if ($('#add-detail-time').val() === '') {
  144. toastr.error('请输入日期');
  145. return false;
  146. }
  147. console.log($('#add-detail-time').val());
  148. postData('/sp/' + spid + '/payment/' + tenderId + '/list/' + trId + '/save', { type: 'add-detail', code: _.trim($('#add-detail-code').val()), s_time: $('#add-detail-time').val() }, function (result) {
  149. if (result.type) {
  150. window.location.href = '/sp/' + spid + '/payment/' + tenderId + '/safe/' + result.id + '/bills';
  151. } else {
  152. window.location.href = '/sp/' + spid + '/payment/' + tenderId + '/detail/' + result.id;
  153. }
  154. });
  155. });
  156. // 获取审批流程
  157. $('a[data-target="#sp-list" ]').on('click', function () {
  158. const data = {
  159. order: $(this).attr('m-order'),
  160. };
  161. postData('/sp/' + spid + '/payment/' + tenderId + '/list/'+ trId + '/auditors', data, function (result) {
  162. const { auditHistory, auditors, user } = result
  163. let auditorsHTML = ''
  164. let historyHTML = ''
  165. auditors.forEach((auditor, idx) => {
  166. if (idx === 0) {
  167. auditorsHTML += `<li class="list-group-item">
  168. <i class="fa fa fa-play-circle fa-rotate-90"></i> ${auditor.name}
  169. <small class="text-muted">${auditor.role}</small>
  170. <span class="pull-right">原报</span>
  171. </li>`
  172. } else if(idx === auditors.length -1 && idx !== 0) {
  173. auditorsHTML += `<li class="list-group-item">
  174. <i class="fa fa fa-stop-circle"></i> ${auditor.name}
  175. <small class="text-muted">${auditor.role}</small>
  176. <span class="pull-right">终审</span>
  177. </li>`
  178. } else {
  179. auditorsHTML += `<li class="list-group-item">
  180. <i class="fa fa-chevron-circle-down"></i> ${auditor.name}
  181. <small class="text-muted">${auditor.role}</small>
  182. <span class="pull-right">${transFormToChinese(idx)}审</span>
  183. </li>`
  184. }
  185. })
  186. $('#auditor-list').empty()
  187. $('#auditor-list').append(auditorsHTML)
  188. const leftAuditors = auditors;
  189. auditHistory.forEach((auditors, idx) => {
  190. if(idx === auditHistory.length - 1 && auditHistory.length !== 1) {
  191. historyHTML += `<div class="text-right"><a href="javascript: void(0);" id="fold-btn" data-target="show"
  192. >展开历史审批流程</a></div>`
  193. }
  194. historyHTML += `<div class="${idx < auditHistory.length - 1 ? 'fold-card' : ''}">
  195. <div class="text-center text-muted">${idx + 1}#</div>
  196. <ul class="timeline-list list-unstyled mt-2">`
  197. auditors.forEach((auditor, index) => {
  198. if (index === 0) {
  199. historyHTML += `<li class="timeline-list-item pb-2">
  200. <div class="timeline-item-date">
  201. ${formatDate(auditor.begin_time)}
  202. </div>
  203. <div class="timeline-item-tail"></div>
  204. <div class="timeline-item-icon bg-success text-light">
  205. <i class="fa fa-caret-down"></i>
  206. </div>
  207. <div class="timeline-item-content">
  208. <div class="card">
  209. <div class="card-body p-3">
  210. <div class="card-text">
  211. <p class="mb-1"><span
  212. class="h5">${user.name}</span><span
  213. class="pull-right text-success">${idx !== 0 ? '重新' : ''}上报审批</span>
  214. </p>
  215. <p class="text-muted mb-0">${user.role}</p>
  216. </div>
  217. </div>
  218. </div>
  219. </div>
  220. </li>
  221. <li class="timeline-list-item pb-2">
  222. <div class="timeline-item-date">
  223. ${formatDate(auditor.end_time)}
  224. </div>`
  225. if(index < auditors.length - 1) {
  226. historyHTML += `<div class="timeline-item-tail"></div>`
  227. }
  228. if(auditor.status === auditConst.status.checked) {
  229. historyHTML += `<div class="timeline-item-icon bg-success text-light">
  230. <i class="fa fa-check"></i>
  231. </div>`
  232. } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {
  233. historyHTML += `<div class="timeline-item-icon bg-warning text-light">
  234. <i class="fa fa-level-up"></i>
  235. </div>`
  236. } else if(auditor.status === auditConst.status.checking) {
  237. historyHTML += `<div class="timeline-item-icon bg-warning text-light">
  238. <i class="fa fa-ellipsis-h"></i>
  239. </div>`
  240. } else {
  241. historyHTML += `<div class="timeline-item-icon bg-secondary text-light"></div>`
  242. }
  243. historyHTML += `<div class="timeline-item-content">
  244. <div class="card">
  245. <div class="card-body p-3">
  246. <div class="card-text">
  247. <p class="mb-1"><span class="h5">${auditor.name}</span><span
  248. class="pull-right ${auditConst.statusClass[auditor.status]}">${auditConst.statusString[auditor.status]}</span>
  249. </p>
  250. <p class="text-muted mb-0">${auditor.role}</p>
  251. </div>
  252. </div>`
  253. if (auditor.opinion) {
  254. historyHTML += `<div class="card-body p-3 border-top">
  255. <p style="margin: 0;">${auditor.opinion}</p>
  256. </div>`
  257. }
  258. historyHTML += `</div></div></li>`
  259. } else {
  260. historyHTML += `<li class="timeline-list-item pb-2">
  261. <div class="timeline-item-date">
  262. ${formatDate(auditor.end_time)}
  263. </div>`
  264. if(index < auditors.length - 1) {
  265. historyHTML += `<div class="timeline-item-tail"></div>`
  266. }
  267. if(auditor.status === auditConst.status.checked) {
  268. historyHTML += `<div class="timeline-item-icon bg-success text-light">
  269. <i class="fa fa-check"></i>
  270. </div>`
  271. } else if(auditor.status === auditConst.status.checkNo || auditor.status === auditConst.status.checkNoPre) {
  272. historyHTML += `<div class="timeline-item-icon bg-warning text-light">
  273. <i class="fa fa-level-up"></i>
  274. </div>`
  275. } else if(auditor.status === auditConst.status.checking) {
  276. historyHTML += `<div class="timeline-item-icon bg-warning text-light">
  277. <i class="fa fa-ellipsis-h"></i>
  278. </div>`
  279. } else {
  280. historyHTML += `<div class="timeline-item-icon bg-secondary text-light"></div>`
  281. }
  282. historyHTML += `<div class="timeline-item-content">
  283. <div class="card">
  284. <div class="card-body p-3">
  285. <div class="card-text">
  286. <p class="mb-1"><span class="h5">${auditor.name}</span>
  287. <span
  288. class="pull-right
  289. ${auditConst.statusClass[auditor.status]}">${auditor.status !== auditConst.status.uncheck ? auditConst.statusString[auditor.status] : ''}
  290. ${auditor.status === auditConst.status.checkNo ? user.name : ''}
  291. ${auditor.status === auditConst.status.checkNoPre ? auditors.find(item => item.sort === auditor.sort-1).name : ''}
  292. </span>
  293. </p>
  294. <p class="text-muted mb-0">${auditor.role}</p>
  295. </div>
  296. </div>`
  297. if (auditor.opinion) {
  298. historyHTML += `<div class="card-body p-3 border-top">
  299. <p style="margin: 0;">${auditor.opinion} </p>
  300. </div>`
  301. }
  302. historyHTML += `</div></div></li>`
  303. }
  304. })
  305. historyHTML += '</ul></div>'
  306. })
  307. $('#audit-list').empty()
  308. $('#audit-list').append(historyHTML)
  309. });
  310. });
  311. // 展开/收起历史审核记录
  312. $('#audit-list').on('click', 'a', function() {
  313. const type = $(this).data('target')
  314. const auditCard = $(this).parent().parent()
  315. console.log('auditCard', auditCard)
  316. if (type === 'show') {
  317. $(this).data('target', 'hide')
  318. auditCard.find('.fold-card').slideDown('swing', () => {
  319. auditCard.find('#end-target').text($(this).data('idx') + '#')
  320. auditCard.find('#fold-btn').text('收起历史审核记录')
  321. })
  322. } else {
  323. $(this).data('target', 'show')
  324. auditCard.find('.fold-card').slideUp('swing', () => {
  325. auditCard.find('#end-target').text('1#')
  326. auditCard.find('#fold-btn').text('展开历史审核记录')
  327. })
  328. }
  329. });
  330. function formatDate(date) {
  331. if (!date) return '';
  332. date = new Date(date)
  333. const year = date.getFullYear();
  334. let mon = date.getMonth() + 1;
  335. let day = date.getDate();
  336. let hour = date.getHours();
  337. let minute = date.getMinutes();
  338. let scond = date.getSeconds();
  339. if (mon < 10) {
  340. mon = '0' + mon.toString();
  341. }
  342. if (day < 10) {
  343. day = '0' + day.toString();
  344. }
  345. if (hour < 10) {
  346. hour = '0' + hour.toString();
  347. }
  348. if (minute < 10) {
  349. minute = '0' + minute.toString();
  350. }
  351. if (scond < 10) {
  352. scond = '0' + scond.toString();
  353. }
  354. return `${year}<span>${mon}-${day}</span><span>${hour}:${minute}:${scond}</span>`;
  355. };
  356. class srObject {
  357. constructor() {
  358. const self = this;
  359. this.selectTree = null;
  360. const srSpreadSetting = {
  361. cols: [
  362. {title: '选择', field: 'selected', hAlign: 1, width: 40, formatter: '@', cellType: 'checkbox'},
  363. {title: '名称', field: 'name', hAlign: 0, width: 300, formatter: '@', cellType: 'tree'},
  364. ],
  365. emptyRows: 0,
  366. headRows: 1,
  367. headRowHeight: [32],
  368. defaultRowHeight: 21,
  369. headerFont: '12px 微软雅黑',
  370. font: '12px 微软雅黑',
  371. headColWidth: [30],
  372. selectedBackColor: '#fffacd',
  373. readOnly: true,
  374. };
  375. this.spread = SpreadJsObj.createNewSpread($('#sr-spread')[0]);
  376. this.sheet = this.spread.getActiveSheet();
  377. SpreadJsObj.initSheet(this.sheet, srSpreadSetting);
  378. this.spread.bind(spreadNS.Events.ButtonClicked, function (e, info) {
  379. if (!info.sheet.zh_setting) return;
  380. const col = info.sheet.zh_setting.cols[info.col];
  381. if (col.field !== 'selected') return;
  382. const node = SpreadJsObj.getSelectObject(info.sheet);
  383. self.selectNode(node, !node[col.field]);
  384. SpreadJsObj.reloadColData(info.sheet, 0);
  385. });
  386. $('#sync-attr-ok').click(() => {
  387. const select = self.getSelects();
  388. if (select.length === 0) return;
  389. if (!select[0].measure_type) {
  390. toastr.warning(`标段[${select[0].name}]未填写任何内容,请选择其他标段`);
  391. return;
  392. }
  393. postData(`/tender/${select[0].tid}/load`, { filter: 'tender_info' }, function (result) {
  394. property.deal_info = result.tender_info.deal_info;
  395. property.construction_unit = result.tender_info.construction_unit;
  396. property.tech_param = result.tender_info.tech_param;
  397. property.pay_account = result.tender_info.pay_account;
  398. loadCommonProperty(property);
  399. $('#sync-attr').modal('hide');
  400. });
  401. });
  402. }
  403. selectNode(node, select) {
  404. if (node.children && node.children.length > 0) return;
  405. if (select) {
  406. this.selectTree.nodes.forEach(x => { x.selected = false });
  407. }
  408. node.selected = select;
  409. }
  410. getSelects() {
  411. const select = [];
  412. for (const n of this.selectTree.nodes) {
  413. if ((!n.children || n.children.length === 0) && n.selected) select.push(n);
  414. }
  415. return select;
  416. }
  417. init() {
  418. const self = this;
  419. postData(`/sp/${spid}/list/load2`, { type: 'all'}, result => {
  420. self.selectTree = Tender2Tree.convert(category, result.tenders);
  421. SpreadJsObj.loadSheetData(this.sheet, SpreadJsObj.DataType.Tree, this.selectTree);
  422. });
  423. }
  424. }
  425. let srSelect;
  426. $('#sync-attr').on('shown.bs.modal', () => {
  427. if (!srSelect) srSelect = new srObject();
  428. srSelect.init();
  429. });
  430. $('#bd-attr').on('show.bs.modal', function () {
  431. loadCommonProperty();
  432. });
  433. });
  434. // 标段属性相关
  435. function loadCommonProperty () {
  436. // 合同信息
  437. $('#build-name').val(property.deal_info.buildName);
  438. $('#deal-code').val(property.deal_info.dealCode);
  439. $('#deal-name').val(property.deal_info.dealName);
  440. $('#project-type').val(property.deal_info.projectType);
  441. $('#deal-type').val(property.deal_info.dealType);
  442. $('#final-code').val(property.deal_info.finalCode);
  443. // 参建单位
  444. // 建设单位
  445. $('#build-company').val(property.construction_unit.build.company);
  446. $('#build-corporation').val(property.construction_unit.build.corporation);
  447. $('#build-date').val(property.construction_unit.build.date);
  448. // 承包单位1
  449. $('#contract1-company').val(property.construction_unit.contract1.company);
  450. $('#contract1-corporation').val(property.construction_unit.contract1.corporation);
  451. $('#contract1-date').val(property.construction_unit.contract1.date);
  452. $('#contract1-management').val(property.construction_unit.contract1.management);
  453. // 承包单位2
  454. $('#contract2-company').val(property.construction_unit.contract2.company);
  455. $('#contract2-corporation').val(property.construction_unit.contract2.corporation);
  456. $('#contract2-date').val(property.construction_unit.contract2.date);
  457. // 监理单位1
  458. $('#supervision1-company').val(property.construction_unit.supervision1.company);
  459. $('#supervision1-corporation').val(property.construction_unit.supervision1.corporation);
  460. $('#supervision1-date').val(property.construction_unit.supervision1.date);
  461. // 监理单位2
  462. $('#supervision2-company').val(property.construction_unit.supervision2.company);
  463. $('#supervision2-corporation').val(property.construction_unit.supervision2.corporation);
  464. $('#supervision2-date').val(property.construction_unit.supervision2.date);
  465. // 检测单位
  466. $('#detect-company').val(property.construction_unit.detect.company);
  467. $('#detect-corporation').val(property.construction_unit.detect.corporation);
  468. $('#detect-date').val(property.construction_unit.detect.date);
  469. // 技术参数
  470. $('#load-level').find("option:contains('" + property.tech_param.loadLevel + "')").attr("selected",true);
  471. $('#length').val(property.tech_param.loadLength);
  472. $('#start-peg').val(property.tech_param.startPeg);
  473. $('#end-peg').val(property.tech_param.endPeg);
  474. $('#lane-count').val(property.tech_param.laneCount);
  475. $('#deal-period').val(property.tech_param.dealPeriod);
  476. $('#start-date').val(property.tech_param.startDate);
  477. $('#plan-end-date').val(property.tech_param.planEndDate);
  478. $('#real-start-date').val(property.tech_param.realStartDate);
  479. $('#real-end-date').val(property.tech_param.realEndDate);
  480. $('#structure-scale').val(property.tech_param.structureScale);
  481. // 付款账号
  482. $('#project-name').val(property.pay_account.project.name);
  483. $('#project-bank').val(property.pay_account.project.bank);
  484. $('#project-account').val(property.pay_account.project.account);
  485. $('#project-rate').val(property.pay_account.project.rate);
  486. $('#project-contact').val(property.pay_account.project.contact);
  487. $('#project-phone').val(property.pay_account.project.phone);
  488. $('#project-num').val(property.pay_account.project.num);
  489. $('#worker-name').val(property.pay_account.worker.name);
  490. $('#worker-bank').val(property.pay_account.worker.bank);
  491. $('#worker-account').val(property.pay_account.worker.account);
  492. $('#worker-rate').val(property.pay_account.worker.rate);
  493. $('#worker-contact').val(property.pay_account.worker.contact);
  494. $('#worker-phone').val(property.pay_account.worker.phone);
  495. $('#worker-num').val(property.pay_account.worker.num);
  496. }
  497. function postAttr () {
  498. let flag = false;
  499. const rate_reg = /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2}))|)$/;
  500. const phone_reg = /^((0\d{2,3}-\d{7,8})|(1[3456789]\d{9}))$/;
  501. const project_rate = $('#project-rate').val();
  502. if (!rate_reg.test(project_rate) && project_rate !== '') {
  503. toastr.error('工程款账户分账划拨比例数字格式有误且最多保留2位小数');
  504. flag = true;
  505. }
  506. const project_phone = $('#project-phone').val();
  507. if (!phone_reg.test(project_phone) && project_phone !== '') {
  508. toastr.error('工程款账户联系电话格式有误');
  509. flag = true;
  510. }
  511. const worker_rate = $('#worker-rate').val();
  512. if (!rate_reg.test(worker_rate) && worker_rate !== '') {
  513. toastr.error('农民工工资专用账户分账划拨比例数字格式有误且最多保留2位小数');
  514. flag = true;
  515. }
  516. const worker_phone = $('#worker-phone').val();
  517. if (!phone_reg.test(worker_phone) && worker_phone !== '') {
  518. toastr.error('农民工工资专用账户联系电话格式有误');
  519. flag = true;
  520. }
  521. if (flag) {
  522. return false;
  523. }
  524. const info = {
  525. deal_info: {
  526. buildName: $('#build-name').val(),
  527. dealCode: $('#deal-code').val(),
  528. dealName: $('#deal-name').val(),
  529. projectType: $('#project-type').val(),
  530. dealType: $('#deal-type').val(),
  531. finalCode: $('#final-code').val(),
  532. },
  533. construction_unit: {
  534. build: {
  535. company: $('#build-company').val(),
  536. corporation: $('#build-corporation').val(),
  537. date: $('#build-date').val(),
  538. },
  539. contract1: {
  540. company: $('#contract1-company').val(),
  541. corporation: $('#contract1-corporation').val(),
  542. date: $('#contract1-date').val(),
  543. management: $('#contract1-management').val(),
  544. },
  545. contract2: {
  546. company: $('#contract2-company').val(),
  547. corporation: $('#contract2-corporation').val(),
  548. date: $('#contract2-date').val(),
  549. },
  550. supervision1: {
  551. company: $('#supervision1-company').val(),
  552. corporation: $('#supervision1-corporation').val(),
  553. date: $('#supervision1-date').val(),
  554. },
  555. supervision2: {
  556. company: $('#supervision2-company').val(),
  557. corporation: $('#supervision2-corporation').val(),
  558. date: $('#supervision2-date').val(),
  559. },
  560. detect: {
  561. company: $('#detect-company').val(),
  562. corporation: $('#detect-corporation').val(),
  563. date: $('#detect-date').val(),
  564. },
  565. },
  566. tech_param: {
  567. loadLevel: $('#load-level').find("option:selected").text(),
  568. loadLength: _.toNumber($('#length').val()),
  569. startPeg: $('#start-peg').val(),
  570. endPeg: $('#end-peg').val(),
  571. laneCount: _.toNumber($('#lane-count').val()),
  572. dealPeriod: $('#deal-period').val(),
  573. startDate: $('#start-date').val(),
  574. planEndDate: $('#plan-end-date').val(),
  575. realStartDate: $('#real-start-date').val(),
  576. realEndDate: $('#real-end-date').val(),
  577. structureScale: $('#structure-scale').val(),
  578. },
  579. pay_account: {
  580. project: {
  581. name: $('#project-name').val(),
  582. bank: $('#project-bank').val(),
  583. account: $('#project-account').val(),
  584. rate: $('#project-rate').val(),
  585. contact: $('#project-contact').val(),
  586. phone: $('#project-phone').val(),
  587. num: $('#project-num').val(),
  588. },
  589. worker: {
  590. name: $('#worker-name').val(),
  591. bank: $('#worker-bank').val(),
  592. account: $('#worker-account').val(),
  593. rate: $('#worker-rate').val(),
  594. contact: $('#worker-contact').val(),
  595. phone: $('#worker-phone').val(),
  596. num: $('#worker-num').val(),
  597. },
  598. },
  599. };
  600. const tenderId = window.location.pathname.split('/')[2];
  601. postData('/sp/' + spid + '/payment/info/save', { type: 'info', postData: { id: tenderId, info} }, function (data) {
  602. property.deal_info = info.deal_info;
  603. property.construction_unit = info.construction_unit;
  604. property.tech_param = info.tech_param;
  605. property.pay_account = info.pay_account;
  606. $('#bd-attr').modal('hide');
  607. });
  608. }