fix:修复体检档案标题显示错误,新增阳性编辑删除按钮

This commit is contained in:
Jafeng 2026-03-06 14:34:27 +08:00
parent 85c56ebf89
commit 9fbee9caf4
2 changed files with 55 additions and 35 deletions

View File

@ -9,20 +9,16 @@
</view>
<view v-if="value.length" class="list">
<uni-swipe-action>
<uni-swipe-action-item v-for="(i, idx) in value" :key="idx">
<view class="item">
<view class="item-title">{{ idx + 1 }}{{ i.category || '' }}</view>
<view class="item-sub">{{ i.opinion || '' }}</view>
</view>
<template #right>
<view class="actions">
<view class="action edit" @click.stop="edit(i, idx)">编辑</view>
<view class="action del" @click.stop="remove(idx)">删除</view>
</view>
</template>
</uni-swipe-action-item>
</uni-swipe-action>
<view v-for="(i, idx) in value" :key="idx" class="item">
<view class="item-main">
<view class="item-title">{{ idx + 1 }}{{ i.category || '' }}</view>
<view class="item-sub">{{ i.opinion || '' }}</view>
</view>
<view class="item-actions">
<view class="text-action edit" @click.stop="edit(i, idx)">编辑</view>
<view class="text-action del" @click.stop="remove(idx)">删除</view>
</view>
</view>
</view>
<view v-else class="empty">暂无内容点击右侧 + 添加</view>
@ -90,12 +86,14 @@ function edit(item, idx) {
function remove(idx) {
if (props.disableChange) return;
confirm('确定删除吗?', () => {
const list = value.value.map((i) => ({ category: i.category, opinion: i.opinion }));
list.splice(idx, 1);
emitChange(list);
toast('已删除');
});
confirm('确定删除吗?')
.then(() => {
const list = value.value.map((i) => ({ category: i.category, opinion: i.opinion }));
list.splice(idx, 1);
emitChange(list);
toast('已删除');
})
.catch(() => {});
}
</script>
@ -127,37 +125,49 @@ function remove(idx) {
margin-top: 20rpx;
}
.item {
padding: 20rpx 0;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24rpx;
padding: 24rpx 0;
border-bottom: 2rpx solid #f3f4f6;
}
.item:last-child {
border-bottom: none;
}
.item-main {
flex: 1;
min-width: 0;
}
.item-title {
font-size: 28rpx;
color: #111827;
font-weight: 600;
word-break: break-all;
}
.item-sub {
margin-top: 12rpx;
font-size: 26rpx;
color: #6b7280;
white-space: pre-wrap;
word-break: break-all;
}
.actions {
display: flex;
height: 100%;
align-items: stretch;
}
.action {
width: 140rpx;
.item-actions {
display: flex;
align-items: center;
justify-content: center;
gap: 20rpx;
flex-shrink: 0;
padding-top: 4rpx;
}
.text-action {
font-size: 26rpx;
color: #fff;
line-height: 1;
}
.action.edit {
background: #0877F1;
.text-action.edit {
color: #0877F1;
}
.action.del {
background: #ff4d4f;
.text-action.del {
color: #ff4d4f;
}
.empty {
margin-top: 20rpx;

View File

@ -44,7 +44,17 @@ const eventName = ref('');
onLoad((opt) => {
eventName.value = String(opt?.eventName || '');
if (opt?.title) uni.setNavigationBarTitle({ title: String(opt.title) });
if (opt?.title) {
let title = String(opt.title);
try {
title = decodeURIComponent(title);
} catch {
title = String(opt.title);
}
uni.setNavigationBarTitle({ title: title || '阳性发现及处理意见' });
} else {
uni.setNavigationBarTitle({ title: '阳性发现及处理意见' });
}
const data = uni.getStorageSync('current-positive-find') || {};
category.value = typeof data?.category === 'string' ? data.category : '';
opinion.value = typeof data?.opinion === 'string' ? data.opinion : '';