workflowBoard.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <div class="contanier">
  3. <el-card shadow="always" style="margin-bottom:20px;">
  4. <div class="node-area" >
  5. <div class="node-seq">
  6. <WrokflowNode name="开始" state="START" />
  7. </div>
  8. <div class="node-seq" v-for="(n,index) in queue" :key="index">
  9. <WrokflowNode :key="index" :name="n.nodeName" :state="n.state" @openCurrentNodeDialog="openCurrentNodeDialog(n)" />
  10. </div>
  11. <div class="node-seq" v-if="!nodeBusinessInfo.production">
  12. <WrokflowNode name="待定" state="WAITING" :last=true />
  13. </div>
  14. <div class="node-seq" v-else>
  15. <WrokflowNode name="结束" state="END" :last=true />
  16. </div>
  17. </div>
  18. </el-card>
  19. <el-dialog custom-class="nodeDialog" :title="dialogTitle" :visible.sync="dialogVisible" width="40%">
  20. <el-table :data="taskPageData" border style="width:100%">
  21. <el-table-column label="任务" align="center" prop="taskName" />
  22. <el-table-column label="处理人" align="center" prop="handler" />
  23. <el-table-column label="任务状态" align="center" prop="finished" />
  24. <el-table-column label="处理时间" align="center" prop="finishTime" />
  25. </el-table>
  26. </el-dialog>
  27. </div>
  28. </template>
  29. <script>
  30. import WrokflowNode from '@/components/workflowNode'
  31. export default {
  32. components: {
  33. WrokflowNode
  34. },
  35. name: 'workflowBoard',
  36. props: {
  37. nodeBusinessInfo:{
  38. type: Object
  39. },
  40. },
  41. watch:{
  42. nodeBusinessInfo:{
  43. handler(newVal,oldVal){
  44. if (newVal.ccId){
  45. this.workNodeCommit.ccId= newVal.ccId;
  46. this.workNodeCommit.production= newVal.production;
  47. }
  48. },
  49. deep:true,
  50. immediate:true
  51. }
  52. },
  53. data() {
  54. return {
  55. queue:[
  56. {
  57. flowId:null,
  58. pnodeId:null,
  59. nodeId:null,
  60. flowCode:null,
  61. nodeName:"业务下单",
  62. nodeCode:null,
  63. state:"PENDING",
  64. instanceId:null
  65. }
  66. ],
  67. instance:{
  68. mainBusiness:null,
  69. businessId:null,
  70. businessSubId:null,
  71. businessMinId:null,
  72. production:[],
  73. ifPay:null
  74. },
  75. dialogVisible:false,
  76. taskPageData:[],
  77. dialogTitle:null,
  78. workNodeCommit:{
  79. instanceNodeId:null,
  80. state:null,
  81. comments:null,
  82. production:[],
  83. reportNos:[],
  84. ifCheckTask:true,
  85. businessSubId:null,
  86. doSecondCheck:null,
  87. doThirdCheck:null,
  88. doFourthCheck:null
  89. },
  90. }
  91. },
  92. created(){
  93. //this.getInstanceQueue();
  94. },
  95. methods: {
  96. openCurrentNodeDialog(node){
  97. this.dialogVisible = true;
  98. this.dialogTitle = node.nodeName;
  99. if (node.instanceId){
  100. this.$api.workNodeTaskRecord.instanceTask(node.instanceId).then(res=>{
  101. if (res.code === 200 ){
  102. this.taskPageData = res.data;
  103. }
  104. })
  105. }else {
  106. this.taskPageData = [];
  107. }
  108. },
  109. getInstanceQueue(){
  110. if (this.nodeBusinessInfo.mainBusiness!=null && this.nodeBusinessInfo.businessId!=null){
  111. this.instance.mainBusiness = this.nodeBusinessInfo.mainBusiness;
  112. this.instance.businessId = this.nodeBusinessInfo.businessId;
  113. this.instance.businessSubId = this.nodeBusinessInfo.businessSubId;
  114. this.instance.businessMinId = this.nodeBusinessInfo.businessMinId;
  115. this.instance.production = this.nodeBusinessInfo.production;
  116. this.instance.ifPay = this.nodeBusinessInfo.ifPay;
  117. this.$api.workNodeInstance.queue(this.instance).then(res =>{
  118. if (res.code ===200){
  119. this.queue = res.data;
  120. }
  121. })
  122. }
  123. },
  124. getInstanceArray(mainBusiness,businessId){
  125. this.instance.mainBusiness = mainBusiness;
  126. this.instance.businessId = businessId;
  127. this.$api.workNodeInstance.array(this.instance).then(res =>{
  128. if (res.code ===200){
  129. this.queue = res.data;
  130. }
  131. })
  132. },
  133. commit(state){
  134. let commit = this.workNodeCommit
  135. let handldType = "提交";
  136. let type = "success"
  137. if (state ==='REVERSE'){
  138. handldType= "退回"
  139. type = "warning"
  140. }
  141. if (state ==='SKIP'){
  142. handldType= "跳过"
  143. type = "warning"
  144. }
  145. if (state ==='TERMINATE'){
  146. handldType= "终止"
  147. type = "error"
  148. }
  149. if (state ==='RESTART'){
  150. handldType= "重置"
  151. type = "error"
  152. }
  153. //需要把必要的业务信息提交给流程
  154. commit.state = state;
  155. commit.instanceNodeId = this.nodeBusinessInfo.currentInstanceNodeId;
  156. commit.production = this.nodeBusinessInfo.production;
  157. commit.reportNos = this.nodeBusinessInfo.reportNos;
  158. commit.ifCheckTask = this.nodeBusinessInfo.ifCheckTask;
  159. commit.businessSubId = this.nodeBusinessInfo.businessSubId;
  160. commit.businessMinId = this.nodeBusinessInfo.businessMinId;
  161. commit.doSecondCheck = this.nodeBusinessInfo.doSecondCheck;
  162. commit.doThirdCheck = this.nodeBusinessInfo.doThirdCheck;
  163. commit.doFourthCheck = this.nodeBusinessInfo.doFourthCheck;
  164. commit.ifFeedback = this.nodeBusinessInfo.ifFeedback;
  165. commit.ifProductionFund = this.nodeBusinessInfo.ifProductionFund;
  166. let isOk = true
  167. this.$emit('workflowCommitVerify',{"commit":commit},val =>{
  168. if (!val.state){
  169. isOk = false;
  170. }
  171. if (val.cleanReport!=null){
  172. commit.cleanReportNo = val.cleanReport;
  173. }
  174. if (val.nextHandlerId){
  175. commit.nextHandlerId = val.nextHandlerId
  176. }
  177. });
  178. if (isOk){
  179. this.$prompt('请填写处理意见,若无可直接点击确认按钮。',handldType,{
  180. confirmButtonText: '确认',
  181. cancelButtonText: '取消',
  182. type: type,
  183. }).then(({value})=>{
  184. commit.comments = value;
  185. this.$api.workflow.commit(commit).then(res=>{
  186. if (res.code === 200 && res.data){
  187. this.$notify({
  188. title: '成功',
  189. message: '工作流节点提交成功。',
  190. type: 'success',
  191. duration: 2000
  192. });
  193. this.goBack();
  194. }else{
  195. this.$notify({
  196. title: '失败',
  197. message: '工作流节点提交失败,请联系管理员。',
  198. type: 'error',
  199. duration: 2000
  200. });
  201. }
  202. })
  203. })
  204. }
  205. },
  206. goBack(){
  207. const back = this.$route.query.back;
  208. if (back) {
  209. this.$router.push({path:back, query:this.listQuery})
  210. }
  211. },
  212. getPreviousNode(){
  213. const nodes = this.queue;
  214. nodes.map((item,index)=>{
  215. if (item.state==="PENDING"){
  216. this.$emit("getPreviousNode",this.queue[(index-1)])
  217. }
  218. })
  219. },
  220. }
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. .contanier{
  225. width:100%;
  226. height:auto;
  227. }
  228. .node-area{
  229. width:100%;
  230. }
  231. .node-seq{
  232. display:flex;
  233. float:left
  234. }
  235. .button-area{
  236. text-align: right;
  237. }
  238. /deep/.nodeDialog {
  239. border-radius: 20px;
  240. }
  241. </style>