technicianOptions.vue 3.7 KB

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