select-user.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div>
  3. <el-alert class="alert" type="info" :closable="false">
  4. <template #title>
  5. <div class="title">
  6. <span>{{formatName}}</span>
  7. <el-button style="padding: 5px;" type="text" @click="clear">清空</el-button>
  8. </div>
  9. </template>
  10. </el-alert>
  11. <div class="content">
  12. <el-row v-for="(row, index) in item" :key="row.organId">
  13. <el-col :span="8">
  14. <el-form-item :label="branchsyId[row.organId] && branchsyId[row.organId].name"></el-form-item>
  15. </el-col>
  16. <el-col :span="16">
  17. <el-form-item
  18. label="交接人"
  19. :prop="`${name}.${index}.transferUserId`"
  20. :rules="[{
  21. required: true, message: '请选择交接人'
  22. }]"
  23. >
  24. <el-select
  25. @change="val => change(val, row)"
  26. :value="row.transferUserId"
  27. clearable
  28. filterable
  29. >
  30. <el-option
  31. v-for="option in options[row.organId]"
  32. :key="option.id || option.userId"
  33. :value="option.id || option.userId"
  34. :label="option.realName"
  35. ></el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. <!-- <el-col :span="6">
  40. <el-button
  41. type="text"
  42. v-if="index == 0"
  43. :disabled="!row.transferUserId"
  44. @click="quickSetting(row.transferUserId)"
  45. >快速设置</el-button>
  46. </el-col> -->
  47. </el-row>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import { employeeLevelDetail, employeeLevel } from '../api'
  53. export default {
  54. props: ['item', 'name', 'branchsyId', 'employeeByOrganId', 'technicianByOrganId'],
  55. computed: {
  56. formatName() {
  57. const types = {
  58. repair: '维修技师',
  59. director: '乐队指导',
  60. education: '乐团主管',
  61. teamTeacher: '运营主管',
  62. }
  63. return types[this.name]
  64. },
  65. options() {
  66. return this.name === 'repair' ? this.technicianByOrganId : this.employeeByOrganId
  67. }
  68. },
  69. methods: {
  70. quickSetting(id) {
  71. this.item.forEach(row => {
  72. if (!row.transferUserId) {
  73. row.transferUserId = id
  74. }
  75. })
  76. },
  77. change(val, row) {
  78. row.transferUserId = val
  79. },
  80. clear() {
  81. this.item.forEach(row => {
  82. row.transferUserId = ''
  83. })
  84. }
  85. }
  86. };
  87. </script>
  88. <style lang="less" scoped>
  89. .alert{
  90. ::v-deep .el-alert__content{
  91. width: 100%;
  92. }
  93. .title{
  94. display: flex;
  95. align-items: center;
  96. justify-content: space-between;
  97. }
  98. }
  99. .content{
  100. padding: 0 24px;
  101. padding-top: 24px;
  102. }
  103. </style>