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

View File

@ -26,7 +26,6 @@ import dayjs from 'dayjs';
import useGuard from '@/hooks/useGuard'; import useGuard from '@/hooks/useGuard';
import useAccount from '@/store/account'; import useAccount from '@/store/account';
import api from '@/utils/api'; import api from '@/utils/api';
import { set } from "@/utils/cache";
import { toast, confirm as uniConfirm } from '@/utils/widget'; import { toast, confirm as uniConfirm } from '@/utils/widget';
import validate from '@/utils/validate'; import validate from '@/utils/validate';
@ -163,9 +162,7 @@ async function addArchive() {
const res = await api('addCustomer', { params }); const res = await api('addCustomer', { params });
if (res && res.success) { if (res && res.success) {
uni.$emit('reloadTeamCustomers') uni.$emit('reloadTeamCustomers')
uni.redirectTo({ getTeam(corpId.value, teamId.value, res.data.id);
url: `/pages/archive/archive-result?corpId=${corpId.value}&teamId=${teamId.value}&customerId=${res.data.id}`
})
} else { } else {
toast(res?.message || '新增档案失败'); toast(res?.message || '新增档案失败');
} }
@ -202,7 +199,6 @@ async function init() {
await getCustomer(); await getCustomer();
} else { } else {
const res = await getArchives(); const res = await getArchives();
console.log('res:', res)
if (res.length > 0) { if (res.length > 0) {
visible.value = true; visible.value = true;
} }
@ -281,6 +277,26 @@ async function getReferenceCustomer() {
referenceCustomer.value = res && res.data ? res.data : null; 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 => { onLoad(options => {
teamId.value = options.teamId; teamId.value = options.teamId;

View File

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

View File

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

View File

@ -14,9 +14,26 @@
</view> </view>
<image class="add-archive-bg" src="/static/home/add-archive-bg.png" mode="aspectFit"></image> <image class="add-archive-bg" src="/static/home/add-archive-bg.png" mode="aspectFit"></image>
</view> </view>
<scroll-view scroll-x="true"> <scroll-view scroll-x="true" :scroll-left="scrollLeft" @scroll="handleScroll">
<view class="flex flex-nowrap pb-5"> <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)"> :class="current && i._id === current._id ? 'current-customer' : ''" @click="toggle(i)">
<!-- 关系标签 --> <!-- 关系标签 -->
<view v-if="i.relationship" class="relationship-tag" <view v-if="i.relationship" class="relationship-tag"
@ -107,6 +124,8 @@ const { account, externalUserId } = storeToRefs(useAccount());
const { getExternalUserId } = useAccount() const { getExternalUserId } = useAccount()
const current = ref(null); const current = ref(null);
const customers = ref([]); const customers = ref([]);
const scrollLeft = ref(0);
const customersList = computed(() => customers.value.filter(i => i._id !== current.value?._id))
const canAuth = computed(() => { const canAuth = computed(() => {
if (current.value && props.team && props.team.teamId) { if (current.value && props.team && props.team.teamId) {
@ -161,7 +180,9 @@ function toHealthList() {
} }
function toggle(i) { function toggle(i) {
if (current.value && current.value._id === i._id) return;
current.value = i; current.value = i;
scrollLeft.value = 0
} }
function toManagePage() { 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() { async function auth() {
await confirm(`是否授权${props.team.name}提供服务`); await confirm(`是否授权${props.team.name}提供服务`);
const corpUserId = await getResponsiblePerson(); const corpUserId = await getResponsiblePerson();

View File

@ -16,7 +16,7 @@
<button open-type="share" class="absolute w-full h-full opacity-0"></button> <button open-type="share" class="absolute w-full h-full opacity-0"></button>
</view> </view>
</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> </view>
<view class="mt-15 px-15 leading-normal text-base text-blue"> <view class="mt-15 px-15 leading-normal text-base text-blue">