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