AssignUserGroup.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <div>
  3. <table-lists style="min-height:auto" ref="tableLists" v-model="data" :filter="filter" :filterReset="0" requestApi="/system/auth/getUserGroup">
  4. <template slot="filterContent">
  5. <FormItem>
  6. <Input type="text" size="large" v-model="filter.keyword" placeholder="搜索关键词"/>
  7. </FormItem>
  8. </template>
  9. <Table size="large" ellipsis :columns="columns" :data="data.lists['noAssign']" stripe height="270">
  10. <template slot-scope="{ row }" slot="op">
  11. <Button size="small" type="success" @click="add(row)">加入</Button>
  12. </template>
  13. </Table>
  14. </table-lists>
  15. <Table size="large" ellipsis style="margin-top: 10px" :columns="columns" :data="data.lists['assign']" stripe height="270">
  16. <template slot-scope="{row,index}" slot="op">
  17. <Button size="small" type="error" @click="remove(row,index)">移出</Button>
  18. </template>
  19. </Table>
  20. </div>
  21. </template>
  22. <script>
  23. export default {
  24. name: 'AssignUserGroup',
  25. data() {
  26. return {
  27. data: {
  28. lists: []
  29. },
  30. filter: {
  31. keyword: "",
  32. id: 0,
  33. },
  34. columns: [
  35. {
  36. type: 'ID',
  37. key: 'id',
  38. width: 70,
  39. align: 'center'
  40. },
  41. {
  42. title: '名称',
  43. key: 'name',
  44. },
  45. {
  46. title: '操作',
  47. slot: 'op',
  48. width: 140,
  49. },
  50. ]
  51. }
  52. },
  53. props: {
  54. id: Number,
  55. },
  56. created() {
  57. this.filter.id = this.id;
  58. },
  59. methods: {
  60. remove(row) {
  61. this.$request('/system/auth/removeUserGroup').data({
  62. id: this.id,
  63. userGroupId: row.id
  64. }).success(() => {
  65. this.reload();
  66. }).get();
  67. },
  68. add(row) {
  69. this.$request('/system/auth/assignUserGroup').data({
  70. id: this.id,
  71. userGroupId: row.id
  72. }).success(() => {
  73. this.reload();
  74. }).get();
  75. },
  76. reload() {
  77. this.$refs.tableLists.reload(true);
  78. this.$emit('reload')
  79. }
  80. }
  81. }
  82. </script>