AddContent.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. this.allStr = this.$store.state.addContent.txt
  80. },
  81. mounted() {
  82. this.$nextTick(()=>{
  83. let scroll = setScroll(BScroll,true,'.addper')
  84. this.scroll = scroll
  85. scroll.on('scroll', this.onScroll)
  86. })
  87. },
  88. methods: {
  89. onScroll(data) {
  90. this.$store.commit('setScroll', data)
  91. document.activeElement.scrollIntoViewIfNeeded(true);
  92. },
  93. back() {
  94. this.$emit("back");
  95. },
  96. changeAreaVal(value, idx) {
  97. this.val = value
  98. },
  99. next(){
  100. this.$store.commit('setText',{data:this.dataTrd,type:this.allMoudles&&this.allMoudles.type});
  101. this.$emit('next','preview')
  102. },
  103. setDetail(obj){
  104. this.labelDetail = obj.detail;
  105. this.ppId = obj.ppId;
  106. this.show = true;
  107. },
  108. updateOrig(){
  109. let origin = this.$store.state.diagnose.origin;
  110. // this.dtoList = origin;console.log("更新:",origin)
  111. },
  112. updataData(data,idx,item){
  113. let mapping = this.dataTrd;
  114. let allData = this.$store.state.allMoudles;
  115. let tmpTrdData = allData.filter((item) => item.type == 52);
  116. if(data.controlType == 3){//多行输入,多了一层需单独处理
  117. let tmpLis = item.questionDetailList;
  118. tmpLis.splice(idx,1,data);
  119. this.allStr=getAllStr({data:tmpTrdData&&tmpTrdData[0].moduleDetailDTOList,type:this.allMoudles&&this.allMoudles.type}).allStr;
  120. }else{
  121. for(let i in mapping){
  122. if(mapping[i].id==data.id){
  123. mapping.splice(i,1,data)
  124. }
  125. }
  126. this.allStr=getAllStr({data:tmpTrdData&&tmpTrdData[0].moduleDetailDTOList,type:this.allMoudles&&this.allMoudles.type}).allStr
  127. this.$store.commit('setDataAll',{data:data,idx:idx});
  128. }
  129. this.$store.commit('setText',{data:tmpTrdData&&tmpTrdData[0].moduleDetailDTOList,type:this.allMoudles&&this.allMoudles.type});
  130. this.$nextTick(()=>{
  131. this.scroll.refresh()
  132. })
  133. },
  134. },
  135. components: {
  136. ComTextArea,
  137. MultiLineInput,
  138. Input,
  139. Radio,
  140. CheckBox
  141. }
  142. }
  143. </script>
  144. <style lang="less" scoped>
  145. @import "../less/base.less";
  146. .questionImg {
  147. width: 100%;
  148. }
  149. .symp-wrap {
  150. font-size: 0.3rem;
  151. overflow: hidden;
  152. .content {
  153. // padding-right: .3rem;
  154. }
  155. .btscroll;
  156. h3 {
  157. color: #000;
  158. margin-bottom: 0.36rem;
  159. }
  160. }
  161. .choose {
  162. padding-bottom: 0.2rem;
  163. .addPart {
  164. li {
  165. margin-bottom: 0.1rem;
  166. clear: both;
  167. }
  168. .question {
  169. margin-bottom: 0.2rem;
  170. font-weight: bold;
  171. }
  172. }
  173. }
  174. .foot{
  175. .dbfooter;
  176. }
  177. .result{
  178. margin-bottom: .3rem;
  179. }
  180. .thanks {
  181. font-size: .28rem /* 28/100 */;
  182. color: #666666;
  183. letter-spacing: 0;
  184. text-align: justify;
  185. line-height: .48rem /* 48/100 */;
  186. }
  187. .label{
  188. .label;
  189. }
  190. </style>