nodeClass.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="nodeClass">
  3. <div class="nodeClass-sf">
  4. <div class="manageTitle">请选择算法类型</div>
  5. <el-radio-group style="width: 100%;margin-top: 20px;" @change="changeSelect('algorithmtype',formInline.algorithmtype)" v-model="formInline.algorithmtype" size="small">
  6. <el-row :gutter="20">
  7. <el-col style="margin-bottom: 20px;" v-for="(item,index) in selectType" :key="index" :span="8">
  8. <el-radio :label="item.code" border>
  9. <el-tooltip class="item" effect="dark" :content="item.name" placement="right">
  10. <span>{{ item.name }}</span>
  11. </el-tooltip>
  12. </el-radio>
  13. </el-col>
  14. </el-row>
  15. </el-radio-group>
  16. </div>
  17. <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" style="margin-top: 60px">
  18. <div class="manageTitle">请选择算法模板</div>
  19. <template v-if="selectAlgorithm.length">
  20. <el-radio-group style="width: 100%;margin-top: 20px;" @change="groupChange" v-model="algorithmid" size="small">
  21. <el-row :gutter="20">
  22. <el-col style="margin-bottom: 20px;" v-for="(item,index) in selectAlgorithm" :key="index" :span="8">
  23. <el-radio :label="item.id" border>
  24. <el-tooltip class="item" effect="dark" :content="item.name" placement="right">
  25. <span>{{ item.name }}</span>
  26. </el-tooltip>
  27. </el-radio>
  28. </el-col>
  29. </el-row>
  30. </el-radio-group>
  31. </template>
  32. <template v-else>
  33. <el-empty description="暂无数据"></el-empty>
  34. </template>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. import { getQueryData } from '../utils/index'
  40. export default {
  41. name: 'NodeClass',
  42. data () {
  43. return {
  44. loading: false,
  45. selectAlgorithm: [],
  46. selectType: [],
  47. formInline: {
  48. algorithmtype: '',
  49. },
  50. algorithmid: ''
  51. }
  52. },
  53. mounted () {
  54. this.getSelectData('algorithmtype', 20, { type: 'category' })
  55. },
  56. methods: {
  57. async getSelectData (pagecode, serviceid, datacontent) {
  58. if (pagecode != 'algorithmtype') {
  59. this.loading = true
  60. }
  61. const { code, returnData } = await getQueryData(serviceid, datacontent)
  62. if (code == 0) this.setFormSelectData(pagecode, returnData)
  63. this.loading = false
  64. },
  65. setFormSelectData (name, returnData) {
  66. switch (name) {
  67. case 'algorithmtype':
  68. this.selectType = [...returnData]
  69. break;
  70. case 'algorithmname':
  71. this.selectAlgorithm = [...returnData]
  72. break;
  73. case 'datasourceid':
  74. sessionStorage.setItem('nodeDatasource', JSON.stringify([...returnData]))
  75. break
  76. default:
  77. break;
  78. }
  79. },
  80. //获取表单下拉数据
  81. changeSelect (name, code) {
  82. this.$emit('changeSelect', code)
  83. switch (name) {
  84. case 'algorithmtype':
  85. const item = this.selectType.filter(item => item.code == code)
  86. if (!item.length) return
  87. const id = item[0].id
  88. this.getSelectData('algorithmname', 20, { superiorid: id })
  89. this.getSelectData('datasourceid', 12, { datasourcetype: code })
  90. break;
  91. default:
  92. break;
  93. }
  94. },
  95. groupChange (val) {
  96. this.$emit('groupChange', val)
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .nodeClass {
  103. .el-radio.is-bordered {
  104. width: 100%;
  105. white-space: nowrap;
  106. overflow: hidden;
  107. text-overflow: ellipsis;
  108. }
  109. }
  110. </style>