1
0

detail.vue 4.2 KB

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