SelectCube.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <el-dialog title="选择数据模型" :visible.sync="show" :close-on-click-modal="false" custom-class="nopadding">
  3. <el-input v-model="search" size="mini" placeholder="输入关键字搜索">
  4. <el-button slot="append" icon="el-icon-search" @click="searchme"></el-button>
  5. </el-input>
  6. <div class="el-dialog-div">
  7. <el-table :data="tableData" @row-click="selectme" border style="width: 100%" header-row-class-name="tableHeadbg">
  8. <el-table-column label="" width="45">
  9. <template slot-scope="scope">
  10. <el-radio v-model="checked" name="myselect2" :label="scope.row.cubeId">&nbsp;</el-radio>
  11. </template>
  12. </el-table-column>
  13. <el-table-column align="center" prop="cubeName" label="模型名称"></el-table-column>
  14. <el-table-column align="center" prop="desc" label="说明"></el-table-column>
  15. <el-table-column align="center" prop="dsetName" label="数据集"></el-table-column>
  16. </el-table>
  17. <el-pagination
  18. background
  19. layout="prev, pager, next"
  20. :total="total">
  21. </el-pagination>
  22. </div>
  23. <div slot="footer" class="dialog-footer">
  24. <el-button type="primary" @click="save()">确 定</el-button>
  25. <el-button @click="show = false">取 消</el-button>
  26. </div>
  27. </el-dialog>
  28. </template>
  29. <script>
  30. import {ajax} from '@/common/biConfig'
  31. import $ from 'jquery'
  32. export default {
  33. data(){
  34. return {
  35. show:false,
  36. checked:null,
  37. tableData:[],
  38. search:null,
  39. total:0,
  40. page:1,
  41. rows:10,
  42. }
  43. },
  44. props:{
  45. callback:{
  46. type:Function, //点击选择立方体后的回调函数
  47. required:true
  48. }
  49. },
  50. mounted(){
  51. },
  52. computed: {
  53. },
  54. methods: {
  55. select(){
  56. this.show = true;
  57. this.search = null;
  58. this.loadData();
  59. },
  60. save(){
  61. let chk = this.checked;
  62. if(!chk){
  63. this.$notify.error({title: '未勾选数据',offset: 50});
  64. return;
  65. }
  66. this.callback(chk);
  67. this.show = false;
  68. },
  69. selectme:function(a, b){
  70. this.checked = a.cubeId;
  71. },
  72. searchme(){
  73. this.loadData();
  74. },
  75. loadData(){
  76. ajax({
  77. url:"model/pageCube.action",
  78. type:"POST",
  79. data:{rows:this.rows, page:this.page,key:this.search},
  80. success:(resp)=>{
  81. this.total = resp.total;
  82. this.tableData = resp.rows.map(m=>{
  83. return {
  84. cubeId:m.cubeId,
  85. cubeName:m.cubeName,
  86. desc:m.desc,
  87. dsetName:m.dsetName
  88. }
  89. });
  90. }
  91. }, this);
  92. }
  93. },
  94. watch: {
  95. }
  96. }
  97. </script>
  98. <style lang="css">
  99. .nopadding .el-dialog__body{
  100. padding: 5px;
  101. }
  102. </style>