DiagTreat.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="treat-wrap treatper btscroll">
  3. <div class="content">
  4. <div v-for="(it,i) in dtoList"
  5. v-if="dtoList"
  6. :key="it.id"
  7. class="label">
  8. <p class="quest">{{i + 1 +'.' + (it.description||it.name)}}</p>
  9. <img class="questionImg" :src="it.url.replace('{imageUrlPrefix}',imgUrl)" v-if="it.url">
  10. <Label v-if="it.controlType==0"
  11. :item="it"
  12. :ppId="it.id"
  13. :order="i"
  14. :moduleType="datas.type"/>
  15. <!-- 上传图片 -->
  16. <UploadImg v-if="it.controlType==4"
  17. :item="it"
  18. :moduleType="datas.type"
  19. :imgList="imgs"/>
  20. <!-- 输入框 -->
  21. <Input v-if="it.controlType==6 || it.controlType==7"
  22. :item="it"
  23. :key="it.id"
  24. @updata="updataData($event,it.id,i)"/>
  25. <!-- 文本域 -->
  26. <ComTextArea v-if="it.controlType == 5"
  27. :item="it"
  28. @updata="updataData($event,it.id,i)"/>
  29. <Radio v-if="it.controlType==1"
  30. :item="it"
  31. :key="it.id"
  32. @updata="updataData($event,it.id,i)"/>
  33. <CheckBox v-if="it.controlType==2"
  34. :item="it"
  35. :key="it.id"
  36. @updata="updataData($event,it.id,i)"/>
  37. <!-- 多行输入-->
  38. <template
  39. v-if="it.controlType == 3"
  40. v-for="(part,index) in it.questionDetailList"
  41. >
  42. <MultiLineInput
  43. :msg="part.name"
  44. :part="part"
  45. @updata="updataData($event,it.id,i,index)"
  46. ></MultiLineInput>
  47. </template>
  48. <!-- 时间控件 -->
  49. <PickTime v-if="it.controlType==9"
  50. :item="it"
  51. :key="it.id"
  52. @updata="updataData($event,it.id,i)"/>
  53. </div>
  54. <div class="result" v-if="getText()">
  55. <p class="title"><span class="line"></span>{{datas.name}}</p>
  56. <p class="contentP bgResult">{{getText()}}</p>
  57. </div>
  58. </div>
  59. <div class="foot" v-if="modluesLen==2">
  60. <!-- <span class="back" @click="beBack">{{'返回'+ preName}}</span> -->
  61. <span class="back" @click="beBack">上一步</span>
  62. <span class="next" @click="toNext">预览并提交病历</span>
  63. </div>
  64. <div class="foot" v-else>
  65. <!-- <span class="back" @click="beBack">{{'返回'+ preName}}</span> -->
  66. <!-- <span class="next" @click="toNext">{{'进入'+ nextName}}</span> -->
  67. <span class="back" @click="beBack">上一步</span>
  68. <span class="next" @click="toNext">下一步</span>
  69. </div>
  70. </div>
  71. </template>
  72. <script type="text/javascript">
  73. import UploadImg from '../common/UploadImg.vue';
  74. import Label from '../common/Label.vue';
  75. import DetailBox from './DetailBox.vue';
  76. import Input from '../common/Input.vue';
  77. import ComTextArea from '../common/ComTextArea.vue';
  78. import {moduleCP,patt,imageUrlPrefix,setScroll,trimDots} from '@utils/tools';
  79. import Radio from '../common/Radio.vue';
  80. import CheckBox from '../common/CheckBox.vue';
  81. import BScroll from 'better-scroll';
  82. import MultiLineInput from '../common/MultiLineInput.vue';
  83. import PickTime from '../common/PickTime.vue';
  84. export default {
  85. name:'DiagTreat',
  86. data(){
  87. let {origin,text,datas} = this.$store.state.diagnose;
  88. return{
  89. msg:"诊疗情况",
  90. imgs:this.$store.state.diagnose.imgSrc,
  91. // dtoList:origin, //模板数据
  92. dtoList:datas, //模板数据
  93. labelDetail:{}, //标签明细
  94. checkText:text, //选中的文字-Arr
  95. show:false,
  96. ppId:null,
  97. imgUrl:imageUrlPrefix,
  98. scroll:null
  99. }
  100. },
  101. props:['datas','preName','nextName','modluesLen'],
  102. mounted(){
  103. this.$nextTick(()=>{
  104. let scroll = setScroll(BScroll,true,'.treatper')
  105. this.scroll = scroll
  106. scroll.on('scroll', this.onScroll)
  107. })
  108. },
  109. methods:{
  110. onScroll(data) {
  111. this.$store.commit('setScroll', data);
  112. document.activeElement.scrollIntoViewIfNeeded(true);
  113. },
  114. beBack(){
  115. this.$emit('back');
  116. },
  117. toNext(){
  118. if(this.modluesLen==2){
  119. this.$emit('next','preview')
  120. }else{
  121. this.$emit('next');
  122. }
  123. },
  124. getText(){
  125. let textArr = this.checkText;
  126. let msg = "";
  127. for(let k in textArr){
  128. if(textArr[k] && Array.isArray(textArr[k])){
  129. let temp = textArr[k];
  130. for(let j in temp){
  131. if(temp[j] && temp[j].textP){
  132. msg += temp[j].textP + ','
  133. }
  134. }
  135. }else if(textArr[k]&&textArr[k].textP){
  136. msg += textArr[k].textP + ','
  137. }
  138. }
  139. return trimDots(msg.substring(0,msg.length-1));
  140. },
  141. updataData(data,id,order,index){//输入框存值
  142. let list = this.dtoList;
  143. let value = "";
  144. let valueP = "";
  145. for(let i in list){
  146. if(list[i].id==id){
  147. if(list[i].controlType == 3){//多行输入
  148. let detailList = list[i].questionDetailList;
  149. detailList.splice(index,1,data);
  150. let temVal = "";
  151. for(let k in detailList){
  152. if(detailList[k].value){
  153. temVal += detailList[k].value + ','
  154. }
  155. }
  156. value = valueP = temVal?temVal.substring(0,temVal.length-1):'';
  157. }else{
  158. list.splice(i,1,data);
  159. value = data.value;
  160. valueP = data.valueP;
  161. }
  162. }
  163. }
  164. this.$store.commit('setDatas',{type:moduleCP['diagT'],data:data,pId:data.id,ppId:id});
  165. this.$store.commit('setText',{type:moduleCP['diagT'],text:value.replace(patt,'').replace(/\#\{/g,'').replace(/\}/g,''),textP:valueP.replace(patt,'').replace(/\#\{/g,'').replace(/\}/g,''),pId:data.id,flag:true,order:order});
  166. this.$nextTick(()=>{
  167. this.scroll.refresh()
  168. })
  169. }
  170. },
  171. components:{
  172. UploadImg,
  173. Label,
  174. DetailBox,
  175. Input,
  176. ComTextArea,
  177. Radio,
  178. CheckBox,
  179. MultiLineInput,
  180. PickTime
  181. },
  182. computed:{
  183. getItem(){
  184. return this.$store.state.diagnose.text;
  185. }
  186. },
  187. watch:{
  188. getItem:{
  189. handler(value){
  190. this.checkText = value;
  191. },
  192. deep:true
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="less" scoped>
  198. @import '../less/base.less';
  199. .treat-wrap{
  200. font-size: .3rem;
  201. .bgques,.toast-wrap,.inp-wrap,.comArea {
  202. padding-left:0;
  203. padding-right: 0;
  204. }
  205. .label-wrap {
  206. padding-bottom: 0;
  207. }
  208. .quest{
  209. color: #colors[quest];
  210. font-weight: 700;
  211. }
  212. .label{
  213. .label;
  214. padding-bottom: 0;
  215. }
  216. .result{
  217. .result;
  218. word-break: break-all;
  219. .contentP {
  220. word-break: break-all;
  221. }
  222. }
  223. }
  224. .foot{
  225. .dbfooter;
  226. }
  227. .footer{
  228. .footer;
  229. }
  230. .questionImg {
  231. width: 96%;
  232. }
  233. </style>