admin_user.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. export default {
  2. name: "user_cards_list",
  3. data() {
  4. return {
  5. list: [],
  6. menuDialog:false,
  7. loading:false,
  8. outerVisible: false,
  9. addDialog:false,
  10. editDialog:false,
  11. infoDialog:false,
  12. add_form: {
  13. id: 0,
  14. uid: 0,
  15. group_id: '',
  16. },
  17. info:{
  18. },
  19. menuData: [],
  20. groupData: [],
  21. groupValue: ''
  22. }
  23. },
  24. mounted() {
  25. this.getList();
  26. this.getGroup();
  27. },
  28. methods: {
  29. formAdd() {
  30. var that=this;
  31. var add_form=this.add_form;
  32. add_form.group_id=this.groupValue;
  33. this.$post("/api/admin/admin_user/add", this.add_form).then(res => {
  34. if (res && res.status === 1) {
  35. that.getList();
  36. that.$message.success('操作成功')
  37. that.addDialog = false;
  38. that.add_form.id =0;
  39. that.add_form.group_id ='';
  40. that.editDialog = false;
  41. }
  42. });
  43. },
  44. form(){
  45. },
  46. async del(id)
  47. {
  48. let res = await this.$post("/api/admin/admin_user/del", {id: id});
  49. if (res && res.status === 1) {
  50. this.$message({
  51. type: 'success',
  52. message: '操作成功!'
  53. });
  54. this.getList();
  55. }
  56. },
  57. async delData(row) {
  58. this.$confirm('确定删除后将不可逆, 是否继续?', '提示', {
  59. confirmButtonText: '确定',
  60. cancelButtonText: '取消',
  61. type: 'warning'
  62. }).then(() => {
  63. this.del(row.id);
  64. }).catch(() => {
  65. this.$message({
  66. type: 'info',
  67. message: '已取消'
  68. });
  69. });
  70. },
  71. editGroup(row) {
  72. let form = this.add_form;
  73. form.id = row.id;
  74. form.name = row.name;
  75. this.addDialog=true;
  76. },
  77. addGroup() {
  78. let form = this.add_form;
  79. form.id = "";
  80. form.name = "";
  81. this.addDialog=true;
  82. },
  83. menuDialogShow(row) {
  84. this.menuDialog=true;
  85. this.menuData=[];
  86. this.getMenuData(row.id);
  87. },
  88. async getList() {
  89. let res = await this.$post("/api/admin/admin_user/list");
  90. if (res && res.status === 1) {
  91. this.list = res.data.list || [];
  92. }
  93. },
  94. async getGroup() {
  95. let res = await this.$post("/api/admin/admin_group/list");
  96. if (res && res.status === 1) {
  97. this.groupData = res.data.list || [];
  98. }
  99. },
  100. }
  101. }