Merge commit '4e0bbbf3e36ad79e0865a365f94c1c06e8f59577' into dev-wdb

This commit is contained in:
wangdongbo 2026-01-30 13:52:59 +08:00
commit 7b222b6143
25 changed files with 1452 additions and 531 deletions

View File

@ -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)) {
// rangelabel
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>

View File

@ -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>

View File

@ -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;

View File

@ -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);

View File

@ -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>

View File

@ -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>

View 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>

View File

@ -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: {

View File

@ -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 })

View File

@ -12,6 +12,7 @@ const FormRule = {
selectAndOther: checkInput,
selectAndImage: checkListItem,
multiSelectAndOther: checkMultiList,
tagPicker: checkMultiList,
files: checkFiles,
runTime: checkInput,
}

View File

@ -169,6 +169,12 @@
"navigationBarTitleText": "诊断"
}
},
{
"path": "pages/library/tag-list/tag-list",
"style": {
"navigationBarTitleText": "标签"
}
},
{
"path": "pages/others/edit-positive-find",
"style": {

View File

@ -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>

View File

@ -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')

View File

@ -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;
}

View File

@ -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')

View File

@ -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') {

View File

@ -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 {

View File

@ -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>

View File

@ -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;

View File

@ -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;

View 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>

View File

@ -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;

View File

@ -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 },

View File

@ -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"
}

66
utils/form-alias.js Normal file
View 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;
},
});
}