admin_category.vue 2.8 KB

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