Commit b1679e5c authored by LiXuyang's avatar LiXuyang

逻辑模型设计-列表-修改

parent 70e6e992
......@@ -383,42 +383,42 @@ export const DataStandardRoute: AppRouteRecordRaw = {
icon: '',
},
},
{
path: 'publicCode/detailPublicCode',
name: 'detailPublicCode',
component: () => import('@/views/dataStandards/publicCode/detailPublicCode.vue'),
meta: {
title: '公共代码详情',
icon: '',
},
},
{
path: 'publicCode/editDetail',
name: 'editDetail',
component: () => import('@/views/dataStandards/publicCode/editDetail.vue'),
meta: {
title: '公共代码编辑',
icon: '',
},
},
{
path: 'publicCode/publicCodeContrast',
name: 'publicCodeContrast',
component: () => import('@/views/dataStandards/publicCode/publicCodeContrast.vue'),
meta: {
title: '公共代码对比',
icon: '',
},
},
{
path: 'publicCode/relatedRelationships',
name: 'relatedRelationships2',
component: () => import('@/views/dataStandards/publicCode/relatedRelationships.vue'),
meta: {
title: '公共代码关联关系',
icon: '',
},
},
// {
// path: 'publicCode/detailPublicCode',
// name: 'detailPublicCode',
// component: () => import('@/views/dataStandards/publicCode/detailPublicCode.vue'),
// meta: {
// title: '公共代码详情',
// icon: '',
// },
// },
// {
// path: 'publicCode/editDetail',
// name: 'editDetail',
// component: () => import('@/views/dataStandards/publicCode/editDetail.vue'),
// meta: {
// title: '公共代码编辑',
// icon: '',
// },
// },
// {
// path: 'publicCode/publicCodeContrast',
// name: 'publicCodeContrast',
// component: () => import('@/views/dataStandards/publicCode/publicCodeContrast.vue'),
// meta: {
// title: '公共代码对比',
// icon: '',
// },
// },
// {
// path: 'publicCode/relatedRelationships',
// name: 'relatedRelationships2',
// component: () => import('@/views/dataStandards/publicCode/relatedRelationships.vue'),
// meta: {
// title: '公共代码关联关系',
// icon: '',
// },
// },
],
};
......
......@@ -3,10 +3,9 @@
<BasicTree
ref="treeRef"
treeWrapperClassName="h-[calc(100%-35px)] overflow-auto"
:clickRowToExpand="true"
:defaultExpandAll="true"
:treeData="treeData"
:fieldNames="{ key: 'businessId', title: 'modelName' }"
:fieldNames="{ key: 'key', title: 'title' }"
:treeData="TreeData"
@select="handleSelect"
/>
</div>
......@@ -21,57 +20,9 @@
const emit = defineEmits(['select']);
const treeData = ref<TreeItem[]>([]);
const treeRef = ref<Nullable<TreeActionType>>(null);
function getTree() {
const tree = unref(treeRef);
if (!tree) {
throw new Error('tree is null!');
}
return tree;
}
async function fetch() {
const data = TreeData;
treeData.value = handleTree(data, 'businessId', undefined, undefined, undefined);
await nextTick(() => {
getTree().expandAll(true);
});
}
function handleTree(data, id, parentId, children, rootId) {
id = id || 'id';
parentId = parentId || 'parentId';
children = children || 'children';
rootId =
rootId ||
Math.min.apply(
Math,
data.map((item) => {
return item[parentId];
}),
) ||
0;
// 对源数据深度克隆
const cloneData = JSON.parse(JSON.stringify(data));
// 循环所有项
const treeData = cloneData.filter((father) => {
const branchArr = cloneData.filter((child) => {
// 返回每一项的子级数组
return father[id] === child[parentId];
});
branchArr.length > 0 ? (father.children = branchArr) : '';
// 返回第一层
return father[parentId] === rootId;
});
return treeData !== '' ? treeData : data;
}
function handleSelect(keys) {
emit('select', keys[0]);
}
onMounted(() => {
fetch();
});
</script>
......@@ -4,28 +4,70 @@
<BasicTable @register="registerTable" class="w-3/4 xl:w-4/5" :searchInfo="searchInfo">
<template #toolbar>
<a-button type="primary" @click="handleVersion">转换记录</a-button>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <=0" @click="handleTurnPhy">转物理模型</a-button>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <=0" @click="handleWaitUpload">设为待发布</a-button>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <=0">发布</a-button>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <=0" @click="handleImport">导入</a-button>
<a-button
type="primary"
:disabled="getRowSelection().selectedRowKeys <= 0"
@click="handleTurnPhy"
>转物理模型</a-button
>
<a-button
type="primary"
:disabled="getRowSelection().selectedRowKeys <= 0"
@click="handleWaitUpload"
>设为待发布</a-button
>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <= 0">发布</a-button>
<a-button
type="primary"
:disabled="getRowSelection().selectedRowKeys <= 0"
@click="handleImport"
>导入</a-button
>
<a-button type="primary" @click="handleExport">导出</a-button>
<a-button type="primary" @click="handleCreateFile">新建文件夹</a-button>
<a-button type="primary" @click="handleCreateModel">新建文件</a-button>
<a-button type="primary" :disabled="getRowSelection().selectedRowKeys <=0" @click="handleDelete">删除</a-button>
<!-- <a-button type="primary" @click="handleCreateFile">新建文件夹</a-button>-->
<a-button type="primary" v-if="modelLevel > 1" @click="handleCreateModel"
>新建文件</a-button
>
<a-button
type="primary"
:disabled="getRowSelection().selectedRowKeys <= 0"
@click="handleDelete"
>删除</a-button
>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
:actions="[
:actions="
modelLevel > 1
? [
{
icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record),
icon: 'clarity:contract-line',
onClick: goEdit.bind(null, record),
},
{
// 重命名
icon: 'ant-design:edit-outlined',
onClick: handleRename.bind(null, record),
},
{
icon: 'ion:ellipsis-horizontal-outline',
onClick: handleMove.bind(null, record),
// 删除
icon: 'ant-design:delete-outlined',
popConfirm: {
title: '是否确认删除',
placement: 'left',
confirm: handleRemove.bind(null, record),
},
color: 'error',
},
]"
]
: [
{
icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record),
},
]
"
/>
</template>
</template>
......@@ -37,6 +79,7 @@
<ModelEdit @register="registerModelEdit" @success="handleSuccess" />
<ImportModel @register="importModel" @success="handleSuccess" />
<TurnPhysicalModel @register="turnPhysicalModel" @success="handleSuccess" />
<RenameModel @register="renameModel" @success="handleSuccess" />
</PageWrapper>
</template>
<script lang="ts" setup>
......@@ -52,9 +95,10 @@
import { columns, searchFormSchema } from './model.data';
import { useGo } from '@/hooks/web/usePage';
import { useFilterStore } from '@/store/modules/filterData';
import { TreeData } from '@/views/dataWarehousePlanning/logicalModel/modelData';
import { logicalData, TreeData } from '@/views/dataWarehousePlanning/logicalModel/modelData';
import ImportModel from './importModel.vue';
import TurnPhysicalModel from '@/views/dataWarehousePlanning/logicalModel/modelDetail/turnPhysicalModel.vue';
import RenameModel from './renameModel.vue';
defineOptions({ name: 'AccountManagement' });
const { createMessage, createConfirm } = useMessage();
......@@ -68,11 +112,13 @@
const [registerAddUserModal, { openModal: addUserModal }] = useModal();
const [registerMoveUser, { openModal: openMoveUserModal }] = useModal();
const [turnPhysicalModel, { openModal: openTurnPhysicalModel }] = useModal();
const [renameModel, { openModal: openRenameModel }] = useModal();
const searchInfo = reactive<Recordable>({});
const tableData = ref([]);
let modelLevel = ref(1);
const [
registerTable,
{ reload, updateTableDataRecord, getSearchInfo, getForm, getRowSelection },
{ reload, updateTableDataRecord, setTableData, getSearchInfo, getForm, getRowSelection },
] = useTable({
title: '逻辑模型',
api: async (params) => {
......@@ -89,7 +135,7 @@
//过滤data中的数据,取出等于params.deptId的数据
//按照部门筛选 如果有进行过滤相应部门的 没有就赋值全部
let data = [];
data = tableData.value.filter((item) => item.businessId !== 100);
data = tableData.value.filter((item) => item.type === 'theme');
return { ...response, data: data };
},
rowKey: 'businessId',
......@@ -155,14 +201,9 @@
});
}
/** 移动按钮*/
function handleMove(record: Recordable) {
openMoveUserModal(true, {
record,
isMove: true,
});
function handleRemove(record) {
createMessage.success('删除成功!');
}
/** 编辑按钮*/
function handleEdit(record: Recordable) {
openEditUserModal(true, {
......@@ -213,6 +254,12 @@
query: record,
});
}
function handleRename(record) {
openRenameModel(true, {
record,
isUpdate: true,
});
}
/** 移动*/
function handleMoveSuccess({ isMove, values }) {
const rowSelection = getRowSelection().selectedRowKeys;
......@@ -229,9 +276,21 @@
}
/** 部门树的select*/
function handleSelect(modelId = '') {
searchInfo.modelId = modelId;
reload();
function handleSelect(key) {
if (key !== null && key !== undefined) {
modelLevel.value = key.split('-').length - 1;
} else {
modelLevel.value = 0;
}
if (modelLevel.value > 0) {
const regex = new RegExp(key, 'i');
const data = tableData.value.filter((item) => item.type === 'model' && regex.test(item.themeId));
setTableData(data);
} else {
const regex = new RegExp(key, 'i');
const data = tableData.value.filter((item) => item.type === 'theme' && regex.test(item.themeId));
setTableData(data);
}
}
function handleView(record: Recordable) {
......@@ -248,7 +307,7 @@
}
onMounted(() => {
tableData.value = TreeData;
tableData.value = logicalData;
const path = route.path;
if (filterStore.getSearchParams[path]) {
if (JSON.parse(filterStore.getSearchParams[path] !== {})) {
......
......@@ -108,11 +108,23 @@ export const modelFormSchema: any[] = [
colProps: { lg: 24, md: 24 },
},
];
export const renameFormSchema = [
{
field: 'modelName',
label: '名称',
required: true,
component: 'Input',
colProps: { lg: 24, md: 24 },
},
];
export const editFormSchema: any[] = [
{
field: 'modelName',
label: '文件夹名称',
component: 'Input',
componentProps: {
disabled: true,
},
colProps: { lg: 24, md: 24 },
rules: [
{
......@@ -128,16 +140,24 @@ export const editFormSchema: any[] = [
componentProps: {
options: [
{
label: '知识库模型1',
value: '101',
label: '概念元模型',
value: '概念元模型',
},
{
label: '默认元模型',
value: '默认元模型',
},
{
label: 'rac元模型',
value: 'rac元模型',
},
{
label: '知识库模型2',
value: '102',
label: 'cor元模型',
value: 'cor元模型',
},
{
label: '知识库模型3',
value: '103',
label: 'acc元模型',
value: 'acc元模型',
},
],
getPopupContainer: () => document.body,
......
......@@ -7,75 +7,131 @@ import { changeFlagApi } from '@/api/system/user/user';
// 引入开关组件
type CheckedType = boolean | string | number;
export const TreeData: any[] = [
export const TreeData = [
{
delFlag: '0',
flag: '1',
businessId: 100,
modelName: '知识库模型',
parentId: 0,
'code:': '001',
ancestors: '0',
orderNum: 0,
key: '1',
title: '主体域',
level: '0',
children: [
{
key: '1-1',
title: '一级主体域1',
level: '1',
children: [
{ key: '1-1-1', title: '二级主体域1', level: '2' },
{ key: '1-1-2', title: '二级主体域2', level: '2' },
],
},
{
key: '1-2',
title: '一级主体域2',
level: '1',
children: [
{ key: '1-2-1', title: '二级主体域3', level: '2' },
{ key: '1-2-2', title: '二级主体域4', level: '2' },
],
},
{
key: '1-3',
title: '一级主体域3',
level: '1',
children: [
{ key: '1-3-1', title: '二级主体域3', level: '2' },
{ key: '1-3-2', title: '二级主体域4', level: '2' },
],
},
],
},
];
export const logicalData: any[] = [
{
modelName: '逻辑模型1',
EngName: 'modelOne',
describe: '逻辑模型1,数据多',
workArea: '默认工作组',
createDate: '2024-10-24 10:04:04',
updateDate: '2024-10-24 10:04:04',
holder: 'admin',
type: 'model',
themeId: '1-1-1',
},
{
modelName: '逻辑模型2',
EngName: 'modelTwo',
describe: '逻辑模型2,数据少',
workArea: '默认工作组',
createDate: '2024-10-24 10:04:04',
updateDate: '2024-10-24 10:04:04',
// "children" : [ ],
selectType: null,
holder: 'admin',
type: 'model',
themeId: '1-1-1',
},
{
delFlag: '0',
flag: '1',
businessId: 101,
modelName: '知识库模型1',
EngName:'modelOne',
describe:'知识库模型1,数据多',
workArea:'默认工作组',
parentId: 100,
'code:': '002',
ancestors: '0,100',
orderNum: 1,
// "children" : [ ],
selectType: null,
modelName: '逻辑模型3',
EngName: 'modelThree',
describe: '逻辑模型3,数据很多',
workArea: '默认工作组',
createDate: '2024-10-24 10:04:04',
updateDate: '2024-10-24 10:04:04',
holder: 'admin',
type: 'model',
themeId: '1-1-2',
},
{
modelName: '逻辑模型4',
EngName: 'model4',
describe: '逻辑模型4,数据少',
workArea: '默认工作组',
createDate: '2024-10-24 10:04:04',
updateDate: '2024-10-24 10:04:04',
holder: 'admin',
type: 'model',
themeId: '1-1-2',
},
{
delFlag: '0',
flag: '1',
businessId: 102,
modelName: '知识库模型2',
EngName:'modelTwo',
describe:'知识库模型2,数据少',
workArea:'默认工作组',
parentId: 100,
'code:': '002',
ancestors: '0,100',
orderNum: 1,
// "children" : [ ],
selectType: null,
modelName: '逻辑模型5',
EngName: 'model5',
describe: '逻辑模型5,数据很多',
workArea: '默认工作组',
createDate: '2024-10-24 10:04:04',
updateDate: '2024-10-24 10:04:04',
holder: 'admin',
type: 'model',
themeId: '1-2-1',
},
{
modelName: '一级主体域1',
EngName: 'themeOne',
describe: '知识库模型3,数据很多',
workArea: '默认工作组',
createDate: '2024-10-24 10:04:04',
updateDate: '2024-10-24 10:04:04',
holder: 'admin',
type: 'theme',
themeId: '1-1',
},
{
delFlag: '0',
flag: '1',
businessId: 103,
modelName: '知识库模型3',
EngName:'modelThree',
describe:'知识库模型3,数据很多',
workArea:'默认工作组',
parentId: 100,
'code:': '002',
ancestors: '0,100',
orderNum: 1,
// "children" : [ ],
selectType: null,
modelName: '一级主体域2',
EngName: 'themeTwo',
describe: '知识库模型3,数据很多',
workArea: '默认工作组',
createDate: '2024-10-24 10:04:04',
updateDate: '2024-10-24 10:04:04',
holder: 'admin',
type: 'theme',
themeId: '1-2',
},
{
modelName: '一级主体域3',
EngName: 'themeThree',
describe: '知识库模型3,数据很多',
workArea: '默认工作组',
createDate: '2024-10-24 10:04:04',
updateDate: '2024-10-24 10:04:04',
holder: 'admin',
type: 'theme',
themeId: '1-3',
},
];
......
<template>
<BasicModal
width="40%"
v-bind="$attrs"
@register="registerModal"
:title="getTitle"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, unref } from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { renameFormSchema } from './model.data';
import { useMessage } from '@/hooks/web/useMessage';
const emit = defineEmits(['success', 'register']);
const isUpdate = ref(true);
const isMove = ref(false);
const rowId = ref('');
//获取接口数据并放在下拉框里(这里是打开了一个弹框)
//初始化表单
const [registerForm, { setFieldsValue, updateSchema, resetFields, validate }] = useForm({
labelWidth: 100,
baseColProps: { lg: 12, md: 24 },
schemas: renameFormSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
});
//初始化弹框
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields();
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
isMove.value = !!data?.isMove;
if (unref(isUpdate)) {
// 获取行数据的id
rowId.value = data.record.businessId;
// 塞值
setFieldsValue({
...data.record,
});
}
});
const getTitle = '重命名';
/**确定按钮*/
async function handleSubmit() {
await validate();
closeModal();
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment