header.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div>
  3. <el-input v-model="query.name" clearable size="small" placeholder="输入工作流名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
  4. <!-- <date-range-picker v-model="query.createDateStr" class="date-item" />
  5. <date-range-picker v-model="query.lastUpdateDateStr" class="date-item" /> -->
  6. <rrOperation />
  7. <el-button class="filter-item" size="mini" type="primary" icon="el-icon-plus" @click="showForm">新增</el-button>
  8. <acticitiDialog :page-url.sync="activitiEditorUrl" :activiti-editor-visible.sync="activitiEditorVisible" />
  9. <el-dialog
  10. append-to-body
  11. :close-on-click-modal="false"
  12. :before-close="closeForm"
  13. :visible="formBoolean"
  14. :title="crud.status.title"
  15. width="500px"
  16. >
  17. <el-form label-width="80px" :rules="rules" :model="formLabelAlign">
  18. <el-form-item label="模型名称">
  19. <el-input v-model="formLabelAlign.name" />
  20. </el-form-item>
  21. <el-form-item label="模型key">
  22. <el-input v-model="formLabelAlign.key" />
  23. </el-form-item>
  24. <el-form-item label="模型描述">
  25. <el-input v-model="formLabelAlign.description" />
  26. </el-form-item>
  27. </el-form>
  28. <div
  29. slot="footer"
  30. class="dialog-footer"
  31. >
  32. <el-button
  33. type="text"
  34. @click="closeForm"
  35. >
  36. 取消
  37. </el-button>
  38. <el-button
  39. type="primary"
  40. @click="submitCU"
  41. >
  42. 确认
  43. </el-button>
  44. </div>
  45. </el-dialog>
  46. </div>
  47. </template>
  48. <script>
  49. import { header, crud } from '@crud/crud'
  50. import rrOperation from '@crud/RR.operation'
  51. // import DateRangePicker from '@/components/DateRangePicker'
  52. import { add } from '@/api/activiti/activiti'
  53. import acticitiDialog from './activiti-dialog'
  54. export default {
  55. components: { rrOperation, acticitiDialog/* , DateRangePicker */ },
  56. mixins: [header(), crud()],
  57. props: {
  58. permission: {
  59. type: Object,
  60. required: true
  61. }
  62. },
  63. data() {
  64. return {
  65. activitiEditorVisible: false,
  66. activitiEditorUrl: '',
  67. formLabelAlign: {
  68. name: '',
  69. key: '',
  70. description: ''
  71. },
  72. formBoolean: false,
  73. rules: {
  74. name: [
  75. { required: true, message: '请输入模型名称', trigger: 'blur' }
  76. ],
  77. key: [
  78. { required: true, message: '请输入模型key', trigger: 'blur' }
  79. ],
  80. description: [
  81. { required: false, message: '请输入模型描述', trigger: 'blur' }
  82. ]
  83. }
  84. }
  85. },
  86. methods: {
  87. toEditPage() {
  88. add().then(modelId => {
  89. this.activitiEditorVisible = true
  90. this.activitiEditorUrl = process.env.VUE_APP_BASE_API + '/static/modeler.html?modelId=' + modelId
  91. })
  92. },
  93. showForm() {
  94. // this.crud.status.cu = 1
  95. // this.crud.status.add = 1
  96. this.formBoolean = true
  97. },
  98. closeForm() {
  99. this.formBoolean = false
  100. },
  101. submitCU() {
  102. if (this.formLabelAlign.name === '' || this.formLabelAlign.key === '') {
  103. this.$message.info('模型名称和key不能为空')
  104. return false
  105. }
  106. // eslint-disable-next-line no-unused-vars
  107. const map = {
  108. 'name': this.formLabelAlign.name,
  109. 'key': this.formLabelAlign.key,
  110. 'description': this.formLabelAlign.description
  111. }
  112. add(map).then(res => {
  113. this.$message.info('添加成功')
  114. this.formBoolean = false
  115. this.activitiEditorVisible = true
  116. this.activitiEditorUrl = process.env.VUE_APP_BASE_API + '/static/modeler.html?modelId=' + res
  117. this.crud.refresh()
  118. })
  119. }
  120. }
  121. }
  122. </script>