DetailBox.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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.name+'详情'}}</span>
  8. <span @click="handleClear">清空</span>
  9. </div>
  10. <div class="main">
  11. <Detail :datas="privateData"
  12. ref="detail"
  13. :type="moduleType"
  14. :ppId="ppId"/>
  15. </div>
  16. <div class="foot" @click="complete">完成</div>
  17. <Toast :message="clearTxt"
  18. :show="showToast"
  19. @comfirn="comfirnDel"
  20. @cancel="cancelDel"/>
  21. </div>
  22. </template>
  23. <script type="text/javascript">
  24. import Detail from './Detail.vue';
  25. import Toast from '../common/Toast.vue';
  26. export default {
  27. name:'DetailBox', //点开详情的盒子
  28. data(){
  29. return{
  30. msg:"胸痛详情",
  31. privateData:{},
  32. compFlag:false,
  33. clearTxt:"是否清空当前已选内容?",
  34. showToast:false
  35. }
  36. },
  37. created(){
  38. this.privateData = this.data;
  39. },
  40. mounted(){
  41. const box = this.$refs.detailBox;
  42. const height = document.documentElement.clientHeight;
  43. box.style.height = height - 45 + 'px';
  44. },
  45. methods:{
  46. close(){
  47. this.$emit("close");
  48. },
  49. complete(){
  50. this.$refs.detail.saveData();
  51. this.$emit("pComplete");
  52. },
  53. handleClear(){//清空
  54. this.showToast = true;
  55. },
  56. cancelDel(){
  57. this.showToast = false;
  58. },
  59. comfirnDel(){
  60. this.$refs.detail.clearData();
  61. this.showToast = false;
  62. // 让detail组件更新
  63. // this.privateData = JSON.parse(JSON.stringify(this.data));
  64. this.$emit('reload',this.data.id);
  65. }
  66. },
  67. props:['data','moduleType','ppId'],
  68. components:{
  69. Detail,
  70. Toast
  71. }
  72. }
  73. </script>
  74. <style lang="less" scoped>
  75. @import '../less/base.less';
  76. .detailBox-wrap{
  77. width: 100%;
  78. // overflow-y: auto;
  79. position: fixed;
  80. bottom: 0;
  81. left: 0;
  82. z-index: 666;
  83. background: #fff;
  84. border-radius: .08rem .08rem 0 0;
  85. font-size: .3rem;
  86. // animation: wave .4s ease-in;
  87. animation: wave .4s linear;
  88. .head{
  89. height: .88rem;
  90. line-height: .88rem;
  91. display: flex;
  92. justify-content: space-between;
  93. border-bottom: 1px solid #E6E7EF;
  94. padding: 0 .4rem 0 .32rem;
  95. font-size: .28rem;
  96. color: #7C828E;
  97. .icon{
  98. display: inline-block;
  99. height: 100%;
  100. padding: 0 .1rem;
  101. img{
  102. width:.34rem;
  103. vertical-align: middle;
  104. }
  105. }
  106. .name{
  107. font-size: .32rem;
  108. color: #1A1A1A;
  109. }
  110. }
  111. .main{
  112. height: 100%;
  113. width:100%;
  114. overflow-y: auto;
  115. }
  116. .foot{
  117. .footer;
  118. animation-delay:.6s;
  119. animation: foo .4s linear;
  120. /* width:100%;
  121. height: .88rem;
  122. line-height: .88rem;
  123. text-align: center;
  124. color:#fff;
  125. font-size: .32rem;
  126. background: linear-gradient(-270deg, #4F4FFF,#4F8BFF); */
  127. }
  128. }
  129. @keyframes wave {
  130. 0% {top:100% ;}
  131. 25% {top: 75%;}
  132. 50% {top: 50%;}
  133. 75% {top: 25%;}
  134. 100% {top: 45px;}
  135. }
  136. @keyframes foo {
  137. 0% {bottom:-1rem;}
  138. 100% {bottom:0;}
  139. }
  140. </style>