admin_category_add.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div>
  3. <el-drawer
  4. title="编辑标签"
  5. size="500px"
  6. :append-to-body="false"
  7. :destroy-on-close="true"
  8. :visible="true"
  9. :modal="false"
  10. :modal-append-to-body="false"
  11. :before-close="handleClose"
  12. :wrapperClosable="false"
  13. ref="drawer_close">
  14. <el-form style="padding-top: 20px;padding-right: 20px;" label-width="100px" v-loading="loading" class="qs-form-add">
  15. <el-form-item label="名称">
  16. <el-input v-model="ruleForm.name"></el-input>
  17. </el-form-item>
  18. <el-form-item label="副标题">
  19. <el-input v-model="ruleForm.sub_title"></el-input>
  20. </el-form-item>
  21. <el-form-item label="排序">
  22. <el-input v-model="ruleForm.order"></el-input>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button type="primary" @click="save()">保存</el-button>
  26. </el-form-item>
  27. </el-form>
  28. </el-drawer>
  29. <div class="ccf_modal"></div>
  30. </div>
  31. </template>
  32. <script>
  33. export default {
  34. props: {
  35. point: {
  36. type: Number,
  37. default: 0
  38. },
  39. value: {
  40. type: Number,
  41. default: 0
  42. },
  43. back:{
  44. type:Object
  45. }
  46. },
  47. async mounted() {
  48. await this.getInfo();
  49. },
  50. data() {
  51. return {
  52. loading:true,
  53. ruleForm:{
  54. },
  55. }
  56. },
  57. methods: {
  58. handleClose: function () {
  59. this.back.child_page.type = "";
  60. },
  61. async getInfo() {
  62. if(!this.value)
  63. {
  64. this.loading = false;
  65. return ;
  66. }
  67. this.loading = true;
  68. let res = await this.$post("/uapi/admin/pub/admin_category/info",{id:this.value});
  69. if (res.status == 1) {
  70. this.ruleForm=res.data;
  71. }
  72. this.loading = false;
  73. },
  74. async save() {
  75. let data=this.ruleForm;
  76. data.id=this.value;
  77. this.loading = true;
  78. let res = await this.$post("/uapi/admin/pub/admin_category/save",this.ruleForm);
  79. if (res.status == 1) {
  80. this.$message.success("保存成功");
  81. this.back.child_page.type = "";
  82. this.back.getList();
  83. }
  84. this.loading = false;
  85. },
  86. }
  87. }
  88. </script>