technicianOptions.vue 4.0 KB

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