|
@@ -614,6 +614,15 @@ export default {
|
|
|
primaryKeyList() {
|
|
|
return this.tableFieldList.filter((item) => !item.isChildren);
|
|
|
},
|
|
|
+ menuOrderNum() {
|
|
|
+ if (!this.formData.routePath) return 0;
|
|
|
+ let targetMenu = this.getTargetMenu(this.menus);
|
|
|
+ if (targetMenu.children?.length) {
|
|
|
+ return targetMenu.children.length;
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
tableName: function (val) {
|
|
@@ -632,6 +641,18 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取目标menu
|
|
|
+ getTargetMenu(menus) {
|
|
|
+ for (let i = 0; i < menus.length; i++) {
|
|
|
+ if (menus[i].menuId == this.formData.routePath) {
|
|
|
+ return menus[i];
|
|
|
+ } else if (menus.children?.length) {
|
|
|
+ return this.getTargetMenu(menus.children);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+
|
|
|
/** 查询列表 */
|
|
|
getList(queryParams) {
|
|
|
if (!this.tableName) return;
|
|
@@ -864,6 +885,31 @@ export default {
|
|
|
msg: "显示的字段数不能为空",
|
|
|
};
|
|
|
}
|
|
|
+ if (
|
|
|
+ tableFieldList.filter((item) => item.isExport && !item.isChildren)
|
|
|
+ .length == 0
|
|
|
+ ) {
|
|
|
+ return {
|
|
|
+ val: false,
|
|
|
+ msg: "导出字段中至少应有一个主表字段",
|
|
|
+ };
|
|
|
+ }
|
|
|
+ // 导出的字段的描述不能重复
|
|
|
+ let describeArr = tableFieldList
|
|
|
+ .filter((item) => item.isExport)
|
|
|
+ .map((item) => item.fieldDescription);
|
|
|
+ let isRepeat = false;
|
|
|
+ describeArr.map((item) => {
|
|
|
+ if (describeArr.indexOf(item) != describeArr.lastIndexOf(item)) {
|
|
|
+ isRepeat = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (isRepeat) {
|
|
|
+ return {
|
|
|
+ val: false,
|
|
|
+ msg: "导出的字段描述不能重复",
|
|
|
+ };
|
|
|
+ }
|
|
|
|
|
|
return {
|
|
|
val: true,
|
|
@@ -1146,7 +1192,7 @@ export default {
|
|
|
isCache: "0",
|
|
|
isFrame: "1",
|
|
|
menuType: "C",
|
|
|
- orderNum: "0",
|
|
|
+ orderNum: this.menuOrderNum,
|
|
|
status: "0",
|
|
|
visible: "0",
|
|
|
};
|
|
@@ -1162,7 +1208,7 @@ export default {
|
|
|
isFrame: "1",
|
|
|
menuName: this.formData.menuName,
|
|
|
menuType: "C",
|
|
|
- orderNum: "0",
|
|
|
+ orderNum: this.menuOrderNum,
|
|
|
parentId: this.formData.routePath,
|
|
|
path: uuid,
|
|
|
query: JSON.stringify(sqlKeyObj),
|