cf478289 by xukangle

fix : 修改分类分级和标签管理问题

1 parent 7166760b
......@@ -603,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
})
......
......@@ -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" />
......
......@@ -82,7 +82,7 @@ const routes: RouteRecordRaw[] = [
name: 'templateConfig',
component: () => import('@/views/data_inventory/templateConfig.vue'),
meta: {
title: '分类分级标准',
title: '分类分级规则',
breadcrumb: false,
cache: true
},
......
......@@ -42,7 +42,7 @@ const classStandardFormItems = ref([{
// clearable: true,
// disabled: false,
// visible: true,
label: '分级标准',
label: '分级名称',
type: 'select',
placeholder: '请选择',
field: 'gradeStandard',
......@@ -83,7 +83,7 @@ const tableInfo = ref({
multiple: false,
fields: [
{ label: "序号", type: "index", width: 56, align: "center" },
{ label: "分类", field: "classifyName", width: 160, type: 'expand' },
{ label: "规则名称", field: "classifyName", width: 160, type: 'expand' },
{
label: "层级", field: "level", width: 120, getName: (scope) => {
let level = scope.row.level;
......@@ -121,7 +121,7 @@ const tableInfo = ref({
selectParentEdit(scope.row.guid);
currTableInfo.value = scope.row;
drawerInfo.value.visible = true;
drawerInfo.value.header.title = '编辑分类';
drawerInfo.value.header.title = '编辑规则';
classEditFormItems.value.forEach(item => {
item.default = scope.row[item.field]
})
......@@ -210,7 +210,7 @@ const classEditFormItems = ref([{
}, {
label: '定义说明',
type: 'textarea',
placeholder: '请输入',
placeholder: '分类规则的描述说明',
field: 'description',
default: '',
clearable: true,
......@@ -305,7 +305,7 @@ const drawerInfo = ref({
direction: 'rtl',
size: 600,
header: {
title: '添加分类',
title: '添加规则',
},
type: '',
container: {
......@@ -324,7 +324,7 @@ const drawerBtnClick = async (btn, info) => {
if (btn.value == 'cancel') {
drawerInfo.value.visible = false;
} else {
if (drawerInfo.value.header.title == '添加分类') {
if (drawerInfo.value.header.title == '添加规则') {
drawerInfo.value.footer.btns.map((item: any) => (item.disabled = true));
const params = {
...info,
......@@ -332,7 +332,7 @@ const drawerBtnClick = async (btn, info) => {
}
const res: any = await saveClassify(params);
if (res.code == proxy.$passCode) {
proxy.$ElMessage.success('添加成功!');
proxy.$ElMessage.success('添加规则成功!');
drawerInfo.value.visible = false;
getTreeListData();
drawerInfo.value.footer.btns.map((item: any) => delete item.disabled);
......@@ -351,7 +351,7 @@ const drawerBtnClick = async (btn, info) => {
}
const res: any = await updateClassify(params);
if (res.code == proxy.$passCode) {
proxy.$ElMessage.success('修改成功!');
proxy.$ElMessage.success('编辑规则成功!');
drawerInfo.value.visible = false;
drawerInfo.value.footer.btns.map((item: any) => delete item.disabled);
getTreeListData();
......@@ -462,7 +462,7 @@ const newCreateClass = () => {
drawerInfo.value.visible = true;
classEditFormItems.value[2].options = treeListData.value;
drawerInfo.value.header.title = '添加分类';
drawerInfo.value.header.title = '添加规则';
classEditFormItems.value.forEach(item => {
if (item.field == 'status') {
item.default = 'Y';
......@@ -481,7 +481,7 @@ const saveUpdate = async () => {
return;
}
if (!formRef.value.formInline.gradeStandard) {
proxy.$ElMessage.error('分级标准不能为空');
proxy.$ElMessage.error('分级名称不能为空');
return;
}
saveLoading.value = true;
......@@ -495,7 +495,7 @@ const saveUpdate = async () => {
console.log(params);
const res: any = await updateClassifyGrad(params);
if (res.code == proxy.$passCode) {
proxy.$ElMessage.success('修改成功');
proxy.$ElMessage.success('修改分类成功');
router.push({
name: 'templateConfig'
});
......@@ -512,9 +512,21 @@ const importClass = () => {
}
const dataShowMethod = ref('table');
// 创建聚合数据
const updatedTreeData = ref<any>();
/** 切换是图形展示,还是表格展示。 */
const changeShowMethod = () => {
dataShowMethod.value = dataShowMethod.value == 'table' ? 'shape' : 'table';
console.log(shapeTreeListData.value);
if (dataShowMethod.value == 'shape') {
const tempArr = {
classifyName: router.currentRoute.value.query.classStandardName,
guid: "1",
children: shapeTreeListData.value
}
updatedTreeData.value = [tempArr];
console.log('updatedTreeData', [tempArr]);
}
}
const cancel = () => {
......@@ -679,10 +691,11 @@ const initGraph = () => {
},
}
});
graph.data(shapeTreeListData.value[0]);
graph.data(updatedTreeData.value[0]);
graph.on('node:mouseenter', (e) => {
const nodeItem = e.item; // 获取鼠标进入的节点元素对象
const nodeModel = nodeItem.getModel();
if (nodeModel.guid == '1') return; // 根节点不显示
// 更新弹窗位置和显示节点详情
nodeDetails.value = nodeModel;
showNodeDetails.value = true;
......@@ -804,7 +817,6 @@ onMounted(() => {
const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true');
</script>
<template>
......@@ -814,10 +826,10 @@ const isExpand = ref<boolean>(router.currentRoute.value.query.isExpand == 'true'
:isExpand="isExpand">
<Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
</ContentWrap>
<ContentWrap id="id-classStandard" class="detail-content" title="分类标准" description=""
<ContentWrap id="id-classStandard" class="detail-content" title="分类规则" description=""
style="margin-top:16px; height: calc(100% - 161px)">
<div class="tools_btns">
<el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加分类</el-button>
<el-button v-show="dataShowMethod == 'table'" type="primary" @click="newCreateClass">添加规则</el-button>
<!-- <el-button v-show="dataShowMethod == 'table'" @click="importClass">导入分类</el-button> -->
<el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button>
</div>
......
......@@ -127,7 +127,7 @@ const tableInfo = ref({
return classDataRef.value.find((item: any) => item.value === dataClassify)?.label;
}
},
{ label: "分级描述", field: "gradeDesc", align: "left" },
{ label: "规则描述", field: "gradeDesc", align: "left" },
],
actionInfo: {
......@@ -242,10 +242,10 @@ const newCreateGradeFormItems = ref([{
regexp: /\D/g
},
{
label: '分级描述',
label: '规则描述',
type: 'textarea',
maxlength: 500,
placeholder: '分类分级的描述说明',
placeholder: '分级规则的描述说明',
field: 'gradeDesc',
default: '',
clearable: true,
......@@ -326,6 +326,7 @@ const newCreateGradeStandardDialogInfo = ref({
const newStandard = () => {
filterDataGrade();
newCreateGradeStandardDialogInfo.value.title = '新增标准';
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeFormItems.value.forEach(item => item.default = '');
}
......@@ -362,7 +363,7 @@ const saveUpdate = async () => {
console.log(params);
const res: any = await updateClassifyGrad(params);
if (res.code == proxy.$passCode) {
proxy.$ElMessage.success('修改成功');
proxy.$ElMessage.success('修改分级成功');
router.push({
name: 'templateConfig'
});
......@@ -392,7 +393,7 @@ const cancel = () => {
<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;">
<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>
......
......@@ -7,7 +7,9 @@ import { Warning } from "@element-plus/icons-vue";
import TableTools from '@/components/Tools/table_tools.vue';
import {
getCgDirTreeList, getCgDirFieldPageList, getDictionary, saveBizRuleConfig,
getDbDirTreeList, getDbDirTablePageList, getDbDirFieldPageList, getExecGuidAndName
getDbDirTreeList, getDbDirTablePageList, getDbDirFieldPageList, getExecGuidAndName,
getClassifyTreeList, getCgLabelPageList, execTaskFieldList, execTaskSheetList, getTaskExeTreeList,
getDbFieldList
} from '@/api/modules/dataInventory';
import { TableColumnWidth } from "@/utils/enum";
import router from "@/router";
......@@ -20,15 +22,16 @@ const CgDirTreeList = ref();
const getCgDirTreeData = async () => {
treeInfo.value.loading = true;
const params = {
classifyName: '',
execGuid: execGuidInfo.value.execGuid
}
const res: any = await getCgDirTreeList(params);
const res: any = await getTaskExeTreeList(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;
searchItemList.value[1].options = res.data;
treeInfo.value.loading = false;
} else {
proxy.$ElMessage.error(res.msg);
......@@ -41,18 +44,16 @@ const getCgDirFieldPage = async (params = {}) => {
// 在这里你可以根据需要扩展或修改 params
const defaultParams = {
pageIndex: 1,
pageSize: 10,
dirGuid: '',
label: '',
fieldName: '',
classifyName: '',
gradeDetailName: '',
tableName: '',
database: '',
dirGuids: [],
pageSize: 50,
execGuid: '',
classifyDetail: '',
gradeDetailGuid: '',
databaseGuid: '',
tableGuid: '',
fieldGuid: '',
};
const finalParams = { ...defaultParams, ...params };
const res: any = await getCgDirFieldPageList(finalParams);
const res: any = await execTaskFieldList(finalParams);
if (res.code == proxy.$passCode) {
CgDirFieldPageList.value = res.data.records;
tableInfo.value.page.rows = res.data.totalRows;
......@@ -90,15 +91,15 @@ const getExecGuid = async () => {
}
//
onMounted(() => {
getCgDirTreeData();
getCgDirFieldPage();
onMounted(async () => {
await getExecGuid();
await getCgDirTreeData();
await getCgDirFieldPage({
execGuid: execGuidInfo.value.execGuid
});
getDictionaryList();
getExecGuid();
getSearchTableList();
})
// 左侧tree-list
......@@ -108,12 +109,12 @@ const treeInfo = ref({
editTreeItem: false,
queryValue: "",
className: 'tree-list',
queryPlaceholder: "输入标准集名称搜索",
queryPlaceholder: "输入名称搜索",
props: {
label: "classifyName",
value: "guid",
value: "classifyDetailGuid",
},
nodeKey: 'guid',
nodeKey: 'classifyDetailGuid',
expandedKey: ['0'],
currentNodeKey: '',
expandOnNodeClick: false,
......@@ -121,6 +122,7 @@ const treeInfo = ref({
loading: false
});
const addStandardSet = () => {
console.log('addStandardSet');
}
......@@ -143,33 +145,24 @@ const searchItemList = ref([
},
clearable: true,
},
// {
// label: '字段名',
// type: 'select',
// maxlength: 19,
// placeholder: '选择字段名',
// field: 'fieldName',
// default: '',
// options: [],
// props: {
// label: 'name',
// value: 'guid',
// },
// clearable: true,
// },
{
label: '分类',
type: 'select',
maxlength: 19,
placeholder: '选择分类',
label: "",
placeholder: '分类',
field: 'classifyName',
type: 'tree-select',
default: '',
options: [],
showAllLevels: false,
checkStrictly: true,
lazy: false,
props: {
label: 'name',
value: 'guid',
label: "classifyName",
value: "classifyDetailGuid",
},
clearable: true,
block: false,
filterable: false,
clearable: false,
required: false
}, {
label: '分级',
type: 'select',
......@@ -203,8 +196,14 @@ const toSearch = (val: any, clear: boolean = false) => {
// return getTableData(params);
};
const nodeClick = (data: any) => {
const { guid, classifyName } = data
const nodeClick = async (data: any) => {
console.log('nodeClick', data);
const { guid, classifyDetailGuid } = data
searchItemList.value[1].default = data.classifyName;
await getCgDirFieldPage({
execGuid: execGuidInfo.value.execGuid,
classifyDetail: classifyDetailGuid,
});
// 递归tempData找到所有祖先元素的standardName,存入currentPath中
const path = findPath(CgDirTreeList.value, guid);
if (path) {
......@@ -214,6 +213,7 @@ const nodeClick = (data: any) => {
console.error('未找到路径');
}
}
const findPath = (data: any[], targetGuid: string, path: string[] = []) => {
for (const item of data) {
path.push(item.classifyName); // 添加当前节点名称
......@@ -296,7 +296,7 @@ const tableCheckboxSelectChange = (select, row) => {
let rulesName: any = [];
let rulesGuid: any = [];
select.forEach((item: any) => {
rulesName.push(item.classifyName);
rulesName.push(item.fieldName);
rulesGuid.push(item.guid);
});
selectedRulesData.value = {
......@@ -309,7 +309,7 @@ const tableCheckboxAllSelectChange = (select) => {
let rulesName: any = [];
let rulesGuid: any = [];
select.forEach((item: any) => {
rulesName.push(item.classifyName);
rulesName.push(item.fieldName);
rulesGuid.push(item.guid);
});
selectedRulesData.value = {
......@@ -603,17 +603,31 @@ const drawerBtnClick = async (btn, info) => {
proxy.$ElMessage.error('字段取值范围结束值不能小于开始值');
return;
}
fieldValueRange = [numberStart, numberEnd];
}
const params = {
fieldPrecision,
dictionaryGuid,
isUnique,
isNotNull,
fieldLengthCondition,
fieldValueRange,
fieldGuid: selectedRulesData.value.guids
fieldValueRange = numberStart + '#' + numberEnd;
}
const params: any = [];
selectedRulesData.value.guids.forEach((item: any) => {
params.push({
fieldPrecision,
dictionaryGuid,
isUnique,
isNotNull,
fieldLengthCondition,
fieldValueRange,
fieldGuid: item,
execGuid: execGuidInfo.value.execGuid
})
});
// const params = {
// fieldPrecision,
// dictionaryGuid,
// isUnique,
// isNotNull,
// fieldLengthCondition,
// fieldValueRange,
// fieldGuid: selectedRulesData.value.guids,
// execGuid: execGuidInfo.value.execGuid
// }
const res: any = await saveBizRuleConfig(params);
if (res.code == proxy.$passCode) {
btn.loading = false;
......@@ -621,6 +635,7 @@ const drawerBtnClick = async (btn, info) => {
drawerInfo.value.visible = false;
getCgDirFieldPage();
} else {
btn.loading = false;
proxy.$ElMessage.error(res.msg);
}
......@@ -880,53 +895,27 @@ const setActiveTab = (tab) => {
};
// 模拟后端接口
const fetchOptionsA = () => {
return new Promise((resolve) => {
setTimeout(() => {
resolve([
{ label: "选项 A1", value: "a1" },
{ label: "选项 A2", value: "a2" },
]);
}, 500);
});
};
// 获取查询的数据库名 execTaskSheetList
const fetchOptionsB = (aValue) => {
return new Promise((resolve) => {
setTimeout(() => {
const data = {
a1: [
{ label: "B1-1", value: "b1" },
{ label: "B1-2", value: "b2" },
],
a2: [
{ label: "B2-1", value: "b3" },
{ label: "B2-2", value: "b4" },
],
};
resolve(data[aValue] || []);
}, 500);
});
};
const getSearchTableList = async (type = 1, dbGuid = '') => {
const fetchOptionsC = (bValue) => {
return new Promise((resolve) => {
setTimeout(() => {
const data = {
b1: [
{ label: "C1-1", value: "c1" },
{ label: "C1-2", value: "c2" },
],
b3: [
{ label: "C2-1", value: "c3" },
{ label: "C2-2", value: "c4" },
],
};
resolve(data[bValue] || []);
}, 500);
const res: any = await getDbFieldList({
execGuid: execGuidInfo.value.execGuid,
dbGuid,
type,
});
if (res.code == proxy.$passCode) {
if (type == 1) {
optionsA.value = res.data;
} else if (type == 2) {
optionsB.value = res.data;
} else {
optionsC.value = res.data;
}
} else {
proxy.$ElMessage.error(res.msg);
}
};
const selectedA = ref<any>(null);
const selectedB = ref<any>(null);
const selectedC = ref<any>(null);
......@@ -935,29 +924,33 @@ const optionsA = ref<any>([]);
const optionsB = ref<any>([]);
const optionsC = ref<any>([]);
// 初始化加载第一个下拉框的选项
const loadOptionsA = async () => {
optionsA.value = await fetchOptionsA();
};
// 第一个下拉框值改变时
const onAChange = async () => {
selectedB.value = null;
selectedC.value = null;
optionsB.value = [];
optionsC.value = [];
optionsB.value = await fetchOptionsB(selectedA.value); // 根据 A 动态加载 B 的选项
await getSearchTableList(2, selectedA.value); // 根据 A 动态加载 B 的选项
};
// 第二个下拉框值改变时
const onBChange = async () => {
console.log('onBChange', selectedB.value);
selectedC.value = null;
optionsC.value = [];
optionsC.value = await fetchOptionsC(selectedB.value); // 根据 B 动态加载 C 的选项
await getSearchTableList(3, selectedB.value); // 根据 B 动态加载 C 的选项
};
// 导出
const btnClick = async () => {
};
// 页面加载时初始化 A 的数据
loadOptionsA();
// 分类选择
const treeSelectNodeChange = (node, item) => {
console.log('treeSelectNodeChange', node, item);
}
</script>
......@@ -966,23 +959,25 @@ loadOptionsA();
<div class="v-table-tools">
<el-select v-model="selectedA" placeholder="选择数据库名" @change="onAChange" style="width: 140px; margin-right: 8px"
clearable>
<el-option v-for="item in optionsA" :key="item.value" :label="item.label" :value="item.value" />
<el-option v-for="item in optionsA" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
</el-select>
<el-select v-model="selectedB" placeholder="选择表名" :disabled="!selectedA" @change="onBChange"
style="width: 140px; margin-right: 8px" clearable>
<el-option v-for="item in optionsB" :key="item.value" :label="item.label" :value="item.value" />
<el-option v-for="item in optionsB" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
</el-select>
<el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px"
clearable>
<el-option v-for="item in optionsC" :key="item.value" :label="item.label" :value="item.value" />
<el-option v-for="item in optionsC" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
</el-select>
<TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch" />
<TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch"
@treeSelectNodeChange="treeSelectNodeChange" />
</div>
<div class="container_wrap full flex">
<div class="aside_wrap">
<el-tabs v-model="activeName" class="v-tabs" @tab-click="handleClick">
<el-tab-pane label="分类分级目录" name="first">
<Tree :treeInfo="treeInfo" @nodeClick="nodeClick" @itemMenuClick="handleTreeItemMenuClick" />
<!-- <Tree ref="treeInfoRef" :treeInfo="treeInfo" @nodeClick="nodeClick" /> -->
</el-tab-pane>
<el-tab-pane label="数据库目录" name="second">
<Tree :treeInfo="dataBaseTreeInfo" @nodeClick="dataBasenodeClick" @nodeSelectChange='nodeSelectChange' />
......@@ -1012,7 +1007,7 @@ loadOptionsA();
<div class="btns-area">
<div class="left-btns">
<el-button type="primary" @click="addStandardSet">查看已生产报告</el-button>
<el-button>导出</el-button>
<el-button @click="btnClick()">导出</el-button>
<el-button @click="batchControlRules">批量配置业务规则</el-button>
</div>
</div>
......
......@@ -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,45 @@ 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;
// 判断是否为最后一层
if (node.childNodes.length === 0) {
isLastLayer.value = true;
atGradeinfo.value = node.data;
} else {
isLastLayer.value = false;
}
// 如果当前节点的父节点符合条件
if (node.parent && node.parent.data.type === 'C') {
findNodeDetails.value = node.parent.data;
return; // 停止递归
}
// 如果当前节点的祖父节点符合条件
if (node.parent?.parent && node.parent.parent.data.type === 'C') {
findNodeDetails.value = node.parent.parent.data;
return; // 停止递归
}
// 如果未找到,继续递归向上查找
if (node.parent) {
findTopParentNode(node.parent);
}
};
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 +219,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 +324,6 @@ const batchRemobe = async () => {
message: '已取消删除'
});
});
};
const tableSwitchBeforeChange = (scope, field, callback) => {
......@@ -410,7 +453,7 @@ const newCreateGradeFormItems = ref<any>([{
{
label: '精确匹配',
type: 'textarea',
maxlength: 500,
maxlength: 260,
placeholder: '请输入字段中文,中间用英文“,”分号隔开',
field: 'matchChValue',
default: '',
......@@ -421,7 +464,7 @@ const newCreateGradeFormItems = ref<any>([{
{
label: '',
type: 'textarea',
maxlength: 500,
maxlength: 260,
placeholder: '请输入字段中文,中间用英文“,”分号隔开',
field: 'matchEnValue',
default: '',
......@@ -459,7 +502,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 +536,7 @@ const newCreateGradeStandardDialogInfo = ref({
getLabelPageData();
getLabelListData();
} else {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
proxy.$ElMessage.error(res.msg);
}
}
......@@ -508,6 +563,7 @@ const newCreateGradeStandardDialogInfo = ref({
getLabelPageData();
getLabelListData();
} else {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
proxy.$ElMessage.error(res.msg);
}
}
......@@ -516,30 +572,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 +640,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 +649,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 +669,6 @@ const searchClass = async (val: any, clear: boolean = false) => {
}
}
};
......@@ -601,12 +690,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 +792,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 +958,11 @@ const deleteRow = (index: number) => {
line-height: 24px;
font-weight: 600;
}
.el-dialog__body {
height: 510px;
overflow: auto;
}
}
}
</style>
......
......@@ -96,7 +96,7 @@ const getFieldTypeData = async () => {
}
const res: any = await getFieldTypeList(params);
if (res.code == proxy.$passCode) {
fieldData.value = options;
fieldData.value = res.data;
} else {
proxy.$ElMessage.error(res.msg);
}
......@@ -253,6 +253,8 @@ const editableFields = {
gradeDetailName: true, // 分级可编辑
sourceFieldName: true, // 源字段英文名可编辑
classifyDetailGuid: true, // 分类可编辑
fieldType: true, // 字段类型可编辑
fieldChName: true, // 字段中文名可编辑
}
const tableFieldsLoading = ref(false)
......@@ -542,7 +544,6 @@ const saveOrUpdate = async (params: any = {}, type) => {
database: '',
databaseChName: '',
foundMode: 0,
state: 0,
isDraft: '',
fieldRQVOList: tableDataDetailInfo.value
}
......@@ -716,16 +717,24 @@ const createNewSql = () => {
<el-table-column type="selection" :width="32" align="center" />
<!-- 排序列(不可编辑) -->
<el-table-column type="index" label="排序" width="80" align="center" />
<!-- 字段中文名(可编辑)fieldChName -->
<!-- 字段中文名(可编辑)fieldChName -->
<el-table-column prop="fieldChName" label="目标字段中文名" width="150">
<!-- 可以编辑 -->
<template #default="scope">
{{ scope.row.fieldChName ? scope.row.fieldChName : '--' }}
<span v-if="!scope.row.isEdit || !editableFields.fieldChName">{{ scope.row.fieldChName ?
scope.row.fieldChName
: '--' }}</span>
<el-input v-else v-model="scope.row.fieldChName" placeholder="请输入" />
</template>
</el-table-column>
<!-- 字段英文名(可编辑) -->
<!-- 字段英文名(可编辑) -->
<el-table-column prop="fieldName" label="目标字段英文名" width="150">
<template #default="scope">
{{ scope.row.fieldName ? scope.row.fieldName : '--' }}
<span v-if="!scope.row.isEdit || !editableFields.fieldName">{{ scope.row.fieldName ?
scope.row.fieldName
: '--' }}</span>
<el-input v-else v-model="scope.row.fieldName" placeholder="请输入" />
</template>
</el-table-column>
<!-- 源数据库 -->
......@@ -756,10 +765,19 @@ const createNewSql = () => {
<el-input v-else v-model="scope.row.sourceFieldName" placeholder="请输入长度" />
</template>
</el-table-column>
<!-- 源端字段 fieldType-->
<!-- 源端字段 fieldType fieldTypeProps-->
<el-table-column prop="fieldType" label="源端字段类型" width="150">
<template #default="scope">
{{ scope.row.fieldType ? scope.row.fieldType : '--' }}
<div v-if="scope.row.isEdit">
<el-select v-model="scope.row.fieldType" placeholder="选择类型" clearable filterable
:props="fieldTypeProps">
<el-option v-for="(item, index) in fieldData" :key="index" :label="item.label"
:value="item.value"></el-option>
</el-select>
</div>
<div v-else>
{{ fieldData.find(item => item.value === scope.row.fieldType)?.label || '--' }}
</div>
</template>
</el-table-column>
......
......@@ -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
}
);
};
/** 编辑分类 */
......@@ -232,7 +247,7 @@ const classStandardFormItems = ref([{
const classStandardFormRules = ref({
classStandardName: [required('请填写分类名称')],
gradeStandard: [required('请选择分级标准')]
refGradeGuid: [required('请选择分级标准')]
});
const newCreateClassStandardDialogInfo = ref({
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!