nodeForm.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div class="nodeForm">
  3. <el-form ref="ruleForm" :model="tableForm" label-width="100px">
  4. <el-row :gutter="20">
  5. <!-- <el-col :span="24">
  6. <el-form-item prop="algorithmname" label="算法名称">
  7. <el-input size="small" v-model="tableForm.algorithmname" placeholder="请输入" />
  8. </el-form-item>
  9. </el-col>
  10. <el-col v-if="formatData(algorithmtype) == 'java' || formatData(algorithmtype) == 'db' || formatData(algorithmtype) == 'kafka'" :span="24">
  11. <el-form-item prop="datasourceid" label="数据源">
  12. <el-select size="small" v-model="tableForm.datasourceid" placeholder="请选择">
  13. <el-option v-for="(item,index) in selectSource" :key="index" :label="item.datasourcedescribe" :value="item.datasourceid"></el-option>
  14. </el-select>
  15. </el-form-item>
  16. </el-col>
  17. <el-col v-if="formatData(algorithmtype) != 'js'" :span="24">
  18. <el-form-item prop="targetsource" label="数据源目标">
  19. <el-input size="small" v-model="tableForm.targetsource"></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :span="24">
  23. <el-form-item prop="executionorder" label="执行排序">
  24. <el-input size="small" v-model="tableForm.executionorder"></el-input>
  25. </el-form-item>
  26. </el-col> -->
  27. <el-col :span="24">
  28. <el-form-item prop="algorithmdescription" label="算法说明">
  29. <span slot="label">
  30. 算法说明
  31. <el-tooltip content="算法说明" placement="top">
  32. <i class="el-icon-question"></i>
  33. </el-tooltip>
  34. </span>
  35. <el-input size="small" v-model="tableForm.algorithmdescription"></el-input>
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="24">
  39. <el-form-item prop="preconditions" label="执行条件">
  40. <span slot="label">
  41. 执行条件
  42. <el-tooltip content="执行条件" placement="top">
  43. <i class="el-icon-question"></i>
  44. </el-tooltip>
  45. </span>
  46. <el-input size="small" type="textarea" @focus="setPreconditions" v-model="tableForm.preconditions"></el-input>
  47. </el-form-item>
  48. </el-col>
  49. <!-- v-if="formatData(algorithmtype) == 'js'" :span="24" -->
  50. <el-col>
  51. <el-form-item prop="computingexpression" label="计算表达式">
  52. <span slot="label">
  53. 计算表达式
  54. <el-tooltip content="计算表达式" placement="top">
  55. <i class="el-icon-question"></i>
  56. </el-tooltip>
  57. </span>
  58. <el-input size="small" type="textarea" v-model="tableForm.computingexpression"></el-input>
  59. </el-form-item>
  60. </el-col>
  61. <!-- <el-col :span="24">
  62. <el-form-item prop="preparameterset" label="前置条件参数">
  63. <el-input size="small" type="textarea" v-model="tableForm.preparameterset"></el-input>
  64. </el-form-item>
  65. </el-col> -->
  66. </el-row>
  67. </el-form>
  68. <nodeType ref="nodeType" @getColumnData="getColumnData" />
  69. </div>
  70. </template>
  71. <script>
  72. import nodeType from './nodeType.vue'
  73. export default {
  74. name: 'NodeForm',
  75. components: { nodeType },
  76. props: {
  77. algorithmtype: {
  78. type: String,
  79. default: ''
  80. },
  81. nodeForm: {
  82. type: Object,
  83. default: () => new Object()
  84. }
  85. },
  86. data () {
  87. return {
  88. tableForm: {
  89. serviceid: '',
  90. preconditions: '',
  91. algorithmname: '',
  92. algorithmsourcelibraryid: '',
  93. executionorder: '',
  94. targetsource: '',
  95. datasourceid: '',
  96. computingexpression: '',
  97. algorithmdescription: sessionStorage.getItem('nodeTreeTxt') || '',
  98. preparameterset: ''
  99. },
  100. selectSource: JSON.parse(sessionStorage.getItem('nodeDatasource')) || []
  101. }
  102. },
  103. watch: {
  104. nodeForm: {
  105. handler (obj) {
  106. if (Object.keys(obj).length) {
  107. this.tableForm = _.cloneDeep(obj)
  108. }
  109. },
  110. deep: true,
  111. immediate: true
  112. }
  113. },
  114. methods: {
  115. formatData (name) {
  116. return typeof name == 'string' ? name.toLocaleLowerCase() : name
  117. },
  118. setPreconditions () {
  119. this.$refs['nodeType'].showCron = true
  120. },
  121. getColumnData (str) {
  122. this.$set(this.tableForm, 'preconditions', str)
  123. }
  124. }
  125. }
  126. </script>
  127. <style>
  128. </style>