|
@@ -767,11 +767,14 @@ export default {
|
|
|
};
|
|
|
let res = await getFormName(data);
|
|
|
|
|
|
- const baseTable = await this.getDicts('base_table')
|
|
|
+ const baseTable = await this.getDicts("base_table");
|
|
|
|
|
|
- this.tableList = res.data.filter(item => {
|
|
|
- return !baseTable.data.some(value => value.dictValue.toLowerCase() == item.tableName.toLowerCase())
|
|
|
- })
|
|
|
+ this.tableList = res.data.filter((item) => {
|
|
|
+ return !baseTable.data.some(
|
|
|
+ (value) =>
|
|
|
+ value.dictValue.toLowerCase() == item.tableName.toLowerCase()
|
|
|
+ );
|
|
|
+ });
|
|
|
},
|
|
|
//处理表格行拖拽
|
|
|
initDragTable() {
|
|
@@ -1091,21 +1094,6 @@ export default {
|
|
|
this.$message.error(validRes.msg);
|
|
|
return;
|
|
|
}
|
|
|
- // let validateParams = {
|
|
|
- // isFieldDescrib: false,
|
|
|
- // isRelationFieldAll: false,
|
|
|
- // };
|
|
|
- // this.validateField(this.tableFieldList, validateParams);
|
|
|
- // console.log(validateParams);
|
|
|
- // if (validateParams.isFieldDescrib) {
|
|
|
- // this.$message.error("需要显示的字段描述不能为空");
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // if (validateParams.isRelationFieldAll) {
|
|
|
- // this.$message.error("请补全关联条件");
|
|
|
- // return;
|
|
|
- // }
|
|
|
- let uuid = uuidv4();
|
|
|
let columns = [],
|
|
|
searchFieldList = [],
|
|
|
tableExportField = {};
|
|
@@ -1121,110 +1109,135 @@ export default {
|
|
|
tableFieldData: this.tableFieldList,
|
|
|
formData: this.formData,
|
|
|
};
|
|
|
- // let isAsc = this.formData.isAsc == "ASC" ? 0 : 1;
|
|
|
- let data = {
|
|
|
- tId: this.tId,
|
|
|
- dtName: this.formData.menuName,
|
|
|
- // menuId: this.formData.routePath,
|
|
|
- // tableKey: this.formData.routePath, // 暂定
|
|
|
- dtTableName: this.tableName,
|
|
|
- primaryKey: this.formData.primaryKey,
|
|
|
- orderByColumn: this.formData.orderByColumn,
|
|
|
- sortOrder: this.formData.isAsc,
|
|
|
- sqlKey: uuid,
|
|
|
- dtColumnName: columns, //列字段标题名称(存储显示字段信息
|
|
|
- // dtColumnName: JSON.stringify(columns).replace(/"/g, "'"), //列字段标题名称(存储显示字段信息
|
|
|
- timeFormat: this.formData.timeFormate,
|
|
|
- searchFieldList: searchFieldList, //搜索字段数组
|
|
|
- tableSql: this.getSQLStr(), // 暂定
|
|
|
- tableExportField: tableExportField, //导出字段名及列名
|
|
|
- echoData: JSON.stringify(echoData),
|
|
|
- };
|
|
|
- // this.tableFieldList.forEach((item) => {
|
|
|
- // if (item.isShow) {
|
|
|
- // let tempObj = {};
|
|
|
- // tempObj[item.fieldName] = item.fieldDescription;
|
|
|
- // data.dtColumnName.push(tempObj);
|
|
|
- // if (item.children.length) {
|
|
|
- // item.children.map((child) => {
|
|
|
- // let tempObj = {};
|
|
|
- // tempObj[child.fieldName] = child.fieldDescription;
|
|
|
- // data.dtColumnName.push(tempObj);
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (item.isSearch) {
|
|
|
- // data.searchFieldList.push(item.fieldName);
|
|
|
- // }
|
|
|
- // if (item.isExport) {
|
|
|
- // data.tableExportField[item.fieldName] = item.fieldDescription;
|
|
|
- // }
|
|
|
- // });
|
|
|
- if (!data.searchFieldList.length) {
|
|
|
+ if (!searchFieldList.length) {
|
|
|
this.$message.warning("请至少选择一个包含查询字段");
|
|
|
return false;
|
|
|
}
|
|
|
- let res;
|
|
|
+ // let validateParams = {
|
|
|
+ // isFieldDescrib: false,
|
|
|
+ // isRelationFieldAll: false,
|
|
|
+ // };
|
|
|
+ // this.validateField(this.tableFieldList, validateParams);
|
|
|
+ // console.log(validateParams);
|
|
|
+ // if (validateParams.isFieldDescrib) {
|
|
|
+ // this.$message.error("需要显示的字段描述不能为空");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (validateParams.isRelationFieldAll) {
|
|
|
+ // this.$message.error("请补全关联条件");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ let uuid = uuidv4();
|
|
|
+
|
|
|
+ // 表单
|
|
|
+ let result;
|
|
|
if (this.tId) {
|
|
|
- data.sqlKey = this.editData.sqlKey;
|
|
|
- res = await editTable(data);
|
|
|
+ let payLoad = {
|
|
|
+ menuId: this.menuId,
|
|
|
+ menuName: this.formData.menuName,
|
|
|
+ parentId: this.formData.routePath,
|
|
|
+ component: "tablelist/commonTable/listInfo",
|
|
|
+ icon: "",
|
|
|
+ isCache: "0",
|
|
|
+ isFrame: "1",
|
|
|
+ menuType: "C",
|
|
|
+ orderNum: "0",
|
|
|
+ status: "0",
|
|
|
+ visible: "0",
|
|
|
+ };
|
|
|
+ result = await updateMenu(payLoad);
|
|
|
} else {
|
|
|
- res = await addDragTable(data);
|
|
|
+ let sqlKeyObj = {
|
|
|
+ sqlkey: uuid,
|
|
|
+ };
|
|
|
+ let payLoad = {
|
|
|
+ component: "tablelist/commonTable/listInfo",
|
|
|
+ icon: "",
|
|
|
+ isCache: "0",
|
|
|
+ isFrame: "1",
|
|
|
+ menuName: this.formData.menuName,
|
|
|
+ menuType: "C",
|
|
|
+ orderNum: "0",
|
|
|
+ parentId: this.formData.routePath,
|
|
|
+ path: uuid,
|
|
|
+ query: JSON.stringify(sqlKeyObj),
|
|
|
+ status: "0",
|
|
|
+ visible: "0",
|
|
|
+ };
|
|
|
+ result = await addMenu(payLoad);
|
|
|
}
|
|
|
- if (res.code == 200) {
|
|
|
+
|
|
|
+ if (result.code == 200) {
|
|
|
+ // 更新路由
|
|
|
+ this.reloadRouter();
|
|
|
+
|
|
|
+ // let isAsc = this.formData.isAsc == "ASC" ? 0 : 1;
|
|
|
+ let data = {
|
|
|
+ tId: this.tId,
|
|
|
+ dtName: this.formData.menuName,
|
|
|
+ // menuId: this.formData.routePath,
|
|
|
+ // tableKey: this.formData.routePath, // 暂定
|
|
|
+ dtTableName: this.tableName,
|
|
|
+ primaryKey: this.formData.primaryKey,
|
|
|
+ orderByColumn: this.formData.orderByColumn,
|
|
|
+ sortOrder: this.formData.isAsc,
|
|
|
+ sqlKey: uuid,
|
|
|
+ dtColumnName: columns, //列字段标题名称(存储显示字段信息
|
|
|
+ // dtColumnName: JSON.stringify(columns).replace(/"/g, "'"), //列字段标题名称(存储显示字段信息
|
|
|
+ timeFormat: this.formData.timeFormate,
|
|
|
+ searchFieldList: searchFieldList, //搜索字段数组
|
|
|
+ tableSql: this.getSQLStr(), // 暂定
|
|
|
+ tableExportField: tableExportField, //导出字段名及列名
|
|
|
+ echoData: JSON.stringify(echoData),
|
|
|
+ };
|
|
|
+ // this.tableFieldList.forEach((item) => {
|
|
|
+ // if (item.isShow) {
|
|
|
+ // let tempObj = {};
|
|
|
+ // tempObj[item.fieldName] = item.fieldDescription;
|
|
|
+ // data.dtColumnName.push(tempObj);
|
|
|
+ // if (item.children.length) {
|
|
|
+ // item.children.map((child) => {
|
|
|
+ // let tempObj = {};
|
|
|
+ // tempObj[child.fieldName] = child.fieldDescription;
|
|
|
+ // data.dtColumnName.push(tempObj);
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (item.isSearch) {
|
|
|
+ // data.searchFieldList.push(item.fieldName);
|
|
|
+ // }
|
|
|
+ // if (item.isExport) {
|
|
|
+ // data.tableExportField[item.fieldName] = item.fieldDescription;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+
|
|
|
+ let res;
|
|
|
if (this.tId) {
|
|
|
- let payLoad = {
|
|
|
- menuId: this.menuId,
|
|
|
- menuName: this.formData.menuName,
|
|
|
- parentId: this.formData.routePath,
|
|
|
- component: "tablelist/commonTable/listInfo",
|
|
|
- icon: "",
|
|
|
- isCache: "0",
|
|
|
- isFrame: "1",
|
|
|
- menuType: "C",
|
|
|
- orderNum: "0",
|
|
|
- status: "0",
|
|
|
- visible: "0",
|
|
|
- };
|
|
|
- let result = await updateMenu(payLoad);
|
|
|
- if (result.code == 200) {
|
|
|
- this.$message.success("更新成功");
|
|
|
- this.reloadRouter();
|
|
|
- } else {
|
|
|
- this.$message.warning("更新失败");
|
|
|
- }
|
|
|
+ data.menuId = this.menuId;
|
|
|
+ data.sqlKey = this.editData.sqlKey;
|
|
|
+ res = await editTable(data);
|
|
|
} else {
|
|
|
- let sqlKeyObj = {
|
|
|
- sqlkey: uuid,
|
|
|
- };
|
|
|
- let payLoad = {
|
|
|
- component: "tablelist/commonTable/listInfo",
|
|
|
- icon: "",
|
|
|
- isCache: "0",
|
|
|
- isFrame: "1",
|
|
|
- menuName: this.formData.menuName,
|
|
|
- menuType: "C",
|
|
|
- orderNum: "0",
|
|
|
- parentId: this.formData.routePath,
|
|
|
- path: uuid,
|
|
|
- query: JSON.stringify(sqlKeyObj),
|
|
|
- status: "0",
|
|
|
- visible: "0",
|
|
|
- };
|
|
|
- let result = await addMenu(payLoad);
|
|
|
- if (result.code == 200) {
|
|
|
- this.$message.success("创建成功");
|
|
|
- this.reloadRouter();
|
|
|
- } else {
|
|
|
- this.$message.warning("创建失败");
|
|
|
- }
|
|
|
+ data.menuId = result.data;
|
|
|
+ res = await addDragTable(data);
|
|
|
}
|
|
|
+
|
|
|
// 关闭当前页面
|
|
|
if (this.tId) {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("修改成功");
|
|
|
+ } else {
|
|
|
+ this.$message.warning("修改失败");
|
|
|
+ }
|
|
|
this.$tab.closePage();
|
|
|
this.$router.push({
|
|
|
path: "/system/fromModel/index/tablelist",
|
|
|
});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("创建成功");
|
|
|
+ } else {
|
|
|
+ this.$message.warning("创建失败");
|
|
|
}
|
|
|
this.isShowPreview = false;
|
|
|
}
|