GenerateFlowableForm.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <!-- 待用活动表单 -->
  3. <active-form :formData="formData" ref="form" >
  4. </active-form>
  5. </template>
  6. <script>
  7. import activeForm from '@/components/generate-form/generate-form.vue';
  8. import formService from "@/api/flowable/formService"
  9. var graceChecker = require("@/common/graceChecker.js");
  10. export default {
  11. components:{
  12. activeForm
  13. },
  14. props: {
  15. processDefinitionId: {
  16. type: String,
  17. required: true
  18. },
  19. edit: {
  20. type: Boolean,
  21. default: true
  22. },
  23. formData:{
  24. type:Array,
  25. default:function(){
  26. return []
  27. }
  28. }
  29. },
  30. methods: {
  31. // 提交序列化的表单
  32. getFormData (option){
  33. var submitData={};
  34. for(var i=0;i<option.length;i++){
  35. submitData[option[i].model]=option[i].value;
  36. }
  37. return submitData;
  38. },
  39. //
  40. submitStartFormData (vars, callback) {
  41. // 表单校验
  42. let errMsg = graceChecker.checkFormData(this.formData);
  43. if(errMsg){
  44. uni.showToast({
  45. title:errMsg,
  46. icon:'none'
  47. })
  48. return
  49. }
  50. let data = this.getFormData(this.formData)
  51. formService.submitStartFormData(
  52. {
  53. id: this.id,
  54. ...vars,
  55. data: JSON.stringify(data)
  56. }
  57. ).then((data) => {
  58. uni.showToast({
  59. title: "启动成功",
  60. icon: "none"
  61. });
  62. callback(data)
  63. })
  64. },
  65. submitTaskFormData (vars, procInsId, taskId, assignee, comment, callback) {
  66. // 表单校验
  67. let errMsg = graceChecker.checkFormData(this.formData);
  68. if(errMsg){
  69. uni.showToast({
  70. title:errMsg,
  71. icon:'none'
  72. })
  73. return
  74. }
  75. let data = this.getFormData(this.formData);
  76. data = {...vars, ...data}
  77. this.loading = true
  78. formService.submitTaskFormData({
  79. id: this.id,
  80. procInsId: procInsId,
  81. taskId: taskId,
  82. assignee: assignee,
  83. comment: comment,
  84. data: JSON.stringify(data)
  85. }).then((data) => {
  86. uni.showToast({
  87. title: "提交成功"
  88. })
  89. callback(data)
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss">
  96. .form-container-box{
  97. width: 100vw;
  98. font-size: 28upx;
  99. min-height: 100vh;
  100. position: relative;
  101. padding-bottom: 100upx;
  102. }
  103. .bgfff {
  104. background: #fff;
  105. position: fixed;
  106. bottom: 0;
  107. left: 0;
  108. right: 0;
  109. }
  110. .buttonBox {
  111. width: 100%;
  112. height: 84upx;
  113. color: white;
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. background-color: #ff5b01;
  118. }
  119. .submit-data {
  120. padding: 20upx;
  121. margin-top: 20upx;
  122. word-break: break-word;
  123. }
  124. </style>