index.vue 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div style="width: 800px">
  3. <el-table
  4. v-loading="isLoading"
  5. :data="listData"
  6. border
  7. fit
  8. highlight-current-row
  9. >
  10. <el-table-column label="标题" prop="title"/>
  11. <el-table-column label="方法名" prop="method" width="300"/>
  12. <el-table-column label="版本号" prop="version" width="150"/>
  13. <el-table-column label="操作" width="70">
  14. <template slot-scope="scope">
  15. <el-button type="text" size="small" @click.native="showDetail(scope.row)">详情</el-button>
  16. </template>
  17. </el-table-column>
  18. </el-table>
  19. <dialog-detail ref="dialogDetail"/>
  20. <!-- <el-drawer-->
  21. <!-- :title="currentDetail.title+'['+currentDetail.method+':'+currentDetail.version+']'"-->
  22. <!-- :visible.sync="showDrawer"-->
  23. <!-- >-->
  24. <!-- <el-table-->
  25. <!-- v-loading="isLoading"-->
  26. <!-- :data="currentDetail.listFields"-->
  27. <!-- border-->
  28. <!-- highlight-current-row-->
  29. <!-- >-->
  30. <!-- <el-table-column label="参数名" prop="name" width="150" />-->
  31. <!-- <el-table-column label="类型" prop="type" width="100" />-->
  32. <!-- <el-table-column label="必须">-->
  33. <!-- <template slot-scope="scope">-->
  34. <!-- {{ scope.row.required ? '是' : '否' }}-->
  35. <!-- </template>-->
  36. <!-- </el-table-column>-->
  37. <!-- <el-table-column label="说明" prop="describe" />-->
  38. <!-- </el-table>-->
  39. <!-- </el-drawer>-->
  40. </div>
  41. </template>
  42. <script>
  43. import { getApis } from '@/api/docsApis'
  44. import { findPage } from '@/api/appKey'
  45. import DialogDetail from '@/views/apidocs/DialogDetail'
  46. export default {
  47. name: 'Dashboard',
  48. components: { DialogDetail },
  49. data() {
  50. return {
  51. queryForm: {},
  52. currentPage: 1,
  53. listData: [],
  54. isLoading: false,
  55. perList:[]
  56. // showDrawer: false,
  57. // currentDetail: {}
  58. }
  59. },
  60. created() {
  61. this.fetchData();
  62. },
  63. methods: {
  64. showDetail(row) {
  65. this.$refs.dialogDetail.open(row)
  66. // this.showDrawer = true
  67. // this.currentDetail = row
  68. },
  69. fetchData() {
  70. this.isLoading = true
  71. findPage({ ...this.queryForm, current: this.currentPage })
  72. .then((response) => {
  73. this.perList = response && response.records ? response.records.map(re=>re.permissions).flat(Infinity) : [];
  74. getApis().then(listData => {
  75. this.listData = listData.filter(data =>{
  76. return this.perList.includes(data.method+':'+data.version);
  77. });
  78. }).finally(() => {
  79. this.isLoading = false
  80. })
  81. })
  82. .finally(() => (this.isLoading = false))
  83. }
  84. }
  85. }
  86. </script>