transferWorkOrderPatient.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="transferWorkOrder">
  3. <mSearch class="search" :mode="2" button="inside" placeholder="请搜索患者名称、住院号" @search="doSearch()" v-model="keyword" searchButtonType="icon" searchButtonName="newicon-saoma"></mSearch>
  4. <scroll-view scroll-y class="list">
  5. <view class="item tac"><text class="green">接收人:</text>{{userDTO.name}}({{userDTO.account}})</view>
  6. <view class="item" v-for="item in listComputed" :key="item.id" @click="selectItem(item)">
  7. <view>{{item.patientName}}({{item.residenceNo}})</view>
  8. <view><checkbox color="#49B856" value="item.id" :checked="item.checked" /></view>
  9. </view>
  10. </scroll-view >
  11. <view class="footer">
  12. <view class="btn gray" hover-class="seimin-btn-hover" @click="toTransferWorkOrderUser()">切换人员</view>
  13. <view class="btn" hover-class="seimin-btn-hover" @click="submit()">提交</view>
  14. </view>
  15. <!-- 弹窗 -->
  16. <!-- 弹窗 -->
  17. <showModel :title="models1.title" :icon="models1.icon" :disjunctor="models1.disjunctor" :content="models1.content" :operate="models1.operate" @ok="ok1" @cancel="cancel1"></showModel>
  18. </view>
  19. </template>
  20. <script>
  21. import { get, post, SM, webHandle } from "../../http/http.js";
  22. import mSearch from "@/components/mehaotian-search-revision/mehaotian-search-revision.vue";
  23. export default {
  24. onShow() {
  25. this.SMFlag = true;
  26. },
  27. onLoad(options) {
  28. console.log('options', options);
  29. this.options = options || {};
  30. this.userDTO = { id: +this.options.userId, name: this.options.userName, account: this.options.userAccount };
  31. this.getList(undefined, true);
  32. },
  33. components: {
  34. //引用mSearch组件,如不需要删除即可
  35. mSearch,
  36. },
  37. data() {
  38. return {
  39. SMFlag: true,
  40. keyword: '',
  41. hosId: uni.getStorageSync('userData').user.currentHospital.id,
  42. list: [],
  43. options: {},
  44. userDTO: {},
  45. // 弹窗model1
  46. models1: {
  47. disjunctor: false,
  48. },
  49. };
  50. },
  51. computed: {
  52. listComputed() {
  53. if(this.keyword){
  54. return this.list.filter( v => v.patientName.includes(this.keyword) || v.residenceNo.includes(this.keyword))
  55. }else{
  56. return this.list;
  57. }
  58. }
  59. },
  60. methods:{
  61. doSearch(){
  62. // 扫码
  63. if (!this.SMFlag) {
  64. return;
  65. }
  66. this.SMFlag = false;
  67. SM().then((content) => {
  68. this.keyword = content;
  69. }).catch(err => {
  70. this.SMFlag = true;
  71. });
  72. },
  73. submit(){
  74. let patientList = this.listComputed.filter(v => v.checked);
  75. if(!patientList.length){
  76. uni.showToast({
  77. icon: "none",
  78. title: "请选择患者!",
  79. });
  80. return;
  81. }
  82. this.models1 = {
  83. disjunctor: true,
  84. content: `您确认将<b style='color:red'>${patientList.map(v => v.patientName).join('、')}</b>相关陪检任务转交给<b style='color:red'>${this.userDTO.name}</b>吗`,
  85. icon: "warn",
  86. operate: {
  87. ok: "确定",
  88. cancel: "取消",
  89. },
  90. };
  91. },
  92. // 确定
  93. ok1() {
  94. this.models1.disjunctor = false;
  95. uni.showLoading({
  96. title: "加载中",
  97. mask: true,
  98. });
  99. post("/patient/patientHandover", {
  100. id: this.userDTO.id,
  101. patientCodes: this.listComputed.filter(v => v.checked).map(v => v.patientCode).toString(),
  102. }).then((result) => {
  103. uni.hideLoading();
  104. if (result.state == 200) {
  105. uni.showToast({
  106. icon: "none",
  107. mask: true,
  108. title: "交接成功!",
  109. });
  110. setTimeout(() => {
  111. uni.navigateTo({
  112. url: `/pages/receiptpage/receiptpage`,
  113. });
  114. },300)
  115. } else {
  116. uni.showToast({
  117. icon: "none",
  118. title: result.msg || "接口获取数据失败!",
  119. });
  120. }
  121. });
  122. },
  123. // 取消
  124. cancel1() {
  125. this.models1.disjunctor = false;
  126. },
  127. toTransferWorkOrderUser() {
  128. uni.redirectTo({
  129. url: `/pages/transferWorkOrder/transferWorkOrderUser`,
  130. });
  131. },
  132. selectItem(patient){
  133. this.list.forEach(v => {
  134. if(v.id === patient.id){
  135. v.checked ? this.$set(v, 'checked', false) : this.$set(v, 'checked', true)
  136. }
  137. })
  138. },
  139. getList(keyword, isInit = false){
  140. uni.showLoading({
  141. title: "加载中",
  142. });
  143. post("/nurse/patientInspect/getUserOrderPatient", {}).then((result) => {
  144. uni.hideLoading();
  145. if (result.status == 200) {
  146. let list = result.list || [];
  147. if(isInit && this.options.selectPatientId){
  148. list.forEach(v => {
  149. if(v.id == this.options.selectPatientId){
  150. v.checked = true;
  151. }
  152. })
  153. }
  154. this.list = list;
  155. } else {
  156. uni.showToast({
  157. icon: "none",
  158. title: result.msg || "接口获取数据失败!",
  159. });
  160. }
  161. });
  162. },
  163. }
  164. }
  165. </script>
  166. <style lang="less" scoped>
  167. .transferWorkOrder{
  168. width: 100%;
  169. height: 100vh;
  170. display: flex;
  171. flex-direction: column;
  172. /deep/ uni-checkbox:not([disabled]) .uni-checkbox-input:hover{
  173. border-color: #49B856!important;
  174. }
  175. .green{
  176. color: #49B856;
  177. font-size: 24rpx;
  178. }
  179. .search{
  180. padding: 10rpx 24rpx;
  181. }
  182. .list{
  183. flex: 1;
  184. min-height: 0;
  185. background-color: #fff;
  186. .item{
  187. height: 100rpx;
  188. line-height: 100rpx;
  189. font-size: 26rpx;
  190. border-bottom: 1rpx solid #D5D5D5;
  191. padding: 0 32rpx;
  192. display: flex;
  193. align-items: center;
  194. justify-content: space-between;
  195. &.tac{
  196. justify-content: center;
  197. }
  198. }
  199. }
  200. .footer{
  201. margin-top: 24rpx;
  202. margin-bottom: 24rpx;
  203. line-height: 80rpx;
  204. height: 80rpx;
  205. background: #fff;
  206. display: flex;
  207. align-items: center;
  208. .btn {
  209. height: 80rpx;
  210. flex: 1;
  211. margin: 0 24rpx 0 0;
  212. background-color: #49B856;
  213. color: #fff;
  214. border-radius: 8rpx;
  215. font-size: 34rpx;
  216. text-align: center;
  217. &:first-of-type{
  218. margin-left: 24rpx;
  219. }
  220. &.gray{
  221. background-color: #8F939C;
  222. }
  223. }
  224. }
  225. }
  226. </style>