Commit 6f444502 authored by liwei's avatar liwei

物理模型完善

parent 5113ef9d
...@@ -97,18 +97,18 @@ ...@@ -97,18 +97,18 @@
const [registerTable, { reload, updateTableDataRecord, getSearchInfo,getForm,getRowSelection }] = useTable({ const [registerTable, { reload, updateTableDataRecord, getSearchInfo,getForm,getRowSelection }] = useTable({
title: '', title: '',
api: async (params) => { api: async (params) => {
//过滤掉tableData.value中,businessId等于100的
var data = [];
data = tableData.value.filter((item) => item.businessId >= 200);
const response = { const response = {
pageNu: "1", pageNu: "1",
pageSize: "10", pageSize: "10",
pages: "1", pages: "1",
total: tableData.value.length, total: data.length,
code:'', code:'',
message:'', message:'',
data: [], data: [],
}; };
//过滤掉tableData.value中,businessId等于100的
var data = [];
data = tableData.value.filter((item) => item.businessId >= 200);
//过滤data中的数据,取出等于params.deptId的数据 //过滤data中的数据,取出等于params.deptId的数据
return { ...response,data: data }; return { ...response,data: data };
}, },
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
<div class="m-4 mr-0 overflow-hidden bg-white"> <div class="m-4 mr-0 overflow-hidden bg-white">
<BasicTree <BasicTree
ref="treeRef" ref="treeRef"
title="物理模型"
search
toolbar
treeWrapperClassName="h-[calc(100%-35px)] overflow-auto" treeWrapperClassName="h-[calc(100%-35px)] overflow-auto"
:clickRowToExpand="true" :clickRowToExpand="true"
:defaultExpandAll="true" :defaultExpandAll="true"
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
</template> </template>
</BasicTable> </BasicTable>
<ModelModal @register="registerModal" @success="handleSuccess" /> <ModelModal @register="registerModal" @success="handleSuccess" />
<MoveModelModal @register="registerMoveModel" @success="handleSuccess" />
</PageWrapper> </PageWrapper>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
...@@ -49,6 +50,7 @@ ...@@ -49,6 +50,7 @@
import { useRoute,onBeforeRouteLeave } from 'vue-router'; import { useRoute,onBeforeRouteLeave } from 'vue-router';
import { useFilterStore } from '@/store/modules/filterData'; import { useFilterStore } from '@/store/modules/filterData';
import {TreeData} from "@/views/metaModel/physicsModel/modelData"; import {TreeData} from "@/views/metaModel/physicsModel/modelData";
import MoveModelModal from "@/views/metaModel/physicsModel/moveModel.vue";
defineOptions({ name: 'AccountManagement' }); defineOptions({ name: 'AccountManagement' });
const { createMessage } = useMessage(); const { createMessage } = useMessage();
...@@ -57,24 +59,24 @@ ...@@ -57,24 +59,24 @@
const go = useGo(); const go = useGo();
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const [registerAddUserModal, { openModal:addUserModal }] = useModal(); const [registerAddUserModal, { openModal:addUserModal }] = useModal();
const [registerMoveUser, { openModal: openMoveUserModal }] = useModal(); const [registerMoveModel, { openModal: openMoveModelModal }] = useModal();
const searchInfo = reactive<Recordable>({}); const searchInfo = reactive<Recordable>({});
const tableData = ref([]) const tableData = ref([])
const [registerTable, { reload, updateTableDataRecord, getSearchInfo,getForm,getRowSelection }] = useTable({ const [registerTable, { reload, updateTableDataRecord, getSearchInfo,getForm,getRowSelection }] = useTable({
title: '', title: '',
api: async (params) => { api: async (params) => {
//按照部门筛选 如果有进行过滤相应部门的 没有就赋值全部
var data = [];
data = tableData.value.filter((item) => item.businessId >= 200);
const response = { const response = {
pageNu: "1", pageNu: "1",
pageSize: "10", pageSize: "10",
pages: "1", pages: "1",
total: tableData.value.length, total: data.length,
code:'', code:'',
message:'', message:'',
data: [], data: [],
}; };
//按照部门筛选 如果有进行过滤相应部门的 没有就赋值全部
var data = [];
data = tableData.value.filter((item) => item.businessId !== 100);
return { ...response, data: data }; return { ...response, data: data };
}, },
rowKey: 'businessId', rowKey: 'businessId',
...@@ -90,6 +92,7 @@ ...@@ -90,6 +92,7 @@
}, },
useSearchForm: true, useSearchForm: true,
showTableSetting: false, showTableSetting: false,
showIndexColumn:false,
bordered: true, bordered: true,
handleSearchInfoFn(info) { handleSearchInfoFn(info) {
return info; return info;
...@@ -118,7 +121,7 @@ ...@@ -118,7 +121,7 @@
/** 移动按钮*/ /** 移动按钮*/
function handleMove(record: Recordable) { function handleMove(record: Recordable) {
openMoveUserModal(true, { openMoveModelModal(true, {
record, record,
isMove: true, isMove: true,
}); });
......
...@@ -144,7 +144,7 @@ export const modelFormSchema: any[] = [ ...@@ -144,7 +144,7 @@ export const modelFormSchema: any[] = [
required: true, required: true,
}, },
{ {
field: 'name', field: 'modelName',
label: '元模型名称', label: '元模型名称',
component: 'Input', component: 'Input',
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
...@@ -156,7 +156,7 @@ export const modelFormSchema: any[] = [ ...@@ -156,7 +156,7 @@ export const modelFormSchema: any[] = [
], ],
}, },
{ {
field: 'username', field: 'type',
label: '数据资产类型', label: '数据资产类型',
component: 'Select', component: 'Select',
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
...@@ -192,13 +192,13 @@ export const modelFormSchema: any[] = [ ...@@ -192,13 +192,13 @@ export const modelFormSchema: any[] = [
/**移动*/ /**移动*/
export const MoveFormSchema: any[] = [ export const MoveFormSchema: any[] = [
{ {
field: 'institutionId', field: 'modelId',
label: '所属机构', label: '所属机构',
component: 'TreeSelect', component: 'TreeSelect',
colProps: { lg: 24, md: 24 }, colProps: { lg: 24, md: 24 },
componentProps: { componentProps: {
fieldNames: { fieldNames: {
label: 'institutionName', label: 'modelName',
value: 'businessId', value: 'businessId',
}, },
getPopupContainer: () => document.body, getPopupContainer: () => document.body,
......
...@@ -21,7 +21,7 @@ export const TreeData: any[] = [ ...@@ -21,7 +21,7 @@ export const TreeData: any[] = [
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
// "children" : [ ], // "children" : [ ],
"selectType" : null "type" : 'MySQL'
}, },
{ {
"delFlag" : "0", "delFlag" : "0",
...@@ -33,10 +33,11 @@ export const TreeData: any[] = [ ...@@ -33,10 +33,11 @@ export const TreeData: any[] = [
"ancestors" : "0,100", "ancestors" : "0,100",
"orderNum" : 1, "orderNum" : 1,
// "children" : [ ], // "children" : [ ],
"selectType" : null, "type" : 'MySQL',
"holder":"admin", "holder":"admin",
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
}, },
{ {
"delFlag" : "0", "delFlag" : "0",
...@@ -48,7 +49,7 @@ export const TreeData: any[] = [ ...@@ -48,7 +49,7 @@ export const TreeData: any[] = [
"ancestors" : "0,100", "ancestors" : "0,100",
"orderNum" : 1, "orderNum" : 1,
// "children" : [ ], // "children" : [ ],
"selectType" : null, "type" : 'MySQL',
"holder":"admin", "holder":"admin",
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
...@@ -63,7 +64,7 @@ export const TreeData: any[] = [ ...@@ -63,7 +64,7 @@ export const TreeData: any[] = [
"ancestors" : "0,100", "ancestors" : "0,100",
"orderNum" : 1, "orderNum" : 1,
// "children" : [ ], // "children" : [ ],
"selectType" : null, "type" : 'DB2',
"holder":"admin", "holder":"admin",
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
...@@ -78,7 +79,7 @@ export const TreeData: any[] = [ ...@@ -78,7 +79,7 @@ export const TreeData: any[] = [
"ancestors" : "0,100,101", "ancestors" : "0,100,101",
"orderNum" : 1, "orderNum" : 1,
// "children" : [ ], // "children" : [ ],
"selectType" : null, "type" : 'MySQL',
"holder":"admin", "holder":"admin",
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
...@@ -93,7 +94,7 @@ export const TreeData: any[] = [ ...@@ -93,7 +94,7 @@ export const TreeData: any[] = [
"ancestors" : "0,100,101", "ancestors" : "0,100,101",
"orderNum" : 1, "orderNum" : 1,
// "children" : [ ], // "children" : [ ],
"selectType" : null, "type" : 'ArgoDB',
"holder":"admin", "holder":"admin",
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
...@@ -108,7 +109,7 @@ export const TreeData: any[] = [ ...@@ -108,7 +109,7 @@ export const TreeData: any[] = [
"ancestors" : "0,100,102", "ancestors" : "0,100,102",
"orderNum" : 1, "orderNum" : 1,
// "children" : [ ], // "children" : [ ],
"selectType" : null, "type" : 'MySQL',
"holder":"admin", "holder":"admin",
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
...@@ -123,7 +124,7 @@ export const TreeData: any[] = [ ...@@ -123,7 +124,7 @@ export const TreeData: any[] = [
"ancestors" : "0,100,102", "ancestors" : "0,100,102",
"orderNum" : 1, "orderNum" : 1,
// "children" : [ ], // "children" : [ ],
"selectType" : null, "type" : 'MySQL',
"holder":"admin", "holder":"admin",
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
...@@ -138,7 +139,7 @@ export const TreeData: any[] = [ ...@@ -138,7 +139,7 @@ export const TreeData: any[] = [
"ancestors" : "0,100,103", "ancestors" : "0,100,103",
"orderNum" : 1, "orderNum" : 1,
// "children" : [ ], // "children" : [ ],
"selectType" : null, "type" : 'MySQL',
"holder":"admin", "holder":"admin",
"createDate": "2024-10-24 10:04:04", "createDate": "2024-10-24 10:04:04",
"updateDate": "2024-10-24 10:04:04", "updateDate": "2024-10-24 10:04:04",
......
...@@ -38,18 +38,31 @@ import {router} from "@/router"; ...@@ -38,18 +38,31 @@ import {router} from "@/router";
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate; isUpdate.value = !!data?.isUpdate;
isMove.value = !!data?.isMove; isMove.value = !!data?.isMove;
console.log('data',data)
if (unref(isUpdate)) { if (unref(isUpdate)) {
// 获取行数据的id // 获取行数据的id
rowId.value = data.record.businessId; rowId.value = data.record.businessId;
const formData = {
modelId: data.record.businessId,
modelName: data.record.modelName,
type: data.record.type
}
// 塞值 // 塞值
setFieldsValue({ setFieldsValue({
...data.record, ...formData,
});
}else {
const formData = {
modelId: '100',
}
// 塞值
setFieldsValue({
...formData,
}); });
} }
const treeList = handleTree(TreeData, 'businessId',undefined,undefined,undefined) const treeList = handleTree(TreeData, 'businessId',undefined,undefined,undefined)
console.log('treeList',treeList)
updateSchema([ updateSchema([
{ {
field: 'modelId', field: 'modelId',
...@@ -84,14 +97,13 @@ import {router} from "@/router"; ...@@ -84,14 +97,13 @@ import {router} from "@/router";
/**确定按钮*/ /**确定按钮*/
async function handleSubmit() { async function handleSubmit() {
const values = await validate(); // const values = await validate();
router.push({ // router.push({
path: '/metaModel/physicsModel/EditRowTable', // path: '/metaModel/physicsModel/EditRowTable',
query: { // query: {
// },
}, // });
}); createMessage.success('修改成功');
closeModal() closeModal()
} }
......
<template>
<BasicModal width="40%" v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
<BasicForm @register="registerForm" />
</BasicModal>
</template>
<script lang="ts" setup>
import {ref, computed, unref, reactive} from 'vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import {modelFormSchema, MoveFormSchema} from './model.data';
import { getDeptList } from '@/api/system/dept/dept';
import {addUserApi,UserDetailApi,UserUpdataApi} from '@/api/system/user/user'
import { encryptTwo } from '../../../../src/utils/jsencrypt.js'
import { useMessage } from '@/hooks/web/useMessage';
import {TreeData} from "@/views/metaModel/physicsModel/modelData";
import {router} from "@/router";
defineOptions({ name: 'ModelModal' });
const emit = defineEmits(['success', 'register']);
const { createMessage } = useMessage();
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: MoveFormSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
});
//初始化弹框
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields();
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
isMove.value = !!data?.isMove;
const formData = {
modelId: data.record.businessId
}
// 塞值
setFieldsValue({
...formData,
});
const treeList = handleTree(TreeData, 'businessId',undefined,undefined,undefined)
updateSchema([
{
field: 'modelId',
componentProps: {
treeData: treeList
},
},
]);
});
const getTitle = computed(() => ('移动'));
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
}
/**确定按钮*/
async function handleSubmit() {
// const values = await validate();
// router.push({
// path: '/metaModel/physicsModel/EditRowTable',
// query: {
// },
// });
createMessage.success('修改成功');
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