f278ba6b by xukangle

fix:修改分级分类标准的相关问题

1 parent 751d9bbf
......@@ -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
......
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'
});
......@@ -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,15 +449,20 @@ 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) => {
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,
url: res.data.signedUrl,
file: file.file
};
if (item.limit === 1) {
......@@ -468,6 +478,7 @@ const uploadFile = (file, item) => {
ElMessage.error('上传失败,请重新上传!');
}
})
})
.catch(() => {
uploadRef.value['ref' + item.field].handleRemove(file);
ElMessage.error('上传失败,请重新上传');
......
......@@ -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[]
......
......@@ -6,10 +6,9 @@
import { ref, onMounted } from "vue";
import useUserStore from "@/store/modules/user";
import { useValidator } from '@/hooks/useValidator';
import { TableColumnWidth } from '@/utils/enum';
import G6 from '@antv/g6';
import { IGroup, ModelConfig } from '@antv/g6';
import { getClassifyGradList, getClassifyTreeList, getGradeList, saveClassify, updateClassify, deleteClassify } from "@/api/modules/dataInventory";
import { getClassifyGradList, getClassifyTreeList, getGradeList, saveClassify, updateClassify, deleteClassify, updateClassifyGrad } from "@/api/modules/dataInventory";
const { required, orderNum } = useValidator();
......@@ -30,19 +29,43 @@ const classStandardFormItems = ref([{
field: 'classStandardName',
default: router.currentRoute.value.query.classStandardName,
clearable: true,
disabled: true,
disabled: false,
required: true
}, {
// label: '分级标准',
// type: 'input',
// placeholder: '请选择',
// field: 'gradeStandard',
// default: '',
// required: true,
// filterable: true,
// clearable: true,
// disabled: false,
// visible: true,
label: '分级标准',
type: 'input',
type: 'select',
placeholder: '请选择',
field: 'gradeStandard',
options: [],
props: {
label: "name",
value: "guid",
},
filterable: true,
clearable: true,
default: '',
required: true,
filterable: true,
block: false,
},
{
label: '分类描述',
type: 'textarea',
placeholder: '请输入',
field: 'description',
default: '',
clearable: true,
disabled: true,
visible: true,
required: false,
block: true
}]);
// 定义层级映射1->一级,2->二级,3->三级,4->四级
......@@ -77,7 +100,7 @@ const tableInfo = ref({
{
label: "最低安全级别参考", field: "name", width: 140, getName: (scope) => {
let dataGrade = scope.row.dataGrade;
return dataGrade + '级';
return dataGrade ? dataGrade + '级' : '--';
}
},
{ label: "修改人", field: "updateUserName", width: 140 },
......@@ -165,7 +188,7 @@ const classEditFormItems = ref([{
type: 'select',
placeholder: '请选择',
field: 'gradeGuid',
default: 1,
default: '',
options: [], //TODO
props: {
label: "name",
......@@ -322,7 +345,9 @@ const drawerBtnClick = async (btn, info) => {
const params = {
...info,
classifyGradeGuid: router.currentRoute.value.query.guid,
guid: currTableInfo.value.guid
guid: currTableInfo.value.guid,
gradeGuid: info.gradeGuid || '',
parentGuid: info.parentGuid || '',
}
const res: any = await updateClassify(params);
if (res.code == proxy.$passCode) {
......@@ -350,8 +375,10 @@ const getClassifyGradListData = async () => {
const res: any = await getClassifyGradList(refGradePageParams.value);
if (res.code == proxy.$passCode) {
classifyGradListData.value = res.data.records || [];
const gradeName = findStandardName(router.currentRoute.value.query.refGradeGuid as any);
classStandardFormItems.value[1].default = gradeName;
classStandardFormItems.value[1].options = classifyGradListData.value;
// const gradeName = findStandardName(router.currentRoute.value.query.refGradeGuid as any);
classStandardFormItems.value[1].default = router.currentRoute.value.query.refGradeGuid;
classStandardFormItems.value[2].default = router.currentRoute.value.query.description;
} else {
proxy.$ElMessage.error(res.msg);
}
......@@ -445,6 +472,39 @@ const newCreateClass = () => {
})
}
const saveLoading = ref(false);
const saveUpdate = async () => {
console.log(formRef.value.formInline);
if (!formRef.value.formInline.classStandardName) {
proxy.$ElMessage.error('分类名称不能为空');
return;
}
if (!formRef.value.formInline.gradeStandard) {
proxy.$ElMessage.error('分级标准不能为空');
return;
}
saveLoading.value = true;
const params = {
guid: router.currentRoute.value.query.guid,
name: formRef.value.formInline.classStandardName,
refGradeGuid: formRef.value.formInline.gradeStandard,
type: 'C',
description: formRef.value.formInline.description
}
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 {
proxy.$ElMessage.error(res.msg);
}
}
/** 导入分类。 */
const importClass = () => {
......@@ -778,6 +838,7 @@ onMounted(() => {
</div>
<div class="bottom_tool_wrap">
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="saveUpdate" :loading="saveLoading">保存修改</el-button>
</div>
<Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" ref="drawerRef" />
</div>
......@@ -824,11 +885,11 @@ onMounted(() => {
}
.shape-main {
height: calc(100% - 58px);
height: calc(100% - 160px);
}
.table_panel {
height: calc(100% - 58px) !important;
height: calc(100% - 160px) !important;
}
.node-details-popup {
......
......@@ -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.query.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: {
......@@ -328,19 +331,81 @@ const newStandard = () => {
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 {
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">
<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>
</template>
......@@ -351,11 +416,48 @@ const newStandard = () => {
.content_main {
height: calc(100% - 44px);
padding: 17px 16px 10px 16px;
padding: 10px 16px;
.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>
......
......@@ -149,6 +149,7 @@ const handleClassDataEdit = (params) => {
// 配置分类
const handleClassDataClick = (item, des = '') => {
console.log(item, 'i111tem');
// 获取分级标准
router.push({
name: 'classStandardEdit',
......@@ -156,7 +157,8 @@ const handleClassDataClick = (item, des = '') => {
guid: item.guid,
type: des === '' ? '配置' : des,
classStandardName: item.name,
refGradeGuid: item.refGradeGuid
refGradeGuid: item.refGradeGuid,
description: item.description
}
});
}
......@@ -248,6 +250,7 @@ const newCreateClassStandardDialogInfo = ref({
newCreateClassStandardDialogInfo.value.visible = false;
},
submit: async (btn, info) => {
if (newCreateClassStandardDialogInfo.value.title === '新增分类') {
newCreateClassStandardDialogInfo.value.submitBtnLoading = true;
const params = {
......@@ -263,6 +266,22 @@ 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
}
handleClassDataClick(params, '');
}
})
newCreateClassStandardDialogInfo.value.submitBtnLoading = false;
newCreateClassStandardDialogInfo.value.visible = false;
} else {
......@@ -343,7 +362,7 @@ const newCreateGradeStandardDialogInfo = ref({
await getClassifyGradListData();
proxy.$ElMessage({
type: 'success',
message: '新增分成功'
message: '新增分成功'
})
// 拿到新增的分级数据,跳转到配置页面
......@@ -372,7 +391,7 @@ const newCreateGradeStandardDialogInfo = ref({
getClassifyGradListData();
proxy.$ElMessage({
type: 'success',
message: '修改分成功'
message: '修改分成功'
})
newCreateGradeStandardDialogInfo.value.visible = false;
} else {
......@@ -437,6 +456,7 @@ const handleClassifyGradDataClick = (item) => {
}
const newCreateGrade = () => {
newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
newCreateGradeStandardDialogInfo.value.visible = true;
newCreateGradeFormItems.value.forEach(item => item.default = '');
}
......@@ -539,7 +559,7 @@ const newCreateGrade = () => {
</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="handleClassDataEdit(item)">编辑</span> -->
<span class="levitation-li" @click="handleClassDataDel(item)">删除</span>
</div>
</el-popover>
......@@ -572,7 +592,7 @@ const newCreateGrade = () => {
</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="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!