add.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="main">
  3. <view class="form">
  4. <view class="form_group">
  5. <view class="lable">所属科室</view>
  6. <input :value="user.dept.deptName || '无科室'" disabled />
  7. </view>
  8. <view class="form_group">
  9. <view class="lable">选择模板</view>
  10. <picker :range="templateList" range-key="title" @change="picker">
  11. <input placeholder="请选择" v-model="item.templateName" :disabled="true" />
  12. <view class="icon more">&#xe62b;</view>
  13. </picker>
  14. </view>
  15. <view class="form_group">
  16. <view class="lable">指定患者</view>
  17. <picker @click="go()" disabled v-if="item.patientList">
  18. <input placeholder="请选择" :value="item.patientList.length > 0 ? '已选择:' + item.patientList.length + '人' : ''" :disabled="true" />
  19. <view class="icon more">&#xe62b;</view>
  20. </picker>
  21. <input :value="item.patientName" v-else :disabled="true" />
  22. </view>
  23. </view>
  24. <button class="btn" @click="add()">确认</button>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. user: this.getUser(),
  32. item: { patientList: [], op: '根据您于本院做的体检结果异常,请到岑溪人民医院做复诊' },
  33. templateList: []
  34. };
  35. },
  36. onLoad(e) {
  37. this.item.type = e.type || 0;
  38. this.getTemplateList();
  39. this.getDeatil(e);
  40. uni.$on('selectUser', (res) => {
  41. this.item.patientList = res;
  42. });
  43. },
  44. methods: {
  45. getDeatil(e) {
  46. if (e.id) {
  47. this.http.request({
  48. url: '/work/record/detail/' + e.id,
  49. success: (res) => {
  50. this.item = res.data.data;
  51. this.item.patientName = e.patientName;
  52. uni.setNavigationBarTitle({ title: '编辑' });
  53. }
  54. });
  55. }
  56. },
  57. picker(e, tag) {
  58. this.item.templateName = this.templateList[e.detail.value].title;
  59. this.item.op = this.templateList[e.detail.value].op;
  60. this.$forceUpdate();
  61. },
  62. //随访模板
  63. getTemplateList() {
  64. this.http.request({
  65. url: '/work/record/template/list',
  66. data: { type: this.item.type },
  67. success: (res) => {
  68. this.templateList = res.data.data;
  69. }
  70. });
  71. },
  72. //指定患者
  73. go() {
  74. uni.navigateTo({ url: '/pages/follow/doctor/selectUser?selected=' + JSON.stringify(this.item.patientList) });
  75. },
  76. add() {
  77. let rule = [{ name: 'templateName', checkType: 'notnull', errorMsg: this.item.type == 0 ? '提醒标题' : '请选择随访模板' }];
  78. if (!this.verify.check(this.item, rule)) {
  79. uni.showModal({ content: this.verify.error, showCancel: false });
  80. return false;
  81. }
  82. this.http.request({
  83. url: this.item.id ? '/work/record/edit' : '/work/record/add',
  84. method: 'POST',
  85. data: this.item,
  86. success: (res) => {
  87. uni.showModal({
  88. title: '提示',
  89. content: '操作成功',
  90. showCancel: false,
  91. success: (res) => {
  92. uni.$emit('record');
  93. uni.navigateBack();
  94. }
  95. });
  96. }
  97. });
  98. }
  99. }
  100. };
  101. </script>
  102. <style lang="scss"></style>