AddContent.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div class="symp-wrap addper">
  3. <div class="content">
  4. <div class="choose">
  5. <ul class="addPart">
  6. <li v-for="(item,idx) in dataTrd">
  7. <p class="question">{{idx+1 + '. ' +(item.description||item.name)}}</p>
  8. <img class="questionImg" :src="item.url.replace('{imageUrlPrefix}',imgUrl)" v-if="item.url">
  9. <Radio v-if="item.controlType==1"
  10. :item="item"
  11. :key="item.id"
  12. @updata="updataData($event,idx,item)"/>
  13. <CheckBox v-if="item.controlType==2"
  14. :item="item"
  15. :key="item.id"
  16. @updata="updataData($event,idx,item)"/>
  17. <ComTextArea
  18. v-if="item.controlType == 5"
  19. :item="item"
  20. @updata="updataData($event,idx,item)"
  21. @changeAreaVal="changeAreaVal($event,idx)"
  22. ></ComTextArea>
  23. <Input v-if="item.controlType==6 || item.controlType==7"
  24. :item="item"
  25. :key="item.id"
  26. @updata="updataData($event,idx,item)"/>
  27. <template
  28. v-if="item.controlType == 3"
  29. v-for="(part,index) in item.questionDetailList"
  30. >
  31. <MultiLineInput
  32. v-if="item.controlType == 3"
  33. :msg="part.description||part.name"
  34. :part="part"
  35. @updata="updataData($event,index,item)"
  36. ></MultiLineInput>
  37. </template>
  38. </li>
  39. </ul>
  40. <div class="result" v-if="allStr">
  41. <p class="title">{{allMoudles.name}}</p>
  42. <p>{{allStr}}</p>
  43. </div>
  44. <div class="thanks">
  45. <p>感谢您的回答,您的病历已经自动生成。</p>
  46. <p>您可以点击预览并提交病历按钮预览病历。</p>
  47. <p>如果没有需要修改的内容,请点击提交,医生便能看到您的病历。</p>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="foot">
  52. <span class="back" @click="back">{{'返回'+ preName}}</span>
  53. <span class="next" @click="next">预览并提交病历</span>
  54. </div>
  55. </div>
  56. </template>
  57. <script type="text/javascript">
  58. import ComTextArea from '../common/ComTextArea.vue';
  59. import MultiLineInput from '../common/MultiLineInput.vue';
  60. import Input from '../common/Input.vue';
  61. import Radio from '../common/Radio.vue';
  62. import CheckBox from '../common/CheckBox.vue';
  63. import {imageUrlPrefix,getAllStr,setScroll} from '@utils/tools.js';
  64. import BScroll from 'better-scroll';
  65. export default {
  66. name: 'AddContent',
  67. props: ['allMoudles','preName'],
  68. data() {
  69. return {
  70. imgUrl:imageUrlPrefix,
  71. dataTrd: [],
  72. val: '',
  73. allStr:'',
  74. scroll:null
  75. }
  76. },
  77. created(){
  78. this.dataTrd = this.allMoudles && this.allMoudles.moduleDetailDTOList
  79. },
  80. mounted() {
  81. this.$nextTick(()=>{
  82. let scroll = setScroll(BScroll,true,'.addper')
  83. this.scroll = scroll
  84. scroll.on('scroll', this.onScroll)
  85. })
  86. },
  87. methods: {
  88. onScroll() {
  89. document.activeElement.scrollIntoViewIfNeeded(true);
  90. },
  91. back() {
  92. this.$emit("back");
  93. },
  94. changeAreaVal(value, idx) {
  95. this.val = value
  96. },
  97. next(){
  98. this.$store.commit('setText',{data:this.dataTrd,type:this.allMoudles&&this.allMoudles.type});
  99. this.$emit('next','preview')
  100. },
  101. setDetail(obj){
  102. this.labelDetail = obj.detail;
  103. this.ppId = obj.ppId;
  104. this.show = true;
  105. },
  106. updateOrig(){
  107. let origin = this.$store.state.diagnose.origin;
  108. // this.dtoList = origin;console.log("更新:",origin)
  109. },
  110. updataData(data,idx,item){
  111. let mapping = this.dataTrd;
  112. let allData = this.$store.state.allMoudles;
  113. let tmpTrdData = allData.filter((item) => item.type == 52);
  114. if(data.controlType == 3){//多行输入,多了一层需单独处理
  115. let tmpLis = item.questionDetailList;
  116. tmpLis.splice(idx,1,data);
  117. this.allStr=getAllStr({data:tmpTrdData&&tmpTrdData[0].moduleDetailDTOList,type:this.allMoudles&&this.allMoudles.type}).allStr;
  118. }else{
  119. for(let i in mapping){
  120. if(mapping[i].id==data.id){
  121. mapping.splice(i,1,data)
  122. }
  123. }
  124. this.allStr=getAllStr({data:tmpTrdData&&tmpTrdData[0].moduleDetailDTOList,type:this.allMoudles&&this.allMoudles.type}).allStr
  125. this.$store.commit('setDataAll',{data:data,idx:idx});
  126. }
  127. this.$nextTick(()=>{
  128. this.scroll.refresh()
  129. })
  130. },
  131. },
  132. components: {
  133. ComTextArea,
  134. MultiLineInput,
  135. Input,
  136. Radio,
  137. CheckBox
  138. }
  139. }
  140. </script>
  141. <style lang="less" scoped>
  142. @import "../less/base.less";
  143. .questionImg {
  144. width: 100%;
  145. }
  146. .symp-wrap {
  147. font-size: 0.3rem;
  148. overflow: hidden;
  149. .content {
  150. // padding-right: .3rem;
  151. }
  152. .btscroll;
  153. h3 {
  154. color: #000;
  155. margin-bottom: 0.36rem;
  156. }
  157. }
  158. .choose {
  159. padding-bottom: 0.2rem;
  160. .addPart {
  161. li {
  162. margin-bottom: 0.1rem;
  163. clear: both;
  164. }
  165. .question {
  166. margin-bottom: 0.2rem;
  167. font-weight: bold;
  168. }
  169. }
  170. }
  171. .foot{
  172. .dbfooter;
  173. }
  174. .result{
  175. margin-bottom: .3rem;
  176. }
  177. .thanks {
  178. font-size: .28rem /* 28/100 */;
  179. color: #666666;
  180. letter-spacing: 0;
  181. text-align: justify;
  182. line-height: .48rem /* 48/100 */;
  183. }
  184. .label{
  185. .label;
  186. }
  187. </style>