global.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  1. /*全局自适应高度*/
  2. /*全局自适应高度*/
  3. function autoFlashHeight(){
  4. const select = $(".scrollbar-auto .active");
  5. if (select.length > 0) $(".scrollbar-auto")[0].scrollTop = select[0].offsetTop - 72;
  6. function getObjHeight(select) {
  7. return select.length > 0 ? select.height() : 0;
  8. }
  9. /*侧栏高度*/
  10. var sBar1 = getObjHeight($(".sjs-bar-1"));
  11. var sBar2 = getObjHeight($(".sjs-bar-2"));
  12. var sBar3 = getObjHeight($(".sjs-bar-3"));
  13. var sBar4 = getObjHeight($(".sjs-bar-4"));
  14. var sBar5 = getObjHeight($(".sjs-bar-5"));
  15. /*侧栏高度*/
  16. var cHeader = getObjHeight($(".c-header"));
  17. var sBar = getObjHeight($(".sjs-bar"));
  18. var sBart = getObjHeight($(".sjs-bart"));
  19. var sBarz = getObjHeight($(".side-bar"));
  20. var pBarz = getObjHeight($(".toolsbar-f"));
  21. var bdtopc = getObjHeight($(".body-height-top"));
  22. var bcontent = getObjHeight($(".bcontent-wrap"));
  23. $(".sjs-height-0").height($(window).height()-cHeader-90+53);
  24. $(".sjs-height-1").height($(window).height()-cHeader-bcontent-90+53);
  25. $(".sjs-height-2").height($(window).height()-cHeader-sBarz-120);
  26. $(".sjs-height-3").height($(window).height()-cHeader-sBar-492+25+150);/*492*/
  27. $(".sjs-height-4").height($(window).height()-cHeader-pBarz-110+75);
  28. $(".sjs-height-5").height($(window).height()-cHeader-sBar-492+55);/*492*/
  29. $(".sjs-height-6").height($(window).height()-cHeader-34-sBar1);
  30. $(".sp-wrap").height(bcontent-30);
  31. /*侧栏高度*/
  32. $(".sjs-sh-1").height($(window).height()-cHeader-sBar1-92+55);
  33. $(".sjs-sh-2").height($(window).height()-cHeader-sBar2-92+55);
  34. $(".sjs-sh-3").height($(window).height()-cHeader-sBar3-92+55);
  35. $(".sjs-sh-4").height($(window).height()-cHeader-sBar4-92+55);
  36. $(".sjs-sh-5").height($(window).height()-cHeader-sBar5-92+55);
  37. for (const sh of $('.sjs-sh')) {
  38. $(sh).height($(window).height()-cHeader-getObjHeight($('.sjs-bar', sh.parentNode))-getObjHeight($('.sjs-bottom', sh.parentNode))-92+55);
  39. }
  40. /*工程变更添加清单高度*/
  41. $(".sjs-biangeng-height").height($(window).height()/3.3);
  42. };
  43. $(window).resize(autoFlashHeight);
  44. /*全局自适应高度结束*/
  45. $(function(){
  46. /*侧滑*/
  47. $(".open-sidebar").click(function(){
  48. $(".slide-sidebar").animate({width:"800"}).addClass("open");
  49. });
  50. $("body").click(function(event){
  51. var e = event || window.event; //浏览器兼容性
  52. if(!$(event.target).is('a')) {
  53. var elem = event.target || e.srcElement;
  54. while (elem) { //循环判断至跟节点,防止点击的是div子元素
  55. if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
  56. return false;
  57. }
  58. elem = elem.parentNode;
  59. }
  60. $(".slide-sidebar").animate({width:"0"}).removeClass("open")// 关闭处理
  61. }
  62. });
  63. /*侧滑*/
  64. /*工具提示*/
  65. $(function () {
  66. $('[data-toggle="tooltip"]').tooltip()
  67. });
  68. /*侧栏菜单*/
  69. $(".bg-nav > li > a").click(function() {
  70. var self = $(this);
  71. var subMenu = $(this).siblings('ul.sub-menu');
  72. if(subMenu.length > 0) {
  73. if(subMenu.is(":visible")) {
  74. self.find('.menu-arrow').removeClass('fa-angle-up').addClass('fa-angle-down');
  75. subMenu.slideUp('fast');
  76. self.parent().removeClass('active');
  77. }else{
  78. self.parent().addClass('active');
  79. self.find('.menu-arrow').removeClass('fa-angle-down').addClass('fa-angle-up');
  80. subMenu.slideDown('fast');
  81. }
  82. }
  83. });
  84. // 数据提交
  85. $("#submit-form").click(function() {
  86. $("#save-form").submit();
  87. });
  88. // modal弹窗拖动
  89. // $(document).on("show.bs.modal", ".modal", function() {
  90. // $(this).draggable({
  91. // handle: ".modal-header" // 只能点击头部拖动
  92. // });
  93. // $(this).css("overflow", "hidden");
  94. // });
  95. // 动态生成datepicker
  96. $('body').on('focus', ".datepicker-here", function (e) {
  97. if ($(this).data("datepicker") != "1") {
  98. $(this).datepicker();
  99. }
  100. $(this).data("datepicker", "1");
  101. });
  102. $('a[href="/setting/user"]').each(function () {
  103. if (getLocalCache('account-pageSize')) {
  104. $(this).attr('href', $(this).attr('href') + '?pageSize=' + getLocalCache('account-pageSize'));
  105. }
  106. });
  107. $('.change_sort_link').each(function () {
  108. const tender_id = $(this).attr('href').split('/')[2];
  109. let orderSetting = getLocalCache('change-'+ tender_id +'-list-order');
  110. if(orderSetting) {
  111. const orders = orderSetting.split('|');
  112. $(this).attr('href', $(this).attr('href') + '?sort=' + orders[0] + '&order=' + orders[1]);
  113. }
  114. });
  115. $('.change_project_sort_link').each(function () {
  116. const tender_id = $(this).attr('href').split('/')[2];
  117. let orderSetting = getLocalCache('change-project-'+ tender_id +'-list-order');
  118. if(orderSetting) {
  119. const orders = orderSetting.split('|');
  120. $(this).attr('href', $(this).attr('href') + '?sort=' + orders[0] + '&order=' + orders[1]);
  121. }
  122. });
  123. $('.change_apply_sort_link').each(function () {
  124. const tender_id = $(this).attr('href').split('/')[2];
  125. let orderSetting = getLocalCache('change-apply-'+ tender_id +'-list-order');
  126. if(orderSetting) {
  127. const orders = orderSetting.split('|');
  128. $(this).attr('href', $(this).attr('href') + '?sort=' + orders[0] + '&order=' + orders[1]);
  129. }
  130. });
  131. $('.change_plan_sort_link').each(function () {
  132. const tender_id = $(this).attr('href').split('/')[2];
  133. let orderSetting = getLocalCache('change-plan-'+ tender_id +'-list-order');
  134. if(orderSetting) {
  135. const orders = orderSetting.split('|');
  136. $(this).attr('href', $(this).attr('href') + '?sort=' + orders[0] + '&order=' + orders[1]);
  137. }
  138. });
  139. $('#nav_management').click(function(e) {
  140. e.preventDefault()
  141. showWaitingView();
  142. $.ajax({
  143. type: 'GET',
  144. url: '/management/proxy/project/vertify',
  145. dataType: 'json',
  146. cache: false,
  147. timeout: 60000,
  148. success: function ({code = -1, data: { exist, is_admin, redirect } = { exist: 0, is_admin: false}}) {
  149. if (code === 0) {
  150. if (!exist && !is_admin) {
  151. toastr.error('「项目管理」系统不存在当前项目,请联系管理员进行处理。');
  152. } else if(!exist && is_admin) {
  153. $('#add-management').modal('show')
  154. } else {
  155. redirect && window.open(redirect)
  156. }
  157. }
  158. closeWaitingView()
  159. },
  160. error: function(jqXHR, textStatus, errorThrown){
  161. toastr.error('error: ' + textStatus + " " + errorThrown);
  162. closeWaitingView();
  163. }
  164. })
  165. });
  166. $('#add-management .btn-primary').click(function() {
  167. $('#add-management').modal('hide')
  168. $('#process-management').modal('show')
  169. $.ajax({
  170. tpye: 'post',
  171. url: '/management/proxy/project/add',
  172. dataType: 'json',
  173. cache: false,
  174. timeout: 60000,
  175. // beforeSend: function(xhr) {
  176. // let csrfToken = Cookies.get('csrfToken_j');
  177. // xhr.setRequestHeader('x-csrf-token', csrfToken);
  178. // },
  179. success: function ({code = -1, data = {}}) {
  180. if (code === 0) {
  181. timer = setTimeout(() => {
  182. $('#process-management .process-child').css('width', '100%')
  183. setTimeout(() => {
  184. const { redirect } = data
  185. redirect && window.open(redirect)
  186. $('#process-management').modal('hide')
  187. }, 150);
  188. }, 500);
  189. }
  190. }
  191. })
  192. })
  193. });
  194. function checkShowLast (count) {
  195. if (count > 12500) {
  196. $('a[name=showLevel][tag=last]').hide();
  197. } else {
  198. $('a[name=showLevel][tag=last]').show();
  199. }
  200. }
  201. /**
  202. * 提示框
  203. *
  204. * @param string message
  205. * @param string type
  206. * @param string icon
  207. * @return void
  208. */
  209. function toast(message, type, icon) {
  210. var toast = $(".toast");
  211. toast.addClass(type);
  212. toast.children('.message').html(message);
  213. var iconClass = 'fa-' + icon;
  214. toast.children('.icon').addClass(iconClass);
  215. toast.fadeIn(500);
  216. setTimeout(function() {
  217. toast.fadeOut('fast');
  218. toast.children('.message').text('');
  219. toast.children('.icon').removeClass(iconClass);
  220. }, 3000);
  221. }
  222. /**
  223. * 动态请求数据
  224. * @param {String} url - 请求链接
  225. * @param data - 提交数据
  226. * @param {function} successCallback - 返回成功回调
  227. * @param {function} errorCallBack - 返回失败回调
  228. */
  229. const postData = function (url, data, successCallback, errorCallBack, showWaiting = true) {
  230. if (showWaiting) showWaitingView();
  231. $.ajax({
  232. type:"POST",
  233. url: url,
  234. data: {'data': JSON.stringify(data)},
  235. dataType: 'json',
  236. cache: false,
  237. timeout: 60000,
  238. beforeSend: function(xhr) {
  239. let csrfToken = Cookies.get('csrfToken_j');
  240. xhr.setRequestHeader('x-csrf-token', csrfToken);
  241. },
  242. success: function(result){
  243. if (result.err === 0) {
  244. if (result.hpack) {
  245. result.hpack.forEach(x => {
  246. result.data[x] = hpackArrBack(result.data[x]);
  247. });
  248. }
  249. if (successCallback) {
  250. successCallback(result.data, result.msg);
  251. }
  252. } else if (result.err === 2) {
  253. toastr.error('error: ' + result.msg);
  254. setTimeout(function () {
  255. window.location.href = '/login';
  256. },1000);
  257. } else {
  258. toastr.error('error: ' + result.msg);
  259. if (errorCallBack) {
  260. errorCallBack(result.msg);
  261. }
  262. }
  263. if (showWaiting) closeWaitingView();
  264. },
  265. error: function(jqXHR, textStatus, errorThrown){
  266. toastr.error('error: ' + textStatus + " " + errorThrown);
  267. if (errorCallBack) {
  268. errorCallBack();
  269. }
  270. if (showWaiting) closeWaitingView();
  271. }
  272. });
  273. };
  274. const postDataAsync = function (url, data, showWaiting = true) {
  275. return new Promise(function (resolve, reject) {
  276. postData(url, data, result => {
  277. resolve(result);
  278. }, err => {
  279. reject(err);
  280. }, showWaiting);
  281. });
  282. };
  283. /**
  284. * 动态请求数据(压缩数据)
  285. * @param {String} url - 请求链接
  286. * @param data - 提交数据
  287. * @param {function} successCallback - 返回成功回调
  288. * @param {function} errorCallBack - 返回失败回调
  289. */
  290. const postDataCompress = function (url, data, successCallback, errorCallBack, htype = 'progress') {
  291. if (htype === 'wait') showWaitingView();
  292. if (htype === 'progress') showProgress();
  293. $.ajax({
  294. type:"POST",
  295. url: url,
  296. data: {'data': LZString.compressToUTF16(JSON.stringify(data))},
  297. dataType: 'json',
  298. cache: false,
  299. timeout: 80000, // 导入清单Excel(10w行)预计需要时间
  300. beforeSend: function(xhr) {
  301. let csrfToken = Cookies.get('csrfToken_j');
  302. xhr.setRequestHeader('x-csrf-token', csrfToken);
  303. },
  304. success: function(result){
  305. if (htype === 'progress') doneProgress();
  306. if (result.err === 0) {
  307. if (successCallback) {
  308. successCallback(result.data);
  309. }
  310. } else if (result.err === 2) {
  311. toastr.error('error: ' + result.msg);
  312. setTimeout(function () {
  313. window.location.href = '/login';
  314. },1000);
  315. } else {
  316. toastr.error('error: ' + result.msg);
  317. if (errorCallBack) {
  318. errorCallBack(result.msg);
  319. }
  320. }
  321. if (htype === 'wait') closeWaitingView();
  322. if (htype === 'progress') closeProgress();
  323. },
  324. error: function(jqXHR, textStatus, errorThrown){
  325. toastr.error('error: ' + textStatus + " " + errorThrown);
  326. if (errorCallBack) {
  327. errorCallBack();
  328. }
  329. if (htype === 'wait') closeWaitingView();
  330. if (htype === 'progress') closeProgress();
  331. }
  332. });
  333. };
  334. /**
  335. * 动态请求数据
  336. * @param {String} url - 请求链接
  337. * @param data - 提交数据
  338. * @param {function} successCallback - 返回成功回调
  339. * @param {function} errorCallBack - 返回失败回调
  340. */
  341. const postDataWithFile = function (url, formData, successCallback, errorCallBack, showWaiting = true) {
  342. if (showWaiting) showWaitingView();
  343. if (formData.getAll('file[]').length > 10) {
  344. toastr.error('文件数量不能多于10个');
  345. if (showWaiting) closeWaitingView();
  346. return
  347. }
  348. $.ajax({
  349. type:"POST",
  350. url: url,
  351. data: formData,
  352. dataType: 'json',
  353. cache: false,
  354. // 告诉jQuery不要去设置Content-Type请求头
  355. contentType: false,
  356. // 告诉jQuery不要去处理发送的数据
  357. processData: false,
  358. timeout: 60000,
  359. beforeSend: function(xhr) {
  360. let csrfToken = Cookies.get('csrfToken_j');
  361. xhr.setRequestHeader('x-csrf-token', csrfToken);
  362. },
  363. success: function(result){
  364. if (result.err === 0) {
  365. if (successCallback) {
  366. successCallback(result.data);
  367. }
  368. } else if (result.err === 2) {
  369. toastr.error('error: ' + result.msg);
  370. setTimeout(function () {
  371. window.location.href = '/login';
  372. },1000);
  373. } else {
  374. toastr.error('error: ' + result.msg);
  375. if (errorCallBack) {
  376. errorCallBack();
  377. }
  378. }
  379. if (showWaiting) closeWaitingView();
  380. },
  381. error: function(jqXHR, textStatus, errorThrown){
  382. toastr.error('error: ' + textStatus + " " + errorThrown);
  383. if (errorCallBack) {
  384. errorCallBack();
  385. }
  386. if (showWaiting) closeWaitingView();
  387. }
  388. });
  389. };
  390. const postDataWithFileProgress = function (url, formData, successCallback, errorCallBack) {
  391. showUploadFileProgress();
  392. $.ajax({
  393. type:"POST",
  394. url: url,
  395. data: formData,
  396. dataType: 'json',
  397. cache: false,
  398. // 告诉jQuery不要去设置Content-Type请求头
  399. contentType: false,
  400. // 告诉jQuery不要去处理发送的数据
  401. processData: false,
  402. beforeSend: function(xhr) {
  403. let csrfToken = Cookies.get('csrfToken_j');
  404. xhr.setRequestHeader('x-csrf-token', csrfToken);
  405. },
  406. success: function(result){
  407. doneProgress();
  408. if (result.err === 0) {
  409. if (successCallback) {
  410. successCallback(result.data);
  411. }
  412. } else if (result.err === 2) {
  413. toastr.error('error: ' + result.msg);
  414. setTimeout(function () {
  415. window.location.href = '/login';
  416. },1000);
  417. } else {
  418. toastr.error('error: ' + result.msg);
  419. if (errorCallBack) {
  420. errorCallBack();
  421. }
  422. }
  423. closeProgress();
  424. },
  425. error: function(jqXHR, textStatus, errorThrown){
  426. toastr.error('error: ' + textStatus + " " + errorThrown);
  427. if (errorCallBack) {
  428. errorCallBack();
  429. }
  430. closeProgress();
  431. },
  432. xhr: function() {
  433. var xhr = new XMLHttpRequest();
  434. //使用XMLHttpRequest.upload监听上传过程,注册progress事件,打印回调函数中的event事件
  435. xhr.upload.addEventListener('progress', function (e) {
  436. console.log(e);
  437. //loaded代表上传了多少
  438. //total代表总数为多少
  439. var progressRate = (e.loaded / e.total) * 95;
  440. //通过设置进度条的宽度达到效果
  441. setUploadFileProgress(progressRate);
  442. })
  443. return xhr;
  444. }
  445. });
  446. }
  447. const postCompressFile = function (url, data, successCallback, errorCallBack) {
  448. $.ajax({
  449. type:"POST",
  450. url: url,
  451. data: {'data': JSON.stringify(data)},
  452. // dataType: 'blob',
  453. cache: false,
  454. timeout: 180000,
  455. xhrFields: {
  456. responseType: 'blob'
  457. },
  458. beforeSend: function(xhr) {
  459. let csrfToken = Cookies.get('csrfToken_j');
  460. xhr.setRequestHeader('x-csrf-token', csrfToken);
  461. },
  462. success: function(result){
  463. // if (result.err === 0) {
  464. // if (successCallback) {
  465. // successCallback(result.data);
  466. // }
  467. // } else if (result.err === 2) {
  468. // toastr.error('error: ' + result.msg);
  469. // setTimeout(function () {
  470. // window.location.href = '/login';
  471. // },1000);
  472. // } else {
  473. // toastr.error('error: ' + result.msg);
  474. // if (errorCallBack) {
  475. // errorCallBack(result.msg);
  476. // }
  477. // }
  478. if (successCallback) {
  479. successCallback(result)
  480. }
  481. },
  482. error: function(jqXHR, textStatus, errorThrown){
  483. // console.log(jqXHR, textStatus, errorThrown);
  484. // toastr.error('error: ' + textStatus + " " + errorThrown);
  485. if (errorCallBack) {
  486. errorCallBack();
  487. }
  488. }
  489. });
  490. }
  491. /**
  492. * 获取url中参数
  493. * @param variable
  494. * @returns {*}
  495. */
  496. function getQueryVariable(variable) {
  497. var query = window.location.search.substring(1);
  498. var vars = query.split("&");
  499. for (var i=0;i<vars.length;i++) {
  500. var pair = vars[i].split("=");
  501. if(pair[0] == variable){return pair[1];}
  502. }
  503. return(false);
  504. }
  505. const zeroRange = 0.00000001;
  506. function checkZero(value) {
  507. return value === null || value === undefined || (_.isNumber(value) && Math.abs(value) < zeroRange);
  508. }
  509. function checkFieldChange(o, n) {
  510. return o == n || ((!o || o === '') && (n === ''));
  511. }
  512. var bShowWaiting = false, beginWaitingTime;
  513. //关闭等待窗口
  514. function closeWaitingView() {
  515. bShowWaiting = false;
  516. const time = parseInt(new Date());
  517. setTimeout(function () {
  518. var bgDiv = document.getElementById("bgDiv");
  519. var msgDiv = document.getElementById("msgDiv");
  520. //移除背景遮罩层div
  521. if(bgDiv != null){
  522. document.body.removeChild(bgDiv);
  523. }
  524. //移除中间信息提示层div
  525. if(msgDiv != null){
  526. document.body.removeChild(msgDiv);
  527. }
  528. }, Math.max(beginWaitingTime - time + 500, 0));
  529. }
  530. //显示等待窗口
  531. function showWaitingView() {
  532. // bShowWaiting = true;
  533. // setTimeout(function () {
  534. // if (!bShowWaiting) return;
  535. // beginWaitingTime = parseInt(new Date());
  536. // var msgw = 300; //提示窗口的宽度
  537. // var msgh = 100; //提示窗口的高度
  538. //
  539. // var sWidth, sHeight;
  540. // sWidth = document.body.clientWidth;
  541. // sHeight = document.body.clientHeight;
  542. //
  543. // //背景遮罩层div
  544. // var bgObj = document.createElement("div");
  545. // bgObj.setAttribute('id', 'bgDiv');
  546. // bgObj.style.zIndex = '9998';
  547. // bgObj.style.position = "absolute";
  548. // bgObj.style.top = "0px";
  549. // bgObj.style.background = "#888";
  550. // bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
  551. // bgObj.style.opacity = "0.6";
  552. // bgObj.style.left = "0px";
  553. // bgObj.style.width = sWidth + "px";
  554. // bgObj.style.height = sHeight + "px";
  555. // document.body.appendChild(bgObj);
  556. //
  557. // //信息提示层div
  558. // var msgObj = document.createElement("div");
  559. // msgObj.style.zIndex = '9999';
  560. // msgObj.setAttribute("id", "msgDiv");
  561. // msgObj.setAttribute("align", "center");
  562. // msgObj.style.position = "absolute";
  563. // msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
  564. // msgObj.style.width = msgw + "px";
  565. // msgObj.style.height = msgh + "px";
  566. // msgObj.style.top = (document.documentElement.scrollTop + (sHeight - msgh) / 2) + "px";
  567. // msgObj.style.left = (sWidth - msgw) / 2 + "px";
  568. // document.body.appendChild(msgObj);
  569. //
  570. // //中间等待图标
  571. // document.getElementById("msgDiv").innerHTML = '<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>';
  572. // }, 1000);
  573. beginWaitingTime = parseInt(new Date());
  574. var msgw = 300; //提示窗口的宽度
  575. var msgh = 100; //提示窗口的高度
  576. var sWidth, sHeight;
  577. sWidth = document.body.clientWidth;
  578. sHeight = document.body.clientHeight;
  579. //背景遮罩层div
  580. var bgObj = document.createElement("div");
  581. bgObj.setAttribute('id', 'bgDiv');
  582. bgObj.style.zIndex = '9998';
  583. bgObj.style.position = "absolute";
  584. bgObj.style.top = "0px";
  585. // bgObj.style.background = "#888";
  586. bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
  587. bgObj.style.opacity = "0.6";
  588. bgObj.style.left = "0px";
  589. bgObj.style.width = sWidth + "px";
  590. bgObj.style.height = sHeight + "px";
  591. document.body.appendChild(bgObj);
  592. //信息提示层div
  593. var msgObj = document.createElement("div");
  594. msgObj.style.zIndex = '9999';
  595. msgObj.setAttribute("id", "msgDiv");
  596. msgObj.setAttribute("align", "center");
  597. msgObj.style.position = "absolute";
  598. msgObj.style.font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
  599. msgObj.style.width = msgw + "px";
  600. msgObj.style.height = msgh + "px";
  601. msgObj.style.top = (document.documentElement.scrollTop + (sHeight - msgh) / 2) + "px";
  602. msgObj.style.left = (sWidth - msgw) / 2 + "px";
  603. document.body.appendChild(msgObj);
  604. //中间等待图标
  605. document.getElementById("msgDiv").innerHTML = '<i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>';
  606. }
  607. let progressInterval;
  608. function showProgress() {
  609. var sWidth, sHeight;
  610. sWidth = document.body.clientWidth;
  611. sHeight = document.body.clientHeight;
  612. //背景遮罩层div
  613. var bgObj = document.createElement("div");
  614. bgObj.setAttribute('id', 'bgDiv');
  615. bgObj.style.zIndex = '9998';
  616. bgObj.style.position = "absolute";
  617. bgObj.style.top = "0px";
  618. bgObj.style.background = "#888";
  619. bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
  620. bgObj.style.opacity = "0.6";
  621. bgObj.style.left = "0px";
  622. bgObj.style.width = sWidth + "px";
  623. bgObj.style.height = sHeight + "px";
  624. document.body.appendChild(bgObj);
  625. //信息提示层div
  626. var msgObj = document.createElement("div");
  627. msgObj.classList.add('progress');
  628. msgObj.style.zIndex = '9999';
  629. msgObj.style.position = "absolute";
  630. msgObj.setAttribute("id", "progressDiv");
  631. msgObj.style.height = "2px";
  632. msgObj.style.width = "600px";
  633. msgObj.style.top = (document.documentElement.scrollTop + sHeight / 2) + "px";
  634. msgObj.style.left = (sWidth - 600) / 2 + "px";
  635. document.body.appendChild(msgObj);
  636. msgObj.innerHTML = '<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>';
  637. const processObj = $('.progress-bar');
  638. let count = 0;
  639. progressInterval = setInterval(function () {
  640. const pos = parseInt(processObj.attr('aria-valuenow'));
  641. if (pos < 20) { // 1
  642. processObj.attr('aria-valuenow', pos + 2);
  643. processObj.width((pos + 2) + '%');
  644. } else if (pos < 40) { // 2
  645. processObj.attr('aria-valuenow', pos + 1);
  646. processObj.width((pos + 1) + '%');
  647. } else if (pos < 60) { // 4
  648. count += 1;
  649. if (count % 2 === 0) {
  650. processObj.attr('aria-valuenow', pos + 1);
  651. processObj.width((pos + 1) + '%');
  652. }
  653. } else if (pos < 80) { // 10
  654. count += 1;
  655. if (count % 5 === 0) {
  656. processObj.attr('aria-valuenow', pos + 1);
  657. processObj.width((pos + 1) + '%');
  658. }
  659. } else if (pos < 90) { // 15
  660. count += 1;
  661. if (count % 15 === 0) {
  662. processObj.attr('aria-valuenow', pos + 1);
  663. processObj.width((pos + 1) + '%');
  664. }
  665. } else if (pos < 95) { // 20
  666. count += 1;
  667. if (count % 40 === 0) {
  668. processObj.attr('aria-valuenow', pos + 1);
  669. processObj.width((pos + 1) + '%');
  670. }
  671. } else if (pos < 100) { // 30
  672. count += 1;
  673. if (count % 60 === 0) {
  674. processObj.attr('aria-valuenow', pos + 1);
  675. }
  676. }
  677. }, 100);
  678. }
  679. function doneProgress() {
  680. clearInterval(progressInterval);
  681. $('.progress-bar').attr('aria-valuenow', 100).width('100%');
  682. }
  683. function closeProgress() {
  684. setTimeout(function () {
  685. var bgDiv = document.getElementById("bgDiv");
  686. var msgDiv = document.getElementById("progressDiv");
  687. //移除背景遮罩层div
  688. if(bgDiv != null){
  689. document.body.removeChild(bgDiv);
  690. }
  691. //移除中间信息提示层div
  692. if(msgDiv != null){
  693. document.body.removeChild(msgDiv);
  694. }
  695. }, 500);
  696. }
  697. function showUploadFileProgress() {
  698. var sWidth, sHeight;
  699. sWidth = document.body.clientWidth;
  700. sHeight = document.body.clientHeight;
  701. //背景遮罩层div
  702. var bgObj = document.createElement("div");
  703. bgObj.setAttribute('id', 'bgDiv');
  704. bgObj.style.zIndex = '9998';
  705. bgObj.style.position = "absolute";
  706. bgObj.style.top = "0px";
  707. bgObj.style.background = "#888";
  708. bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
  709. bgObj.style.opacity = "0.6";
  710. bgObj.style.left = "0px";
  711. bgObj.style.width = sWidth + "px";
  712. bgObj.style.height = sHeight + "px";
  713. document.body.appendChild(bgObj);
  714. //信息提示层div
  715. var msgObj = document.createElement("div");
  716. msgObj.classList.add('progress');
  717. msgObj.style.zIndex = '9999';
  718. msgObj.style.position = "absolute";
  719. msgObj.setAttribute("id", "progressDiv");
  720. msgObj.style.height = "2px";
  721. msgObj.style.width = "600px";
  722. msgObj.style.top = (document.documentElement.scrollTop + sHeight / 2) + "px";
  723. msgObj.style.left = (sWidth - 600) / 2 + "px";
  724. document.body.appendChild(msgObj);
  725. msgObj.innerHTML = '<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>';
  726. }
  727. function setUploadFileProgress(pos) {
  728. const processObj = $('.progress-bar');
  729. processObj.attr('aria-valuenow', pos);
  730. processObj.width(pos + '%');
  731. }
  732. /**
  733. * 设置本地缓存
  734. *
  735. * @param {String} key
  736. * @param {String|Number} value
  737. * @return {void}
  738. */
  739. function setLocalCache(key, value) {
  740. const storage = window.localStorage;
  741. if (!storage || key === '' || value === '') {
  742. return;
  743. }
  744. storage.setItem(key, value);
  745. }
  746. /**
  747. * 获取本地缓存
  748. *
  749. * @param {String} key
  750. * @return {String}
  751. */
  752. function getLocalCache(key) {
  753. const storage = window.localStorage;
  754. if (!storage || key === '') {
  755. return null;
  756. }
  757. return storage.getItem(key);
  758. }
  759. /**
  760. * 移除本地缓存
  761. * @param {String} key
  762. * @returns {Boolean}
  763. */
  764. function removeLocalCache(key) {
  765. const storage = window.localStorage;
  766. if (!storage || key === '') {
  767. return null;
  768. }
  769. return storage.removeItem(key);
  770. }
  771. //params: 需要复制的对象(元素)
  772. function copyToClipboard( text ) {
  773. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  774. var aux = document.createElement('textarea');// 创建元素用于复制
  775. // Prevent zooming on iOS
  776. aux.style.fontSize = '12pt';
  777. // Reset box model
  778. aux.style.border = '0';
  779. aux.style.padding = '0';
  780. aux.style.margin = '0';
  781. // Move element out of screen horizontally
  782. aux.style.position = 'absolute';
  783. aux.style[isRTL ? 'right' : 'left'] = '-9999px';
  784. // Move element to the same position vertically
  785. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  786. aux.style.top = yPosition + 'px';
  787. aux.setAttribute('readonly', '');
  788. // 设置元素内容
  789. aux.value = text;
  790. // 将元素插入页面进行调用
  791. document.body.appendChild(aux);
  792. // 复制内容
  793. aux.select();
  794. aux.setSelectionRange(0, text.length);
  795. // 将内容复制到剪贴板
  796. document.execCommand("copy", true);
  797. // 删除创建元素
  798. document.body.removeChild(aux);
  799. }
  800. function toastMessageUniq (obj) {
  801. if (!obj.msg || !obj.type) return;
  802. if (!obj.once) {
  803. switch (obj.type) {
  804. case 'error':
  805. toastr.error(obj.msg);
  806. break;
  807. case 'warning':
  808. toastr.warning(obj.msg);
  809. break;
  810. case 'info':
  811. toastr.info(obj.msg);
  812. break;
  813. case 'success':
  814. toastr.success(obj.msg);
  815. break;
  816. }
  817. obj.once = true;
  818. }
  819. }
  820. function trimInvalidChar(str) {
  821. return $.trim(str).replace(/\n/g, '').replace(/\r/g, '').replace(/\t/g, '');
  822. }
  823. function cleanSymbols(str) {
  824. return $.trim(str).replace(/\\/g, '').replace(/\'/g, '').replace(/\"/g, '').replace(/\</g, '').replace(/\|/g, '');
  825. }
  826. jQuery.bootstrapLoading = {
  827. isLoading: function () {
  828. return $('#loadingPage').is(':visible');
  829. },
  830. start: function (options) {
  831. if(this.isLoading()){
  832. return;
  833. }
  834. var defaults = {
  835. opacity: 0.5,
  836. //loading页面透明度
  837. // backgroundColor: "#FFFFFF",
  838. //loading页面背景色
  839. borderColor: "#bbb",
  840. //提示边框颜色
  841. borderWidth: 1,
  842. //提示边框宽度
  843. borderStyle: "solid",
  844. //提示边框样式
  845. loadingTips: "Loading, please wait...",
  846. //提示文本
  847. TipsColor: "#fff",
  848. //提示颜色
  849. delayTime: 500,
  850. //页面加载完成后,加载页面渐出速度
  851. zindex: 2000,
  852. //loading页面层次
  853. sleep: 0
  854. //设置挂起,等于0时则无需挂起
  855. }
  856. var options = $.extend(defaults, options);
  857. //获取页面宽高
  858. var _PageHeight = document.documentElement.clientHeight,
  859. _PageWidth = document.documentElement.clientWidth;
  860. //在页面未加载完毕之前显示的loading Html自定义内容
  861. //var _LoadingHtml = '<div id="loadingPage" style="position:fixed;left:0;top:0;_position: absolute;width:100%;height:' + _PageHeight + 'px;background:' + options.backgroundColor + ';opacity:' + options.opacity + ';filter:alpha(opacity=' + options.opacity * 100 + ');z-index:' + options.zindex + ';"><div id="loadingTips" style="position: absolute; cursor1: wait; width: auto;border-color:' + options.borderColor + ';border-style:' + options.borderStyle + ';border-width:' + options.borderWidth + 'px; height:80px; line-height:80px; padding-left:80px; padding-right: 5px;border-radius:10px; background: ' + options.backgroundColor + ' url(/Content/bootstrap-loading/images/loading.gif) no-repeat 5px center; color:' + options.TipsColor + ';font-size:20px;">' + options.loadingTips + '</div></div>';
  862. var _LoadingHtml = '<div id="loadingPage" style="position:fixed;left:0;top:0;_position: absolute;width:100%;height:' + _PageHeight + 'px;background:' + options.backgroundColor + ';opacity:' + options.opacity + ';filter:alpha(opacity=' + options.opacity * 100 + ');z-index:' + options.zindex + ';"><div id="loadingTips" style="position: absolute; cursor1: wait; width: auto;">' +'<div class="text-green"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i> <span class="sr-only">Loading...</span> </div> </div></div>';
  863. //呈现loading效果
  864. $("body").append(_LoadingHtml);
  865. //获取loading提示框宽高
  866. var _LoadingTipsH = document.getElementById("loadingTips").clientHeight,
  867. _LoadingTipsW = document.getElementById("loadingTips").clientWidth;
  868. //计算距离,让loading提示框保持在屏幕上下左右居中
  869. var _LoadingTop = _PageHeight > _LoadingTipsH ? (_PageHeight - _LoadingTipsH) / 2 : 0,
  870. _LoadingLeft = _PageWidth > _LoadingTipsW ? (_PageWidth - _LoadingTipsW) / 2 : 0;
  871. $("#loadingTips").css({
  872. "left": _LoadingLeft + "px",
  873. "top": _LoadingTop + "px"
  874. });
  875. //监听页面加载状态
  876. document.onreadystatechange = PageLoaded;
  877. //当页面加载完成后执行
  878. function PageLoaded() {
  879. if (document.readyState == "complete") {
  880. var loadingMask = $('#loadingPage');
  881. setTimeout(function () {
  882. loadingMask.animate({
  883. "opacity": 0
  884. },
  885. options.delayTime,
  886. function () {
  887. $(this).hide();
  888. });
  889. },
  890. options.sleep);
  891. }
  892. }
  893. },
  894. end: function () {
  895. $("#loadingPage").remove();
  896. },
  897. progressStop:true,
  898. progressStart:async function(title="导出文件",autoBar = false){
  899. if($("#progressModal").length == 0){
  900. let phtml = `<div class="modal fade" id="progressModal" data-backdrop="static">
  901. <div class="modal-dialog" role="document">
  902. <div class="modal-content">
  903. <div class="modal-header">
  904. <h5 class="modal-title" id="progress_modal_title">${title}</h5>
  905. </div>
  906. <div class="modal-body">
  907. <!--正在生成-->
  908. <h5 class="my-3" id="progress_modal_body">正在${title}</h5>
  909. <div class="progress mb-3">
  910. <div id="progress_modal_bar" class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 10%"></div>
  911. </div>
  912. </div>
  913. </div>
  914. </div>
  915. </div>`;
  916. $("body").append(phtml);
  917. }else {
  918. $("#progress_modal_title").text(title);
  919. $("#progress_modal_body").text(`正在${title}`);
  920. }
  921. $("#progress_modal_bar").css('width','0%');
  922. $("#progressModal").modal('show');
  923. if(autoBar == true){//假的进度条
  924. $.bootstrapLoading.progressStop = false;
  925. let width = 0;
  926. while ($.bootstrapLoading.progressStop == false){
  927. await setTimeoutSync(null,1000);
  928. width += 5;
  929. if(width > 90) width -= 50;
  930. $("#progress_modal_bar").css('width',`${width}%`);
  931. }
  932. }
  933. },
  934. progressEnd:function () {
  935. $("#progress_modal_bar").css('width','100%');
  936. $.bootstrapLoading.progressStop = true;
  937. $("#progressModal").modal('hide');
  938. }
  939. };
  940. // 光标插入button内容
  941. $.fn.extend({
  942. insertAtCaret: function(myValue){
  943. var $t=$(this)[0];
  944. if (document.selection) {
  945. this.focus();
  946. sel = document.selection.createRange();
  947. sel.text = myValue;
  948. this.focus();
  949. }
  950. else
  951. if ($t.selectionStart || $t.selectionStart == '0') {
  952. var startPos = $t.selectionStart;
  953. var endPos = $t.selectionEnd;
  954. var scrollTop = $t.scrollTop;
  955. $t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
  956. this.focus();
  957. $t.selectionStart = startPos + myValue.length;
  958. $t.selectionEnd = startPos + myValue.length;
  959. $t.scrollTop = scrollTop;
  960. }
  961. else {
  962. this.value += myValue;
  963. this.focus();
  964. }
  965. }
  966. });
  967. const checkUtils = {
  968. posOver(data) {
  969. if (!data) return false;
  970. if (!data.quantity) return !!data.end_contract_qty;
  971. return data.quantity > 0
  972. ? data.end_contract_qty > data.final_1_qty
  973. : data.end_contract_qty < data.final_1_qty || data.end_contract_qty > 0;
  974. },
  975. billsOver(data, isTz, relaPos) {
  976. if (!data) return false;
  977. if (isTz) {
  978. const posRange = relaPos.ledgerPos[itemsPre + data.id] || [];
  979. if (posRange.length > 0) {
  980. for (const p of posRange) {
  981. if (checkUtils.posOver(p)) return true;
  982. }
  983. }
  984. if (data.is_tp) {
  985. if (!data.total_price) return !!data.end_contract_tp;
  986. return data.total_price > 0
  987. ? data.end_contract_tp > data.total_price
  988. : data.end_contract_tp < data.total_price || data.end_contract_tp > 0;
  989. } else {
  990. if (!data.quantity) return !!data.end_contract_qty;
  991. return data.quantity > 0
  992. ? data.end_contract_qty > data.final_1_qty
  993. : data.end_contract_qty < data.final_1_qty || data.end_contract_qty > 0;
  994. }
  995. } else {
  996. if (data.is_tp) {
  997. if (!data.deal_tp) return !!data.end_contract_tp;
  998. return data.deal_tp > 0
  999. ? data.end_contract_tp > data.deal_tp
  1000. : data.end_contract_tp < data.deal_tp || data.end_contract_tp > 0;
  1001. } else {
  1002. if (!data.deal_qty) return !!data.end_contract_qty;
  1003. return data.deal_qty > 0
  1004. ? data.end_contract_qty > data.deal_final_1_qty
  1005. : data.end_contract_qty < data.deal_final_1_qty || data.end_contract_qty > 0;
  1006. }
  1007. }
  1008. },
  1009. compareCode(str1, str2, symbol = '-') {
  1010. if (!str1) {
  1011. return 1;
  1012. } else if (!str2) {
  1013. return -1;
  1014. }
  1015. function compareSubCode(code1, code2) {
  1016. if (numReg.test(code1)) {
  1017. if (numReg.test(code2)) {
  1018. return parseInt(code1) - parseInt(code2);
  1019. } else {
  1020. return -1
  1021. }
  1022. } else {
  1023. if (numReg.test(code2)) {
  1024. return 1;
  1025. } else {
  1026. return code1 === code2 ? 0 : (code1 < code2 ? -1 : 1); //code1.localeCompare(code2);
  1027. }
  1028. }
  1029. }
  1030. const numReg = /^[0-9]+$/;
  1031. const aCodes = str1.split(symbol), bCodes = str2.split(symbol);
  1032. for (let i = 0, iLength = Math.min(aCodes.length, bCodes.length); i < iLength; ++i) {
  1033. const iCompare = compareSubCode(aCodes[i], bCodes[i]);
  1034. if (iCompare !== 0) {
  1035. return iCompare;
  1036. }
  1037. }
  1038. return aCodes.length - bCodes.length;
  1039. },
  1040. };
  1041. Number.prototype.format2Str = function (pattern) {
  1042. var strarr = this?this.toString().split('.'):['0'];
  1043. var fmtarr = pattern?pattern.split('.'):[''];
  1044. var retstr='';
  1045. // 整数部分
  1046. var str = strarr[0];
  1047. var fmt = fmtarr[0];
  1048. var i = str.length-1;
  1049. var comma = false;
  1050. for(var f=fmt.length-1;f>=0;f--){
  1051. switch(fmt.substr(f,1)){
  1052. case '#':
  1053. if(i>=0 ) retstr = str.substr(i--,1) + retstr;
  1054. break;
  1055. case '0':
  1056. if(i>=0) retstr = str.substr(i--,1) + retstr;
  1057. else retstr = '0' + retstr;
  1058. break;
  1059. case ',':
  1060. comma = true;
  1061. retstr=','+retstr;
  1062. break;
  1063. }
  1064. }
  1065. if(i>=0){
  1066. if(comma){
  1067. var l = str.length;
  1068. for(;i>=0;i--){
  1069. retstr = str.substr(i,1) + retstr;
  1070. if(i>0 && ((l-i)%3)==0) retstr = ',' + retstr;
  1071. }
  1072. }
  1073. else retstr = str.substr(0,i+1) + retstr;
  1074. }
  1075. retstr = retstr+'.';
  1076. // 处理小数部分
  1077. str=strarr.length>1?strarr[1]:'';
  1078. fmt=fmtarr.length>1?fmtarr[1]:'';
  1079. i=0;
  1080. for(var f=0;f<fmt.length;f++){
  1081. switch(fmt.substr(f,1)){
  1082. case '#':
  1083. if(i<str.length) retstr+=str.substr(i++,1);
  1084. break;
  1085. case '0':
  1086. if(i<str.length) retstr+= str.substr(i++,1);
  1087. else retstr+='0';
  1088. break;
  1089. }
  1090. }
  1091. return retstr.replace(/^,+/,'').replace(/\.$/,'');
  1092. };
  1093. function transFormToChinese(num) {
  1094. const changeNum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
  1095. const unit = ["", "十", "百", "千", "万"];
  1096. num = parseInt(num);
  1097. let getWan = (temp) => {
  1098. let strArr = temp.toString().split("").reverse();
  1099. let newNum = "";
  1100. for (var i = 0; i < strArr.length; i++) {
  1101. newNum = (i == 0 && strArr[i] == 0 ? "" : (i > 0 && strArr[i] == 0 && strArr[i - 1] == 0 ? "" : changeNum[strArr[i]] + (strArr[i] == 0 ? unit[0] : unit[i]))) + newNum;
  1102. }
  1103. return strArr.length === 2 && newNum.indexOf("一十") !== -1 ? newNum.replace('一十', '十') : newNum;
  1104. }
  1105. let overWan = Math.floor(num / 10000);
  1106. let noWan = num % 10000;
  1107. if (noWan.toString().length < 4) noWan = "0" + noWan;
  1108. return overWan ? getWan(overWan) + "万" + getWan(noWan) : getWan(num);
  1109. }
  1110. function hpackArrBack(data) {
  1111. if (data.length === 0) return data;
  1112. if (data.length === 1) throw '数据错误';
  1113. const result = [];
  1114. //const keyIndex = {};
  1115. // data[0].forEach((x, i) => {
  1116. // keyIndex[x] = i;
  1117. // });
  1118. const key = data[0];
  1119. data.forEach((d, i) => {
  1120. if (i === 0) return;
  1121. const obj = {};
  1122. d.forEach((v, j) => {
  1123. if (v === undefined) return;
  1124. obj[key[j]] = v;
  1125. });
  1126. result.push(obj);
  1127. });
  1128. return result;
  1129. }
  1130. const spreadColor = {
  1131. stage: {
  1132. over: '#FF9595', //'#ff6f5c', '#f8d7da'
  1133. differ: '#F2DEDE',
  1134. },
  1135. gcl: {
  1136. differ: '#FFE699', // 同编号时,名称、单位、单价存在不同
  1137. calc_differ: '#f8d7da', //
  1138. },
  1139. };
  1140. $(document).ready(function () {
  1141. $('.modal').draggable({handle: '.modal-header'});
  1142. });