admin_category.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div v-loading="loading">
  3. <el-form class="search" label-width="90px" inline>
  4. <el-row>
  5. <el-col :span="24">
  6. <el-form-item>
  7. <el-button size="small" @click="show_child_page('admin_category_add',{})" type="primary">添加标签</el-button>
  8. </el-form-item>
  9. </el-col>
  10. </el-row>
  11. </el-form>
  12. <el-table
  13. :data="list"
  14. style="width: 100%">
  15. <el-table-column prop="name" label="标签名称"></el-table-column>
  16. <el-table-column prop="sub_title" label="副标题"></el-table-column>
  17. <el-table-column prop="order" label="排序"></el-table-column>
  18. <el-table-column fixed="right" width="100px" prop="act" label="操作">
  19. <template slot-scope="scope">
  20. <el-button type="primary" size="mini" @click="show_child_page('admin_category_add',{id:scope.row.id})">编辑标签</el-button>
  21. </template>
  22. </el-table-column>
  23. </el-table>
  24. <el-pagination
  25. background
  26. style="margin-top: 10px"
  27. layout="total,prev, pager, next"
  28. :current-page="search.page"
  29. @current-change="page_event"
  30. :page-size="search.pagesize"
  31. :total="search.total">
  32. </el-pagination>
  33. <admin_category_add v-if="child_page.type=='admin_category_add'" :point="value" v-model="child_page.obj.id" :back="this"></admin_category_add>
  34. </div>
  35. </template>
  36. <script>
  37. import admin_category_add from '@/components/child_page/admin_category_add';
  38. export default {
  39. props: {
  40. value: {},
  41. },
  42. components: {admin_category_add},
  43. data() {
  44. return {
  45. loading:true,
  46. list: [],
  47. child_page:{
  48. type:"",
  49. obj:{}
  50. },
  51. search:{
  52. pagesize: 20,
  53. },
  54. }
  55. },
  56. mounted() {
  57. this.getList();
  58. },
  59. methods: {
  60. show_child_page(type,obj)
  61. {
  62. this.child_page.type=type;
  63. this.child_page.obj=obj;
  64. },
  65. page_event(page) {
  66. this.search.page = page;
  67. this.getList();
  68. },
  69. async getList() {
  70. this.loading = true;
  71. let data=this.search;
  72. data.point=this.value-20;
  73. let res = await this.$post("/uapi/admin/pub/admin_category/list",data);
  74. if (res.status == 1) {
  75. this.list = res.data.list;
  76. this.search.total=res.data.total;
  77. }
  78. this.loading = false;
  79. },
  80. }
  81. }
  82. </script>