8e994be3 by xukangle

updata: 分类分级目录模块开发

1 parent 210b5eb5
......@@ -3,8 +3,8 @@ VITE_APP_TITLE = 数据资产管理系统
# 接口域名
# VITE_API_BASEURL = https://www.zgsjzc.com/api
# VITE_API_BASEURL = https://swzl-test.csbr.cn/api
# VITE_API_BASEURL = http://localhost:9000
VITE_API_BASEURL = http://10.4.82.1:28052/
VITE_API_BASEURL = http://localhost:9000
# VITE_API_BASEURL = http://10.4.82.1:28052/
# 平台用户 接口请地址
VITE_APP_USER_API_BASEURL = gateway-server/user
# 系统管理 接口地址
......@@ -25,8 +25,8 @@ VITE_APP_PLAN_BASEURL = ms-daop-jgjf-data-plan-service
VITE_APP_QUALITY_BASEURL = ms-daop-data-quality-service
#数据盘点接口地址ms-daop-zcgl-data-inventory
# VITE_APP_CHECK_BASEURL = /mock
VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory
VITE_APP_CHECK_BASEURL = /mock
# VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory
#门户接口
VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal
......
......@@ -226,3 +226,45 @@ export const getCgDirFieldPageList = (data) => request({
method: 'post',
data
})
/** 获取字典列表
* VITE_APP_PLAN_BASEURL 为环境变量 现在只是mock数据
*/
export const getDictionary = (params) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/data-dictionary-general/list-all?state=1`,
method: 'post'
})
/** 业务规则配置-新增
* @param {Object}
* @path /biz-rule-config/save
*/
export const saveBizRuleConfig = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/save`,
method: 'post',
data
})
/**树形目录
* @param {Object}
* @path /db-dir/tree-list
*/
export const getDbDirTreeList = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/tree-list`,
method: 'post',
data
})
/**
* 数据库目录-表数据列表查询
* @param {Object}
* @path /db-dir/table/page-list
*/
export const getDbDirTablePageList = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/page-list`,
method: 'post',
data
})
......
......@@ -2,18 +2,296 @@ import type { MockMethod } from 'vite-plugin-mock'
import Mock from 'mockjs'
export const confirmDelivery = {
url: '/mock/youthBoost/admin/shipment',
/**
* {
"children": [
{
"parentGuids": [
"string"
]
}
],
"parentGuids": [
"string"
],
"guid": "string",
"tenantGuid": "string",
"cgDirName": "string",
"classifyName": "string",
"orderNum": 0,
"level": 0,
"levelCode": "string",
"parentGuid": "string"
}
*/
export const getCgDirTreeList = {
url: '/mock/cg-dir/tree-list',
method: 'post',
response: ({body}:{body:any}) => {
return {
code: 200,
code: '00000',
message: '成功',
'data|10-30': [{
guid: '@guid',
tenantGuid: '@guid',
cgDirName: '@cword(3, 10)',
classifyName: '@cword(3, 5)',
orderNum: '@integer(1, 100)',
level: '@integer(1, 3)',
levelCode: '@string("number", 6)',
parentGuid: '@guid',
'parentGuids|1-2': ['@guid'],
'children|0-3': [{
guid: '@guid',
tenantGuid: '@guid',
cgDirName: '@cword(3, 5)',
classifyName: '@cword(3, 5)',
orderNum: '@integer(1, 100)',
level: '@integer(1, 3)',
levelCode: '@string("number", 6)',
parentGuid: '@guid',
'parentGuids|1-2': ['@guid']
}]
}]
}
}
}
/**
* "data": {
"totalRows": 0,
"totalPages": 0,
"pageSize": 0,
"pageIndex": 0,
"records": [
{
"guid": "string",
"tenantGuid": "string",
"cgDirName": "string",
"dirGuid": "string",
"classifyName": "string",
"gradeDetailName": "string",
"label": "string",
"fieldName": "string",
"fieldChName": "string",
"tableName": "string",
"tableChName": "string",
"database": "string",
"databaseChName": "string"
}
],
export const getCgDirFieldPageList = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/field/page-list`,
method: 'post',
data
})
*/
export const getCgDirFieldPageList = {
url: '/mock/cg-dir/field/page-list',
method: 'post',
response: ({body}:{body:any}) => {
return {
code: '00000',
message: '成功',
'data': {
totalRows: '@integer(50, 100)',
totalPages: '@integer(1, 10)',
pageSize: 10,
pageIndex: 1,
'records|20-30': [{
guid: '@guid',
tenantGuid: '@guid',
cgDirName: '@cword(3, 5)',
dirGuid: '@guid',
classifyName: '@cword(3, 5)',
gradeDetailName: '@cword(3, 5)',
label: '@cword(3, 5)',
fieldName: '@cword(3, 5)',
fieldChName: '@cword(3, 5)',
tableName: '@cword(3, 5)',
tableChName: '@cword(3, 5)',
database: '@cword(3, 5)',
databaseChName: '@cword(3, 5)'
}]
}
}
}
}
/**
*
* export const getDictionary = (params) => request({
url: `${import.meta.env.VITE_APP_PLAN_BASEURL}/data-dictionary-general/list-all?state=1`,
method: 'post'
})
*/
export const getDictionary = {
url: '/mock/data-dictionary-general/list-all',
method: 'post',
response: ({body}:{body:any}) => {
return {
code: '00000',
message: '成功',
data: []
'data|10-30': [{
guid: '@guid',
tenantGuid: '@guid',
chName: '@cword(3, 5)',
classifyName: '@cword(3, 5)',
orderNum: '@integer(1, 100)',
level: '@integer(1, 3)',
levelCode: '@string("number", 6)',
parentGuid: '@guid',
'parentGuids|1-2': ['@guid'],
'children|0-3': [{
guid: '@guid',
tenantGuid: '@guid',
chName: '@cword(3, 5)',
classifyName: '@cword(3, 5)',
orderNum: '@integer(1, 100)',
level: '@integer(1, 3)',
levelCode: '@string("number", 6)',
parentGuid: '@guid',
'parentGuids|1-2': ['@guid']
}]
}]
}
}
}
export const saveBizRuleConfig = {
url: '/mock/biz-rule-config/save',
method: 'post',
response: ({body}:{body:any}) => {
return {
code: '00000',
message: '成功'
}
}
}
/**
* "data": [
{
"cgDirName": "string",
"childList": [
{
"databaseGuid": "string",
"database": "string",
"databaseChName": "string",
"childList": [
{
"tableGuid": "string",
"tableName": "string",
"tableChName": "string"
}
]
}
]
}
],
export const getDbDirTreeList = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/tree-list`,
method: 'post',
data
})
*/
export const getDbDirTreeList = {
url: '/mock/db-dir/tree-list',
method: 'post',
response: ({body}:{body:any}) => {
return {
code: '00000',
message: '成功',
'data|10-30': [{
cgDirName: '@cword(3, 5)',
'children|1-3': [{
databaseGuid: '@guid',
database: '@cword(3, 5)',
databaseChName: '@cword(3, 5)',
'children|1-3': [{
tableGuid: '@guid',
tableName: '@cword(3, 5)',
tableChName: '@cword(3, 5)'
}]
}]
}]
}
}
}
/**
* /**
* 数据库目录-表数据列表查询
* @param {Object}
* @path /db-dir/table/page-list
* export const getDbDirTablePageList = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/page-list`,
method: 'post',
data
})
"data": {
"totalRows": 0,
"totalPages": 0,
"pageSize": 0,
"pageIndex": 0,
"records": [
{
"guid": "string",
"tenantGuid": "string",
"cgDirName": "string",
"dirGuid": "string",
"tableGuid": "string",
"tableName": "string",
"tableChName": "string",
"databaseGuid": "string",
"database": "string",
"databaseChName": "string",
"foundMode": 0,
"state": 0,
"isDataAsset": "string"
}
],
}
*/
export const getDbDirTablePageList = {
url: '/mock/db-dir/table/page-list',
method: 'post',
response: ({body}:{body:any}) => {
const {pageIndex, pageSize} = body
return {
code: '00000',
message: '成功',
'data': {
totalRows: '@integer(50, 100)',
totalPages: '@integer(1, 10)',
pageSize,
pageIndex,
'records|20-30': [{
guid: '@guid',
tenantGuid: '@guid',
cgDirName: '@cword(3, 5)',
dirGuid: '@guid',
tableGuid: '@guid',
tableName: '@cword(3, 5)',
tableChName: '@cword(3, 5)',
databaseGuid: '@guid',
database: '@cword(3, 5)',
databaseChName: '@cword(3, 5)',
foundMode: '@integer(1, 3)',
state: '@integer(0,2)',
isDataAsset: 'Y'
}]
}
}
}
}
export default [confirmDelivery] as MockMethod[]
export default [getCgDirTreeList,getCgDirFieldPageList, getDictionary,saveBizRuleConfig, getDbDirTreeList, getDbDirTablePageList] as MockMethod[]
......
......@@ -176,6 +176,20 @@ const routes: RouteRecordRaw[] = [
cache: true
},
},
{
path: 'configure-rules',
name: 'configureRules',
component: () => import('@/views/data_inventory/configureRules.vue'),
meta: {
title: '配置业务规则',
sidebar: false,
breadcrumb: false,
cache: true,
reuse: true,
editPage: true,
activeMenu: '/data-inventory/classify-grade-catalogue',
},
},
],
}
]
......
......@@ -3,54 +3,31 @@
</route>
<script lang="ts" setup name="classifyGradeCatalogue">
import { CirclePlus, Delete, Warning } from "@element-plus/icons-vue";
import { Warning } from "@element-plus/icons-vue";
import TableTools from '@/components/Tools/table_tools.vue';
import { getCgDirTreeList, getCgDirFieldPageList } from '@/api/modules/dataInventory';
import { getCgDirTreeList, getCgDirFieldPageList, getDictionary, saveBizRuleConfig, getDbDirTreeList, getDbDirTablePageList } from '@/api/modules/dataInventory';
import { TableColumnWidth } from "@/utils/enum";
import router from "@/router";
const currentPath = ref<string[]>(['全部', '个人信息', '个人自然信息', '个人基本概况信息']);
const tempData = [
{
guid: '1',
standardName: '个人信息',
status: 'published',
children: [
{
guid: '1-1',
standardName: '个人自然信息',
status: 'published',
children: [
{
guid: '1-1-1',
standardName: '个人基本概况信息',
status: 'published',
},
{
guid: '1-1-2',
standardName: '个人财产信息',
status: 'published',
},
{
guid: '1-1-3',
standardName: '个人健康信息',
status: 'published',
},
]
},
]
},
];
const currentPath = ref<string[]>([]);
const { proxy } = getCurrentInstance() as any;
// 分级分类树形列表
const CgDirTreeList = ref();
const getCgDirTreeData = async () => {
treeInfo.value.loading = true;
const params = {
classifyName: '',
}
const res: any = await getCgDirTreeList(params);
if (res.code == proxy.$passCode) {
CgDirTreeList.value = res.data;
treeInfo.value.data = res.data;
currentPath.value = [res.data[0].classifyName];
treeInfo.value.expandedKey = [res.data[0].guid];
treeInfo.value.currentNodeKey = res.data[0].guid;
treeInfo.value.loading = false;
} else {
proxy.$ElMessage.error(res.msg);
}
......@@ -58,6 +35,7 @@ const getCgDirTreeData = async () => {
// 分页列表
const CgDirFieldPageList = ref();
const getCgDirFieldPage = async (params = {}) => {
tableInfo.value.loading = true;
// 在这里你可以根据需要扩展或修改 params
const defaultParams = {
pageIndex: 1,
......@@ -74,165 +52,61 @@ const getCgDirFieldPage = async (params = {}) => {
const finalParams = { ...defaultParams, ...params };
const res: any = await getCgDirFieldPageList(finalParams);
if (res.code == proxy.$passCode) {
CgDirFieldPageList.value = res.data;
CgDirFieldPageList.value = res.data.records;
tableInfo.value.page.rows = res.data.totalRows;
tableInfo.value.page.limit = res.data.pageSize
tableInfo.value.page.curr = res.data.pageIndex
tableInfo.value.data = res.data.records;
tableInfo.value.loading = false;
} else {
proxy.$ElMessage.error(res.msg);
}
};
const dictionaryList = ref([]);
const getDictionaryList = () => {
getDictionary({}).then((res: any) => {
dictionaryList.value = [];
if (res.code == proxy.$passCode) {
dictionaryList.value = res.data || [];
classEditFormItems.value[4].options = res.data || [];
} else {
proxy.$ElMessage.error(res.msg);
}
})
};
onMounted(() => {
getCgDirTreeData();
getCgDirFieldPage();
getDictionaryList();
})
// 左侧tree-list
const treeInfo = ref({
id: "data-pickup-tree",
filter: true,
editTreeItem: true,
editTreeItem: false,
queryValue: "",
className: 'tree-list',
queryPlaceholder: "输入标准集名称搜索",
props: {
label: "standardName",
label: "classifyName",
value: "guid",
},
nodeKey: 'guid',
expandedKey: ['0'],
currentNodeKey: '',
expandOnNodeClick: false,
data: tempData,
data: [],
loading: false
});
// 弹窗配置
const formItems: any = ref([
{
label: '标准集名称',
type: 'input',
maxlength: 50,
placeholder: '请输入',
field: 'standardName',
clearable: true,
required: true
}, {
label: '标准集编号',
type: 'input',
placeholder: '',
field: 'standardCode',
required: true,
disabled: true
}, {
label: "上级标准集",
type: 'tree-select',
placeholder: '请选择',
field: 'parentGuid',
default: '',
checkStrictly: true,
lazy: false,
clearable: true,
options: [],
props: {
label: 'standardName',
value: 'guid',
children: 'children',
isLeaf: 'isLeaf'
},
expandKeys: [],
filterable: true,
required: false
}, {
label: '排序',
type: 'input',
placeholder: '请输入',
field: 'orderNum',
maxlength: 6,
required: true,
clearable: true,
}, {
label: '描述',
type: 'textarea',
placeholder: '请输入',
field: 'description',
clearable: true,
required: false,
block: true
},
])
const formRules: any = ref({
standardName: [
{
required: true,
message: '请输入标准集名称',
trigger: 'blur'
},
{
max: 50,
message: '长度在 50 个字符以内',
trigger: 'blur'
},
],
orderNum: [{
validator: (rule: any, value: any, callback: any) => {
if (value === 0) {
callback();
return;
}
if (!value) {
callback(new Error('请填写排序'));
return;
}
const r = /(^[0-9]([0-9]*)$|^[0-9]$)/; // 正整数(可以以0打头)
if (value && !r.test(value)) {
callback(new Error('请填写大于或等于零整数'));
return;
}
callback();
},
trigger: "blur",
}],
})
const formInfo = ref({
type: "form",
title: "",
formInfo: {
id: "add-set-standard-form",
items: formItems.value,
rules: formRules.value
},
})
const standardSetDialogInfo: any = ref({
visible: false,
size: 700,
direction: "column",
header: {
title: "新建",
},
type: '',
contents: [formInfo.value],
footer: {
visible: true,
btns: [
{ type: "default", label: "取消", value: "cancel" },
{ type: "primary", label: "确定", value: "submit" },
],
},
})
const addStandardSet = () => {
standardSetDialogInfo.value.visible = true;
console.log('addStandardSet');
}
const standardSetDialogBtnClick = (btn: any, info: any) => {
console.log('standardSetDialogBtnClick', btn, info);
if (btn.value === 'submit') {
standardSetDialogInfo.value.visible = false;
}
if (btn.value === 'cancel') {
standardSetDialogInfo.value.visible = false;
}
}
// 右侧上方搜索tab配置
const searchItemList = ref([
......@@ -336,14 +210,11 @@ const toSearch = (val: any, clear: boolean = false) => {
// params.standardSetLevelCode = standardSetLevelCode.value;
// return getTableData(params);
};
const treeSelectNodeChange = (node: any) => {
console.log('treeSelectNodeChange', node);
const { guid, standardName } = node
treeInfo.value.currentNodeKey = guid;
console.log('nodeClick', guid, standardName);
const nodeClick = (data: any) => {
const { guid, classifyName } = data
// 递归tempData找到所有祖先元素的standardName,存入currentPath中
const path = findPath(tempData, guid);
const path = findPath(CgDirTreeList.value, guid);
if (path) {
currentPath.value = path;
console.log('找到路径:', path);
......@@ -351,31 +222,43 @@ const treeSelectNodeChange = (node: any) => {
console.error('未找到路径');
}
}
const findPath = (data: any[], targetGuid: string, path: string[] = []) => {
for (const item of data) {
path.push(item.classifyName); // 添加当前节点名称
if (item.guid === targetGuid) {
return path; // 找到目标节点,返回路径
}
if (item.children && item.children.length > 0) {
const result = findPath(item.children, targetGuid, path);
if (result) return result; // 子节点找到目标节点,返回路径
}
path.pop(); // 回溯,移除当前节点
}
return null; // 未找到目标节点
};
// btns-area
const checked1 = ref(false);
const checked = ref(false);
const changeCheck = (val) => {
checked.value = val;
getDataBaseTableData();
}
//下方表格配置
const tableDataList = ref([{
fieldStandardCode: '个人基本概况信息',
chName: '个人自然信息',
enName: '个人信息',
dataTypeValue: '规则',
approveState: 'Y',
}, {
fieldStandardCode: '个人财产信息',
chName: '个人自然信息',
enName: '个人信息',
dataTypeValue: '规则',
approveState: 'Y',
}, {
fieldStandardCode: '个人健康信息',
chName: '个人自然信息',
enName: '个人信息',
dataTypeValue: '规则',
approveState: 'Y',
}]);
const tableDataList = ref();
const page = ref({
limit: 10,
curr: 1,
sizes: [
{ label: "10", value: 10 },
{ label: "20", value: 20 },
{ label: "100", value: 100 },
{ label: "150", value: 150 },
{ label: "200", value: 200 },
],
});
const tableInfo = ref({
id: "role-manage-table",
multiple: true,
......@@ -384,20 +267,142 @@ const tableInfo = ref({
{ label: "序号", type: "index", width: 56, align: "center" },
{ label: "字段名", field: "fieldName", width: 140 },
{ label: "分类", field: "classifyName", width: 180 },
{ label: "分级", field: "enName", width: 120 },
{ label: "标签", field: "labelName", width: 140 },
{ label: "分级", field: "gradeDetailName", width: 120 },
{ label: "标签", field: "label", width: 140 },
{ label: "规则", field: "rulesName", width: 180 },
{ label: "表名", field: "tableName", width: 120, align: 'center' },
{ label: "表中文名", field: "tableCHName", width: 120, align: 'center' },
{ label: "数据库名", field: "databaseName", width: 120, align: 'center' },
{ label: "数据类型", field: "databaseCHName", width: 120, align: 'center' },
{ label: "表中文名", field: "tableChName", width: 120, align: 'center' },
{ label: "数据库名", field: "database", width: 120, align: 'center' },
{ label: "数据类型", field: "databaseChName", width: 120, align: 'center' },
],
data: tableDataList.value,
data: [],
page: {
type: "normal",
rows: 0,
// ...page.value,
...page.value,
},
actionInfo: {
show: false,
},
loading: false
});
const tablePageChange = (info) => {
console.log('tablePageChange', info);
page.value.curr = Number(info.curr);
page.value.limit = Number(info.limit);
getCgDirFieldPage({
pageIndex: info.curr,
pageSize: info.limit
});
}
// 选中配置的业务规则
const selectedRulesData = ref();
const tableCheckboxSelectChange = (select, row) => {
// 遍历选中的数据,存入selectedRulesData
let rulesName: any = [];
let rulesGuid: any = [];
select.forEach((item: any) => {
rulesName.push(item.classifyName);
rulesGuid.push(item.guid);
});
selectedRulesData.value = {
rulesName: rulesName.join('、'),
guids: rulesGuid
};
}
const tableCheckboxAllSelectChange = (select) => {
// 遍历选中的数据,存入selectedRulesData
let rulesName: any = [];
let rulesGuid: any = [];
select.forEach((item: any) => {
rulesName.push(item.classifyName);
rulesGuid.push(item.guid);
});
selectedRulesData.value = {
rulesName: rulesName.join('、'),
guids: rulesGuid
};
}
// 批量配置业务规则
const batchControlRules = () => {
// 判断是否选中数据
if (!selectedRulesData.value || !selectedRulesData.value.guids || selectedRulesData.value.guids.length == 0) {
proxy.$ElMessage.warning('请选择数据');
return;
}
drawerInfo.value.visible = true;
classEditFormItems.value[0].default = selectedRulesData.value.rulesName;
}
// 数据库目录
// 左侧tree-list
const dataBaseTreeInfo = ref({
id: "data-pickup-tree",
filter: true,
editTreeItem: false,
queryValue: "",
className: 'tree-list',
queryPlaceholder: "输入标准集名称搜索",
props: {
label: "name",
value: "guid",
},
nodeKey: 'guid',
expandedKey: ['0'],
currentNodeKey: '',
expandOnNodeClick: false,
data: [],
loading: false
});
const dataBasePage = ref({
limit: 10,
curr: 1,
sizes: [
{ label: "10", value: 10 },
{ label: "20", value: 20 },
{ label: "100", value: 100 },
{ label: "150", value: 150 },
{ label: "200", value: 200 },
],
});
const dataBaseTableInfo = ref({
id: "data-base-table",
multiple: true,
fixedSelection: true,
fields: [
{ label: "序号", type: "index", width: 56, align: "center" },
{ label: "数据源", field: "databaseChName", width: 140 },
{ label: "表名称", field: "tableChName", width: 180 },
{ label: "数据库表", field: "enName", width: 120 },
{
label: "新建方式", field: "foundMode", width: 140, getName: (scope) => {
let dataGrade = scope.row.foundMode;
return dataGrade == 1 ? '根据文件新建' : '已有表新建';
}
},
{
label: "状态", field: "state", type: 'tag', width: 180, getName: (scope) => {
let status = scope.row.state;
// 0 草稿中 1 已建表 2 已有默认表
return status == 0 ? '草稿中' : status == 1 ? '已建表' : '已有默认表';
}
},
{ label: "任务修改人", field: "damName", width: 120 },
{ label: "修改时间", field: "updateTime", width: TableColumnWidth.DATETIME },
{ label: "描述", field: "databaseName", width: 120, align: 'center' },
{ label: "规划数据资产", field: "isDataAsset", type: 'switch', activeText: '是', inactiveText: '否', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 120, align: 'center' },
],
data: [],
page: {
type: "normal",
rows: 0,
...dataBasePage.value,
},
actionInfo: {
label: "操作",
......@@ -406,22 +411,28 @@ const tableInfo = ref({
fixed: 'right',
btns: [
{
label: "编辑", value: "edit", click: (scope) => {
label: "配置业务规则", value: "edit", click: (scope) => {
console.log('编辑', scope);
drawerInfo.value.visible = true
// 路由跳转configure-rules
router.push({
name: 'configure-rules',
query: {
guid: scope.row.guid,
tableChName: scope.row.tableChName,
databaseChName: scope.row.databaseChName,
databaseGuid: scope.row.databaseGuid,
tableGuid: scope.row.guid,
}
});
}
},
{
label: "复制", value: "copy", click: (scope) => {
label: "编辑表结构", value: "copy", click: (scope) => {
console.log('复制', scope);
}
},
{
label: "删除 ", value: "delete", click: (scope) => {
console.log('删除', scope);
}
},
}
]
},
......@@ -429,36 +440,17 @@ const tableInfo = ref({
});
const nodeClick = (data: any) => {
const { guid, standardName } = data
console.log('nodeClick', guid, standardName);
searchItemList.value[0].default = standardName;
// 递归tempData找到所有祖先元素的standardName,存入currentPath中
const path = findPath(tempData, guid);
if (path) {
currentPath.value = path;
console.log('找到路径:', path);
} else {
console.error('未找到路径');
}
}
const findPath = (data: any[], targetGuid: string, path: string[] = []) => {
for (const item of data) {
path.push(item.standardName); // 添加当前节点名称
if (item.guid === targetGuid) {
return path; // 找到目标节点,返回路径
}
if (item.children && item.children.length > 0) {
const result = findPath(item.children, targetGuid, path);
if (result) return result; // 子节点找到目标节点,返回路径
}
path.pop(); // 回溯,移除当前节点
}
return null; // 未找到目标节点
};
// 映射 大于,小于,等于 三种关系
const selectLength = ref([
{ label: '大于', value: '>', },
{ label: '小于', value: '<', },
{ label: '等于', value: '=', },
]
)
const classEditFormItems = ref([{
label: '已选字段',
type: 'input',
......@@ -468,14 +460,14 @@ const classEditFormItems = ref([{
default: '',
clearable: true,
required: true,
block: true
block: true,
disabled: true,
}, {
label: '长度',
type: 'input',
type: 'select',
placeholder: '请选择',
field: 'orderNum',
maxlength: 6,
regexp: /\D/g,
field: 'orderNumLength',
options: selectLength.value,
required: true,
clearable: true,
},
......@@ -494,31 +486,21 @@ const classEditFormItems = ref([{
label: '精度',
type: 'input',
placeholder: '请选择',
field: 'orderNum',
maxlength: 6,
regexp: /\D/g,
required: true,
clearable: true,
},
{
label: '',
type: 'input',
placeholder: '请输入',
field: 'orderNum',
field: 'fieldPrecision',
maxlength: 6,
regexp: /\D/g,
required: true,
clearable: true,
col: 'numberClass',
block: true,
}, {
label: '关联字典',
field: 'parentGuid',
field: 'dictionaryGuid',
type: 'select',
placeholder: '请选择',
default: '',
options: [],
props: {
label: "classifyName",
label: "chName",
value: "guid",
},
filterable: true,
......@@ -529,7 +511,7 @@ const classEditFormItems = ref([{
label: '字段取值范围',
type: 'input-group',
placeholder: '请输入',
field: 'numberAround',
field: 'fieldValueRange',
default: '',
children: [
{
......@@ -555,26 +537,31 @@ const classEditFormItems = ref([{
{
label: '数据是否唯一',
type: "radio-group",
field: "radioField",
field: "isUnique",
disabled: false,
default: 'N',
options: [
{ label: "选项一", value: "option1", disabled: false },
{ label: "选项二", value: "option2", disabled: false },
{ label: "是", value: "Y", disabled: false },
{ label: "否", value: "N", disabled: false },
],
},
{
label: '是否必填',
type: "radio-group",
field: "radioField",
field: "isNotNull",
disabled: false,
default: 'N',
options: [
{ label: "选项一", value: "option1", disabled: false },
{ label: "选项二", value: "option2", disabled: false },
{ label: "是", value: "Y", disabled: false },
{ label: "否", value: "N", disabled: false },
],
}
]);
const classEditFormRules = ref({
classifyName: [{ required: true, message: '请填写分类名称', trigger: 'blur' }],
orderNumLength: [{ required: true, message: '请选择长度', trigger: 'blur' }],
orderNum: [{ required: true, message: '请填写长度', trigger: 'blur' }],
fieldPrecision: [{ required: true, message: '请填写精度', trigger: 'blur' }],
});
/** 新增分类的form */
const classEditFormInfo = ref({
......@@ -611,71 +598,145 @@ const drawerBtnClick = async (btn, info) => {
if (btn.value == 'cancel') {
drawerInfo.value.visible = false;
} else {
// if (drawerInfo.value.header.title == '添加分类') {
// const params = {
// ...info,
// classifyGradeGuid: router.currentRoute.value.query.guid,
// }
// const res: any = await saveClassify(params);
// if (res.code == proxy.$passCode) {
// proxy.$ElMessage.success('添加成功!');
// drawerInfo.value.visible = false;
// getTreeListData();
// } else {
// proxy.$ElMessage.error(res.msg);
// }
// } else {
// // 编辑分类
// const params = {
// ...info,
// classifyGradeGuid: router.currentRoute.value.query.guid,
// guid: currTableInfo.value.guid
// }
// const res: any = await updateClassify(params);
// if (res.code == proxy.$passCode) {
// proxy.$ElMessage.success('修改成功!');
// drawerInfo.value.visible = false;
// getTreeListData();
// } else {
// proxy.$ElMessage.error(res.msg);
// }
// }
console.log('aaa')
btn.loading = true;
const { orderNumLength, orderNum, numberStart, numberEnd, fieldPrecision, dictionaryGuid, isUnique, isNotNull } = info;
let fieldLengthCondition = orderNumLength + '#' + orderNum;
let fieldValueRange: any = [];
if (numberStart && numberEnd) {
if (numberEnd < numberStart) {
proxy.$ElMessage.error('字段取值范围结束值不能小于开始值');
return;
}
fieldValueRange = [numberStart, numberEnd];
}
const params = {
fieldPrecision,
dictionaryGuid,
isUnique,
isNotNull,
fieldLengthCondition,
fieldValueRange,
fieldGuid: selectedRulesData.value.guids
}
const res: any = await saveBizRuleConfig(params);
if (res.code == proxy.$passCode) {
btn.loading = false;
proxy.$ElMessage.success('配置成功!');
drawerInfo.value.visible = false;
getCgDirFieldPage();
} else {
proxy.$ElMessage.error(res.msg);
}
}
}
const handleTreeItemMenuClick = (data: any, type) => {
console.log('handleTreeItemMenuClick', data, type);
}
const getItemStyle = (status: string) => {
const styles: { [key: string]: any } = {
published: {
color: '#1BA854',
background: '#F2FFF5',
border: '1px solid rgba(109, 209, 142, 1)',
},
running: {
color: '#FF991C',
background: '#FFFBF2',
border: '1px solid rgba(255, 203, 120, 1)',
},
pending: {
border: '1px solid rgba(217, 217, 217, 1)',
color: '#404040',
background: '#F5F5F5',
},
};
return styles[status] || {}; // 如果状态没有对应的样式,则返回空对象
}
// tab切换
const activeName = ref('first');
const handleClick = (tab: any) => {
console.log(tab.props.name);
activeName.value = tab.props.name;
if (tab.props.name === 'second') {
getDataBaseTreeData();
getDataBaseTableData();
}
}
// 获取数据库树形列表 getDbDirTreeList
const dataBaseTreeData = ref<any>();
const getDataBaseTreeData = async () => {
dataBaseTreeInfo.value.loading = true;
try {
const res: any = await getDbDirTreeList({});
if (res.code == proxy.$passCode) {
res.data.forEach(addGuids);
dataBaseTreeData.value = res.data;
dataBaseTreeInfo.value.data = res.data;
} else {
proxy.$ElMessage.error(res.msg);
}
} catch (error) {
proxy.$ElMessage.error('请求失败');
} finally {
dataBaseTreeInfo.value.loading = false;
}
};
// 递归添加 GUID 的函数
const addGuids = (node) => {
if (node.databaseGuid) {
node.guid = node.databaseGuid;
node.name = node.databaseChName;
} else if (node.tableGuid) {
node.guid = node.tableGuid;
node.name = node.tableChName;
} else {
node.guid = crypto.randomUUID();
node.name = node.cgDirName;
}
if (node.children && Array.isArray(node.children)) {
node.children.forEach(addGuids);
}
};
// 获取数据列表
const dataBaseTableDataList = ref<any>();
const getDataBaseTableData = async (params = {}) => {
dataBaseTableInfo.value.loading = true;
const dataBaseParams = {
pageIndex: 1,
pageSize: 10,
databaseGuid: "",
isDataAsset: checked.value ? 'Y' : 'N',
};
const finalParams = { ...dataBaseParams, ...params };
const res: any = await getDbDirTablePageList(finalParams);
if (res.code == proxy.$passCode) {
dataBaseTableDataList.value = res.data.records;
dataBaseTableInfo.value.page.rows = res.data.totalRows;
dataBaseTableInfo.value.data = res.data.records;
dataBasePage.value.limit = res.data.pageSize
dataBasePage.value.curr = res.data.pageIndex
} else {
proxy.$ElMessage.error(res.msg);
}
dataBaseTableInfo.value.loading = false;
};
const dataBaseTablePageChange = (info) => {
console.log('dataBaseTablePageChange', info);
dataBasePage.value.curr = Number(info.curr);
dataBasePage.value.limit = Number(info.limit);
getDataBaseTableData({
pageIndex: info.curr,
pageSize: info.limit
});
}
const showTableOrDatabase = ref(true);
const dataBasenodeClick = (data: any) => {
console.log('dataBasenodeClick', data);
if (data.databaseGuid || data.cgDirName) {
showTableOrDatabase.value = true;
return;
}
if (data.tableGuid) {
showTableOrDatabase.value = false;
return;
}
}
const handleSubjectTableCommand = (command: string) => {
console.log('handleSubjectTableCommand', command);
}
......@@ -691,13 +752,20 @@ const addIsShowDatabaseTip = () => {
isShowDatabaseTip.value = false;
}
// 表信息和字段信息切换
const activeTab = ref('table');
const setActiveTab = (tab) => {
console.log('setActiveTab', tab);
activeTab.value = tab;
};
</script>
<template>
<div class="classification-template-content">
<div class="v-table-tools">
<TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch"
@treeSelectNodeChange="treeSelectNodeChange" />
<TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch" />
</div>
<div class="container_wrap full flex">
<div class="aside_wrap">
......@@ -705,7 +773,9 @@ const addIsShowDatabaseTip = () => {
<el-tab-pane label="分类分级目录" name="first">
<Tree :treeInfo="treeInfo" @nodeClick="nodeClick" @itemMenuClick="handleTreeItemMenuClick" />
</el-tab-pane>
<el-tab-pane label="数据库目录" name="second">Config</el-tab-pane>
<el-tab-pane label="数据库目录" name="second">
<Tree :treeInfo="dataBaseTreeInfo" @nodeClick="dataBasenodeClick" />
</el-tab-pane>
</el-tabs>
</div>
<div class="main_wrap" v-if="activeName === 'first'">
......@@ -732,11 +802,13 @@ const addIsShowDatabaseTip = () => {
<div class="left-btns">
<el-button type="primary" @click="addStandardSet">查看已生产报告</el-button>
<el-button>导出</el-button>
<el-button>批量配置业务规则</el-button>
<el-button @click="batchControlRules">批量配置业务规则</el-button>
</div>
</div>
<div class="table_panel_wrap">
<Table :tableInfo="tableInfo" />
<Table :tableInfo="tableInfo" @tablePageChange="tablePageChange"
@tableCheckboxSelectChange="tableCheckboxSelectChange"
@tableCheckboxAllSelectChange="tableCheckboxAllSelectChange" />
</div>
</div>
......@@ -755,6 +827,17 @@ const addIsShowDatabaseTip = () => {
</el-button>
</div>
<div>全部</div>
<div class="tab-btn">
内容信息:
<div v-if="showTableOrDatabase" class="table" :class="{ active: activeTab === 'table' }"
@click="setActiveTab('table')">
表信息
</div>
<div class="word" :class="{ active: activeTab === 'word' || !showTableOrDatabase }"
@click="setActiveTab('word')">
字段信息
</div>
</div>
<div class="btns-area">
<div class="left-btns">
<div class="dropdown_btn">
......@@ -792,15 +875,13 @@ const addIsShowDatabaseTip = () => {
<el-button>查看质量规则</el-button>
</div>
<div class="right-btns">
<el-checkbox v-model="checked1" label="仅看规划数据资产表" size="large" />
<el-checkbox v-model="checked" label="仅看规划数据资产表" size="large" @change="changeCheck" />
</div>
</div>
<div class="table_panel_wrap_database">
<Table :tableInfo="tableInfo" />
<Table :tableInfo="dataBaseTableInfo" @tablePageChange="dataBaseTablePageChange" />
</div>
</div>
<Dialog :dialogInfo="standardSetDialogInfo" @btnClick="standardSetDialogBtnClick" />
<Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" />
</div>
......@@ -830,23 +911,34 @@ const addIsShowDatabaseTip = () => {
border-right: 1px solid #d9d9d9;
box-shadow: none;
:deep(.v-tabs) {
.el-tabs__item {
padding: 0 10px;
.v-tabs {
height: 100%;
.el-tabs__content {
height: 100%;
.el-tab-pane {
height: 100%;
}
}
:deep(.v-tabs) {
.el-tabs__item {
padding: 0 10px;
}
}
}
.tree_panel {
height: 100%;
padding-top: 0;
.tree_panel {
height: 100%;
padding-top: 0;
:deep(.el-tree) {
margin: 0;
height: calc(100% - 68px);
overflow: hidden auto;
:deep(.el-tree) {
margin: 0;
height: calc(100% - 115px);
overflow: hidden auto;
}
}
}
}
.main_wrap {
......@@ -915,17 +1007,59 @@ const addIsShowDatabaseTip = () => {
.table_panel_wrap {
width: 100%;
height: calc(100% - 113px);
height: calc(100% - 175px);
min-height: 210px;
overflow: visible;
}
.table_panel_wrap_database {
width: 100%;
height: calc(100% - 113px);
height: calc(100% - 215px);
min-height: 210px;
overflow: visible;
}
/* 外层容器 */
.tab-btn {
display: flex;
align-items: center;
font-size: 14px;
margin-top: 6px;
margin-bottom: 6px;
}
/* Tab 按钮样式 */
.tab-btn div {
padding: 4px 12px;
cursor: pointer;
border: 1px solid #ccc;
background-color: #f7f7f7;
transition: background-color 0.3s ease, color 0.3s ease;
}
.tab-btn .table {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
.tab-btn .word {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}
/* 默认未选中样式 */
.tab-btn div:not(.active):hover {
background-color: #e0e0e0;
}
/* 选中样式 */
.tab-btn .active {
background-color: #4FA1A4;
color: white;
border-color: #4FA1A4;
}
}
}
......@@ -954,7 +1088,7 @@ const addIsShowDatabaseTip = () => {
:deep(.v-drawer) {
.numberClass {
margin-top: 12px;
margin-top: 10px;
}
}
}
......
<route lang="yaml">
name: configureRules //标签管理
</route>
<script lang="ts" setup name="configureRules"></script>
<template>
<div>111</div>
</template>
......@@ -7,7 +7,7 @@ import TableTools from '@/components/Tools/table_tools.vue';
import { getGradeList } from "@/api/modules/dataInventory";
import { getLabelList, getClassifyGradeTreeList, saveLabel, getLabelPageList, deleteLabel, updateLabel } from "@/api/modules/dataLabel";
import { CirclePlus, Delete } from "@element-plus/icons-vue";
import { el, tr } from 'element-plus/es/locale';
const { proxy } = getCurrentInstance() as any;
const dialogLabelFormRef = ref();
......@@ -560,7 +560,6 @@ const searchClass = async (val: any, clear: boolean = false) => {
return;
}
if (val?.labelName?.length !== 0) {
console.log('调用了吗');
tableInfo.value.loading = true;
const params = {
pageIndex: page.value.curr,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!