|
@@ -20,7 +20,7 @@
|
|
|
|
|
|
|
|
<view v-if="isSurveyTarget" class="entity-tabs">
|
|
<view v-if="isSurveyTarget" class="entity-tabs">
|
|
|
<view
|
|
<view
|
|
|
- v-for="tab in surveyTargetTabs"
|
|
|
|
|
|
|
+ v-for="tab in visibleSurveyTargetTabs"
|
|
|
:key="tab.alias"
|
|
:key="tab.alias"
|
|
|
class="entity-tab"
|
|
class="entity-tab"
|
|
|
:class="{ 'entity-tab--active': activeEntityAlias === tab.alias }"
|
|
:class="{ 'entity-tab--active': activeEntityAlias === tab.alias }"
|
|
@@ -131,6 +131,7 @@ import type {
|
|
|
PharmacyItem,
|
|
PharmacyItem,
|
|
|
ScorePackageDrugItem,
|
|
ScorePackageDrugItem,
|
|
|
SurveyTargetItem,
|
|
SurveyTargetItem,
|
|
|
|
|
+ SurveyTargetSelection,
|
|
|
} from '@/services/modules/task/entitySelector/type'
|
|
} from '@/services/modules/task/entitySelector/type'
|
|
|
const entityAliasConfig = {
|
|
const entityAliasConfig = {
|
|
|
pharmacyName: {
|
|
pharmacyName: {
|
|
@@ -157,13 +158,21 @@ const surveyTargetTabs: ReadonlyArray<{ alias: EntityAlias; label: string }> = [
|
|
|
{ alias: 'companyName', label: '选择商业公司' },
|
|
{ alias: 'companyName', label: '选择商业公司' },
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
+const surveyTargetTypeByAlias: Record<EntityAlias, SurveyTargetSelection['targetType']> = {
|
|
|
|
|
+ yymc: 'hospital',
|
|
|
|
|
+ pharmacyName: 'pharmacy',
|
|
|
|
|
+ companyName: 'company',
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
interface PageQuery {
|
|
interface PageQuery {
|
|
|
alias?: string
|
|
alias?: string
|
|
|
packageId?: string
|
|
packageId?: string
|
|
|
|
|
+ targetMode?: string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const pageAlias = ref<PageAlias>('pharmacyName')
|
|
const pageAlias = ref<PageAlias>('pharmacyName')
|
|
|
const packageId = ref('')
|
|
const packageId = ref('')
|
|
|
|
|
+const hospitalOrPharmacyOnly = ref(false)
|
|
|
const activeEntityAlias = ref<EntityAlias>('yymc')
|
|
const activeEntityAlias = ref<EntityAlias>('yymc')
|
|
|
const keyword = ref('')
|
|
const keyword = ref('')
|
|
|
const list = ref<EntityItem[]>([])
|
|
const list = ref<EntityItem[]>([])
|
|
@@ -181,6 +190,11 @@ const addName = ref('')
|
|
|
const addError = ref('')
|
|
const addError = ref('')
|
|
|
|
|
|
|
|
const isSurveyTarget = computed(() => pageAlias.value === 'surveyTarget')
|
|
const isSurveyTarget = computed(() => pageAlias.value === 'surveyTarget')
|
|
|
|
|
+const visibleSurveyTargetTabs = computed(() =>
|
|
|
|
|
+ hospitalOrPharmacyOnly.value
|
|
|
|
|
+ ? surveyTargetTabs.filter((tab) => tab.alias !== 'companyName')
|
|
|
|
|
+ : surveyTargetTabs
|
|
|
|
|
+)
|
|
|
const isSurveyCategory = computed(() => pageAlias.value === 'surveyCategory')
|
|
const isSurveyCategory = computed(() => pageAlias.value === 'surveyCategory')
|
|
|
const canAddEntity = computed(() => !isSurveyTarget.value && !isSurveyCategory.value)
|
|
const canAddEntity = computed(() => !isSurveyTarget.value && !isSurveyCategory.value)
|
|
|
const currentEntityAlias = computed<EntityAlias>(() =>
|
|
const currentEntityAlias = computed<EntityAlias>(() =>
|
|
@@ -316,7 +330,12 @@ const emitSelectedItem = (item: EntityItem | string) => {
|
|
|
eventName = entityAliasConfig[currentEntityAlias.value].eventName
|
|
eventName = entityAliasConfig[currentEntityAlias.value].eventName
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- eventChannel?.emit(eventName, item)
|
|
|
|
|
|
|
+ const selectedItem =
|
|
|
|
|
+ isSurveyTarget.value && typeof item !== 'string'
|
|
|
|
|
+ ? { ...item, targetType: surveyTargetTypeByAlias[currentEntityAlias.value] }
|
|
|
|
|
+ : item
|
|
|
|
|
+
|
|
|
|
|
+ eventChannel?.emit(eventName, selectedItem)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const selectItem = (item: EntityItem) => {
|
|
const selectItem = (item: EntityItem) => {
|
|
@@ -327,7 +346,10 @@ const selectItem = (item: EntityItem) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const switchSurveyTargetTab = (alias: EntityAlias) => {
|
|
const switchSurveyTargetTab = (alias: EntityAlias) => {
|
|
|
- if (alias === activeEntityAlias.value) {
|
|
|
|
|
|
|
+ if (
|
|
|
|
|
+ alias === activeEntityAlias.value ||
|
|
|
|
|
+ !visibleSurveyTargetTabs.value.some((tab) => tab.alias === alias)
|
|
|
|
|
+ ) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -415,6 +437,7 @@ onLoad((query?: PageQuery) => {
|
|
|
: 'pharmacyName'
|
|
: 'pharmacyName'
|
|
|
|
|
|
|
|
packageId.value = String(query?.packageId ?? '').trim()
|
|
packageId.value = String(query?.packageId ?? '').trim()
|
|
|
|
|
+ hospitalOrPharmacyOnly.value = isSurveyTarget.value && query?.targetMode === 'hospitalOrPharmacy'
|
|
|
|
|
|
|
|
if (isSurveyTarget.value) {
|
|
if (isSurveyTarget.value) {
|
|
|
uni.setNavigationBarTitle({
|
|
uni.setNavigationBarTitle({
|
|
@@ -450,7 +473,6 @@ onPullDownRefresh(async () => {
|
|
|
uni.stopPullDownRefresh()
|
|
uni.stopPullDownRefresh()
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|