c7b77154 by lxs

Merge branch 'develop' of http://117.78.60.236:8000/csbr-daop/fe-data-asset-management into develop

2 parents 429ed263 82a6de26
......@@ -36,6 +36,9 @@ VITE_APP_CHECK_BASEURL = ms-daop-zcgl-data-inventory
# 数据字典接口地址
VITE_APP_CONFIG_URL = 'ms-daop-configure-service'
# 文件上传下载接口地址
VITE_APP_COMMON_URL = 'ms-daop-common-service'
#门户接口
VITE_API_PORTALURL = https://swzl-test.zgsjzc.com/portal
......
......@@ -172,6 +172,14 @@ export const getLargeCategoryList = (params) => request({
method: 'get',
})
/**
* 获取字段类型
*/
export const getFieldTypeList = (params) => request({
url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType?dictType=${params.dictType}`,
method: 'get',
})
/** 分类分级模板数据 */
export const getTempleteClassifyData = (data) => request({
......@@ -595,7 +603,7 @@ export const getDictionary = (params) => request({
* @path /biz-rule-config/save
*/
export const saveBizRuleConfig = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/save`,
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/save-or-update`,
method: 'post',
data
})
......@@ -644,15 +652,46 @@ export const getDbDirFieldPageList = (data) => request({
data
})
/**
* 数据库目录-表联动查询
* @param data
* @returns
* @path /db-dir/table/select-list
*/
export const getDbDirTableSelectList = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/select-list`,
method: 'post',
data
})
/** 获取已有字段信息 */
export const getDsTableStructure= (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid`,
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guid?tableGuid=${data.tableGuid}&execGuid=${data.execGuid}`,
method: 'post',
data
});
/** 获取已有数据库目录字段信息 入参是数组 */
export const getDsTableStructures= (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guids`,
method: 'post',
data
});
/**
* 数据库目录-字段查询分类分级
* @param {Object}
* @path /db-dir/field/get-classify-and-grade
*/
export const getDbDirFieldClassifyAndGrade = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/get-classify-and-grade`,
method: 'post',
data
})
/** 根据选择的连接池获取表列表 */
export const getDsTableByDs = (params) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/list-by-datasource-guid`,
......
import request from "@/utils/request";
//获取下载签名
export const getDownFileSignByUrl = (params) => {
return request({
url: `${
import.meta.env.VITE_APP_COMMON_URL
}/obs/generate-download-file-signature?fileName=${params.fileName}`,
method: "get",
});
};
//obs下载
export const obsDownloadRequest = (params) => {
return request({
withCredentials: false,
headers: params.actualSignedRequestHeaders
? {
"Content-Type": params.actualSignedRequestHeaders["Content-Type"],
}
: {},
validateStatus: function (status) {
return status >= 200;
},
url: params.signedUrl,
responseType: "blob",
maxRedirects: 0,
data: { unused: 0 },
method: "get",
});
};
//获取上传签名
export const getUpFileSignByUrl = (params) => {
return request({
url: `${
import.meta.env.VITE_APP_COMMON_URL
}/obs/generate-file-signature?fileName=${params.fileName}`,
method: "get",
});
};
//obs上传
export const obsUploadRequest = (params) => {
return request({
withCredentials: false,
headers: params.actualSignedRequestHeaders ? {
"Content-Type": params.actualSignedRequestHeaders[
"Content-Type"
]
} : {},
validateStatus: function (status) {
return status >= 200;
},
url: params.signedUrl,
method: "put",
data: params.file,
});
};
export const getImageContent = (params) => request({
url: `${import.meta.env.VITE_APP_COMMON_URL}/obs/view-pic?filePath=${params.split("?")[0]}`,
method: 'get',
responseType: 'blob'
});
......@@ -24,7 +24,8 @@ const props = defineProps({
const emits = defineEmits(["expand"]);
const isExpanded = ref(true);
// const isExpanded = ref(true);
const isExpanded = ref(props.isExpand);
watch(
() => props.isExpand,
......@@ -46,14 +47,10 @@ const expandSwicthHandler = () => {
</script>
<template>
<ElCard
class="v-content-wrap"
shadow="never"
:body-style="{
padding: `0px`,
height: `${isExpanded ? contentHeight + 28 : 0}px`,
}"
>
<ElCard class="v-content-wrap" shadow="never" :body-style="{
padding: `0px`,
height: `${isExpanded ? contentHeight + 28 : 0}px`,
}">
<template v-if="title" #header>
<div class="card-title" @click="expandSwicthHandler">
<span v-if="expandSwicth" style="padding-right: 5px; cursor: pointer">
......
......@@ -19,10 +19,15 @@ import Schedule from "../Schedule/index.vue";
import { setFormFields, setItemsDisabled, getDownloadUrl, download } from '@/utils/common';
import { ElMessage, ElMessageBox } from 'element-plus';
import useUserStore from "@/store/modules/user";
// import {
// getFileUrl,
// getImageContent
// } from '@/api/modules/queryService';
import {
getFileUrl,
getImageContent
} from '@/api/modules/queryService';
getImageContent,
getUpFileSignByUrl,
obsUploadRequest
} from "@/api/modules/obsSerivice";
import { Editor, EditorExpose } from '@/components/Editor'
const userStore = useUserStore()
......@@ -444,29 +449,35 @@ const uploadFile = (file, item) => {
return Promise.resolve();
}
ruleFormRef.value?.clearValidate([item.field]);
let formData = new FormData();
formData.append('file', file.file);
formData.append('fileName', file.file.name);
return getFileUrl(formData)
// let formData = new FormData();
// formData.append('file', file.file);
// formData.append('fileName', file.file.name);
return getUpFileSignByUrl({ fileName: file.file.name })
.then((res: any) => {
if (res.code == '00000') {
let fileItem = {
name: file.file.name,
url: res.data,
file: file.file
};
if (item.limit === 1) {
formInline.value[item.field] = [fileItem];
obsUploadRequest({
signedUrl: res.data.signedUrl,
file: file.file,
actualsignedRequestHeaders: res.data.actualsignedRequestHeaders
}).then(() => {
if (res.code == '00000') {
let fileItem = {
name: file.file.name,
url: res.data.signedUrl,
file: file.file
};
if (item.limit === 1) {
formInline.value[item.field] = [fileItem];
} else {
formInline.value[item.field].push(fileItem);
}
ruleFormRef.value?.validateField([item.field]);
ElMessage.success('上传成功');
emits("uploadFileChange", formInline.value[item.field]);
} else {
formInline.value[item.field].push(fileItem);
uploadRef.value['ref' + item.field].handleRemove(file);
ElMessage.error('上传失败,请重新上传!');
}
ruleFormRef.value?.validateField([item.field]);
ElMessage.success('上传成功');
emits("uploadFileChange", formInline.value[item.field]);
} else {
uploadRef.value['ref' + item.field].handleRemove(file);
ElMessage.error('上传失败,请重新上传!');
}
})
})
.catch(() => {
uploadRef.value['ref' + item.field].handleRemove(file);
......
......@@ -99,8 +99,9 @@ onMounted(() => {
<el-form-item v-if="item.visible ?? true" :key="'item_' + index"
:class="{ 'width_auto': item.type == 'radio-button' }" :prop="item.field">
<template v-if="item.type == 'select'">
<el-select :class="{ 'is-multiple': item.multiple }" v-model="formInline[item.field]"
:placeholder="item.placeholder" :clearable="item.clearable" :filterable="item.filterable"
<el-select collapse-tags collapse-tags-tooltip :class="{ 'is-multiple': item.multiple }"
v-model="formInline[item.field]" :placeholder="item.placeholder" :clearable="item.clearable"
:filterable="item.filterable" :multiple="item.multiple" :max-collapse-tags="3"
:disabled="item.disabled ?? false" @change="(val) => selectChange(val, item)">
<el-option v-for="opt in item.options" :label="item.props?.label ? opt[item.props.label] : opt.label"
:value="item.props?.value ? opt[item.props.value] : opt.value" />
......
......@@ -206,7 +206,7 @@ export const getDbDirTreeList = {
return {
code: '00000',
message: '成功',
'data|10-30': [{
'data|10-30': {
cgDirName: '@cword(3, 5)',
'children|1-3': [{
databaseGuid: '@guid',
......@@ -218,7 +218,7 @@ export const getDbDirTreeList = {
tableChName: '@cword(3, 5)'
}]
}]
}]
}
}
}
}
......@@ -616,8 +616,221 @@ export const createTableSql = {
}
}
/** 获取已有数据库目录字段信息 入参是数组
export const getDsTableStructures= (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/list-by-table-guids`,
method: 'post',
data
});
* "data": [
{
"guid": "string",
"sourceTableName": "string",
"sourceDatabase": "string",
"sourceFieldName": "string",
"sourceFieldChName": "string",
"fieldGuid": "string",
"fieldName": "string",
"fieldChName": "string",
"fieldType": "string",
"fieldLength": 0,
"fieldPrecision": 0,
"dimGuid": "string",
"dictionaryGuid": "string",
"sortValue": 0,
"isPrimary": "string",
"isFk": "string",
"isNotNull": "string",
"classifyDetailGuid": "string",
"classifyDetailName": "string",
"gradeDetailGuid": "string",
"gradeDetailName": "string"
}
],
*/
// 模拟 getDsTableStructures 接口
export const getDsTableStructures = {
url: '/mock/db-dir/field/list-by-table-guids',
method: 'post',
response: ({ body }: { body: any }) => {
return {
code: '00000',
message: '成功',
'data|2-5': [
{
guid: '@guid',
sourceTableName: '@cword(3, 5)',
sourceDatabase: '@cword(3, 5)',
sourceFieldName: '@cword(3, 5)',
sourceFieldChName: '@cword(3, 5)',
fieldGuid: '@guid',
fieldName: '@cword(3, 5)',
fieldChName: '@cword(3, 5)',
fieldType: '@cword(3, 5)',
fieldLength: '@integer(1, 100)',
fieldPrecision: '@integer(1, 100)',
dimGuid: '@guid',
dictionaryGuid: '@guid',
sortValue: '@integer(1, 100)',
isPrimary: 'Y',
isFk: 'Y',
isNotNull: 'Y',
classifyDetailGuid: () => {
return Math.floor(Math.random() * 2) + 3; // 随机生成 3 或 4
},
classifyDetailName: '@cword(3, 5)',
gradeDetailGuid: '@guid',
gradeDetailName: '@cword(3, 5)'
}
]
};
}
};
// 模拟 getGradeDetails 接口
export const getGradeDetails = {
url: '/mock/grade-details',
method: 'post',
response: ({ body }: { body: any }) => {
return {
code: '00000',
message: '成功',
data: [{
}]
};
}
};
let currentGuid = 2;
// 模拟 getTaskExeTreeList 接口
export const getTaskExeTreeList = {
url: '/mock/cg-task-exec/classify/tree-list',
method: 'get',
response: ({ body }: { body: any }) => {
return {
code: '00000',
message: '成功',
data: [{
"guid": 1,
"classifyName": "听参我完",
"parentGuid": 1,
"gradeGuid":1,
"parentGuids": [
"39Ec3B98-EA2F-f5FF-Fc3b-EfAfe1fce91C",
"14be757b-8f0e-3DB9-5AaE-8cfeC18B2322"
],
"children": [
{
"classifyName": "素新议白",
"parentGuid": 4,
"gradeGuid":2,
"parentGuids": [
"de6A2ED4-Dc2f-DBf2-4d14-ceD8fd5BBa7C"
],
"children": [
{
"classifyName": "置表京革",
"parentGuid": 5,
"gradeGuid":3,
"parentGuids": [
"E2FAe9b2-3bc3-B6f7-f99a-964C6ae9dFCE",
"18EA10f2-7f1a-4ADA-cEba-d1dF44ED74cB"
],
"guid": 3
}
],
"guid": 10
}
],
},
{
"guid": 7,
"classifyName": "大头儿子",
"parentGuid": 1,
"gradeGuid":4,
"parentGuids": [
"39Ec3B98-EA2F-f5FF-Fc3b-EfAfe1fce91C",
"14be757b-8f0e-3DB9-5AaE-8cfeC18B2322"
],
"children": [
{
"classifyName": "小头把把",
"parentGuid": 4,
"gradeGuid":5,
"parentGuids": [
"de6A2ED4-Dc2f-DBf2-4d14-ceD8fd5BBa7C"
],
"children": [
{
"classifyName": "喜羊羊",
"parentGuid": 5,
"gradeGuid":6,
"parentGuids": [
"E2FAe9b2-3bc3-B6f7-f99a-964C6ae9dFCE",
"18EA10f2-7f1a-4ADA-cEba-d1dF44ED74cB"
],
"guid": 9
}
],
"guid": 8
}
],
},
]
};
}
};
// 模拟 getGradeList 分级接口 用于获取分级列表
export const getGradeList = {
url: '/mock/grade/page-list',
method: 'post',
response: ({ body }: { body: any }) => {
return {
code: '00000',
message: '成功',
data: {
records:[{
"guid": '1',
"name": "一级",
"parentGuid": 0,
},
{
"guid": '2',
"name": "二级",
"parentGuid": 1,
},
{
"guid": '3',
"name": "三级",
"parentGuid": 2,
},
{
"guid": '4',
"name": "四级",
"parentGuid": 3,
},
{
"guid": '5',
"name": "五级",
"parentGuid": 4,
},
{
"guid": '6',
"name": "六级",
"parentGuid": 5,
},
]
}}
}
};
export default [getCgDirTreeList,getCgDirFieldPageList,
getDictionary,saveBizRuleConfig, getDbDirTreeList,
getDbDirTablePageList,getDbDirDataSourceList,getDsTableByDs,
getDsTableStructure,getDbDirFieldPageList,getBizRuleConfigDetail,
updateBizRuleConfig,saveDbDirTable,createTableSql,updateDbDirTable] as MockMethod[]
updateBizRuleConfig,saveDbDirTable,createTableSql,updateDbDirTable,getDsTableStructures,getGradeDetails,getTaskExeTreeList,getGradeList] as MockMethod[]
......
......@@ -82,7 +82,7 @@ const routes: RouteRecordRaw[] = [
name: 'templateConfig',
component: () => import('@/views/data_inventory/templateConfig.vue'),
meta: {
title: '分类分级标准',
title: '分类分级规则',
breadcrumb: false,
cache: true
},
......
......@@ -6,8 +6,11 @@
import router from "@/router";
import { ref } from "vue";
import { saveGrade, getGradeList, deleteGrade, getLargeCategoryList, updateGrade } from '@/api/modules/dataInventory';
import { saveGrade, getGradeList, deleteGrade, getLargeCategoryList, updateGrade, updateClassifyGrad } from '@/api/modules/dataInventory';
import useUserStore from "@/store/modules/user";
const userStore = useUserStore();
const route = useRoute();
const fullPath = route.fullPath;
onBeforeMount(() => {
getGradeListData();
getDataGrade();
......@@ -16,7 +19,6 @@ onBeforeMount(() => {
// 获取分级列表
const getGradeListData = async () => {
console.log('调用了吗~~~');
tableInfo.value.loading = true;
const params = {
pageIndex: 1,
......@@ -111,7 +113,8 @@ const tableInfo = ref({
id: "data-class-standard-table",
multiple: true,
fields: [
{ label: "序号", field: 'orderNum', width: 56, align: "center" },
{ label: "序号", type: 'index', width: 56, align: "center" },
// { label: "排序", field: 'orderNum', width: 56, align: "center" },
{
label: "数据级别", field: "dataGrade", width: 120, getName: (scope) => {
let dataGrade = scope.row.dataGrade;
......@@ -124,7 +127,7 @@ const tableInfo = ref({
return classDataRef.value.find((item: any) => item.value === dataClassify)?.label;
}
},
{ label: "分级描述", field: "gradeDesc", align: "left", width: 480 },
{ label: "规则描述", field: "gradeDesc", align: "left" },
],
actionInfo: {
......@@ -137,7 +140,7 @@ const tableInfo = ref({
console.log(scope);
filterDataGradeEdit(scope.row.dataGrade);
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeStandardDialogInfo.value.title = '编辑分类';
newCreateGradeStandardDialogInfo.value.title = '编辑规则';
newCreateGradeFormItems.value.forEach(item => {
item.default = scope.row[item.field];
})
......@@ -228,7 +231,7 @@ const newCreateGradeFormItems = ref([{
visible: true,
},
{
label: '序号',
label: '序号',
type: 'input',
maxlength: 19,
placeholder: '请输入',
......@@ -239,10 +242,10 @@ const newCreateGradeFormItems = ref([{
regexp: /\D/g
},
{
label: '分级描述',
label: '规则描述',
type: 'textarea',
maxlength: 500,
placeholder: '分类分级的描述说明',
placeholder: '分级规则的描述说明',
field: 'gradeDesc',
default: '',
clearable: true,
......@@ -265,7 +268,7 @@ const newCreateGradeFormRules = ref({
const newCreateGradeStandardDialogInfo = ref({
visible: false,
size: 860,
title: "添加分类",
title: "新增规则",
type: "",
formInfo: {
id: "grade-form",
......@@ -278,9 +281,8 @@ const newCreateGradeStandardDialogInfo = ref({
newCreateGradeStandardDialogInfo.value.visible = false;
},
submit: async (btn, info) => {
console.log(info, guid);
newCreateGradeStandardDialogInfo.value.submitBtnLoading = true;
if (newCreateGradeStandardDialogInfo.value.title === '编辑分类') {
if (newCreateGradeStandardDialogInfo.value.title === '编辑规则') {
const params = {
...info,
guid: editClassifyGradeGuid.value,
......@@ -291,7 +293,7 @@ const newCreateGradeStandardDialogInfo = ref({
if (res.code == proxy.$passCode) {
proxy.$ElMessage({
type: 'success',
message: '修改分类成功'
message: '编辑规则成功'
})
getGradeListData();
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
......@@ -309,7 +311,7 @@ const newCreateGradeStandardDialogInfo = ref({
if (res.code == proxy.$passCode) {
proxy.$ElMessage({
type: 'success',
message: '新增分类成功'
message: '新增规则成功'
})
getGradeListData();
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
......@@ -324,22 +326,86 @@ const newCreateGradeStandardDialogInfo = ref({
const newStandard = () => {
filterDataGrade();
newCreateGradeStandardDialogInfo.value.title = '新增规则';
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeFormItems.value.forEach(item => item.default = '');
}
const formRef = ref<any>();
const classStandardFormItems = ref([{
label: '分级名称',
type: 'input',
maxlength: 50,
placeholder: '请输入',
field: 'name',
default: router.currentRoute.value.query.classClassifyGradName,
block: false,
clearable: true,
required: true
}]);
const saveLoading = ref(false);
const saveUpdate = async () => {
console.log(formRef.value.formInline);
if (!formRef.value.formInline.name) {
proxy.$ElMessage.error('分级名称不能为空');
return;
}
saveLoading.value = true;
const params = {
guid: router.currentRoute.value.query.guid,
name: formRef.value.formInline.name,
type: 'G',
}
console.log(params);
const res: any = await updateClassifyGrad(params);
if (res.code == proxy.$passCode) {
proxy.$ElMessage.success('修改分级成功');
router.push({
name: 'templateConfig'
});
saveLoading.value = false;
} else {
saveLoading.value = false;
proxy.$ElMessage.error(res.msg);
}
}
const cancel = () => {
proxy.$openMessageBox("当前页面尚未保存,确定放弃修改吗?", () => {
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.push({
name: 'templateConfig'
});
}, () => {
proxy.$ElMessage.info("已取消");
});
}
</script>
<template>
<div class="container_wrap" v-loading="fullscreenLoading">
<div class="container_wrap">
<div class="content_main">
<div class="table-top-btns">
<el-button type="primary" @click="newStandard">新增标准</el-button>
<el-button @click="batchRemobe">批量删除</el-button>
</div>
<Table ref="tableRef" :tableInfo="tableInfo" @tableSelectionChange="onTableSelectChange" />
<ContentWrap id="id-baseInfo" title="基础信息" description="" style="margin-top: 8px;">
<Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
</ContentWrap>
<ContentWrap id="id-grade-info" title="分级规则" class="detail-content" description="" style="margin-top: 8px;">
<div class="content" v-loading="fullscreenLoading">
<div class="table-top-btns">
<el-button type="primary" @click="newStandard">新增规则</el-button>
<el-button @click="batchRemobe">批量删除</el-button>
</div>
<Table ref="tableRef" :tableInfo="tableInfo" @tableSelectionChange="onTableSelectChange" />
</div>
</ContentWrap>
</div>
<div class="bottom_tool_wrap">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="saveUpdate" :loading="saveLoading">保存修改</el-button>
</div>
<Dialog_form :dialogConfigInfo="newCreateGradeStandardDialogInfo" />
</div>
......@@ -351,11 +417,49 @@ const newStandard = () => {
.content_main {
height: calc(100% - 44px);
padding: 17px 16px 10px 16px;
padding: 10px 16px;
overflow: auto;
.table-top-btns {
display: flex;
margin-bottom: 12px;
}
}
.bottom_tool_wrap {
height: 44px;
padding: 0 16px;
border-top: 1px solid #d9d9d9;
display: flex;
justify-content: center;
align-items: center;
}
:deep(.detail-content) {
.el-card__body {
height: calc(100% - 50px) !important;
.card-body-content {
height: 100%;
}
}
}
.tools_btns {
position: relative;
margin-bottom: 16px;
.show-change-btn {
position: absolute;
right: 0px;
}
}
.shape-main {
height: calc(100% - 40px);
}
.table_panel {
height: calc(100% - 40px) !important;
}
</style>
......
......@@ -6,7 +6,6 @@
import { ref } from "vue";
import router from "@/router";
import { getBizRuleConfigDetail, updateBizRuleConfig } from '@/api/modules/dataInventory'
const { proxy } = getCurrentInstance() as any;
const bizRuleConfigData = ref<any>()
const getBizRuleConfigDetailData = async () => {
......@@ -105,9 +104,25 @@ const moveDown = () => {
// 编辑行
const editRow = (row) => {
if (!row.isEdit) {
const [symbol, value] = row.fieldLengthCondition.split('#');
row.lengthSymbol = symbol; // 初始化符号部分
row.lengthValue = value; // 初始化数值部分
// 编辑fieldLengthCondition
if (row.fieldLengthCondition) {
const [symbol, value] = row.fieldLengthCondition.split('#');
row.lengthSymbol = symbol; // 初始化符号部分
row.lengthValue = value; // 初始化数值部分
} else {
row.lengthSymbol = ''; // 默认值
row.lengthValue = ''; // 默认值
}
//编辑fieldValueRange
if (row.fieldValueRange) {
const [start, end] = row.fieldValueRange.split('-');
row.rangeStart = start; // 初始化符号部分
row.rangeEnd = end; // 初始化数值部分
} else {
row.rangeStart = ''; // 默认值
row.rangeEnd = ''; // 默认值
}
row.isEdit = true; // 进入编辑模式
}
};
......@@ -115,6 +130,7 @@ const editRow = (row) => {
// 保存数据
const saveRow = (row) => {
row.fieldLengthCondition = `${row.lengthSymbol}#${row.lengthValue}`;
row.fieldValueRange = [row.rangeStart || '', row.rangeEnd || ''];
row.isEdit = false
}
......@@ -213,19 +229,23 @@ const saveData = async () => {
"isNotNull": "string",
"fieldValueRange": "string"
*/
const params = tableData.value.map((item: any) => {
return {
guid: item.guid,
const inParams = [] as any
tableData.value.forEach((item: any) => {
const obj = {
guid: router.currentRoute.value.query.tableGuid,
fieldGuid: item.fieldGuid,
fieldLengthCondition: item.fieldLengthCondition,
fieldPrecision: item.fieldPrecision,
dictionaryGuid: item.dictionaryGuid,
isUnique: item.isUnique,
isNotNull: item.isNotNull,
isNotNull: item.isRequired,
fieldValueRange: item.fieldValueRange
}
inParams.push(obj)
})
const res: any = await updateBizRuleConfig(params)
console.log('finalParams', inParams)
const res: any = await updateBizRuleConfig(inParams)
if (res.code === proxy.$passCode) {
proxy.$message.success('修改配置规则成功!')
router.back()
......@@ -270,29 +290,29 @@ const cancel = () => {
<!-- 排序列(不可编辑) -->
<el-table-column type="index" label="排序" width="80" align="center" />
<!-- 字段中文名(不可编辑)fieldChName -->
<el-table-column prop="fieldName" label="字段中文名" width="120">
<el-table-column prop="fieldChName" label="字段中文名" width="120">
<template #default="scope">
{{ scope.row.fieldName ? scope.row.fieldName : '--' }}
{{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
</template>
</el-table-column>
<!-- 字段英文名(不可编辑) -->
<el-table-column prop="fieldEnglish" label="字段英文名" width="120">
<el-table-column prop="fieldName" label="字段英文名" width="120">
<template #default="scope">
{{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }}
{{ scope.row.fieldName ? scope.row.fieldName : '--' }}
</template>
</el-table-column>
<!-- 分类(不可编辑)classifyName -->
<el-table-column prop="fieldEnglish" label="分类" width="120">
<!-- <el-table-column prop="fieldEnglish" label="分类" width="120">
<template #default="scope">
{{ scope.row.fieldEnglish ? scope.row.fieldEnglish : '--' }}
</template>
</el-table-column>
</el-table-column> -->
<!-- 分级(不可编辑) -->
<el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
<!-- <el-table-column prop="gradeDetailName" label="分级" width="120" align="center">
<template #default="scope">
{{ scope.row.gradeDetailName ? scope.row.gradeDetailName : '--' }}
</template>
</el-table-column>
</el-table-column> -->
<!-- 字段类型fieldType (不可编辑) -->
<el-table-column prop="fieldType" label="字段类型" width="150" align="center">
<template #default="scope">
......@@ -367,11 +387,20 @@ const cancel = () => {
</el-select>
</template>
</el-table-column>
<!-- 字段取值范围 fieldValueRange(可编辑)-->
<el-table-column prop="fieldValueRange" label="字段取值范围" width="150" align="center">
<el-table-column prop="fieldValueRange" label="字段取值范围" width="260" align="center">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.fieldValueRange ? scope.row.fieldValueRange : '--' }}</span>
<el-input v-else v-model="scope.row.fieldValueRange" placeholder="请输入字段取值范围" />
<!-- 非编辑模式,展示取值范围 -->
<span v-if="!scope.row.isEdit">
{{ scope.row.fieldValueRange ? scope.row.fieldValueRange.join('-') : '--' }}
</span>
<!-- 编辑模式,显示两个输入框 -->
<div v-else style="display: flex; gap: 5px; align-items: center;">
<el-input v-model="scope.row.rangeStart" placeholder="最小值" style="width: 45%;" type="number" />
<span>-</span>
<el-input v-model="scope.row.rangeEnd" placeholder="最大值" style="width: 45%;" type="number" />
</div>
</template>
</el-table-column>
......
......@@ -9,6 +9,7 @@ import { getLabelList, getClassifyGradeTreeList, saveLabel, getLabelPageList, de
import { CirclePlus, Delete } from "@element-plus/icons-vue";
const { proxy } = getCurrentInstance() as any;
const dialogLabelFormRef = ref();
......@@ -74,6 +75,7 @@ const transformDataForTree = (data: any[]) => {
const labelPageList = ref<any>()
const getLabelPageData = async () => {
refCount.value++;
tableInfo.value.loading = true;
const params = {
pageIndex: page.value.curr,
......@@ -111,7 +113,7 @@ const getLabelListData = async () => {
}
}
onMounted(async () => {
onBeforeMount(async () => {
await getClassifyGradeTree();
await getLabelPageData();
await getLabelListData();
......@@ -136,8 +138,46 @@ const treeInfo = ref<any>({
loading: false
});
// 点击树节点修改分类guid 和 分类明细guid
const nodeClick = (data: any) => {
console.log('nodeClick', data);
// 存储大类的数据。
const findNodeDetails = ref<any>('');
const isLastLayer = ref<boolean>(false);
// 所在层级的info
const atGradeinfo = ref<any>('');
const findTopParentNode = (node: any) => {
if (!node) return;
// 判断是否为最后一层
isLastLayer.value = node.childNodes.length === 0;
if (isLastLayer.value) {
atGradeinfo.value = node.data;
}
// 递归向上查找符合条件的祖先节点
const findCParent = (currentNode: any): any => {
if (!currentNode?.parent) return null; // 没有父节点,停止递归
if (currentNode.parent.data?.type === 'C') {
return currentNode.parent; // 找到符合条件的节点
}
return findCParent(currentNode.parent); // 继续向上查找
};
// 查找最接近的符合条件的祖先节点
const topParent = findCParent(node);
// 更新结果
if (topParent) {
findNodeDetails.value = topParent.data;
}
};
const nodeClick = (data, node) => {
findTopParentNode(node);
newCreateGradeFormItems.value[1].options = transformDataForTree([findNodeDetails.value])
// 分类guid
if (Object.keys(data).includes("type")) {
classifyGuid.value = data.guid;
......@@ -180,8 +220,13 @@ const tableInfo = ref({
fixedSelection: true,
fields: [
{ label: "序号", type: "index", width: 56, align: "center" },
{ label: "标签名", field: "label", type: 'text_btn', class: 'drawer-detail-cell', width: 120, value: 'detail', columClass: 'text_btn' },
{ label: "分类", field: "classifyDetailName", width: 140 },
{ label: "标签名", field: "label", type: 'text_btn', class: 'drawer-detail-cell', width: 160, value: 'detail', columClass: 'text_btn' },
{
label: "分类", field: "classifyNames", getName: (scope) => {
let tempInfo = scope.row.classifyNames;
return tempInfo.join('/')
},
},
{ label: "分级", field: "gradeDetailName", width: 140 },
{
label: '状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 100, align: 'center'
......@@ -280,7 +325,6 @@ const batchRemobe = async () => {
message: '已取消删除'
});
});
};
const tableSwitchBeforeChange = (scope, field, callback) => {
......@@ -410,7 +454,7 @@ const newCreateGradeFormItems = ref<any>([{
{
label: '精确匹配',
type: 'textarea',
maxlength: 500,
maxlength: 260,
placeholder: '请输入字段中文,中间用英文“,”分号隔开',
field: 'matchChValue',
default: '',
......@@ -421,7 +465,7 @@ const newCreateGradeFormItems = ref<any>([{
{
label: '',
type: 'textarea',
maxlength: 500,
maxlength: 260,
placeholder: '请输入字段中文,中间用英文“,”分号隔开',
field: 'matchEnValue',
default: '',
......@@ -459,7 +503,18 @@ const newCreateGradeStandardDialogInfo = ref({
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
},
submit: async (btn, info) => {
console.log(info);
for (let i = 0; i < formRows.value.length; i++) {
const row = formRows.value[i];
// 如果某一条数据的 matchValue, position, name 都为空,则跳过,不校验
if (!row.matchValue && !row.position && !row.name) {
continue; // 如果全为空,跳过这一行的校验
}
if (!row.matchValue || !row.position || !row.name) {
proxy.$ElMessage.error('请填写完整的模糊匹配规则');
return;
}
}
newCreateGradeStandardDialogInfo.value.submitBtnLoading = true;
if (newCreateGradeStandardDialogInfo.value.title === "添加标签") {
const tempParams = formRows.value.map((item) => ({
......@@ -482,6 +537,7 @@ const newCreateGradeStandardDialogInfo = ref({
getLabelPageData();
getLabelListData();
} else {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
proxy.$ElMessage.error(res.msg);
}
}
......@@ -508,6 +564,7 @@ const newCreateGradeStandardDialogInfo = ref({
getLabelPageData();
getLabelListData();
} else {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
proxy.$ElMessage.error(res.msg);
}
}
......@@ -516,30 +573,63 @@ const newCreateGradeStandardDialogInfo = ref({
})
// 新增标签
const addNewLabel = () => {
console.log('addNewLabel');
const addNewLabel = async () => {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
newCreateGradeFormItems.value.forEach(item => {
item.default = '';
item.disabled = false;
});
formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }];
//
if (isLastLayer.value) {
// 选择了最后一级
newCreateGradeFormItems.value[1].default = atGradeinfo.value.guid;
treeInfo.value.expandedKey = [];
treeInfo.value.currentNodeKey = atGradeinfo.value.guid;
treeInfo.value.expandedKey.push(atGradeinfo.value.classifyGradeGuid);
if (atGradeinfo.value?.classifyGradeGuid) {
classifyGuid.value = atGradeinfo.value.classifyGradeGuid;
tempName.value = atGradeinfo.value.name;
classifyDetailGuid.value = atGradeinfo.value.guid;
}
// 遍历classGradeTreeData 找到对应的guid item的refGradeGuid
classGradeTreeData.value.forEach((element: any) => {
if (element.guid === classifyGuid.value) {
tempRefGradeGuid.value = element.refGradeGuid;
}
});
if (tempRefGradeGuid.value) {
await getGradeListData(tempRefGradeGuid.value);
const matchedGrade = gradeListData.value.find(
(element: any) => element.name === tempName.value
);
if (matchedGrade) {
newCreateGradeFormItems.value[2].default = matchedGrade.guid;
}
}
}
newCreateGradeStandardDialogInfo.value.title = '添加标签';
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
}
const classSearchItemList = ref<any>([
{
type: 'select-slots',
type: 'select',
multiple: true,
label: '',
field: 'labelName',
default: [],
options: [],
placeholder: '请选择标签名称',
clearable: false,
clearable: true,
filterable: true,
visible: true
}
]);
......@@ -551,6 +641,7 @@ const selectChange = async (val: any, row: any) => {
};
/** 搜索查询分类标准 */
const refCount = ref(0);
const searchClass = async (val: any, clear: boolean = false) => {
console.log('searchClass', val, clear);
if (clear) {
......@@ -559,7 +650,7 @@ const searchClass = async (val: any, clear: boolean = false) => {
getLabelPageData();
return;
}
if (val?.labelName?.length !== 0) {
if (val?.labelName?.length !== 0 || refCount.value >= 1) {
tableInfo.value.loading = true;
const params = {
pageIndex: page.value.curr,
......@@ -579,7 +670,6 @@ const searchClass = async (val: any, clear: boolean = false) => {
}
}
};
......@@ -601,12 +691,13 @@ const handleSelectChange = async (val, row, info) => {
newCreateGradeFormItems.value[2].default = matchedGrade.guid;
newCreateGradeFormItems.value[0].default = tempFormData.value.label;
newCreateGradeFormItems.value[1].default = tempFormData.value.classifyDetailGuid;
newCreateGradeFormItems.value[3].default = tempFormData.value.matchChValue;
newCreateGradeFormItems.value[4].default = tempFormData.value.matchEnValue;
}
}
};
const handleTreeSelectNodeChange = (node, item, nodeObj) => {
console.log('handleTreeSelectNodeChange', node, item, nodeObj);
treeInfo.value.expandedKey = [];
treeInfo.value.currentNodeKey = node.guid;
treeInfo.value.expandedKey.push(node.classifyGradeGuid);
......@@ -702,8 +793,8 @@ const deleteRow = (index: number) => {
</div>
<div>
<el-button type="primary" class="v-add" @click="addNewLabel">新增</el-button>
<el-button class="v-import">导入</el-button>
<el-button>导出</el-button>
<!-- <el-button class="v-import">导入</el-button>
<el-button>导出</el-button> -->
</div>
<div class="table_panel_wrap">
<Table :tableInfo="tableInfo" @tableSwitchBeforeChange="tableSwitchBeforeChange"
......@@ -868,6 +959,11 @@ const deleteRow = (index: number) => {
line-height: 24px;
font-weight: 600;
}
.el-dialog__body {
height: 510px;
overflow: auto;
}
}
}
</style>
......
......@@ -196,13 +196,16 @@ const getPreviewData = () => {
const getTableStructure = () => {
let tableName = currDatasourceSelect.value.tableName;
console.log('tableName', currDatasourceSelect.value);
currDsTableStructureLoading.value = true;
currDsTableStructure.value = [];
getDsTableStructure({
tableName: tableName,
dataSourceGuid: databaseInfo.value.guid,
database: databaseInfo.value.databaseNameEn,
databaseType: databaseInfo.value.databaseType
// tableName: tableName,
// dataSourceGuid: databaseInfo.value.guid,
// database: databaseInfo.value.databaseNameEn,
// databaseType: databaseInfo.value.databaseType,
tableGuid: currDatasourceSelect.value.tableGuid,
execGuid: props.execGuid
}).then((res: any) => {
currDsTableStructureLoading.value = false;
if (res.code == proxy.$passCode) {
......@@ -318,7 +321,7 @@ watch(
if (val?.length && !currDatasourceSelect.value?.tableName) {
currDatasourceSelect.value = val[0];
}
emits("datasourceSelectedChange", val);
emits("datasourceSelectedChange", val, databaseGuid.value);
},
{
deep: true,
......
......@@ -57,9 +57,18 @@ const getClassifyGradListData = async () => {
}
//获取分类列表
const getClassListData = async () => {
const getClassListData = async (params = {}) => {
const inParams = {
type: 'C',
pageIndex: 1,
pageSize: -1
}
const finalParams = {
...inParams,
...params
}
classListDataLoading.value = true;
const res: any = await getClassifyGradList(refClassifyPageParams.value);
const res: any = await getClassifyGradList(finalParams);
if (res.code == proxy.$passCode) {
classListData.value = res.data.records || [];
classListDataLoading.value = false;
......@@ -70,7 +79,7 @@ const getClassListData = async () => {
onMounted(() => {
getClassifyGradListData();
getClassListData();
// getClassListData();
})
......@@ -108,24 +117,30 @@ const cardBtnVisible: any = ref(false);
/** 搜索查询分类标准 */
const searchClass = async (val: any, clear: boolean = false) => {
console.log(val, 'val');
if (clear) {
classSearchItemList.value.map(item => item.default = '')
getClassListData();
return;
}
const params = {
type: 'C',
name: val.classStandardName,
pageIndex: 1,
pageSize: -1
}
const res: any = await getClassifyGradList(params);
if (res.code == proxy.$passCode) {
classListData.value = res.data.records || [];
} else {
proxy.$ElMessage.error(res.msg);
}
// const params = {
// type: 'C',
// name: val.classStandardName,
// pageIndex: 1,
// pageSize: -1
// }
// const res: any = await getClassifyGradList(params);
// if (res.code == proxy.$passCode) {
// classListData.value = res.data.records || [];
// } else {
// proxy.$ElMessage.error(res.msg);
// }
getClassListData(
{
name: val.classStandardName
}
);
};
/** 编辑分类 */
......@@ -149,6 +164,7 @@ const handleClassDataEdit = (params) => {
// 配置分类
const handleClassDataClick = (item, des = '') => {
console.log(item, 'i111tem');
// 获取分级标准
router.push({
name: 'classStandardEdit',
......@@ -156,7 +172,9 @@ const handleClassDataClick = (item, des = '') => {
guid: item.guid,
type: des === '' ? '配置' : des,
classStandardName: item.name,
refGradeGuid: item.refGradeGuid
refGradeGuid: item.refGradeGuid,
description: item.description,
isExpand: item.isExpand || false
}
});
}
......@@ -229,7 +247,7 @@ const classStandardFormItems = ref([{
const classStandardFormRules = ref({
classStandardName: [required('请填写分类名称')],
gradeStandard: [required('请选择分级标准')]
refGradeGuid: [required('请选择分级标准')]
});
const newCreateClassStandardDialogInfo = ref({
......@@ -248,6 +266,7 @@ const newCreateClassStandardDialogInfo = ref({
newCreateClassStandardDialogInfo.value.visible = false;
},
submit: async (btn, info) => {
if (newCreateClassStandardDialogInfo.value.title === '新增分类') {
newCreateClassStandardDialogInfo.value.submitBtnLoading = true;
const params = {
......@@ -263,9 +282,26 @@ const newCreateClassStandardDialogInfo = ref({
type: 'success',
message: '新增分类成功'
})
nextTick(() => {
// 拿到新增的分类数据,跳转到配置页面
const item = classListData.value.find(item => item.name === info.classStandardName);
console.log(item, 'item---------------');
if (item) {
const params = {
name: item.name,
guid: item.guid,
refGradeGuid: item.refGradeGuid,
description: item.description,
isExpand: true
}
handleClassDataClick(params, '');
}
})
newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
newCreateClassStandardDialogInfo.value.visible = false;
} else {
newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
proxy.$ElMessage.error(res.msg);
}
} else {
......@@ -293,6 +329,7 @@ const newCreateClassStandardDialogInfo = ref({
})
const newCreateClass = () => {
newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
newCreateClassStandardDialogInfo.value.visible = true;
classStandardFormItems.value.forEach(item => item.default = '');
}
......@@ -343,12 +380,10 @@ const newCreateGradeStandardDialogInfo = ref({
await getClassifyGradListData();
proxy.$ElMessage({
type: 'success',
message: '新增分成功'
message: '新增分成功'
})
// 拿到新增的分级数据,跳转到配置页面
const item = classifyGradListData.value.find(item => item.name === info.name);
if (item) {
const params = {
name: item.name,
......@@ -359,6 +394,7 @@ const newCreateGradeStandardDialogInfo = ref({
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
newCreateGradeStandardDialogInfo.value.visible = false;
} else {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
proxy.$ElMessage.error(res.msg);
}
} else {
......@@ -372,7 +408,7 @@ const newCreateGradeStandardDialogInfo = ref({
getClassifyGradListData();
proxy.$ElMessage({
type: 'success',
message: '修改分成功'
message: '修改分成功'
})
newCreateGradeStandardDialogInfo.value.visible = false;
} else {
......@@ -437,6 +473,7 @@ const handleClassifyGradDataClick = (item) => {
}
const newCreateGrade = () => {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeFormItems.value.forEach(item => item.default = '');
}
......@@ -538,8 +575,8 @@ const newCreateGrade = () => {
</el-icon>
</template>
<div class="levitation-ul">
<span class="levitation-li" @click="handleClassDataClick(item)">配置</span>
<span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span>
<span class="levitation-li" @click="handleClassDataClick(item)">编辑</span>
<!-- <span class="levitation-li" @click="handleClassDataEdit(item)">编辑</span> -->
<span class="levitation-li" @click="handleClassDataDel(item)">删除</span>
</div>
</el-popover>
......@@ -571,8 +608,8 @@ const newCreateGrade = () => {
</el-icon>
</template>
<div class="levitation-ul">
<span class="levitation-li" @click="handleClassifyGradDataClick(item)">配置</span>
<span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span>
<span class="levitation-li" @click="handleClassifyGradDataClick(item)">编辑</span>
<!-- <span class="levitation-li" @click="handleClassifyGradDataEdit(item)">编辑</span> -->
<span class="levitation-li" @click="handleClassifyGradDataDel(item)">删除</span>
</div>
</el-popover>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!