info.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view>
  3. <u-navbar class="u-navbar-box" :title="handleTitle" placeholder bgColor="transparent" autoBack />
  4. <!-- 小程序不支持动态表单 -->
  5. <!-- <view>
  6. <component :is="currentComponent"></component>
  7. </view> -->
  8. <!-- 加载组件 -->
  9. <view>
  10. <Page1 class="page1" :item="appItem" v-if="judgePageIsShow('page2')" />
  11. <Page2 class="page2" :item="appItem" v-if="judgePageIsShow('page1')" />
  12. <Page3 class="page3" :item="appItem" v-if="judgePageIsShow('page3')" />
  13. <Page4 class="page4" :item="appItem" v-if="judgePageIsShow('page4')" />
  14. </view>
  15. <u-tabbar :value="tabbarKey" v-if="judgeTabbarIsShow('tabbar')" @change="tabbarChange" :zIndex="9" fixed
  16. placeholder safeAre aInsetBottom>
  17. <u-tabbar-item name="page1" text="基本信息" icon="file-text-fill" />
  18. <u-tabbar-item name="page4" text="护理打卡" icon="chrome-circle-fill" v-if="judgeTabbarIsShow('page4')" />
  19. <u-tabbar-item name="page2" text="特困审批" v-if="judgeTabbarIsShow('page2')" icon="chrome-circle-fill" />
  20. <u-tabbar-item name="page3" text="申请进度" v-if="judgeTabbarIsShow('page3')" icon="hourglass-half-fill" />
  21. </u-tabbar>
  22. </view>
  23. </template>
  24. <script setup>
  25. import {
  26. reactive,
  27. ref,
  28. computed,
  29. getCurrentInstance
  30. } from 'vue';
  31. import Page1 from './componenets/page1.vue';
  32. import Page2 from './componenets/page2.vue';
  33. import Page3 from './componenets/page3.vue';
  34. import Page4 from './componenets/page4.vue';
  35. import {
  36. onLoad,
  37. onShow
  38. } from '@dcloudio/uni-app'
  39. import {
  40. getCareInfo
  41. } from '@/common/config/application-api.js'
  42. const {
  43. proxy
  44. } = getCurrentInstance();
  45. const id = ref(0);
  46. const tabbarKey = ref('page1');
  47. const appItem = ref({})
  48. function tabbarChange(key) {
  49. console.log('key', key);
  50. if (key === tabbarKey.value) return;
  51. tabbarKey.value = key;
  52. }
  53. const handleTitle = computed(() => {
  54. if (tabbarKey.value === 'page2') return '特困审批';
  55. else if (tabbarKey.value === 'page1') return '基本信息';
  56. else if (tabbarKey.value === 'page3') return '申请进度';
  57. else if (tabbarKey.value === 'page4') return '护理打卡';
  58. return '特困表单';
  59. })
  60. const roleAuthStatus = {
  61. village: ['no_check'],
  62. area: ['wait_assign_company', 'wait_check'],
  63. nurse: ['assigned'],
  64. company: ['wait_assign_nurse'],
  65. }
  66. function judgePageIsShow(pageName = 'page1') {
  67. let status = appItem.value.status;
  68. let dealStatus = appItem.value.dealStatus;
  69. let roles = proxy.vuex_user.roles;
  70. let judgeBool = true;
  71. let roleAuthArray = [];
  72. roles.map(role => {
  73. if (roleAuthStatus.hasOwnProperty(role)) roleAuthArray.push(...roleAuthStatus[role]);
  74. })
  75. //审批页面只能区民政、公司看到
  76. if (pageName === 'page2') {
  77. if (dealStatus == 'complete') judgeBool = false;
  78. else if (roles.includes('village')) judgeBool = false;
  79. else if (!roleAuthArray.includes(status)) judgeBool = false;
  80. else if (roles.includes('nurse')) judgeBool = false;
  81. //流程记录页面只有除了护理人员之外的人看到
  82. } else if (pageName === 'page3') {
  83. if (roles.includes('nurse')) judgeBool = false;
  84. } else if (pageName === 'page4') {
  85. if (!roles.includes('nurse')) judgeBool = false;
  86. }
  87. return judgeBool && tabbarKey.value == pageName;
  88. }
  89. //tabbar page1 page2 page3
  90. function judgeTabbarIsShow(pageName = 'page1') {
  91. let status = appItem.value.status;
  92. let dealStatus = appItem.value.dealStatus;
  93. let roles = proxy.vuex_user.roles;
  94. let roleAuthArray = [];
  95. roles.map(role => {
  96. if (roleAuthStatus.hasOwnProperty(role)) roleAuthArray.push(...roleAuthStatus[role]);
  97. })
  98. //当只有一个tabbar的时候 比如未审核的时候
  99. if (pageName === 'tabbar' && status == 'no_check') return false;
  100. if (pageName === 'page2') {
  101. if (dealStatus == 'complete') return false;
  102. else if (roles.includes('village')) return false;
  103. else if (!roleAuthArray.includes(status)) return false;
  104. else if (roles.includes('nurse')) return false;
  105. } else if (pageName === 'page3') {
  106. if (roles.includes('nurse')) return false;
  107. } else if (pageName === 'page4') {
  108. if (!roles.includes('nurse')) return false;
  109. }
  110. return true;
  111. }
  112. function initData() {
  113. getCareInfo({
  114. id: id.value
  115. }).then(res => {
  116. appItem.value = res;
  117. // console.log('getCareInfo=>', res);
  118. })
  119. }
  120. onLoad((params) => {
  121. if (params.id) {
  122. id.value = params.id;
  123. // initData();
  124. }
  125. })
  126. onShow(() => {
  127. initData();
  128. })
  129. </script>
  130. <style>
  131. page {
  132. background-color: #F6FAFF;
  133. }
  134. </style>
  135. <style lang="scss" scoped>
  136. ::v-deep {
  137. .u-navbar__content__title {
  138. font-weight: bold;
  139. font-size: 36rpx;
  140. color: #222222;
  141. }
  142. .u-navbar__content,
  143. .u-status-bar {
  144. background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
  145. }
  146. .u-tabbar-item__text {
  147. font-size: 30rpx;
  148. }
  149. .u-tabbar-item__icon {
  150. .u-icon__icon {
  151. font-size: 50rpx !important;
  152. }
  153. }
  154. .u-textarea {
  155. background-color: rgba(245, 248, 252, 1) !important;
  156. border: none;
  157. }
  158. .u-textarea__count {
  159. background-color: transparent !important;
  160. }
  161. .u-steps-item {
  162. padding-bottom: 50rpx;
  163. }
  164. .u-steps-item__line {
  165. background: repeating-linear-gradient(to bottom,
  166. #207DFF 0,
  167. #207DFF 2rpx,
  168. transparent 4rpx,
  169. transparent 8rpx) !important;
  170. }
  171. .u-steps-item__content {
  172. margin-top: 0 !important;
  173. margin-left: 30rpx !important;
  174. .u-text__value {
  175. font-size: 32rpx !important;
  176. color: #222222 !important;
  177. }
  178. }
  179. .up-icon {
  180. padding: 10rpx;
  181. border-radius: 5rpx;
  182. border: 1px dashed rgba(0, 0, 0, 0.6);
  183. width: 50rpx;
  184. height: 50rpx;
  185. justify-content: center;
  186. }
  187. }
  188. .page1 {
  189. // background-color: red;
  190. :deep {
  191. .u-form-item__body {
  192. background-color: #fff;
  193. border-radius: 5rpx;
  194. padding: 10rpx;
  195. margin-bottom: 20rpx;
  196. }
  197. .u-form-item__body__right__content {
  198. margin-top: 10rpx;
  199. background-color: #fff;
  200. border-radius: 5rpx;
  201. padding: 0 24rpx;
  202. }
  203. .u-form-item__body__left__content__label {
  204. font-weight: 550;
  205. font-size: 32rpx;
  206. color: rgba(0, 0, 0, 0.85);
  207. padding-left: 24rpx;
  208. }
  209. .u-form-item__body__left__content__required {
  210. left: 0;
  211. }
  212. .u-textarea {
  213. background-color: #fff !important;
  214. border: none;
  215. padding: 0;
  216. }
  217. }
  218. }
  219. .u-navbar-box {
  220. background: radial-gradient(circle at left, #FFE5E4 0%, #EEF2F5 40%, #DBEEFB 100%);
  221. }
  222. </style>