ToKey.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="container">
  3. <view class="input-box">
  4. <input placeholder="默认关键字" @input='onchance' v-model="mechanism" placeholder-style="color:#c0c0c0;" />
  5. </view>
  6. <mepicker ref="picker"
  7. mode="selector"
  8. :list="meList"
  9. @change="handleChange"
  10. @confirm="handleConfirm"
  11. @cancel="handleCancel">
  12. </mepicker>
  13. </view>
  14. </template>
  15. <script>
  16. import mepicker from '@/components/picker/index.vue'
  17. import { hospitalList } from '@/api/record.js';
  18. export default {
  19. components: {
  20. mepicker
  21. },
  22. data() {
  23. return {
  24. mechanism:'',//机构
  25. hospital_id:"",//机构id
  26. meList: [],//机构列表
  27. };
  28. },
  29. onLoad(option) {
  30. if(option.mechanism == '' || option.mechanism == undefined){
  31. this.mechanism = '';
  32. }else{
  33. this.mechanism = option.mechanism;
  34. }
  35. },
  36. watch:{
  37. // meList(newValue, oldValue) {
  38. // if(newValue != oldValue){
  39. // this.mechanism = ''
  40. // }
  41. // },
  42. },
  43. methods:{
  44. //当键盘输入时,触发input事件
  45. onchance(e){
  46. this.keyword = e.detail.value;
  47. this.ListDate();
  48. this.handleTap('picker');
  49. },
  50. //显示弹窗
  51. handleTap(name) {
  52. this.$refs[name].show();
  53. },
  54. //加载机构列表
  55. ListDate(){
  56. let obj = this;
  57. hospitalList({
  58. keyword:obj.mechanism
  59. }).then(e => {
  60. obj.meList = e.data
  61. }).catch((e) => {
  62. console.log(e)
  63. });
  64. },
  65. handleChange (item) {
  66. },
  67. handleCancel (item) {
  68. },
  69. handleConfirm (item) {
  70. let obj = this;
  71. if(item != null){
  72. obj.mechanism = item.item.name;
  73. obj.hospital_id = item.item.id;
  74. uni.navigateTo({
  75. url:'/pages/rescuers/rescuers?hospital_id='+item.item.id+'&mechanism='+item.item.name
  76. })
  77. // uni.showT
  78. }else{
  79. obj.mechanism = '';
  80. obj.keyword = '';
  81. }
  82. },
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. page{
  88. height: 100%;
  89. }
  90. .container{
  91. background-color: #FFFFFF;
  92. height: 100%;
  93. padding-top: 180rpx;
  94. }
  95. //搜索框
  96. .input-box {
  97. width: 92%;
  98. margin: 0rpx auto;
  99. height: 70rpx;
  100. background-color: #f5f5f5;
  101. border-radius: 50rpx;
  102. position: relative;
  103. display: flex;
  104. align-items: center;
  105. .icon {
  106. display: flex;
  107. align-items: center;
  108. position: absolute;
  109. top: 0;
  110. right: 0;
  111. width: 60rpx;
  112. height: 80rpx;
  113. font-size: 34rpx;
  114. color: #c0c0c0;
  115. }
  116. input {
  117. padding-left: 28rpx;
  118. height: 28rpx;
  119. font-size: 28rpx;
  120. }
  121. }
  122. </style>