filterPath.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div>
  3. <el-dialog title="公共方法配置" :visible.sync="dialog" width="950px" :close-on-click-modal="false" top="50px">
  4. <p class="top-tip fc-theme">公共方法列表
  5. <el-button type="primary" v-permission="'method_list_add'" @click="add">添加</el-button>
  6. </p>
  7. <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border :max-height="vheight">
  8. <el-table-column label="方法ID" prop="id"></el-table-column>
  9. <el-table-column label="方法路径" prop="method_path"></el-table-column>
  10. <el-table-column label="方法描述" prop="method_desc"></el-table-column>
  11. <el-table-column label="操作" width="180">
  12. <template slot-scope="scope">
  13. <el-button type="text" @click="edit(scope.row)" v-permission="'method_list_edit'">编辑</el-button>
  14. <el-button type="text" @click="del(scope.row)" v-permission="'method_list_del'">删除</el-button>
  15. </template>
  16. </el-table-column>
  17. </el-table>
  18. <el-pagination
  19. class="marginT-20"
  20. @size-change="handleSizeChange"
  21. @current-change="handleCurrentChange"
  22. :hide-on-single-page="true"
  23. :current-page="page"
  24. :page-size="page_size"
  25. :page-sizes="[10, 20, 100, 200, 300, 400]"
  26. background
  27. layout="total, sizes, prev, pager, next, jumper"
  28. :total="totalCount" />
  29. <div slot="footer" class="dialog-footer text-center">
  30. <el-button @click="dialog = false">取 消</el-button>
  31. <el-button type="danger" @click="dialog = false">确 定</el-button>
  32. </div>
  33. </el-dialog>
  34. <filterAdd v-if="filterAddDialog.show" v-model="filterAddDialog.show" :exData="filterAddDialog.exData" @success="init"></filterAdd>
  35. </div>
  36. </template>
  37. <script>
  38. import page from '@/mixin/page'
  39. import filterAdd from './components/filterAdd';
  40. export default {
  41. mixins: [page],
  42. components: {
  43. filterAdd,
  44. },
  45. props: {
  46. value: {
  47. type: Boolean,
  48. default: true
  49. },
  50. exData: {
  51. type: Object,
  52. default: function (){
  53. return {}
  54. }
  55. }
  56. },
  57. data() {
  58. return {
  59. filterAddDialog: {
  60. show: false,
  61. exData: {}
  62. },
  63. searchForm: {},
  64. tableData: [],
  65. tableUrl: '/method/list',
  66. dialog: !!this.value,
  67. }
  68. },
  69. methods: {
  70. add() {
  71. this.filterAddDialog.exData = {
  72. method_project_id: this.exData.id
  73. }
  74. this.filterAddDialog.show = true
  75. },
  76. edit(row) {
  77. this.filterAddDialog.exData = row
  78. this.filterAddDialog.show = true
  79. },
  80. del(row) {
  81. this.$confirm('确定要删除吗', '确认', {
  82. confirmButtonText: '确定',
  83. cancelButtonText: '取消',
  84. type: 'warning'
  85. }).then(async () => {
  86. const data = await this.$fetch('/method/del', {id: row.id})
  87. if (data.code == 200) {
  88. this.$message.success('删除成功')
  89. this.init()
  90. }
  91. }).catch(() => {})
  92. }
  93. },
  94. mounted () {
  95. this.init()
  96. },
  97. watch: {
  98. dialog(val) {
  99. if (!val) this.$emit('input', val)
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .top-tip {
  106. margin-top: -20px;
  107. margin-bottom: 20px;
  108. }
  109. </style>