回访计划发送
This commit is contained in:
parent
fa01c77830
commit
b9385ebf02
@ -4,7 +4,10 @@
|
||||
<view class="top">
|
||||
<view class="top-row">
|
||||
<view class="my" @click="toggleMy">
|
||||
<image :src="`/static/checkbox${query.isMy ? '-checked' : ''}.svg`" class="checkbox" />
|
||||
<image
|
||||
:src="`/static/checkbox${query.isMy ? '-checked' : ''}.svg`"
|
||||
class="checkbox"
|
||||
/>
|
||||
<view class="my-text">我的</view>
|
||||
</view>
|
||||
|
||||
@ -25,38 +28,81 @@
|
||||
</view>
|
||||
|
||||
<view class="filter-btn" @click="openFilter">
|
||||
<image class="filter-icon" :src="`/static/icons/icon-filter${filtered ? '-active' : ''}.svg`" />
|
||||
<image
|
||||
class="filter-icon"
|
||||
:src="`/static/icons/icon-filter${filtered ? '-active' : ''}.svg`"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="total">共<text class="total-num">{{ total }}</text>条</view>
|
||||
<view class="total"
|
||||
>共<text class="total-num">{{ total }}</text
|
||||
>条</view
|
||||
>
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<view v-for="i in list" :key="i._id" class="card">
|
||||
<view v-for="i in list" :key="i._id" class="card" @click="toDetail(i)">
|
||||
<view class="head">
|
||||
<view class="date">计划日期: <text class="date-val">{{ i.planDate }}</text></view>
|
||||
<view class="executor truncate">{{ i.executorName }}<text v-if="i.executeTeamName">({{ i.executeTeamName }})</text></view>
|
||||
<view class="date"
|
||||
>计划日期: <text class="date-val">{{ i.planDate }}</text></view
|
||||
>
|
||||
<view class="executor truncate"
|
||||
>{{ i.executorName
|
||||
}}<text v-if="i.executeTeamName"
|
||||
>({{ i.executeTeamName }})</text
|
||||
></view
|
||||
>
|
||||
</view>
|
||||
<view class="body">
|
||||
<view class="title-row">
|
||||
<view class="type">{{ i.eventTypeLabel }}</view>
|
||||
<view class="status" :class="`st-${i.status}`">{{ i.eventStatusLabel }}</view>
|
||||
<view class="status" :class="`st-${i.status}`">{{
|
||||
i.eventStatusLabel
|
||||
}}</view>
|
||||
</view>
|
||||
<view class="content">{{ i.taskContent || '暂无内容' }}</view>
|
||||
<view v-if="i.status === 'treated'" class="result">【处理结果】 {{ i.result || '' }}</view>
|
||||
<view class="content">{{ i.taskContent || "暂无内容" }}</view>
|
||||
<view v-if="i.sendContent || (i.fileList && i.fileList.length > 0)" class="send-content-wrapper">
|
||||
<view class="send-content-section">
|
||||
<view class="send-content-label">【发送内容】</view>
|
||||
<view class="send-content-body">
|
||||
<view v-if="i.sendContent" class="send-text">{{ i.sendContent }}</view>
|
||||
<view v-if="i.fileList && i.fileList.length > 0" class="file-list">
|
||||
<view v-for="(file, idx) in i.fileList" :key="idx" class="file-item" :class="`file-type-${file.type}`">
|
||||
<view v-if="file.type === 'image'" class="file-icon">🖼️</view>
|
||||
<view v-else-if="file.type === 'article'" class="file-icon">📄</view>
|
||||
<view v-else-if="file.type === 'questionnaire'" class="file-icon">📋</view>
|
||||
<view class="file-name">{{ file.file?.name || file.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button
|
||||
v-if="fromChat"
|
||||
class="action-btn send-btn"
|
||||
@click.stop="sendFollowUp(i)"
|
||||
>
|
||||
发送
|
||||
</button>
|
||||
</view>
|
||||
<view v-if="i.status === 'treated'" class="result"
|
||||
>【处理结果】 {{ i.result || "" }}</view
|
||||
>
|
||||
<view class="footer-row">
|
||||
<view class="footer">创建: {{ i.createTimeStr }} {{ i.creatorName }}</view>
|
||||
<button v-if="fromChat" class="action-btn send-btn" @click.stop="sendFollowUp(i)">发送</button>
|
||||
</view>
|
||||
<view class="card-actions">
|
||||
<button class="action-btn detail-btn" @click.stop="toDetail(i)">详情</button>
|
||||
<view class="footer"
|
||||
>创建: {{ i.createTimeStr }} {{ i.creatorName }}</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="list.length === 0" class="empty">暂无数据</view>
|
||||
<uni-load-more v-if="list.length" :status="moreStatus" :contentText="loadMoreText" @clickLoadMore="getMore" />
|
||||
<uni-load-more
|
||||
v-if="list.length"
|
||||
:status="moreStatus"
|
||||
:contentText="loadMoreText"
|
||||
@clickLoadMore="getMore"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view class="fab" :style="{ bottom: `${floatingBottom}px` }" @click="add">
|
||||
@ -105,9 +151,18 @@
|
||||
|
||||
<view class="section">
|
||||
<view class="section-title">所属团队</view>
|
||||
<picker mode="selector" :range="teamOptions" range-key="label" @change="pickTeam">
|
||||
<picker
|
||||
mode="selector"
|
||||
:range="teamOptions"
|
||||
range-key="label"
|
||||
@change="pickTeam"
|
||||
>
|
||||
<view class="select-row">
|
||||
<view class="select-text" :class="{ muted: teamPicked.value === 'ALL' }">{{ teamPicked.label }}</view>
|
||||
<view
|
||||
class="select-text"
|
||||
:class="{ muted: teamPicked.value === 'ALL' }"
|
||||
>{{ teamPicked.label }}</view
|
||||
>
|
||||
<uni-icons type="right" size="16" color="#999" />
|
||||
</view>
|
||||
</picker>
|
||||
@ -117,11 +172,15 @@
|
||||
<view class="section-title">计划日期</view>
|
||||
<view class="range-row">
|
||||
<picker mode="date" @change="pickStart">
|
||||
<view class="range-pill" :class="{ muted: !planRange[0] }">{{ planRange[0] || '开始日期' }}</view>
|
||||
<view class="range-pill" :class="{ muted: !planRange[0] }">{{
|
||||
planRange[0] || "开始日期"
|
||||
}}</view>
|
||||
</picker>
|
||||
<view class="sep">-</view>
|
||||
<picker mode="date" @change="pickEnd">
|
||||
<view class="range-pill" :class="{ muted: !planRange[1] }">{{ planRange[1] || '结束日期' }}</view>
|
||||
<view class="range-pill" :class="{ muted: !planRange[1] }">{{
|
||||
planRange[1] || "结束日期"
|
||||
}}</view>
|
||||
</picker>
|
||||
<view class="clear" @click="clearPlanRange">
|
||||
<uni-icons type="closeempty" size="16" color="#999" />
|
||||
@ -139,18 +198,21 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import dayjs from 'dayjs';
|
||||
import api from '@/utils/api';
|
||||
import useAccountStore from '@/store/account';
|
||||
import { toast } from '@/utils/widget';
|
||||
import { getTodoEventTypeLabel, getTodoEventTypeOptions } from '@/utils/todo-const';
|
||||
import { computed, onMounted, onUnmounted, reactive, ref, watch } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import dayjs from "dayjs";
|
||||
import api from "@/utils/api";
|
||||
import useAccountStore from "@/store/account";
|
||||
import { toast } from "@/utils/widget";
|
||||
import {
|
||||
getTodoEventTypeLabel,
|
||||
getTodoEventTypeOptions,
|
||||
} from "@/utils/todo-const";
|
||||
|
||||
const props = defineProps({
|
||||
data: { type: Object, default: () => ({}) },
|
||||
archiveId: { type: String, default: '' },
|
||||
reachBottomTime: { type: [String, Number], default: '' },
|
||||
archiveId: { type: String, default: "" },
|
||||
reachBottomTime: { type: [String, Number], default: "" },
|
||||
floatingBottom: { type: Number, default: 16 },
|
||||
fromChat: { type: Boolean, default: false },
|
||||
});
|
||||
@ -160,24 +222,27 @@ const { account, doctorInfo } = storeToRefs(accountStore);
|
||||
const { getDoctorInfo } = accountStore;
|
||||
|
||||
const statusTabs = [
|
||||
{ label: '全部', value: 'all' },
|
||||
{ label: '待处理', value: 'processing' },
|
||||
{ label: '未开始', value: 'notStart' },
|
||||
{ label: '已完成', value: 'treated' },
|
||||
{ label: '已取消', value: 'cancelled' },
|
||||
{ label: '已过期', value: 'expired' },
|
||||
{ label: "全部", value: "all" },
|
||||
{ label: "待处理", value: "processing" },
|
||||
{ label: "未开始", value: "notStart" },
|
||||
{ label: "已完成", value: "treated" },
|
||||
{ label: "已取消", value: "cancelled" },
|
||||
{ label: "已过期", value: "expired" },
|
||||
];
|
||||
|
||||
const typeOptions = [{ label: '全部', value: 'all' }, ...getTodoEventTypeOptions()];
|
||||
const typeOptions = [
|
||||
{ label: "全部", value: "all" },
|
||||
...getTodoEventTypeOptions(),
|
||||
];
|
||||
|
||||
const teamOptions = ref([{ label: '全部', value: 'ALL' }]);
|
||||
const teamOptions = ref([{ label: "全部", value: "ALL" }]);
|
||||
|
||||
const query = reactive({
|
||||
isMy: false,
|
||||
status: 'all',
|
||||
status: "all",
|
||||
eventTypes: [],
|
||||
teamId: 'ALL',
|
||||
planRange: ['', ''],
|
||||
teamId: "ALL",
|
||||
planRange: ["", ""],
|
||||
});
|
||||
|
||||
const list = ref([]);
|
||||
@ -191,20 +256,20 @@ const loading = ref(false);
|
||||
const userNameMap = ref({});
|
||||
|
||||
const moreStatus = computed(() => {
|
||||
if (loading.value) return 'loading';
|
||||
return page.value <= pages.value ? 'more' : 'no-more';
|
||||
if (loading.value) return "loading";
|
||||
return page.value <= pages.value ? "more" : "no-more";
|
||||
});
|
||||
const loadMoreText = {
|
||||
contentdown: '点击加载更多',
|
||||
contentrefresh: '加载中...',
|
||||
contentnomore: '没有更多了',
|
||||
contentdown: "点击加载更多",
|
||||
contentrefresh: "加载中...",
|
||||
contentnomore: "没有更多了",
|
||||
};
|
||||
|
||||
const filtered = ref(false);
|
||||
const typeSelectedMap = computed(() => {
|
||||
const s = new Set(query.eventTypes || []);
|
||||
return typeOptions.reduce((acc, cur) => {
|
||||
if (cur.value === 'all') acc[cur.value] = s.size === 0;
|
||||
if (cur.value === "all") acc[cur.value] = s.size === 0;
|
||||
else acc[cur.value] = s.has(cur.value);
|
||||
return acc;
|
||||
}, {});
|
||||
@ -213,14 +278,18 @@ const typeSelectedMap = computed(() => {
|
||||
function getUserId() {
|
||||
const d = doctorInfo.value || {};
|
||||
const a = account.value || {};
|
||||
return String(d.userid || d.userId || d.corpUserId || a.userid || a.userId || '') || '';
|
||||
return (
|
||||
String(
|
||||
d.userid || d.userId || d.corpUserId || a.userid || a.userId || ""
|
||||
) || ""
|
||||
);
|
||||
}
|
||||
|
||||
function getCorpId() {
|
||||
const t = uni.getStorageSync('ykt_case_current_team') || {};
|
||||
const t = uni.getStorageSync("ykt_case_current_team") || {};
|
||||
const a = account.value || {};
|
||||
const d = doctorInfo.value || {};
|
||||
return String(t.corpId || a.corpId || d.corpId || '') || '';
|
||||
return String(t.corpId || a.corpId || d.corpId || "") || "";
|
||||
}
|
||||
|
||||
async function ensureDoctor() {
|
||||
@ -235,33 +304,37 @@ async function ensureDoctor() {
|
||||
|
||||
function statusLabelFromStatus(status) {
|
||||
const map = {
|
||||
processing: '待处理',
|
||||
notStart: '未开始',
|
||||
treated: '已完成',
|
||||
cancelled: '已取消',
|
||||
expired: '已过期',
|
||||
processing: "待处理",
|
||||
notStart: "未开始",
|
||||
treated: "已完成",
|
||||
cancelled: "已取消",
|
||||
expired: "已过期",
|
||||
};
|
||||
return map[status] || '未知';
|
||||
return map[status] || "未知";
|
||||
}
|
||||
|
||||
function getStatus(todo) {
|
||||
const endOfToday = dayjs().endOf('day').valueOf();
|
||||
const startOfToday = dayjs().startOf('day').valueOf();
|
||||
const endOfToday = dayjs().endOf("day").valueOf();
|
||||
const startOfToday = dayjs().startOf("day").valueOf();
|
||||
const plannedExecutionTime = Number(todo?.plannedExecutionTime || 0) || 0;
|
||||
const expireTime = Number(todo?.expireTime || 0) || 0;
|
||||
const eventStatus = String(todo?.eventStatus || '');
|
||||
const eventStatus = String(todo?.eventStatus || "");
|
||||
|
||||
if (eventStatus === 'treated') return 'treated';
|
||||
if (eventStatus === 'closed') return 'cancelled';
|
||||
if (eventStatus === 'expire') return 'expired';
|
||||
if (eventStatus === "treated") return "treated";
|
||||
if (eventStatus === "closed") return "cancelled";
|
||||
if (eventStatus === "expire") return "expired";
|
||||
|
||||
if (eventStatus === 'untreated') {
|
||||
if (expireTime && expireTime < startOfToday) return 'expired';
|
||||
if (plannedExecutionTime >= endOfToday) return 'notStart';
|
||||
if (plannedExecutionTime <= startOfToday && (!expireTime || expireTime >= endOfToday)) return 'processing';
|
||||
return 'processing';
|
||||
if (eventStatus === "untreated") {
|
||||
if (expireTime && expireTime < startOfToday) return "expired";
|
||||
if (plannedExecutionTime >= endOfToday) return "notStart";
|
||||
if (
|
||||
plannedExecutionTime <= startOfToday &&
|
||||
(!expireTime || expireTime >= endOfToday)
|
||||
)
|
||||
return "processing";
|
||||
return "processing";
|
||||
}
|
||||
return 'processing';
|
||||
return "processing";
|
||||
}
|
||||
|
||||
function eventTypeLabel(eventType) {
|
||||
@ -269,10 +342,10 @@ function eventTypeLabel(eventType) {
|
||||
}
|
||||
|
||||
function resolveUserName(userId) {
|
||||
const id = String(userId || '');
|
||||
if (!id) return '';
|
||||
const id = String(userId || "");
|
||||
if (!id) return "";
|
||||
const map = userNameMap.value || {};
|
||||
return String(map[id] || '') || id;
|
||||
return String(map[id] || "") || id;
|
||||
}
|
||||
|
||||
function formatTodo(todo) {
|
||||
@ -284,8 +357,14 @@ function formatTodo(todo) {
|
||||
status,
|
||||
eventStatusLabel: statusLabelFromStatus(status),
|
||||
eventTypeLabel: eventTypeLabel(todo?.eventType),
|
||||
planDate: plannedExecutionTime && dayjs(plannedExecutionTime).isValid() ? dayjs(plannedExecutionTime).format('YYYY-MM-DD') : '',
|
||||
createTimeStr: createTime && dayjs(createTime).isValid() ? dayjs(createTime).format('YYYY-MM-DD HH:mm') : '',
|
||||
planDate:
|
||||
plannedExecutionTime && dayjs(plannedExecutionTime).isValid()
|
||||
? dayjs(plannedExecutionTime).format("YYYY-MM-DD")
|
||||
: "",
|
||||
createTimeStr:
|
||||
createTime && dayjs(createTime).isValid()
|
||||
? dayjs(createTime).format("YYYY-MM-DD HH:mm")
|
||||
: "",
|
||||
executorName: resolveUserName(todo?.executorUserId),
|
||||
creatorName: resolveUserName(todo?.creatorUserId),
|
||||
};
|
||||
@ -310,7 +389,7 @@ async function getMore() {
|
||||
const corpId = getCorpId();
|
||||
const userId = getUserId();
|
||||
if (!corpId) {
|
||||
toast('缺少 corpId,请先完成登录/团队选择');
|
||||
toast("缺少 corpId,请先完成登录/团队选择");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -321,22 +400,23 @@ async function getMore() {
|
||||
pageSize,
|
||||
};
|
||||
|
||||
if (query.status !== 'all') params.statusList = [query.status];
|
||||
if (query.status !== "all") params.statusList = [query.status];
|
||||
if (query.isMy) params.executorUserId = userId;
|
||||
if (Array.isArray(query.eventTypes) && query.eventTypes.length) params.eventType = query.eventTypes;
|
||||
if (query.teamId && query.teamId !== 'ALL') params.teamId = query.teamId;
|
||||
if (Array.isArray(query.eventTypes) && query.eventTypes.length)
|
||||
params.eventType = query.eventTypes;
|
||||
if (query.teamId && query.teamId !== "ALL") params.teamId = query.teamId;
|
||||
if (query.planRange?.[0]) params.startDate = query.planRange[0];
|
||||
if (query.planRange?.[1]) params.endDate = query.planRange[1];
|
||||
|
||||
const res = await api('getCustomerTodos', params);
|
||||
const res = await api("getCustomerTodos", params);
|
||||
if (!res?.success) {
|
||||
toast(res?.message || '获取回访任务失败');
|
||||
toast(res?.message || "获取回访任务失败");
|
||||
return;
|
||||
}
|
||||
const arr = Array.isArray(res.data) ? res.data : [];
|
||||
const next = arr.map(formatTodo);
|
||||
|
||||
total.value = typeof res.total === 'number' ? res.total : 0;
|
||||
total.value = typeof res.total === "number" ? res.total : 0;
|
||||
pages.value = Math.ceil(total.value / pageSize) || 0;
|
||||
list.value = page.value === 1 ? next : [...list.value, ...next];
|
||||
page.value += 1;
|
||||
@ -359,81 +439,154 @@ async function loadTeams() {
|
||||
const corpId = getCorpId();
|
||||
const userId = getUserId();
|
||||
if (!corpId || !userId) return;
|
||||
const res = await api('getTeamBymember', { corpId, corpUserId: userId });
|
||||
const res = await api("getTeamBymember", { corpId, corpUserId: userId });
|
||||
if (!res?.success) return;
|
||||
const list = Array.isArray(res?.data) ? res.data : Array.isArray(res?.data?.data) ? res.data.data : [];
|
||||
const list = Array.isArray(res?.data)
|
||||
? res.data
|
||||
: Array.isArray(res?.data?.data)
|
||||
? res.data.data
|
||||
: [];
|
||||
const normalized = list
|
||||
.map((raw) => {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
const teamId = raw.teamId || raw.id || raw._id || '';
|
||||
const name = raw.name || raw.teamName || raw.team || '';
|
||||
if (!raw || typeof raw !== "object") return null;
|
||||
const teamId = raw.teamId || raw.id || raw._id || "";
|
||||
const name = raw.name || raw.teamName || raw.team || "";
|
||||
if (!teamId || !name) return null;
|
||||
return { label: String(name), value: String(teamId) };
|
||||
})
|
||||
.filter(Boolean);
|
||||
teamOptions.value = [{ label: '全部', value: 'ALL' }, ...normalized];
|
||||
teamOptions.value = [{ label: "全部", value: "ALL" }, ...normalized];
|
||||
}
|
||||
|
||||
function add() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['+新增任务', '+使用模板', '+回访记录'],
|
||||
itemList: ["+新增任务", "+使用模板", "+回访记录"],
|
||||
success: ({ tapIndex }) => {
|
||||
if (tapIndex === 0) {
|
||||
uni.setStorageSync('new-followup-customer', { _id: props.archiveId, name: props.data?.name || '' });
|
||||
uni.navigateTo({ url: `/pages/case/new-followup?archiveId=${encodeURIComponent(props.archiveId)}` });
|
||||
uni.setStorageSync("new-followup-customer", {
|
||||
_id: props.archiveId,
|
||||
name: props.data?.name || "",
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/new-followup?archiveId=${encodeURIComponent(
|
||||
props.archiveId
|
||||
)}`,
|
||||
});
|
||||
} else if (tapIndex === 1) {
|
||||
uni.setStorageSync('new-followup-plan-customer', { _id: props.archiveId, name: props.data?.name || '' });
|
||||
uni.setStorageSync('select-mamagement-plan', '');
|
||||
uni.navigateTo({ url: `/pages/case/plan-list?archiveId=${encodeURIComponent(props.archiveId)}` });
|
||||
uni.setStorageSync("new-followup-plan-customer", {
|
||||
_id: props.archiveId,
|
||||
name: props.data?.name || "",
|
||||
});
|
||||
uni.setStorageSync("select-mamagement-plan", "");
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/plan-list?archiveId=${encodeURIComponent(
|
||||
props.archiveId
|
||||
)}`,
|
||||
});
|
||||
} else if (tapIndex === 2) {
|
||||
uni.setStorageSync('new-followup-record-customer', { _id: props.archiveId, name: props.data?.name || '' });
|
||||
uni.navigateTo({ url: `/pages/case/new-followup-record?archiveId=${encodeURIComponent(props.archiveId)}` });
|
||||
uni.setStorageSync("new-followup-record-customer", {
|
||||
_id: props.archiveId,
|
||||
name: props.data?.name || "",
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/new-followup-record?archiveId=${encodeURIComponent(
|
||||
props.archiveId
|
||||
)}`,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function toDetail(todo) {
|
||||
uni.navigateTo({ url: `/pages/case/followup-detail?archiveId=${encodeURIComponent(props.archiveId)}&mode=edit&id=${encodeURIComponent(todo._id)}` });
|
||||
uni.navigateTo({
|
||||
url: `/pages/case/followup-detail?archiveId=${encodeURIComponent(
|
||||
props.archiveId
|
||||
)}&mode=edit&id=${encodeURIComponent(todo._id)}`,
|
||||
});
|
||||
}
|
||||
|
||||
function sendFollowUp(todo) {
|
||||
const content = `【回访计划】\n类型: ${todo.eventTypeLabel}\n计划日期: ${todo.planDate}\n执行人: ${todo.executorName}\n内容: ${todo.taskContent || '暂无内容'}`;
|
||||
|
||||
// 触发事件,通知父组件发送消息
|
||||
uni.$emit('send-followup-message', {
|
||||
content,
|
||||
followupId: todo._id,
|
||||
followupData: todo
|
||||
});
|
||||
|
||||
// 获取当前页面栈
|
||||
const pages = getCurrentPages();
|
||||
const currentPage = pages[pages.length - 1];
|
||||
|
||||
// 如果当前页面是 followup-task-list,则返回两次(返回到消息页面)
|
||||
if (currentPage && currentPage.route === 'pages/case/followup-task-list') {
|
||||
uni.navigateBack({ delta: 2 });
|
||||
} else {
|
||||
// 否则只返回一次
|
||||
uni.navigateBack();
|
||||
async function sendFollowUp(todo) {
|
||||
if (!todo.sendContent && (!todo.fileList || todo.fileList.length === 0)) {
|
||||
toast("没有发送内容");
|
||||
return;
|
||||
}
|
||||
|
||||
const messages = [];
|
||||
|
||||
// 1. 发送文字内容
|
||||
if (todo.sendContent) {
|
||||
messages.push({
|
||||
type: "text",
|
||||
content: todo.sendContent,
|
||||
});
|
||||
}
|
||||
|
||||
// 2. 处理文件列表(图片、宣教文章、问卷)
|
||||
if (Array.isArray(todo.fileList)) {
|
||||
for (const file of todo.fileList) {
|
||||
if (file.type === "image" && file.URL) {
|
||||
// 发送图片
|
||||
messages.push({
|
||||
type: "image",
|
||||
content: file.URL,
|
||||
name: file.file?.name || file.name || "图片",
|
||||
});
|
||||
} else if (file.type === "article" && file.file?.url) {
|
||||
// 发送宣教文章
|
||||
messages.push({
|
||||
type: "article",
|
||||
content: {
|
||||
title: file.file?.name || file.name || "宣教文章",
|
||||
url: file.file?.url || file.URL,
|
||||
desc: file.file?.subtitle || "",
|
||||
},
|
||||
});
|
||||
} else if (file.type === "questionnaire" && file.file?.surveryId) {
|
||||
// 发送问卷
|
||||
messages.push({
|
||||
type: "questionnaire",
|
||||
content: {
|
||||
title: file.file?.name || file.name || "问卷",
|
||||
surveryId: file.file?.surveryId || file.surveryId,
|
||||
url: file.file?.url || file.URL,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 触发事件,通知父组件发送消息
|
||||
uni.$emit("send-followup-message", {
|
||||
messages,
|
||||
followupId: todo._id,
|
||||
followupData: todo,
|
||||
});
|
||||
|
||||
toast("消息已发送");
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
||||
// ---- filter popup ----
|
||||
const filterPopupRef = ref(null);
|
||||
const state = ref(null);
|
||||
const teamPicked = ref(teamOptions.value[0]);
|
||||
const planRange = ref(['', '']);
|
||||
const planRange = ref(["", ""]);
|
||||
|
||||
function openFilter() {
|
||||
state.value = {
|
||||
query: { ...query, eventTypes: [...(query.eventTypes || [])], planRange: [...(query.planRange || ['', ''])] },
|
||||
query: {
|
||||
...query,
|
||||
eventTypes: [...(query.eventTypes || [])],
|
||||
planRange: [...(query.planRange || ["", ""])],
|
||||
},
|
||||
team: { ...teamPicked.value },
|
||||
range: [...planRange.value],
|
||||
};
|
||||
planRange.value = [...(query.planRange || ['', ''])];
|
||||
teamPicked.value = teamOptions.value.find((i) => i.value === query.teamId) || teamOptions.value[0];
|
||||
planRange.value = [...(query.planRange || ["", ""])];
|
||||
teamPicked.value =
|
||||
teamOptions.value.find((i) => i.value === query.teamId) ||
|
||||
teamOptions.value[0];
|
||||
filterPopupRef.value?.open?.();
|
||||
}
|
||||
function closeFilter(revert) {
|
||||
@ -446,7 +599,7 @@ function closeFilter(revert) {
|
||||
}
|
||||
|
||||
function toggleType(v) {
|
||||
if (v === 'all') {
|
||||
if (v === "all") {
|
||||
query.eventTypes = [];
|
||||
return;
|
||||
}
|
||||
@ -462,42 +615,50 @@ function pickTeam(e) {
|
||||
}
|
||||
|
||||
function pickStart(e) {
|
||||
planRange.value = [e.detail.value || '', planRange.value[1] || ''];
|
||||
planRange.value = [e.detail.value || "", planRange.value[1] || ""];
|
||||
query.planRange = [...planRange.value];
|
||||
}
|
||||
function pickEnd(e) {
|
||||
planRange.value = [planRange.value[0] || '', e.detail.value || ''];
|
||||
planRange.value = [planRange.value[0] || "", e.detail.value || ""];
|
||||
query.planRange = [...planRange.value];
|
||||
}
|
||||
function clearPlanRange() {
|
||||
planRange.value = ['', ''];
|
||||
query.planRange = ['', ''];
|
||||
planRange.value = ["", ""];
|
||||
query.planRange = ["", ""];
|
||||
}
|
||||
|
||||
function resetFilter() {
|
||||
query.eventTypes = [];
|
||||
query.teamId = 'ALL';
|
||||
query.teamId = "ALL";
|
||||
teamPicked.value = teamOptions.value[0];
|
||||
clearPlanRange();
|
||||
}
|
||||
|
||||
function confirmFilter() {
|
||||
filtered.value = Boolean((query.eventTypes && query.eventTypes.length) || query.teamId !== 'ALL' || query.planRange[0] || query.planRange[1]);
|
||||
filtered.value = Boolean(
|
||||
(query.eventTypes && query.eventTypes.length) ||
|
||||
query.teamId !== "ALL" ||
|
||||
query.planRange[0] ||
|
||||
query.planRange[1]
|
||||
);
|
||||
closeFilter(false);
|
||||
resetList();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const userId = getUserId();
|
||||
const name = String(doctorInfo.value?.anotherName || doctorInfo.value?.name || '');
|
||||
if (userId && name) userNameMap.value = { ...(userNameMap.value || {}), [userId]: name };
|
||||
const name = String(
|
||||
doctorInfo.value?.anotherName || doctorInfo.value?.name || ""
|
||||
);
|
||||
if (userId && name)
|
||||
userNameMap.value = { ...(userNameMap.value || {}), [userId]: name };
|
||||
loadTeams();
|
||||
resetList();
|
||||
uni.$on('archive-detail:followup-changed', resetList);
|
||||
uni.$on("archive-detail:followup-changed", resetList);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
uni.$off('archive-detail:followup-changed', resetList);
|
||||
uni.$off("archive-detail:followup-changed", resetList);
|
||||
});
|
||||
|
||||
watch(
|
||||
@ -553,7 +714,7 @@ watch(
|
||||
}
|
||||
.status-tab.active {
|
||||
background: #dbe6ff;
|
||||
color: #0877F1;
|
||||
color: #0877f1;
|
||||
}
|
||||
.filter-btn {
|
||||
flex-shrink: 0;
|
||||
@ -633,7 +794,7 @@ watch(
|
||||
}
|
||||
.st-notStart {
|
||||
background: #dbe6ff;
|
||||
color: #0877F1;
|
||||
color: #0877f1;
|
||||
}
|
||||
.st-treated {
|
||||
background: #dcfce7;
|
||||
@ -650,6 +811,68 @@ watch(
|
||||
color: #666;
|
||||
line-height: 18px;
|
||||
}
|
||||
.send-content-wrapper {
|
||||
margin-top: 10px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
.send-content-section {
|
||||
flex: 1;
|
||||
padding: 10px;
|
||||
background: #f9f9f9;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
.send-content-label {
|
||||
font-size: 13px;
|
||||
color: #666;
|
||||
flex-shrink: 0;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.send-content-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.send-text {
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
line-height: 18px;
|
||||
word-break: break-word;
|
||||
}
|
||||
.file-list {
|
||||
margin-top: 6px;
|
||||
}
|
||||
.file-item {
|
||||
margin-top: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.file-icon {
|
||||
font-size: 14px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.file-name {
|
||||
font-size: 12px;
|
||||
color: #0877f1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
}
|
||||
.file-type-image .file-name {
|
||||
color: #0877f1;
|
||||
}
|
||||
.file-type-article .file-name {
|
||||
color: #16a34a;
|
||||
}
|
||||
.file-type-questionnaire .file-name {
|
||||
color: #f59e0b;
|
||||
}
|
||||
.result {
|
||||
margin-top: 10px;
|
||||
font-size: 13px;
|
||||
@ -707,7 +930,9 @@ watch(
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
background: #0877F1;
|
||||
flex: 0 0 auto;
|
||||
width: 60px;
|
||||
background: #0877f1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@ -724,7 +949,7 @@ watch(
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
border-radius: 26px;
|
||||
background: #0877F1;
|
||||
background: #0877f1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@ -784,8 +1009,8 @@ watch(
|
||||
color: #333;
|
||||
}
|
||||
.chip.active {
|
||||
background: #0877F1;
|
||||
border-color: #0877F1;
|
||||
background: #0877f1;
|
||||
border-color: #0877f1;
|
||||
color: #fff;
|
||||
}
|
||||
.select-row {
|
||||
@ -849,11 +1074,11 @@ watch(
|
||||
}
|
||||
.btn.plain {
|
||||
background: #fff;
|
||||
color: #0877F1;
|
||||
border: 1px solid #0877F1;
|
||||
color: #0877f1;
|
||||
border: 1px solid #0877f1;
|
||||
}
|
||||
.btn.primary {
|
||||
background: #0877F1;
|
||||
background: #0877f1;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
:archiveId="archiveId"
|
||||
:reachBottomTime="reachBottomTime"
|
||||
:floatingBottom="0"
|
||||
:fromChat="true"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user