|
@@ -7,14 +7,23 @@
|
|
|
}
|
|
|
</route>
|
|
|
<script setup lang="ts">
|
|
|
-import SectionHeading from '@designer-hub/app/src/components/section-heading.vue'
|
|
|
-import { getDesignerBasicInfo, getDesignerExtraEvents } from '../../../core/libs/agent-requests'
|
|
|
+import {
|
|
|
+ getDesignerBasicInfo,
|
|
|
+ getDesignerExtraEvents,
|
|
|
+ getDesignerFamilyInfo,
|
|
|
+ saveDesignerFamilyInfo,
|
|
|
+} from '../../../core/libs/agent-requests'
|
|
|
import { messages } from '../../../core/libs/messages'
|
|
|
import { omit } from 'radash'
|
|
|
import BottomAppBar from '@/components/bottom-app-bar.vue'
|
|
|
import { renders } from '../../../core/libs/renders'
|
|
|
import DataRender from '@/components/data-render.vue'
|
|
|
import PageHelperEvo from '@/components/page-helper-evo.vue'
|
|
|
+import { DataFormSchema } from '../../../components/data-form'
|
|
|
+import { DesignerFamilyInfo } from '@designer-hub/app/src/core/libs/models'
|
|
|
+import DataForm from '@/components/data-form.vue'
|
|
|
+import { requestToast } from '@designer-hub/app/src/core/utils/common'
|
|
|
+import { ComponentExposed } from 'vue-component-type-helpers'
|
|
|
|
|
|
const tab = ref('basic')
|
|
|
// 基础信息 家庭信息 奖项信息 销售信息 游学/活动信息
|
|
@@ -28,11 +37,74 @@ const tabs = [
|
|
|
]
|
|
|
const id = ref()
|
|
|
const { data: basicData, run: setBasicData } = useRequest(() => getDesignerBasicInfo(id.value))
|
|
|
+const query = computed(() => ({ userId: id.value }))
|
|
|
const eventsQuery = computed(() => ({ type: '3' }))
|
|
|
+const actionSheetStatus = ref(false)
|
|
|
+const schema = ref<DataFormSchema>()
|
|
|
+const formData = ref({})
|
|
|
+const submitType = ref<'family'>()
|
|
|
+const familyPageRef = ref<ComponentExposed<typeof PageHelperEvo>>()
|
|
|
// const {} = useRequest()
|
|
|
const handleEditBasicInfo = async () => {
|
|
|
await uni.navigateTo({ url: `/pages/designer/archives/basic-info/index?id=${id.value}` })
|
|
|
}
|
|
|
+const handleAddFamilyInfo = async () => {
|
|
|
+ submitType.value = 'family'
|
|
|
+ const familySchema: DataFormSchema<Omit<DesignerFamilyInfo, 'userId' | 'createTime' | 'id'>> = {
|
|
|
+ familyRelation: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerFamilyInfo.familyRelation,
|
|
|
+ },
|
|
|
+ familyName: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerFamilyInfo.familyName,
|
|
|
+ },
|
|
|
+ familySex: {
|
|
|
+ type: 'Radio',
|
|
|
+ label: messages.objects.designerFamilyInfo.familySex,
|
|
|
+ props: {
|
|
|
+ columns: [
|
|
|
+ { label: '男', value: '1' },
|
|
|
+ { label: '女', value: '2' },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ familyBirthday: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerFamilyInfo.familyBirthday,
|
|
|
+ },
|
|
|
+ familyInterset: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerFamilyInfo.familyInterset,
|
|
|
+ },
|
|
|
+ familyOccupation: {
|
|
|
+ type: 'TextField',
|
|
|
+ label: messages.objects.designerFamilyInfo.familyOccupation,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ schema.value = familySchema
|
|
|
+ actionSheetStatus.value = true
|
|
|
+}
|
|
|
+const handleSubmit = async () => {
|
|
|
+ switch (submitType.value) {
|
|
|
+ case 'family': {
|
|
|
+ const { code } = await requestToast(
|
|
|
+ () => saveDesignerFamilyInfo({ ...formData.value, userId: id.value }),
|
|
|
+ {
|
|
|
+ success: true,
|
|
|
+ successTitle: '保存成功',
|
|
|
+ },
|
|
|
+ )
|
|
|
+ if (code === 0) {
|
|
|
+ actionSheetStatus.value = false
|
|
|
+ familyPageRef.value?.reload()
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+}
|
|
|
onLoad(async (query: { id: string }) => {
|
|
|
id.value = query.id
|
|
|
await setBasicData()
|
|
@@ -66,7 +138,13 @@ onLoad(async (query: { id: string }) => {
|
|
|
</template>
|
|
|
</template>
|
|
|
<template v-if="tab === 'family'">
|
|
|
- <template></template>
|
|
|
+ <PageHelperEvo ref="familyPageRef" :request="getDesignerFamilyInfo" :query="query">
|
|
|
+ <template #default="{ source }">
|
|
|
+ <template v-for="(it, index) in source.list" :key="index">
|
|
|
+ <div>{{ it }}</div>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </PageHelperEvo>
|
|
|
</template>
|
|
|
<template v-if="tab === 'events'">
|
|
|
<PageHelperEvo :request="getDesignerExtraEvents" :query="eventsQuery">
|
|
@@ -79,7 +157,18 @@ onLoad(async (query: { id: string }) => {
|
|
|
</template>
|
|
|
</div>
|
|
|
<BottomAppBar fixed placeholder>
|
|
|
- <wd-button block :round="false" @click="handleEditBasicInfo">编辑</wd-button>
|
|
|
+ <wd-button v-if="tab === 'basic'" block :round="false" @click="handleEditBasicInfo">
|
|
|
+ 编辑
|
|
|
+ </wd-button>
|
|
|
+ <wd-button v-if="tab === 'family'" block :round="false" @click="handleAddFamilyInfo">
|
|
|
+ 新增
|
|
|
+ </wd-button>
|
|
|
</BottomAppBar>
|
|
|
+ <wd-action-sheet v-model="actionSheetStatus">
|
|
|
+ <div class="p-4">
|
|
|
+ <DataForm :schema="schema" :direction="'horizontal'" v-model="formData"></DataForm>
|
|
|
+ <wd-button :round="false" block @click="handleSubmit">提交</wd-button>
|
|
|
+ </div>
|
|
|
+ </wd-action-sheet>
|
|
|
</div>
|
|
|
</template>
|