51a32b6b by xukangle

fix : 标签管理相关问题

1 parent 82a6de26
......@@ -175,7 +175,7 @@ export const getLargeCategoryList = (params) => request({
/**
* 获取字段类型
*/
export const getFieldTypeList = (params) => request({
export const getNewDataTypeList = (params) => request({
url: `${import.meta.env.VITE_APP_CONFIG_URL}/dict/data/get-by-dictType?dictType=${params.dictType}`,
method: 'get',
})
......@@ -740,6 +740,36 @@ export const createTableSql = (data) => request({
data
})
/**
* 导出分类分级目录列表
* @param {no params}
* @path /cg-dir/export
*/
export const exportCgDir = () => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/cg-dir/export`,
method: 'post',
})
/**
* 数据库目录导出
* @param {no params}
* @path /db-dir/table/export
*/
export const exportDbDirTable = () => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/table/export`,
method: 'post',
})
/**
* 数据库目录详情
* @param {query}
* @path /db-dir/detail
*
*/
export const getDbDirDetail = (params) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/detail?guid=${params.tableGuid}`,
method: 'get',
})
......@@ -756,14 +786,17 @@ export const getBizRuleConfigDetail = (params) => request({
method: 'get',
})
/**-----------------根据文件新建表-------------------------------------- */
/**
* 业务规则配置-修改
* 根据字段中文名解析字段英文名
* @param {Object}
* @path /biz-rule-config/update
* @returns
* @path /db-dir/field/get-field-en-name
*/
export const updateBizRuleConfig = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/biz-rule-config/update`,
export const getFidldEnName = (data) => request({
url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/get-field-en-name`,
method: 'post',
data
})
......
......@@ -554,7 +554,7 @@ const panelChange = (scope, row) => {
required_mark: item.required,
}">{{
item.label
}}</span>
}}</span>
</span>
<div class="header_title_tooltip" style="width: auto" v-if="item.tooltip">
......@@ -647,7 +647,7 @@ const panelChange = (scope, row) => {
<div class="item_panel" :class="{ is_block: panel.block }" v-for="panel in item.children">
<label :class="{ required_mark: panel.required }">{{
panel.label
}}</label>
}}</label>
<el-checkbox v-if="panel.type == 'checkbox'" v-model="formInline[panel.field]"
:disabled="panel.disabled || readonly" :true-label="panel.trueValue ?? true"
:false-label="panel.falseValue ?? false">{{ panel.placeholder }}</el-checkbox>
......@@ -730,7 +730,7 @@ const panelChange = (scope, row) => {
<span class="item-label" slot="label">
<span v-if="child.label" :class="{ required_mark: child.required }">{{
child.label
}}</span>
}}</span>
</span>
<el-select v-if="child.type == 'select'" v-model="formInline[child.field]"
:placeholder="child.placeholder" :disabled="child.disabled || readonly" :filterable="child.filterable"
......@@ -789,7 +789,7 @@ const panelChange = (scope, row) => {
<span class="item-label" slot="label">
<span :class="{ required_mark: child.required }">{{
child.label
}}</span>
}}</span>
</span>
<el-cascader v-if="child.type == 'cascader'" v-model="formInline[child.field]" :props="child.props"
:options="child.options" :show-all-levels="child.showAllLevels ?? true"
......@@ -832,7 +832,7 @@ const panelChange = (scope, row) => {
<div class="item_panel" v-for="child in item.children">
<label :class="{ required_mark: child.required }">{{
child.label
}}</label>
}}</label>
<div class="tool_item">
<el-select v-model="formInline[child.field]" :class="{ is_block: child.block }"
:placeholder="child.placeholder" :multiple="child.multiple" :collapse-tags="child.collapse"
......@@ -907,7 +907,7 @@ const panelChange = (scope, row) => {
<span class="item-label" slot="label">
<span :class="{ required_mark: child.required }">{{
child.label
}}</span>
}}</span>
</span>
<el-input :class="[child.col, { is_block: child.block }]" v-model="formInline[child.field]"
:rows="child.rows ?? 4" type="textarea" :placeholder="child.placeholder"
......@@ -964,7 +964,7 @@ const panelChange = (scope, row) => {
<span class="item-label" slot="label">
<span :class="{ required_mark: child.required }">{{
child.label
}}</span>
}}</span>
</span>
<div class="input_group" :class="[child.col]" v-if="child.type == 'input-group'">
<template v-for="(group, c) in child.children">
......@@ -973,7 +973,7 @@ const panelChange = (scope, row) => {
<span class="item-label" slot="label">
<span :class="{ required_mark: group.required }">{{
group.label
}}</span>
}}</span>
</span>
<el-select v-if="group.type == 'select'" v-model="formInline[group.field]"
:placeholder="group.placeholder" :clearable="group.clearable"
......@@ -1114,7 +1114,7 @@ const panelChange = (scope, row) => {
<span class="item-label" slot="label">
<span :class="{ required_mark: child.required }">{{
child.label
}}</span>
}}</span>
</span>
<el-select v-if="child.type == 'select'" v-model="formInline[child.field]"
:placeholder="child.placeholder" :clearable="child.clearable" :disabled="child.disabled || readonly"
......@@ -1164,7 +1164,7 @@ const panelChange = (scope, row) => {
<span class="item-label" slot="label" :class="[child.col]">
<span :class="{ required_mark: child.required }">{{
child.label
}}</span>
}}</span>
</span>
<div class="input_popover_panel" v-if="child.type == 'input-popover-panel'">
<el-popover placement="bottom-start" width="100%" trigger="click" :teleported="false">
......@@ -1218,7 +1218,7 @@ const panelChange = (scope, row) => {
<span class="item-label" slot="label">
<span :class="{ required_mark: child.required }">{{
child.label
}}</span>
}}</span>
</span>
<template v-if="child.type == 'upload-image'">
<el-upload :class="[child.col, 'avatar-uploader', { is_block: child.block }]" action="#"
......
......@@ -33,6 +33,7 @@ const emits = defineEmits([
"tableRowClick",
"tableRowDblClick",
"tableInputChange",
]);
const tableRef = ref();
......@@ -198,6 +199,8 @@ const rowSelectable = (row, index) => {
return row.selectable ?? true;
};
const pageChange = (page) => {
let info = { ...page, id: props.tableInfo.id };
emits("tablePageChange", info);
......@@ -277,7 +280,7 @@ onMounted(() => {
@show="() => popoverHover(scope, item)">
<template #reference>
<span :class="{ text_btn: item.checkName ? item.checkName(scope) : true }">{{
item.getName ? item.getName(scope):"详情" }}</span>
item.getName ? item.getName(scope) : "详情" }}</span>
</template>
<el-table :data="props.tableInfo.popoverData" v-loading="props.tableInfo.popoverloading" class="tablePover"
:row-class-name="tableRowClassName1" border tooltip-effect="light"
......@@ -445,7 +448,7 @@ onMounted(() => {
: scope.row[item.field] !== 0 && !scope.row[item.field]
? "--"
: scope.row[item.field]
}}</span>
}}</span>
</template>
<!--- 直接用??会导致空字符串时无法显示'--',此处需要区分0和“” -->
<span v-else>{{
......
......@@ -493,9 +493,14 @@ export const tagType = (row, type) => {
case "R":
state = 'danger'
break;
case 0:
state = 'info';
break;
case 1:
state = 'success';
break;
case 2:
state = 'info';
state = 'warning';
break;
case 3:
state = 'warning'
......
......@@ -77,7 +77,8 @@ const levelMap = {
}
const currTableInfo = ref<any>({});
const drawerRef = ref<any>('');
const currentRowKey = ref<any>(null);
const scopeRow = ref<any>(null);
const tableInfo = ref({
id: "data-class-standard-table",
multiple: false,
......@@ -108,6 +109,7 @@ const tableInfo = ref({
],
data: [],
rowKey: 'guid',
currentRowKey: '',
showPage: false,
actionInfo: {
label: "操作",
......@@ -116,7 +118,7 @@ const tableInfo = ref({
btns: [
{
label: "编辑", value: "edit", click: (scope) => {
console.log(scope.row);
scopeRow.value = scope.row;
currentEditingGuid.value = scope.row.guid;
selectParentEdit(scope.row.guid);
currTableInfo.value = scope.row;
......@@ -147,6 +149,8 @@ const tableInfo = ref({
loading: false,
});
const classEditFormItems = ref([{
label: '分类名称',
type: 'input',
......@@ -218,38 +222,9 @@ const classEditFormItems = ref([{
block: true
}]);
// const validateUniqueClassifyName = (rule, value, callback) => {
// console.log('validateUniqueClassifyName', value);
// // 递归遍历treeListData,判断是否有重复的分类名称
// // 检查空值情况
// if (!value) {
// callback(new Error('请填写分类名称'));
// return;
// }
// // 递归检查函数
// const isExist = (data, value) => {
// return data.some(item => {
// if (item.classifyName === value) {
// return true;
// }
// return item.children && isExist(item.children, value);
// });
// };
// // 检查是否存在
// if (isExist(treeListData.value, value)) {
// callback(new Error('分类名称已存在,请填写其他名称'));
// } else {
// callback(); // 校验通过
// }
// }
let currentEditingGuid = ref<any>('');
const validateUniqueClassifyName = (rule, value, callback) => {
console.log('validateUniqueClassifyName', treeListData.value, value, currentEditingGuid);
// 检查空值情况
if (!value) {
callback(new Error('请填写分类名称'));
......@@ -341,6 +316,7 @@ const drawerBtnClick = async (btn, info) => {
}
} else {
// 编辑分类
drawerInfo.value.footer.btns.map((item: any) => (item.disabled = true));
const params = {
...info,
......@@ -357,8 +333,14 @@ const drawerBtnClick = async (btn, info) => {
getTreeListData();
// 清空当前编辑的guid
currentEditingGuid.value = '';
nextTick(() => {
console.log('tableRef进来了吗', scopeRow.value.guid);
tableInfo.value.currentRowKey = scopeRow.value.guid;
tableRef.value.tableRef.setCurrentRow(scopeRow.value.guid);
});
} else {
proxy.$ElMessage.error(res.msg);
drawerInfo.value.footer.btns.map((item: any) => (item.disabled = false));
}
}
}
......@@ -387,7 +369,7 @@ const findStandardName = (guid: string) => {
const item: any = classifyGradListData.value.find((item: any) => item.guid == guid);
return item ? item.name : '';
}
const tableRef = ref(null); // 表格的 ref
const tableRef = ref<any>(null); // 表格的 ref
// 获取分类树形列表
const treeListParams = ref({
pageIndex: 1,
......@@ -404,7 +386,6 @@ const getTreeListData = async () => {
classEditFormItems.value[2].options = treeListData.value;
shapeTreeListData.value = treeListData.value;
tableInfo.value.loading = false;
} else {
proxy.$ElMessage.error(res.msg);
}
......@@ -493,10 +474,10 @@ const saveUpdate = async () => {
type: 'C',
description: formRef.value.formInline.description
}
console.log(params);
const res: any = await updateClassifyGrad(params);
if (res.code == proxy.$passCode) {
proxy.$ElMessage.success('修改分类成功');
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.push({
name: 'templateConfig'
});
......@@ -518,7 +499,6 @@ 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,
......@@ -526,13 +506,10 @@ const changeShowMethod = () => {
children: shapeTreeListData.value
}
updatedTreeData.value = [tempArr];
console.log('updatedTreeData', [tempArr]);
}
}
const cancel = () => {
console.log(userStore.tabbar);
console.log(fullPath);
proxy.$openMessageBox("当前页面尚未保存,确定放弃修改吗?", () => {
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.push({
......@@ -823,6 +800,19 @@ const expand = (item) => {
isExpand1.value = item
}
onActivated(() => {
const classClassifyGradName = route.query.classClassifyGradName;
let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === fullPath);
if (tab) {
if (classClassifyGradName) {
tab.meta.title = `编辑-${classClassifyGradName}`;
}
if (fullPath === route.fullPath) {
document.title = tab.meta.title;
}
}
});
</script>
<template>
......@@ -832,14 +822,16 @@ const expand = (item) => {
:isExpand="isExpand">
<Form ref="formRef" :itemList="classStandardFormItems" formId="main-model-edit" col="col3" />
</ContentWrap>
<ContentWrap id="id-classStandard" class="detail-content" title="分类规则" description=""
style="margin-top:16px; height: calc(100% - 161px)" :expandSwicth="true" :isExpand="isExpand1" @expand="expand">
<ContentWrap id="id-classStandard" class="class-content" title="分类规则" description="" style="margin-top:16px; "
:expandSwicth="true" :isExpand="isExpand1" @expand="expand">
<div class="tools_btns">
<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>
<!-- <el-button class="show-change-btn" @click="changeShowMethod">{{ '图形展示' }}</el-button> -->
</div>
<div class="table_panel">
<Table v-show="dataShowMethod == 'table'" :tableInfo="tableInfo" ref="tableRef" />
</div>
<Table v-show="dataShowMethod == 'table'" :tableInfo="tableInfo" :ref="tableRef" />
<div ref="shapeMain" class="shape-main" v-show="dataShowMethod != 'table'"></div>
<div v-if="showNodeDetails" class="node-details-popup"
:style="{ top: popupPosition.top + 'px', left: popupPosition.left + 'px' }">
......@@ -890,9 +882,10 @@ const expand = (item) => {
}
:deep(.detail-content) {
height: calc(100% - 50px);
.el-card__body {
height: calc(100% - 50px) !important;
height: calc(100% - 50px);
.card-body-content {
height: 100%;
......@@ -916,7 +909,7 @@ const expand = (item) => {
}
.table_panel {
height: calc(100% - 44px) !important;
height: 500px
}
.node-details-popup {
......
......@@ -137,7 +137,6 @@ const tableInfo = ref({
btns: [
{
label: "编辑", value: "edit", click: (scope) => {
console.log(scope);
filterDataGradeEdit(scope.row.dataGrade);
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeStandardDialogInfo.value.title = '编辑规则';
......@@ -364,6 +363,7 @@ const saveUpdate = async () => {
const res: any = await updateClassifyGrad(params);
if (res.code == proxy.$passCode) {
proxy.$ElMessage.success('修改分级成功');
userStore.setTabbar(userStore.tabbar.filter((tab: any) => tab.fullPath !== fullPath));
router.push({
name: 'templateConfig'
});
......@@ -385,6 +385,20 @@ const cancel = () => {
});
}
onActivated(() => {
const classClassifyGradName = route.query.classClassifyGradName;
let tab: any = userStore.tabbar.find((tab: any) => tab.fullPath === fullPath);
console.log(tab, '-----------');
if (tab) {
if (classClassifyGradName) {
tab.meta.title = `编辑-${classClassifyGradName}`;
}
if (fullPath === route.fullPath) {
document.title = tab.meta.title;
}
}
});
</script>
<template>
......
......@@ -9,10 +9,15 @@ import {
getCgDirTreeList, getCgDirFieldPageList, getDictionary, saveBizRuleConfig,
getDbDirTreeList, getDbDirTablePageList, getDbDirFieldPageList, getExecGuidAndName,
getClassifyTreeList, getCgLabelPageList, execTaskFieldList, execTaskSheetList, getTaskExeTreeList,
getDbFieldList
getDbFieldList, exportCgDir,
getGradeList,
exportDbDirTable,
getDbDirDetail
} from '@/api/modules/dataInventory';
import { TableColumnWidth } from "@/utils/enum";
import router from "@/router";
import { download } from "@/utils/common";
import { getLabelList } from "@/api/modules/dataLabel";
const currentPath = ref<string[]>([]);
const { proxy } = getCurrentInstance() as any;
......@@ -99,6 +104,7 @@ onMounted(async () => {
});
getDictionaryList();
getSearchTableList();
getLabelListData();
})
......@@ -140,7 +146,7 @@ const searchItemList = ref([
default: '',
options: [],
props: {
label: 'name',
label: 'label',
value: 'guid',
},
clearable: true,
......@@ -178,27 +184,34 @@ const searchItemList = ref([
clearable: true,
},
])
const searchParams = ref({})
// 搜索
const searchCount = ref(0);
const toSearch = (val: any, clear: boolean = false) => {
if (clear) {
selectedA.value = null;
selectedB.value = null;
selectedC.value = null;
searchItemList.value.map(item => item.default = '')
searchParams.value = {}
}
if (Object.keys(val).length) {
searchParams.value = { ...val }
}
// let params: any = { ...searchParams.value }
// params.pageIndex = page.value.curr;
// params.pageSize = page.value.limit;
// //params.standardSetGuid = standardSetGuid.value;
// params.standardSetLevelCode = standardSetLevelCode.value;
// return getTableData(params);
// 差一个label标签 -- 未完成
getCgDirFieldPage({
pageIndex: 1,
pageSize: 50,
execGuid: execGuidInfo.value.execGuid,
classifyDetail: val.classifyName,
gradeDetailGuid: val.levelName,
databaseGuid: selectedA.value,
tableGuid: selectedB.value,
fieldGuid: selectedC.value,
});
};
const nodeClick = async (data: any) => {
console.log('nodeClick', data);
const { guid, classifyDetailGuid } = data
const { guid, classifyDetailGuid, refGradeGuid } = data
getGradeData(refGradeGuid);
searchItemList.value[1].default = data.classifyName;
await getCgDirFieldPage({
execGuid: execGuidInfo.value.execGuid,
......@@ -230,6 +243,26 @@ const findPath = (data: any[], targetGuid: string, path: string[] = []) => {
};
// 根据选择的分类获取分级
const getGradeData = async (refGradeGuid) => {
const res: any = await getGradeList({ classifyGradeGuid: refGradeGuid, pageIndex: 1, pageSize: -1 });
if (res.code == proxy.$passCode) {
searchItemList.value[2].options = res.data.records || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}
// 获取标签
const getLabelListData = async () => {
const res: any = await getLabelList({ label: '' });
if (res.code == proxy.$passCode) {
searchItemList.value[0].options = res.data || [];
} else {
proxy.$ElMessage.error(res.msg);
}
}
// btns-area
const checked = ref(false);
const changeCheck = (val) => {
......@@ -245,7 +278,7 @@ const page = ref({
curr: 1,
sizes: [
{ label: "10", value: 10 },
{ label: "20", value: 20 },
{ label: "50", value: 50 },
{ label: "100", value: 100 },
{ label: "150", value: 150 },
{ label: "200", value: 200 },
......@@ -258,10 +291,10 @@ const tableInfo = ref({
fields: [
{ label: "序号", type: "index", width: 56, align: "center" },
{ label: "字段名", field: "fieldName", width: 140 },
{ label: "分类", field: "classifyName", width: 180 },
{ label: "分类", field: "classifyDetailName", width: 180 },
{ label: "分级", field: "gradeDetailName", width: 120 },
{ label: "标签", field: "label", width: 140 },
{ label: "规则", field: "rulesName", width: 180 },
{ label: "规则", field: "ruleDetail", width: 180 },
{ label: "表名", field: "tableName", width: 120, align: 'center' },
{ label: "表中文名", field: "tableChName", width: 120, align: 'center' },
{ label: "数据库名", field: "database", width: 120, align: 'center' },
......@@ -285,7 +318,8 @@ const tablePageChange = (info) => {
page.value.limit = Number(info.limit);
getCgDirFieldPage({
pageIndex: info.curr,
pageSize: info.limit
pageSize: info.limit,
execGuid: execGuidInfo.value.execGuid
});
}
......@@ -355,7 +389,7 @@ const dataBasePage = ref({
curr: 1,
sizes: [
{ label: "10", value: 10 },
{ label: "20", value: 20 },
{ label: "50", value: 50 },
{ label: "100", value: 100 },
{ label: "150", value: 150 },
{ label: "200", value: 200 },
......@@ -423,6 +457,30 @@ const dataBaseTableInfo = ref({
{
label: "编辑表结构", value: "edit", click: (scope) => {
console.log('复制', scope);
getDbDirDetail({
tableGuid: scope.row.tableGuid
}).then((res: any) => {
if (res.code == proxy.$passCode) {
console.log('res', res);
router.push({
name: 'tableCreateExisting',
query: {
execGuid: execGuidInfo.value.execGuid,
foundMode: 1,
database: res.data.database,
databaseChName: res.data.databaseChName,
databaseGuid: res.data.databaseGuid,
tableGuid: scope.row.tableGuid,
tableName: scope.row.tableName,
tableChName: scope.row.tableChName,
description: scope.row.description,
}
});
} else {
proxy.$ElMessage.error(res.msg);
}
})
},
disabled: scope.row.state !== 2 ? false : true
}
......@@ -483,7 +541,7 @@ const classEditFormItems = ref([{
type: 'input',
placeholder: '请选择',
field: 'fieldPrecision',
maxlength: 6,
maxlength: 2,
regexp: /\D/g,
required: true,
clearable: true,
......@@ -708,7 +766,7 @@ const getDataBaseTableData = async (params = {}) => {
dataBaseTableInfo.value.loading = true;
const dataBaseParams = {
pageIndex: 1,
pageSize: 10,
pageSize: 50,
databaseGuid: "",
isDataAsset: '',
execGuid: execGuidInfo.value.execGuid,
......@@ -719,9 +777,8 @@ const getDataBaseTableData = async (params = {}) => {
if (res.code == proxy.$passCode) {
dataBaseTableDataList.value = res.data.records;
dataBaseTableInfo.value.page.rows = res.data.totalRows;
dataBaseTableInfo.value.page.limit = res.data.pageSize
dataBaseTableInfo.value.data = res.data.records;
dataBasePage.value.limit = res.data.pageSize
dataBasePage.value.curr = res.data.pageIndex
} else {
proxy.$ElMessage.error(res.msg);
}
......@@ -746,7 +803,7 @@ const getDataBaseFieldData = async (params = {}) => {
tableFieldsLoading.value = true;
const dataBaseParams = {
pageIndex: 1,
pageSize: 10,
pageSize: 50,
tableGuid: "",
execGuid: execGuidInfo.value.execGuid,
databaseGuid: "",
......@@ -778,8 +835,8 @@ const tableFieldsDataInfo = ref({
{ label: "表中文名", field: "tableChName", width: 140, },
{ label: "数据库名称", field: "database", width: 120 },
{ label: "数据库中文名", field: "databaseChName", width: TableColumnWidth.DATETIME },
{ label: "分类", field: "description", width: 120, align: 'center' },
{ label: "分级", field: "isDataAsset", width: 120, align: 'center' },
{ label: "分类", field: "classifyDetailName", width: 120, align: 'center' },
{ label: "分级", field: "gradeDetailName", width: 120, align: 'center' },
{ label: "标签", field: "label", width: 120, align: 'center' },
],
data: [],
......@@ -857,7 +914,8 @@ const handleSubjectTableCommand = (command: string) => {
name: 'tableCreateFile',
query: {
type: 'tableCreateFile',
foundMode: 2
foundMode: 2,
execGuid: execGuidInfo.value.execGuid,
}
});
} else if (command === 'existingCreate') {
......@@ -894,7 +952,7 @@ const setActiveTab = (tab) => {
activeTab.value = tab;
};
// 模拟后端接口
// 获取查询的数据库名 execTaskSheetList
const getSearchTableList = async (type = 1, dbGuid = '') => {
......@@ -943,30 +1001,37 @@ const onBChange = async () => {
// 导出
const btnClick = async () => {
exportCgDir().then((res: any) => {
download(res, '分类分级目录数据.xlsx', 'excel')
});
};
// 数据库导出
const exportDB = async () => {
exportDbDirTable().then((res: any) => {
download(res, '数据库目录数据.xlsx', 'excel')
});
}
// 分类选择
const treeSelectNodeChange = (node, item) => {
console.log('treeSelectNodeChange', node, item);
const { refGradeGuid } = node;
getGradeData(refGradeGuid);
}
</script>
<template>
<div class="classification-template-content">
<div class="v-table-tools">
<el-select v-model="selectedA" placeholder="选择数据库名" @change="onAChange" style="width: 140px; margin-right: 8px"
clearable>
:clearable="false">
<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>
style="width: 140px; margin-right: 8px" :clearable="false">
<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>
:clearable="false">
<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"
......@@ -1078,7 +1143,7 @@ const treeSelectNodeChange = (node, item) => {
</template>
</el-dropdown>
</div>
<el-button>导出</el-button>
<el-button @click="exportDB">导出</el-button>
<el-button>查看已生产报告</el-button>
<el-button>查看质量规则</el-button>
</div>
......@@ -1111,6 +1176,7 @@ const treeSelectNodeChange = (node, item) => {
.v-table-tools {
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 8px 12px;
}
......@@ -1225,21 +1291,21 @@ const treeSelectNodeChange = (node, item) => {
.table_panel_wrap {
width: 100%;
height: calc(100% - 175px);
height: calc(100% - 117px);
min-height: 210px;
overflow: visible;
}
.table_panel_wrap_database {
width: 100%;
height: calc(100% - 215px);
height: calc(100% - 155px);
min-height: 210px;
overflow: visible;
}
.table_field {
width: 100%;
height: calc(100% - 180px);
height: calc(100% - 150px);
min-height: 210px;
overflow: visible;
}
......
......@@ -5,7 +5,7 @@
<script lang="ts" setup name="configureRules">
import { ref } from "vue";
import router from "@/router";
import { getBizRuleConfigDetail, updateBizRuleConfig } from '@/api/modules/dataInventory'
import { getBizRuleConfigDetail, saveBizRuleConfig, } from '@/api/modules/dataInventory'
const { proxy } = getCurrentInstance() as any;
const bizRuleConfigData = ref<any>()
const getBizRuleConfigDetailData = async () => {
......@@ -52,85 +52,73 @@ const editableFields = {
}
const tableFieldsLoading = ref(false)
// 当前选中的行
const selectedRows = ref([]);
// 监听选中行
// 监听选中行变化
const selectionFieldsChange = (selection) => {
console.log('selection', selection)
selectedRows.value = selection;
};
// 上移功能
// 上移操作
const moveUp = () => {
// 1. 找到选中行在 tableData 中的索引
const selectedIds = selectedRows.value.map((row: any) => row.id);
// 2. 遍历选中行,按顺序上移
for (let i = 0; i < tableData.value.length; i++) {
const currentRow = tableData.value[i];
// 如果当前行被选中,且不是第一行,则交换位置
if (selectedIds.includes(currentRow.id) && i > 0) {
const previousRow = tableData.value[i - 1];
// 如果上一行没有被选中,交换位置
if (!selectedIds.includes(previousRow.id)) {
[tableData.value[i], tableData.value[i - 1]] = [tableData.value[i - 1], tableData.value[i]];
}
}
if (selectedRows.value.length === 0) {
proxy.$message.warning("请选择数据!");
return;
}
selectedRows.value.forEach((row: any) => {
const index = tableData.value.findIndex((item) => item.guid === row.guid);
if (index > 0) {
[tableData.value[index - 1], tableData.value[index]] = [
tableData.value[index],
tableData.value[index - 1],
];
}
});
};
// 下移功能
// 下移操作
const moveDown = () => {
// 1. 找到选中行在 tableData 中的索引
const selectedIds = selectedRows.value.map((row: any) => row.id);
// 2. 遍历选中行,倒序下移
for (let i = tableData.value.length - 1; i >= 0; i--) {
const currentRow = tableData.value[i];
// 如果当前行被选中,且不是最后一行,则交换位置
if (selectedIds.includes(currentRow.id) && i < tableData.value.length - 1) {
const nextRow = tableData.value[i + 1];
// 如果下一行没有被选中,交换位置
if (!selectedIds.includes(nextRow.id)) {
[tableData.value[i], tableData.value[i + 1]] = [tableData.value[i + 1], tableData.value[i]];
}
}
if (selectedRows.value.length === 0) {
proxy.$message.warning("请选择数据!");
return;
}
// 倒序遍历选中行
[...selectedRows.value].reverse().forEach((row: any) => {
const index = tableData.value.findIndex((item) => item.guid === row.guid);
if (index < tableData.value.length - 1) {
[tableData.value[index], tableData.value[index + 1]] = [
tableData.value[index + 1],
tableData.value[index],
];
}
});
};
// 编辑行
const editRow = (row) => {
if (!row.isEdit) {
// 编辑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; // 进入编辑模式
if (row.fieldLengthCondition) {
const arr = row.fieldLengthCondition.split('#')
row.lengthSymbol = arr[0]
row.lengthValue = arr[1]
}
if (row.fieldValueRange) {
const arr = row.fieldValueRange.split('#')
row.rangeStart = arr[0]
row.rangeEnd = arr[1]
}
row.isEdit = true; // 进入编辑模式
};
// 保存数据
const saveRow = (row) => {
row.fieldLengthCondition = `${row.lengthSymbol}#${row.lengthValue}`;
row.fieldValueRange = [row.rangeStart || '', row.rangeEnd || ''];
if (row.lengthSymbol && row.lengthValue) {
row.fieldLengthCondition = row.lengthSymbol + '#' + row.lengthValue
}
if (row.rangeStart && row.rangeEnd) {
row.fieldValueRange = row.rangeStart + '#' + row.rangeEnd
}
row.isEdit = false
}
......@@ -234,6 +222,7 @@ const saveData = async () => {
const obj = {
guid: router.currentRoute.value.query.tableGuid,
fieldGuid: item.fieldGuid,
execGuid: router.currentRoute.value.query.execGuid,
fieldLengthCondition: item.fieldLengthCondition,
fieldPrecision: item.fieldPrecision,
dictionaryGuid: item.dictionaryGuid,
......@@ -245,7 +234,7 @@ const saveData = async () => {
})
console.log('finalParams', inParams)
const res: any = await updateBizRuleConfig(inParams)
const res: any = await saveBizRuleConfig(inParams)
if (res.code === proxy.$passCode) {
proxy.$message.success('修改配置规则成功!')
router.back()
......@@ -323,7 +312,8 @@ const cancel = () => {
<!-- 长度列 fieldLengthCondition: '>#10',-->
<el-table-column prop="fieldLengthCondition" label="长度" width="240" align="center">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.fieldLengthCondition || '--' }}</span>
<span v-if="!scope.row.isEdit">{{ scope.row.fieldLengthCondition
? scope.row.fieldLengthCondition.replace('#', '') : '--' }}</span>
<div v-else>
<el-select v-model="scope.row.lengthSymbol" placeholder="请选择" style="width: 50%;margin-right: 8px;">
<el-option label="大于" value=">"></el-option>
......@@ -334,21 +324,6 @@ const cancel = () => {
</div>
</template>
</el-table-column>
<!-- 精度列 -->
<!-- <el-table-column prop="fieldPrecision" label="精度" width="240" align="center">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.fieldPrecision || '--' }}</span>
<div v-else>
<el-select v-model="scope.row.fieldPrecision" placeholder="请选择" style="width: 50%;margin-right: 8px;">
<el-option label="<=500" value="<=500"></el-option>
<el-option label=">500" value=">500"></el-option>
</el-select>
<el-input v-model="scope.row.precisionValue" placeholder="请输入" style="width: 45%;" />
</div>
</template>
</el-table-column> -->
<!-- 精度(可编辑)fieldPrecision -->
<el-table-column prop="fieldPrecision" label="精度" width="120" align="center">
<template #default="scope">
<span v-if="!scope.row.isEdit || !editableFields.fieldPrecision">{{
......@@ -393,7 +368,8 @@ const cancel = () => {
<template #default="scope">
<!-- 非编辑模式,展示取值范围 -->
<span v-if="!scope.row.isEdit">
{{ scope.row.fieldValueRange ? scope.row.fieldValueRange.join('-') : '--' }}
{{ scope.row.fieldValueRange
? scope.row.fieldValueRange.replace('#', '-') : '--' }}
</span>
<!-- 编辑模式,显示两个输入框 -->
<div v-else style="display: flex; gap: 5px; align-items: center;">
......
......@@ -6,8 +6,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 { CirclePlus, Delete, Warning } from "@element-plus/icons-vue";
const { proxy } = getCurrentInstance() as any;
......@@ -78,8 +77,8 @@ const getLabelPageData = async () => {
refCount.value++;
tableInfo.value.loading = true;
const params = {
pageIndex: page.value.curr,
pageSize: page.value.limit,
pageIndex: 1,
pageSize: 50,
classifyGuid: classifyGuid.value,
detailGuid: classifyDetailGuid.value
}
......@@ -152,6 +151,10 @@ const findTopParentNode = (node: any) => {
if (isLastLayer.value) {
atGradeinfo.value = node.data;
}
if (!node.parent.parent) {
findNodeDetails.value = node.data;
return;
}
// 递归向上查找符合条件的祖先节点
const findCParent = (currentNode: any): any => {
......@@ -174,7 +177,7 @@ const findTopParentNode = (node: any) => {
const nodeClick = (data, node) => {
console.log('nodeClick', data, node);
findTopParentNode(node);
newCreateGradeFormItems.value[1].options = transformDataForTree([findNodeDetails.value])
......@@ -208,7 +211,7 @@ const page = ref({
curr: 1,
sizes: [
{ label: "10", value: 10 },
{ label: "20", value: 20 },
{ label: "50", value: 50 },
{ label: "100", value: 100 },
{ label: "150", value: 150 },
{ label: "200", value: 200 },
......@@ -227,7 +230,7 @@ const tableInfo = ref({
return tempInfo.join('/')
},
},
{ label: "分级", field: "gradeDetailName", width: 140 },
{ label: "分级", field: "gradeDetailName", width: 80 },
{
label: '状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 'Y', inactiveValue: 'N', switchWidth: 56, width: 100, align: 'center'
},
......@@ -243,7 +246,7 @@ const tableInfo = ref({
actionInfo: {
label: "操作",
type: "btn",
width: 300,
width: 120,
fixed: 'right',
btns: [
{
......@@ -264,6 +267,10 @@ const tableInfo = ref({
item.default = scope.row[item.field];
item.disabled = false;
});
matchChValue.value.value = scope.row.matchChValue;
matchChValue.value.disabled = false;
matchEnValue.value.value = scope.row.matchEnValue;
matchEnValue.value.disabled = false;
if (scope.row.vagueMatchRule) {
// formRows进行回显
formRows.value = scope.row.vagueMatchRule.map((item) => ({
......@@ -374,6 +381,10 @@ const tableBtnClick = async (scope, value) => {
item.default = scope.row[item.field];
item.disabled = true;
});
matchChValue.value.value = scope.row.matchChValue;
matchChValue.value.disabled = true;
matchEnValue.value.value = scope.row.matchEnValue;
matchEnValue.value.disabled = true;
if (scope.row.vagueMatchRule) {
// formRows进行回显
formRows.value = scope.row.vagueMatchRule.map((item) => ({
......@@ -444,34 +455,34 @@ const newCreateGradeFormItems = ref<any>([{
required: true,
block: true,
},
// {
// label: ' ',
// type: 'label',
// default: '规则配置',
// block: true,
// col: 'title-label'
// },
{
label: '精确匹配',
type: 'textarea',
maxlength: 260,
placeholder: '请输入字段中文,中间用英文“,”分号隔开',
field: 'matchChValue',
default: '',
clearable: true,
required: false,
},
{
label: '',
type: 'textarea',
maxlength: 260,
placeholder: '请输入字段中文,中间用英文“,”分号隔开',
field: 'matchEnValue',
default: '',
clearable: true,
required: false,
}
// {
// label: ' ',
// type: 'label',
// default: '规则配置',
// block: true,
// col: 'title-label'
// },
// {
// label: '精确匹配',
// type: 'textarea',
// maxlength: 200,
// placeholder: '请输入字段中文,中间用英文“,”分号隔开',
// field: 'matchChValue',
// default: '',
// clearable: true,
// required: false,
// },
// {
// label: '',
// type: 'textarea',
// maxlength: 200,
// placeholder: '请输入字段中文,中间用英文“,”分号隔开',
// field: 'matchEnValue',
// default: '',
// clearable: true,
// required: false,
// }
]);
const newCreateGradeFormRules = ref({
......@@ -526,7 +537,9 @@ const newCreateGradeStandardDialogInfo = ref({
...info,
classifyGuid: classifyGuid.value,
gradeGuid: tempRefGradeGuid.value,
vagueMatchRule: tempParams
vagueMatchRule: tempParams,
matchChValue: matchChValue.value.value,
matchEnValue: matchEnValue.value.value
}
console.log('submit', params);
const res: any = await saveLabel(params);
......@@ -554,6 +567,8 @@ const newCreateGradeStandardDialogInfo = ref({
vagueMatchRule: tempParams,
classifyGuid: classifyGuid.value,
gradeGuid: tempRefGradeGuid.value,
matchChValue: matchChValue.value.value,
matchEnValue: matchEnValue.value.value
}
console.log('submit', params);
const res: any = await updateLabel(params);
......@@ -579,6 +594,10 @@ const addNewLabel = async () => {
item.default = '';
item.disabled = false;
});
matchChValue.value.value = '';
matchChValue.value.disabled = false;
matchEnValue.value.value = '';
matchEnValue.value.disabled = false;
formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }];
//
......@@ -653,8 +672,8 @@ const searchClass = async (val: any, clear: boolean = false) => {
if (val?.labelName?.length !== 0 || refCount.value >= 1) {
tableInfo.value.loading = true;
const params = {
pageIndex: page.value.curr,
pageSize: page.value.limit,
pageIndex: 1,
pageSize: 50,
guids: guids.value,
}
const res: any = await getLabelPageList(params);
......@@ -691,8 +710,6 @@ 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;
}
}
};
......@@ -769,9 +786,18 @@ const addRow = () => {
const deleteRow = (index: number) => {
formRows.value.splice(index, 1);
};
const matchChValue = ref({
value: '',
disabled: false
})
const matchEnValue = ref({
value: '',
disabled: false
})
</script>
<template>
<div class="data-label">
<div class="container_wrap full flex">
......@@ -805,13 +831,37 @@ const deleteRow = (index: number) => {
<Dialog_form ref="dialogLabelFormRef" :dialogConfigInfo="newCreateGradeStandardDialogInfo" class="v-dialog-form"
@treeSelectNodeChange='handleTreeSelectNodeChange' @selectChange="handleSelectChange">
<template v-slot:default>
<div class="dim-label">模糊匹配</div>
<div>
<div class="dim-label">
<span class="front">模糊匹配</span>
<el-icon>
<Warning />
</el-icon>
<span class="tip">
精确匹配使用中文;分隔每个规则
</span>
</div>
<div class="v-match">
<el-input v-model="matchChValue.value" :disabled="matchChValue.disabled" maxlength="200"
style="width: 272px;height:94px;" show-word-limit type="textarea" class="no-resize" />
<el-input v-model="matchEnValue.value" :disabled="matchEnValue.disabled" maxlength="200"
style="width: 272px;height:94px;" show-word-limit type="textarea" class="no-resize" />
</div>
</div>
<div class="dim-label" style="margin-top: 16px;">
<span class="front">模糊匹配</span>
<el-icon>
<Warning />
</el-icon>
<span class="tip">
模糊匹配是或的关系,可配置多个模糊匹配规则
</span>
</div>
<!-- 渲染行 -->
<div v-for="(row, index) in formRows" :key="index" class="match-content-wrapper">
<div class="match-content" @mouseenter="handleMouseEnter(index)" @mouseleave="handleMouseLeave()">
<!-- 位置映射下拉框 -->
<el-select v-model="row.name" placeholder="请选语言类型" :disabled=row.disabled class="v-select">
<el-select v-model="row.name" placeholder="请选择中文名/英文名" :disabled=row.disabled class="v-select">
<el-option v-for="option in languageOptions" :key="option.value" :label="option.label"
:value="option.value" />
</el-select>
......@@ -911,6 +961,16 @@ const deleteRow = (index: number) => {
.dim-label {
height: 10px;
display: flex;
align-items: center;
margin-top: 6px;
.front {
margin-right: 8px;
}
.tip {
margin-left: 3px;
}
}
.match-content-wrapper {
......@@ -965,5 +1025,21 @@ const deleteRow = (index: number) => {
overflow: auto;
}
}
.v-match {
display: flex;
justify-content: space-between;
margin-top: 10px;
margin-bottom: 10px;
}
:deep(.no-resize) {
height: 94px;
.el-textarea__inner {
min-height: 94px !important;
resize: none;
}
}
}
</style>
......
......@@ -87,8 +87,8 @@ const tabsInfo = ref({
activeName: 'gradeStandard',
tabs: [
// { label: '分类分级模板', name: 'classTemplate' },
{ label: '分级标准', name: 'gradeStandard' },
{ label: '分类标准', name: 'classStandard' },
{ label: '分级规则', name: 'gradeStandard' },
{ label: '分类规则', name: 'classStandard' },
]
});
......@@ -106,7 +106,7 @@ const classSearchItemList = ref([
field: 'classStandardName',
default: '',
maxlength: 50,
placeholder: '分类标准名称',
placeholder: '分类名称',
clearable: true,
visible: true
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!