selectAccount.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <view class="changeHospital" v-show="disjunctor">
  3. <view class="changeHospital__wrap">
  4. <view class="changeHospital__header" v-if="title">
  5. {{ title }}
  6. </view>
  7. <view class="changeHospital__article">
  8. <view class="uni-list-cell">
  9. <view class="uni-list-cell-left">
  10. 交接人账号:
  11. </view>
  12. <view class="uni-list-cell-db">
  13. <input class="uni-input" auto-focus="true" placeholder="请填写交接人信息" v-model="account" @input="bindPickerChange($event)" />
  14. </view>
  15. </view>
  16. <view class="uni-list-cell">
  17. <view class="uni-list-cell-left">
  18. 交接人姓名:
  19. </view>
  20. <view class="uni-list-cell-db-text">
  21. <text>{{accountName}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="changeHospital__footer">
  26. <view v-if="operate.ok" class="changeHospital__ok" @click="ok" hover-class="seimin-btn-hover">
  27. {{ operate.ok || "" }}
  28. </view>
  29. <view v-if="operate.cancel" class="changeHospital__cancel" @click="cancel" hover-class="seimin-btn-hover">
  30. {{ operate.cancel || "" }}
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. post
  39. } from "../../http/http.js";
  40. export default {
  41. data() {
  42. return {
  43. userData: null,
  44. hosId:null,
  45. timer:null,
  46. account:'',//交接人账号
  47. accountName:'',//交接人姓名
  48. accountId:''//交接人ID
  49. };
  50. },
  51. watch: {
  52. disjunctor(newValue) {
  53. if (newValue && this.operate.know == "知道了") {
  54. this.time = 5;
  55. this.timer = setInterval(() => {
  56. this.time--;
  57. if (this.time <= 0) {
  58. clearInterval(this.timer);
  59. this.know();
  60. }
  61. }, 1000);
  62. }
  63. },
  64. },
  65. props: {
  66. // 显示隐藏
  67. disjunctor: {
  68. type: Boolean,
  69. default: false,
  70. },
  71. // 标题
  72. title: {
  73. type: String,
  74. default: "提示",
  75. },
  76. // 操作按钮文字
  77. operate: {
  78. type: Object,
  79. default: () => {
  80. return {
  81. ok: "确认",
  82. cancel: "取消",
  83. };
  84. },
  85. },
  86. },
  87. methods: {
  88. //修改picker的值
  89. bindPickerChange(e) {
  90. console.log(e.target.value);
  91. clearTimeout(this.timer);
  92. let cValue = e.target.value;
  93. this.timer = setTimeout(()=>{
  94. let account = e.target.value;
  95. post("/data/isRepeat", {
  96. hospital: {id: this.hosId},
  97. account
  98. }).then(result => {
  99. if(cValue === account && result.status == 200){
  100. this.accountName = result.userName;
  101. this.account = account;
  102. this.accountId = result.userId;
  103. }
  104. })
  105. },500)
  106. },
  107. // 确定
  108. ok() {
  109. let e = {};
  110. if(this.accountName){
  111. e.accountName = this.accountName;
  112. }
  113. if(this.account){
  114. e.account = this.account;
  115. }
  116. if(this.accountId){
  117. e.accountId = this.accountId;
  118. }
  119. this.$emit("ok", e);
  120. },
  121. // 取消
  122. cancel() {
  123. this.$emit("cancel");
  124. },
  125. },
  126. created() {
  127. this.hosId = uni.getStorageSync('userData').user.currentHospital.id;
  128. }
  129. };
  130. </script>
  131. <style lang="less" scoped>
  132. .changeHospital {
  133. position: fixed;
  134. left: 0;
  135. right: 0;
  136. top: 0;
  137. bottom: 0;
  138. background-color: rgba(0, 0, 0, 0.2);
  139. z-index: 999;
  140. .uni-list-cell {
  141. width: 90%;
  142. display: flex;
  143. flex-direction: row;
  144. justify-content: space-evenly;
  145. align-items: center;
  146. text-align: center;
  147. margin-top: 32rpx;
  148. .uni-list-cell-left {
  149. flex: 3;
  150. font-size: 32rpx;
  151. color: #666;
  152. }
  153. .uni-list-cell-db {
  154. border: 1px solid #e5e9ed;
  155. background-color: #fff;
  156. padding: 16rpx 0;
  157. flex: 5;
  158. }
  159. .uni-list-cell-db-text {
  160. flex: 5;
  161. text-align: left;
  162. }
  163. }
  164. .changeHospital__wrap {
  165. width: 90vw;
  166. position: absolute;
  167. left: 50%;
  168. top: 50%;
  169. transform: translate(-50%, -50%);
  170. background-color: #fff;
  171. border-radius: 12rpx;
  172. color: #666;
  173. .changeHospital__header {
  174. font-size: 36rpx;
  175. color: #000;
  176. height: 84rpx;
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. }
  181. .changeHospital__article {
  182. width: 90%;
  183. margin: 0 auto 25rpx;
  184. padding: 48rpx 0;
  185. background-color: rgb(249, 250, 251);
  186. border: 2rpx solid rgb(229, 233, 237);
  187. border-radius: 12rpx;
  188. box-sizing: border-box;
  189. display: flex;
  190. flex-direction: column;
  191. justify-content: center;
  192. align-items: center;
  193. &.p0 {
  194. padding: 0;
  195. }
  196. .changeHospital__icon {
  197. font-size: 138rpx;
  198. margin-bottom: 32rpx;
  199. &.changeHospital__icon--success {
  200. color: rgb(52, 179, 73);
  201. }
  202. &.changeHospital__icon--warn {
  203. color: rgb(245, 165, 35);
  204. }
  205. &.changeHospital__icon--error {
  206. color: rgb(255, 58, 82);
  207. }
  208. }
  209. .changeHospital__content {
  210. font-size: 36rpx;
  211. }
  212. .changeHospital__info {
  213. font-size: 32rpx;
  214. color: rgb(102, 102, 102);
  215. }
  216. .specialCloseFlag {
  217. width: 90%;
  218. height: 100%;
  219. padding: 16rpx;
  220. }
  221. .radio-wrap {
  222. .radio-item {
  223. margin-top: 16rpx;
  224. /deep/ .uni-radio-input-checked {
  225. background-color: #49b856 !important;
  226. border-color: #49b856 !important;
  227. }
  228. }
  229. }
  230. }
  231. .changeHospital__footer {
  232. box-sizing: border-box;
  233. height: 100rpx;
  234. border-top: 2rpx solid rgb(229, 233, 237);
  235. display: flex;
  236. align-items: center;
  237. view {
  238. height: 100%;
  239. display: flex;
  240. align-items: center;
  241. justify-content: center;
  242. font-size: 36rpx;
  243. color: rgb(102, 102, 102);
  244. position: relative;
  245. &:nth-of-type(2)::before {
  246. content: "";
  247. position: absolute;
  248. left: 0;
  249. bottom: 0;
  250. width: 2rpx;
  251. height: 87rpx;
  252. background-color: rgb(229, 233, 237);
  253. }
  254. }
  255. .changeHospital__ok {
  256. flex: 1;
  257. color: rgb(73, 184, 86);
  258. }
  259. .changeHospital__cancel {
  260. flex: 1;
  261. }
  262. .changeHospital__know {
  263. flex: 1;
  264. color: rgb(73, 184, 86);
  265. }
  266. }
  267. }
  268. }
  269. </style>