admin_category.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 prop="works_num" label="作品数量"></el-table-column>
  24. <el-table-column fixed="right" width="100px" prop="act" label="操作">
  25. <template slot-scope="scope">
  26. <el-button type="primary" size="mini" @click="show_child_page('admin_category_add',{id:scope.row.id})">编辑标签</el-button>
  27. </template>
  28. </el-table-column>
  29. </el-table>
  30. <el-pagination
  31. background
  32. style="margin-top: 10px"
  33. layout="total,prev, pager, next"
  34. :current-page="search.page"
  35. @current-change="page_event"
  36. :page-size="search.pagesize"
  37. :total="search.total">
  38. </el-pagination>
  39. <admin_category_add v-if="child_page.type=='admin_category_add'" :point="value" v-model="child_page.obj.id" :back="this"></admin_category_add>
  40. </div>
  41. </template>
  42. <script>
  43. import admin_category_add from '@/components/child_page/admin_category_add';
  44. export default {
  45. props: {
  46. value: {},
  47. },
  48. components: {admin_category_add},
  49. data() {
  50. return {
  51. loading:true,
  52. list: [],
  53. child_page:{
  54. type:"",
  55. obj:{}
  56. },
  57. search:{
  58. pagesize: 20,
  59. name:"",
  60. },
  61. }
  62. },
  63. mounted() {
  64. this.getList();
  65. },
  66. methods: {
  67. show_child_page(type,obj)
  68. {
  69. this.child_page.type=type;
  70. this.child_page.obj=obj;
  71. },
  72. page_event(page) {
  73. this.search.page = page;
  74. this.getList();
  75. },
  76. async search_() {
  77. this.search.page=1;
  78. this.getList();
  79. },
  80. async getList() {
  81. this.loading = true;
  82. let data=this.search;
  83. data.point=this.value-20;
  84. let res = await this.$post("/uapi/admin/pub/admin_category/list",data);
  85. if (res.status == 1) {
  86. this.list = res.data.list;
  87. this.search.total=res.data.total;
  88. }
  89. this.loading = false;
  90. },
  91. }
  92. }
  93. </script>