Merge branch 'dev-wdb' of http://175.27.226.205:3000/huxuejian/ykt-wxapp into dev-wdb
This commit is contained in:
commit
38553df861
@ -1,18 +1,6 @@
|
||||
<template>
|
||||
<!-- Mobile 来源: ykt-management-mobile/src/pages/customer/customer-detail/customer-profile.vue -->
|
||||
<view class="wrap">
|
||||
<view class="sub-tabs">
|
||||
<view
|
||||
v-for="t in anchors"
|
||||
:key="t.value"
|
||||
class="sub-tab"
|
||||
:class="{ active: activeAnchor === t.value }"
|
||||
@click="scrollToAnchor(t.value)"
|
||||
>
|
||||
{{ t.label }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card">
|
||||
<view id="anchor-base" class="section-title" @click="startEdit">
|
||||
<text>基本信息</text>
|
||||
@ -55,7 +43,7 @@
|
||||
<view class="row" @click="openTransferRecord">
|
||||
<view class="label">院内来源</view>
|
||||
<view class="val link">
|
||||
{{ forms.creator || '点击查看' }}
|
||||
{{ latestTransferRecord?.executeTeamName || '点击查看' }}
|
||||
<uni-icons type="arrowright" size="14" color="#4f6ef7" />
|
||||
</view>
|
||||
</view>
|
||||
@ -88,26 +76,32 @@
|
||||
<uni-popup ref="transferPopupRef" type="bottom" :mask-click="true">
|
||||
<view class="popup">
|
||||
<view class="popup-title">
|
||||
<view class="popup-title-text">院内流转记录(mock)</view>
|
||||
<view class="popup-title-text">院内流转记录</view>
|
||||
<view class="popup-close" @click="closeTransferRecord">
|
||||
<uni-icons type="closeempty" size="18" color="#666" />
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view scroll-y class="popup-body">
|
||||
<view class="timeline">
|
||||
<view v-if="transferRecords.length" class="timeline">
|
||||
<view class="line"></view>
|
||||
<view v-for="r in transferRecords" :key="r._id" class="item">
|
||||
<view class="dot"></view>
|
||||
<view class="content">
|
||||
<view class="time">{{ r.time }}</view>
|
||||
<view class="time">{{ r.createTime }}</view>
|
||||
<view class="card2">
|
||||
<view class="trow"><text class="tlabel">转入团队:</text>{{ r.team }}</view>
|
||||
<view class="trow"><text class="tlabel">转入方式:</text>{{ r.type }}</view>
|
||||
<view class="trow"><text class="tlabel">操作人:</text>{{ r.user }}</view>
|
||||
<view v-if="r.executeTeamName" class="trow"><text class="tlabel">转入团队:</text>{{ r.executeTeamName }}</view>
|
||||
<view v-if="r.eventTypeName" class="trow"><text class="tlabel">转入方式:</text>{{ r.eventTypeName }}</view>
|
||||
<view v-if="r.creatorUserName" class="trow">
|
||||
<text class="tlabel">操作人:</text>
|
||||
<text>{{ r.creatorUserName }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="empty-state">
|
||||
<text class="empty-text">暂无流转记录</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
@ -115,9 +109,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { computed, reactive, ref, watch, onMounted } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import dayjs from 'dayjs';
|
||||
import FormTemplate from '@/components/form-template/index.vue';
|
||||
import api from '@/utils/api';
|
||||
import useAccountStore from '@/store/account';
|
||||
import useTeamStore from '@/store/team';
|
||||
|
||||
const props = defineProps({
|
||||
data: { type: Object, default: () => ({}) },
|
||||
@ -127,11 +125,10 @@ const props = defineProps({
|
||||
});
|
||||
const emit = defineEmits(['save']);
|
||||
|
||||
const anchors = [
|
||||
{ label: '基本信息', value: 'base' },
|
||||
{ label: '内部信息', value: 'internal' },
|
||||
];
|
||||
const activeAnchor = ref('base');
|
||||
const accountStore = useAccountStore();
|
||||
const teamStore = useTeamStore();
|
||||
const { account, doctorInfo } = storeToRefs(accountStore);
|
||||
const { teams } = storeToRefs(teamStore);
|
||||
|
||||
const editing = ref(false);
|
||||
const baseFormRef = ref(null);
|
||||
@ -224,7 +221,21 @@ function displayValue(item) {
|
||||
return list.length ? `已上传${list.length}项` : '-';
|
||||
}
|
||||
|
||||
if (Array.isArray(v)) return v.filter(Boolean).join('、') || '-';
|
||||
if (Array.isArray(v)) {
|
||||
// 对于数组类型(如标签),查找range中的label
|
||||
if (type === 'select' || type === 'radio' || type === 'selectAndImage' || type === 'tagPicker' || item.__originType === 'tag') {
|
||||
const range = Array.isArray(item?.range) ? item.range : [];
|
||||
if (range.length && typeof range[0] === 'object') {
|
||||
const labels = v.map((val) => {
|
||||
const found = range.find((i) => String(i?.value) === String(val));
|
||||
return found ? String(found.label || found.value || val) : String(val);
|
||||
}).filter(Boolean);
|
||||
return labels.length ? labels.join('、') : '-';
|
||||
}
|
||||
}
|
||||
return v.filter(Boolean).join('、') || '-';
|
||||
}
|
||||
|
||||
if (typeof v === 'object') {
|
||||
if ('label' in v) return String(v.label || '-');
|
||||
if ('name' in v) return String(v.name || '-');
|
||||
@ -258,82 +269,154 @@ function scrollToAnchor(key) {
|
||||
|
||||
const transferPopupRef = ref(null);
|
||||
const transferRecords = ref([]);
|
||||
const latestTransferRecord = computed(() => transferRecords.value[0]);
|
||||
const userNameMap = ref({});
|
||||
|
||||
function openTransferRecord() {
|
||||
transferRecords.value = [
|
||||
{ _id: 't1', time: dayjs().subtract(120, 'day').format('YYYY-MM-DD HH:mm'), team: '口腔一科(示例)', type: '系统建档', user: '系统' },
|
||||
{ _id: 't2', time: dayjs().subtract(30, 'day').format('YYYY-MM-DD HH:mm'), team: '正畸团队(示例)', type: '团队流转', user: '管理员A' },
|
||||
];
|
||||
const CURRENT_TEAM_STORAGE_KEY = 'ykt_case_current_team';
|
||||
|
||||
function getCorpId() {
|
||||
const d = doctorInfo.value || {};
|
||||
const a = account.value || {};
|
||||
const team = uni.getStorageSync(CURRENT_TEAM_STORAGE_KEY) || {};
|
||||
return String(d.corpId || a.corpId || team.corpId || '') || '';
|
||||
}
|
||||
|
||||
async function loadTeamMembers() {
|
||||
const corpId = getCorpId();
|
||||
const team = uni.getStorageSync(CURRENT_TEAM_STORAGE_KEY) || {};
|
||||
const teamId = team?.teamId ? String(team.teamId) : '';
|
||||
if (!corpId || !teamId) return;
|
||||
if (Object.keys(userNameMap.value || {}).length > 0) return;
|
||||
|
||||
try {
|
||||
const res = await api('getTeamData', { corpId, teamId });
|
||||
if (!res?.success) return;
|
||||
const t = res?.data && typeof res.data === 'object' ? res.data : {};
|
||||
const members = Array.isArray(t.memberList) ? t.memberList : [];
|
||||
userNameMap.value = members.reduce((acc, m) => {
|
||||
const uid = String(m?.userid || '');
|
||||
if (!uid) return acc;
|
||||
acc[uid] = String(m?.anotherName || m?.name || m?.userid || '') || uid;
|
||||
return acc;
|
||||
}, {});
|
||||
} catch (e) {
|
||||
console.error('获取团队成员失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveUserName(userId) {
|
||||
const id = String(userId || '');
|
||||
if (!id) return '';
|
||||
const map = userNameMap.value || {};
|
||||
return String(map[id] || id) || id;
|
||||
}
|
||||
|
||||
const ServiceType = {
|
||||
remindFiling: '自主开拓',
|
||||
adminTransferTeams: '团队流转',
|
||||
adminRemoveTeams: '移出团队',
|
||||
systemAutoDistribute: '系统分配',
|
||||
bindWechatCustomer: '绑定企业微信',
|
||||
share: '共享',
|
||||
transfer: '转移',
|
||||
importCustomer: '导入客户',
|
||||
addCustomer: '新增客户',
|
||||
};
|
||||
|
||||
async function fetchTransferRecords() {
|
||||
const customerId = props.data?._id;
|
||||
if (!customerId) return;
|
||||
|
||||
// 先加载团队成员信息
|
||||
await loadTeamMembers();
|
||||
|
||||
try {
|
||||
const res = await api('customerTransferRecord', { customerId });
|
||||
if (res?.success && res.list) {
|
||||
const allTeams = Array.isArray(teams.value) ? teams.value : [];
|
||||
transferRecords.value = res.list.map((item) => {
|
||||
const record = { ...item };
|
||||
record.createTime = dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss');
|
||||
record.executeTeamName = allTeams.find((team) => team.teamId === item.executeTeamId)?.name || item.executeTeamName;
|
||||
record.eventTypeName = ServiceType[item.eventType] || item.eventType;
|
||||
record.creatorUserName = item.creatorUserId === 'system' ? '系统自动建档' : resolveUserName(item.creatorUserId);
|
||||
if (item.transferToTeamIds && Array.isArray(item.transferToTeamIds)) {
|
||||
record.teamName = item.transferToTeamIds.map((teamId) => allTeams.find((team) => team.teamId === teamId)?.name).join('、');
|
||||
}
|
||||
if (item.removeTeamIds && Array.isArray(item.removeTeamIds)) {
|
||||
record.teamName = item.removeTeamIds.map((teamId) => allTeams.find((team) => team.teamId === teamId)?.name).join('、');
|
||||
}
|
||||
if (item.eventType === 'remindFiling') record.eventTypeName = '自主开拓';
|
||||
return record;
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('获取流转记录失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
async function openTransferRecord() {
|
||||
await fetchTransferRecords();
|
||||
transferPopupRef.value?.open?.();
|
||||
}
|
||||
|
||||
function closeTransferRecord() {
|
||||
transferPopupRef.value?.close?.();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchTransferRecords();
|
||||
});
|
||||
|
||||
watch(() => props.data?._id, () => {
|
||||
if (props.data?._id) fetchTransferRecords();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.wrap {
|
||||
padding: 12px 0 96px;
|
||||
}
|
||||
|
||||
.sub-tabs {
|
||||
display: flex;
|
||||
background: #f5f6f8;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
}
|
||||
.sub-tab {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
}
|
||||
.sub-tab.active {
|
||||
color: #4f6ef7;
|
||||
font-weight: 600;
|
||||
padding: 24rpx 0 192rpx;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #fff;
|
||||
margin-top: 10px;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 14px;
|
||||
font-size: 15px;
|
||||
padding: 24rpx 28rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
border-bottom: 2rpx solid #f2f2f2;
|
||||
}
|
||||
.pen {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
}
|
||||
.rows {
|
||||
padding: 2px 14px;
|
||||
padding: 4rpx 28rpx;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #f6f6f6;
|
||||
padding: 24rpx 0;
|
||||
border-bottom: 2rpx solid #f6f6f6;
|
||||
}
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.label {
|
||||
width: 90px;
|
||||
font-size: 14px;
|
||||
width: 180rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
.val {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
.val.link {
|
||||
@ -341,13 +424,13 @@ function closeTransferRecord() {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.input,
|
||||
.picker {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
@ -356,18 +439,18 @@ function closeTransferRecord() {
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
padding: 12px 14px;
|
||||
padding: 24rpx 28rpx;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
|
||||
gap: 24rpx;
|
||||
box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
z-index: 30;
|
||||
}
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.btn::after {
|
||||
border: none;
|
||||
@ -375,7 +458,7 @@ function closeTransferRecord() {
|
||||
.btn.plain {
|
||||
background: #fff;
|
||||
color: #4f6ef7;
|
||||
border: 1px solid #4f6ef7;
|
||||
border: 2rpx solid #4f6ef7;
|
||||
}
|
||||
.btn.primary {
|
||||
background: #4f6ef7;
|
||||
@ -384,24 +467,24 @@ function closeTransferRecord() {
|
||||
|
||||
.popup {
|
||||
background: #fff;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-top-left-radius: 20rpx;
|
||||
border-top-right-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.popup-title {
|
||||
position: relative;
|
||||
padding: 14px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
padding: 28rpx;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
}
|
||||
.popup-title-text {
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.popup-close {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
right: 24rpx;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
@ -412,47 +495,63 @@ function closeTransferRecord() {
|
||||
}
|
||||
.timeline {
|
||||
position: relative;
|
||||
padding: 14px 14px 18px;
|
||||
padding: 40rpx 28rpx 36rpx 28rpx;
|
||||
}
|
||||
.line {
|
||||
position: absolute;
|
||||
left: 22px;
|
||||
top: 18px;
|
||||
bottom: 18px;
|
||||
width: 2px;
|
||||
left: 48rpx;
|
||||
top: 56rpx;
|
||||
bottom: 36rpx;
|
||||
width: 4rpx;
|
||||
background: #4f6ef7;
|
||||
}
|
||||
.item {
|
||||
position: relative;
|
||||
padding-left: 32px;
|
||||
margin-bottom: 14px;
|
||||
padding-left: 80rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.dot {
|
||||
position: absolute;
|
||||
left: 16px;
|
||||
top: 6px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
left: 6rpx;
|
||||
top: 8rpx;
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
border-radius: 50%;
|
||||
background: #4f6ef7;
|
||||
border: 4rpx solid #fff;
|
||||
box-shadow: 0 0 0 4rpx #4f6ef7;
|
||||
}
|
||||
.time {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.card2 {
|
||||
border: 1px solid #f0f0f0;
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
border: 2rpx solid #f0f0f0;
|
||||
border-radius: 16rpx;
|
||||
padding: 24rpx;
|
||||
background: #fafafa;
|
||||
}
|
||||
.trow {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 20px;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
.tlabel {
|
||||
color: #666;
|
||||
margin-right: 6px;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 80rpx 40rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -381,57 +381,57 @@ watch(
|
||||
|
||||
<style scoped>
|
||||
.wrap {
|
||||
padding: 12px 0 96px;
|
||||
padding: 24rpx 0 192rpx;
|
||||
}
|
||||
|
||||
.filters {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 10px 14px;
|
||||
gap: 20rpx;
|
||||
padding: 20rpx 28rpx;
|
||||
background: #f5f6f8;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
border-bottom: 2rpx solid #f2f2f2;
|
||||
}
|
||||
.filter-pill {
|
||||
background: #fff;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 6px;
|
||||
padding: 10px 12px;
|
||||
border: 2rpx solid #e6e6e6;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
gap: 20rpx;
|
||||
flex: 1;
|
||||
}
|
||||
.pill-text {
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
max-width: 180px;
|
||||
max-width: 360rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.share-tip {
|
||||
padding: 10px 14px 0;
|
||||
padding: 20rpx 28rpx 0;
|
||||
}
|
||||
.share-tip-text {
|
||||
display: inline-block;
|
||||
background: #eef2ff;
|
||||
color: #4338ca;
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 24rpx;
|
||||
padding: 12rpx 20rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.list {
|
||||
padding: 0 14px;
|
||||
padding: 0 28rpx;
|
||||
}
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
margin-top: 10px;
|
||||
border-radius: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
|
||||
box-shadow: 0 12rpx 28rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.record {
|
||||
padding: 0;
|
||||
@ -439,28 +439,28 @@ watch(
|
||||
.record-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 12px 10px;
|
||||
gap: 8px;
|
||||
padding: 24rpx 24rpx 20rpx;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.record-title {
|
||||
font-size: 15px;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #1f1f1f;
|
||||
}
|
||||
.record-date {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.record-body {
|
||||
padding: 0 12px 12px;
|
||||
padding: 0 24rpx 24rpx;
|
||||
}
|
||||
.line {
|
||||
display: flex;
|
||||
padding-top: 10px;
|
||||
font-size: 13px;
|
||||
padding-top: 20rpx;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
line-height: 18px;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.line-label {
|
||||
flex-shrink: 0;
|
||||
@ -475,47 +475,47 @@ watch(
|
||||
}
|
||||
|
||||
.thumbs {
|
||||
padding-top: 10px;
|
||||
padding-top: 20rpx;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
gap: 20rpx;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.thumb {
|
||||
width: 84px;
|
||||
height: 64px;
|
||||
border-radius: 6px;
|
||||
width: 168rpx;
|
||||
height: 128rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
background: #f3f4f6;
|
||||
border: 1px solid #e5e7eb;
|
||||
border: 2rpx solid #e5e7eb;
|
||||
}
|
||||
.thumb-img {
|
||||
width: 84px;
|
||||
height: 64px;
|
||||
width: 168rpx;
|
||||
height: 128rpx;
|
||||
}
|
||||
.thumb-more {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #6b7280;
|
||||
}
|
||||
.record-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 12px;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
font-size: 12px;
|
||||
padding: 24rpx 24rpx;
|
||||
border-top: 2rpx solid #f2f2f2;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
.foot-left {
|
||||
flex-shrink: 0;
|
||||
margin-right: 10px;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.record-tag {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #fff;
|
||||
padding: 4px 8px;
|
||||
border-radius: 8px;
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.bg-blue {
|
||||
background: #4f6ef7;
|
||||
@ -537,23 +537,23 @@ watch(
|
||||
}
|
||||
|
||||
.empty {
|
||||
padding: 120px 0;
|
||||
padding: 240rpx 0;
|
||||
text-align: center;
|
||||
color: #9aa0a6;
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.fab {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 26px;
|
||||
right: 32rpx;
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
border-radius: 52rpx;
|
||||
background: #4f6ef7;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 10px 18px rgba(79, 110, 247, 0.35);
|
||||
box-shadow: 0 20rpx 36rpx rgba(79, 110, 247, 0.35);
|
||||
z-index: 20;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -420,16 +420,16 @@ watch(
|
||||
|
||||
<style scoped>
|
||||
.wrap {
|
||||
padding: 8px 0 96px;
|
||||
padding: 16rpx 0 192rpx;
|
||||
}
|
||||
|
||||
.filters {
|
||||
padding: 10px 14px;
|
||||
padding: 20rpx 28rpx;
|
||||
background: #fff;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
gap: 24rpx;
|
||||
}
|
||||
.filter-item {
|
||||
display: block;
|
||||
@ -442,18 +442,18 @@ watch(
|
||||
/* Removed old deep selectors */
|
||||
.filter-pill {
|
||||
background: #f7f8fa;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
padding: 10px 12px;
|
||||
border: 2rpx solid #e5e7eb;
|
||||
border-radius: 12rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
gap: 16rpx;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
box-sizing: border-box; /* Ensure padding doesn't overflow width */
|
||||
}
|
||||
.pill-text {
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
@ -478,11 +478,11 @@ watch(
|
||||
|
||||
.timeline {
|
||||
background: #fff;
|
||||
margin-top: 6px;
|
||||
padding: 10px 0 70px;
|
||||
margin-top: 12rpx;
|
||||
padding: 20rpx 0 140rpx;
|
||||
}
|
||||
.cell {
|
||||
padding: 0 14px;
|
||||
padding: 0 28rpx;
|
||||
position: relative;
|
||||
}
|
||||
.head {
|
||||
@ -490,48 +490,48 @@ watch(
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 44px;
|
||||
padding-left: 18px;
|
||||
height: 88rpx;
|
||||
padding-left: 36rpx;
|
||||
}
|
||||
.dot {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
width: 16rpx;
|
||||
height: 16rpx;
|
||||
border-radius: 50%;
|
||||
background: #4f6ef7;
|
||||
}
|
||||
.time {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #1f1f1f;
|
||||
}
|
||||
.file-link {
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
color: #4f6ef7;
|
||||
}
|
||||
.meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding-left: 18px;
|
||||
margin-bottom: 6px;
|
||||
gap: 20rpx;
|
||||
padding-left: 36rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.tag {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #4f6ef7;
|
||||
border: 1px solid #4f6ef7;
|
||||
border-radius: 999px;
|
||||
padding: 4px 8px;
|
||||
border: 2rpx solid #4f6ef7;
|
||||
border-radius: 999rpx;
|
||||
padding: 8rpx 16rpx;
|
||||
}
|
||||
.meta-text {
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
.truncate {
|
||||
max-width: 160px;
|
||||
max-width: 320rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
@ -540,15 +540,15 @@ watch(
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding-left: 18px;
|
||||
padding-bottom: 12px;
|
||||
padding-left: 36rpx;
|
||||
padding-bottom: 24rpx;
|
||||
}
|
||||
.content {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
line-height: 18px;
|
||||
margin-right: 10px;
|
||||
line-height: 36rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.content.clamp {
|
||||
display: -webkit-box;
|
||||
@ -557,81 +557,81 @@ watch(
|
||||
overflow: hidden;
|
||||
}
|
||||
.pen {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin-top: 2px;
|
||||
width: 36rpx;
|
||||
height: 36rpx;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
.line {
|
||||
position: absolute;
|
||||
left: 18px;
|
||||
top: 34px;
|
||||
left: 36rpx;
|
||||
top: 68rpx;
|
||||
bottom: 0;
|
||||
width: 2px;
|
||||
width: 4rpx;
|
||||
background: #4f6ef7;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.empty {
|
||||
padding: 120px 0;
|
||||
padding: 240rpx 0;
|
||||
text-align: center;
|
||||
color: #9aa0a6;
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.fab {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 26px;
|
||||
right: 32rpx;
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
border-radius: 52rpx;
|
||||
background: #4f6ef7;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 10px 18px rgba(79, 110, 247, 0.35);
|
||||
box-shadow: 0 20rpx 36rpx rgba(79, 110, 247, 0.35);
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.popup {
|
||||
background: #fff;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-top-left-radius: 20rpx;
|
||||
border-top-right-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.popup-title {
|
||||
position: relative;
|
||||
padding: 14px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
padding: 28rpx;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
}
|
||||
.popup-title-text {
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.popup-close {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
right: 24rpx;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.popup-body2 {
|
||||
padding: 14px;
|
||||
padding: 28rpx;
|
||||
}
|
||||
.desc {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 20px;
|
||||
line-height: 40rpx;
|
||||
word-break: break-all;
|
||||
margin-bottom: 14px;
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
.btn {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.btn::after {
|
||||
border: none;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="form-row" title="">
|
||||
<view class="form-row" @click="handleClick">
|
||||
<view class="form-row__label">
|
||||
{{ name }}<text v-if="required" class="form-cell--required"></text>
|
||||
</view>
|
||||
@ -10,6 +10,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const emit = defineEmits(['click'])
|
||||
|
||||
defineProps({
|
||||
name: {
|
||||
default: ''
|
||||
@ -22,6 +24,10 @@ defineProps({
|
||||
default: ''
|
||||
}
|
||||
})
|
||||
|
||||
function handleClick(e) {
|
||||
emit('click', e)
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
@import url(./cell-style.css);
|
||||
|
||||
@ -64,34 +64,34 @@ function open() {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding: 24rpx 28rpx;
|
||||
border-bottom: 2rpx solid #eee;
|
||||
}
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.label {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #111827;
|
||||
font-weight: 700;
|
||||
}
|
||||
.required {
|
||||
color: #ff4d4f;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 120px;
|
||||
gap: 16rpx;
|
||||
min-width: 240rpx;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.value {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #111827;
|
||||
max-width: 220px;
|
||||
max-width: 440rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
@ -100,4 +100,3 @@ function open() {
|
||||
color: #9aa0a6;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@ -101,8 +101,8 @@ function remove(idx) {
|
||||
|
||||
<style scoped>
|
||||
.wrap {
|
||||
padding: 12px 14px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding: 24rpx 28rpx;
|
||||
border-bottom: 2rpx solid #eee;
|
||||
}
|
||||
.head {
|
||||
display: flex;
|
||||
@ -112,31 +112,31 @@ function remove(idx) {
|
||||
.head-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.label {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
}
|
||||
.required {
|
||||
color: #ff4d4f;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.list {
|
||||
margin-top: 10px;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.item {
|
||||
padding: 10px 0;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.item-title {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #111827;
|
||||
font-weight: 600;
|
||||
}
|
||||
.item-sub {
|
||||
margin-top: 6px;
|
||||
font-size: 13px;
|
||||
margin-top: 12rpx;
|
||||
font-size: 26rpx;
|
||||
color: #6b7280;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
@ -146,11 +146,11 @@ function remove(idx) {
|
||||
align-items: stretch;
|
||||
}
|
||||
.action {
|
||||
width: 70px;
|
||||
width: 140rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.action.edit {
|
||||
@ -160,9 +160,8 @@ function remove(idx) {
|
||||
background: #ff4d4f;
|
||||
}
|
||||
.empty {
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
margin-top: 20rpx;
|
||||
font-size: 26rpx;
|
||||
color: #9aa0a6;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
100
components/form-template/form-cell/form-tag-picker.vue
Normal file
100
components/form-template/form-cell/form-tag-picker.vue
Normal file
@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<common-cell :name="name" :required="required" @click="open">
|
||||
<view class="form-content__wrapper">
|
||||
<view class="flex-main-content truncate" :class="displayText ? '' : 'form__placeholder'">
|
||||
{{ displayText || placeholder }}
|
||||
</view>
|
||||
<view v-if="displayText && !disableChange" class="form-arrow" @click.stop="clear">
|
||||
<uni-icons type="closeempty" size="18" color="#bbb" />
|
||||
</view>
|
||||
<uni-icons class="form-arrow" type="arrowright"></uni-icons>
|
||||
</view>
|
||||
</common-cell>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted } from 'vue';
|
||||
import commonCell from '../common-cell.vue';
|
||||
|
||||
const emits = defineEmits(['change']);
|
||||
const props = defineProps({
|
||||
form: { type: Object, default: () => ({}) },
|
||||
name: { default: '' },
|
||||
required: { type: Boolean, default: false },
|
||||
title: { default: '' },
|
||||
range: { type: Array, default: () => [] },
|
||||
disableChange: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const placeholder = computed(() => `请选择${props.name || ''}`);
|
||||
|
||||
const value = computed(() => {
|
||||
const v = props.form?.[props.title];
|
||||
return Array.isArray(v) ? v.map(String).filter(Boolean) : [];
|
||||
});
|
||||
|
||||
const valueToLabel = computed(() => {
|
||||
const map = new Map();
|
||||
const r = Array.isArray(props.range) ? props.range : [];
|
||||
r.forEach((i) => {
|
||||
if (typeof i === 'string') map.set(String(i), String(i));
|
||||
else if (i && typeof i === 'object') {
|
||||
const val = i.value ?? i.id ?? i.key ?? i.label ?? i.name ?? '';
|
||||
const label = i.label ?? i.name ?? i.text ?? String(val);
|
||||
if (val) map.set(String(val), String(label || val));
|
||||
}
|
||||
});
|
||||
return map;
|
||||
});
|
||||
|
||||
const displayText = computed(() => {
|
||||
if (!value.value.length) return '';
|
||||
const labels = value.value.map((id) => valueToLabel.value.get(id) || id);
|
||||
return labels.join('、');
|
||||
});
|
||||
|
||||
const eventName = `select_tag_${Date.now()}_${Math.random().toString(16).slice(2)}`;
|
||||
|
||||
function open() {
|
||||
if (props.disableChange) return;
|
||||
console.log('[debug][wxapp][tagPicker] open click');
|
||||
uni.setStorageSync('ykt_tag_list_selections', value.value);
|
||||
const url = `/pages/library/tag-list/tag-list?eventName=${eventName}`;
|
||||
uni.navigateTo({
|
||||
url,
|
||||
fail: (e) => {
|
||||
console.error('[debug][wxapp][tagPicker] navigateTo fail:', url, e);
|
||||
const msg = e && typeof e === 'object' && e.errMsg ? e.errMsg : '跳转失败';
|
||||
uni.showToast({ title: msg, icon: 'none' });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function clear() {
|
||||
emits('change', { title: props.title, value: [] });
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
console.log('[debug][wxapp][tagPicker] mounted:', props.title);
|
||||
uni.$on(eventName, (data) => {
|
||||
const next = Array.isArray(data) ? data.map(String).filter(Boolean) : [];
|
||||
emits('change', { title: props.title, value: next });
|
||||
});
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
uni.$off(eventName);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../cell-style.css';
|
||||
|
||||
.form-content__wrapper {
|
||||
line-height: 42rpx;
|
||||
}
|
||||
|
||||
.flex-main-content {
|
||||
line-height: 42rpx;
|
||||
}
|
||||
</style>
|
||||
@ -13,6 +13,7 @@
|
||||
:disableChange="disableChange"
|
||||
@change="change"
|
||||
/>
|
||||
<form-input v-else-if="attrs.type === 'hisCardNo' || attrs.title === 'hisCardNo'" v-bind="attrs" :form="form" :disableChange="disableChange" @change="change" />
|
||||
<form-surgical-history
|
||||
v-else-if="attrs.title === 'surgicalHistory'"
|
||||
v-bind="attrs"
|
||||
@ -37,11 +38,36 @@
|
||||
:disableChange="disableChange"
|
||||
@change="change"
|
||||
/>
|
||||
<form-tag-picker
|
||||
v-else-if="attrs.type === 'tagPicker'"
|
||||
v-bind="attrs"
|
||||
:form="form"
|
||||
:disableChange="disableChange"
|
||||
@change="change"
|
||||
/>
|
||||
<form-run-time v-else-if="attrs.type === 'runTime'" v-bind="attrs" :form="form" :disableChange="disableChange" @change="change" />
|
||||
<form-files v-else-if="attrs.type === 'files'" v-bind="attrs" :form="form" :disableChange="disableChange" @change="change" />
|
||||
<view v-else-if="attrs.type || attrs.name || attrs.title" class="py-20rpx px-30rpx border-bottom text-28rpx text-gray-500">
|
||||
{{ attrs.name || attrs.title }}(暂不支持:{{ attrs.type }})
|
||||
</view>
|
||||
<form-select
|
||||
v-else-if="Array.isArray(attrs.range) && attrs.range.length"
|
||||
v-bind="attrs"
|
||||
:form="form"
|
||||
:disableChange="disableChange"
|
||||
@change="change"
|
||||
/>
|
||||
<form-textarea
|
||||
v-else-if="String(attrs.type || '').toLowerCase().includes('textarea')"
|
||||
v-bind="attrs"
|
||||
:form="form"
|
||||
:disableChange="disableChange"
|
||||
@change="change"
|
||||
/>
|
||||
<form-input
|
||||
v-else-if="attrs.type || attrs.name || attrs.title"
|
||||
v-bind="attrs"
|
||||
:form="form"
|
||||
:disableChange="disableChange"
|
||||
@change="change"
|
||||
/>
|
||||
|
||||
<!--
|
||||
<form-operation v-else-if="attrs.title === 'surgicalHistory'" v-bind="attrs" :form="form" @change="change"
|
||||
@ -70,6 +96,7 @@ import formSelectImage from './form-select-image.vue';
|
||||
import formSurgicalHistory from './form-surgical-history.vue';
|
||||
import formPositiveFind from './form-positive-find.vue';
|
||||
import formDiagnosisPicker from './form-diagnosis-picker.vue';
|
||||
import formTagPicker from './form-tag-picker.vue';
|
||||
|
||||
defineProps({
|
||||
form: {
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
<template>
|
||||
<template v-for="item in formItems" :key="item.title">
|
||||
<form-cell v-bind="item" :form="form" :disableChange="disabledMap[item.title]" @change="change" />
|
||||
<form-cell v-bind="item" :form="formModel" :disableChange="disabledMap[item.title]" @change="change" />
|
||||
</template>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, provide, ref } from 'vue';
|
||||
import verifyForm from './verify.js';
|
||||
import { createAliasedForm } from '@/utils/form-alias';
|
||||
|
||||
import FormCell from './form-cell/index.vue';
|
||||
|
||||
@ -54,6 +55,8 @@ const formItems = computed(() => {
|
||||
.map((i) => ({ ...i }));
|
||||
})
|
||||
|
||||
const formModel = computed(() => createAliasedForm(props.form, props.items));
|
||||
|
||||
const rules = computed(() => ({ ...customRule.value, ...props.rule }));
|
||||
|
||||
function addRule(arg1, arg2) {
|
||||
@ -78,7 +81,7 @@ function change(data) {
|
||||
|
||||
function verify() {
|
||||
const visible = formItems.value.filter((i) => i && !i.hidden);
|
||||
return verifyForm(visible, rules.value, props.form)
|
||||
return verifyForm(visible, rules.value, formModel.value)
|
||||
}
|
||||
|
||||
defineExpose({ verify })
|
||||
|
||||
@ -12,6 +12,7 @@ const FormRule = {
|
||||
selectAndOther: checkInput,
|
||||
selectAndImage: checkListItem,
|
||||
multiSelectAndOther: checkMultiList,
|
||||
tagPicker: checkMultiList,
|
||||
files: checkFiles,
|
||||
runTime: checkInput,
|
||||
}
|
||||
|
||||
@ -7,8 +7,14 @@
|
||||
<view v-if="customScroll" class="page-scroll">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<scroll-view v-else scroll-y="true" :scroll-top="scrollTop" class="page-scroll" @scrolltolower="scrolltolower"
|
||||
@scroll="onScroll">
|
||||
<scroll-view
|
||||
v-else
|
||||
scroll-y="true"
|
||||
:scroll-top="scrollTop"
|
||||
class="page-scroll"
|
||||
@scrolltolower="scrolltolower"
|
||||
@scroll="onScroll"
|
||||
>
|
||||
<slot></slot>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@ -16,22 +22,22 @@
|
||||
<slot name="footer"></slot>
|
||||
</view>
|
||||
<!-- #ifdef MP-->
|
||||
<view v-if="showSafeArea" class="safeareaBottom"></view>
|
||||
<!-- <view v-if="showSafeArea" class="safeareaBottom"></view> -->
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { computed, useSlots, ref } from 'vue';
|
||||
import useDebounce from '@/utils/useDebounce';
|
||||
import { computed, useSlots, ref } from "vue";
|
||||
import useDebounce from "@/utils/useDebounce";
|
||||
|
||||
const emits = defineEmits(['reachBottom']);
|
||||
const emits = defineEmits(["reachBottom"]);
|
||||
const props = defineProps({
|
||||
customScroll: { type: Boolean, default: false },
|
||||
mainClass: { type: String, default: '' },
|
||||
mainStyle: { default: '' },
|
||||
pageClass: { type: String, default: '' },
|
||||
pageStyle: { default: '' },
|
||||
showSafeArea: { type: Boolean, default: true }
|
||||
mainClass: { type: String, default: "" },
|
||||
mainStyle: { default: "" },
|
||||
pageClass: { type: String, default: "" },
|
||||
pageStyle: { default: "" },
|
||||
showSafeArea: { type: Boolean, default: true },
|
||||
});
|
||||
const slots = useSlots();
|
||||
const hasHeader = computed(() => !!slots.header);
|
||||
@ -40,7 +46,7 @@ const hasFooter = computed(() => !!slots.footer);
|
||||
const scrollTop = ref(0);
|
||||
|
||||
const scrolltolower = useDebounce(() => {
|
||||
emits('reachBottom');
|
||||
emits("reachBottom");
|
||||
});
|
||||
|
||||
const onScroll = useDebounce((e) => {
|
||||
@ -52,9 +58,8 @@ function scrollToBottom() {
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
scrollToBottom
|
||||
})
|
||||
|
||||
scrollToBottom,
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.full-page {
|
||||
|
||||
@ -169,6 +169,12 @@
|
||||
"navigationBarTitleText": "诊断"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/library/tag-list/tag-list",
|
||||
"style": {
|
||||
"navigationBarTitleText": "标签"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/others/edit-positive-find",
|
||||
"style": {
|
||||
|
||||
@ -249,11 +249,7 @@ function switchTab(key) {
|
||||
currentTab.value = key;
|
||||
// 切换 tab 后,将 tab 滚动到页面顶部(隐藏头部信息区域)
|
||||
nextTick(() => {
|
||||
// tabs 高度可能随数据变化,先测量一次再滚动
|
||||
measureTabsTop();
|
||||
setTimeout(() => {
|
||||
uni.pageScrollTo({ scrollTop: tabsScrollTop.value || 0, duration: 0 });
|
||||
}, 0);
|
||||
uni.pageScrollTo({ scrollTop: tabsScrollTop.value || 0, duration: 300 });
|
||||
});
|
||||
}
|
||||
|
||||
@ -303,6 +299,9 @@ function normalizeArchiveFromApi(raw) {
|
||||
outpatientNo: r.outpatientNo || '',
|
||||
inpatientNo: r.inpatientNo || '',
|
||||
medicalRecordNo: r.medicalRecordNo || '',
|
||||
customerNumber: r.customerNumber || '',
|
||||
customerProfileNo2: r.customerProfileNo2 || '',
|
||||
customerProfileNo3: r.customerProfileNo3 || '',
|
||||
createTime: r.createTime || '',
|
||||
creator: r.creator || '',
|
||||
notes: r.notes || r.remark || '',
|
||||
@ -548,9 +547,9 @@ const sexOrAge = computed(() => {
|
||||
|
||||
const idRows = computed(() => {
|
||||
const rows = [];
|
||||
if (archive.value.outpatientNo) rows.push({ label: '门诊号', value: String(archive.value.outpatientNo) });
|
||||
if (archive.value.inpatientNo) rows.push({ label: '住院号', value: String(archive.value.inpatientNo) });
|
||||
if (archive.value.medicalRecordNo) rows.push({ label: '病案号', value: String(archive.value.medicalRecordNo) });
|
||||
if (archive.value.customerNumber) rows.push({ label: '病案号1', value: String(archive.value.customerNumber) });
|
||||
if (archive.value.customerProfileNo2) rows.push({ label: '病案号2', value: String(archive.value.customerProfileNo2) });
|
||||
if (archive.value.customerProfileNo3) rows.push({ label: '病案号3', value: String(archive.value.customerProfileNo3) });
|
||||
return rows;
|
||||
});
|
||||
|
||||
@ -762,7 +761,7 @@ const saveAddGroup = async () => {
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #f5f6f8;
|
||||
padding-bottom: calc(80px + env(safe-area-inset-bottom));
|
||||
padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.card {
|
||||
@ -772,69 +771,69 @@ const saveAddGroup = async () => {
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
padding: 14px 14px 10px;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
padding: 28rpx 28rpx 20rpx;
|
||||
border-bottom: 2rpx solid #f2f2f2;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #e8e8e8;
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
background: #fafafa;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
width: 112rpx;
|
||||
height: 112rpx;
|
||||
}
|
||||
|
||||
.header-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 0 10px;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding-top: 2px;
|
||||
gap: 16rpx;
|
||||
padding-top: 4rpx;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 18px;
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #1f1f1f;
|
||||
max-width: 220px;
|
||||
max-width: 440rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.meta {
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.sub-line {
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
margin-top: 12rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.id-rows {
|
||||
margin-top: 6px;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.id-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
line-height: 18px;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
|
||||
.id-label {
|
||||
@ -849,58 +848,58 @@ const saveAddGroup = async () => {
|
||||
}
|
||||
|
||||
.create-row {
|
||||
margin-top: 6px;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.create-text {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
width: 56rpx;
|
||||
height: 56rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
margin-top: 6px;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.cells {
|
||||
background: #fff;
|
||||
padding: 0 14px;
|
||||
padding: 0 28rpx;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
border-bottom: 2rpx solid #f2f2f2;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 0;
|
||||
min-height: 24px;
|
||||
padding: 32rpx 0;
|
||||
min-height: 48rpx;
|
||||
}
|
||||
|
||||
.info-block {
|
||||
padding: 16px 0;
|
||||
padding: 32rpx 0;
|
||||
}
|
||||
|
||||
.block-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.block-content {
|
||||
min-height: 20px;
|
||||
min-height: 40rpx;
|
||||
}
|
||||
|
||||
.input-label {
|
||||
font-size: 15px;
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
@ -912,15 +911,15 @@ const saveAddGroup = async () => {
|
||||
.phone-area {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 12px;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.mr-4 {
|
||||
margin-right: 4px;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.phone-text {
|
||||
font-size: 16px;
|
||||
font-size: 32rpx;
|
||||
color: #4f6ef7;
|
||||
font-weight: 500;
|
||||
}
|
||||
@ -929,17 +928,17 @@ const saveAddGroup = async () => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.note-content {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
word-break: break-all;
|
||||
@ -948,16 +947,16 @@ const saveAddGroup = async () => {
|
||||
.tags-wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.tag-item {
|
||||
height: 24px;
|
||||
line-height: 22px;
|
||||
padding: 0 10px;
|
||||
border: 1px solid #4f6ef7;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
height: 48rpx;
|
||||
line-height: 44rpx;
|
||||
padding: 0 20rpx;
|
||||
border: 2rpx solid #4f6ef7;
|
||||
border-radius: 24rpx;
|
||||
font-size: 24rpx;
|
||||
color: #4f6ef7;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@ -968,11 +967,11 @@ const saveAddGroup = async () => {
|
||||
}
|
||||
|
||||
.tabs {
|
||||
margin-top: 10px;
|
||||
margin-top: 20rpx;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
border-top: 2rpx solid #f2f2f2;
|
||||
border-bottom: 2rpx solid #f2f2f2;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 30;
|
||||
@ -981,9 +980,9 @@ const saveAddGroup = async () => {
|
||||
.tab {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
font-size: 14px;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
position: relative;
|
||||
}
|
||||
@ -998,11 +997,11 @@ const saveAddGroup = async () => {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 0;
|
||||
width: 32px;
|
||||
height: 3px;
|
||||
width: 64rpx;
|
||||
height: 6rpx;
|
||||
background: #4f6ef7;
|
||||
transform: translateX(-50%);
|
||||
border-radius: 2px;
|
||||
border-radius: 4rpx;
|
||||
}
|
||||
|
||||
.content {
|
||||
@ -1017,14 +1016,14 @@ const saveAddGroup = async () => {
|
||||
}
|
||||
|
||||
.empty-img {
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
width: 320rpx;
|
||||
height: 320rpx;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
margin-top: 20rpx;
|
||||
font-size: 26rpx;
|
||||
color: #9aa0a6;
|
||||
}
|
||||
|
||||
@ -1034,21 +1033,21 @@ const saveAddGroup = async () => {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
|
||||
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
|
||||
padding: 24rpx 28rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.bind-btn {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
height: 88rpx;
|
||||
background: #4f6ef7;
|
||||
color: #fff;
|
||||
border-radius: 6px;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
font-size: 15px;
|
||||
gap: 16rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.bind-text {
|
||||
@ -1057,52 +1056,52 @@ const saveAddGroup = async () => {
|
||||
|
||||
/* ===== 弹窗样式(居中) ===== */
|
||||
.modal {
|
||||
width: 320px;
|
||||
width: 640rpx;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modal-title {
|
||||
font-size: 16px;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
padding: 14px 12px;
|
||||
padding: 28rpx 24rpx;
|
||||
color: #333;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
padding: 14px 14px 8px;
|
||||
padding: 28rpx 28rpx 16rpx;
|
||||
}
|
||||
|
||||
.modal-input {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 4px;
|
||||
padding: 0 10px;
|
||||
font-size: 14px;
|
||||
height: 80rpx;
|
||||
border: 2rpx solid #e6e6e6;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 20rpx;
|
||||
font-size: 28rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 12px 14px 14px;
|
||||
gap: 24rpx;
|
||||
padding: 24rpx 28rpx 28rpx;
|
||||
}
|
||||
|
||||
.modal-btn {
|
||||
flex: 1;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.modal-btn.cancel {
|
||||
border: 1px solid #4f6ef7;
|
||||
border: 2rpx solid #4f6ef7;
|
||||
color: #4f6ef7;
|
||||
background: #fff;
|
||||
}
|
||||
@ -1115,69 +1114,69 @@ const saveAddGroup = async () => {
|
||||
/* ===== 底部弹层样式 ===== */
|
||||
.sheet {
|
||||
background: #fff;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-top-left-radius: 20rpx;
|
||||
border-top-right-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sheet-header {
|
||||
height: 48px;
|
||||
height: 96rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 14px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
padding: 0 28rpx;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.sheet-title {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.sheet-close {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sheet-header-left {
|
||||
width: 24px;
|
||||
width: 48rpx;
|
||||
}
|
||||
|
||||
.sheet-link {
|
||||
min-width: 60px;
|
||||
min-width: 120rpx;
|
||||
text-align: right;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #4f6ef7;
|
||||
}
|
||||
|
||||
.sheet-body {
|
||||
padding: 14px;
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.notes-textarea {
|
||||
width: 100%;
|
||||
height: 140px;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
height: 280rpx;
|
||||
border: 2rpx solid #e6e6e6;
|
||||
border-radius: 8rpx;
|
||||
padding: 20rpx;
|
||||
font-size: 28rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.counter {
|
||||
text-align: right;
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
margin-top: 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.group-list {
|
||||
padding: 8px 14px 14px;
|
||||
padding: 16rpx 28rpx 28rpx;
|
||||
max-height: 55vh;
|
||||
overflow: auto;
|
||||
}
|
||||
@ -1185,26 +1184,26 @@ const saveAddGroup = async () => {
|
||||
.group-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 0;
|
||||
padding: 24rpx 0;
|
||||
}
|
||||
|
||||
.group-name {
|
||||
margin-left: 10px;
|
||||
font-size: 14px;
|
||||
margin-left: 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.sheet-footer {
|
||||
padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
|
||||
padding: 24rpx 28rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
height: 88rpx;
|
||||
background: #4f6ef7;
|
||||
color: #fff;
|
||||
border-radius: 4px;
|
||||
font-size: 15px;
|
||||
line-height: 44px;
|
||||
border-radius: 8rpx;
|
||||
font-size: 30rpx;
|
||||
line-height: 88rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -74,7 +74,7 @@ function normalizeTemplateItem(item) {
|
||||
const customTypeMap = {
|
||||
customerSource: 'select',
|
||||
customerStage: 'select',
|
||||
tag: 'multiSelectAndOther',
|
||||
tag: 'tagPicker',
|
||||
reference: 'input',
|
||||
selectWwuser: 'select',
|
||||
files: 'files',
|
||||
@ -121,6 +121,87 @@ function normalizeTemplateItem(item) {
|
||||
return next;
|
||||
}
|
||||
|
||||
function unwrapTemplate(res) {
|
||||
const d = res?.data;
|
||||
if (d && typeof d === 'object') {
|
||||
if (d.data && typeof d.data === 'object') return d.data;
|
||||
return d;
|
||||
}
|
||||
return res && typeof res === 'object' ? res : {};
|
||||
}
|
||||
|
||||
function unwrapListPayload(res) {
|
||||
const root = res && typeof res === 'object' ? res : {};
|
||||
const d = root.data && typeof root.data === 'object' ? root.data : root;
|
||||
if (!d) return [];
|
||||
if (Array.isArray(d)) return d;
|
||||
if (Array.isArray(d.data)) return d.data;
|
||||
if (Array.isArray(d.list)) return d.list;
|
||||
if (d.data && typeof d.data === 'object') {
|
||||
if (Array.isArray(d.data.data)) return d.data.data;
|
||||
if (Array.isArray(d.data.list)) return d.data.list;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function parseCustomerStageOptions(res) {
|
||||
const list = unwrapListPayload(res);
|
||||
return list
|
||||
.map((i) => {
|
||||
if (typeof i === 'string') return { label: i, value: i };
|
||||
const label = i?.name ?? i?.label ?? '';
|
||||
const value = i?.type ?? i?.value ?? i?.id ?? i?.key ?? label;
|
||||
if (!label && (value === undefined || value === null || value === '')) return null;
|
||||
return { label: String(label || value), value: String(value) };
|
||||
})
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function parseTagOptions(res) {
|
||||
const list = unwrapListPayload(res);
|
||||
let flat = [];
|
||||
if (list.length && typeof list[0] === 'object' && Array.isArray(list[0]?.tag)) {
|
||||
flat = list.reduce((acc, g) => {
|
||||
if (Array.isArray(g?.tag)) acc.push(...g.tag);
|
||||
return acc;
|
||||
}, []);
|
||||
} else {
|
||||
flat = list;
|
||||
}
|
||||
|
||||
const options = flat
|
||||
.map((i) => {
|
||||
if (typeof i === 'string') return { label: i, value: i };
|
||||
const label = i?.name ?? i?.label ?? i?.text ?? '';
|
||||
const value = i?.id ?? i?.value ?? i?.key ?? label;
|
||||
if (!label && (value === undefined || value === null || value === '')) return null;
|
||||
return { label: String(label || value), value: String(value) };
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
const seen = new Set();
|
||||
return options.filter((i) => {
|
||||
if (!i?.value) return false;
|
||||
if (seen.has(i.value)) return false;
|
||||
seen.add(i.value);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
function isStageItem(i) {
|
||||
const title = String(i?.title || '');
|
||||
const type = String(i?.type || '');
|
||||
const name = String(i?.name || '');
|
||||
return title === 'customerStage' || type === 'customerStage' || name.includes('阶段');
|
||||
}
|
||||
|
||||
function isTagItem(i) {
|
||||
const title = String(i?.title || '');
|
||||
const type = String(i?.type || '');
|
||||
const name = String(i?.name || '');
|
||||
return title === 'tagIds' || title === 'tag' || type === 'tag' || name.includes('标签');
|
||||
}
|
||||
|
||||
function getUserId() {
|
||||
const d = doctorInfo.value || {};
|
||||
const a = account.value || {};
|
||||
@ -159,13 +240,17 @@ function loadFromStorage() {
|
||||
async function loadTemplates() {
|
||||
const corpId = getCorpId();
|
||||
if (!corpId) return;
|
||||
const [baseRes, internalRes] = await Promise.all([
|
||||
const [baseRes, internalRes, stageRes, tagRes] = await Promise.all([
|
||||
api('getCurrentTemplate', { corpId, templateType: 'baseTemplate' }),
|
||||
api('getCurrentTemplate', { corpId, templateType: 'internalTemplate' }),
|
||||
api('getCustomerType', { corpId }),
|
||||
api('getCorpTags', { corpId }),
|
||||
]);
|
||||
const stageOptions = parseCustomerStageOptions(stageRes);
|
||||
const tagOptions = parseTagOptions(tagRes);
|
||||
|
||||
if (baseRes?.success) {
|
||||
const temp = baseRes?.data && typeof baseRes.data === 'object' ? baseRes.data : baseRes;
|
||||
const temp = unwrapTemplate(baseRes);
|
||||
const list = Array.isArray(temp.templateList) ? temp.templateList : [];
|
||||
baseItems.value = list
|
||||
.filter((i) => i && i.fieldStatus !== 'disable')
|
||||
@ -174,8 +259,14 @@ async function loadTemplates() {
|
||||
}
|
||||
|
||||
if (internalRes?.success) {
|
||||
const temp = internalRes?.data && typeof internalRes.data === 'object' ? internalRes.data : internalRes;
|
||||
const list = Array.isArray(temp.templateList) ? temp.templateList : [];
|
||||
const temp = unwrapTemplate(internalRes);
|
||||
const list = (Array.isArray(temp.templateList) ? temp.templateList : []).map((i) => {
|
||||
const item = { ...(i || {}) };
|
||||
if (isStageItem(item) && (!Array.isArray(item.range) || item.range.length === 0)) item.range = stageOptions;
|
||||
if (isTagItem(item) && (!Array.isArray(item.range) || item.range.length === 0)) item.range = tagOptions;
|
||||
if (isTagItem(item) && item.title === 'tag') item.title = 'tagIds';
|
||||
return item;
|
||||
});
|
||||
internalItems.value = list
|
||||
.filter((i) => i && i.fieldStatus !== 'disable')
|
||||
.filter((i) => i.operateType !== 'onlyRead')
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<view class="header">
|
||||
<view class="team-selector" @click="toggleTeamPopup">
|
||||
<text class="team-name">{{ teamDisplay }}</text>
|
||||
<uni-icons type="loop" size="18" color="#333" class="team-icon"></uni-icons>
|
||||
<text class="team-icon">⇌</text>
|
||||
</view>
|
||||
<view class="header-actions">
|
||||
<view class="action-item" @click="goToSearch">
|
||||
@ -85,11 +85,11 @@
|
||||
<view class="card-row-bottom">
|
||||
<template v-if="currentTabKey === 'new'"> <!-- New Patient Tab -->
|
||||
<text class="record-text">
|
||||
{{ patient.createTime || '-' }} / {{ patient.creator || '-' }}
|
||||
{{ patient.createTime || '-' }} / {{ resolveCreatorName(patient) || '-' }}
|
||||
</text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text v-if="patient.record" class="record-text">
|
||||
<text v-if="patient.record" class="record-text record-ellipsis">
|
||||
{{ patient.record.type }} / {{ patient.record.date }} / {{ patient.record.diagnosis }}
|
||||
</text>
|
||||
<text v-else class="no-record">暂无病历记录</text>
|
||||
@ -99,7 +99,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- Bottom padding for tabbar -->
|
||||
<view style="height: 100px;"></view> <!-- Increased padding -->
|
||||
<view style="height: 200rpx;"></view> <!-- Increased padding -->
|
||||
</scroll-view>
|
||||
|
||||
<!-- Sidebar Index -->
|
||||
@ -163,11 +163,15 @@ const tabs = computed(() => {
|
||||
const isBatchMode = ref(false);
|
||||
const selectedItems = ref([]); // Stores patient phone or unique ID
|
||||
|
||||
// 新增流程所需状态(后续接接口替换)
|
||||
// Team Members Map
|
||||
const userNameMap = ref({});
|
||||
|
||||
// 新增流程所需状态(认证相关)
|
||||
const managedArchiveCountAllTeams = ref(0); // 在管档案数(所有团队)
|
||||
const isVerified = ref(true); // 是否已认证
|
||||
const verifyStatus = ref(''); // unverified | verifying | verified | failed
|
||||
const isVerified = ref(false); // 是否已认证
|
||||
const hasVerifyFailedHistory = ref(false); // 是否有历史认证失败
|
||||
const verifyFailedReason = ref('资料不完整,请补充营业执照/资质证明后重新提交。');
|
||||
const verifyFailedReason = ref('');
|
||||
|
||||
const DETAIL_STORAGE_KEY = 'ykt_case_archive_detail';
|
||||
const CURRENT_TEAM_STORAGE_KEY = 'ykt_case_current_team';
|
||||
@ -220,6 +224,58 @@ function getTeamId() {
|
||||
return String(currentTeam.value?.teamId || '') || '';
|
||||
}
|
||||
|
||||
async function loadTeamMembers() {
|
||||
const corpId = getCorpId();
|
||||
const teamId = getTeamId();
|
||||
if (!corpId || !teamId) return;
|
||||
|
||||
try {
|
||||
const res = await api('getTeamData', { corpId, teamId });
|
||||
if (!res?.success) return;
|
||||
const t = res?.data && typeof res.data === 'object' ? res.data : {};
|
||||
const members = Array.isArray(t.memberList) ? t.memberList : [];
|
||||
// Update map
|
||||
members.forEach(m => {
|
||||
const uid = String(m?.userid || '');
|
||||
if (uid) {
|
||||
userNameMap.value[uid] = String(m?.anotherName || m?.name || m?.userid || '') || uid;
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('获取团队成员失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveCreatorName(patient) {
|
||||
const val = patient.creator;
|
||||
if (!val) return '';
|
||||
return userNameMap.value[val] || val;
|
||||
}
|
||||
|
||||
|
||||
function applyVerifyStatus(status, reason) {
|
||||
verifyStatus.value = status || '';
|
||||
isVerified.value = verifyStatus.value === 'verified';
|
||||
hasVerifyFailedHistory.value = verifyStatus.value === 'failed';
|
||||
verifyFailedReason.value = hasVerifyFailedHistory.value ? (reason || '') : '';
|
||||
}
|
||||
|
||||
async function refreshVerifyStatus() {
|
||||
const corpId = String(account.value?.corpId || doctorInfo.value?.corpId || getCorpId() || '');
|
||||
const weChatOpenId = String(account.value?.openid || account.value?.openId || '');
|
||||
const id = String(doctorInfo.value?._id || doctorInfo.value?.id || '');
|
||||
if (!corpId || !weChatOpenId || !id) {
|
||||
applyVerifyStatus(String(doctorInfo.value?.verifyStatus || ''), '');
|
||||
return;
|
||||
}
|
||||
const res = await api('getMemberVerifyStatus', { corpId, weChatOpenId, id });
|
||||
if (res && res.success) {
|
||||
applyVerifyStatus(String(res.data?.verifyStatus || ''), String(res.data?.reason || ''));
|
||||
return;
|
||||
}
|
||||
applyVerifyStatus(String(doctorInfo.value?.verifyStatus || ''), '');
|
||||
}
|
||||
|
||||
function sortGroupList(list) {
|
||||
const { orderList, corpList, restList } = (Array.isArray(list) ? list : []).reduce(
|
||||
(p, c) => {
|
||||
@ -299,10 +355,32 @@ function formatPatient(raw) {
|
||||
const createTime = parseCreateTime(raw?.createTime);
|
||||
const createTimeStr = createTime ? createTime.format('YYYY-MM-DD HH:mm') : '';
|
||||
|
||||
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string');
|
||||
const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string');
|
||||
|
||||
// 优先使用后端返回的 tagNames(标签名称数组)
|
||||
const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string' && i.trim());
|
||||
// 其次使用 tags(如果是字符串数组)
|
||||
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string' && i.trim());
|
||||
// 最后才使用 tagIds(仅作为兜底,不推荐显示)
|
||||
const tagIds = asArray(raw?.tagIds).map(String).filter(Boolean);
|
||||
|
||||
// 解析标签:优先 tagNames > tags(字符串) > tagIds
|
||||
const displayTags = rawTagNames.length ? rawTagNames : (rawTags.length ? rawTags : []);
|
||||
|
||||
// 解析病历信息
|
||||
let record = null;
|
||||
if (raw?.latestRecord && typeof raw.latestRecord === 'object') {
|
||||
const lr = raw.latestRecord;
|
||||
const type = lr.type || '';
|
||||
const date = lr.date || '';
|
||||
const diagnosis = lr.diagnosis || '';
|
||||
// 只有存在有效信息时才设置 record
|
||||
if (type || date || diagnosis) {
|
||||
record = {
|
||||
type: type || '-',
|
||||
date: date || '-',
|
||||
diagnosis: diagnosis || '-'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...raw,
|
||||
@ -310,13 +388,13 @@ function formatPatient(raw) {
|
||||
name: String(name || ''),
|
||||
gender: String(sex || ''),
|
||||
age,
|
||||
tags: rawTags.length ? rawTags : (rawTagNames.length ? rawTagNames : tagIds),
|
||||
tags: displayTags,
|
||||
mobiles,
|
||||
mobile,
|
||||
createTime: createTimeStr,
|
||||
creator: raw?.creatorName || raw?.creator || '',
|
||||
hospitalId: raw?.customerNumber || raw?.hospitalId || '',
|
||||
record: null,
|
||||
record,
|
||||
createdByDoctor: raw?.addMethod ? String(raw.addMethod) === 'manual' : Boolean(raw?.createdByDoctor),
|
||||
hasBindWechat: Boolean(raw?.externalUserId || raw?.unionid || raw?.hasBindWechat),
|
||||
};
|
||||
@ -395,7 +473,8 @@ async function reload(reset = true) {
|
||||
userId,
|
||||
teamId,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
pageSize: 1000, // 按首字母排序时,一次加载更多数据以显示完整的字母分组
|
||||
sortByFirstLetter: true, // 按姓名首字母排序
|
||||
};
|
||||
|
||||
if (currentTab.value.kind === 'group' && currentTab.value.groupId) {
|
||||
@ -408,7 +487,7 @@ async function reload(reset = true) {
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
const res = await api('searchCorpCustomerWithFollowTime', query);
|
||||
const res = await api('searchCorpCustomerForCaseList', query);
|
||||
loading.value = false;
|
||||
|
||||
if (!res?.success) {
|
||||
@ -523,6 +602,7 @@ const toggleTeamPopup = () => {
|
||||
if (currentTeam.value) uni.setStorageSync(CURRENT_TEAM_STORAGE_KEY, currentTeam.value);
|
||||
currentTabKey.value = 'all';
|
||||
loadGroups();
|
||||
loadTeamMembers();
|
||||
reload(true);
|
||||
}
|
||||
});
|
||||
@ -574,6 +654,10 @@ const handleCreate = () => {
|
||||
|
||||
// 未认证 + 达到10上限:提示去认证
|
||||
if (!isVerified.value && managedArchiveCountAllTeams.value >= 10) {
|
||||
if (verifyStatus.value === 'verifying') {
|
||||
toast('信息认证中,请耐心等待!');
|
||||
return;
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '当前管理档案数已达上限 10 个,完成认证即可升级至 100 个。',
|
||||
@ -603,6 +687,10 @@ const handleCreate = () => {
|
||||
|
||||
// 新增流程:认证分支
|
||||
const startVerifyFlow = () => {
|
||||
if (verifyStatus.value === 'verifying') {
|
||||
toast('信息认证中,请耐心等待!');
|
||||
return;
|
||||
}
|
||||
// 有历史失败记录 -> 展示失败原因 & 重新认证
|
||||
if (hasVerifyFailedHistory.value) {
|
||||
uni.showModal({
|
||||
@ -625,7 +713,7 @@ const startVerifyFlow = () => {
|
||||
|
||||
// ===== 预留入口(后续对接真实页面/接口) =====
|
||||
const openVerifyEntry = () => {
|
||||
uni.showToast({ title: '认证功能待接入', icon: 'none' });
|
||||
uni.navigateTo({ url: '/pages/work/profile?type=cert' });
|
||||
};
|
||||
|
||||
const openAddCustomerServiceEntry = () => {
|
||||
@ -715,8 +803,10 @@ onLoad(async () => {
|
||||
await loadTeams();
|
||||
if (currentTeam.value) {
|
||||
await loadGroups();
|
||||
loadTeamMembers();
|
||||
await reload(true);
|
||||
}
|
||||
await refreshVerifyStatus();
|
||||
});
|
||||
|
||||
onShow(async () => {
|
||||
@ -737,6 +827,8 @@ onShow(async () => {
|
||||
} else {
|
||||
await loadGroups();
|
||||
}
|
||||
loadTeamMembers();
|
||||
await refreshVerifyStatus();
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -751,7 +843,7 @@ onShow(async () => {
|
||||
|
||||
// Padding for batch footer
|
||||
/* &.is-batch {
|
||||
padding-bottom: 50px;
|
||||
padding-bottom: 100rpx;
|
||||
} */
|
||||
// We can't use &.is-batch because scoped style and root element is tricky depending on uni-app version/style
|
||||
// Instead we handle it in content-body or separate view
|
||||
@ -761,25 +853,30 @@ onShow(async () => {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 15px;
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #fff;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
|
||||
.team-selector {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 18px;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
|
||||
.team-name {
|
||||
margin-right: 5px;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.team-icon {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
gap: 30rpx;
|
||||
|
||||
.action-item {
|
||||
display: flex;
|
||||
@ -788,9 +885,9 @@ onShow(async () => {
|
||||
justify-content: center;
|
||||
|
||||
.action-text {
|
||||
font-size: 10px;
|
||||
font-size: 20rpx;
|
||||
color: #333;
|
||||
margin-top: 2px;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -800,8 +897,8 @@ onShow(async () => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #f5f7fa;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-right: 15px; // Padding for the count
|
||||
border-bottom: 2rpx solid #eee;
|
||||
padding-right: 30rpx; // Padding for the count
|
||||
|
||||
.tabs-scroll {
|
||||
flex: 1;
|
||||
@ -810,15 +907,15 @@ onShow(async () => {
|
||||
|
||||
.tabs-container {
|
||||
display: flex;
|
||||
padding: 10px 15px;
|
||||
padding: 20rpx 30rpx;
|
||||
|
||||
.tab-item {
|
||||
padding: 5px 15px;
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
padding: 10rpx 30rpx;
|
||||
margin-right: 20rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
border-radius: 8rpx;
|
||||
flex-shrink: 0;
|
||||
|
||||
&.active {
|
||||
@ -831,11 +928,11 @@ onShow(async () => {
|
||||
}
|
||||
|
||||
.total-count-inline {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
min-width: 50px;
|
||||
min-width: 100rpx;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
@ -854,22 +951,22 @@ onShow(async () => {
|
||||
}
|
||||
|
||||
.group-title {
|
||||
padding: 5px 15px;
|
||||
font-size: 14px;
|
||||
padding: 10rpx 30rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.patient-card {
|
||||
display: flex;
|
||||
background-color: #fff;
|
||||
padding: 15px;
|
||||
margin-bottom: 1px; // Separator line
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 2rpx; // Separator line
|
||||
border-bottom: 2rpx solid #f0f0f0;
|
||||
|
||||
.checkbox-area {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
@ -879,51 +976,59 @@ onShow(async () => {
|
||||
.card-row-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 16rpx;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.patient-info {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
margin-right: 10px;
|
||||
margin-right: 20rpx;
|
||||
|
||||
.patient-name {
|
||||
font-size: 18px;
|
||||
font-size: 32rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-right: 8px;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.patient-meta {
|
||||
font-size: 12px;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 2px;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.patient-tags {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
gap: 10rpx;
|
||||
|
||||
.tag {
|
||||
font-size: 10px;
|
||||
font-size: 20rpx;
|
||||
color: #5d8aff;
|
||||
border: 1px solid #5d8aff;
|
||||
padding: 0 4px;
|
||||
border-radius: 8px;
|
||||
height: 16px;
|
||||
line-height: 14px;
|
||||
border: 2rpx solid #5d8aff;
|
||||
padding: 0 8rpx;
|
||||
border-radius: 16rpx;
|
||||
height: 32rpx;
|
||||
line-height: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-row-bottom {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
|
||||
.record-text {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.record-ellipsis {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.no-record {
|
||||
color: #bdc3c7;
|
||||
}
|
||||
@ -935,39 +1040,39 @@ onShow(async () => {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 50px;
|
||||
height: 100rpx;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 15px;
|
||||
box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
|
||||
padding: 0 30rpx;
|
||||
box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.05);
|
||||
z-index: 99;
|
||||
|
||||
.left-action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.footer-text {
|
||||
margin-left: 5px;
|
||||
font-size: 14px;
|
||||
margin-left: 10rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.right-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
gap: 20rpx;
|
||||
|
||||
.footer-btn {
|
||||
font-size: 14px;
|
||||
padding: 0 15px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
font-size: 28rpx;
|
||||
padding: 0 30rpx;
|
||||
height: 64rpx;
|
||||
line-height: 64rpx;
|
||||
margin: 0;
|
||||
border-radius: 4px;
|
||||
border-radius: 8rpx;
|
||||
|
||||
&.plain {
|
||||
border: 1px solid #ddd;
|
||||
border: 2rpx solid #ddd;
|
||||
background-color: #fff;
|
||||
color: #666;
|
||||
}
|
||||
@ -986,11 +1091,11 @@ onShow(async () => {
|
||||
}
|
||||
|
||||
.sidebar-index {
|
||||
width: 20px;
|
||||
width: 40rpx;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 20px;
|
||||
bottom: 20px;
|
||||
top: 40rpx;
|
||||
bottom: 40rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
@ -999,10 +1104,10 @@ onShow(async () => {
|
||||
z-index: 10;
|
||||
|
||||
.index-item {
|
||||
font-size: 10px;
|
||||
font-size: 20rpx;
|
||||
color: #555;
|
||||
padding: 2px 0;
|
||||
width: 20px;
|
||||
padding: 4rpx 0;
|
||||
width: 40rpx;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@ -129,6 +129,15 @@ function normalizeTemplateItem(item) {
|
||||
return next;
|
||||
}
|
||||
|
||||
function unwrapTemplate(res) {
|
||||
const d = res?.data;
|
||||
if (d && typeof d === 'object') {
|
||||
if (d.data && typeof d.data === 'object') return d.data;
|
||||
return d;
|
||||
}
|
||||
return res && typeof res === 'object' ? res : {};
|
||||
}
|
||||
|
||||
async function loadBaseTemplate() {
|
||||
const corpId = String(account.value?.corpId || doctorInfo.value?.corpId || '') || '';
|
||||
if (!corpId) return;
|
||||
@ -142,7 +151,7 @@ async function loadBaseTemplate() {
|
||||
return;
|
||||
}
|
||||
|
||||
const temp = res?.data && typeof res.data === 'object' ? res.data : res;
|
||||
const temp = unwrapTemplate(res);
|
||||
const list = Array.isArray(temp.templateList) ? temp.templateList : [];
|
||||
baseItems.value = list
|
||||
.filter((i) => i && i.fieldStatus !== 'disable')
|
||||
|
||||
@ -95,7 +95,7 @@ function normalizeTemplateItem(item) {
|
||||
const customTypeMap = {
|
||||
customerSource: 'select',
|
||||
customerStage: 'select',
|
||||
tag: 'multiSelectAndOther',
|
||||
tag: 'tagPicker',
|
||||
reference: 'input',
|
||||
selectWwuser: 'select',
|
||||
files: 'files',
|
||||
@ -144,12 +144,139 @@ function normalizeTemplateItem(item) {
|
||||
return next;
|
||||
}
|
||||
|
||||
function unwrapTemplate(res) {
|
||||
// 兼容后端返回结构:{ success, data: { data: template } } / { success, data: template } / { templateList: [] }
|
||||
const d = res?.data;
|
||||
if (d && typeof d === 'object') {
|
||||
if (d.data && typeof d.data === 'object') return d.data;
|
||||
return d;
|
||||
}
|
||||
return res && typeof res === 'object' ? res : {};
|
||||
}
|
||||
|
||||
function ensureInternalDefaults(list, { stageOptions = [], tagOptions = [] } = {}) {
|
||||
const items = Array.isArray(list) ? [...list] : [];
|
||||
const has = (title) => items.some((i) => i && String(i.title || '') === title);
|
||||
|
||||
// 与 mobile 内部信息页一致:标签 / 备注 / 阶段
|
||||
if (!has('tagIds')) {
|
||||
items.unshift({
|
||||
title: 'tagIds',
|
||||
name: '标签',
|
||||
type: 'tag',
|
||||
operateType: 'formCell',
|
||||
required: false,
|
||||
wordLimit: 200,
|
||||
range: tagOptions,
|
||||
});
|
||||
}
|
||||
if (!has('notes')) {
|
||||
items.push({
|
||||
title: 'notes',
|
||||
name: '备注',
|
||||
type: 'textarea',
|
||||
operateType: 'formCell',
|
||||
required: false,
|
||||
wordLimit: 200,
|
||||
});
|
||||
}
|
||||
if (!has('customerStage')) {
|
||||
items.push({
|
||||
title: 'customerStage',
|
||||
name: '阶段',
|
||||
type: 'customerStage',
|
||||
operateType: 'formCell',
|
||||
required: false,
|
||||
range: stageOptions,
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
function unwrapListPayload(res) {
|
||||
const root = res && typeof res === 'object' ? res : {};
|
||||
const d = root.data && typeof root.data === 'object' ? root.data : root;
|
||||
if (!d) return [];
|
||||
if (Array.isArray(d)) return d;
|
||||
if (Array.isArray(d.data)) return d.data;
|
||||
if (Array.isArray(d.list)) return d.list;
|
||||
if (d.data && typeof d.data === 'object') {
|
||||
if (Array.isArray(d.data.data)) return d.data.data;
|
||||
if (Array.isArray(d.data.list)) return d.data.list;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function parseCustomerStageOptions(res) {
|
||||
const list = unwrapListPayload(res);
|
||||
return list
|
||||
.map((i) => {
|
||||
if (typeof i === 'string') return { label: i, value: i };
|
||||
const label = i?.name ?? i?.label ?? '';
|
||||
const value = i?.type ?? i?.value ?? i?.id ?? i?.key ?? label;
|
||||
if (!label && (value === undefined || value === null || value === '')) return null;
|
||||
return { label: String(label || value), value: String(value) };
|
||||
})
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function parseTagOptions(res) {
|
||||
const list = unwrapListPayload(res);
|
||||
let flat = [];
|
||||
|
||||
// 形态1:[{ groupName, tag: [{id,name}] }]
|
||||
if (list.length && typeof list[0] === 'object' && Array.isArray(list[0]?.tag)) {
|
||||
flat = list.reduce((acc, g) => {
|
||||
if (Array.isArray(g?.tag)) acc.push(...g.tag);
|
||||
return acc;
|
||||
}, []);
|
||||
} else {
|
||||
flat = list;
|
||||
}
|
||||
|
||||
const options = flat
|
||||
.map((i) => {
|
||||
if (typeof i === 'string') return { label: i, value: i };
|
||||
const label = i?.name ?? i?.label ?? i?.text ?? '';
|
||||
const value = i?.id ?? i?.value ?? i?.key ?? label;
|
||||
if (!label && (value === undefined || value === null || value === '')) return null;
|
||||
return { label: String(label || value), value: String(value) };
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
const seen = new Set();
|
||||
return options.filter((i) => {
|
||||
if (!i?.value) return false;
|
||||
if (seen.has(i.value)) return false;
|
||||
seen.add(i.value);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
function isStageItem(i) {
|
||||
const title = String(i?.title || '');
|
||||
const type = String(i?.type || '');
|
||||
const name = String(i?.name || '');
|
||||
return title === 'customerStage' || type === 'customerStage' || name.includes('阶段');
|
||||
}
|
||||
|
||||
function isTagItem(i) {
|
||||
const title = String(i?.title || '');
|
||||
const type = String(i?.type || '');
|
||||
const name = String(i?.name || '');
|
||||
return title === 'tagIds' || title === 'tag' || type === 'tag' || name.includes('标签');
|
||||
}
|
||||
|
||||
async function loadInternalTemplate() {
|
||||
const corpId = String(account.value?.corpId || doctorInfo.value?.corpId || '') || '';
|
||||
if (!corpId) return;
|
||||
|
||||
loading('加载中...');
|
||||
const res = await api('getCurrentTemplate', { corpId, templateType: 'internalTemplate' });
|
||||
const [res, stageRes, tagRes] = await Promise.all([
|
||||
api('getCurrentTemplate', { corpId, templateType: 'internalTemplate' }),
|
||||
api('getCustomerType', { corpId }),
|
||||
api('getCorpTags', { corpId }),
|
||||
]);
|
||||
hideLoading();
|
||||
|
||||
if (!res?.success) {
|
||||
@ -157,12 +284,32 @@ async function loadInternalTemplate() {
|
||||
return;
|
||||
}
|
||||
|
||||
const temp = res?.data && typeof res.data === 'object' ? res.data : res;
|
||||
const list = Array.isArray(temp.templateList) ? temp.templateList : [];
|
||||
console.log('[debug][wxapp][patient-inner-info] corpId:', corpId);
|
||||
console.log('[debug][wxapp][patient-inner-info] getCustomerType:', stageRes);
|
||||
console.log('[debug][wxapp][patient-inner-info] getCorpTags:', tagRes);
|
||||
|
||||
const stageOptions = parseCustomerStageOptions(stageRes);
|
||||
const tagOptions = parseTagOptions(tagRes);
|
||||
console.log('[debug][wxapp][patient-inner-info] parsed stageOptions:', stageOptions.length, stageOptions);
|
||||
console.log('[debug][wxapp][patient-inner-info] parsed tagOptions:', tagOptions.length, tagOptions);
|
||||
|
||||
const temp = unwrapTemplate(res);
|
||||
const list = ensureInternalDefaults(Array.isArray(temp.templateList) ? temp.templateList : [], { stageOptions, tagOptions }).map((i) => {
|
||||
const item = { ...(i || {}) };
|
||||
if (isStageItem(item) && (!Array.isArray(item.range) || item.range.length === 0)) item.range = stageOptions;
|
||||
if (isTagItem(item) && (!Array.isArray(item.range) || item.range.length === 0)) item.range = tagOptions;
|
||||
if (isTagItem(item) && item.title === 'tag') item.title = 'tagIds';
|
||||
return item;
|
||||
});
|
||||
items.value = list
|
||||
.filter((i) => i && i.fieldStatus !== 'disable')
|
||||
.filter((i) => i.operateType !== 'onlyRead')
|
||||
.map(normalizeTemplateItem);
|
||||
|
||||
const debugStage = items.value.find(isStageItem);
|
||||
const debugTag = items.value.find(isTagItem);
|
||||
console.log('[debug][wxapp][patient-inner-info] final stage item:', debugStage);
|
||||
console.log('[debug][wxapp][patient-inner-info] final tag item:', debugTag);
|
||||
}
|
||||
|
||||
onLoad(async () => {
|
||||
@ -235,6 +382,7 @@ function buildPayload(base, inner) {
|
||||
if (payload.gender && !payload.sex) payload.sex = payload.gender;
|
||||
if (payload.idNo && !payload.idCard) payload.idCard = payload.idNo;
|
||||
if (payload.idType && !payload.cardType) payload.cardType = payload.idType;
|
||||
if (payload.tag && !payload.tagIds) payload.tagIds = payload.tag;
|
||||
if (Array.isArray(payload.teamId)) payload.teamId = payload.teamId[0] || '';
|
||||
|
||||
if (payload.customerSource && typeof payload.customerSource === 'string') {
|
||||
|
||||
@ -98,23 +98,45 @@ function getTeamContext() {
|
||||
}
|
||||
|
||||
function formatPatient(raw) {
|
||||
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string');
|
||||
const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string');
|
||||
|
||||
// 优先使用后端返回的 tagNames(标签名称数组)
|
||||
const rawTagNames = asArray(raw?.tagNames).filter((i) => typeof i === 'string' && i.trim());
|
||||
// 其次使用 tags(如果是字符串数组)
|
||||
const rawTags = asArray(raw?.tags).filter((i) => typeof i === 'string' && i.trim());
|
||||
// 最后才使用 tagIds(仅作为兜底,不推荐显示)
|
||||
const tagIds = asArray(raw?.tagIds).map(String).filter(Boolean);
|
||||
|
||||
// 解析标签:优先 tagNames > tags(字符串) > tagIds
|
||||
const displayTags = rawTagNames.length ? rawTagNames : (rawTags.length ? rawTags : []);
|
||||
|
||||
const mobiles = asArray(raw?.mobiles).map(String).filter(Boolean);
|
||||
const mobile = raw?.mobile ? String(raw.mobile) : (mobiles[0] || '');
|
||||
|
||||
// 解析病历信息
|
||||
let record = null;
|
||||
if (raw?.latestRecord && typeof raw.latestRecord === 'object') {
|
||||
const lr = raw.latestRecord;
|
||||
const type = lr.type || '';
|
||||
const date = lr.date || '';
|
||||
const diagnosis = lr.diagnosis || '';
|
||||
if (type || date || diagnosis) {
|
||||
record = {
|
||||
type: type || '-',
|
||||
date: date || '-',
|
||||
diagnosis: diagnosis || '-'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
...raw,
|
||||
_id: raw?._id || raw?.id || '',
|
||||
name: raw?.name || raw?.customerName || '',
|
||||
gender: raw?.sex || raw?.gender || '',
|
||||
age: raw?.age ?? '',
|
||||
tags: rawTags.length ? rawTags : (rawTagNames.length ? rawTagNames : tagIds),
|
||||
tags: displayTags,
|
||||
mobiles,
|
||||
mobile,
|
||||
record: null,
|
||||
record,
|
||||
createTime: raw?.createTime || '',
|
||||
creator: raw?.creatorName || raw?.creator || '',
|
||||
hospitalId: raw?.customerNumber || raw?.hospitalId || '',
|
||||
@ -142,7 +164,7 @@ const doSearch = useDebounce(async () => {
|
||||
}
|
||||
|
||||
searching.value = true;
|
||||
const res = await api('searchCorpCustomerWithFollowTime', {
|
||||
const res = await api('searchCorpCustomerForCaseList', {
|
||||
corpId,
|
||||
userId,
|
||||
teamId,
|
||||
@ -315,6 +337,11 @@ const goDetail = (patient) => {
|
||||
|
||||
.record-text {
|
||||
color: #666;
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.no-record {
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="height: 120px;"></view>
|
||||
<view style="height: 240rpx;"></view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="footer">
|
||||
@ -328,7 +328,7 @@ function previewFile(idx) {
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #f5f6f8;
|
||||
padding-bottom: calc(76px + env(safe-area-inset-bottom));
|
||||
padding-bottom: calc(152rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
.body {
|
||||
height: 100vh;
|
||||
@ -340,24 +340,24 @@ function previewFile(idx) {
|
||||
}
|
||||
.header {
|
||||
background: #fff;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.header-title {
|
||||
padding: 14px 14px;
|
||||
font-size: 16px;
|
||||
padding: 28rpx 28rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
.form-wrap {
|
||||
background: #fff;
|
||||
margin-top: 10px;
|
||||
padding: 4px 0;
|
||||
margin-top: 20rpx;
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.upload-wrap {
|
||||
background: #fff;
|
||||
padding: 24rpx 30rpx;
|
||||
border-bottom: 1px solid #eee;
|
||||
border-bottom: 2rpx solid #eee;
|
||||
}
|
||||
.upload-row {
|
||||
display: flex;
|
||||
@ -384,7 +384,7 @@ function previewFile(idx) {
|
||||
width: 180rpx;
|
||||
height: 140rpx;
|
||||
position: relative;
|
||||
border: 1px solid #e5e7eb;
|
||||
border: 2rpx solid #e5e7eb;
|
||||
border-radius: 8rpx;
|
||||
overflow: hidden;
|
||||
background: #f9fafb;
|
||||
@ -408,7 +408,7 @@ function previewFile(idx) {
|
||||
.upload-add {
|
||||
width: 180rpx;
|
||||
height: 140rpx;
|
||||
border: 1px dashed #d1d5db;
|
||||
border: 2rpx dashed #d1d5db;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -425,17 +425,17 @@ function previewFile(idx) {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
|
||||
padding: 24rpx 28rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
|
||||
gap: 24rpx;
|
||||
box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.btn::after {
|
||||
border: none;
|
||||
@ -443,7 +443,7 @@ function previewFile(idx) {
|
||||
.btn.plain {
|
||||
background: #fff;
|
||||
color: #4f6ef7;
|
||||
border: 1px solid #4f6ef7;
|
||||
border: 2rpx solid #4f6ef7;
|
||||
}
|
||||
.btn.primary {
|
||||
background: #4f6ef7;
|
||||
@ -452,16 +452,16 @@ function previewFile(idx) {
|
||||
|
||||
.delete-fab {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
bottom: calc(96px + env(safe-area-inset-bottom));
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 26px;
|
||||
right: 32rpx;
|
||||
bottom: calc(192rpx + env(safe-area-inset-bottom));
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
border-radius: 52rpx;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
|
||||
box-shadow: 0 20rpx 36rpx rgba(0, 0, 0, 0.12);
|
||||
z-index: 30;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -267,70 +267,70 @@ function remove() {
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #fff;
|
||||
padding-bottom: calc(76px + env(safe-area-inset-bottom));
|
||||
padding-bottom: calc(152rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
.topbar {
|
||||
background: #5d6df0;
|
||||
padding: 10px 14px;
|
||||
padding: 20rpx 28rpx;
|
||||
}
|
||||
.topbar-text {
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.content {
|
||||
padding: 14px 14px 0;
|
||||
padding: 28rpx 28rpx 0;
|
||||
}
|
||||
.section {
|
||||
margin-bottom: 14px;
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
padding: 10px 0;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
.label {
|
||||
width: 90px;
|
||||
font-size: 14px;
|
||||
width: 180rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #111827;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #111827;
|
||||
word-break: break-all;
|
||||
}
|
||||
.h2 {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
padding: 8px 0;
|
||||
padding: 16rpx 0;
|
||||
}
|
||||
.p {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #111827;
|
||||
line-height: 20px;
|
||||
line-height: 40rpx;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.files {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
gap: 20rpx;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.file {
|
||||
width: 90px;
|
||||
height: 70px;
|
||||
border: 1px solid #d1d5db;
|
||||
width: 180rpx;
|
||||
height: 140rpx;
|
||||
border: 2rpx solid #d1d5db;
|
||||
background: #f9fafb;
|
||||
}
|
||||
.thumb {
|
||||
width: 90px;
|
||||
height: 70px;
|
||||
width: 180rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
.files-empty {
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
color: #9aa0a6;
|
||||
padding: 8px 0;
|
||||
padding: 16rpx 0;
|
||||
}
|
||||
.footer {
|
||||
position: fixed;
|
||||
@ -338,18 +338,18 @@ function remove() {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
|
||||
padding: 24rpx 28rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 14px;
|
||||
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
|
||||
gap: 28rpx;
|
||||
box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.btn {
|
||||
width: 120px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
width: 240rpx;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.btn::after {
|
||||
border: none;
|
||||
@ -357,7 +357,7 @@ function remove() {
|
||||
.btn.danger {
|
||||
background: #fff;
|
||||
color: #ff4d4f;
|
||||
border: 1px solid #ff4d4f;
|
||||
border: 2rpx solid #ff4d4f;
|
||||
}
|
||||
.btn.primary {
|
||||
background: #4f6ef7;
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<uni-icons :type="selectedMap[item.label] ? 'checkmarkempty' : ''" size="22" color="#007aff" />
|
||||
</view>
|
||||
<view v-if="showList.length === 0" class="empty">暂无诊断数据</view>
|
||||
<view style="height: 120px;"></view>
|
||||
<view style="height: 240rpx;"></view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="footer">
|
||||
@ -132,32 +132,32 @@ function save() {
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #fff;
|
||||
padding-bottom: calc(76px + env(safe-area-inset-bottom));
|
||||
padding-bottom: calc(152rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
.top {
|
||||
padding: 12px 14px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
|
||||
padding: 24rpx 28rpx;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.scroll {
|
||||
height: calc(100vh - 140px);
|
||||
height: calc(100vh - 280rpx);
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 14px 14px;
|
||||
border-bottom: 1px solid #f2f2f2;
|
||||
padding: 28rpx 28rpx;
|
||||
border-bottom: 2rpx solid #f2f2f2;
|
||||
}
|
||||
.label {
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #111827;
|
||||
margin-right: 10px;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.empty {
|
||||
padding: 60px 0;
|
||||
padding: 120rpx 0;
|
||||
text-align: center;
|
||||
color: #9aa0a6;
|
||||
font-size: 13px;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.footer {
|
||||
position: fixed;
|
||||
@ -165,15 +165,15 @@ function save() {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
|
||||
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
|
||||
padding: 24rpx 28rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.btn {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.btn::after {
|
||||
border: none;
|
||||
|
||||
224
pages/library/tag-list/tag-list.vue
Normal file
224
pages/library/tag-list/tag-list.vue
Normal file
@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<scroll-view scroll-y class="scroll">
|
||||
<view v-for="(group, idx) in tagGroups" :key="group.id || idx" class="group">
|
||||
<view class="group-title">
|
||||
<text>{{ group.groupName || '标签' }}</text>
|
||||
<text v-if="group.createType === 'corpAsync'" class="hint">(企微标签)</text>
|
||||
</view>
|
||||
<view class="tags">
|
||||
<view
|
||||
v-for="tag in group.tag"
|
||||
:key="tag.id"
|
||||
class="tag"
|
||||
:class="selectedMap[tag.id] ? 'active' : ''"
|
||||
@click="toggle(tag.id)"
|
||||
>
|
||||
{{ tag.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="spacer" />
|
||||
</scroll-view>
|
||||
|
||||
<view class="footer">
|
||||
<view class="btn plain" @click="cancel">取消</view>
|
||||
<view class="btn primary" @click="save">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
import api from '@/utils/api';
|
||||
import useAccountStore from '@/store/account';
|
||||
import { hideLoading, loading, toast } from '@/utils/widget';
|
||||
|
||||
const accountStore = useAccountStore();
|
||||
const account = computed(() => accountStore.account);
|
||||
const doctorInfo = computed(() => accountStore.doctorInfo);
|
||||
|
||||
const eventName = ref('change-tag-list');
|
||||
const selections = ref([]);
|
||||
const tagGroups = ref([]);
|
||||
|
||||
const selectedMap = computed(() =>
|
||||
selections.value.reduce((m, id) => {
|
||||
m[String(id)] = true;
|
||||
return m;
|
||||
}, {})
|
||||
);
|
||||
|
||||
function unwrapListPayload(res) {
|
||||
const root = res && typeof res === 'object' ? res : {};
|
||||
const d = root.data && typeof root.data === 'object' ? root.data : root;
|
||||
if (!d) return [];
|
||||
if (Array.isArray(d)) return d;
|
||||
if (Array.isArray(d.list)) return d.list;
|
||||
if (Array.isArray(d.data)) return d.data;
|
||||
if (d.data && typeof d.data === 'object') {
|
||||
if (Array.isArray(d.data.list)) return d.data.list;
|
||||
if (Array.isArray(d.data.data)) return d.data.data;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function normalizeGroups(list) {
|
||||
const groups = Array.isArray(list) ? list : [];
|
||||
return groups
|
||||
.map((g) => {
|
||||
const tag = Array.isArray(g?.tag) ? g.tag : Array.isArray(g?.tags) ? g.tags : [];
|
||||
return {
|
||||
id: g?.id || g?._id || g?.groupId || '',
|
||||
groupName: g?.groupName || g?.name || '',
|
||||
createType: g?.createType || '',
|
||||
tag: (Array.isArray(tag) ? tag : [])
|
||||
.map((t) => ({
|
||||
id: String(t?.id || t?._id || t?.tagId || ''),
|
||||
name: String(t?.name || t?.label || ''),
|
||||
}))
|
||||
.filter((t) => t.id && t.name),
|
||||
};
|
||||
})
|
||||
.filter((g) => g.tag.length > 0);
|
||||
}
|
||||
|
||||
function getCorpId() {
|
||||
const env = __VITE_ENV__;
|
||||
return String(account.value?.corpId || doctorInfo.value?.corpId || env.MP_CORP_ID || '');
|
||||
}
|
||||
|
||||
async function loadTags() {
|
||||
const corpId = getCorpId();
|
||||
if (!corpId) return;
|
||||
|
||||
loading('加载中...');
|
||||
const res = await api('getCorpTags', { corpId });
|
||||
hideLoading();
|
||||
if (!res?.success) {
|
||||
toast(res?.message || '获取标签失败');
|
||||
tagGroups.value = [];
|
||||
return;
|
||||
}
|
||||
const list = unwrapListPayload(res);
|
||||
tagGroups.value = normalizeGroups(list);
|
||||
}
|
||||
|
||||
function toggle(id) {
|
||||
const key = String(id);
|
||||
if (!key) return;
|
||||
if (selectedMap.value[key]) {
|
||||
selections.value = selections.value.filter((i) => String(i) !== key);
|
||||
} else {
|
||||
selections.value = [...selections.value, key];
|
||||
}
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
function save() {
|
||||
const list = selections.value.map(String).filter(Boolean);
|
||||
uni.$emit(eventName.value, list);
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
onLoad(async (query) => {
|
||||
if (query?.eventName) eventName.value = String(query.eventName);
|
||||
const cached = uni.getStorageSync('ykt_tag_list_selections');
|
||||
uni.removeStorageSync('ykt_tag_list_selections');
|
||||
selections.value = Array.isArray(cached) ? cached.map(String).filter(Boolean) : [];
|
||||
await loadTags();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page {
|
||||
height: 100vh;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.group {
|
||||
padding: 30rpx;
|
||||
}
|
||||
|
||||
.group-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.hint {
|
||||
font-size: 22rpx;
|
||||
color: #5d8aff;
|
||||
}
|
||||
|
||||
.tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
}
|
||||
|
||||
.tag {
|
||||
max-width: 100%;
|
||||
padding: 12rpx 20rpx;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 16rpx;
|
||||
font-size: 24rpx;
|
||||
line-height: 1.2em;
|
||||
color: #333;
|
||||
background: #fff;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.tag.active {
|
||||
color: #fff;
|
||||
border-color: #5d8aff;
|
||||
background: #5d8aff;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
height: 120rpx;
|
||||
}
|
||||
|
||||
.footer {
|
||||
padding: 24rpx 30rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
border-top: 1px solid #eee;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn.plain {
|
||||
background: #fff;
|
||||
color: #666;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.btn.primary {
|
||||
background: #5d8aff;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
@ -16,6 +16,76 @@ $primary-color: #0877F1;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/* 患者信息栏样式 */
|
||||
.patient-info-bar {
|
||||
position: relative;
|
||||
background: #fff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
padding: 20rpx 32rpx;
|
||||
z-index: 10;
|
||||
flex-shrink: 0; /* 防止被压缩 */
|
||||
}
|
||||
|
||||
.patient-info-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.patient-basic-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
flex: 1;
|
||||
min-width: 0; /* 允许文字截断 */
|
||||
}
|
||||
|
||||
.patient-name {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 200rpx;
|
||||
}
|
||||
|
||||
.patient-detail {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.patient-detail-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
background: linear-gradient(270deg, #1b5cc8 2.26%, #0877f1 94.33%);
|
||||
border-radius: 40rpx;
|
||||
transition: all 0.2s;
|
||||
flex-shrink: 0; /* 防止按钮被压缩 */
|
||||
}
|
||||
|
||||
.patient-detail-btn:active {
|
||||
opacity: 0.8;
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.detail-btn-text {
|
||||
font-size: 26rpx;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.arrow-icon {
|
||||
font-size: 32rpx;
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.chat-content {
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
/>
|
||||
|
||||
<!-- 进度显示弹窗 -->
|
||||
<medical-case-progress
|
||||
ref="progressRef"
|
||||
<medical-case-progress
|
||||
ref="progressRef"
|
||||
@regenerate="handleRegenerateFromProgress"
|
||||
@next="handleNextFromProgress"
|
||||
/>
|
||||
@ -65,12 +65,12 @@ const buttons = ref([
|
||||
icon: "/static/icon/zhuiwen.png",
|
||||
loading: false,
|
||||
},
|
||||
{
|
||||
id: "aiAssistant",
|
||||
text: "开启AI助手",
|
||||
icon: "/static/icon/kaiqiAI.png",
|
||||
loading: false,
|
||||
},
|
||||
// {
|
||||
// id: "aiAssistant",
|
||||
// text: "开启AI助手",
|
||||
// icon: "/static/icon/kaiqiAI.png",
|
||||
// loading: false,
|
||||
// },
|
||||
{
|
||||
id: "supplementRecord",
|
||||
text: "补充病历",
|
||||
@ -241,7 +241,7 @@ const handleCaseTypeSelect = async (type) => {
|
||||
title: error.message || "生成病历失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("补充病历失败:", error);
|
||||
@ -254,33 +254,42 @@ const handleCaseTypeSelect = async (type) => {
|
||||
};
|
||||
|
||||
// 流式请求处理
|
||||
const requestWithStream = async ({ url, data, onProgress, onComplete, onError }) => {
|
||||
const requestWithStream = async ({
|
||||
url,
|
||||
data,
|
||||
onProgress,
|
||||
onComplete,
|
||||
onError,
|
||||
}) => {
|
||||
try {
|
||||
// 调用接口时不显示全局 loading(第二个参数为 false)
|
||||
const result = await request({
|
||||
url,
|
||||
data,
|
||||
}, false);
|
||||
const result = await request(
|
||||
{
|
||||
url,
|
||||
data,
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
if (result.success && result.data) {
|
||||
// 模拟流式处理(如果后端返回的是完整数据)
|
||||
const extractedData = result.data.extractedData || {};
|
||||
|
||||
|
||||
// 逐个字段动态显示(包括空值字段)
|
||||
let progressValue = 20;
|
||||
const fields = Object.entries(extractedData);
|
||||
const delay = 300; // 每个字段显示间隔
|
||||
|
||||
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
const [key, value] = fields[i];
|
||||
|
||||
|
||||
// 显示所有字段,包括空值(会在组件中显示为"暂无")
|
||||
await new Promise(resolve => setTimeout(resolve, delay));
|
||||
await new Promise((resolve) => setTimeout(resolve, delay));
|
||||
onProgress({ key, value });
|
||||
progressValue += Math.floor(60 / fields.length);
|
||||
progressRef.value?.updateProgress(Math.min(progressValue, 80));
|
||||
}
|
||||
|
||||
|
||||
// 完成
|
||||
onComplete(result.data);
|
||||
} else {
|
||||
@ -294,7 +303,7 @@ const requestWithStream = async ({ url, data, onProgress, onComplete, onError })
|
||||
// 处理流式数据
|
||||
const handleStreamData = (data, caseType) => {
|
||||
const { key, value } = data;
|
||||
|
||||
|
||||
// 添加检测到的信息
|
||||
progressRef.value?.addDetectedInfo(key, value);
|
||||
};
|
||||
|
||||
317
pages/message/components/message-header.vue
Normal file
317
pages/message/components/message-header.vue
Normal file
@ -0,0 +1,317 @@
|
||||
<template>
|
||||
<view class="header-container">
|
||||
<view class="header-content">
|
||||
<!-- 团队选择器 -->
|
||||
<view class="team-selector" @click="showTeamPicker = true">
|
||||
<text class="team-name">{{ currentTeamName }}</text>
|
||||
<image class="arrow-icon" src="/static/zhuanhua.svg" mode="aspectFit" />
|
||||
</view>
|
||||
|
||||
<!-- 右侧操作按钮 -->
|
||||
<view class="header-actions">
|
||||
<view class="action-btn" @click="handleAddPatient">
|
||||
<image
|
||||
class="invite-icon"
|
||||
src="/static/work/qrcode.svg"
|
||||
mode="aspectFit"
|
||||
/>
|
||||
<text class="action-text">邀请患者</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 标签页切换 -->
|
||||
<view class="tabs-container">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'processing' }"
|
||||
@click="handleTabChange('processing')"
|
||||
>
|
||||
<text class="tab-text">处理中</text>
|
||||
</view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'finished' }"
|
||||
@click="handleTabChange('finished')"
|
||||
>
|
||||
<text class="tab-text">已结束</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 团队选择弹窗 -->
|
||||
<view
|
||||
v-if="showTeamPicker"
|
||||
class="team-picker-overlay"
|
||||
@click="showTeamPicker = false"
|
||||
>
|
||||
<view class="team-picker-content" @click.stop>
|
||||
<view class="team-picker-header">
|
||||
<text class="picker-title">选择团队</text>
|
||||
</view>
|
||||
<scroll-view class="team-list" scroll-y>
|
||||
<view
|
||||
v-for="team in teamList"
|
||||
:key="team.teamId"
|
||||
class="team-item"
|
||||
:class="{ active: currentTeamId === team.teamId }"
|
||||
@click="selectTeam(team)"
|
||||
>
|
||||
<text class="team-item-name">{{ team.name }}</text>
|
||||
<text v-if="currentTeamId === team.teamId" class="check-icon">✓</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import useTeamStore from "@/store/team.js";
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
activeTab: {
|
||||
type: String,
|
||||
default: "processing",
|
||||
},
|
||||
});
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(["update:activeTab", "teamChange", "addPatient"]);
|
||||
|
||||
// 获取团队信息
|
||||
const teamStore = useTeamStore();
|
||||
const { teams } = storeToRefs(teamStore);
|
||||
|
||||
// 团队相关状态
|
||||
const showTeamPicker = ref(false);
|
||||
const currentTeamId = ref(""); // 空字符串表示"全部会话消息"
|
||||
|
||||
// 团队列表(包含"全部会话消息"选项)
|
||||
const teamList = computed(() => {
|
||||
const allOption = { teamId: "", name: "全部会话消息" };
|
||||
return [allOption, ...(teams.value || [])];
|
||||
});
|
||||
|
||||
// 当前团队名称
|
||||
const currentTeamName = computed(() => {
|
||||
if (!currentTeamId.value) return "全部会话消息";
|
||||
const team = teams.value.find((t) => t.teamId === currentTeamId.value);
|
||||
return team ? team.name : "全部会话消息";
|
||||
});
|
||||
|
||||
// 选择团队
|
||||
const selectTeam = (team) => {
|
||||
currentTeamId.value = team.teamId;
|
||||
showTeamPicker.value = false;
|
||||
console.log("切换到团队:", team.name);
|
||||
emit("teamChange", team.teamId);
|
||||
};
|
||||
|
||||
// 切换标签页
|
||||
const handleTabChange = (tab) => {
|
||||
if (props.activeTab === tab) return;
|
||||
emit("update:activeTab", tab);
|
||||
};
|
||||
|
||||
// 添加患者
|
||||
const handleAddPatient = () => {
|
||||
emit("addPatient");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.header-container {
|
||||
background-color: #fff;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16rpx 32rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.team-selector {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
cursor: pointer;
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.team-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.arrow-icon {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
margin-left: 8rpx;
|
||||
flex-shrink: 0;
|
||||
opacity: 0.6;
|
||||
filter: brightness(0.5);
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-left: 16rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 6rpx 12rpx;
|
||||
// background-color: #f5f5f5;
|
||||
border-radius: 8rpx;
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.invite-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.action-text {
|
||||
font-size: 20rpx;
|
||||
color: #666;
|
||||
line-height: 1.4;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tabs-container {
|
||||
display: flex;
|
||||
padding: 0 32rpx;
|
||||
gap: 48rpx;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
position: relative;
|
||||
padding: 20rpx 0;
|
||||
cursor: pointer;
|
||||
|
||||
&.active {
|
||||
.tab-text {
|
||||
color: #1890ff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 48rpx;
|
||||
height: 4rpx;
|
||||
background-color: #1890ff;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
transition: color 0.3s;
|
||||
}
|
||||
|
||||
.team-picker-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
padding-top: 200rpx;
|
||||
}
|
||||
|
||||
.team-picker-content {
|
||||
width: 600rpx;
|
||||
max-height: 800rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.team-picker-header {
|
||||
padding: 32rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.picker-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.team-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.team-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
cursor: pointer;
|
||||
|
||||
&:active {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: #e6f7ff;
|
||||
|
||||
.team-item-name {
|
||||
color: #1890ff;
|
||||
}
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.team-item-name {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.check-icon {
|
||||
font-size: 32rpx;
|
||||
color: #1890ff;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
@ -1,5 +1,18 @@
|
||||
<template>
|
||||
<view class="chat-page">
|
||||
<!-- 患者信息栏 -->
|
||||
<view class="patient-info-bar" v-if="patientInfo.name">
|
||||
<view class="patient-info-content">
|
||||
<view class="patient-basic-info">
|
||||
<text class="patient-name">{{ patientInfo.name }}</text>
|
||||
<text class="patient-detail">{{ patientInfo.sex }} · {{ patientInfo.age }}岁</text>
|
||||
</view>
|
||||
<view class="patient-detail-btn" @click="handleViewPatientDetail">
|
||||
<text class="detail-btn-text">查看档案</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 聊天消息区域 -->
|
||||
<scroll-view
|
||||
class="chat-content"
|
||||
@ -127,7 +140,11 @@
|
||||
|
||||
<!-- AI助手按钮组 -->
|
||||
<AIAssistantButtons
|
||||
v-if="!isEvaluationPopupOpen && !showConsultAccept && orderStatus === 'processing'"
|
||||
v-if="
|
||||
!isEvaluationPopupOpen &&
|
||||
!showConsultAccept &&
|
||||
orderStatus === 'processing'
|
||||
"
|
||||
:groupId="groupId"
|
||||
:patientAccountId="chatInfo.userID || ''"
|
||||
:corpId="corpId"
|
||||
@ -204,9 +221,9 @@ const groupId = ref("");
|
||||
const { chatMember, getGroupInfo } = useGroupChat(groupId);
|
||||
|
||||
// 动态设置导航栏标题
|
||||
const updateNavigationTitle = () => {
|
||||
const updateNavigationTitle = (title = "群聊") => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: "群聊",
|
||||
title: title,
|
||||
});
|
||||
};
|
||||
|
||||
@ -222,6 +239,14 @@ const isEvaluationPopupOpen = ref(false);
|
||||
// 订单状态
|
||||
const orderStatus = ref("");
|
||||
|
||||
// 患者信息
|
||||
const patientInfo = ref({
|
||||
name: "",
|
||||
sex: "",
|
||||
age: "",
|
||||
mobile: "",
|
||||
});
|
||||
|
||||
// 计算弹框显示状态 - 只有 pending 状态才显示接受问诊组件
|
||||
const showConsultAccept = computed(() => orderStatus.value === "pending");
|
||||
|
||||
@ -281,8 +306,25 @@ const fetchGroupOrderStatus = async () => {
|
||||
|
||||
if (result.success && result.data) {
|
||||
orderStatus.value = result.data.orderStatus || "";
|
||||
|
||||
// 更新导航栏标题为团队名称
|
||||
const teamName = result.data.team?.name || "群聊";
|
||||
updateNavigationTitle(teamName);
|
||||
|
||||
// 更新患者信息
|
||||
if (result.data.patient) {
|
||||
patientInfo.value = {
|
||||
name: result.data.patient.name || "",
|
||||
sex: result.data.patient.sex || "",
|
||||
age: result.data.patient.age || "",
|
||||
mobile: result.data.patient.mobile || "",
|
||||
};
|
||||
}
|
||||
|
||||
console.log("获取群组订单状态:", {
|
||||
orderStatus: orderStatus.value,
|
||||
teamName: teamName,
|
||||
patientInfo: patientInfo.value,
|
||||
groupId: groupId.value,
|
||||
});
|
||||
} else {
|
||||
@ -401,7 +443,11 @@ const initTIMCallbacks = async () => {
|
||||
});
|
||||
|
||||
// 立即标记会话为已读,确保未读数为0
|
||||
if (timChatManager.tim && timChatManager.isLoggedIn && chatInfo.value.conversationID) {
|
||||
if (
|
||||
timChatManager.tim &&
|
||||
timChatManager.isLoggedIn &&
|
||||
chatInfo.value.conversationID
|
||||
) {
|
||||
timChatManager.tim
|
||||
.setMessageRead({
|
||||
conversationID: chatInfo.value.conversationID,
|
||||
@ -409,9 +455,9 @@ const initTIMCallbacks = async () => {
|
||||
.then(() => {
|
||||
console.log("✓ 收到新消息后已标记为已读");
|
||||
// 触发会话列表更新,确保未读数为0
|
||||
timChatManager.triggerCallback('onConversationListUpdated', {
|
||||
timChatManager.triggerCallback("onConversationListUpdated", {
|
||||
conversationID: chatInfo.value.conversationID,
|
||||
unreadCount: 0
|
||||
unreadCount: 0,
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
@ -570,9 +616,9 @@ const loadMessageList = async () => {
|
||||
.then(() => {
|
||||
console.log("✓ 会话已标记为已读:", chatInfo.value.conversationID);
|
||||
// 触发会话列表更新回调,通知消息列表页面清空未读数
|
||||
timChatManager.triggerCallback('onConversationListUpdated', {
|
||||
timChatManager.triggerCallback("onConversationListUpdated", {
|
||||
conversationID: chatInfo.value.conversationID,
|
||||
unreadCount: 0
|
||||
unreadCount: 0,
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
@ -851,6 +897,15 @@ const handleRejectReasonConfirm = async (reason) => {
|
||||
const handleRejectReasonCancel = () => {
|
||||
showRejectReasonModal.value = false;
|
||||
};
|
||||
|
||||
// 处理查看患者详情
|
||||
const handleViewPatientDetail = () => {
|
||||
// TODO: 跳转到患者详情页面
|
||||
uni.showToast({
|
||||
title: "患者详情功能开发中",
|
||||
icon: "none",
|
||||
});
|
||||
};
|
||||
// 处理结束问诊
|
||||
const handleEndConsult = async () => {
|
||||
try {
|
||||
|
||||
@ -1,24 +1,11 @@
|
||||
<template>
|
||||
<view class="message-page">
|
||||
<!-- 标签页切换 -->
|
||||
<view class="tabs-container">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'processing' }"
|
||||
@click="switchTab('processing')"
|
||||
>
|
||||
<text class="tab-text">处理中</text>
|
||||
<view v-if="activeTab === 'processing'" class="tab-indicator"></view>
|
||||
</view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'finished' }"
|
||||
@click="switchTab('finished')"
|
||||
>
|
||||
<text class="tab-text">已结束</text>
|
||||
<view v-if="activeTab === 'finished'" class="tab-indicator"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 头部组件 -->
|
||||
<message-header
|
||||
v-model:activeTab="activeTab"
|
||||
@team-change="handleTeamChange"
|
||||
@add-patient="handleAddPatient"
|
||||
/>
|
||||
|
||||
<!-- 消息列表 -->
|
||||
<scroll-view
|
||||
@ -101,12 +88,26 @@ import { ref, watch, computed } from "vue";
|
||||
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
|
||||
import { storeToRefs } from "pinia";
|
||||
import useAccountStore from "@/store/account.js";
|
||||
import useTeamStore from "@/store/team.js";
|
||||
import useInfoCheck from "@/hooks/useInfoCheck.js";
|
||||
import { globalTimChatManager } from "@/utils/tim-chat.js";
|
||||
import { mergeConversationWithGroupDetails } from "@/utils/conversation-merger.js";
|
||||
import MessageHeader from "./components/message-header.vue";
|
||||
|
||||
// 获取登录状态
|
||||
const { account, openid, isIMInitialized } = storeToRefs(useAccountStore());
|
||||
const { initIMAfterLogin } = useAccountStore();
|
||||
|
||||
// 获取团队信息
|
||||
const teamStore = useTeamStore();
|
||||
const { getTeams } = teamStore;
|
||||
|
||||
// 信息完善检查
|
||||
const { withInfo } = useInfoCheck();
|
||||
|
||||
// 团队相关状态
|
||||
const currentTeamId = ref(""); // 空字符串表示"全部会话消息"
|
||||
|
||||
// 监听 IM 初始化状态
|
||||
watch(isIMInitialized, (newValue) => {
|
||||
console.log("IM初始化状态变化:", newValue);
|
||||
@ -126,32 +127,44 @@ const activeTab = ref("processing");
|
||||
|
||||
// 根据 orderStatus 过滤会话列表
|
||||
const filteredConversationList = computed(() => {
|
||||
let filtered = [];
|
||||
|
||||
if (activeTab.value === "processing") {
|
||||
// 处理中:pending(待处理) 和 processing(处理中)
|
||||
const filtered = conversationList.value.filter(
|
||||
filtered = conversationList.value.filter(
|
||||
(conv) =>
|
||||
conv.orderStatus === "pending" || conv.orderStatus === "processing"
|
||||
);
|
||||
return filtered;
|
||||
} else {
|
||||
// 已结束:cancelled(已取消)、completed(已完成)、finished(已结束)
|
||||
const filtered = conversationList.value.filter(
|
||||
filtered = conversationList.value.filter(
|
||||
(conv) =>
|
||||
conv.orderStatus === "cancelled" ||
|
||||
conv.orderStatus === "completed" ||
|
||||
conv.orderStatus === "finished"
|
||||
);
|
||||
return filtered;
|
||||
}
|
||||
|
||||
// 如果选择了团队,进一步过滤
|
||||
if (currentTeamId.value) {
|
||||
filtered = filtered.filter((conv) => conv.teamId === currentTeamId.value);
|
||||
}
|
||||
return filtered;
|
||||
});
|
||||
|
||||
// 切换标签页
|
||||
const switchTab = (tab) => {
|
||||
if (activeTab.value === tab) return;
|
||||
activeTab.value = tab;
|
||||
console.log("切换到标签页:", tab);
|
||||
// 处理团队切换
|
||||
const handleTeamChange = (teamId) => {
|
||||
currentTeamId.value = teamId;
|
||||
console.log("切换到团队ID:", teamId);
|
||||
};
|
||||
|
||||
// 邀请患者 - 使用 withInfo 包装,确保信息完善后才能使用
|
||||
const handleAddPatient = withInfo(() => {
|
||||
uni.navigateTo({
|
||||
url: "/pages/work/team/invite/invite-patient",
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化IM
|
||||
const initIM = async () => {
|
||||
if (!isIMInitialized.value) {
|
||||
@ -311,13 +324,20 @@ const setupConversationListener = () => {
|
||||
existing.patientSex !== conversationData.patientSex ||
|
||||
existing.patientAge !== conversationData.patientAge
|
||||
) {
|
||||
Object.assign(
|
||||
conversationList.value[existingIndex],
|
||||
conversationData
|
||||
);
|
||||
// 只更新变化的字段,保持头像和未读数稳定
|
||||
conversationList.value[existingIndex] = {
|
||||
...conversationData,
|
||||
// 保持原有头像,避免闪动
|
||||
avatar: existing.avatar || conversationData.avatar,
|
||||
// 保留较大的未读数(避免被后端数据覆盖)
|
||||
unreadCount: Math.max(
|
||||
existing.unreadCount || 0,
|
||||
conversationData.unreadCount || 0
|
||||
),
|
||||
};
|
||||
needSort = true;
|
||||
console.log(
|
||||
`已更新会话: ${conversationData.name}, unreadCount: ${conversationData.unreadCount}`
|
||||
`已更新会话: ${conversationData.name}, unreadCount: ${conversationList.value[existingIndex].unreadCount}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@ -350,19 +370,23 @@ const setupConversationListener = () => {
|
||||
if (conversationIndex !== -1) {
|
||||
const conversation = conversationList.value[conversationIndex];
|
||||
|
||||
// 检查当前页面栈,判断用户是否正在查看该会话
|
||||
// 检查当前页面栈,判断用户是否正在查看该会话的聊天详情页
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
const isViewingConversation =
|
||||
currentPage?.route === "pages/message/index";
|
||||
|
||||
// 如果用户正在查看该会话,不增加未读数
|
||||
if (isViewingConversation) {
|
||||
// 获取当前页面的 groupID 参数(如果在聊天详情页)
|
||||
const currentGroupID = currentPage?.options?.groupID;
|
||||
const isViewingThisConversation =
|
||||
currentPage?.route === "pages/message/index" &&
|
||||
currentGroupID === conversation.groupID;
|
||||
|
||||
// 如果用户正在查看这个具体的会话,不增加未读数
|
||||
if (isViewingThisConversation) {
|
||||
console.log("用户正在查看该会话,不增加未读数");
|
||||
return;
|
||||
}
|
||||
|
||||
// 只在用户不在聊天页面时才增加未读数
|
||||
// 只在用户不在该会话的聊天页面时才增加未读数
|
||||
conversation.unreadCount = (conversation.unreadCount || 0) + 1;
|
||||
console.log(
|
||||
"已更新会话未读数:",
|
||||
@ -488,6 +512,9 @@ onLoad(() => {
|
||||
// 页面显示
|
||||
onShow(async () => {
|
||||
try {
|
||||
// 加载团队列表
|
||||
await getTeams();
|
||||
|
||||
// 初始化IM
|
||||
const imReady = await initIM();
|
||||
if (!imReady) {
|
||||
@ -531,46 +558,6 @@ onHide(() => {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tabs-container {
|
||||
display: flex;
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 28rpx 0;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
||||
&.active {
|
||||
.tab-text {
|
||||
color: #1890ff;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 32rpx;
|
||||
color: #666;
|
||||
transition: color 0.3s;
|
||||
}
|
||||
|
||||
.tab-indicator {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 60rpx;
|
||||
height: 6rpx;
|
||||
background-color: #1890ff;
|
||||
border-radius: 3rpx;
|
||||
}
|
||||
|
||||
.message-list {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
@ -604,7 +591,7 @@ onHide(() => {
|
||||
.message-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 32rpx;
|
||||
padding: 24rpx 32rpx;
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #f0f0f0;
|
||||
|
||||
@ -616,6 +603,7 @@ onHide(() => {
|
||||
.avatar-container {
|
||||
position: relative;
|
||||
margin-right: 24rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
@ -659,14 +647,28 @@ onHide(() => {
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.name-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 32rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 1;
|
||||
}
|
||||
|
||||
.patient-info {
|
||||
font-size: 26rpx;
|
||||
padding-left: 12rpx;
|
||||
color: #999;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.time {
|
||||
@ -682,7 +684,7 @@ onHide(() => {
|
||||
}
|
||||
|
||||
.preview-text {
|
||||
font-size: 28rpx;
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@ -698,10 +700,4 @@ onHide(() => {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.patient-info {
|
||||
font-size: 28rpx;
|
||||
padding-left: 10rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view style="height: 120px;"></view>
|
||||
<view style="height: 240rpx;"></view>
|
||||
</scroll-view>
|
||||
|
||||
<view class="footer">
|
||||
@ -68,28 +68,28 @@ function save() {
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #fff;
|
||||
padding-bottom: calc(76px + env(safe-area-inset-bottom));
|
||||
padding-bottom: calc(152rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
.scroll {
|
||||
height: 100vh;
|
||||
}
|
||||
.section {
|
||||
padding: 16px 14px 0;
|
||||
padding: 32rpx 28rpx 0;
|
||||
}
|
||||
.title {
|
||||
font-size: 15px;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
margin-bottom: 10px;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.textarea {
|
||||
width: 100%;
|
||||
min-height: 120px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
min-height: 240rpx;
|
||||
border: 2rpx solid #e5e7eb;
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 14px;
|
||||
font-size: 28rpx;
|
||||
color: #111827;
|
||||
}
|
||||
.placeholder {
|
||||
@ -101,17 +101,17 @@ function save() {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: #fff;
|
||||
padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
|
||||
padding: 24rpx 28rpx calc(24rpx + env(safe-area-inset-bottom));
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
|
||||
gap: 24rpx;
|
||||
box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
border-radius: 6px;
|
||||
font-size: 15px;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
border-radius: 12rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.btn::after {
|
||||
border: none;
|
||||
@ -119,7 +119,7 @@ function save() {
|
||||
.btn.plain {
|
||||
background: #fff;
|
||||
color: #4f6ef7;
|
||||
border: 1px solid #4f6ef7;
|
||||
border: 2rpx solid #4f6ef7;
|
||||
}
|
||||
.btn.primary {
|
||||
background: #4f6ef7;
|
||||
|
||||
@ -125,6 +125,10 @@ export default [
|
||||
path: 'pages/library/diagnosis-list',
|
||||
meta: { title: '诊断', login: false },
|
||||
},
|
||||
{
|
||||
path: 'pages/library/tag-list/tag-list',
|
||||
meta: { title: '标签', login: false },
|
||||
},
|
||||
{
|
||||
path: 'pages/others/edit-positive-find',
|
||||
meta: { title: '阳性发现', login: false },
|
||||
|
||||
1
static/zhuanhua.svg
Normal file
1
static/zhuanhua.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="174.60px" viewBox="0 0 1173 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M1166.247916 358.382794a40.871232 40.871232 0 0 1-50.713886 13.785174H40.952129a40.9258 40.9258 0 0 1 0-81.8516h958.345809l-302.775887-215.747174a40.9258 40.9258 0 1 1 46.614486-67.282014l399.026546 284.366098A40.843948 40.843948 0 0 1 1173.232586 331.242168v0.361511a40.612035 40.612035 0 0 1-6.98467 26.779115zM40.952129 645.006632h1091.354658a40.9258 40.9258 0 0 1 0 81.851599H168.306396l312.332061 222.568141a40.9258 40.9258 0 0 1-46.614485 67.282015L21.246356 722.561023a39.561606 39.561606 0 0 1-3.124003-2.666998A40.9258 40.9258 0 0 1 40.952129 645.006632z" /></svg>
|
||||
|
After Width: | Height: | Size: 840 B |
@ -3,6 +3,9 @@ import request from "./http";
|
||||
const urlsConfig = {
|
||||
corp: {
|
||||
getCorpMemberHomepageInfo: 'getCorpMemberHomepageInfo',
|
||||
// 企业信息/标签
|
||||
getCorpInfo: 'getCorpInfo',
|
||||
getCorpTags: 'getCorpTags',
|
||||
getTeamBaseInfo: 'getTeamBaseInfo',
|
||||
getTeamData: 'getTeamData',
|
||||
getTeamBymember: 'getTeamBymember',
|
||||
@ -70,6 +73,7 @@ const urlsConfig = {
|
||||
getUnbindMiniAppCustomers: 'getUnbindMiniAppCustomers',
|
||||
searchCorpCustomer: 'searchCorpCustomer',
|
||||
searchCorpCustomerWithFollowTime: 'searchCorpCustomerWithFollowTime',
|
||||
searchCorpCustomerForCaseList: 'searchCorpCustomerForCaseList', // 档案列表专用接口
|
||||
unbindMiniAppArchive: 'unbindMiniAppArchive',
|
||||
// 健康档案相关接口
|
||||
addMedicalRecord: 'addMedicalRecord',
|
||||
@ -77,6 +81,8 @@ const urlsConfig = {
|
||||
updateMedicalRecord: 'updateMedicalRecord',
|
||||
removeMedicalRecord: 'removeMedicalRecord',
|
||||
getCustomerMedicalRecord: 'getCustomerMedicalRecord',
|
||||
// 客户阶段
|
||||
getCustomerType: 'getCustomerType',
|
||||
},
|
||||
wecom: {
|
||||
addContactWay: 'addContactWay'
|
||||
@ -112,6 +118,8 @@ const urlsConfig = {
|
||||
addServiceRecord: 'addServiceRecord',
|
||||
updateServiceRecord: 'updateServiceRecord',
|
||||
removeServiceRecord: 'removeServiceRecord',
|
||||
// 客户流转记录
|
||||
customerTransferRecord: 'customerTransferRecord',
|
||||
// sendConsultRejectedMessage: "sendConsultRejectedMessage"
|
||||
}
|
||||
|
||||
|
||||
@ -48,35 +48,31 @@ export async function mergeConversationWithGroupDetails(conversationList, option
|
||||
console.error('获取群组详细信息失败:', response?.message || '未知错误')
|
||||
return []
|
||||
}
|
||||
|
||||
const groupDetailsMap = createGroupDetailsMap(response.data?.list || [])
|
||||
console.log('获取到的群组详细信息数量:', Object.keys(groupDetailsMap).size)
|
||||
|
||||
// 5. 合并数据并过滤
|
||||
const mergedList = conversationList
|
||||
.map(conversation => mergeConversationData(conversation, groupDetailsMap))
|
||||
.filter(item => item !== null) // 过滤掉后端不存在的会话
|
||||
|
||||
.filter(item => item !== null);
|
||||
console.log('合并后的会话列表数量:', mergedList.length)
|
||||
console.log('过滤掉的会话数量:', conversationList.length - mergedList.length)
|
||||
|
||||
// 6. 格式化并排序会话列表
|
||||
const formattedList = mergedList
|
||||
.map((group) => ({
|
||||
conversationID: group.conversationID || `GROUP${group.groupID}`,
|
||||
groupID: group.groupID,
|
||||
name: group.patientName
|
||||
? `${group.patientName}的问诊`
|
||||
: group.name || "问诊群聊",
|
||||
avatar: group.avatar || "/static/default-avatar.png",
|
||||
lastMessage: group.lastMessage || "暂无消息",
|
||||
lastMessageTime: group.lastMessageTime || Date.now(),
|
||||
groupID: group.groupID,
|
||||
unreadCount: group.unreadCount || 0,
|
||||
doctorId: group.doctorId,
|
||||
patientName: group.patientName,
|
||||
patientSex: group.patientSex,
|
||||
patientAge: group.patientAge,
|
||||
orderStatus: group.orderStatus,
|
||||
teamId: group.teamId,
|
||||
teamName: group.teamName,
|
||||
teamMemberList: group.teamMemberList,
|
||||
}))
|
||||
.sort((a, b) => b.lastMessageTime - a.lastMessageTime)
|
||||
|
||||
@ -127,9 +123,6 @@ function mergeConversationData(conversation, groupDetailsMap) {
|
||||
return {
|
||||
// 保留原有的会话信息
|
||||
...conversation,
|
||||
|
||||
// 合并后端的群组信息
|
||||
_id: groupDetail._id,
|
||||
corpId: groupDetail.corpId,
|
||||
teamId: groupDetail.teamId,
|
||||
customerId: groupDetail.customerId,
|
||||
@ -148,7 +141,7 @@ function mergeConversationData(conversation, groupDetailsMap) {
|
||||
teamName: groupDetail.team?.name,
|
||||
teamMemberList: groupDetail.team?.memberList,
|
||||
teamDescription: groupDetail.team?.description,
|
||||
|
||||
teamId: groupDetail.teamId,
|
||||
// 时间信息
|
||||
createdAt: groupDetail.createdAt,
|
||||
updatedAt: groupDetail.updatedAt,
|
||||
@ -156,8 +149,8 @@ function mergeConversationData(conversation, groupDetailsMap) {
|
||||
// 更新显示名称(使用后端的患者信息)
|
||||
name: formatConversationName(groupDetail),
|
||||
|
||||
// 更新头像
|
||||
avatar: groupDetail.patient?.avatar || conversation.avatar || '/static/default-avatar.png'
|
||||
// 更新头像(优先使用已有头像,避免闪动)
|
||||
avatar: conversation.avatar || groupDetail.patient?.avatar || '/static/default-avatar.png'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
66
utils/form-alias.js
Normal file
66
utils/form-alias.js
Normal file
@ -0,0 +1,66 @@
|
||||
export const GLOBAL_FIELD_ALIASES = {
|
||||
// 内部信息 / HIS 相关字段可能后续改名:这里做最小兜底,保证“有值就能显示”
|
||||
hisCardNo: ['hisOutpatientNo', 'hisClinicNo', 'hisCardNumber'],
|
||||
idCard: ['idNo', 'idNumber'],
|
||||
sex: ['gender'],
|
||||
cardType: ['idType'],
|
||||
};
|
||||
|
||||
function isEmpty(v) {
|
||||
if (v === null || v === undefined) return true;
|
||||
if (Array.isArray(v)) return v.length === 0;
|
||||
if (typeof v === 'string') return v.trim() === '';
|
||||
return false;
|
||||
}
|
||||
|
||||
function buildAliasCandidates(items) {
|
||||
const itemList = Array.isArray(items) ? items : [];
|
||||
const map = {};
|
||||
|
||||
// 支持模板项自带别名:aliasTitles / aliases
|
||||
itemList.forEach((it) => {
|
||||
const title = it?.title;
|
||||
if (!title) return;
|
||||
const aliases = Array.isArray(it?.aliasTitles)
|
||||
? it.aliasTitles
|
||||
: Array.isArray(it?.aliases)
|
||||
? it.aliases
|
||||
: [];
|
||||
if (!aliases.length) return;
|
||||
map[String(title)] = aliases.map((i) => String(i)).filter(Boolean);
|
||||
});
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
function uniq(arr) {
|
||||
const out = [];
|
||||
const seen = new Set();
|
||||
arr.forEach((i) => {
|
||||
const v = String(i || '');
|
||||
if (!v || seen.has(v)) return;
|
||||
seen.add(v);
|
||||
out.push(v);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
export function createAliasedForm(form, items) {
|
||||
const local = buildAliasCandidates(items);
|
||||
return new Proxy(form || {}, {
|
||||
get(target, prop) {
|
||||
if (typeof prop !== 'string') return target[prop];
|
||||
|
||||
const direct = target[prop];
|
||||
if (!isEmpty(direct)) return direct;
|
||||
|
||||
const candidates = uniq([...(local[prop] || []), ...(GLOBAL_FIELD_ALIASES[prop] || [])]);
|
||||
for (const k of candidates) {
|
||||
const v = target[k];
|
||||
if (!isEmpty(v)) return v;
|
||||
}
|
||||
return direct;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user