selectAccount.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. {{name}}账号:
  11. </view>
  12. <view class="uni-list-cell-db">
  13. <input class="uni-input" auto-focus="true" :placeholder="'请填写'+name+'账号'" v-model="account" @input="bindPickerChange($event)" />
  14. </view>
  15. </view>
  16. <view class="uni-list-cell">
  17. <view class="uni-list-cell-left">
  18. {{name}}姓名:
  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. name:{
  87. type:String,
  88. default:'交接人'
  89. }
  90. },
  91. methods: {
  92. //修改picker的值
  93. bindPickerChange(e) {
  94. console.log(e.target.value);
  95. clearTimeout(this.timer);
  96. let cValue = e.target.value;
  97. this.timer = setTimeout(()=>{
  98. let account = e.target.value;
  99. post("/data/isRepeat", {
  100. hospital: {id: this.hosId},
  101. account
  102. }).then(result => {
  103. if(cValue === account && result.status == 200){
  104. this.accountName = result.userName;
  105. this.account = account;
  106. this.accountId = result.userId;
  107. }
  108. })
  109. },500)
  110. },
  111. // 确定
  112. ok() {
  113. let e = {};
  114. if(this.accountName){
  115. e.accountName = this.accountName;
  116. }
  117. if(this.account){
  118. e.account = this.account;
  119. }
  120. if(this.accountId){
  121. e.accountId = this.accountId;
  122. }
  123. this.$emit("ok", e);
  124. },
  125. // 取消
  126. cancel() {
  127. this.$emit("cancel");
  128. },
  129. },
  130. created() {
  131. this.hosId = uni.getStorageSync('userData').user.currentHospital.id;
  132. }
  133. };
  134. </script>
  135. <style lang="less" scoped>
  136. .changeHospital {
  137. position: fixed;
  138. left: 0;
  139. right: 0;
  140. top: 0;
  141. bottom: 0;
  142. background-color: rgba(0, 0, 0, 0.2);
  143. z-index: 999;
  144. .uni-list-cell {
  145. width: 90%;
  146. display: flex;
  147. flex-direction: row;
  148. justify-content: space-evenly;
  149. align-items: center;
  150. text-align: center;
  151. margin-top: 32rpx;
  152. .uni-list-cell-left {
  153. flex: 3;
  154. font-size: 32rpx;
  155. color: #666;
  156. }
  157. .uni-list-cell-db {
  158. border: 1px solid #e5e9ed;
  159. background-color: #fff;
  160. padding: 16rpx 0;
  161. flex: 5;
  162. }
  163. .uni-list-cell-db-text {
  164. flex: 5;
  165. text-align: left;
  166. }
  167. }
  168. .changeHospital__wrap {
  169. width: 90vw;
  170. position: absolute;
  171. left: 50%;
  172. top: 50%;
  173. transform: translate(-50%, -50%);
  174. background-color: #fff;
  175. border-radius: 12rpx;
  176. color: #666;
  177. .changeHospital__header {
  178. font-size: 36rpx;
  179. color: #000;
  180. height: 84rpx;
  181. display: flex;
  182. justify-content: center;
  183. align-items: center;
  184. }
  185. .changeHospital__article {
  186. width: 90%;
  187. margin: 0 auto 25rpx;
  188. padding: 48rpx 0;
  189. background-color: rgb(249, 250, 251);
  190. border: 2rpx solid rgb(229, 233, 237);
  191. border-radius: 12rpx;
  192. box-sizing: border-box;
  193. display: flex;
  194. flex-direction: column;
  195. justify-content: center;
  196. align-items: center;
  197. &.p0 {
  198. padding: 0;
  199. }
  200. .changeHospital__icon {
  201. font-size: 138rpx;
  202. margin-bottom: 32rpx;
  203. &.changeHospital__icon--success {
  204. color: rgb(52, 179, 73);
  205. }
  206. &.changeHospital__icon--warn {
  207. color: rgb(245, 165, 35);
  208. }
  209. &.changeHospital__icon--error {
  210. color: rgb(255, 58, 82);
  211. }
  212. }
  213. .changeHospital__content {
  214. font-size: 36rpx;
  215. }
  216. .changeHospital__info {
  217. font-size: 32rpx;
  218. color: rgb(102, 102, 102);
  219. }
  220. .specialCloseFlag {
  221. width: 90%;
  222. height: 100%;
  223. padding: 16rpx;
  224. }
  225. .radio-wrap {
  226. .radio-item {
  227. margin-top: 16rpx;
  228. /deep/ .uni-radio-input-checked {
  229. background-color: #49b856 !important;
  230. border-color: #49b856 !important;
  231. }
  232. }
  233. }
  234. }
  235. .changeHospital__footer {
  236. box-sizing: border-box;
  237. height: 100rpx;
  238. border-top: 2rpx solid rgb(229, 233, 237);
  239. display: flex;
  240. align-items: center;
  241. view {
  242. height: 100%;
  243. display: flex;
  244. align-items: center;
  245. justify-content: center;
  246. font-size: 36rpx;
  247. color: rgb(102, 102, 102);
  248. position: relative;
  249. &:nth-of-type(2)::before {
  250. content: "";
  251. position: absolute;
  252. left: 0;
  253. bottom: 0;
  254. width: 2rpx;
  255. height: 87rpx;
  256. background-color: rgb(229, 233, 237);
  257. }
  258. }
  259. .changeHospital__ok {
  260. flex: 1;
  261. color: rgb(73, 184, 86);
  262. }
  263. .changeHospital__cancel {
  264. flex: 1;
  265. }
  266. .changeHospital__know {
  267. flex: 1;
  268. color: rgb(73, 184, 86);
  269. }
  270. }
  271. }
  272. }
  273. </style>