technicianOptions.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="page-container uni-column" style="position: absolute;left: 0;right: 0;top: 0;bottom: 0">
  3. <view class="option-container uni-column" style="display: flex;">
  4. <!-- tab-bar -->
  5. <view class="tab-bars uni-row">
  6. <view>
  7. <text style="font-weight: bold;">技术负责人</text>
  8. <view class="line"></view>
  9. </view>
  10. </view>
  11. <!-- 搜索框 -->
  12. <view class="search-container uni-row">
  13. <input type="text" v-model="keywords" placeholder="请输入关键字" />
  14. <view class="btn" @click="handleSearch()">搜索</view>
  15. </view>
  16. </view>
  17. <view class="uni-row" style="background-color:#ffffff;height: 85%;padding-bottom: 12px;margin-top: 8px;">
  18. <view style="width: 100%;height: 100%;overflow: auto;">
  19. <view v-if="optionList&& optionList.length == 0" style="align-items: center;margin-top: 30px">暂无技术员
  20. </view>
  21. <!-- 选项 -->
  22. <view class="option-item" v-for="(item, index) in optionList" :key="index"
  23. @click="handleOptionChecked(item)">
  24. <view class="uni-row">
  25. <view class="value">{{ item.nickName }}</view>
  26. </view>
  27. <uni-icons class="arrow-right" type="right" size="24" />
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script setup>
  34. import {
  35. ref
  36. } from 'vue'
  37. import {
  38. onMounted,
  39. getCurrentInstance
  40. } from 'vue';
  41. import {
  42. onLoad,
  43. onReady,
  44. onUnload,
  45. onShow
  46. } from '@dcloudio/uni-app'
  47. import {
  48. getTechnicianList
  49. } from '@/api/dept/dept.js'
  50. const currentTabName = ref(1)
  51. const keywords = ref('')
  52. const optionList = ref([])
  53. onMounted(() => {
  54. loadTechnicianList()
  55. })
  56. function handleSearch() {
  57. uni.showLoading({
  58. title: '加载中'
  59. });
  60. getTechnicianList({
  61. nickName: keywords.value
  62. }).then(res => {
  63. console.log(res)
  64. if (res.code === 200) {
  65. optionList.value = res.data
  66. uni.hideLoading();
  67. } else {
  68. uni.showToast({
  69. icon: 'none',
  70. title: '技术部无人员'
  71. })
  72. uni.hideLoading();
  73. }
  74. })
  75. }
  76. const loadTechnicianList = () => {
  77. uni.showLoading({
  78. title: '加载中'
  79. });
  80. getTechnicianList().then(res => {
  81. console.log(res)
  82. if (res.code === 200) {
  83. optionList.value = res.data
  84. uni.hideLoading();
  85. } else {
  86. uni.showToast({
  87. icon: 'none',
  88. title: '技术部无人员'
  89. })
  90. uni.hideLoading();
  91. }
  92. })
  93. }
  94. const handleOptionChecked = (data) => {
  95. uni.$emit('addTechnicianEvent', {
  96. technicianId: data.userId,
  97. technicianName: data.nickName
  98. })
  99. uni.navigateBack()
  100. }
  101. </script>
  102. <style lang="scss">
  103. .page-container {
  104. height: 100%;
  105. background-color: #ececec;
  106. font-size: 28rpx;
  107. padding: 24rpx;
  108. box-sizing: border-box;
  109. }
  110. .option-container {
  111. height: 13%;
  112. background-color: #ffffff;
  113. padding: 24rpx;
  114. border-radius: 12rpx;
  115. }
  116. .tab-bars {
  117. height: 56rpx;
  118. >view {
  119. flex: 1;
  120. text-align: center;
  121. .line {
  122. width: 50%;
  123. height: 2px;
  124. margin: 8rpx auto 0 auto;
  125. background-color: #FFFFFF;
  126. }
  127. &.active {
  128. .line {
  129. background-color: #1684FC;
  130. }
  131. }
  132. }
  133. }
  134. .search-container {
  135. margin-top: 16rpx;
  136. align-items: center;
  137. input {
  138. flex: 1;
  139. height: 72rpx;
  140. border: 1px solid #bbbbbb;
  141. padding: 0 8rpx;
  142. box-sizing: border-box;
  143. }
  144. .btn {
  145. display: flex;
  146. flex-direction: row;
  147. width: 112rpx;
  148. height: 72rpx;
  149. align-items: center;
  150. justify-content: center;
  151. background-color: #1684FC;
  152. color: #ffffff;
  153. }
  154. }
  155. .option-item {
  156. position: relative;
  157. margin-top: 24rpx;
  158. padding-bottom: 8rpx;
  159. border-bottom: 1px solid #BBBBBB;
  160. margin-left: 24rpx;
  161. .uni-row {
  162. padding-bottom: 16rpx;
  163. .label {
  164. width: 144rpx;
  165. }
  166. .value {
  167. flex: 1;
  168. }
  169. }
  170. .uni-row:first-child {
  171. font-size: 32rpx;
  172. }
  173. .arrow-right {
  174. position: absolute;
  175. right: 24rpx;
  176. }
  177. }
  178. </style>