page1.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="page1-warp">
  3. <up-form labelPosition="top" :model="formData" ref="formRef">
  4. <!-- 'wait_assign_company,wait_assign_nurse'.includes(item.status) -->
  5. <up-form-item label="指派任务" labelWidth="auto" v-if="item.status && item.status.includes('wait_assign')" required>
  6. <view class="flex-row justify-between align-center" style="width: 100%;">
  7. <view v-if="item.status === 'wait_assign_company'">
  8. <view class="">护理公司</view>
  9. <view class="flow-tips-content" :class="{'theme-color': chooseInfo.name}">
  10. {{chooseInfo.name??'请选择护理公司'}}
  11. </view>
  12. </view>
  13. <view v-if="item.status === 'wait_assign_nurse'">
  14. <view class="flow-tips">护理人员</view>
  15. <view class="flow-tips-content" :class="{'theme-color': chooseInfo.name}">
  16. {{chooseInfo.name??'请选择护理人员'}}
  17. </view>
  18. </view>
  19. <view class="icon-box" @tap="goToChoosePage">
  20. <up-icon v-if="!chooseInfo.name" size="28" class="up-icon" name="plus" />
  21. <up-avatar v-else size="80rpx" :text="nameText(chooseInfo.name)" shape="square"
  22. bgColor="#305BFF" />
  23. </view>
  24. </view>
  25. </up-form-item>
  26. <!-- <up-form-item label="护理打卡(0/6)" labelWidth="auto" required>
  27. <view class="flex-row justify-between align-center" style="width: 100%;">
  28. <u-upload :sizeType="['compressed']" :capture="['camera']" />
  29. </view>
  30. </up-form-item>
  31. <up-form-item label="护理评分" labelWidth="auto" required>
  32. <view class="flex-row justify-between align-center" style="width: 100%;">
  33. <up-rate v-model="formData.score" activeIcon="heart-fill" inactiveIcon="heart" count="10"
  34. :size="25" />
  35. <view>{{formData.score*10}}</view>
  36. </view>
  37. </up-form-item> -->
  38. <up-form-item label="审批意见" labelWidth="auto" required>
  39. <up-textarea v-model="formData.remark" placeholder="请输入您的审批意见" count />
  40. </up-form-item>
  41. </up-form>
  42. <view class="btn-box">
  43. <view class="flex-row ">
  44. <up-button class="up-button" v-if="isShowBack" type="error"
  45. style="width: 250rpx;" @tap="checkTap(2)">‌退回</up-button>
  46. <view v-if="isShowBack" class="btn-place"></view>
  47. <up-button v-if='item.status && item.status.includes("wait_assign")'
  48. class="up-button" type="primary" @tap="assignTap"
  49. >指派</up-button>
  50. <up-button v-else class="up-button" type="primary"
  51. @tap="checkTap(1)">通过</up-button>
  52. </view>
  53. </view>
  54. </view>
  55. </template>
  56. <script setup>
  57. import {
  58. ref,
  59. reactive,
  60. computed
  61. } from 'vue';
  62. import {
  63. useStore
  64. } from 'vuex';
  65. import {
  66. onLoad,
  67. onUnload
  68. } from "@dcloudio/uni-app"
  69. import {
  70. postCareAssign,
  71. postCareCheck,
  72. postCareComplete
  73. } from '@/common/config/application-api.js'
  74. const store = useStore();
  75. const props = defineProps({
  76. item: {
  77. type: Object,
  78. default () {
  79. return {}
  80. }
  81. }
  82. })
  83. // 使用 ref 创建响应式引用
  84. const formRef = ref(null);
  85. const formData = reactive({
  86. remark: '', //审核意见
  87. careCompany: '', //护理公司
  88. careStaff: '', //护理人员
  89. score: 1, //评分
  90. })
  91. const formRule = reactive({
  92. remark: ''
  93. })
  94. const chooseInfo = ref({}); //选择的数据
  95. //名字取值
  96. const nameText = computed(() => {
  97. return (name) => {
  98. name = name.replaceAll('南充','').replaceAll('服务','').replaceAll('养老', '').replaceAll('有限公司', '');
  99. let index = name.length - 2;
  100. index = index >= 0 ? index : 0;
  101. return name.substring(index);
  102. };
  103. })
  104. //跳转选择的页面
  105. function goToChoosePage() {
  106. let params = {
  107. maxCount: 1
  108. }
  109. if (chooseInfo.value.name) {
  110. params.dufaultIds = chooseInfo.value.id + "";
  111. }
  112. if(props.item.status === 'wait_assign_company') {
  113. params.pageType = 'company';
  114. }else if(props.item.status === 'wait_assign_nurse') {
  115. params.pageType = 'user';
  116. }
  117. uni.$u.route('/pages/subpack/pages/application/choose', params)
  118. }
  119. //是否显示退回按钮
  120. function isShowBack(){
  121. let user = store.state.vuex_user;
  122. return user.roles.includes('area') && props.item.status == 'wait_check';
  123. }
  124. //点击处理指派
  125. function assignTap(){
  126. if(!chooseInfo.value.id) {
  127. uni.$u.toast('请选择指派的公司');
  128. return false;
  129. }
  130. let checkParams = {...props.item};
  131. if(props.item.status === 'wait_assign_nurse') {
  132. checkParams.status = 'assigned';
  133. checkParams.nurseId = chooseInfo.value.id;
  134. } else {
  135. checkParams.status = 'wait_assign_nurse';
  136. checkParams.companyId = chooseInfo.value.id;
  137. }
  138. checkParams.assignNurseRemark = formData.remark;
  139. postCareAssign(checkParams).then(res=>{
  140. uni.$u.toast('指派成功');
  141. uni.$emit('renderApplyList');
  142. setTimeout(()=>{
  143. uni.$u.route({
  144. type: 'back'
  145. })
  146. }, 1000)
  147. })
  148. }
  149. //点击处理审核 1 审核 2 退回
  150. function checkTap(type = 2){
  151. if(!formData.remark){
  152. uni.$u.toast('审核理由不能为空');
  153. return false;
  154. }
  155. let checkParams = {...props.item};
  156. checkParams.status = 'wait_assign_company';
  157. if(type == 2) {
  158. checkParams.status = 'disagree';
  159. }
  160. checkParams.auditReason = formData.remark;
  161. postCareCheck(checkParams).then(res=>{
  162. uni.$u.toast('审核成功');
  163. uni.$emit('renderApplyList');
  164. setTimeout(()=>{
  165. uni.$u.route({
  166. type: 'back'
  167. })
  168. }, 1000)
  169. })
  170. }
  171. onLoad(() => {
  172. uni.$on('choose', ({
  173. checkList
  174. }) => {
  175. if (checkList && checkList.length > 0) chooseInfo.value = checkList[0];
  176. })
  177. })
  178. onUnload(() => {
  179. uni.$off('choose')
  180. })
  181. </script>
  182. <style lang="scss" scoped>
  183. .page1-warp {
  184. padding: 24rpx 0;
  185. }
  186. .flow-tips {
  187. font-size: 30rpx;
  188. color: #222222;
  189. }
  190. .flow-tips-content {
  191. font-size: 24rpx;
  192. margin-top: 4rpx;
  193. color: rgba(34, 34, 34, .3);
  194. }
  195. .btn-box {
  196. padding: 20rpx 36rpx;
  197. background-color: #fff;
  198. position: fixed;
  199. bottom: calc(50px + var(--status-bar-height));
  200. /* bottom: 50px; */
  201. width: 690rpx;
  202. .btn-place {
  203. width: 100rpx;
  204. }
  205. }
  206. .theme-color {
  207. color: #305BFF !important;
  208. }
  209. .icon-box {
  210. overflow: hidden;
  211. width: 80rpx;
  212. height: 80rpx;
  213. }
  214. </style>