1a24000e1ea1155476e5e27261417b4abf665db4.svn-base 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <a-modal
  3. title="用户列表"
  4. :width="1000"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. @ok="handleSubmit"
  8. @cancel="handleCancel">
  9. <a-table
  10. ref="table"
  11. bordered
  12. size="middle"
  13. rowKey="id"
  14. :columns="columns"
  15. :dataSource="dataSource"
  16. :pagination="ipagination"
  17. :loading="loading"
  18. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"></a-table>
  19. </a-modal>
  20. </template>
  21. <script>
  22. import {getUserList} from '@/api/api'
  23. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  24. export default {
  25. name: "SelectUserListModal",
  26. mixins: [JeecgListMixin],
  27. data() {
  28. return {
  29. title: "操作",
  30. visible: false,
  31. model: {},
  32. confirmLoading: false,
  33. url: {
  34. add: "/act/model/create",
  35. list: "/sys/user/list"
  36. },
  37. columns: [
  38. {
  39. title: '用户账号',
  40. align: "center",
  41. dataIndex: 'username',
  42. fixed: 'left',
  43. width: 200
  44. },
  45. {
  46. title: '用户姓名',
  47. align: "center",
  48. dataIndex: 'realname',
  49. },
  50. {
  51. title: '性别',
  52. align: "center",
  53. dataIndex: 'sex_dictText'
  54. },
  55. {
  56. title: '手机号码',
  57. align: "center",
  58. dataIndex: 'phone'
  59. },
  60. {
  61. title: '邮箱',
  62. align: "center",
  63. dataIndex: 'email'
  64. },
  65. {
  66. title: '状态',
  67. align: "center",
  68. dataIndex: 'status_dictText'
  69. }
  70. ]
  71. }
  72. },
  73. created() {
  74. //Step.2 加载用户数据
  75. getUserList().then((res) => {
  76. if (res.success) {
  77. this.dataSource = res.result.records;
  78. this.ipagination.total = Number(res.result.total);
  79. }
  80. })
  81. },
  82. methods: {
  83. open() {
  84. this.visible = true;
  85. //Step.1 清空选中用户
  86. this.selectedRowKeys = []
  87. this.selectedRows = []
  88. },
  89. close() {
  90. this.$emit('close');
  91. this.visible = false;
  92. },
  93. handleChange(info) {
  94. let file = info.file;
  95. if (file.response.success) {
  96. this.$message.success(file.response.message);
  97. this.$emit('ok');
  98. this.close()
  99. } else {
  100. this.$message.warn(file.response.message);
  101. this.close()
  102. }
  103. },
  104. handleCancel() {
  105. this.close()
  106. },
  107. handleSubmit() {
  108. this.$emit('ok', this.selectionRows);
  109. this.close()
  110. },
  111. }
  112. }
  113. </script>
  114. <style>
  115. </style>