Compare commits
No commits in common. "aed96bceb201628a5b36b5fdeb76740656e492ec" and "85c56ebf8991d65b3d5df57c55cd7a710f8b2666" have entirely different histories.
aed96bceb2
...
85c56ebf89
@ -9,16 +9,20 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="value.length" class="list">
|
<view v-if="value.length" class="list">
|
||||||
<view v-for="(i, idx) in value" :key="idx" class="item">
|
<uni-swipe-action>
|
||||||
<view class="item-main">
|
<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-title">{{ idx + 1 }}、{{ i.category || '' }}</view>
|
||||||
<view class="item-sub">{{ i.opinion || '' }}</view>
|
<view class="item-sub">{{ i.opinion || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item-actions">
|
<template #right>
|
||||||
<view class="text-action edit" @click.stop="edit(i, idx)">编辑</view>
|
<view class="actions">
|
||||||
<view class="text-action del" @click.stop="remove(idx)">删除</view>
|
<view class="action edit" @click.stop="edit(i, idx)">编辑</view>
|
||||||
</view>
|
<view class="action del" @click.stop="remove(idx)">删除</view>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
</uni-swipe-action-item>
|
||||||
|
</uni-swipe-action>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-else class="empty">暂无内容,点击右侧 + 添加</view>
|
<view v-else class="empty">暂无内容,点击右侧 + 添加</view>
|
||||||
@ -86,14 +90,12 @@ function edit(item, idx) {
|
|||||||
|
|
||||||
function remove(idx) {
|
function remove(idx) {
|
||||||
if (props.disableChange) return;
|
if (props.disableChange) return;
|
||||||
confirm('确定删除吗?')
|
confirm('确定删除吗?', () => {
|
||||||
.then(() => {
|
|
||||||
const list = value.value.map((i) => ({ category: i.category, opinion: i.opinion }));
|
const list = value.value.map((i) => ({ category: i.category, opinion: i.opinion }));
|
||||||
list.splice(idx, 1);
|
list.splice(idx, 1);
|
||||||
emitChange(list);
|
emitChange(list);
|
||||||
toast('已删除');
|
toast('已删除');
|
||||||
})
|
});
|
||||||
.catch(() => {});
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -125,49 +127,37 @@ function remove(idx) {
|
|||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
.item {
|
.item {
|
||||||
display: flex;
|
padding: 20rpx 0;
|
||||||
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 {
|
.item-title {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #111827;
|
color: #111827;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
word-break: break-all;
|
|
||||||
}
|
}
|
||||||
.item-sub {
|
.item-sub {
|
||||||
margin-top: 12rpx;
|
margin-top: 12rpx;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: #6b7280;
|
color: #6b7280;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-break: break-all;
|
|
||||||
}
|
}
|
||||||
.item-actions {
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
.action {
|
||||||
|
width: 140rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20rpx;
|
justify-content: center;
|
||||||
flex-shrink: 0;
|
|
||||||
padding-top: 4rpx;
|
|
||||||
}
|
|
||||||
.text-action {
|
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
line-height: 1;
|
color: #fff;
|
||||||
}
|
}
|
||||||
.text-action.edit {
|
.action.edit {
|
||||||
color: #0877F1;
|
background: #0877F1;
|
||||||
}
|
}
|
||||||
.text-action.del {
|
.action.del {
|
||||||
color: #ff4d4f;
|
background: #ff4d4f;
|
||||||
}
|
}
|
||||||
.empty {
|
.empty {
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
|||||||
@ -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 showDialog = ref(false);
|
||||||
const dialogMode = ref('add'); // 'add' or 'edit'
|
const dialogMode = ref('add'); // 'add' or 'edit'
|
||||||
const inputValue = ref('');
|
const inputValue = ref('');
|
||||||
@ -280,43 +215,20 @@ const handleEdit = (item, index) => {
|
|||||||
const handleDelete = (item, index) => {
|
const handleDelete = (item, index) => {
|
||||||
if (dragEnabledId.value) return;
|
if (dragEnabledId.value) return;
|
||||||
if (item?.parentGroupId) return;
|
if (item?.parentGroupId) return;
|
||||||
(async () => {
|
uni.showModal({
|
||||||
await ensureDoctor();
|
title: '提示',
|
||||||
|
content: '确定要删除该分组吗?',
|
||||||
|
success: async (res) => {
|
||||||
|
if (!res.confirm) return;
|
||||||
const corpId = getCorpId();
|
const corpId = getCorpId();
|
||||||
const teamId = getTeamId();
|
const teamId = getTeamId();
|
||||||
if (!corpId || !teamId) {
|
if (!corpId || !teamId) {
|
||||||
toast('缺少团队信息');
|
toast('缺少团队信息');
|
||||||
return;
|
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('');
|
loading('');
|
||||||
try {
|
try {
|
||||||
if (memberIds.length) {
|
const delRes = await api('removeGroup', { corpId, id: item._id, teamId, groupType: 'team' });
|
||||||
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) {
|
if (!delRes?.success) {
|
||||||
toast(delRes?.message || '删除失败');
|
toast(delRes?.message || '删除失败');
|
||||||
return;
|
return;
|
||||||
@ -329,7 +241,6 @@ const handleDelete = (item, index) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
})();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeDialog = () => {
|
const closeDialog = () => {
|
||||||
|
|||||||
@ -1434,7 +1434,9 @@ const handleCreate = withInfo(async () => {
|
|||||||
}
|
}
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '当前管理档案数已达上限10个,完成认证后可提升档案管理数至100个。',
|
content: limitText
|
||||||
|
? `当前管理档案数已达上限 ${limitText} 个,完成认证可提升档案管理上限。`
|
||||||
|
: '当前管理档案数已达上限,完成认证可提升档案管理上限。',
|
||||||
cancelText: '暂不认证',
|
cancelText: '暂不认证',
|
||||||
confirmText: '去认证',
|
confirmText: '去认证',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
|
|||||||
@ -44,17 +44,7 @@ const eventName = ref('');
|
|||||||
|
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
eventName.value = String(opt?.eventName || '');
|
eventName.value = String(opt?.eventName || '');
|
||||||
if (opt?.title) {
|
if (opt?.title) uni.setNavigationBarTitle({ title: String(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') || {};
|
const data = uni.getStorageSync('current-positive-find') || {};
|
||||||
category.value = typeof data?.category === 'string' ? data.category : '';
|
category.value = typeof data?.category === 'string' ? data.category : '';
|
||||||
opinion.value = typeof data?.opinion === 'string' ? data.opinion : '';
|
opinion.value = typeof data?.opinion === 'string' ? data.opinion : '';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user