fix: 问题修复

This commit is contained in:
huxuejian 2026-05-29 12:06:00 +08:00
parent d05513e8f6
commit 70a5d49e93
6 changed files with 92 additions and 22 deletions

View File

@ -104,15 +104,15 @@ async function getTeam(corpId, teamId, customerId) {
const res = await api('getTeamData', { teamId, corpId });
if (res && res.data) {
team.value = res.data;
const qrcode = team.value && Array.isArray(team.value.qrcodes) ? team.value.qrcodes[0] : null;
const healthTempList = qrcode && Array.isArray(qrcode.healthTempList) ? qrcode.healthTempList : [];
const types = healthTempList.filter(i => typeof i.templateType === 'string' && i.templateType.trim() && i.archiveRecommend === true).map(i => i.templateType);
if (types.length && customerId) {
const nextType = types[0];
const nextTypes = types.slice(1);
const url = `/pages/health/record?type=${nextType}&teamId=${teamId}&corpId=${corpId}&customerId=${customerId}&nextTypes=${nextTypes.join(',')}`
uni.navigateTo({ url });
}
// const qrcode = team.value && Array.isArray(team.value.qrcodes) ? team.value.qrcodes[0] : null;
// const healthTempList = qrcode && Array.isArray(qrcode.healthTempList) ? qrcode.healthTempList : [];
// const types = healthTempList.filter(i => typeof i.templateType === 'string' && i.templateType.trim() && i.archiveRecommend === true).map(i => i.templateType);
// if (types.length && customerId) {
// const nextType = types[0];
// const nextTypes = types.slice(1);
// const url = `/pages/health/record?type=${nextType}&teamId=${teamId}&corpId=${corpId}&customerId=${customerId}&nextTypes=${nextTypes.join(',')}`
// uni.navigateTo({ url });
// }
} else {
toast(res?.message || '获取团队信息失败')
}

View File

@ -26,7 +26,6 @@ import dayjs from 'dayjs';
import useGuard from '@/hooks/useGuard';
import useAccount from '@/store/account';
import api from '@/utils/api';
import { set } from "@/utils/cache";
import { toast, confirm as uniConfirm } from '@/utils/widget';
import validate from '@/utils/validate';
@ -163,9 +162,7 @@ async function addArchive() {
const res = await api('addCustomer', { params });
if (res && res.success) {
uni.$emit('reloadTeamCustomers')
uni.redirectTo({
url: `/pages/archive/archive-result?corpId=${corpId.value}&teamId=${teamId.value}&customerId=${res.data.id}`
})
getTeam(corpId.value, teamId.value, res.data.id);
} else {
toast(res?.message || '新增档案失败');
}
@ -202,7 +199,6 @@ async function init() {
await getCustomer();
} else {
const res = await getArchives();
console.log('res:', res)
if (res.length > 0) {
visible.value = true;
}
@ -281,6 +277,26 @@ async function getReferenceCustomer() {
referenceCustomer.value = res && res.data ? res.data : null;
}
async function getTeam(corpId, teamId, customerId) {
const res = await api('getTeamData', { teamId, corpId });
if (res && res.data) {
const team = res.data;
const qrcode = team && Array.isArray(team.qrcodes) ? team.qrcodes[0] : null;
const healthTempList = qrcode && Array.isArray(qrcode.healthTempList) ? qrcode.healthTempList : [];
const types = healthTempList.filter(i => typeof i.templateType === 'string' && i.templateType.trim() && i.archiveRecommend === true).map(i => i.templateType);
if (types.length && customerId) {
const nextType = types[0];
const nextTypes = types.slice(1);
const url = `/pages/health/record?type=${nextType}&teamId=${teamId}&corpId=${corpId}&customerId=${customerId}&nextTypes=${nextTypes.join(',')}&source=afterArchive`
uni.redirectTo({ url });
}
} else {
uni.redirectTo({
url: `/pages/archive/archive-result?corpId=${corpId}&teamId=${teamId}&customerId=${customerId}`
})
}
}
onLoad(options => {
teamId.value = options.teamId;

View File

@ -11,8 +11,12 @@
<view class="px-15 py-12 flex items-center justify-center">
<view class="text-xl font-semibold text-dark">{{ nameSet.pre }}</view>
<view v-if="nameSet.middle" class="text-xl font-semibold text-dark">{{ nameSet.middle }}</view>
<input v-model="inputName" :focus="focus" class="input-name text-xl font-semibold text-dark"
placeholder-class="text-lg font-semibold placeholder-class" maxlength="1" />
<!-- <view class="input-name border rounded-sm text-xl font-semibold text-dark text-center">
{{ firstInputName }} -->
<input v-model="inputName" :focus="focus" class="input-name text-xl font-semibold text-dark"
placeholder-class="text-lg font-semibold placeholder-class" />
<!-- </view> -->
</view>
<view class="pb-15">
<button-footer hideden-shadow confirmText="确定" @cancel="close" @confirm="confirm()" />
@ -42,6 +46,7 @@ const props = defineProps({
const popup = ref()
const inputName = ref('')
const focus = ref(false)
const firstInputName = computed(() => inputName.value.trim()[0] || '')
const placeholder = computed(() => '请输入姓名' + (props.customer.maskName ? `(${props.customer.maskName})` : ''));
const nameSet = computed(() => {
const name = props.customer && typeof props.customer.name === 'string' ? props.customer.name.trim() : ''
@ -86,6 +91,7 @@ watch(() => props.visible, n => {
<style lang="scss" scoped>
.input-name {
position: relative;
border: 1px solid #eee;
border-radius: 8rpx;
margin-left: 8rpx;
@ -95,6 +101,15 @@ watch(() => props.visible, n => {
text-align: center;
}
.input-name-enter {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
.placeholder-class {
color: #999;
}

View File

@ -44,6 +44,7 @@ const visible = ref(false);
const timeTitle = ref('');
const canEdit = ref(false)
const nextTypes = ref([]);
const source = ref('');
const formData = computed(() => ({ ...record.value, ...form.value }));
const displayFormItems = computed(() => {
@ -92,8 +93,14 @@ async function addHealthRecord() {
if (res && res.success) {
await toast('保存成功');
const isFill = await fillNext();
if(isFill) return;
uni.navigateBack();
if (isFill) return;
if (source.value === 'afterArchive') {
uni.redirectTo({
url: `/pages/archive/archive-result?corpId=${corpId.value}&teamId=${teamId.value}&customerId=${customerId.value}`
})
} else {
uni.navigateBack();
}
} else {
toast(res?.message || '保存失败');
}
@ -103,7 +110,7 @@ async function fillNext() {
const nextType = nextTypes.value[0];
const types = nextTypes.value.slice(1);
if (nextType) {
const url = `/pages/health/record?type=${nextType}&teamId=${teamId.value}&corpId=${corpId.value}&customerId=${customerId.value}&nextTypes=${types.join(',')}`
const url = `/pages/health/record?type=${nextType}&teamId=${teamId.value}&corpId=${corpId.value}&customerId=${customerId.value}&nextTypes=${types.join(',')}&source=${source.value}`
uni.redirectTo({ url });
return true
}
@ -176,6 +183,7 @@ onLoad(options => {
customerId.value = options.customerId || '';
corpId.value = options.corpId;
teamId.value = options.teamId;
source.value = options.source || '';
const nextTypeStr = typeof options.nextTypes === 'string' ? options.nextTypes : '';
nextTypes.value = nextTypeStr.split(',');
uni.setNavigationBarTitle({ title: id.value ? '编辑健康档案' : '新增健康档案' })

View File

@ -14,9 +14,26 @@
</view>
<image class="add-archive-bg" src="/static/home/add-archive-bg.png" mode="aspectFit"></image>
</view>
<scroll-view scroll-x="true">
<scroll-view scroll-x="true" :scroll-left="scrollLeft" @scroll="handleScroll">
<view class="flex flex-nowrap pb-5">
<view v-for="i in customers" :key="i._id" class="customer-card flex-shrink-0 mr-15 relative"
<view v-if="current" class="customer-card flex-shrink-0 mr-15 relative current-customer">
<!-- 关系标签 -->
<view v-if="current.relationship" class="relationship-tag"
:class="current.relationship === '本人' ? 'tag-blue' : 'tag-green'">
{{ current.relationship }}
</view>
<view class="flex flex-col items-center">
<view class="customer-name text-lg leading-normal font-semibold whitespace-nowrap mb-8 text-primary">
{{ current.name }}
</view>
</view>
<!-- 选中状态底部条和三角 -->
<view class="active-indicator">
<view class="active-bar"></view>
<view class="active-triangle"></view>
</view>
</view>
<view v-for="i in customersList" :key="i._id" class="customer-card flex-shrink-0 mr-15 relative"
:class="current && i._id === current._id ? 'current-customer' : ''" @click="toggle(i)">
<!-- 关系标签 -->
<view v-if="i.relationship" class="relationship-tag"
@ -107,6 +124,8 @@ const { account, externalUserId } = storeToRefs(useAccount());
const { getExternalUserId } = useAccount()
const current = ref(null);
const customers = ref([]);
const scrollLeft = ref(0);
const customersList = computed(() => customers.value.filter(i => i._id !== current.value?._id))
const canAuth = computed(() => {
if (current.value && props.team && props.team.teamId) {
@ -161,7 +180,9 @@ function toHealthList() {
}
function toggle(i) {
if (current.value && current.value._id === i._id) return;
current.value = i;
scrollLeft.value = 0
}
function toManagePage() {
@ -172,6 +193,16 @@ function toManagePage() {
});
}
let timer = null;
function handleScroll(e) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
scrollLeft.value = e.detail.scrollLeft;
}, 300);
}
async function auth() {
await confirm(`是否授权${props.team.name}提供服务`);
const corpUserId = await getResponsiblePerson();

View File

@ -16,7 +16,7 @@
<button open-type="share" class="absolute w-full h-full opacity-0"></button>
</view>
</view>
<view class="corp-title text-gray truncate">{{ corpName }}</view>
<view class="corp-title text-gray truncate">{{ team.licenseHospitalName || corpName }}</view>
</view>
</view>
<view class="mt-15 px-15 leading-normal text-base text-blue">