deploy.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <basic-container>
  3. <avue-form :option="option" v-model="form" :upload-before="uploadBefore" :upload-after="uploadAfter"></avue-form>
  4. </basic-container>
  5. </template>
  6. <script>
  7. import {deployUpload} from "@/api/flow/flow";
  8. import {flowCategory} from "@/util/flow";
  9. export default {
  10. data() {
  11. return {
  12. form: {
  13. flowCategory: '',
  14. imgUrl: [],
  15. file: {},
  16. },
  17. option: {
  18. labelWidth: 120,
  19. menuBtn: false,
  20. column: [
  21. {
  22. label: '流程类型',
  23. prop: 'flowCategory',
  24. type: 'select',
  25. dicUrl: `/api/blade-system/dict/dictionary?code=flow`,
  26. props: {
  27. label: "dictValue",
  28. value: "dictKey"
  29. },
  30. rules: [
  31. {
  32. required: true,
  33. message: '请选择流程类型',
  34. trigger: 'blur'
  35. }
  36. ]
  37. },
  38. {
  39. label: '附件上传',
  40. prop: 'imgUrl',
  41. type: 'upload',
  42. loadText: '附件上传中,请稍等',
  43. span: 24,
  44. propsHttp: {
  45. res: 'data'
  46. },
  47. tip: '请上传 bpmn20.xml 标准格式文件',
  48. action: '/api/blade-flow/manager/check-upload'
  49. },
  50. ]
  51. }
  52. }
  53. },
  54. methods: {
  55. uploadBefore(file, done) {
  56. this.$message.success('部署开始')
  57. this.file = file;
  58. done()
  59. },
  60. uploadAfter(res, done, loading) {
  61. if (!this.form.flowCategory) {
  62. this.$message.warning('清先选择流程类型');
  63. loading()
  64. return false;
  65. }
  66. if (res.success) {
  67. deployUpload(flowCategory(this.form.flowCategory), [this.file]).then(res => {
  68. const data = res.data;
  69. if (data.success) {
  70. this.$message.success('部署结束')
  71. done()
  72. } else {
  73. this.$message.error(data.msg);
  74. loading()
  75. }
  76. })
  77. } else {
  78. this.$message.warning('请上传 bpmn20.xml 标准格式文件');
  79. loading()
  80. return false;
  81. }
  82. },
  83. }
  84. }
  85. </script>