|
@@ -57,7 +57,7 @@
|
|
|
|
|
|
<el-table
|
|
|
v-loading="loading"
|
|
|
- :data="tableList"
|
|
|
+ :data="tableData"
|
|
|
ref="tableRef"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
>
|
|
@@ -322,8 +322,6 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -350,14 +348,20 @@ export default {
|
|
|
dicts: ["sys_time_format", "table_statistic_type"],
|
|
|
data () {
|
|
|
return {
|
|
|
+ // 字段描述规则
|
|
|
+ isInputInvalid: false,
|
|
|
+ // 表格数据
|
|
|
+ tableData:[],
|
|
|
queryParams: {},
|
|
|
showSearch: true,
|
|
|
+ // 新增弹框
|
|
|
dialogVisible: false,
|
|
|
// 选中数组(包含所有数据)
|
|
|
ids: [],
|
|
|
selection: [],
|
|
|
Keys: [],
|
|
|
menuIds: [],
|
|
|
+ menus: [], //路由列表数据
|
|
|
// 非单个禁用
|
|
|
single: true,
|
|
|
// 非多个禁用
|
|
@@ -367,6 +371,7 @@ export default {
|
|
|
loading: false,
|
|
|
|
|
|
tableItemRules: [],
|
|
|
+ // 新增弹框数据
|
|
|
tableItemForm: {
|
|
|
tId: "",
|
|
|
rowId: "",
|
|
@@ -440,9 +445,63 @@ export default {
|
|
|
handleQuery(){},
|
|
|
// 重置
|
|
|
resetQuery(){},
|
|
|
- // 新增
|
|
|
- handleAdd(){
|
|
|
+ // 新增按钮
|
|
|
+ async handleAdd(){
|
|
|
this.dialogVisible = true
|
|
|
+ this.getAllTable()
|
|
|
+ await this.getMenuList()
|
|
|
+ },
|
|
|
+ // 获取所有表格
|
|
|
+ async getAllTable() {
|
|
|
+ let data = {
|
|
|
+ databaseName: this.databaseName,
|
|
|
+ databaseType: this.databaseType,
|
|
|
+ };
|
|
|
+ let res = await getFormName(data);
|
|
|
+
|
|
|
+ const baseTable = await this.getDicts("base_table");
|
|
|
+
|
|
|
+ this.tableList = res.data.filter((item) => {
|
|
|
+ return !baseTable.data.some(
|
|
|
+ (value) =>
|
|
|
+ value.dictValue.toLowerCase() == item.tableName.toLowerCase()
|
|
|
+ );
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 查询列表 */
|
|
|
+ getList(queryParams) {
|
|
|
+ if (!this.tableItemForm.tableName) return;
|
|
|
+ let data = {
|
|
|
+ databaseName: this.databaseName,
|
|
|
+ databaseType: this.databaseType,
|
|
|
+ tableName: this.tableItemForm.tableName,
|
|
|
+ };
|
|
|
+
|
|
|
+ // 获取当前表单结构信息
|
|
|
+ getListName(data).then((res) => {
|
|
|
+ this.tableFieldList = res.map((item, index) => {
|
|
|
+ return {
|
|
|
+ id: this.tableItemForm.tableName + "_" + item.fieldName,
|
|
|
+ fieldName: item.fieldName,
|
|
|
+ fieldDescription: item.fieldDescription,
|
|
|
+ relationTable: "",
|
|
|
+ relationFieldName: "",
|
|
|
+ relaFieldNameList: [],
|
|
|
+ disableRelaFieldName: false,
|
|
|
+ relationType: "",
|
|
|
+ relationShowField: [],
|
|
|
+ relationShowFiledList: [],
|
|
|
+ disableRelaType: false,
|
|
|
+ isShow: true,
|
|
|
+ isSearch: false,
|
|
|
+ isExport: true,
|
|
|
+ relationTableList: this.relationTableList,
|
|
|
+ tableName: this.tableItemForm.tableName,
|
|
|
+ relationFieldList: [],
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
@@ -453,12 +512,7 @@ export default {
|
|
|
this.single = selection.length !== 1;
|
|
|
this.multiple = !selection.length;
|
|
|
},
|
|
|
- // 获取路由表单数据
|
|
|
- async getMenuList() {
|
|
|
- let res = await listGroup();
|
|
|
- console.log('res', res);
|
|
|
- this.menus = this.handleTree(res.data, "menuId");
|
|
|
- },
|
|
|
+
|
|
|
// 递归拼接查询语句
|
|
|
getSQLString(tableFieldList, fieldArr, tableArr, sqlType = "mysql") {
|
|
|
let prefix = "{DBNAME}.";
|
|
@@ -536,8 +590,8 @@ export default {
|
|
|
}
|
|
|
return sql;
|
|
|
},
|
|
|
- // 关联表变化回调
|
|
|
- async ralationTableChange(row) {
|
|
|
+ // 关联表变化回调
|
|
|
+ async ralationTableChange(row) {
|
|
|
this.tableFieldList = this.tableFieldList.filter((item) => {
|
|
|
return !row.relationFieldList.some((val) => {
|
|
|
return val.id == item.id;
|
|
@@ -642,12 +696,17 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- // 更新路由
|
|
|
- reloadRouter() {
|
|
|
+ // 更新路由
|
|
|
+ reloadRouter() {
|
|
|
this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
|
|
|
this.$router.addRoutes(accessRoutes); // 动态添加可访问路由表
|
|
|
});
|
|
|
},
|
|
|
+ // 获取路由表单数据
|
|
|
+ async getMenuList() {
|
|
|
+ let res = await listGroup();
|
|
|
+ this.menus = this.handleTree(res.data, "menuId");
|
|
|
+ },
|
|
|
// 获取目标menu
|
|
|
getTargetMenu(menus) {
|
|
|
for (let i = 0; i < menus.length; i++) {
|
|
@@ -688,12 +747,7 @@ export default {
|
|
|
let res = await getMenuList();
|
|
|
this.menus = this.handleTree(res.data, "menuId");
|
|
|
},
|
|
|
- // 更新路由
|
|
|
- reloadRouter() {
|
|
|
- this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
|
|
|
- this.$router.addRoutes(accessRoutes); // 动态添加可访问路由表
|
|
|
- });
|
|
|
- },
|
|
|
+
|
|
|
/** 转换菜单数据结构 */
|
|
|
normalizer(node) {
|
|
|
if (node.children && !node.children.length) {
|
|
@@ -705,6 +759,12 @@ export default {
|
|
|
children: node.children,
|
|
|
};
|
|
|
},
|
|
|
+ // 更新路由
|
|
|
+ reloadRouter() {
|
|
|
+ this.$store.dispatch("GenerateRoutes").then((accessRoutes) => {
|
|
|
+ this.$router.addRoutes(accessRoutes); // 动态添加可访问路由表
|
|
|
+ });
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -718,4 +778,32 @@ export default {
|
|
|
width: 217px !important;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.ipt {
|
|
|
+ height: 36px;
|
|
|
+ line-height: 36px;
|
|
|
+ font-size: 14px;
|
|
|
+ width: 100%;
|
|
|
+ outline: none;
|
|
|
+ text-align: center;
|
|
|
+ background-color: #fff;
|
|
|
+ border: 1px solid #dcdfe6;
|
|
|
+ color: #606266;
|
|
|
+ display: inline-block;
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.isNullDesc {
|
|
|
+ border-color: #ff4949 !important;
|
|
|
+}
|
|
|
+
|
|
|
+.ipt:focus {
|
|
|
+ border-color: #1890ff;
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+
|
|
|
+.vue-treeselect{
|
|
|
+ z-index: 9999 !important;
|
|
|
+}
|
|
|
</style>
|