phase_pay_detail.js 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154
  1. 'use strict';
  2. const showSideTools = function (show) {
  3. const left = $('#left-view'), right = $('#right-view'), parent = left.parent();
  4. if (show) {
  5. right.show();
  6. autoFlashHeight();
  7. /**
  8. * right.show()后, parent被撑开成2倍left.height, 导致parent.width减少了10px
  9. * 第一次left.width调整后,parent的缩回left.height, 此时parent.width又增加了10px
  10. * 故需要通过最终的parent.width再计算一次left.width
  11. *
  12. * Q: 为什么不通过先计算left.width的宽度,以避免计算两次left.width?
  13. * A: 右侧工具栏不一定显示,当右侧工具栏显示过一次后,就必须使用parent和right来计算left.width
  14. *
  15. */
  16. //left.css('width', parent.width() - right.outerWidth());
  17. //left.css('width', parent.width() - right.outerWidth());
  18. const percent = 100 - right.outerWidth() /parent.width() * 100;
  19. left.css('width', percent + '%');
  20. } else {
  21. left.width(parent.width());
  22. right.hide();
  23. }
  24. };
  25. $(document).ready(() => {
  26. autoFlashHeight();
  27. const payUtils = {
  28. tips: {
  29. name: function(data) {
  30. const tips = [];
  31. if (data) {
  32. if (data.pause) tips.push('当前项已停用');
  33. if (!data.is_yf) tips.push('当前项不参与本期应付计算');
  34. }
  35. return tips.join('<br/>');
  36. },
  37. range_tp: function (data) {
  38. if (!data || (!data.range_expr && !data.range_tp) || !data.dl_type) return '';
  39. if (data.dl_type === 1) {
  40. return '计提期限为(当 计量期数 ≥ ' + data.dl_count + ')';
  41. } else if (data.dl_type === 2) {
  42. switch (data.dl_tp_type) {
  43. case 'contract':
  44. return '计提期限为(累计合同计量 ≥ ' + data.dl_tp + ')';
  45. case 'qc':
  46. return '计提期限为(累计变更计量 ≥ ' + data.dl_tp + ')';
  47. case 'gather':
  48. return '计提期限为(累计完成计量 ≥ ' + data.dl_tp + ')';
  49. }
  50. }
  51. }
  52. },
  53. check: {
  54. isFixed: function(data) {
  55. return data.is_fixed;
  56. },
  57. isStarted: function (data) {
  58. return data.pre_used;
  59. },
  60. isYf: function(data) {
  61. return data.pay_type === 'bqyf';
  62. },
  63. isSf: function(data) {
  64. return data.pay_type === 'bqsf';
  65. },
  66. isGatherValid: function(data) {
  67. return !data.pay_type && (!data.children || data.children.length === 0);
  68. },
  69. isOwner: function(data) {
  70. return data.create_user_id === userID;
  71. },
  72. isFinish: function(data) {
  73. return data.pre_finish;
  74. },
  75. isYB: function() {
  76. return userID === phasePay.create_user_id;
  77. },
  78. isOld: function(data) {
  79. return data.phase_id !== data.create_phase_id;
  80. },
  81. isLock: function (data) {
  82. const result = !!lockPayExpr && payUtils.check.isStarted(data) && payCalc.hasBase(data.expr);
  83. return result;
  84. },
  85. tpReadOnly: function(data) {
  86. return payUtils.check.isYf(data) || (data.children && data.children.length > 0) || payUtils.check.isLock(data);
  87. },
  88. startTpReadOnly: function(data) {
  89. if (data.children && data.children.length > 0) return true;
  90. if (payUtils.check.isOld(data)) {
  91. return payUtils.check.isStarted(data) || !payUtils.check.isYB(data) || payUtils.check.isLock(data);
  92. } else {
  93. return payUtils.check.isSf(data) || payUtils.check.isYf(data) || !(payUtils.check.isOwner(data) || payUtils.check.isYB());
  94. }
  95. },
  96. rangeTpReadOnly: function(data) {
  97. if (data.children && data.children.length > 0) return true;
  98. if (payUtils.check.isOld(data)) {
  99. return !payUtils.check.isYB(data) || payUtils.check.isLock(data);
  100. } else {
  101. return payUtils.check.isYf(data) || !(payUtils.check.isOwner(data) || payUtils.check.isYB());
  102. }
  103. },
  104. },
  105. menuVisible: {
  106. pause: function (data) {
  107. if (payUtils.check.isOld(data)) {
  108. return payUtils.check.isYB();
  109. } else {
  110. return payUtils.check.isOwner(data) || payUtils.check.isYB();
  111. }
  112. },
  113. deadline: function (data) {
  114. if (payUtils.check.isOld(data)) {
  115. return !payUtils.check.isFinish(data) && payUtils.check.isYB();
  116. } else {
  117. return payUtils.check.isOwner(data) || payUtils.check.isYB();
  118. }
  119. }
  120. },
  121. };
  122. const payCalc = (function (b, a) {
  123. class PayCalc {
  124. constructor (bases, add) {
  125. this.percentReg = /((\d+)|((\d+)(\.\d+)))%/g;
  126. this.bases = bases;
  127. this.bases.sort(function (a, b) {
  128. return a.sort - b.sort;
  129. });
  130. for (const b of this.bases) {
  131. b.reg = new RegExp(b.code, 'igm');
  132. }
  133. this.addBase = add;
  134. this.orderReg = /f\d+/ig;
  135. this.nodeReg = /<<[a-z0-9\-]+>>/ig;
  136. this.firstNodeReg = /^<<[a-z0-9\-]+>>/ig;
  137. }
  138. hasBase(expr) {
  139. if (!expr) return false;
  140. for (const b of this.bases) {
  141. if (data.expr.indexOf(b.code) >= 0) return true;
  142. }
  143. return false;
  144. }
  145. trans2OrderExpr(expr, payTree) {
  146. const nodeParam = expr.match(this.nodeReg);
  147. if (nodeParam) {
  148. for (const op of nodeParam) {
  149. const id = op.substring(2, op.length - 2);
  150. const payNode = payTree.nodes.find(x => { return x.uuid === id; });
  151. expr = expr.replace(op, payNode ? `f${payTree.getNodeIndex(payNode) + 1}` || '' : 0);
  152. }
  153. }
  154. return expr;
  155. }
  156. trans2NodeExpr(expr, payTree) {
  157. const orderParam = expr.match(this.orderReg);
  158. if (orderParam) {
  159. for (const op of orderParam) {
  160. const order = parseInt(op.substring(1, op.length));
  161. const payNode = payTree.nodes[order - 1];
  162. expr = expr.replace(op, payNode ? `<<${payNode.uuid}>>` || '' : 0);
  163. }
  164. }
  165. return expr;
  166. }
  167. checkExprValid(expr, invalidParam, selfId, payTree) {
  168. if (!expr) return [true, ''];
  169. const param = [];
  170. let num = '', base = '';
  171. let fixedIdParam;
  172. for (let i = 0, iLen = expr.length; i < iLen; i++) {
  173. const subExpr = expr.substring(i, expr.length);
  174. if (/^[\d\.%]+/.test(expr[i])) {
  175. if (base !== '') {
  176. param.push({type: 'base', value: base});
  177. base = '';
  178. }
  179. num = num + expr[i];
  180. } else if (this.firstNodeReg.test(subExpr)) {
  181. if (num !== '') {
  182. param.push({type: 'num', value: num});
  183. num = '';
  184. }
  185. if (base !== '') {
  186. param.push({type: 'base', value: base});
  187. base = '';
  188. }
  189. // const node = this.nodeReg.exec(subExpr);
  190. const node = subExpr.match(this.firstNodeReg);
  191. param.push({type: 'node', value: node[0]});
  192. i = i + node[0].length - 1;
  193. } else if (/^[a-z]/.test(expr[i])) {
  194. if (num !== '') {
  195. param.push({type: 'num', value: num});
  196. num = '';
  197. }
  198. base = base + expr[i];
  199. } else if (expr[i] === '(') {
  200. if (num !== '') {
  201. param.push({type: 'num', value: num});
  202. num = '';
  203. }
  204. if (base !== '') {
  205. param.push({type: 'base', value: base});
  206. base = '';
  207. }
  208. param.push({type: 'left', value: '('});
  209. } else if (expr[i] === ')') {
  210. if (num !== '') {
  211. param.push({type: 'num', value: num});
  212. num = '';
  213. }
  214. if (base !== '') {
  215. param.push({type: 'base', value: base});
  216. base = '';
  217. }
  218. param.push({type: 'right', value: ')'});
  219. } else if (/^[\+\-*\/]/.test(expr[i])) {
  220. if (num !== '') {
  221. param.push({type: 'num', value: num});
  222. num = '';
  223. }
  224. if (base !== '') {
  225. param.push({type: 'base', value: base});
  226. base = '';
  227. }
  228. param.push({type: 'calc', value: expr[i]});
  229. } else {
  230. return [false, '输入的表达式含有非法字符: ' + expr[i]];
  231. }
  232. }
  233. if (num !== '') {
  234. param.push({type: 'num', value: num});
  235. num = '';
  236. }
  237. if (base !== '') {
  238. param.push({type: 'base', value: base});
  239. base = '';
  240. }
  241. if (param.length === 0) return [true, ''];
  242. if (param.length > 1) {
  243. if (param[0].value === '-' && param[1].type === 'num') {
  244. param[1].value = '-' + param[1].value;
  245. param.shift();
  246. }
  247. }
  248. const iLen = param.length;
  249. let iLeftCount = 0, iRightCount = 0;
  250. for (const [i, p] of param.entries()) {
  251. if (p.type === 'calc') {
  252. if (i === 0 || i === iLen - 1)
  253. return [false, '输入的表达式非法:计算符号' + p.value + '前后应有数字或计算基数'];
  254. }
  255. if (p.type === 'num') {
  256. num = p.value.replace('%', '');
  257. if (p.value.length - num.length > 1)
  258. return [false, '输入的表达式非法:' + p.value + '不是一个有效的数字'];
  259. num = _.toNumber(num);
  260. if (num === undefined || num === null || _.isNaN(num))
  261. return [false, '输入的表达式非法:' + p.value + '不是一个有效的数字'];
  262. if (i > 0) {
  263. if (param[i - 1].type !== 'calc' && param[i - 1].type !== 'left') {
  264. return [false, '输入的表达式非法:' + p.value + '前应有运算符'];
  265. } else if (param[i - 1].value === '/' && num === 0) {
  266. return [false, '输入的表达式非法:请勿除0'];
  267. }
  268. }
  269. }
  270. if (p.type === 'base') {
  271. const baseParam = _.find(calcBase, {code: p.value});
  272. if (!baseParam)
  273. return [false, '输入的表达式非法:不存在计算基数' + p.value];
  274. if (invalidParam && invalidParam.indexOf(p.value) >= 0)
  275. return [false, '不可使用计算基数' + p.value];
  276. if (i > 0 && (param[i - 1].type === 'num' || param[i - 1].type === 'right'))
  277. return [false, '输入的表达式非法:' + p.value + '前应有运算符'];
  278. }
  279. if (p.type === 'node') {
  280. if (!selfId) return [false, '输入的表达式错误:不支持行号引用'];
  281. if ([`<<${selfId}>>`].indexOf(p.value) >= 0) return [false, '输入的表达式非法:请勿引用自己'];
  282. if (!fixedIdParam) {
  283. fixedIdParam = payTree.nodes.filter(x => { return x.is_fixed; }).map(x => { return `<<${x.uuid}>>`});
  284. }
  285. if (fixedIdParam.indexOf(p.value) >= 0) return [false, '输入的表达式非法:请勿引用固定项'];
  286. }
  287. if (p.type === 'left') {
  288. iLeftCount += 1;
  289. if (i !== 0 && (param[i-1].type !== 'calc' || param[i-1].type !== 'left'))
  290. return [false, '输入的表达式非法:(前应有运算符'];
  291. }
  292. if (p.type === 'right') {
  293. iRightCount += 1;
  294. if (i !== iLen - 1 && param[i+1].type !== 'calc')
  295. return [false, '输入的表达式非法:)后应有运算符'];
  296. if (iRightCount > iLeftCount)
  297. return [false, '输入的表达式非法:")"前无对应的"("'];
  298. }
  299. }
  300. if (iLeftCount > iRightCount)
  301. return [false, '输入的表达式非法:"("后无对应的")"'];
  302. if (selfId) {
  303. const circular = payCalc.checkCircularExpr(expr, selfId, payTree);
  304. // 当前循环计算不检查父项
  305. if (circular) return [false, '输入的表达式非法:循环引用'];
  306. }
  307. return [true, ''];
  308. }
  309. checkSfExpr(text, data, payNode, payTree) {
  310. if (text) {
  311. const num = _.toNumber(text);
  312. if (num) {
  313. data.expr = num;
  314. } else {
  315. const expr = this.trans2NodeExpr($.trim(text).replace('\t', '').replace('=', '').toLowerCase(), payTree);
  316. const [valid, msg] = this.checkExprValid(expr, [], payNode.uuid, payTree);
  317. if (!valid) return [valid, msg];
  318. data.expr = expr;
  319. }
  320. } else {
  321. data.tp = 0;
  322. data.expr = '';
  323. }
  324. return [true, ''];
  325. }
  326. checkExpr(text, data, payNode, payTree) {
  327. if (text) {
  328. const num = _.toNumber(text);
  329. if (num) {
  330. data.tp = num;
  331. data.expr = '';
  332. } else {
  333. const expr = this.trans2NodeExpr($.trim(text).replace('\t', '').replace('=', '').toLowerCase(), payTree);
  334. const [valid, msg] = this.checkExprValid(expr, ['bqyf'], payNode.uuid, payTree);
  335. if (!valid) return [valid, msg];
  336. data.expr = expr;
  337. data.tp = 0;
  338. }
  339. } else {
  340. data.tp = 0;
  341. data.expr = '';
  342. }
  343. return [true, ''];
  344. }
  345. checkRangeExpr(payNode, text, data) {
  346. if (!payNode) return [false, '数据错误'];
  347. const num = text ? _.toNumber(text) || 0 : 0;
  348. let expr = text ? (num ? '' : text) : '';
  349. expr = expr ? $.trim(expr).replace('\t', '').replace('=', '').toLowerCase() : '';
  350. const [valid, msg] = this.checkExprValid(expr, ['bqwc', 'ybbqwc', 'bqht', 'bqbg', 'bqyf']);
  351. if (!valid) return [valid, msg];
  352. if (payUtils.check.isStarted(payNode)) {
  353. if (payUtils.check.isSf(payNode)) {
  354. const value = expr ? payCalc.calculateExpr(expr) : num;
  355. if (payNode.pre_tp && value < payNode.pre_tp) return [false, '截止上期已计量' + payNode.pre_tp + ',扣款限额请勿少于改值'];
  356. data.range_tp = num;
  357. data.range_expr = expr;
  358. return [true, ''];
  359. } else {
  360. // if (payNode.pre_finish) return [false, '已达扣款限额,请勿修改'];
  361. // const value = expr ? payCalc.calculateExpr(expr) : num;
  362. // if (payNode.pre_tp && value < payNode.pre_tp) return [false, '截止上期已计量' + payNode.pre_tp + ',扣款限额请勿少于改值'];
  363. // data.range_tp = num;
  364. // data.range_expr = expr;
  365. return [false, '已经开始使用,请勿修改扣款限额'];
  366. }
  367. } else {
  368. data.range_tp = num;
  369. data.range_expr = expr;
  370. return [true, ''];
  371. }
  372. }
  373. checkStartExpr(payNode, text, data) {
  374. if (!payNode) return [false, '数据错误'];
  375. const num = text ? _.toNumber(text) || 0 : 0;
  376. let expr = text ? (num ? '' : text) : '';
  377. expr = expr ? $.trim(expr).replace('\t', '').replace('=', '').toLowerCase() : '';
  378. const [valid, msg] = this.checkExprValid(expr, ['bqwc', 'ybbqwc', 'bqht', 'bqbg', 'bqyf']);
  379. if (!valid) return [valid, msg];
  380. if (payUtils.check.isStarted(payNode)) {
  381. return [false, '已经开始计量,请勿修改起扣金额'];
  382. } else {
  383. if (this.addBase.pre_gather_tp) {
  384. const value = expr ? payCalc.calculateExpr(expr) : num;
  385. if (this.addBase.pre_gather_tp && value < this.addBase.pre_gather_tp)
  386. return [false, '起扣金额请勿少于本期完成截止上期计量金额' + this.addBase.pre_gather_tp];
  387. data.start_tp = num;
  388. data.start_expr = expr;
  389. return [true, ''];
  390. } else {
  391. data.start_tp = num;
  392. data.start_expr = expr;
  393. return [true, ''];
  394. }
  395. }
  396. }
  397. getExprInfo(field, converse = false) {
  398. const exprField = [
  399. {qty: 'tp', expr: 'expr'},
  400. {qty: 'start_tp', expr: 'start_expr'},
  401. {qty: 'range_qty', expr: 'range_expr'},
  402. ];
  403. if (converse) return _.find(exprField, { expr: field });
  404. return _.find(exprField, {qty: field});
  405. }
  406. getLeafOrder(data, parentReg, tree) {
  407. if (!data) return [];
  408. const defaultResult = data.uuid ? [`<<${data.uuid}>>`] : [];
  409. if (!data.expr) return defaultResult;
  410. const nodeParam = data.expr.match(this.nodeReg);
  411. if (!nodeParam || nodeParam.length === 0) return defaultResult;
  412. const result = [];
  413. for (const op of nodeParam) {
  414. const id = op.substring(2, op.length - 2);
  415. if (data.uuid === id || op === parentReg) {
  416. result.push(op);
  417. } else {
  418. const payNode = tree.nodes.find(x => {return x.uuid === id; });
  419. const subOrderParam = this.getLeafOrder(payNode, data.uuid ? `<<${data.uuid}>>` : parentReg, tree);
  420. result.push(...subOrderParam);
  421. }
  422. }
  423. return result;
  424. }
  425. checkCircularExpr(expr, selfId, tree) {
  426. const leafOrder = this.getLeafOrder({expr}, `<<${selfId}>>`, tree);
  427. if (leafOrder.indexOf(`<<${selfId}>>`) >= 0) return true;
  428. return false;
  429. }
  430. calculateExpr(expr) {
  431. let formula = expr;
  432. for (const b of this.bases) {
  433. formula = formula.replace(b.reg, b.value);
  434. }
  435. const percent = formula.match(this.percentReg);
  436. if (percent) {
  437. for (const p of percent) {
  438. const v = math.evaluate(p.replace(new RegExp('%', 'gm'), '/100'));
  439. formula = formula.replace(p, v);
  440. }
  441. }
  442. try {
  443. const value = ZhCalc.mathCalcExpr(formula);
  444. return value;
  445. } catch(err) {
  446. return 0;
  447. }
  448. }
  449. refreshBaseHtml() {
  450. const html = [];
  451. for (const [i, b] of this.bases.entries()) {
  452. html.push('<tr>');
  453. html.push(`<td>${i+1}</td><td>${b.name}</td><td>${b.code}</td>`);
  454. if (b.code === 'bqyf') {
  455. html.push('<td class="text-right">--</td>');
  456. } else {
  457. html.push(`<td class="text-right">${b.formatValue}</td>`);
  458. }
  459. html.push('</tr>');
  460. }
  461. $('#base-list').html(html.join(''));
  462. }
  463. reloadBase(bases, add) {
  464. this.bases = bases;
  465. this.refreshBaseHtml();
  466. this.bases.sort(function (a, b) {
  467. return a.sort - b.sort;
  468. });
  469. for (const b of this.bases) {
  470. b.reg = new RegExp(b.code, 'igm');
  471. }
  472. this.addBase = add;
  473. }
  474. }
  475. return new PayCalc(b, a);
  476. })(calcBase, addBase);
  477. const payObj = (function() {
  478. const spread = SpreadJsObj.createNewSpread($('#pay-spread')[0]);
  479. const sheet = spread.getActiveSheet();
  480. const spreadSetting = {
  481. cols: [
  482. {title: '名称', colSpan: '1', rowSpan: '1', field: 'name', hAlign: 0, width: 230, formatter: '@', cellType: 'tree', getTip: payUtils.tips.name},
  483. {title: '本期金额(F)', colSpan: '1', rowSpan: '1', field: 'tp', hAlign: 2, width: 100, type: 'Number'},
  484. {title: '截止上期金额', colSpan: '1', rowSpan: '1', field: 'pre_tp', hAlign: 2, width: 100, readOnly: true, type: 'Number'},
  485. {title: '截止本期金额', colSpan: '1', rowSpan: '1', field: 'end_tp', hAlign: 2, width: 100, readOnly: true, type: 'Number'},
  486. {title: '起扣金额', colSpan: '1', rowSpan: '1', field: 'start_tp', hAlign: 2, width: 100, type: 'Number'},
  487. {title: '付(扣)款限额', colSpan: '1', rowSpan: '1', field: 'range_tp', hAlign: 2, width: 100, cellType: 'tip', type: 'Number', getTip: payUtils.tips.range_tp},
  488. {title: '汇总', colSpan: '1', rowSpan: '1', field: 'is_gather', hAlign: 1, width: 60, cellType: 'signalCheckbox', show: payUtils.check.isGatherValid},
  489. {title: '本期批注', colSpan: '1', rowSpan: '1', field: 'postil', hAlign: 0, width: 120, formatter: '@', cellType: 'autoTip'},
  490. ],
  491. emptyRows: 0,
  492. headRows: 1,
  493. headRowHeight: [32],
  494. headColWidth: [30],
  495. defaultRowHeight: 21,
  496. headerFont: '12px 微软雅黑',
  497. font: '12px 微软雅黑',
  498. readOnly: readOnly,
  499. localCache: {
  500. key: 'phase-pay',
  501. colWidth: true,
  502. },
  503. pos: SpreadJsObj.getObjPos($('#pay-spread')[0]),
  504. getColor: function (sheet, data, row, col, defaultColor) {
  505. if (!data) return defaultColor;
  506. if (data.expr && data.expr.indexOf('#ref!') >= 0) {
  507. return spreadColor.pay.expr_err;
  508. } else if (data.is_pause) {
  509. return '#f2f2f2';
  510. } else if (data.create_phase_order > 1 && data.create_phase_order === phasePay.phase_order) {
  511. return '#FFFFE1';
  512. } else {
  513. return defaultColor;
  514. }
  515. }
  516. };
  517. sjsSettingObj.setFxTreeStyle(spreadSetting, sjsSettingObj.FxTreeStyle.phasePay);
  518. SpreadJsObj.initSheet(sheet, spreadSetting);
  519. const payTree = createNewPathTree('base', {
  520. id: 'tree_id', pid: 'tree_pid', order: 'tree_order',
  521. level: 'tree_level', isLeaf: 'tree_is_leaf', fullPath: 'tree_full_path',
  522. rootId: -1,
  523. });
  524. const payEvent = {
  525. refreshActn: function() {
  526. const setObjEnable = function (obj, enable) {
  527. if (enable) {
  528. obj.removeClass('disabled');
  529. } else {
  530. obj.addClass('disabled');
  531. }
  532. };
  533. const select = SpreadJsObj.getSelectObject(sheet);
  534. if (!select) {
  535. setObjEnable($('a[name=base-opr][type=add]'), false);
  536. setObjEnable($('a[name=base-opr][type=del]'), false);
  537. setObjEnable($('a[name=base-opr][type=up-move]'), false);
  538. setObjEnable($('a[name=base-opr][type=down-move]'), false);
  539. return;
  540. }
  541. const preNode = payTree.getPreSiblingNode(select);
  542. setObjEnable($('a[name=base-opr][type=add]'), !readOnly && !payUtils.check.isSf(select) && !payUtils.check.isYf(select));
  543. const delValid = !payUtils.check.isFixed(select) && !payUtils.check.isStarted(select) && payUtils.check.isOwner(select);
  544. setObjEnable($('a[name=base-opr][type=delete]'), !readOnly && delValid);
  545. setObjEnable($('a[name=base-opr][type=up-move]'), !readOnly && !payUtils.check.isFixed(select) && preNode);
  546. setObjEnable($('a[name=base-opr][type=down-move]'), !readOnly && !payUtils.check.isFixed(select) && !payTree.isLastSibling(select));
  547. },
  548. loadExprToInput: function() {
  549. const sel = sheet.getSelections()[0];
  550. const col = sheet.zh_setting.cols[sel.col];
  551. const data = SpreadJsObj.getSelectObject(sheet);
  552. if (data && (!data.children || data.children.length === 0)) {
  553. if (col.field === 'tp') {
  554. const expr = payCalc.trans2OrderExpr(data.expr, payTree);
  555. $('#pay-expr').val(expr).attr('field', 'expr').attr('org', expr)
  556. .attr('readOnly', readOnly|| payUtils.check.tpReadOnly(data));
  557. } else if (col.field === 'start_tp') {
  558. const expr = payCalc.trans2OrderExpr(data.start_expr, payTree) || data.start_tp;
  559. $('#pay-expr').val(expr).attr('field', 'start_expr').attr('org', expr)
  560. .attr('readOnly', readOnly|| payUtils.check.startTpReadOnly(data) || payUtils.check.isYf(data));
  561. } else if (col.field === 'range_tp') {
  562. const expr = payCalc.trans2OrderExpr(data.range_expr, payTree);
  563. $('#pay-expr').val(expr).attr('field', 'range_expr').attr('org', expr)
  564. .attr('readOnly', readOnly|| payUtils.check.rangeTpReadOnly(data) || payUtils.check.isYf(data));
  565. } else {
  566. $('#pay-expr').val('').attr('readOnly', true);
  567. }
  568. $('#pay-expr').attr('data-row', sel.row);
  569. } else {
  570. $('#pay-expr').val('').attr('readOnly', true);
  571. $('#pay-expr').removeAttr('data-row');
  572. }
  573. },
  574. refreshTree: function (data) {
  575. SpreadJsObj.massOperationSheet(sheet, function () {
  576. const tree = sheet.zh_tree;
  577. // 处理删除
  578. if (data.delete) {
  579. data.delete.sort(function (a, b) {
  580. return b.deleteIndex - a.deleteIndex;
  581. });
  582. for (const d of data.delete) {
  583. sheet.deleteRows(d.deleteIndex, 1);
  584. }
  585. }
  586. // 处理新增
  587. if (data.create) {
  588. const newNodes = data.create;
  589. if (newNodes) {
  590. newNodes.sort(function (a, b) {
  591. return a.index - b.index;
  592. });
  593. for (const node of newNodes) {
  594. sheet.addRows(node.index, 1);
  595. SpreadJsObj.reLoadRowData(sheet, tree.nodes.indexOf(node), 1);
  596. }
  597. }
  598. }
  599. // 处理更新
  600. if (data.update) {
  601. const rows = [];
  602. for (const u of data.update) {
  603. rows.push(tree.nodes.indexOf(u));
  604. }
  605. SpreadJsObj.reLoadRowsData(sheet, rows);
  606. }
  607. });
  608. },
  609. editStarting: function(e, info) {
  610. const col = info.sheet.zh_setting.cols[info.col];
  611. const select = SpreadJsObj.getSelectObject(info.sheet);
  612. switch (col.field) {
  613. case 'name':
  614. info.cancel = payUtils.check.isFixed(select);
  615. break;
  616. case 'tp':
  617. info.cancel = payUtils.check.tpReadOnly(select);
  618. break;
  619. case 'is_gather':
  620. info.cancel = !payUtils.check.isGatherValid(select);
  621. break;
  622. case 'start_tp':
  623. info.cancel = payUtils.check.startTpReadOnly(select);
  624. break;
  625. case 'range_tp':
  626. info.cancel = payUtils.check.rangeTpReadOnly(select);
  627. break;
  628. case 'is_gather':
  629. info.cancel = true;
  630. break;
  631. }
  632. if (col.field === 'tp') {
  633. if (select.expr && select.expr !== '') {
  634. info.sheet.getCell(info.row, info.col).text(payCalc.trans2OrderExpr(select.expr, payTree));
  635. }
  636. } else if (col.field === 'start_tp') {
  637. if (select.start_expr && select.start_expr !== '') {
  638. info.sheet.getCell(info.row, info.col).text(select.start_expr);
  639. }
  640. } else if (col.field === 'range_tp') {
  641. if (select.range_expr && select.range_expr !== '') {
  642. info.sheet.getCell(info.row, info.col).text(select.range_expr);
  643. }
  644. }
  645. },
  646. editEnded: function(e, info) {
  647. if (!info.sheet.zh_setting) return;
  648. const select = SpreadJsObj.getSelectObject(info.sheet);
  649. const col = info.sheet.zh_setting.cols[info.col];
  650. if (col.field === 'is_gather') return;
  651. // 未改变值则不提交
  652. const validText = info.editingText ? info.editingText.replace('\n', '') : '';
  653. let orgValue;
  654. if (col.field === 'tp') {
  655. orgValue = select.expr ? payCalc.trans2OrderExpr(select.expr, payTree) : select.tp;
  656. } else if (col.field === 'start_tp') {
  657. orgValue = select.start_expr ? select.start_expr : select.start_tp;
  658. } else if (col.field === 'range_tp') {
  659. orgValue = select.range_expr ? select.range_expr : select.range_tp;
  660. } else {
  661. orgValue = select[col.field];
  662. }
  663. orgValue = orgValue || '';
  664. if (orgValue == validText) {
  665. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  666. return;
  667. }
  668. const data = { postType: 'update', postData: { id: select.id } };
  669. switch(col.field) {
  670. case 'tp':
  671. const [tpValid, tpMsg] = payUtils.check.isSf(select)
  672. ? payCalc.checkSfExpr(validText, data.postData, select, payTree)
  673. : payCalc.checkExpr(validText, data.postData, select, payTree);
  674. if (!tpValid) {
  675. toastr.warning(tpMsg);
  676. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  677. return;
  678. }
  679. break;
  680. case 'start_tp':
  681. const [sValid, sMsg] = payCalc.checkStartExpr(select, validText, data.postData);
  682. if (!sValid) {
  683. toastr.warning(sMsg);
  684. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  685. return;
  686. }
  687. break;
  688. case 'range_tp':
  689. const [rValid, rMsg] = payCalc.checkRangeExpr(select, validText, data.postData);
  690. if (!rValid) {
  691. toastr.warning(rMsg);
  692. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  693. return;
  694. }
  695. break;
  696. default:
  697. if (col.type === 'Number') {
  698. data.postData[col.field] = _.toNumber(validText) || 0;
  699. } else {
  700. data.postData[col.field] = validText || '';
  701. }
  702. break;
  703. }
  704. postData('update', data, function (result) {
  705. if (result.reload) {
  706. payEvent.reloadPays(result.reload);
  707. } else {
  708. const refreshData = payTree.loadPostData(result);
  709. payEvent.refreshTree(refreshData);
  710. }
  711. }, function () {
  712. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  713. });
  714. },
  715. selectionChanged: function(e, info) {
  716. if (info.newSelections) {
  717. if (!info.oldSelections || info.newSelections[0].row !== info.oldSelections[0].row) {
  718. payEvent.refreshActn();
  719. payFile.getCurAttHtml(SpreadJsObj.getSelectObject(info.sheet))
  720. }
  721. }
  722. payEvent.loadExprToInput();
  723. },
  724. buttonClicked: function (e, info) {
  725. if (!info.sheet.zh_setting) return;
  726. const select = SpreadJsObj.getSelectObject(info.sheet);
  727. const col = info.sheet.zh_setting.cols[info.col];
  728. if (col.field !== 'is_gather') return;
  729. if (!payUtils.check.isGatherValid(select)) return;
  730. if (info.sheet.isEditing()) info.sheet.endEdit(true);
  731. const data = {
  732. postType: 'update',
  733. postData: { id: select.id },
  734. };
  735. data.postData[col.field] = info.sheet.getValue(info.row, info.col) || 0;
  736. // 更新至服务器
  737. postData('update', data, function (result) {
  738. if (result.reload) payEvent.reloadPays(result.reload);
  739. });
  740. },
  741. deletePress: function (sheet) {
  742. if (!sheet.zh_setting) return;
  743. const sel = sheet.getSelections()[0];
  744. if (!sel) return;
  745. const col = sheet.zh_setting.cols[sel.col];
  746. if (col.readOnly === true) return;
  747. if (sel.colCount > 1) toastr.warning('请勿同时删除多列数据');
  748. const data = { postType: 'update', postData: [] };
  749. for (let iRow = sel.row; iRow < sel.row + sel.rowCount; iRow ++) {
  750. const node = sheet.zh_tree.nodes[iRow];
  751. if (node && (!node.pay_type || col.field === 'postil')) {
  752. const updateData = { id: node.id };
  753. switch(col.field) {
  754. case 'tp':
  755. updateData.tp = 0;
  756. updateData.expr = '';
  757. break;
  758. case 'start_tp':
  759. updateData.start_tp = 0;
  760. updateData.start_expr = '';
  761. break;
  762. case 'range_tp':
  763. updateData.range_tp = 0;
  764. updateData.range_expr = '';
  765. break;
  766. case 'is_gather':
  767. updateData.is_gather = 0;
  768. break;
  769. default:
  770. updateData[col.field] = col.type === 'Number' ? 0 : '';
  771. }
  772. data.postData.push(updateData);
  773. }
  774. }
  775. if (data.postData.length === 0) return;
  776. postData('update', data, function (result) {
  777. if (result.reload) {
  778. payEvent.reloadPays(result.reload);
  779. } else {
  780. const refreshData = payTree.loadPostData(result);
  781. payEvent.refreshTree(refreshData);
  782. }
  783. }, function () {
  784. SpreadJsObj.reLoadRowData(sheet, sel.row, sel.rowCount);
  785. });
  786. },
  787. baseOpr: function(type) {
  788. const self = this;
  789. const node = SpreadJsObj.getSelectObject(sheet);
  790. if (type === 'delete') {
  791. postData('update', { postType: 'delete', postData: { id: node.tree_id }}, function(result) {
  792. payEvent.reloadPays(result.reload);
  793. });
  794. } else {
  795. postData('update', { postType: type, postData: { id: node.tree_id }}, function (result) {
  796. const refreshData = payTree.loadPostData(result);
  797. payEvent.refreshTree(refreshData);
  798. const sel = sheet.getSelections()[0];
  799. if (sel) {
  800. if (['up-move', 'down-move'].indexOf(type) > -1) {
  801. sheet.setSelection(payTree.getNodeIndex(node), sel.col, sel.rowCount, sel.colCount);
  802. SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, payTree.getNodeIndex(node)]);
  803. } else if (type === 'add') {
  804. sheet.setSelection(payTree.getNodeIndex(refreshData.create[0]), sel.col, sel.rowCount, sel.colCount);
  805. SpreadJsObj.reloadRowsBackColor(sheet, [sel.row, payTree.getNodeIndex(refreshData.create[0])]);
  806. }
  807. }
  808. self.refreshActn(sheet);
  809. });
  810. }
  811. },
  812. calculateAll: function() {
  813. postData('update', { postType: 'calc', postData: {}}, function (result) {
  814. payEvent.reloadPays(result.reload);
  815. });
  816. },
  817. reloadCalcBase: function() {
  818. postData('update', { postType: 'refreshBase', postData: {}}, function (result) {
  819. payEvent.reloadPays(result.reload);
  820. payCalc.reloadBase(result.calcBase, result.addBase);
  821. });
  822. },
  823. reloadPays: function(datas){
  824. payTree.loadDatas(datas);
  825. SpreadJsObj.loadSheetData(sheet, SpreadJsObj.DataType.Tree, payTree);
  826. payEvent.refreshActn();
  827. },
  828. };
  829. spread.bind(spreadNS.Events.SelectionChanged, payEvent.selectionChanged);
  830. if (!readOnly) {
  831. spread.bind(spreadNS.Events.EditStarting, payEvent.editStarting);
  832. spread.bind(spreadNS.Events.EditEnded, payEvent.editEnded);
  833. spread.bind(spreadNS.Events.ButtonClicked, payEvent.buttonClicked);
  834. SpreadJsObj.addDeleteBind(spread, payEvent.deletePress);
  835. $('a[name="base-opr"]').click(function () {
  836. payEvent.baseOpr(this.getAttribute('type'));
  837. });
  838. $('#pay-expr').bind('change onblur', function () {
  839. if (this.readOnly) return;
  840. const expr = $(this);
  841. const row = expr.attr('data-row') ? _.toInteger(expr.attr('data-row')) : -1;
  842. const select = payTree.nodes[row];
  843. const field = expr.attr('field'), orgValue = expr.attr('org'), newValue = expr.val();
  844. if (orgValue === newValue || (!orgValue && newValue == '')) { return; }
  845. const data = { postType: 'update' };
  846. if (field === 'expr') {
  847. data.postData = { id: select.id, tp: 0, expr: newValue };
  848. const [valid, msg] = payUtils.check.isSf(select)
  849. ? payCalc.checkSfExpr(newValue, data.postData, select, payTree)
  850. : payCalc.checkExpr(newValue, data.postData, select, payTree);
  851. if (!valid) {
  852. toastr.warning(msg);
  853. this.value = select.expr;
  854. return;
  855. }
  856. } else if (field === 'start_expr') {
  857. data.updateData = {id: select.id};
  858. const [valid, msg] = payCalc.checkStartExpr(select, newValue, data.postData);
  859. if (!valid) {
  860. toastr.warning(msg);
  861. this.value = select.start_expr;
  862. return;
  863. }
  864. } else if (field === 'range_expr') {
  865. data.updateData = {id: select.id};
  866. const [valid, msg] = payCalc.checkRangeExpr(select, newValue, data.postData);
  867. if (!valid) {
  868. toastr.warning(msg);
  869. this.value = select.range_expr;
  870. return;
  871. }
  872. } else {
  873. expr.val('');
  874. return;
  875. }
  876. // 更新至服务器
  877. postData('update', data, function (result) {
  878. if (result.reload) {
  879. payEvent.reloadPays(result.reload);
  880. } else {
  881. const refreshData = payTree.loadPostData(result);
  882. payEvent.refreshTree(refreshData);
  883. }
  884. });
  885. });
  886. $('#calc-all').click(function() {
  887. payEvent.calculateAll();
  888. });
  889. $('#reload-calc-base').click(function() {
  890. payEvent.reloadCalcBase();
  891. });
  892. const deadlineObj = {
  893. payNode: null,
  894. refreshHint: function() {
  895. const dlType = $('[name=dl-type]:checked').val();
  896. const dt = deadlineType[dlType];
  897. if (dlType && dt) {
  898. const dlValue = $('#dl-value').val();
  899. $('#range-hint').text(`当 ${dt.name} >= ${dlValue} 时 `);
  900. $('#dl-hint').show();
  901. } else {
  902. $('#dl-hint').hide();
  903. }
  904. },
  905. initView: function(data) {
  906. this.payNode = data;
  907. $('#dl-pay-name').html(data.name);
  908. // 模式
  909. if (data.dl_type) {
  910. $('[name=dl-type][value=' + data.dl_type +']')[0].checked = true;
  911. } else {
  912. $('#dl-type-none')[0].checked = true;
  913. }
  914. $('#dl-value').val(data.dl_value);
  915. this.refreshHint();
  916. },
  917. getDlCount: function() {
  918. try {
  919. const result = parseInt($('#dl-value').val());
  920. if (result <= 0) throw '限制值请输入正整数';
  921. return result;
  922. } catch (err) {
  923. toastr.warning('限制值请输入正整数');
  924. return 0;
  925. }
  926. },
  927. getDlTp: function() {
  928. try {
  929. const result = parseFloat($('#dl-value').val());
  930. return result;
  931. } catch (err) {
  932. toastr.warning('限制值请输入数值');
  933. return 0;
  934. }
  935. },
  936. getUpdateData: function() {
  937. const result = { postType: 'update', postData: { id: this.payNode.id } };
  938. result.postData.dl_type = $('[name=dl-type]:checked').val();
  939. if (result.postData.dl_type) {
  940. if (result.postData.dl_type === deadlineType.phaseCount.key) {
  941. result.postData.dl_value = this.getDlCount();
  942. if (result.postData.dl_value < phasePay.phase_order) {
  943. toastr.warning(`已计量至第${phasePay.phase_order}期,计提期限不可小于该期`);
  944. return null;
  945. }
  946. } else if (result.postData.dl_type === deadlineType.stageCount.key) {
  947. result.postData.dl_value = this.getDlCount();
  948. if (result.postData.dl_value < maxStageOrder) {
  949. toastr.warning(`已计量至第${maxStageOrder}期,计提期限不可小于该期`);
  950. return null;
  951. }
  952. } else {
  953. result.postData.dl_value = this.getDlTp();
  954. const dt = deadlineType[result.postData.dl_type];
  955. if (!dt) {
  956. toastr.warning('限制模式错误,请刷新页面重试');
  957. return null;
  958. }
  959. const compareValue = payCalc.addBase[`pre_${dt.key}_tp`];
  960. if (result.postData.dl_type < compareValue) {
  961. toastr.warning(`截止上期,${dt.name}已计量${compareValue},计提期限不可小于该值`);
  962. return null;
  963. }
  964. }
  965. } else {
  966. result.postData.dl_value = 0;
  967. }
  968. return result;
  969. },
  970. };
  971. $('[name=dl-type]').change(deadlineObj.refreshHint);
  972. $('#dl-value').change(deadlineObj.refreshHint);
  973. $('#deadline-ok').click(function() {
  974. const updateData = deadlineObj.getUpdateData();
  975. if (!updateData) return;
  976. postData('update', updateData, function(result) {
  977. payEvent.reloadPays(result.reload);
  978. $('#deadline').modal('hide');
  979. });
  980. });
  981. // 右键菜单
  982. $.contextMenu({
  983. selector: '#pay-spread',
  984. build: function ($trigger, e) {
  985. const target = SpreadJsObj.safeRightClickSelection($trigger, e, spread);
  986. return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
  987. },
  988. items: {
  989. 'start': {
  990. name: '启用',
  991. icon: 'fa-play',
  992. callback: function (key, opt) {
  993. const select = SpreadJsObj.getSelectObject(sheet);
  994. const data = {
  995. postType: 'update',
  996. postData: { id: select.id, is_pause: 0 }
  997. };
  998. // 更新至服务器
  999. postData('update', data, function (result) {
  1000. payEvent.reloadPays(result.reload);
  1001. });
  1002. },
  1003. visible: function (key, opt) {
  1004. const select = SpreadJsObj.getSelectObject(sheet);
  1005. return (!select.children || select.children.length ===0) && !readOnly && select.is_pause && payUtils.menuVisible.pause(select);
  1006. }
  1007. },
  1008. 'stop': {
  1009. name: '停用',
  1010. icon: 'fa-pause',
  1011. callback: function (key, opt) {
  1012. const select = SpreadJsObj.getSelectObject(sheet);
  1013. const data = {
  1014. postType: 'update',
  1015. postData: { id: select.id, is_pause: 1 }
  1016. };
  1017. // 更新至服务器
  1018. postData('update', data, function (result) {
  1019. payEvent.reloadPays(result.reload);
  1020. });
  1021. },
  1022. visible: function (key, opt) {
  1023. const select = SpreadJsObj.getSelectObject(sheet);
  1024. return (!select.children || select.children.length === 0) && !readOnly && !select.is_pause && payUtils.menuVisible.pause(select);
  1025. },
  1026. },
  1027. 'setDeadline': {
  1028. name: '设置计提期限',
  1029. icon: 'fa-clipboard',
  1030. callback: function (key, opt) {
  1031. const select = SpreadJsObj.getSelectObject(sheet);
  1032. if (select.range_tp) {
  1033. deadlineObj.initView(select);
  1034. $('#deadline').modal('show');
  1035. } else {
  1036. toastr.warning('计提期限用于达到条件时,即刻计量至付(扣)款限额,应先设置付(扣)款限额');
  1037. }
  1038. },
  1039. visible: function (key, opt) {
  1040. const select = SpreadJsObj.getSelectObject(sheet);
  1041. return (!select.children || select.children.length === 0) && !readOnly && payUtils.menuVisible.deadline(select);
  1042. }
  1043. },
  1044. }
  1045. });
  1046. }
  1047. return { spread, sheet, payTree, loadDatas: payEvent.reloadPays }
  1048. })();
  1049. payObj.loadDatas(details);
  1050. const payFile = $.ledger_att({
  1051. selector: '#fujian',
  1052. key: 'uuid',
  1053. masterKey: 'rela_id',
  1054. uploadUrl: 'file/upload',
  1055. deleteUrl: 'file/delete',
  1056. checked: false,
  1057. zipName: `附件.zip`,
  1058. readOnly: false,
  1059. fileIdType: 'string',
  1060. fileInfo: {
  1061. user_name: 'user_name',
  1062. user_id: 'user_id',
  1063. create_time: 'create_time',
  1064. },
  1065. getCurHint: function(node) {
  1066. return`${node.name || ''}`;
  1067. },
  1068. locate: function (att) {
  1069. if (!att) return;
  1070. SpreadJsObj.locateTreeNode(payObj.sheet, att.node.tree_id, true);
  1071. payFile.getCurAttHtml(att.node);
  1072. }
  1073. });
  1074. // 展开收起标准清单
  1075. $('a', '#side-menu').bind('click', function (e) {
  1076. e.preventDefault();
  1077. const tab = $(this), tabPanel = $(tab.attr('content'));
  1078. // 展开工具栏、切换标签
  1079. if (!tab.hasClass('active')) {
  1080. // const close = $('.active', '#side-menu').length === 0;
  1081. $('a', '#side-menu').removeClass('active');
  1082. $('.tab-content .tab-select-show.tab-pane.active').removeClass('active');
  1083. tab.addClass('active');
  1084. tabPanel.addClass('active');
  1085. // $('.tab-content .tab-pane').removeClass('active');
  1086. showSideTools(tab.hasClass('active'));
  1087. } else { // 收起工具栏
  1088. tab.removeClass('active');
  1089. tabPanel.removeClass('active');
  1090. showSideTools(tab.hasClass('active'));
  1091. }
  1092. payObj.spread.refresh();
  1093. });
  1094. postData('load', {filter: 'file'}, function(result) {
  1095. for (const f of result.file) {
  1096. f.node = payObj.payTree.datas.find(x => { return x.uuid === f.rela_id; });
  1097. }
  1098. payFile.loadDatas(result.file);
  1099. payFile.getCurAttHtml(SpreadJsObj.getSelectObject(payObj.sheet));
  1100. });
  1101. // 工具栏spr
  1102. $.divResizer({
  1103. select: '#right-spr',
  1104. callback: function () {
  1105. payObj.spread.refresh();
  1106. }
  1107. });
  1108. // todo 加载审批列表
  1109. $.subMenu({
  1110. menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
  1111. toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
  1112. key: 'menu.1.0.0',
  1113. miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
  1114. callback: function (info) {
  1115. if (info.mini) {
  1116. $('.panel-title').addClass('fluid');
  1117. $('#sub-menu').removeClass('panel-sidebar');
  1118. } else {
  1119. $('.panel-title').removeClass('fluid');
  1120. $('#sub-menu').addClass('panel-sidebar');
  1121. }
  1122. autoFlashHeight();
  1123. payObj.spread.refresh();
  1124. }
  1125. });
  1126. });