Commit c6d6df48 authored by LiXuyang's avatar LiXuyang

逻辑模型设计-编辑-修改

parent 43057012
......@@ -72,7 +72,8 @@
</template>
</template>
<template #sourceType="{ text, record }">
<a @click="goEdit(record)"> {{ text }}</a>
<a v-if="modelLevel > 1" @click="goEdit(record)"> {{ text }}</a>
<span v-else>{{ text }}</span>
</template>
</BasicTable>
<ModelModal @register="registerModal" @success="handleSuccess" />
......@@ -282,7 +283,7 @@
} else {
modelLevel.value = 0;
}
if (modelLevel.value > 0) {
if (modelLevel.value > 1) {
const regex = new RegExp(key, 'i');
const data = tableData.value.filter((item) => item.type === 'model' && regex.test(item.themeId));
setTableData(data);
......
......@@ -6,11 +6,47 @@
:title="getTitle"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" />
<BasicForm @register="registerForm">
<template #fatherName="{ model, field }">
<Select
style="width: 100%"
placeholder="请选择父实体名称"
v-model:value="model[field]"
:options="optionFatherName"
@select="model['fatherPK'] = null"
/>
</template>
<template #fatherPK="{ model, field }">
<Select
style="width: 100%"
placeholder="请选择父实体属性PK"
v-model:value="model[field]"
:options="getOptions(model['fatherName'])"
/>
</template>
<template #sonName="{ model, field }">
<Select
style="width: 100%"
placeholder="请选择父实体名称"
v-model:value="model[field]"
:options="optionFatherName"
@select="model['sonPK'] = null"
/>
</template>
<template #sonPK="{ model, field }">
<Select
style="width: 100%"
placeholder="请选择父实体属性PK"
v-model:value="model[field]"
:options="getSonOptions(model['sonName'])"
/>
</template>
</BasicForm>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue';
import { ref, computed, unref, reactive } from 'vue';
import { Select } from 'ant-design-vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { ConnectionModelFormSchema } from './model.data';
......@@ -46,7 +82,46 @@
});
}
});
const optionFatherName = reactive([
{
label: 'dw_合约',
value: 'dw_合约',
},
{
label: 'dw_产品合约行情历史',
value: 'dw_产品合约行情历史',
},
]);
const options = reactive([
{
label: '合约号',
value: '合约号',
entity: 'dw_合约',
},
{
label: '产品合约行情历史号',
value: '产品合约行情历史号',
entity: 'dw_产品合约行情历史',
},
]);
const sonOptions = reactive([
{
label: '合约号',
value: '合约号',
entity: 'dw_合约',
},
{
label: '产品合约行情历史号',
value: '产品合约行情历史号',
entity: 'dw_产品合约行情历史',
},
]);
function getOptions(entity) {
return options.filter((item) => item.entity === entity);
}
function getSonOptions(entity) {
return sonOptions.filter((item) => item.entity === entity);
}
const getTitle = computed(() => (isUpdate.value ? '编辑关联' : '新建关联'));
/**确定按钮*/
......
......@@ -6,11 +6,47 @@
:title="getTitle"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" />
<BasicForm @register="registerForm">
<template #fatherName="{ model, field }">
<Select
style="width: 100%"
placeholder="请选择父实体名称"
v-model:value="model[field]"
:options="optionFatherName"
@select="model['fatherPK'] = null"
/>
</template>
<template #fatherPK="{ model, field }">
<Select
style="width: 100%"
placeholder="请选择父实体属性PK"
v-model:value="model[field]"
:options="getOptions(model['fatherName'])"
/>
</template>
<template #sonName="{ model, field }">
<Select
style="width: 100%"
placeholder="请选择父实体名称"
v-model:value="model[field]"
:options="optionFatherName"
@select="model['sonPK'] = null"
/>
</template>
<template #sonPK="{ model, field }">
<Select
style="width: 100%"
placeholder="请选择父实体属性PK"
v-model:value="model[field]"
:options="getSonOptions(model['sonName'])"
/>
</template>
</BasicForm>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue';
import { ref, computed, unref, reactive } from 'vue';
import { Select } from 'ant-design-vue';
import { BasicModal, useModalInner } from '@/components/Modal';
import { BasicForm, useForm } from '@/components/Form';
import { ConnectionModelFormSchema } from './model.data';
......@@ -46,7 +82,46 @@
});
}
});
const optionFatherName = reactive([
{
label: 'dw_合约',
value: 'dw_合约',
},
{
label: 'dw_产品合约行情历史',
value: 'dw_产品合约行情历史',
},
]);
const options = reactive([
{
label: '合约号',
value: '合约号',
entity: 'dw_合约',
},
{
label: '产品合约行情历史号',
value: '产品合约行情历史号',
entity: 'dw_产品合约行情历史',
},
]);
const sonOptions = reactive([
{
label: '合约号',
value: '合约号',
entity: 'dw_合约',
},
{
label: '产品合约行情历史号',
value: '产品合约行情历史号',
entity: 'dw_产品合约行情历史',
},
]);
function getOptions(entity) {
return options.filter((item) => item.entity === entity);
}
function getSonOptions(entity) {
return sonOptions.filter((item) => item.entity === entity);
}
const getTitle = computed(() =>
isUpdate.value ? '编辑跨模型实体关联关系' : '新建跨模型实体关联关系',
);
......
import { BasicColumn } from '@/components/Table';
export const entityFormSchema = [
{
field: 'name',
label: '实体名称',
required: true,
slot: 'name',
component: 'Input',
colProps: { span: 12 },
},
{
field: 'txt',
label: '实体描述',
slot: 'txt',
component: 'Input',
colProps: { span: 12 },
},
{
field: 'engName',
label: '实体英文名',
slot: 'engName',
component: 'Input',
colProps: { span: 12 },
},
{
field: 'person',
label: '资产责任人',
slot: 'person',
component: 'Input',
colProps: { span: 12 },
},
{
field: 'deptName',
label: '所属部门',
slot: 'deptName',
component: 'TreeSelect',
componentProps: {
treeData: [
{
label: '机构管理',
value: '机构管理',
children: [
{
label: '机构管理/数据平台治理部',
value: '机构管理/数据平台治理部',
},
{
label: '机构管理/数据仓库规划部',
value: '机构管理/数据仓库规划部',
},
{
label: '机构管理/数据安全部',
value: '机构管理/数据安全部',
},
],
},
],
},
colProps: { span: 12 },
},
];
export const treeData = [
{
label: '机构管理',
value: '机构管理',
children: [
{
label: '机构管理/数据平台治理部',
value: '机构管理/数据平台治理部',
},
{
label: '机构管理/数据仓库规划部',
value: '机构管理/数据仓库规划部',
},
{
label: '机构管理/数据安全部',
value: '机构管理/数据安全部',
},
],
},
];
export const propertyFormSchema: any[] = [
{
field: 'name',
......@@ -22,14 +102,12 @@ export const propertyModelFormSchema: any[] = [
field: 'fieldName',
label: '字段名称',
component: 'Input',
required: true,
colProps: { lg: 24, md: 24 },
},
{
field: 'dataType',
label: '数据类型',
component: 'Input',
required: true,
colProps: { lg: 24, md: 24 },
},
{
......@@ -42,7 +120,6 @@ export const propertyModelFormSchema: any[] = [
{ label: '是', value: '1' },
],
},
required: true,
colProps: { lg: 24, md: 24 },
},
{
......@@ -55,42 +132,80 @@ export const propertyModelFormSchema: any[] = [
{ label: '是', value: '1' },
],
},
required: true,
colProps: { lg: 24, md: 24 },
},
{
field: 'length',
label: '长度',
component: 'Input',
required: true,
colProps: { lg: 24, md: 24 },
},
{
field: 'precision',
label: '精度',
component: 'Input',
required: true,
colProps: { lg: 24, md: 24 },
},
{
field: 'relationBasic',
label: '关联基础标准',
component: 'Select',
required: true,
componentProps: {
options: [
{
label: '1',
value: '1',
},
{
label: 'basic',
value: 'basic',
},
{
label: 'basic-1',
value: 'basic-1',
},
{
label: 'basic-2',
value: 'basic-2',
},
{
label: 'basic-3',
value: 'basic-3',
},
],
},
colProps: { lg: 24, md: 24 },
},
{
field: 'relationCode',
label: '关联公共代码',
component: 'Select',
required: true,
componentProps: {
options: [
{
label: 'common',
value: 'common',
},
{
label: 'public',
value: 'public',
},
{
label: 'layout',
value: 'layout',
},
{
label: 'enums',
value: 'enums',
},
],
},
colProps: { lg: 24, md: 24 },
},
{
field: 'describe',
label: '属性描述',
component: 'Input',
required: true,
colProps: { lg: 24, md: 24 },
},
];
......@@ -161,6 +276,22 @@ export const entityConnectionModelFormSchema: any[] = [
field: 'physicalModel',
label: '选择物理模型',
component: 'Select',
componentProps: {
options: [
{
label: 'dw_prd_contract_f',
value: 'dw_prd_contract_f',
},
{
label: 'dw_prd_oontract_quot_h_s',
value: 'dw_prd_oontract_quot_h_s',
},
{
label: 'tmp_dw_prd_contractf_our',
value: 'tmp_dw_prd_contractf_our',
},
],
},
required: true,
colProps: { lg: 24, md: 24 },
},
......
<template>
<PageWrapper :title="infoData.name" contentBackground headerSticky>
<template #extra>
<a-button type="primary">编辑</a-button>
<a-button v-if="!isEdit" type="primary" @click="handleEdit">编辑</a-button>
<a-button v-if="isEdit" type="primary" @click="handleSubmit">保存</a-button>
<a-button v-if="isEdit" @click="handleCancel">取消</a-button>
</template>
<Descriptions title="基本信息" style="margin: 10px 12px" :column="2">
<Descriptions.Item label="实体名称" style="padding-left: 40px"
>{{ infoData.name }}
</Descriptions.Item>
<Descriptions.Item label="实体描述" style="padding-left: 40px"
>{{ infoData.txt }}
</Descriptions.Item>
<Descriptions.Item label="实体英文名" style="padding-left: 40px"
>{{ infoData.engName }}
</Descriptions.Item>
<Descriptions.Item label="资产责任人" style="padding-left: 40px"
>{{ infoData.person }}
</Descriptions.Item>
<Descriptions.Item label="所属部门" style="padding-left: 40px"
>{{ infoData.deptName }}
</Descriptions.Item>
</Descriptions>
<div class="table-title" style="font-size: 18px; margin: 12px 10px 0">基本信息</div>
<BasicForm @register="registerForm">
<template #name="{ model, field }">
<a-input v-if="isEdit" placeholder="请输入实体名称" v-model:value="model[field]" />
<span v-else>{{ infoData[field] }}</span>
</template>
<template #txt="{ model, field }">
<a-input v-if="isEdit" placeholder="请输入实体描述" v-model:value="model[field]" />
<span v-else>{{ infoData[field] }}</span>
</template>
<template #engName="{ model, field }">
<a-input v-if="isEdit" placeholder="请输入实体英文名" v-model:value="model[field]" />
<span v-else>{{ infoData[field] }}</span>
</template>
<template #person="{ model, field }">
<a-input v-if="isEdit" placeholder="请输入资产责任人" v-model:value="model[field]" />
<span v-else>{{ infoData[field] }}</span>
</template>
<template #deptName="{ model, field }">
<TreeSelect v-if="isEdit" placeholder="请输入资产责任人" :treeData="treeData" v-model:value="model[field]" />
<span v-else>{{ infoData[field] }}</span>
</template>
</BasicForm>
<Property />
<EntityConnection />
</PageWrapper>
......@@ -28,12 +36,45 @@
<script lang="ts" setup>
import { PageWrapper } from '@/components/Page';
import { useRoute } from 'vue-router';
import { Descriptions } from 'ant-design-vue';
import Property from './propertyTabel.vue';
import EntityConnection from './entityConnectionTable.vue';
import BasicForm from '@/components/Form/src/BasicForm.vue';
import { useForm } from '@/components/Form';
import { TreeSelect } from 'ant-design-vue';
import {
entityFormSchema,
treeData,
} from '@/views/dataWarehousePlanning/logicalModel/modelDetail/entityDetail/enetity.data';
import {onMounted, ref} from "vue";
const route = useRoute();
const infoData = route.query;
let infoData = route.query;
const isEdit = ref(false);
function handleEdit() {
setFieldsValue({ ...infoData });
isEdit.value = true;
}
function handleSubmit() {
validate();
infoData = getFieldsValue();
isEdit.value = false;
}
function handleCancel() {
isEdit.value = false;
}
//初始化表单
const [registerForm, { setFieldsValue, getFieldsValue, updateSchema, resetFields, validate }] = useForm({
labelWidth: 100,
baseColProps: { lg: 12, md: 24 },
schemas: entityFormSchema,
showActionButtonGroup: false,
actionColOptions: {
span: 23,
},
});
onMounted(() => {
setFieldsValue(infoData);
});
</script>
<style lang="scss" scoped></style>
......@@ -359,14 +359,42 @@ export const ConnectionModelFormSchema: any[] = [
{
field: 'fatherName',
label: '父实体名称',
slot: 'fatherName',
component: 'Select',
componentProps: {
options: [
{
label: 'dw_合约',
value: 'dw_合约',
},
{
label: 'dw_产品合约行情历史',
value: 'dw_产品合约行情历史',
},
],
},
required: true,
colProps: { lg: 24, md: 24 },
},
{
field: 'fatherPK',
label: '父实体属性PK',
slot: 'fatherPK',
component: 'Select',
componentProps: {
options: [
{
label: '合约号',
value: '合约号',
entity: 'dw_合约',
},
{
label: '产品合约行情历史号',
value: '产品合约行情历史号',
entity: 'dw_产品合约行情历史',
},
],
},
required: true,
colProps: { lg: 24, md: 24 },
},
......@@ -374,12 +402,29 @@ export const ConnectionModelFormSchema: any[] = [
field: 'fatherNum',
label: '父端基数',
component: 'Select',
componentProps: {
options: [
{
label: '1',
value: '1',
},
{
label: '2',
value: '2',
},
{
label: '3',
value: '3',
},
],
},
required: true,
colProps: { lg: 24, md: 24 },
},
{
field: 'sonName',
label: '子实体名称',
slot: 'sonName',
component: 'Select',
required: true,
colProps: { lg: 24, md: 24 },
......@@ -387,6 +432,7 @@ export const ConnectionModelFormSchema: any[] = [
{
field: 'sonPK',
label: '子实体属性PK',
slot: 'sonPK',
component: 'Select',
required: true,
colProps: { lg: 24, md: 24 },
......@@ -395,6 +441,22 @@ export const ConnectionModelFormSchema: any[] = [
field: 'sonNum',
label: '子端基数',
component: 'Select',
componentProps: {
options: [
{
label: '1',
value: '1',
},
{
label: '2',
value: '2',
},
{
label: '3',
value: '3',
},
],
},
required: true,
colProps: { lg: 24, md: 24 },
},
......
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