Commit 6f444502 authored by liwei's avatar liwei

物理模型完善

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