Compare commits

..

No commits in common. "aed96bceb201628a5b36b5fdeb76740656e492ec" and "85c56ebf8991d65b3d5df57c55cd7a710f8b2666" have entirely different histories.

4 changed files with 63 additions and 170 deletions

View File

@ -9,16 +9,20 @@
</view>
<view v-if="value.length" class="list">
<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>
<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>
<view v-else class="empty">暂无内容点击右侧 + 添加</view>
@ -86,14 +90,12 @@ function edit(item, idx) {
function remove(idx) {
if (props.disableChange) return;
confirm('确定删除吗?')
.then(() => {
const list = value.value.map((i) => ({ category: i.category, opinion: i.opinion }));
list.splice(idx, 1);
emitChange(list);
toast('已删除');
})
.catch(() => {});
confirm('确定删除吗?', () => {
const list = value.value.map((i) => ({ category: i.category, opinion: i.opinion }));
list.splice(idx, 1);
emitChange(list);
toast('已删除');
});
}
</script>
@ -125,49 +127,37 @@ function remove(idx) {
margin-top: 20rpx;
}
.item {
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;
padding: 20rpx 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;
}
.item-actions {
.actions {
display: flex;
height: 100%;
align-items: stretch;
}
.action {
width: 140rpx;
display: flex;
align-items: center;
gap: 20rpx;
flex-shrink: 0;
padding-top: 4rpx;
}
.text-action {
justify-content: center;
font-size: 26rpx;
line-height: 1;
color: #fff;
}
.text-action.edit {
color: #0877F1;
.action.edit {
background: #0877F1;
}
.text-action.del {
color: #ff4d4f;
.action.del {
background: #ff4d4f;
}
.empty {
margin-top: 20rpx;

View File

@ -187,71 +187,6 @@ async function loadGroups() {
}
}
function normalizeListPayload(res) {
const payload =
res && typeof res === 'object'
? res.data && typeof res.data === 'object' && !Array.isArray(res.data)
? res.data
: res
: {};
const list = Array.isArray(payload.list) ? payload.list : Array.isArray(payload.data) ? payload.data : [];
const total = Number(payload.total ?? res?.total ?? list.length) || 0;
return { list, total };
}
async function fetchGroupMemberIds(groupId) {
const corpId = getCorpId();
const teamId = getTeamId();
const userId = getUserId();
if (!corpId || !teamId || !userId || !groupId) {
return { success: false, message: '缺少用户/团队信息', ids: [] };
}
const ids = [];
const seen = new Set();
const pageSize = 200;
let page = 1;
let total = 0;
while (true) {
const res = await api('searchCorpCustomerForCaseList', {
corpId,
userId,
teamId,
page,
pageSize,
groupIds: [String(groupId)],
});
if (!res?.success) {
return { success: false, message: res?.message || '获取分组成员失败', ids: [] };
}
const { list, total: nextTotal } = normalizeListPayload(res);
total = nextTotal;
list.forEach((member) => {
const memberId = String(member?._id || member?.id || '');
if (!memberId || seen.has(memberId)) return;
seen.add(memberId);
ids.push(memberId);
});
if (list.length < pageSize || (total > 0 && ids.length >= total)) break;
page += 1;
}
return { success: true, ids };
}
async function removeMembersFromGroup(memberIds, groupId) {
for (const memberId of memberIds) {
const res = await api('addGroupIdForMember', { memberId, fromGroupId: String(groupId) });
if (!res?.success) {
return { success: false, message: res?.message || '分组成员移出失败' };
}
}
return { success: true };
}
const showDialog = ref(false);
const dialogMode = ref('add'); // 'add' or 'edit'
const inputValue = ref('');
@ -280,56 +215,32 @@ const handleEdit = (item, index) => {
const handleDelete = (item, index) => {
if (dragEnabledId.value) return;
if (item?.parentGroupId) return;
(async () => {
await ensureDoctor();
const corpId = getCorpId();
const teamId = getTeamId();
if (!corpId || !teamId) {
toast('缺少团队信息');
return;
}
const groupId = String(item?._id || '');
const memberRes = await fetchGroupMemberIds(groupId);
if (!memberRes.success) {
toast(memberRes.message || '获取分组成员失败');
return;
}
const memberIds = memberRes.ids;
uni.showModal({
title: '提示',
content: memberIds.length
? '分组删除后,所有分组内成员自动出组。确定要删除该分组吗?'
: '确定要删除该分组吗?',
cancelText: '取消',
confirmText: '确定删除',
success: async (res) => {
if (!res.confirm) return;
loading('');
try {
if (memberIds.length) {
const removeRes = await removeMembersFromGroup(memberIds, groupId);
if (!removeRes.success) {
toast(removeRes.message || '删除失败');
return;
}
}
const delRes = await api('removeGroup', { corpId, id: groupId, teamId, groupType: 'team' });
if (!delRes?.success) {
toast(delRes?.message || '删除失败');
return;
}
toast('删除成功');
uni.setStorageSync(GROUPS_RELOAD_KEY, 1);
await loadGroups();
} finally {
hideLoading();
uni.showModal({
title: '提示',
content: '确定要删除该分组吗?',
success: async (res) => {
if (!res.confirm) return;
const corpId = getCorpId();
const teamId = getTeamId();
if (!corpId || !teamId) {
toast('缺少团队信息');
return;
}
loading('');
try {
const delRes = await api('removeGroup', { corpId, id: item._id, teamId, groupType: 'team' });
if (!delRes?.success) {
toast(delRes?.message || '删除失败');
return;
}
},
});
})();
toast('删除成功');
uni.setStorageSync(GROUPS_RELOAD_KEY, 1);
await loadGroups();
} finally {
hideLoading();
}
},
});
};
const closeDialog = () => {

View File

@ -1434,7 +1434,9 @@ const handleCreate = withInfo(async () => {
}
uni.showModal({
title: '提示',
content: '当前管理档案数已达上限10个完成认证后可提升档案管理数至100个。',
content: limitText
? `当前管理档案数已达上限 ${limitText} 个,完成认证可提升档案管理上限。`
: '当前管理档案数已达上限,完成认证可提升档案管理上限。',
cancelText: '暂不认证',
confirmText: '去认证',
success: (res) => {

View File

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