SelectCube.vue 2.3 KB

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