DetailBox.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <portal to="notification-detail">
  3. <div class="detailBoxMask"></div>
  4. <div class="detailBox-wrap">
  5. <div class="content detailBoxMain" ref="detailBox">
  6. <div class="main">
  7. <Detail :datas="privateData"
  8. ref="detail"
  9. :flags="flags"
  10. :data="data"
  11. :tips="tips"
  12. :checkF="checkF"
  13. @check="changeCheck($event)"
  14. @setBtnTxt="setBtnTxt($event)"
  15. @close="close($event)"
  16. @handleClear="handleClear($event)"
  17. @checkReq="changeFins($event)"/>
  18. </div>
  19. </div>
  20. </div>
  21. <div style="position:absolute" class="foot">
  22. <div class="slide" @click="slideAll">{{btnTxt}}</div>
  23. <div class="nextBtn compete" @click="complete">完成</div>
  24. </div>
  25. <Toast :message="clearTxt"
  26. :show="showToast"
  27. @comfirn="comfirnDel"
  28. @cancel="cancelDel"/>
  29. </portal>
  30. </template>
  31. <script type="text/javascript">
  32. import Detail from './Detail.vue';
  33. import Toast from '../common/Toast.vue';
  34. import Picker from '../common/Picker.vue';
  35. import {fixedKeyboard,moduleCP} from '@utils/tools.js';
  36. import $ from 'jquery';
  37. export default {
  38. name:'DetailBox', //点开详情的盒子
  39. props:['flags'],
  40. data(){
  41. const {detailInfo,detailShow} = this.$store.state;
  42. const {detail} = this.$store.state.detailInfo;
  43. let signNum = 1,tmpData = this.$store.state.detailInfo.detail,tmpArr=[];
  44. if(tmpData.checkedAll != 1){
  45. for(let i = 0;i < tmpData.questionMapping.length;i++){
  46. if(tmpData.questionMapping[i].flag != 3){
  47. tmpArr.push(tmpData.questionMapping[i])
  48. }else{
  49. if(signNum != 1){
  50. tmpArr.push(tmpData.questionMapping[i])
  51. }else{
  52. ++signNum
  53. }
  54. }
  55. }
  56. tmpData.questionMapping = tmpArr
  57. tmpData.checkedAll = 1
  58. }
  59. return{
  60. msg:"胸痛详情",
  61. data:detailInfo,
  62. privateData:tmpData||{},
  63. compFlag:false,
  64. clearTxt:"是否清空当前已选内容?",
  65. showToast:false,
  66. tips:"温馨提示:请完成病情预问诊可让医生提前了解病情",
  67. checkF:false, //详情页有无已选项标识
  68. show:detailShow,
  69. reqFinish:false,
  70. showPic:false,
  71. btnTxt:'展开全部'
  72. }
  73. },
  74. mounted(){
  75. this.$nextTick(()=>{
  76. // 校验是否有已填项,有--弹窗;无--return
  77. let hasCheck = this.$refs.detail.check();
  78. let checkReq = true || this.$refs.detail.checkReq();
  79. if(hasCheck){
  80. this.checkF = true;
  81. }
  82. if(checkReq && hasCheck){
  83. this.reqFinish = true;
  84. }
  85. })
  86. },
  87. methods:{
  88. setBtnTxt(txt){
  89. this.btnTxt = txt
  90. },
  91. slideAll(){
  92. this.$refs.detail.slideAll();
  93. },
  94. close(){
  95. // 有必填项但没值则将choose移除 8-19
  96. // 没点过完成,点关闭时校验是否有必填项--有直接移除
  97. const type = this.data.moduleType;
  98. const select = this.privateData.select;
  99. $(".foot").css({'display':'block'})
  100. if(type == moduleCP['symp'] && !select){//只处理主诉症状
  101. const list = this.privateData.questionMapping;
  102. if(list){
  103. for(let i in list){
  104. // if(list[i].required==1 && !list[i].value){
  105. if(list[i].required==1){
  106. // this.$store.commit('delChoose', {id: this.privateData.id })
  107. // this.$store.commit('delText', { type: moduleCP['symp'], pId: this.privateData.id })
  108. }
  109. }
  110. }
  111. }
  112. this.$store.commit('setDetail',{detail:{}})
  113. },
  114. complete(){
  115. //有选中内容才可以点完成#1919
  116. // if(this.checkF){
  117. //必填项都填完了才可以点完成
  118. // if(this.reqFinish && this.checkF){
  119. // this.$refs.detail.saveData();
  120. // this.$store.commit('setSearchShow', false);
  121. // }
  122. this.$refs.detail.saveData();
  123. this.$store.commit('setSearchShow', false);
  124. },
  125. changeCheck(flag){//是否有选中项
  126. this.checkF = flag;
  127. },
  128. changeFins(flag){//必填项是否都填了
  129. this.reqFinish = flag;
  130. },
  131. handleClear(){//清空
  132. // 校验是否有已填项,有--弹窗;无--return
  133. if(this.checkF){
  134. this.showToast = true;
  135. $(".btscroll").css({'position':'fixed','top':'1rem'})
  136. $(".foot").css({'position':'fixed','bottom':'0'})
  137. }
  138. },
  139. cancelDel(){
  140. $(".btscroll").css({'position':'absolute','top':'0'})
  141. $(".foot").css({'position':'absolute','bottom':'0'})
  142. this.showToast = false;
  143. },
  144. comfirnDel(){
  145. $(".btscroll").css({'position':'absolute','top':'0'})
  146. $(".foot").css({'position':'absolute','bottom':'0'})
  147. this.$refs.detail.clearData();
  148. this.showToast = false;
  149. this.checkF = false;
  150. this.reqFinish = false;
  151. // 让detail组件更新
  152. const type = this.data.moduleType;
  153. if(type == moduleCP['symp']){ //症状情况单独处理
  154. const id = this.privateData.id;
  155. const read = this.$store.state.symptom.datas;
  156. const data = read[id];
  157. this.$store.commit('setDetail',{detail:data,ppId:null,moduleType:moduleCP['symp']})
  158. }
  159. },
  160. },
  161. components:{
  162. Detail,
  163. Toast
  164. },
  165. computed: {
  166. getStoreItem () {
  167. return this.$store.state.detailInfo
  168. }
  169. },
  170. watch: {
  171. getStoreItem:{
  172. handler(newVal){
  173. this.data = newVal;
  174. this.privateData = newVal.detail||{};
  175. },
  176. deep:true
  177. }
  178. },
  179. }
  180. </script>
  181. <style lang="less" scoped>
  182. @import '../less/base.less';
  183. .detailBoxMask {
  184. .mask;
  185. z-index: 110;
  186. }
  187. .tmpDom {
  188. height: 1.5rem;
  189. }
  190. .detailBox-wrap{
  191. position: fixed;
  192. width: 100%;
  193. height: 100%;
  194. top:1rem;
  195. bottom: 0;
  196. left: 0;
  197. z-index: 666;
  198. background: #fff;
  199. font-size: .3rem;
  200. animation: wave .4s linear;
  201. border-radius:.2rem .2rem 0px 0px;
  202. overflow: hidden;
  203. .content{
  204. // height: 100%;
  205. // width:100%;
  206. // padding-bottom: 1rem;
  207. }
  208. }
  209. .foot{
  210. .footer;
  211. .slide {
  212. color: #7C828E;
  213. width: 49%;
  214. display: inline-block;
  215. }
  216. .compete {
  217. width: 49%;
  218. display: inline-block;
  219. }
  220. animation-delay:.6s;
  221. animation: foo .4s linear;
  222. }
  223. .check{
  224. color: #1A1A1A;
  225. }
  226. .noCheck{
  227. background: #CACCFF !important;
  228. }
  229. @keyframes wave {
  230. 0% {top:100% ;}
  231. 25% {top: 75%;}
  232. 50% {top: 50%;}
  233. 75% {top: 25%;}
  234. 100% {top: 45px;}
  235. }
  236. @keyframes foo {
  237. 0% {bottom:-1rem;}
  238. 100% {bottom:0;}
  239. }
  240. </style>