project-start-process.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>发起流程</title>
  5. <!--#include file="common/_header.html"-->
  6. <style>
  7. .tab-labels{
  8. border-bottom: 1px solid #e8e8e8;
  9. }
  10. .tab-labels::after{
  11. content:'';
  12. display: block;
  13. clear:both;
  14. }
  15. .current{
  16. border-bottom-color: #1890ff !important;
  17. }
  18. .tab-label{
  19. cursor: pointer;
  20. display: inline-block;
  21. float: left;
  22. height: 40px;
  23. line-height: 40px;
  24. padding: 0 20px;
  25. border-bottom: solid 2px #fff;
  26. }
  27. .show {
  28. display: block;
  29. }
  30. .hide{
  31. display: none;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <article id="app" class="page-container">
  37. <ul class="tab-labels">
  38. <li class="tab-label" :class="{current:index==current}" @click="current = index;" v-for="(process,index) in processList">
  39. {{process.description}}
  40. </li>
  41. </ul>
  42. <div v-for="(process,pIndex) in processList" v-show="current==pIndex">
  43. <h3 v-html="process.description"></h3>
  44. <p>
  45. 当前模板:
  46. <select v-model="process.selectedTemplateId"
  47. @change="loadStepList(pIndex)" class="select">
  48. <option :value="template.id"
  49. v-for="template in process.templateList">
  50. {{template.title}}
  51. </option>
  52. </select>
  53. </p>
  54. <table class="table table-border table-bordered">
  55. <thead>
  56. <tr>
  57. <td>步骤名称</td>
  58. <td>待办事项</td>
  59. <td>规定完成人天</td>
  60. </tr>
  61. </thead>
  62. <tbody v-if="process.stepList!=null">
  63. <tr v-for="step in process.stepList">
  64. <td v-html="step.name"></td>
  65. <td>
  66. <ul>
  67. <li v-for="todo,index in step.todoList">{{index+1}}.{{todo.detail}}</li>
  68. </ul>
  69. </td>
  70. <td>
  71. <input type="number" v-model="step.day"/>
  72. </td>
  73. </tr>
  74. </tbody>
  75. </table>
  76. </div>
  77. <div style="text-align: center;padding:5px;">
  78. <input class="btn btn-primary radius size-L" type="button" value="提交" @click="submit()">
  79. </div>
  80. </article>
  81. <!--_footer 作为公共模版分离出去-->
  82. <!--#include file="common/_footer.html"-->
  83. <!--/_footer 作为公共模版分离出去-->
  84. <!--请在下方写此页面业务相关的脚本-->
  85. <script type="text/javascript" src="lib/vue/vue.js"></script>
  86. <script type="text/javascript" src="scripts/global.js"></script>
  87. <script type="text/javascript">
  88. var path = global_backend_url;
  89. var vm = new Vue({
  90. el: "#app",
  91. data: {
  92. projectId:"",
  93. templateId:"",
  94. templateList:[],
  95. processList:[],
  96. current:0
  97. },
  98. mounted:function(){
  99. var self = this;
  100. self.projectId = getQueryString("id");
  101. $.get(path + "/procDef/listWithTmpl",{
  102. procDefKeys : "ProjectPerformanceTransfer,ProjectStartUpConstruction,ProjectCompletedAndPutIntoOperation"
  103. },function(rs){
  104. if(rs.result){
  105. self.processList = rs.data;
  106. }
  107. else{
  108. alert(resp.message);
  109. }
  110. },"json");
  111. },
  112. methods:{
  113. loadStepList:function(pIndex){
  114. var self = this;
  115. var process = self.processList[pIndex];
  116. var loadingIndex = top.layer.load(0, {shade: [0.1,'#fff']});
  117. $.get(path + "/procDefTmpl/step/list",{
  118. templateId : process.selectedTemplateId
  119. },function(resp){
  120. top.layer.close(loadingIndex);
  121. if(resp.result) {
  122. process.stepList = resp.data;
  123. }
  124. else{
  125. console.log(resp.message);
  126. }
  127. },"json");
  128. },
  129. submit:function(){
  130. var self = this;
  131. var stepList = [];
  132. var failed = false;
  133. self.processList.forEach(function(process){
  134. process.stepList.forEach(function(step){
  135. if(step.day==null || step.day.length==0){
  136. layer.msg("流程:" + process.description + "中步骤" + step.name + "规定完成人天不能为空!");
  137. failed = true;
  138. return;
  139. }
  140. else{
  141. stepList.push({
  142. procDefKey: process.key,
  143. templateId: process.selectedTemplateId,
  144. taskDefKey: step.taskDefKey,
  145. stepId: step.id,
  146. day: parseInt(step.day)
  147. });
  148. }
  149. });
  150. if(failed){
  151. return;
  152. }
  153. });
  154. if(failed){
  155. return;
  156. }
  157. var loadingIndex = layer.load(1, {shade: [0.5,'#fff']});
  158. var requestDTO = {
  159. projectId : self.projectId,
  160. procDefKey: self.processList[0].key,
  161. templateId: self.processList[0].selectedTemplateId,
  162. templateId2: self.processList[1].selectedTemplateId,
  163. templateId3: self.processList[2].selectedTemplateId,
  164. stepList : stepList
  165. }
  166. $.ajax({
  167. url: path + "/procInst/startProcess",
  168. type: "POST", //请求类型
  169. data: JSON.stringify(requestDTO),
  170. dataType:"json",
  171. contentType:"application/json",
  172. success: function(resp){
  173. layer.close(loadingIndex);
  174. if(resp.result){
  175. layer.msg('发起成功!',{icon:1,time:1000});
  176. setTimeout(function(){
  177. var index = top.layer.getFrameIndex(window.name);
  178. if(index>=0){
  179. window.top["listWindow"].reloadList();
  180. top.layer.close(index);
  181. }
  182. },1000);
  183. }
  184. else{
  185. layer.msg(resp.message);
  186. }
  187. }
  188. });
  189. }
  190. }
  191. });
  192. </script>
  193. <!--/请在上方写此页面业务相关的脚本-->
  194. </body>
  195. </html>