setrules.ui.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. $(function()
  2. {
  3. replaceExample();
  4. $(document).on('keyup', 'input', function(){replaceExample()});
  5. });
  6. function replaceExample()
  7. {
  8. let html = '';
  9. let startTask = $('[id*=start]').val().split(';');
  10. let taskModule = $('[id*=module][id*=task]').val().split(';');
  11. let idMark = $('[id*=id][id*=mark]').val().split(';');
  12. let idSplit = $('[id*=id][id*=split]').val().split(';');
  13. let costs = $('[id*=task][id*=consumed]').val().split(';');
  14. let consumedmark = $('[id*=mark][id*=consumed]').val().split(';');
  15. let lefts = $('[id*=task][id*=left]').val().split(';');
  16. let leftMarks = $('[id*=mark][id*=left]').val().split(';');
  17. let cunits = $('[id*=unit][id*=consumed]').val().split(';');
  18. let lunits = $('[id*=unit][id*=left]').val().split(';');
  19. for(let i in startTask)
  20. {
  21. start = startTask[i];
  22. for(let j in taskModule)
  23. {
  24. task = taskModule[j];
  25. for(let k in idMark)
  26. {
  27. id = idMark[k];
  28. for(let l in idSplit)
  29. {
  30. split = idSplit[l];
  31. for(let m in costs)
  32. {
  33. cost = costs[m];
  34. for(let n in consumedmark)
  35. {
  36. consumed = consumedmark[n];
  37. for(let o in lefts)
  38. {
  39. left = lefts[o];
  40. for(let p in leftMarks)
  41. {
  42. leftMark = leftMarks[p];
  43. for(let q in cunits)
  44. {
  45. cunit = cunits[q];
  46. for(let r in lunits)
  47. {
  48. lunit = lunits[r];
  49. html += '<br />' + rulesExample['task']['start'].replace('%start%', start)
  50. .replace('%task%', task)
  51. .replace('%id%', id)
  52. .replace('%split%', split)
  53. .replace('%cost%', cost)
  54. .replace('%consumedmark%', consumed)
  55. .replace('%left%', left)
  56. .replace('%leftmark%', leftMark)
  57. .replace('%cunit%', cunit)
  58. .replace('%lunit%', lunit);
  59. }
  60. }
  61. }
  62. }
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. let finishTask = $('[id*=finish]').val().split(';');
  70. for(let i in finishTask)
  71. {
  72. finish = finishTask[i];
  73. for(let j in taskModule)
  74. {
  75. task = taskModule[j];
  76. for(let k in idMark)
  77. {
  78. id = idMark[k];
  79. for(let l in idSplit)
  80. {
  81. split = idSplit[l];
  82. for(let m in costs)
  83. {
  84. cost = costs[m];
  85. for(let n in consumedmark)
  86. {
  87. consumed = consumedmark[n];
  88. for(let o in cunits)
  89. {
  90. cunit = cunits[o];
  91. html += '<br />' + rulesExample['task']['finish'].replace('%finish%', finish)
  92. .replace('%task%', task)
  93. .replace('%id%', id)
  94. .replace('%split%', split)
  95. .replace('%cost%', cost)
  96. .replace('%consumedmark%', consumed)
  97. .replace('%cunit%', cunit);
  98. }
  99. }
  100. }
  101. }
  102. }
  103. }
  104. }
  105. let effortTask = $('[id*=logEfforts]').val().split(';');
  106. for(let i in effortTask)
  107. {
  108. effort = effortTask[i];
  109. for(let j in taskModule)
  110. {
  111. task = taskModule[j];
  112. for(let k in idMark)
  113. {
  114. id = idMark[k];
  115. for(let l in idSplit)
  116. {
  117. split = idSplit[l];
  118. for(let m in costs)
  119. {
  120. cost = costs[m];
  121. for(let n in consumedmark)
  122. {
  123. consumed = consumedmark[n];
  124. for(let o in lefts)
  125. {
  126. left = lefts[o];
  127. for(let p in leftMarks)
  128. {
  129. leftMark = leftMarks[p];
  130. for(let q in cunits)
  131. {
  132. cunit = cunits[q];
  133. for(let r in lunits)
  134. {
  135. lunit = lunits[r];
  136. html += '<br />' + rulesExample['task']['effort'].replace('%effort%', effort)
  137. .replace('%task%', task)
  138. .replace('%id%', id)
  139. .replace('%split%', split)
  140. .replace('%cost%', cost)
  141. .replace('%consumedmark%', consumed)
  142. .replace('%left%', left)
  143. .replace('%leftmark%', leftMark)
  144. .replace('%cunit%', cunit)
  145. .replace('%lunit%', lunit);
  146. }
  147. }
  148. }
  149. }
  150. }
  151. }
  152. }
  153. }
  154. }
  155. }
  156. let resolveBug = $('[id*=bug][id*="resolve"]').val().split(';');
  157. let bugModule = $('[id*=module][id*=bug]').val().split(';');
  158. for(let i in resolveBug)
  159. {
  160. resolve = resolveBug[i];
  161. for(let j in bugModule)
  162. {
  163. bug = bugModule[j];
  164. for(let k in idMark)
  165. {
  166. id = idMark[k];
  167. for(let l in idSplit)
  168. {
  169. split = idSplit[l];
  170. html += '<br />' + rulesExample['bug']['resolve'].replace('%resolve%', resolve)
  171. .replace('%bug%', bug)
  172. .replace('%id%', id)
  173. .replace('%split%', split);
  174. }
  175. }
  176. }
  177. }
  178. $('#example').html(html.substr(6));
  179. }