AddContent.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <div class="addc-wrap addper btscroll">
  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)}}{{item.controlType==1?'(单选)':item.controlType==2?'(多选)':''}}</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. <!-- 时间控件 -->
  39. <PickTime v-if="item.controlType==9"
  40. :item="item"
  41. :key="item.id"
  42. @updata="updataData($event,idx,item)"/>
  43. </li>
  44. </ul>
  45. <div class="result" v-if="allStr">
  46. <p class="title"><span class="line"></span>{{allMoudles.name}}</p>
  47. <p class="bgResult">{{allStr}}</p>
  48. </div>
  49. <div class="thanks">
  50. <p>感谢您的回答,您的病历已经自动生成。</p>
  51. <p>您可以点击预览并提交病历按钮预览病历。</p>
  52. <p>如果没有需要修改的内容,请点击提交,医生便能看到您的病历。</p>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="foot">
  57. <span class="back" @click="back">上一步</span>
  58. <span class="next" @click="next(4)">预览并提交病历</span>
  59. </div>
  60. </div>
  61. </template>
  62. <script type="text/javascript">
  63. import ComTextArea from '../common/ComTextArea.vue';
  64. import MultiLineInput from '../common/MultiLineInput.vue';
  65. import Input from '../common/Input.vue';
  66. import Radio from '../common/Radio.vue';
  67. import CheckBox from '../common/CheckBox.vue';
  68. import {imageUrlPrefix,getAllStr,setScroll,getRouteName,setTitle} from '@utils/tools.js';
  69. import BScroll from 'better-scroll';
  70. import PickTime from '../common/PickTime.vue';
  71. import {mapState} from 'vuex';
  72. export default {
  73. name: 'AddContent',
  74. data() {
  75. return {
  76. imgUrl:imageUrlPrefix,
  77. dataTrd: [],
  78. val: '',
  79. allStr:'',
  80. scroll:null,
  81. allMoudles:{}
  82. }
  83. },
  84. computed:{
  85. ...mapState({
  86. activeModule: state => state.activeModule,
  87. datas: state => state.activeModule.obj.omhistory_show,
  88. }),
  89. },
  90. created(){
  91. let activePart = this.$store.state.activeModule;
  92. this.allMoudles = activePart.obj.replenish_show;
  93. this.dataTrd = this.allMoudles && this.allMoudles.moduleDetailDTOList;
  94. this.allStr = this.$store.state.addContent.txt;
  95. },
  96. beforeRouteEnter (to, from , next) {
  97. next(vm => {
  98. // 通过 `vm` 访问组件实例
  99. setTitle(vm.activeModule.obj.replenish_show.name)
  100. })
  101. },
  102. mounted() {
  103. this.$store.commit('setFinish',52)
  104. this.$nextTick(()=>{
  105. let scroll = setScroll(BScroll,true,'.addper')
  106. this.scroll = scroll
  107. scroll.on('scroll', this.onScroll)
  108. })
  109. },
  110. methods: {
  111. onScroll(data) {
  112. this.$store.commit('setScroll', data)
  113. document.activeElement.scrollIntoViewIfNeeded(true);
  114. },
  115. back() {
  116. this.$router.go(-1);
  117. },
  118. changeAreaVal(value, idx) {
  119. this.val = value
  120. },
  121. next(flg){
  122. let routeName = getRouteName(flg)
  123. this.$router.push({
  124. path:routeName
  125. })
  126. this.$store.commit('setText',{data:this.dataTrd,type:this.allMoudles&&this.allMoudles.type});
  127. this.$emit('next','preview')
  128. },
  129. setDetail(obj){
  130. this.labelDetail = obj.detail;
  131. this.ppId = obj.ppId;
  132. this.show = true;
  133. },
  134. updateOrig(){
  135. let origin = this.$store.state.diagnose.origin;
  136. // this.dtoList = origin;console.log("更新:",origin)
  137. },
  138. updataData(data,idx,item){
  139. let mapping = this.dataTrd;
  140. let allData = this.$store.state.allMoudles;
  141. let tmpTrdData = allData.filter((item) => item.type == 52);
  142. if(data.controlType == 3){//多行输入,多了一层需单独处理
  143. let tmpLis = item.questionDetailList;
  144. tmpLis.splice(idx,1,data);
  145. this.allStr=getAllStr({data:tmpTrdData&&tmpTrdData[0].moduleDetailDTOList,type:this.allMoudles&&this.allMoudles.type}).allStr;
  146. }else{
  147. for(let i in mapping){
  148. if(mapping[i].id==data.id){
  149. mapping.splice(i,1,data)
  150. }
  151. }
  152. this.allStr=getAllStr({data:tmpTrdData&&tmpTrdData[0].moduleDetailDTOList,type:this.allMoudles&&this.allMoudles.type}).allStr
  153. this.$store.commit('setDataAll',{data:data,idx:idx});
  154. }
  155. this.$store.commit('setText',{data:tmpTrdData&&tmpTrdData[0].moduleDetailDTOList,type:this.allMoudles&&this.allMoudles.type});
  156. this.$nextTick(()=>{
  157. this.scroll.refresh()
  158. })
  159. },
  160. },
  161. components: {
  162. ComTextArea,
  163. MultiLineInput,
  164. Input,
  165. Radio,
  166. CheckBox,
  167. PickTime
  168. }
  169. }
  170. </script>
  171. <style lang="less" scoped>
  172. @import "../less/base.less";
  173. .comArea,.inp-wrap,.toast-wrap {
  174. padding-left:0 !important;
  175. padding-right: 0 !important;
  176. }
  177. .questionImg {
  178. width: 100%;
  179. }
  180. .addc-wrap {
  181. font-size: 0.3rem;
  182. overflow: hidden;
  183. .content {
  184. // padding-right: .3rem;
  185. }
  186. // .btscroll;
  187. h3 {
  188. color: #colors[quest];
  189. margin-bottom: 0.36rem;
  190. }
  191. }
  192. .choose {
  193. padding-bottom: 0.2rem;
  194. .addPart {
  195. li {
  196. margin-bottom: 0.1rem;
  197. clear: both;
  198. }
  199. .question {
  200. margin-bottom: 0.2rem;
  201. font-weight: bold;
  202. }
  203. .comArea {
  204. padding-top: 0;
  205. padding-bottom: 0;
  206. }
  207. }
  208. }
  209. .foot{
  210. .dbfooter;
  211. }
  212. .result{
  213. margin-bottom: .3rem;
  214. word-break: break-all;
  215. }
  216. .thanks {
  217. font-size: .28rem /* 28/100 */;
  218. color: #666666;
  219. letter-spacing: 0;
  220. text-align: justify;
  221. line-height: .48rem /* 48/100 */;
  222. }
  223. .label{
  224. .label;
  225. }
  226. </style>