ow
This commit is contained in:
1 parent
b26bcfcd3b
commit
8285fb4090
9 files changed
+1372
-20
No files matched your search
@@ -24,7 +24,7 @@
|
||||
<a-button type="primary" :disabled="isEdit" :icon="h(ClearOutlined)"
|
||||
@click.prevent="onReset">重置</a-button>
|
||||
<a-button type="primary" :disabled="isEdit" :icon="h(FileAddOutlined)"
|
||||
@click.prevent="onCreate">新增</a-button>
|
||||
@click.prevent="onCreate">新增</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -91,6 +91,11 @@
|
||||
<a-input-search required :disabled="!isEdit" style="width: 50%;"
|
||||
v-model:value="data.FamilyTree.AncestorPersonId"
|
||||
@search="onModalPerson" />
|
||||
<a-input-search style="flex: 1; min-width: 0;"
|
||||
v-model:value="data.CurrentPerson.FamilyPerson.PersonId"
|
||||
@search="onModalCurrentPerson" />
|
||||
<a-button type="primary" :disabled="!hasData" :icon="h(ApartmentOutlined)"
|
||||
@click.prevent="">祖谱系图</a-button>
|
||||
</a-input-group>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -114,7 +119,7 @@
|
||||
<a-divider orientation="left" orientation-margin="0px" dashed style="background-color: silver">
|
||||
</a-divider>
|
||||
<a-row :gutter="[16, 8]">
|
||||
<a-col :lg="12" :sm="24">
|
||||
<a-col :lg="18" :sm="24">
|
||||
<a-row :wrap="false">
|
||||
<a-col flex="auto">
|
||||
<a-input-group compact style="display: flex; width: 100%;">
|
||||
@@ -134,6 +139,8 @@
|
||||
<a-input-search style="flex: 1; min-width: 0;"
|
||||
v-model:value="data.CurrentPerson.FamilyPerson.PersonId"
|
||||
@search="onModalCurrentPerson" />
|
||||
<a-button type="primary" :disabled="!hasData" :icon="h(ApartmentOutlined)"
|
||||
@click.prevent="onShowChart">谱系图</a-button>
|
||||
</a-input-group>
|
||||
</a-col>
|
||||
</a-row>
|
||||
@@ -281,8 +288,6 @@
|
||||
</a-row>
|
||||
<a-row v-else :gutter="[16, 8]">
|
||||
<a-space>
|
||||
<a-button type="primary" :icon="h(FileSearchOutlined)"
|
||||
:disabled="!hasData" >谱系</a-button>
|
||||
<a-button type="primary" v-if="canAmend" :icon="h(EditOutlined)"
|
||||
:disabled="!hasData" @click.prevent="onAmend">修改</a-button>
|
||||
<a-popconfirm :disabled="!hasData" title="确定是否删除这条记录?" ok-text="是"
|
||||
@@ -307,6 +312,8 @@
|
||||
<FamilyPersonEnquiry ref="personEnquiry"
|
||||
@on-row-dblclick="handleSelectPerson"></FamilyPersonEnquiry>
|
||||
</dragModal>
|
||||
<FamilyTreeChartModal v-model:open="chartVisible" :data="data" :loaded-nodes="loadedNodes" title="谱系图"
|
||||
@select-child="onChartSelectChild" />
|
||||
</a-spin>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
@@ -315,11 +322,12 @@ import { notification } from "ant-design-vue";
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import dayjs from "dayjs";
|
||||
import type { Dayjs } from "dayjs";
|
||||
import { DeleteOutlined, EditOutlined, ClearOutlined, FileSearchOutlined, FileAddOutlined, UndoOutlined, SaveOutlined, PlusSquareTwoTone, DownSquareTwoTone, UpSquareTwoTone } from "@ant-design/icons-vue";
|
||||
import { DeleteOutlined, EditOutlined, ClearOutlined, FileSearchOutlined, FileAddOutlined, UndoOutlined, SaveOutlined, PlusSquareTwoTone, DownSquareTwoTone, UpSquareTwoTone, ApartmentOutlined } from "@ant-design/icons-vue";
|
||||
import { PermissionContext, usePermissionContext } from "@/hooks/PermissionContext"
|
||||
import dragModal from "@/components/basic/DragModal.vue"
|
||||
import FamilyTreeEnquiry from "./FamilyTreeEnquiry.vue";
|
||||
import FamilyPersonEnquiry from "./FamilyPersonEnquiry.vue";
|
||||
import FamilyTreeChartModal from "@/components/master/FamilyTreeChartModal.vue";
|
||||
import { FamilyTreeData } from "@/data/auto/familyTreeData";
|
||||
import { FamilyTreeSpouseMapViewEntity } from "@/data/auto/familyTreeSpouseMapViewEntity";
|
||||
import { FamilyTreeChildrenMapViewEntity } from "@/data/auto/familyTreeChildrenMapViewEntity";
|
||||
@@ -350,6 +358,7 @@ const canDelete = ref<boolean>(false);
|
||||
const canCreate = ref<boolean>(false);
|
||||
|
||||
const showModalType = ref<number>(0);
|
||||
const chartVisible = ref<boolean>(false);
|
||||
|
||||
const data = ref<FamilyTreeData>(new FamilyTreeData());
|
||||
const hasData = ref<boolean>(false);
|
||||
@@ -588,6 +597,48 @@ const onModalSearch = (() => {
|
||||
showModalType.value = 0;
|
||||
})
|
||||
|
||||
const onShowChart = (() => {
|
||||
if (!hasData.value) return;
|
||||
chartVisible.value = true;
|
||||
})
|
||||
|
||||
/** 谱系图中已加载的族员节点(personId -> { person, spouses, children }),不清空原 data,只追加 */
|
||||
const loadedNodes = ref<Record<string, any>>({});
|
||||
|
||||
const onChartSelectChild = (async (personId: string) => {
|
||||
if (!personId || !treeId.value) return;
|
||||
if (loadedNodes.value[personId]) return;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
const childData = await familyTreeService.FindByCurrentPerson({
|
||||
key: treeId.value.trim(),
|
||||
personId,
|
||||
});
|
||||
|
||||
if (childData?.CurrentPerson?.FamilyPerson) {
|
||||
loadedNodes.value = {
|
||||
...loadedNodes.value,
|
||||
[personId]: {
|
||||
person: childData.CurrentPerson.FamilyPerson,
|
||||
spouses: childData.CurrentPerson.FamilyTreeSpouseMaps ?? [],
|
||||
children: childData.CurrentPerson.FamilyTreeChildrenMaps ?? [],
|
||||
},
|
||||
};
|
||||
} else {
|
||||
notification.info({
|
||||
message: '系统提示:',
|
||||
description: '未找到该族员的谱系数据',
|
||||
placement: "topRight",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const onSearch = (async () => {
|
||||
|
||||
@@ -626,6 +677,7 @@ const onReset = (() => {
|
||||
data.value.CurrentPerson.FamilyTreeChildrenMaps = [];
|
||||
treeId.value = '';
|
||||
hasData.value = false;
|
||||
loadedNodes.value = {};
|
||||
selectedSonIndex.value = -1;
|
||||
selectedParentIndex.value = -1;
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user