fee6b498 by lxs

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

2 parents c617ba60 526d4baa
...@@ -671,6 +671,18 @@ export const getDbDirTableSelectList = (data) => request({ ...@@ -671,6 +671,18 @@ export const getDbDirTableSelectList = (data) => request({
671 data 671 data
672 }) 672 })
673 673
674 /**
675 * 数据库目录-字段查询下拉
676 * @param {Object}
677 * @path /db-dir/field/select-list
678 */
679 export const getDbDirFieldSelectList = (data) => request({
680 url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/select-list`,
681 method: 'post',
682 data
683 })
684
685
674 686
675 687
676 /** 获取已有字段信息 */ 688 /** 获取已有字段信息 */
...@@ -780,8 +792,6 @@ export const getDbDirDetail = (params) => request({ ...@@ -780,8 +792,6 @@ export const getDbDirDetail = (params) => request({
780 method: 'get', 792 method: 'get',
781 }) 793 })
782 794
783
784
785 /*********************业务规则配置 ************数据库目录************************* */ 795 /*********************业务规则配置 ************数据库目录************************* */
786 796
787 /** 797 /**
......
...@@ -6,13 +6,24 @@ ...@@ -6,13 +6,24 @@
6 import { Warning } from "@element-plus/icons-vue"; 6 import { Warning } from "@element-plus/icons-vue";
7 import TableTools from '@/components/Tools/table_tools.vue'; 7 import TableTools from '@/components/Tools/table_tools.vue';
8 import { 8 import {
9 getCgDirTreeList, getCgDirFieldPageList, getDictionary, saveBizRuleConfig, 9 getDictionary,
10 getDbDirTreeList, getDbDirTablePageList, getDbDirFieldPageList, getExecGuidAndName, 10 saveBizRuleConfig,
11 getClassifyTreeList, getCgLabelPageList, execTaskFieldList, execTaskSheetList, getTaskExeTreeList, 11 getDbDirTreeList,
12 getDbFieldList, exportCgDir, 12 getDbDirTablePageList,
13 getDbDirFieldPageList,
14 getExecGuidAndName,
15 getClassifyTreeList,
16 getCgLabelPageList,
17 execTaskFieldList,
18 execTaskSheetList,
19 getTaskExeTreeList,
20 getDbFieldList,
21 exportCgDir,
13 getGradeList, 22 getGradeList,
14 exportDbDirTable, 23 exportDbDirTable,
15 getDbDirDetail 24 getDbDirDetail,
25 getDbDirTableSelectList,
26 getDbDirFieldSelectList
16 } from '@/api/modules/dataInventory'; 27 } from '@/api/modules/dataInventory';
17 import { TableColumnWidth } from "@/utils/enum"; 28 import { TableColumnWidth } from "@/utils/enum";
18 import router from "@/router"; 29 import router from "@/router";
...@@ -150,6 +161,7 @@ const searchItemList = ref([ ...@@ -150,6 +161,7 @@ const searchItemList = ref([
150 value: 'guid', 161 value: 'guid',
151 }, 162 },
152 clearable: true, 163 clearable: true,
164 filterable: true,
153 }, 165 },
154 { 166 {
155 label: "", 167 label: "",
...@@ -195,16 +207,33 @@ const toSearch = (val: any, clear: boolean = false) => { ...@@ -195,16 +207,33 @@ const toSearch = (val: any, clear: boolean = false) => {
195 searchItemList.value.map(item => item.default = '') 207 searchItemList.value.map(item => item.default = '')
196 } 208 }
197 // 差一个label标签 -- 未完成 209 // 差一个label标签 -- 未完成
198 getCgDirFieldPage({ 210 if (activeName.value === 'first') {
199 pageIndex: 1, 211 getCgDirFieldPage({
200 pageSize: 50, 212 pageIndex: 1,
201 execGuid: execGuidInfo.value.execGuid, 213 pageSize: 50,
202 classifyDetail: val.classifyName, 214 execGuid: execGuidInfo.value.execGuid,
203 gradeDetailGuid: val.levelName, 215 classifyDetail: val.classifyName,
204 databaseGuid: selectedA.value, 216 gradeDetailGuid: val.levelName,
205 tableGuid: selectedB.value, 217 databaseGuid: selectedA.value,
206 fieldGuid: selectedC.value, 218 tableGuid: selectedB.value,
207 }); 219 fieldGuid: selectedC.value,
220 });
221 }
222 if (activeName.value === 'second') {
223 getDataBaseFieldData({
224 pageIndex: 1,
225 pageSize: 50,
226 execGuid: execGuidInfo.value.execGuid,
227 databaseGuid: selectedA.value,
228 tableGuid: selectedB.value,
229 fieldGuid: selectedC.value,
230 });
231 }
232 if (activeName.value === 'second' && activeTab.value === 'word') {
233 getSearchTableList(1, selectedA.value);
234 getSearchTableList(2, selectedB.value);
235 getSearchTableList(3, selectedC.value);
236 }
208 }; 237 };
209 238
210 239
...@@ -408,7 +437,11 @@ const dataBaseTableInfo = ref({ ...@@ -408,7 +437,11 @@ const dataBaseTableInfo = ref({
408 { 437 {
409 label: "新建方式", field: "foundMode", width: 140, getName: (scope) => { 438 label: "新建方式", field: "foundMode", width: 140, getName: (scope) => {
410 let dataGrade = scope.row.foundMode; 439 let dataGrade = scope.row.foundMode;
411 return dataGrade == 1 ? '根据文件新建' : '已有表新建'; 440 return dataGrade === 1
441 ? '已有表新建'
442 : dataGrade === 2
443 ? '根据文件新建'
444 : '--';
412 } 445 }
413 }, 446 },
414 { 447 {
...@@ -713,9 +746,19 @@ const handleClick = (tab: any) => { ...@@ -713,9 +746,19 @@ const handleClick = (tab: any) => {
713 console.log(tab.props.name); 746 console.log(tab.props.name);
714 activeName.value = tab.props.name; 747 activeName.value = tab.props.name;
715 if (tab.props.name === 'second') { 748 if (tab.props.name === 'second') {
749 optionsA.value = [];
750 optionsB.value = [];
751 optionsC.value = [];
716 getDataBaseTreeData(); 752 getDataBaseTreeData();
717 getDataBaseTableData(); 753 getDataBaseTableData();
718 getDataBaseFieldData(); 754 getDataBaseFieldData();
755 getDbDirTableSelectData(1, {});
756 } else {
757 optionsA.value = [];
758 optionsB.value = [];
759 optionsC.value = [];
760 getSearchTableList();
761 isShowWordSearch.value = true;
719 } 762 }
720 } 763 }
721 764
...@@ -770,6 +813,11 @@ const getDataBaseTableData = async (params = {}) => { ...@@ -770,6 +813,11 @@ const getDataBaseTableData = async (params = {}) => {
770 databaseGuid: "", 813 databaseGuid: "",
771 isDataAsset: '', 814 isDataAsset: '',
772 execGuid: execGuidInfo.value.execGuid, 815 execGuid: execGuidInfo.value.execGuid,
816 tableName: "",
817 database: "",
818 label: "",
819 classifyDetailName: "",
820 gradeDetailName: ""
773 }; 821 };
774 const finalParams = { ...dataBaseParams, ...params }; 822 const finalParams = { ...dataBaseParams, ...params };
775 823
...@@ -946,17 +994,57 @@ const addIsShowDatabaseTip = () => { ...@@ -946,17 +994,57 @@ const addIsShowDatabaseTip = () => {
946 994
947 // 表信息和字段信息切换 995 // 表信息和字段信息切换
948 const activeTab = ref('table'); 996 const activeTab = ref('table');
949 997 const isShowWordSearch = ref(true);
950 const setActiveTab = (tab) => { 998 const setActiveTab = (tab) => {
951 console.log('setActiveTab', tab); 999 console.log('setActiveTab', tab);
952 activeTab.value = tab; 1000 activeTab.value = tab;
1001 if (tab === 'word' && activeName.value === 'second') {
1002 isShowWordSearch.value = false;
1003 optionsA.value = [];
1004 optionsB.value = [];
1005 optionsC.value = [];
1006 getDbDirFieldSelectData(1);
1007 } else {
1008 isShowWordSearch.value = true;
1009 optionsA.value = [];
1010 optionsB.value = [];
1011 optionsC.value = [];
1012 getDbDirTableSelectData(1, {});
1013 }
1014 };
1015
1016 // 数据库字段搜索联动 getDbDirFieldSelectList
1017 const getDbDirFieldSelectData = async (type, params = {}) => {
1018 const inParams = {
1019 condition: "database",
1020 database: "",
1021 tableName: "",
1022 execGuid: execGuidInfo.value.execGuid,
1023 };
1024 const finalParams = { ...inParams, ...params };
1025 const res: any = await getDbDirFieldSelectList(finalParams);
1026 if (res.code == proxy.$passCode) {
1027 console.log('getDbDirFieldSelectData', res);
1028 if (type == 1) {
1029 optionsA.value = res.data.map((item) => ({
1030 dbGuid: item.database, // 数据库标识
1031 name: item.database, // 数据库名称
1032 }));
1033 }
1034 if (type == 2) {
1035 optionsB.value = res.data.map((item) => ({
1036 dbGuid: item.tableName, // 表标识
1037 name: item.tableName, // 表名称
1038 }));
1039 }
1040 } else {
1041 proxy.$ElMessage.error(res.msg);
1042 }
953 }; 1043 };
954 1044
955 1045
956 // 获取查询的数据库名 execTaskSheetList 1046 // 获取查询的数据库名 execTaskSheetList
957
958 const getSearchTableList = async (type = 1, dbGuid = '') => { 1047 const getSearchTableList = async (type = 1, dbGuid = '') => {
959
960 const res: any = await getDbFieldList({ 1048 const res: any = await getDbFieldList({
961 execGuid: execGuidInfo.value.execGuid, 1049 execGuid: execGuidInfo.value.execGuid,
962 dbGuid, 1050 dbGuid,
...@@ -974,6 +1062,45 @@ const getSearchTableList = async (type = 1, dbGuid = '') => { ...@@ -974,6 +1062,45 @@ const getSearchTableList = async (type = 1, dbGuid = '') => {
974 proxy.$ElMessage.error(res.msg); 1062 proxy.$ElMessage.error(res.msg);
975 } 1063 }
976 }; 1064 };
1065
1066 //数据库目录搜索联动 getDbDirTableSelectList
1067 const getDbDirTableSelectData = async (type, params = {}) => {
1068 console.log('getDbDirTableSelectData', params);
1069 const inParams = {
1070 condition: "database",
1071 database: "",
1072 tableName: "",
1073 execGuid: execGuidInfo.value.execGuid,
1074 };
1075 const finalParams = { ...inParams, ...params };
1076 const res: any = await getDbDirTableSelectList(finalParams);
1077 if (res.code == proxy.$passCode) {
1078 console.log('getDbDirTableSelectData', res);
1079 if (type == 1) {
1080 optionsA.value = res.data.map((item) => ({
1081 dbGuid: item.database, // 数据库标识
1082 name: item.database, // 数据库名称
1083 }));
1084 }
1085 if (type == 2) {
1086 optionsB.value = res.data.map((item) => ({
1087 dbGuid: item.tableName, // 表标识
1088 name: item.tableName, // 表名称
1089 }));
1090 }
1091 if (type == 3) {
1092 optionsC.value = res.data.map((item) => ({
1093 dbGuid: item.fieldName, // 字段标识
1094 name: item.fieldName, // 字段名称
1095 }));
1096 }
1097
1098 } else {
1099 proxy.$ElMessage.error(res.msg);
1100 }
1101 };
1102
1103
977 const selectedA = ref<any>(null); 1104 const selectedA = ref<any>(null);
978 const selectedB = ref<any>(null); 1105 const selectedB = ref<any>(null);
979 const selectedC = ref<any>(null); 1106 const selectedC = ref<any>(null);
...@@ -988,7 +1115,15 @@ const onAChange = async () => { ...@@ -988,7 +1115,15 @@ const onAChange = async () => {
988 selectedC.value = null; 1115 selectedC.value = null;
989 optionsB.value = []; 1116 optionsB.value = [];
990 optionsC.value = []; 1117 optionsC.value = [];
991 await getSearchTableList(2, selectedA.value); // 根据 A 动态加载 B 的选项 1118 if (!selectedA.value) return;
1119 if (activeName.value == 'first') {
1120 await getSearchTableList(2, selectedA.value); // 分类分级搜索
1121 }
1122 if (activeName.value == 'second') {
1123 console.log('onAChange', optionsA.value);
1124 await getDbDirTableSelectData(2, { database: selectedA.value }); // 数据库搜索
1125 }
1126
992 }; 1127 };
993 1128
994 // 第二个下拉框值改变时 1129 // 第二个下拉框值改变时
...@@ -996,7 +1131,13 @@ const onBChange = async () => { ...@@ -996,7 +1131,13 @@ const onBChange = async () => {
996 console.log('onBChange', selectedB.value); 1131 console.log('onBChange', selectedB.value);
997 selectedC.value = null; 1132 selectedC.value = null;
998 optionsC.value = []; 1133 optionsC.value = [];
999 await getSearchTableList(3, selectedB.value); // 根据 B 动态加载 C 的选项 1134 if (!selectedB.value) return;
1135 if (activeName.value == 'first') {
1136 await getSearchTableList(3, selectedB.value); // 分类分级搜索
1137 }
1138 if (activeName.value == 'second') {
1139 await getDbDirTableSelectData(3, { tableName: selectedB.value }); // 数据库搜索
1140 }
1000 }; 1141 };
1001 1142
1002 // 导出 1143 // 导出
...@@ -1004,6 +1145,7 @@ const btnClick = async () => { ...@@ -1004,6 +1145,7 @@ const btnClick = async () => {
1004 exportCgDir().then((res: any) => { 1145 exportCgDir().then((res: any) => {
1005 download(res, '分类分级目录数据.xlsx', 'excel') 1146 download(res, '分类分级目录数据.xlsx', 'excel')
1006 }); 1147 });
1148
1007 }; 1149 };
1008 // 数据库导出 1150 // 数据库导出
1009 const exportDB = async () => { 1151 const exportDB = async () => {
...@@ -1025,15 +1167,15 @@ const treeSelectNodeChange = (node, item) => { ...@@ -1025,15 +1167,15 @@ const treeSelectNodeChange = (node, item) => {
1025 <div class="classification-template-content"> 1167 <div class="classification-template-content">
1026 <div class="v-table-tools"> 1168 <div class="v-table-tools">
1027 <el-select v-model="selectedA" placeholder="选择数据库名" @change="onAChange" style="width: 140px; margin-right: 8px" 1169 <el-select v-model="selectedA" placeholder="选择数据库名" @change="onAChange" style="width: 140px; margin-right: 8px"
1028 :clearable="false"> 1170 :clearable="true">
1029 <el-option v-for="item in optionsA" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" /> 1171 <el-option v-for="item in optionsA" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
1030 </el-select> 1172 </el-select>
1031 <el-select v-model="selectedB" placeholder="选择表名" :disabled="!selectedA" @change="onBChange" 1173 <el-select v-model="selectedB" placeholder="选择表名" :disabled="!selectedA" @change="onBChange"
1032 style="width: 140px; margin-right: 8px" :clearable="false"> 1174 style="width: 140px; margin-right: 8px" :clearable="true">
1033 <el-option v-for="item in optionsB" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" /> 1175 <el-option v-for="item in optionsB" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
1034 </el-select> 1176 </el-select>
1035 <el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px" 1177 <el-select v-model="selectedC" placeholder="选择字段名" :disabled="!selectedB" style="width: 140px;margin-right: 8px"
1036 :clearable="false"> 1178 :clearable="true" v-if="isShowWordSearch">
1037 <el-option v-for="item in optionsC" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" /> 1179 <el-option v-for="item in optionsC" :key="item.dbGuid" :label="item.name" :value="item.dbGuid" />
1038 </el-select> 1180 </el-select>
1039 <TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch" 1181 <TableTools :searchItems="searchItemList" :init="false" :searchId="'files-standard-search'" @search="toSearch"
......
...@@ -377,23 +377,54 @@ const tableSwitchChange = async (state, scope, field) => { ...@@ -377,23 +377,54 @@ const tableSwitchChange = async (state, scope, field) => {
377 377
378 const tableBtnClick = async (scope, value) => { 378 const tableBtnClick = async (scope, value) => {
379 console.log('tableBtnClick', scope.row); 379 console.log('tableBtnClick', scope.row);
380 // await getGradeListData(scope.row.gradeGuid);
381 // // formItems进行回显,加上disabled: true 不能修改
382 // newCreateGradeFormItems.value.forEach(item => {
383 // item.default = scope.row[item.field];
384 // item.disabled = true;
385 // });
386 // matchChValue.value.value = scope.row.matchChValue;
387 // matchChValue.value.disabled = true;
388 // matchEnValue.value.value = scope.row.matchEnValue;
389 // matchEnValue.value.disabled = true;
390 // if (scope.row.vagueMatchRule) {
391 // // formRows进行回显
392 // formRows.value = scope.row.vagueMatchRule.map((item) => ({
393 // matchValue: item.matchValue,
394 // position: item.position,
395 // name: item.name,
396 // disabled: true
397 // }));
398 // } else {
399 // formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }];
400 // }
401 // newCreateGradeStandardDialogInfo.value.visible = true;
402 newCreateGradeStandardDialogInfo.value.submitBtnLoading = false;
403 newCreateGradeStandardDialogInfo.value.title = '编辑标签';
380 await getGradeListData(scope.row.gradeGuid); 404 await getGradeListData(scope.row.gradeGuid);
405 // 遍历classGradeTreeData 找到对应的guid item的refGradeGuid
406 classGradeTreeData.value.forEach((element: any) => {
407 if (element.guid === scope.row.classifyGuid) {
408 tempRefGradeGuid.value = element.refGradeGuid;
409 }
410 });
411 editLabelRow.value = scope.row;
381 // formItems进行回显,加上disabled: true 不能修改 412 // formItems进行回显,加上disabled: true 不能修改
382 newCreateGradeFormItems.value.forEach(item => { 413 newCreateGradeFormItems.value.forEach(item => {
383 item.default = scope.row[item.field]; 414 item.default = scope.row[item.field];
384 item.disabled = true; 415 item.disabled = false;
385 }); 416 });
386 matchChValue.value.value = scope.row.matchChValue; 417 matchChValue.value.value = scope.row.matchChValue;
387 matchChValue.value.disabled = true; 418 matchChValue.value.disabled = false;
388 matchEnValue.value.value = scope.row.matchEnValue; 419 matchEnValue.value.value = scope.row.matchEnValue;
389 matchEnValue.value.disabled = true; 420 matchEnValue.value.disabled = false;
390 if (scope.row.vagueMatchRule) { 421 if (scope.row.vagueMatchRule) {
391 // formRows进行回显 422 // formRows进行回显
392 formRows.value = scope.row.vagueMatchRule.map((item) => ({ 423 formRows.value = scope.row.vagueMatchRule.map((item) => ({
393 matchValue: item.matchValue, 424 matchValue: item.matchValue,
394 position: item.position, 425 position: item.position,
395 name: item.name, 426 name: item.name,
396 disabled: true 427 disabled: false
397 })); 428 }));
398 } else { 429 } else {
399 formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }]; 430 formRows.value = [{ matchValue: '', position: '', name: '', disabled: false }];
......
...@@ -330,7 +330,7 @@ watch( ...@@ -330,7 +330,7 @@ watch(
330 330
331 watch(currDatasourceSelect, (val) => { 331 watch(currDatasourceSelect, (val) => {
332 if (val?.tableName) { 332 if (val?.tableName) {
333 getPreviewData(); 333 // getPreviewData();
334 getTableStructure(); 334 getTableStructure();
335 } 335 }
336 }); 336 });
...@@ -395,7 +395,8 @@ const getTextAlign = (field) => { ...@@ -395,7 +395,8 @@ const getTextAlign = (field) => {
395 <span>条数据</span> 395 <span>条数据</span>
396 </div> 396 </div>
397 <el-tabs class="preview-tabs" v-model="currDsPreviewActiveName"> 397 <el-tabs class="preview-tabs" v-model="currDsPreviewActiveName">
398 <el-tab-pane label="查询结果" name="resultData" class="t-left"> 398 <!-- resultData,tableStructure -->
399 <!-- <el-tab-pane label="查询结果" name="resultData" class="t-left">
399 <div v-if="!currDatasourceSelect?.tableName" class="no-select-table"> 400 <div v-if="!currDatasourceSelect?.tableName" class="no-select-table">
400 <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> 401 <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" />
401 <span>请从已选库表中选择</span> 402 <span>请从已选库表中选择</span>
...@@ -419,8 +420,8 @@ const getTextAlign = (field) => { ...@@ -419,8 +420,8 @@ const getTextAlign = (field) => {
419 :formatter="(row) => formatterPreviewDate(row, field)"> 420 :formatter="(row) => formatterPreviewDate(row, field)">
420 </el-table-column> 421 </el-table-column>
421 </el-table> 422 </el-table>
422 </el-tab-pane> 423 </el-tab-pane> -->
423 <el-tab-pane label="库表结构" name="tableStructure" class="t-left"> 424 <el-tab-pane label="库表结构" name="resultData" class="t-left">
424 <div v-if="!currDatasourceSelect?.tableName" class="no-select-table"> 425 <div v-if="!currDatasourceSelect?.tableName" class="no-select-table">
425 <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" /> 426 <img src="../../assets/images/no-data.png" :style="{ width: '96px', height: '96px' }" />
426 <span>请从已选库表中选择</span> 427 <span>请从已选库表中选择</span>
......
...@@ -207,9 +207,11 @@ const nextStep = async () => { ...@@ -207,9 +207,11 @@ const nextStep = async () => {
207 207
208 //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value 208 //下一步获取表字段信息getNextTableInfo。getDsData 入参selectedDatabaseTable.value
209 const getNextTableInfo = async (params) => { 209 const getNextTableInfo = async (params) => {
210 tableFieldsLoading.value = true;
210 const res: any = await getDsTableStructures(params); 211 const res: any = await getDsTableStructures(params);
211 if (res.code === proxy.$passCode) { 212 if (res.code === proxy.$passCode) {
212 tableDataDetailInfo.value = res.data; 213 tableDataDetailInfo.value = res.data;
214 tableFieldsLoading.value = false;
213 } else { 215 } else {
214 proxy.$ElMessage.error(res.msg); 216 proxy.$ElMessage.error(res.msg);
215 } 217 }
...@@ -470,73 +472,47 @@ const submitAsDraft = () => { ...@@ -470,73 +472,47 @@ const submitAsDraft = () => {
470 // } 472 // }
471 473
472 const guid = ref('') 474 const guid = ref('')
475 const saveBtn = ref(false)
473 const submit = async () => { 476 const submit = async () => {
474 console.log('提交', tableDataDetailInfo.value, tableDataInfo.value) 477 console.log('提交', tableDataDetailInfo.value, tableDataInfo.value)
475 const params = { 478 saveBtn.value = true
476 tableName: tableDataInfo.value[0].tableName,
477 tableChName: tableDataInfo.value[0].tableChName,
478 foundMode: route.query.foundMode,
479 }
480 // 校验表格数据是否填写完整 479 // 校验表格数据是否填写完整
481 // if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) { 480 // if (!checkTableData(tableDataDetailInfo.value, tableDataInfo.value)) {
482 // return 481 // return
483 // } 482 // }
484 /**
485 "guid": "string",
486 "cgDirName": "string",
487 "dirGuid": "string",
488 "tableGuid": "string",
489 "tableName": "string",
490 "tableChName": "string",
491 "databaseGuid": "string",
492 "database": "string",
493 "dbType": "string",
494 "databaseChName": "string",
495 "foundMode": 0,
496 "state": 0,
497 "isDraft": "string",
498 "fieldRQVOList": [
499 {
500 "guid": "string",
501 "cgDirName": "string",
502 "dirGuid": "string",
503 "classifyName": "string",
504 "gradeDetailName": "string",
505 "tableGuid": "string",
506 "tableName": "string",
507 "tableChName": "string",
508 "databaseGuid": "string",
509 "database": "string",
510 "databaseChName": "string",
511 "fieldGuid": "string",
512 "fieldName": "string",
513 "fieldChName": "string",
514 "fieldType": "string",
515 "fieldLength": 0,
516 "fieldPrecision": 0,
517 "dimGuid": "string",
518 "dictionaryGuid": "string",
519 "sortValue": 0,
520 "isPrimary": "string",
521 "isFk": "string",
522 "isNotNull": "string",
523 "defaultValue": "string"
524 }
525 ], 这是入参
526 */
527 // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参 483 // 如果提交时没有 guid 则为新增type 0,否则为修改 type 1, 也要传参
528 if (!guid.value) { 484 if (!guid.value) {
529 saveOrUpdate({ 485 try {
530 tableName: tableDataInfo.value[0].tableName, 486 await saveOrUpdate({
531 tableChName: tableDataInfo.value[0].tableChName, 487 tableName: tableDataInfo.value[0].tableName,
532 databaseGuid: route.query.databaseGuid || '', 488 tableChName: tableDataInfo.value[0].tableChName,
533 database: route.query.database || '', 489 databaseGuid: route.query.databaseGuid || '',
534 databaseChName: route.query.databaseChName || '', 490 database: route.query.database || '',
535 foundMode: route.query.foundMode, 491 databaseChName: route.query.databaseChName || '',
536 isDraft: 'N', 492 foundMode: route.query.foundMode,
537 }, 0) 493 isDraft: 'N',
494 }, 0)
495 saveBtn.value = false
496 } catch (error) {
497 saveBtn.value = false
498 }
538 } else { 499 } else {
539 saveOrUpdate({}, 1) 500 // 修改 saveOrUpdate({}, 1)
501 try {
502 await saveOrUpdate({
503 guid: guid.value,
504 tableName: tableDataInfo.value[0].tableName,
505 tableChName: tableDataInfo.value[0].tableChName,
506 databaseGuid: route.query.databaseGuid || '',
507 database: route.query.database || '',
508 databaseChName: route.query.databaseChName || '',
509 foundMode: route.query.foundMode,
510 isDraft: 'N',
511 }, 1)
512 saveBtn.value = false
513 } catch (error) {
514 saveBtn.value = false
515 }
540 } 516 }
541 517
542 } 518 }
...@@ -587,7 +563,7 @@ const saveOrUpdate = async (params: any = {}, type) => { ...@@ -587,7 +563,7 @@ const saveOrUpdate = async (params: any = {}, type) => {
587 // 生成建表语句 563 // 生成建表语句
588 const res2: any = await createTableSql(finalParams); 564 const res2: any = await createTableSql(finalParams);
589 if (res2.code === proxy.$passCode) { 565 if (res2.code === proxy.$passCode) {
590 proxy.$ElMessage.success('建表生成成功!'); 566 proxy.$ElMessage.success('建表sql生成成功!');
591 } else { 567 } else {
592 proxy.$ElMessage.error(res2.msg); 568 proxy.$ElMessage.error(res2.msg);
593 } 569 }
...@@ -610,7 +586,7 @@ const newCreateSqlFormItems = ref([{ ...@@ -610,7 +586,7 @@ const newCreateSqlFormItems = ref([{
610 type: 'select', 586 type: 'select',
611 maxlength: 50, 587 maxlength: 50,
612 placeholder: '请输入', 588 placeholder: '请输入',
613 field: 'name', 589 field: 'dbType',
614 default: 'mysql', 590 default: 'mysql',
615 options: options, 591 options: options,
616 block: true, 592 block: true,
...@@ -619,7 +595,7 @@ const newCreateSqlFormItems = ref([{ ...@@ -619,7 +595,7 @@ const newCreateSqlFormItems = ref([{
619 }]); 595 }]);
620 596
621 const newCreateSqlFormRules = ref({ 597 const newCreateSqlFormRules = ref({
622 name: [ 598 dbType: [
623 { required: true, message: '请选择数据库名称', trigger: 'blur' }, 599 { required: true, message: '请选择数据库名称', trigger: 'blur' },
624 ] 600 ]
625 }); 601 });
...@@ -641,6 +617,15 @@ const newCreateSqlDialogInfo = ref({ ...@@ -641,6 +617,15 @@ const newCreateSqlDialogInfo = ref({
641 }, 617 },
642 618
643 submit: async (btn, info) => { 619 submit: async (btn, info) => {
620 // 校验tableDataInfo 分开校验
621 if (!tableDataInfo.value[0].tableName) {
622 proxy.$ElMessage.error('请填写数据库名称');
623 return;
624 }
625 if (!tableDataInfo.value[0].tableChName) {
626 proxy.$ElMessage.error('请填写数据库表');
627 return;
628 }
644 newCreateSqlDialogInfo.value.submitBtnLoading = true; 629 newCreateSqlDialogInfo.value.submitBtnLoading = true;
645 const params = { 630 const params = {
646 ...info, 631 ...info,
...@@ -648,10 +633,18 @@ const newCreateSqlDialogInfo = ref({ ...@@ -648,10 +633,18 @@ const newCreateSqlDialogInfo = ref({
648 tableChName: tableDataInfo.value[0].tableChName, 633 tableChName: tableDataInfo.value[0].tableChName,
649 foundMode: route.query.foundMode, 634 foundMode: route.query.foundMode,
650 isDraft: 'N', 635 isDraft: 'N',
636 databaseGuid: route.query.databaseGuid || '',
637 database: route.query.database || '',
638 databaseChName: route.query.databaseChName || '',
651 }; 639 };
652 await saveOrUpdate(params, 2); 640 try {
653 newCreateSqlDialogInfo.value.submitBtnLoading = false; 641 await saveOrUpdate(params, 2);
654 newCreateSqlDialogInfo.value.visible = false; 642 newCreateSqlDialogInfo.value.visible = false;
643 newCreateSqlDialogInfo.value.visible = false;
644 } catch (error) {
645 newCreateSqlDialogInfo.value.submitBtnLoading = false;
646 }
647
655 } 648 }
656 } 649 }
657 }) 650 })
...@@ -691,7 +684,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -691,7 +684,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
691 width: '100%', 684 width: '100%',
692 'max-height': 'calc(100% - 16px)', 685 'max-height': 'calc(100% - 16px)',
693 display: 'inline-block', 686 display: 'inline-block',
694 }"> 687 }" v-loading="tableFieldsLoading">
695 <!-- 表名称列 --> 688 <!-- 表名称列 -->
696 <el-table-column prop="tableName" label="表名称" width="180"> 689 <el-table-column prop="tableName" label="表名称" width="180">
697 <template #header> 690 <template #header>
...@@ -932,7 +925,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null ...@@ -932,7 +925,7 @@ const inputLengthKeyUp = (regexp, scope, field, max: any = null, min: any = null
932 <template v-else> 925 <template v-else>
933 <el-button @click="previousStep">上一步</el-button> 926 <el-button @click="previousStep">上一步</el-button>
934 <el-button type="primary" @click="submitAsDraft">保存为草稿</el-button> 927 <el-button type="primary" @click="submitAsDraft">保存为草稿</el-button>
935 <el-button type="primary" @click="submit">提交</el-button> 928 <el-button type="primary" @click="submit" v-loading="saveBtn">提交</el-button>
936 </template> 929 </template>
937 </div> 930 </div>
938 <Dialog_form :dialogConfigInfo="newCreateSqlDialogInfo" /> 931 <Dialog_form :dialogConfigInfo="newCreateSqlDialogInfo" />
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!