JSelectUser.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div>
  3. <a-modal
  4. :title="title"
  5. :width="800"
  6. :visible="visible"
  7. :confirmLoading="confirmLoading"
  8. @ok="handleSubmit"
  9. @cancel="handleCancel">
  10. <div>
  11. <a-form-item label="用户名:" :label-col="{ span: 5 }" :wrapper-col="{ span: 12 }">
  12. <a-input-search placeholder="点击右侧按钮选择用户" disabled @search="onSearch" v-model="userNames">
  13. <a-button slot="enterButton" icon="search">选择</a-button>
  14. </a-input-search>
  15. </a-form-item>
  16. </div>
  17. </a-modal>
  18. <!-- 用户查询列表 -->
  19. <select-user-list-modal ref="selectUserListModal" @ok="getUserCallBack"></select-user-list-modal>
  20. </div>
  21. </template>
  22. <script>
  23. import {getUserList} from '@/api/api'
  24. import SelectUserListModal from './modal/SelectUserListModal'
  25. export default {
  26. name: "SelectUserModal",
  27. components: {
  28. SelectUserListModal,
  29. },
  30. props: ['taskId'],
  31. data() {
  32. return {
  33. title: "操作",
  34. visible: false,
  35. selectUserListVisible: false,
  36. model: {},
  37. confirmLoading: false,
  38. userNames: '',
  39. userKeys: '',
  40. }
  41. },
  42. created() {
  43. console.log(this.model)
  44. },
  45. methods: {
  46. open() {
  47. this.userNames = ''
  48. this.userKeys = ''
  49. this.visible = true;
  50. },
  51. close() {
  52. this.$emit('close');
  53. this.visible = false;
  54. },
  55. handleCancel() {
  56. this.close()
  57. },
  58. onSearch() {
  59. this.$refs.selectUserListModal.open();
  60. },
  61. getUserCallBack(selectionRows) {
  62. console.log(selectionRows)
  63. let names = ''
  64. let keys = ''
  65. for (let row of selectionRows) {
  66. names = row.realname + "," + names
  67. keys = row.username + "," + keys
  68. }
  69. this.userNames = names
  70. this.userKeys = keys
  71. console.log('--userkeys--' + this.userKeys)
  72. },
  73. handleSubmit() {
  74. console.log("taskId: " + this.taskId)
  75. this.$emit('ok', this.userKeys, this.taskId);
  76. this.close()
  77. },
  78. }
  79. }
  80. </script>
  81. <style>
  82. </style>