1
0

detail.vue 4.6 KB

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