|
@@ -1,55 +1,28 @@
|
|
|
<template>
|
|
|
- <view class="page1-warp">
|
|
|
- <up-form labelPosition="top" :model="formData" ref="formRef">
|
|
|
- <!-- 'wait_assign_company,wait_assign_nurse'.includes(item.status) -->
|
|
|
- <up-form-item label="指派任务" labelWidth="auto" v-if="item.status && item.status.includes('wait_assign')" required>
|
|
|
- <view class="flex-row justify-between align-center" style="width: 100%;">
|
|
|
- <view v-if="item.status === 'wait_assign_company'">
|
|
|
- <view class="">护理公司</view>
|
|
|
- <view class="flow-tips-content" :class="{'theme-color': chooseInfo.name}">
|
|
|
- {{chooseInfo.name??'请选择护理公司'}}
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view v-if="item.status === 'wait_assign_nurse'">
|
|
|
- <view class="flow-tips">护理人员</view>
|
|
|
- <view class="flow-tips-content" :class="{'theme-color': chooseInfo.name}">
|
|
|
- {{chooseInfo.name??'请选择护理人员'}}
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="icon-box" @tap="goToChoosePage">
|
|
|
- <up-icon v-if="!chooseInfo.name" size="28" class="up-icon" name="plus" />
|
|
|
- <up-avatar v-else size="80rpx" :text="nameText(chooseInfo.name)" shape="square"
|
|
|
- bgColor="#305BFF" />
|
|
|
+ <view class="page4-warp">
|
|
|
+ <view class="page4-form">
|
|
|
+ <up-form labelPosition="top" :model="formData" :rules="formRule" ref="formRef">
|
|
|
+ <up-form-item label="护理时间" labelWidth="auto" labelPosition="left" required prop="nursingTime">
|
|
|
+ <up-input v-model="formData.nursingTime" disabled disabledColor="#ffffff" border="bottom"
|
|
|
+ placeholder="请选择打卡时间" @tap="showTime = true;" />
|
|
|
+ </up-form-item>
|
|
|
+ <up-form-item :label="`护理打卡(0/${imgNum})`" labelWidth="auto" prop="img" required>
|
|
|
+ <view class="flex-row justify-between align-center" style="width: 100%;">
|
|
|
+ <up-upload :fileList="fileList" multiple :sizeType="['compressed']" :capture="['camera']"
|
|
|
+ @afterRead="afterRead" @delete="deletePic" />
|
|
|
</view>
|
|
|
+ </up-form-item>
|
|
|
+ <up-form-item label="备注" labelWidth="auto">
|
|
|
+ <up-textarea v-model="formData.remark" placeholder="请输入您的打卡备注" count />
|
|
|
+ </up-form-item>
|
|
|
+ </up-form>
|
|
|
+ </view>
|
|
|
|
|
|
- </view>
|
|
|
- </up-form-item>
|
|
|
- <!-- <up-form-item label="护理打卡(0/6)" labelWidth="auto" required>
|
|
|
- <view class="flex-row justify-between align-center" style="width: 100%;">
|
|
|
- <u-upload :sizeType="['compressed']" :capture="['camera']" />
|
|
|
- </view>
|
|
|
- </up-form-item>
|
|
|
- <up-form-item label="护理评分" labelWidth="auto" required>
|
|
|
- <view class="flex-row justify-between align-center" style="width: 100%;">
|
|
|
- <up-rate v-model="formData.score" activeIcon="heart-fill" inactiveIcon="heart" count="10"
|
|
|
- :size="25" />
|
|
|
- <view>{{formData.score*10}}</view>
|
|
|
- </view>
|
|
|
- </up-form-item> -->
|
|
|
- <up-form-item label="审批意见" labelWidth="auto" required>
|
|
|
- <up-textarea v-model="formData.remark" placeholder="请输入您的审批意见" count />
|
|
|
- </up-form-item>
|
|
|
- </up-form>
|
|
|
+ <u-datetime-picker :show="showTime" v-model="timeValue" mode="datetime" closeOnClickOverlay
|
|
|
+ @cancel="showTime = false" @close="showTime = false" @confirm="timeConfirm" />
|
|
|
<view class="btn-box">
|
|
|
<view class="flex-row ">
|
|
|
- <up-button class="up-button" v-if="isShowBack" type="error"
|
|
|
- style="width: 250rpx;" @tap="checkTap(2)">退回</up-button>
|
|
|
- <view v-if="isShowBack" class="btn-place"></view>
|
|
|
- <up-button v-if='item.status && item.status.includes("wait_assign")'
|
|
|
- class="up-button" type="primary" @tap="assignTap"
|
|
|
- >指派</up-button>
|
|
|
- <up-button v-else class="up-button" type="primary"
|
|
|
- @tap="checkTap(1)">通过</up-button>
|
|
|
+ <up-button class="up-button" type="primary" @tap="checkTap">确定打卡</up-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -59,7 +32,8 @@
|
|
|
import {
|
|
|
ref,
|
|
|
reactive,
|
|
|
- computed
|
|
|
+ computed,
|
|
|
+ onMounted
|
|
|
} from 'vue';
|
|
|
import {
|
|
|
useStore
|
|
@@ -69,12 +43,12 @@
|
|
|
onUnload
|
|
|
} from "@dcloudio/uni-app"
|
|
|
import {
|
|
|
- postCareAssign,
|
|
|
- postCareCheck,
|
|
|
- postCareComplete
|
|
|
+ getImgNumber,
|
|
|
+ addCareClocks,
|
|
|
+ uploadImg
|
|
|
} from '@/common/config/application-api.js'
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
const store = useStore();
|
|
|
const props = defineProps({
|
|
|
item: {
|
|
@@ -84,127 +58,131 @@
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- // 使用 ref 创建响应式引用
|
|
|
+
|
|
|
+ const showTime = ref(false);
|
|
|
+ const timeValue = ref(new Date().getTime());
|
|
|
const formRef = ref(null);
|
|
|
+ const fileList = ref([]);
|
|
|
const formData = reactive({
|
|
|
- remark: '', //审核意见
|
|
|
- careCompany: '', //护理公司
|
|
|
- careStaff: '', //护理人员
|
|
|
- score: 1, //评分
|
|
|
+ img: [],
|
|
|
+ remark: '', //意见
|
|
|
+ nursingTime: '', //护理时间
|
|
|
})
|
|
|
const formRule = reactive({
|
|
|
- remark: ''
|
|
|
- })
|
|
|
- const chooseInfo = ref({}); //选择的数据
|
|
|
-
|
|
|
- //名字取值
|
|
|
- const nameText = computed(() => {
|
|
|
- return (name) => {
|
|
|
- name = name.replaceAll('南充','').replaceAll('服务','').replaceAll('养老', '').replaceAll('有限公司', '');
|
|
|
- let index = name.length - 2;
|
|
|
- index = index >= 0 ? index : 0;
|
|
|
- return name.substring(index);
|
|
|
- };
|
|
|
+ nursingTime: [{
|
|
|
+ required: true,
|
|
|
+ message: '请选择护理时间',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ }],
|
|
|
+ img: [{
|
|
|
+ required: true,
|
|
|
+ message: '请上传图片',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ }]
|
|
|
})
|
|
|
+ //点击打卡
|
|
|
+ function checkTap() {
|
|
|
+ formRef.value.validate().then(res => {
|
|
|
+ if(res) uni.$u.toast('校验通过')
|
|
|
+ else uni.$u.toast('校验失败');
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
- //跳转选择的页面
|
|
|
- function goToChoosePage() {
|
|
|
- let params = {
|
|
|
- maxCount: 1
|
|
|
- }
|
|
|
- if (chooseInfo.value.name) {
|
|
|
- params.dufaultIds = chooseInfo.value.id + "";
|
|
|
- }
|
|
|
-
|
|
|
- if(props.item.status === 'wait_assign_company') {
|
|
|
- params.pageType = 'company';
|
|
|
- }else if(props.item.status === 'wait_assign_nurse') {
|
|
|
- params.pageType = 'user';
|
|
|
- }
|
|
|
- uni.$u.route('/pages/subpack/pages/application/choose', params)
|
|
|
+ function timeConfirm(e) {
|
|
|
+ // console.log('timeConfirm=>', e);
|
|
|
+ timeValue.value = e.value;
|
|
|
+ formData.nursingTime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
|
|
|
+ showTime.value = false;
|
|
|
}
|
|
|
-
|
|
|
- //是否显示退回按钮
|
|
|
- function isShowBack(){
|
|
|
- let user = store.state.vuex_user;
|
|
|
- return user.roles.includes('area') && props.item.status == 'wait_check';
|
|
|
+ //删除图片
|
|
|
+ function deletePic(event) {
|
|
|
+ fileList.value.splice(event.index, 1);
|
|
|
}
|
|
|
-
|
|
|
- //点击处理指派
|
|
|
- function assignTap(){
|
|
|
- if(!chooseInfo.value.id) {
|
|
|
- uni.$u.toast('请选择指派的公司');
|
|
|
- return false;
|
|
|
- }
|
|
|
- let checkParams = {...props.item};
|
|
|
-
|
|
|
- if(props.item.status === 'wait_assign_nurse') {
|
|
|
- checkParams.status = 'assigned';
|
|
|
- checkParams.nurseId = chooseInfo.value.id;
|
|
|
- } else {
|
|
|
- checkParams.status = 'wait_assign_nurse';
|
|
|
- checkParams.companyId = chooseInfo.value.id;
|
|
|
- }
|
|
|
- checkParams.assignNurseRemark = formData.remark;
|
|
|
- postCareAssign(checkParams).then(res=>{
|
|
|
- uni.$u.toast('指派成功');
|
|
|
- uni.$emit('renderApplyList');
|
|
|
- setTimeout(()=>{
|
|
|
- uni.$u.route({
|
|
|
- type: 'back'
|
|
|
+ //新增图片
|
|
|
+ async function afterRead(event) {
|
|
|
+ // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
|
|
+ let lists = [].concat(event.file);
|
|
|
+ let fileListLen = fileList.value.length;
|
|
|
+ lists.map((item) => {
|
|
|
+ fileList.value.push({
|
|
|
+ ...item,
|
|
|
+ status: "uploading",
|
|
|
+ message: "上传中",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ for (let i = 0; i < lists.length; i++) {
|
|
|
+ const result = await uploadFilePromise(lists[i].url);
|
|
|
+ let item = fileList.value[fileListLen];
|
|
|
+ fileList.value.splice(
|
|
|
+ fileListLen,
|
|
|
+ 1,
|
|
|
+ Object.assign(item, {
|
|
|
+ status: "success",
|
|
|
+ message: "",
|
|
|
+ url: result,
|
|
|
})
|
|
|
- }, 1000)
|
|
|
- })
|
|
|
- }
|
|
|
- //点击处理审核 1 审核 2 退回
|
|
|
- function checkTap(type = 2){
|
|
|
- if(!formData.remark){
|
|
|
- uni.$u.toast('审核理由不能为空');
|
|
|
- return false;
|
|
|
+ );
|
|
|
+ fileListLen++;
|
|
|
}
|
|
|
- let checkParams = {...props.item};
|
|
|
- checkParams.status = 'wait_assign_company';
|
|
|
- if(type == 2) {
|
|
|
- checkParams.status = 'disagree';
|
|
|
- }
|
|
|
- checkParams.auditReason = formData.remark;
|
|
|
- postCareCheck(checkParams).then(res=>{
|
|
|
- uni.$u.toast('审核成功');
|
|
|
- uni.$emit('renderApplyList');
|
|
|
- setTimeout(()=>{
|
|
|
- uni.$u.route({
|
|
|
- type: 'back'
|
|
|
- })
|
|
|
- }, 1000)
|
|
|
- })
|
|
|
+ }
|
|
|
+/**
|
|
|
+ * TODO 上传图片有问题,上传的时间是选择 还是当前时间
|
|
|
+ * 如果今天上传的护理记录 是否还可以继续上传 一天上传几次护理打卡记录
|
|
|
+ */
|
|
|
+
|
|
|
+ //上传图片
|
|
|
+ function uploadFilePromise(url) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let a = uni.uploadFile({
|
|
|
+ url: "http://127.0.0.1/dev-api/care/clocks/upload", // 仅为示例,非真实的接口地址
|
|
|
+ filePath: url,
|
|
|
+ name: "file",
|
|
|
+ formData: {
|
|
|
+ applyId: 12,
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ console.log('uploadImg=>', res);
|
|
|
+ resolve(res.data.data);
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ /* uploadImg({
|
|
|
+ filePath: url,
|
|
|
+ name: 'file'
|
|
|
+ }).then(res => {
|
|
|
+ console.log('uploadImg=>', res);
|
|
|
+ resolve(res.data.data);
|
|
|
+ }) */
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- onLoad(() => {
|
|
|
- uni.$on('choose', ({
|
|
|
- checkList
|
|
|
- }) => {
|
|
|
- if (checkList && checkList.length > 0) chooseInfo.value = checkList[0];
|
|
|
+ //获取打卡图片数量
|
|
|
+ const imgNum = ref(0);
|
|
|
+
|
|
|
+ function getNumber() {
|
|
|
+ getImgNumber({
|
|
|
+ params: {
|
|
|
+ key: 'need_img_num'
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ imgNum.value = res.number;
|
|
|
})
|
|
|
- })
|
|
|
- onUnload(() => {
|
|
|
- uni.$off('choose')
|
|
|
+ }
|
|
|
+
|
|
|
+ onMounted(()=>{
|
|
|
+ getNumber();
|
|
|
})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .page1-warp {
|
|
|
- padding: 24rpx 0;
|
|
|
+ .page4-warp {
|
|
|
+ padding: 30rpx;
|
|
|
}
|
|
|
|
|
|
- .flow-tips {
|
|
|
- font-size: 30rpx;
|
|
|
- color: #222222;
|
|
|
- }
|
|
|
-
|
|
|
- .flow-tips-content {
|
|
|
- font-size: 24rpx;
|
|
|
- margin-top: 4rpx;
|
|
|
- color: rgba(34, 34, 34, .3);
|
|
|
+ .page4-form {
|
|
|
+ padding: 30rpx;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ background-color: #fff;
|
|
|
}
|
|
|
|
|
|
.btn-box {
|
|
@@ -213,21 +191,7 @@
|
|
|
position: fixed;
|
|
|
bottom: calc(50px + var(--status-bar-height));
|
|
|
/* bottom: 50px; */
|
|
|
+ left: 0;
|
|
|
width: 690rpx;
|
|
|
-
|
|
|
- .btn-place {
|
|
|
- width: 100rpx;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .theme-color {
|
|
|
- color: #305BFF !important;
|
|
|
- }
|
|
|
-
|
|
|
- .icon-box {
|
|
|
- overflow: hidden;
|
|
|
- width: 80rpx;
|
|
|
- height: 80rpx;
|
|
|
-
|
|
|
}
|
|
|
</style>
|