global.js 43 KB

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