fix:隐藏门诊/入院评估表、健康记录模板显示
This commit is contained in:
parent
58401626a6
commit
ebac93569b
@ -99,17 +99,20 @@ const { account, doctorInfo } = storeToRefs(accountStore);
|
|||||||
const { getDoctorInfo } = accountStore;
|
const { getDoctorInfo } = accountStore;
|
||||||
|
|
||||||
const FALLBACK_TEMPLATE_TYPES = ['outpatient', 'inhospital', 'preConsultationRecord', 'physicalExaminationTemplate'];
|
const FALLBACK_TEMPLATE_TYPES = ['outpatient', 'inhospital', 'preConsultationRecord', 'physicalExaminationTemplate'];
|
||||||
|
const HIDDEN_TEMPLATE_TYPES = new Set(['healthTemplate']);
|
||||||
|
const HIDDEN_TEMPLATE_NAMES = new Set(['门诊/入院评估表', '健康记录']);
|
||||||
const templates = ref([]);
|
const templates = ref([]);
|
||||||
const selectableTemplates = computed(() => templates.value.filter((i) => i && i.templateType && typeof i.name === 'string' && i.name.trim()));
|
const visibleTemplates = computed(() => templates.value.filter((i) => i && i.templateType && typeof i.name === 'string' && i.name.trim() && !isHiddenTemplate(i)));
|
||||||
|
const selectableTemplates = computed(() => visibleTemplates.value);
|
||||||
const useActionSheet = computed(() => selectableTemplates.value.length > 0 && selectableTemplates.value.length <= 6);
|
const useActionSheet = computed(() => selectableTemplates.value.length > 0 && selectableTemplates.value.length <= 6);
|
||||||
const fabPickerDisabled = computed(() => selectableTemplates.value.length === 0 || useActionSheet.value);
|
const fabPickerDisabled = computed(() => selectableTemplates.value.length === 0 || useActionSheet.value);
|
||||||
const templateMap = computed(() => templates.value.reduce((m, t) => {
|
const templateMap = computed(() => templates.value.reduce((m, t) => {
|
||||||
if (t?.templateType) m[String(t.templateType)] = t;
|
if (t?.templateType) m[String(t.templateType)] = t;
|
||||||
return m;
|
return m;
|
||||||
}, {}));
|
}, {}));
|
||||||
const availableTypes = computed(() => (templates.value.length ? [...templates.value.map((i) => i.templateType), 'surveyFill'] : FALLBACK_TEMPLATE_TYPES));
|
const availableTypes = computed(() => (templates.value.length ? [...visibleTemplates.value.map((i) => i.templateType), 'surveyFill'] : FALLBACK_TEMPLATE_TYPES));
|
||||||
|
|
||||||
const typeRange = computed(() => [{ name: '全部', value: 'ALL' }, ...templates.value.map((t) => ({ name: t.name, value: t.templateType })), { name: '问卷填写', value: 'surveyFill' }]);
|
const typeRange = computed(() => [{ name: '全部', value: 'ALL' }, ...visibleTemplates.value.map((t) => ({ name: t.name, value: t.templateType })), { name: '问卷填写', value: 'surveyFill' }]);
|
||||||
const currentType = ref({ name: '全部', value: 'ALL' });
|
const currentType = ref({ name: '全部', value: 'ALL' });
|
||||||
|
|
||||||
const records = ref([]);
|
const records = ref([]);
|
||||||
@ -152,6 +155,23 @@ function getCorpId() {
|
|||||||
return String(team.corpId || d.corpId || a.corpId || '') || '';
|
return String(team.corpId || d.corpId || a.corpId || '') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizeTemplateName(name) {
|
||||||
|
return String(name || '').replace(///g, '/').replace(/\s+/g, '').trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
function isHiddenTemplate(template) {
|
||||||
|
const type = String(template?.templateType || '');
|
||||||
|
if (HIDDEN_TEMPLATE_TYPES.has(type)) return true;
|
||||||
|
return HIDDEN_TEMPLATE_NAMES.has(normalizeTemplateName(template?.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
function isHiddenRecord(record) {
|
||||||
|
const rawType = String(record?.medicalType || record?.rawTemplateType || record?.templateType || '');
|
||||||
|
if (isHiddenTemplate({ templateType: rawType, name: record?.tempName || record?.medicalTypeName })) return true;
|
||||||
|
const temp = templateMap.value[rawType];
|
||||||
|
return isHiddenTemplate(temp);
|
||||||
|
}
|
||||||
|
|
||||||
async function ensureDoctor() {
|
async function ensureDoctor() {
|
||||||
if (doctorInfo.value) return;
|
if (doctorInfo.value) return;
|
||||||
if (!account.value?.openid) return;
|
if (!account.value?.openid) return;
|
||||||
@ -240,7 +260,7 @@ async function loadVisitTemplates() {
|
|||||||
if (t && name) m[t] = name;
|
if (t && name) m[t] = name;
|
||||||
return m;
|
return m;
|
||||||
}, {});
|
}, {});
|
||||||
const enabled = list.filter((i) => i && i.templateType !== 'healthTemplate' && i.templateStatus !== 'disable');
|
const enabled = list.filter((i) => i && i.templateStatus !== 'disable' && !isHiddenTemplate(i));
|
||||||
const typeList = enabled.map((i) => String(i.templateType || '')).filter(Boolean);
|
const typeList = enabled.map((i) => String(i.templateType || '')).filter(Boolean);
|
||||||
if (!typeList.length) return;
|
if (!typeList.length) return;
|
||||||
|
|
||||||
@ -466,9 +486,11 @@ async function refreshList() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 未互通时,仅展示本团队数据
|
// 未互通时,仅展示本团队数据
|
||||||
|
const visibleMapped = mapped.filter((i) => !isHiddenRecord(i));
|
||||||
|
|
||||||
records.value = !shareAllTeamsForQuery.value && teamId.value
|
records.value = !shareAllTeamsForQuery.value && teamId.value
|
||||||
? mapped.filter((i) => String(i?.teamId || '') === String(teamId.value))
|
? visibleMapped.filter((i) => String(i?.teamId || '') === String(teamId.value))
|
||||||
: mapped;
|
: visibleMapped;
|
||||||
|
|
||||||
const creatorIds = mapped
|
const creatorIds = mapped
|
||||||
.map(
|
.map(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user