DetailBox.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="detailBox-wrap" ref="detailBox">
  3. <div class="head">
  4. <span class="icon" @click="close">
  5. <img src="../images/small-close.png">
  6. </span>
  7. <span class="name">{{(privateData.description ||privateData.name)+'详情'}}</span>
  8. <span @click="handleClear" :class="{'check':checkF}">清空</span>
  9. <i>{{tips}}</i>
  10. </div>
  11. <div class="main">
  12. <Detail :datas="privateData"
  13. ref="detail"
  14. :type="moduleType"
  15. :ppId="ppId"
  16. @check="changeCheck($event)"/>
  17. </div>
  18. <div class="foot" @click="complete">完成</div>
  19. <Toast :message="clearTxt"
  20. :show="showToast"
  21. @comfirn="comfirnDel"
  22. @cancel="cancelDel"/>
  23. </div>
  24. </template>
  25. <script type="text/javascript">
  26. import Detail from './Detail.vue';
  27. import Toast from '../common/Toast.vue';
  28. import {fixedKeyboard} from '@utils/tools.js';
  29. import $ from 'jquery';
  30. export default {
  31. name:'DetailBox', //点开详情的盒子
  32. data(){
  33. return{
  34. msg:"胸痛详情",
  35. privateData:{},
  36. compFlag:false,
  37. clearTxt:"是否清空当前已选内容?",
  38. showToast:false,
  39. tips:"(请完成病情预问诊可让医生提前了解病情)",
  40. checkF:false //详情页有无已选项标识
  41. }
  42. },
  43. created(){
  44. this.privateData = this.data;
  45. },
  46. mounted(){
  47. const box = this.$refs.detailBox;
  48. const height = document.documentElement.clientHeight;
  49. box.style.height = height - 45 + 'px';
  50. // 校验是否有已填项,有--弹窗;无--return
  51. let hasCheck = this.$refs.detail.check();
  52. if(hasCheck){
  53. this.checkF = true;
  54. }
  55. fixedKeyboard();//给Window绑定事件
  56. },
  57. beforeDestroy(){//给Window解绑事件
  58. $(window).off("resize");
  59. $(window).off("click");
  60. },
  61. methods:{
  62. close(){
  63. this.$emit("close");
  64. },
  65. complete(){
  66. this.$refs.detail.saveData();
  67. this.$emit("pComplete");
  68. },
  69. changeCheck(flag){
  70. this.checkF = flag;
  71. },
  72. handleClear(){//清空
  73. // 校验是否有已填项,有--弹窗;无--return
  74. if(this.checkF){
  75. this.showToast = true;
  76. }
  77. },
  78. cancelDel(){
  79. this.showToast = false;
  80. },
  81. comfirnDel(){
  82. this.$refs.detail.clearData();
  83. this.showToast = false;
  84. // 让detail组件更新
  85. // this.privateData = JSON.parse(JSON.stringify(this.data));
  86. this.$emit('reload',this.data.id);
  87. }
  88. },
  89. props:['data','moduleType','ppId'],
  90. components:{
  91. Detail,
  92. Toast
  93. }
  94. }
  95. </script>
  96. <style lang="less" scoped>
  97. @import '../less/base.less';
  98. .detailBox-wrap{
  99. width: 100%;
  100. // overflow-y: auto;
  101. position: fixed;
  102. bottom: 0;
  103. left: 0;
  104. z-index: 666;
  105. background: #fff;
  106. border-radius: .08rem .08rem 0 0;
  107. font-size: .3rem;
  108. // animation: wave .4s ease-in;
  109. animation: wave .4s linear;
  110. .head{
  111. // height: .88rem;
  112. height: 1rem; //增加了提示
  113. line-height: .88rem;
  114. display: flex;
  115. justify-content: space-between;
  116. border-bottom: 1px solid #E6E7EF;
  117. padding: 0 .4rem 0 .32rem;
  118. font-size: .28rem;
  119. color: #7C828E;
  120. i{
  121. position: absolute;
  122. top:0.64rem;
  123. left:0;
  124. font-size: .22rem;
  125. width:100%;
  126. height: .33rem;
  127. line-height: .33rem;
  128. display: inline-block;
  129. text-align: center;
  130. }
  131. .icon{
  132. display: inline-block;
  133. height: 100%;
  134. padding: 0 .1rem;
  135. img{
  136. width:.34rem;
  137. vertical-align: middle;
  138. }
  139. }
  140. .name{
  141. font-size: .32rem;
  142. color: #1A1A1A;
  143. }
  144. }
  145. .main{
  146. height: 100%;
  147. width:100%;
  148. overflow-y: auto;
  149. }
  150. .foot{
  151. .footer;
  152. animation-delay:.6s;
  153. animation: foo .4s linear;
  154. /* width:100%;
  155. height: .88rem;
  156. line-height: .88rem;
  157. text-align: center;
  158. color:#fff;
  159. font-size: .32rem;
  160. background: linear-gradient(-270deg, #4F4FFF,#4F8BFF); */
  161. }
  162. .check{
  163. color: #1A1A1A;
  164. }
  165. }
  166. @keyframes wave {
  167. 0% {top:100% ;}
  168. 25% {top: 75%;}
  169. 50% {top: 50%;}
  170. 75% {top: 25%;}
  171. 100% {top: 45px;}
  172. }
  173. @keyframes foo {
  174. 0% {bottom:-1rem;}
  175. 100% {bottom:0;}
  176. }
  177. </style>