1
0

detail.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="main">
  3. <view class="desc">
  4. <view class="item">科室:{{ item.deptName }}</view>
  5. <view class="item">医生:{{ item.doctorName }}</view>
  6. <view class="item">日期:{{ item.createTime }}</view>
  7. </view>
  8. <u-divider text="随访内容"></u-divider>
  9. <view class="item" v-for="(item, index) in item.op" :key="item.name">
  10. <view class="mtt">
  11. <text class="ifnull" v-if="item.ifnull == '必填'">*</text>
  12. <text class="index">{{ index + 1 }}、</text>
  13. <text class="tm">{{ item.name }}</text>
  14. <text class="dx">({{ item.input }})</text>
  15. </view>
  16. <view class="mts">
  17. <input v-if="item.input == '填空'" v-model="item.s_value" placeholder="请输入" :disabled="look" />
  18. <images v-model="item.s_value" type="图片" v-if="item.input == '图片'" :read="look"></images>
  19. <images v-model="item.s_value" type="视频" v-if="item.input == '视频'" :read="look"></images>
  20. <images v-model="item.s_value" type="录音" v-if="item.input == '录音'" :read="look"></images>
  21. <input v-if="item.input == '数字'" type="number" v-model="item.s_value" placeholder="请输入" :disabled="look" />
  22. <textarea v-if="item.input == '多行文本'" v-model="item.s_value" placeholder="请输入" :disabled="look" />
  23. <view class="ops" v-if="item.input == '单选' || item.input == '多选' || item.input == '判断'">
  24. <view v-for="(op, i) in item.selects" :key="op.name">
  25. <view class="op" :class="{ active: op.check }" @click="check(item, op)">{{ op.name }}</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <button class="btn" @click="add()" v-if="!look">立即提交</button>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. look: false,
  38. item: { op: { s_value: [] } }
  39. };
  40. },
  41. onLoad(e) {
  42. this.http.request({
  43. url: this.getUser().doctor ? '/work/record/detail/' + e.id : '/app/follow/detail/' + e.id,
  44. success: (res) => {
  45. this.item = res.data.data;
  46. if (this.getUser().doctor) {
  47. this.look = true;
  48. this.item.deptName = this.getUser().dept.deptName;
  49. this.item.doctorName = this.getUser().nickName;
  50. } else {
  51. this.item.deptName = e.deptName;
  52. this.item.doctorName = e.doctorName;
  53. this.look = this.item.state != 0 ? true : false;
  54. }
  55. this.item.op = JSON.parse(this.item.op);
  56. uni.setNavigationBarTitle({ title: this.item.templateName });
  57. }
  58. });
  59. },
  60. methods: {
  61. //单选或多选
  62. check(item, op) {
  63. if (this.look) {
  64. return;
  65. }
  66. if (item.input == '单选' || item.input == '判断') {
  67. item.selects.forEach((i) => (i.check = false));
  68. op.check = true;
  69. } else {
  70. op.check = !op.check;
  71. }
  72. item.s_value = op.check; //选中项
  73. this.$forceUpdate();
  74. },
  75. add() {
  76. let rule = [];
  77. let obj = {};
  78. this.item.op
  79. .filter((item) => item.ifnull == '必填')
  80. .forEach((item) => {
  81. rule.push({ name: item.name, checkType: 'notnull', errorMsg: '第' + (this.item.op.indexOf(item) + 1) + '项,' + item.name + '不能为空' });
  82. obj[item.name] = item.s_value;
  83. });
  84. if (!this.verify.check(obj, rule)) {
  85. uni.showModal({ content: this.verify.error, showCancel: false });
  86. return;
  87. }
  88. let data = JSON.parse(JSON.stringify(this.item));
  89. data.op = JSON.stringify(data.op);
  90. this.http.request({
  91. url: '/app/follow/push',
  92. data: data,
  93. method: 'POST',
  94. success: (res) => {
  95. uni.showModal({
  96. title: '提示',
  97. content: '感谢您的回访',
  98. showCancel: false,
  99. success: (res) => {
  100. uni.$emit('follow');
  101. uni.navigateBack();
  102. }
  103. });
  104. }
  105. });
  106. }
  107. }
  108. };
  109. </script>
  110. <style lang="scss">
  111. page {
  112. background-color: white;
  113. }
  114. .desc {
  115. background-color: $bg;
  116. padding: 10px;
  117. border-radius: 7px;
  118. .item {
  119. padding-top: 5px;
  120. font-size: 15px;
  121. color: $font-c;
  122. }
  123. }
  124. .item {
  125. .mtt {
  126. text-align: left;
  127. font-size: 16px;
  128. padding: 15px 0px 12px 0px;
  129. position: relative;
  130. color: $font-c;
  131. .ifnull {
  132. color: red;
  133. font-weight: bold;
  134. }
  135. .tm {
  136. padding-left: 0px;
  137. }
  138. .dx {
  139. font-size: 12px;
  140. color: #646464;
  141. }
  142. }
  143. input {
  144. background-color: $inp;
  145. border-radius: 5px;
  146. padding: 12px;
  147. font-size: 14px;
  148. }
  149. textarea {
  150. background-color: $inp;
  151. border-radius: 5px;
  152. width: 93%;
  153. padding: 12px;
  154. font-size: 14px;
  155. height: 70px;
  156. }
  157. .ops {
  158. margin-top: -5px;
  159. overflow: hidden;
  160. .op {
  161. padding: 9px;
  162. background-color: $inp;
  163. margin-top: 10px;
  164. font-size: 14px;
  165. border-radius: 3px;
  166. color: #656363;
  167. float: left;
  168. margin-right: 10px;
  169. &.active {
  170. background-color: $main-color;
  171. color: white;
  172. }
  173. }
  174. }
  175. }
  176. </style>