|
@@ -711,6 +711,7 @@ import {
|
|
|
addTableData,
|
|
|
addStatistic,
|
|
|
updateStatistic,
|
|
|
+ insertByDefaultBtn,
|
|
|
} from "@/api/tablelist/commonTable";
|
|
|
import { getDicts } from "@/api/system/dict/data";
|
|
|
import {
|
|
@@ -732,6 +733,7 @@ import { listBtn } from "@/api/system/btn";
|
|
|
import StyleFormPanel from "./components/StyleFormPanel.vue";
|
|
|
import DataFilterPanel from "./components/DataFilterPanel.vue";
|
|
|
import ClassificationQueryPanel from "./components/ClassificationQueryPanel.vue";
|
|
|
+
|
|
|
export default {
|
|
|
name: "tableMange",
|
|
|
dicts: ["sys_time_format", "table_statistic_type"],
|
|
@@ -745,6 +747,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ menuList: [], //路由数组
|
|
|
+ btnTemplate: [], //按钮模板
|
|
|
isNeedNewMenu: false, //是否需要新菜单
|
|
|
filterDataEcho: "", //数据过滤回显数据
|
|
|
classificationDataEcho: "", //分类查询回显数据
|
|
@@ -903,6 +907,13 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
+ ...mapState({
|
|
|
+ databaseName: (state) => state.user.dataSource.databaseName,
|
|
|
+ databaseType: (state) => state.user.dataSource.databaseType,
|
|
|
+ username: (state) => state.user.dataSource.username,
|
|
|
+ tenantId: (state) => state.user.tenant.tenantId,
|
|
|
+ tenantName: (state) => state.user.tenant.tenantName,
|
|
|
+ }),
|
|
|
// 数据字段
|
|
|
dataArr() {
|
|
|
return this.tableFieldList.filter((item) => item.isShow);
|
|
@@ -922,6 +933,7 @@ export default {
|
|
|
databaseType: (state) => state.user.dataSource.databaseType,
|
|
|
username: (state) => state.user.dataSource.username,
|
|
|
tenantId: (state) => state.user.tenant.tenantId,
|
|
|
+ tenantCode: (state) => state.user.tenant.tenantCode,
|
|
|
}),
|
|
|
searchArr() {
|
|
|
if (!this.templateInfo?.where?.length) return [];
|
|
@@ -972,6 +984,51 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取按钮模板数据
|
|
|
+ async getBtnTemplate() {
|
|
|
+ try {
|
|
|
+ let res = await getDicts("drag_table_btn_template");
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.btnTemplate = res.data.map((item) => JSON.parse(item.remark));
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ this.$message.error("获取按钮模板数据失败");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ this.$message.error("获取按钮模板数据失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 格式化按钮模板数据
|
|
|
+ formateBtnTemplate() {
|
|
|
+ let res = {
|
|
|
+ hasPermiName: "",
|
|
|
+ dragTableBtnTop: {},
|
|
|
+ dragTableBtnRight: {},
|
|
|
+ };
|
|
|
+ let moduleName = this.menuList.find(
|
|
|
+ (item) => item.menuId == this.formData.routePath
|
|
|
+ )?.menuName;
|
|
|
+ res.hasPermiName =
|
|
|
+ this.tenantCode + ":" + moduleName + ":" + this.formData.menuName;
|
|
|
+ let primaryKey = this.tableName + "." + this.formData.primaryKey;
|
|
|
+ this.btnTemplate.forEach((item) => {
|
|
|
+ item.children.forEach((i) => {
|
|
|
+ if (i.btnType == "UPDATE" || i.btnType == "DELETE") {
|
|
|
+ let btnParams = { commonFieldData: [], conditionData: [] };
|
|
|
+ btnParams.conditionData.push({
|
|
|
+ fieldName: primaryKey,
|
|
|
+ fieldValue: "",
|
|
|
+ });
|
|
|
+ i.btnParams = JSON.stringify(btnParams);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ res.dragTableBtnTop = this.btnTemplate[0];
|
|
|
+ res.dragTableBtnRight = this.btnTemplate[1];
|
|
|
+ return res;
|
|
|
+ },
|
|
|
// 字段描述验证规则
|
|
|
// blurval(value){
|
|
|
// this.isInputInvalid = value == '' ? true : false;
|
|
@@ -1180,7 +1237,10 @@ export default {
|
|
|
// 获取路由表单数据
|
|
|
async getMenuList() {
|
|
|
let res = await getMenuList();
|
|
|
- this.menus = this.handleTree(res.data, "menuId");
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.menuList = res.data;
|
|
|
+ this.menus = this.handleTree(res.data, "menuId");
|
|
|
+ }
|
|
|
},
|
|
|
// 校验字段合法性(递归版)
|
|
|
validateField(tableFieldList, validateParams) {
|
|
@@ -1639,6 +1699,9 @@ export default {
|
|
|
this.tableKey = uuidv4();
|
|
|
// 表单
|
|
|
let result;
|
|
|
+ let btnTemplate = this.formateBtnTemplate();
|
|
|
+ console.log(btnTemplate);
|
|
|
+
|
|
|
// if (this.tId && this.menuId) {
|
|
|
if (this.menuId && !this.isNeedNewMenu) {
|
|
|
//原菜单存在,仅需要修改菜单数据
|
|
@@ -1658,7 +1721,6 @@ export default {
|
|
|
};
|
|
|
result = await updateMenu(payLoad);
|
|
|
} else if (this.isNeedNewMenu) {
|
|
|
- console.log(111);
|
|
|
//给旧表格新增菜单
|
|
|
let tableKeyObj = {
|
|
|
tableKey: this.editData.tableKey,
|
|
@@ -1810,6 +1872,12 @@ export default {
|
|
|
dtTableName: this.tableName,
|
|
|
});
|
|
|
}
|
|
|
+ if (res.code == 200) {
|
|
|
+ // 新增默认按钮数据
|
|
|
+ btnTemplate.tableKey = data.tableKey;
|
|
|
+ btnTemplate.menuID = result.data;
|
|
|
+ await insertByDefaultBtn(btnTemplate);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 关闭当前页面
|
|
@@ -2021,6 +2089,7 @@ export default {
|
|
|
},
|
|
|
created() {},
|
|
|
async mounted() {
|
|
|
+ this.getBtnTemplate();
|
|
|
this.getAllTable();
|
|
|
this.initDragTable();
|
|
|
await this.getMenuList();
|