ProjectContact.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <!--
  2. * @Author: liuzhenlin 461480418@qq.ocm
  3. * @Date: 2023-02-15 10:34:49
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-02-17 16:58:35
  6. * @Description: file content
  7. * @FilePath: \oms\components\ProjectContact.vue
  8. -->
  9. <template>
  10. <view>
  11. <u-popup :show="concatVisible" @close="close">
  12. <view class="tit">选择项目联系人</view>
  13. <view class="search-container">
  14. <view class="search-input">
  15. <u-input
  16. clearable
  17. placeholderStyle="font-size:26rpx"
  18. :customStyle="{ height: '66rpx' }"
  19. v-model="queryForm.keyWords"
  20. prefixIcon="search"
  21. prefixIconStyle="font-size: 22px;color: #909399"
  22. placeholder="请输入联系人名称"
  23. shape="circle"
  24. border="surround"></u-input>
  25. </view>
  26. <view class="search-btn" @click="getUserList()">搜索</view>
  27. </view>
  28. <u-empty mode="list" v-if="userList.length == 0"></u-empty>
  29. <view class="concat-list" v-else>
  30. <u-radio-group v-model="userValue" placement="column">
  31. <view class="radio-item" v-for="item in userList" :key="item.id">
  32. <u-radio :label="item.label" :name="item.id" @change="radioChange"></u-radio>
  33. </view>
  34. </u-radio-group>
  35. </view>
  36. </u-popup>
  37. </view>
  38. </template>
  39. <script>
  40. import userApi from '@/api/system/user'
  41. import to from 'await-to-js'
  42. export default {
  43. name: 'OmsCustomerContact',
  44. data() {
  45. return {
  46. concatVisible: false,
  47. userList: [],
  48. queryForm: {
  49. busId: 0,
  50. custId: 0,
  51. keyword: '',
  52. pageNum: 1,
  53. pageSize: 10,
  54. },
  55. // u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
  56. userValue: null,
  57. selected: null,
  58. }
  59. },
  60. methods: {
  61. async getUserList() {
  62. let params = this.queryForm
  63. const [err, res] = await to(userApi.getProjectContact(params))
  64. if (err) return
  65. if (res.code == 200 && res.data.list.length > 0)
  66. this.userList = res.data.list.map((item) => ({ id: item.id, label: item.cuctName }))
  67. },
  68. open(busId, custId) {
  69. this.queryForm.busId = busId
  70. this.queryForm.custId = custId
  71. this.concatVisible = true
  72. this.getUserList()
  73. },
  74. close() {
  75. this.concatVisible = false
  76. this.$emit('close', this.selected)
  77. },
  78. radioChange(n) {
  79. this.selected = this.userList.find((item) => item.id == n)
  80. },
  81. },
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .tit {
  86. font-size: 26rpx;
  87. font-weight: bold;
  88. padding: 30rpx 0 0 30rpx;
  89. }
  90. .search-container {
  91. padding: 30rpx 30rpx 0 30rpx;
  92. display: flex;
  93. align-items: center;
  94. .search-input {
  95. flex: 1;
  96. }
  97. .search-btn {
  98. text-align: center;
  99. line-height: 60rpx;
  100. border-radius: 12rpx;
  101. width: 100rpx;
  102. height: 60rpx;
  103. font-size: 26rpx;
  104. margin: 0 0 0 12rpx;
  105. background: $u-primary;
  106. color: #ffffff;
  107. }
  108. }
  109. .concat-list {
  110. padding: 0 0 20rpx 0;
  111. width: 100%;
  112. height: 900rpx;
  113. overflow: auto;
  114. margin-top: 30rpx;
  115. .radio-item {
  116. padding: 20rpx 30rpx;
  117. border-bottom: 1px solid #ccc;
  118. }
  119. }
  120. </style>