|
@@ -208,7 +208,7 @@
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
- v-show="isShowExcuteCol"
|
|
|
|
|
|
+ v-if="isShowExcuteCol"
|
|
label="操作"
|
|
label="操作"
|
|
align="center"
|
|
align="center"
|
|
class-name="small-padding fixed-width"
|
|
class-name="small-padding fixed-width"
|
|
@@ -264,6 +264,7 @@ import {
|
|
listTable,
|
|
listTable,
|
|
unionListTableData,
|
|
unionListTableData,
|
|
getInfoBySqlKey,
|
|
getInfoBySqlKey,
|
|
|
|
+ btnCommonApi,
|
|
addTableData,
|
|
addTableData,
|
|
batchEdit,
|
|
batchEdit,
|
|
getStatisticList,
|
|
getStatisticList,
|
|
@@ -274,6 +275,7 @@ import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
|
|
import { camelCase } from "@/utils";
|
|
import { camelCase } from "@/utils";
|
|
import { inputDisableComplete } from "@/utils/other";
|
|
import { inputDisableComplete } from "@/utils/other";
|
|
import Menu from "./BtnMenu.vue";
|
|
import Menu from "./BtnMenu.vue";
|
|
|
|
+import { checkRole } from "@/utils/permission";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "listInfo",
|
|
name: "listInfo",
|
|
@@ -366,6 +368,8 @@ export default {
|
|
excuteBtnArr: [],
|
|
excuteBtnArr: [],
|
|
// 下拉框动态数据
|
|
// 下拉框动态数据
|
|
dynamicData: {},
|
|
dynamicData: {},
|
|
|
|
+ // 当前点击按钮的数据
|
|
|
|
+ currentBtnData: {},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
|
|
@@ -383,6 +387,7 @@ export default {
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
isShowExcuteCol() {
|
|
isShowExcuteCol() {
|
|
|
|
+ console.log(!this.excuteBtnArr?.every((arr) => arr.children.length == 0));
|
|
// return true;
|
|
// return true;
|
|
return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
|
|
return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
|
|
},
|
|
},
|
|
@@ -455,12 +460,12 @@ export default {
|
|
getStatisticList({
|
|
getStatisticList({
|
|
queryMap: {
|
|
queryMap: {
|
|
tableKey: this.templateInfo.template.tableKey,
|
|
tableKey: this.templateInfo.template.tableKey,
|
|
- queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue
|
|
|
|
|
|
+ queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue,
|
|
},
|
|
},
|
|
- }).then(res => {
|
|
|
|
|
|
+ }).then((res) => {
|
|
// console.log('getStatisticList', res);
|
|
// console.log('getStatisticList', res);
|
|
- this.statisticList = res.data
|
|
|
|
- })
|
|
|
|
|
|
+ this.statisticList = res.data;
|
|
|
|
+ });
|
|
});
|
|
});
|
|
},
|
|
},
|
|
isUpperCase(char) {
|
|
isUpperCase(char) {
|
|
@@ -598,31 +603,79 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
- handleUpdate(row) {
|
|
|
|
- console.log(row);
|
|
|
|
- getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
|
|
|
|
- if (!data || !data.dfVueTemplate) {
|
|
|
|
|
|
+ async handleUpdate(row, btnData) {
|
|
|
|
+ console.log(this.currentBtnData);
|
|
|
|
+
|
|
|
|
+ // 新的修改请求
|
|
|
|
+ try {
|
|
|
|
+ let payLoad = {
|
|
|
|
+ basicMap: {
|
|
|
|
+ btnType: 8,
|
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
|
+ visible: "false",
|
|
|
|
+ sqlKey: this.templateInfo.template.sqlKey,
|
|
|
|
+ tableName: this.tableName,
|
|
|
|
+ },
|
|
|
|
+ conditionMap: {},
|
|
|
|
+ };
|
|
|
|
+ let primary = camelCase(
|
|
|
|
+ this.tableName + "_" + this.templateInfo.template?.primaryKey
|
|
|
|
+ );
|
|
|
|
+ payLoad.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
|
+ row[primary];
|
|
|
|
+ let res = await btnCommonApi(payLoad);
|
|
|
|
+ if (!res.data || !res.data.template.dfVueTemplate) {
|
|
this.$message.error("当前表格未绑定表单!");
|
|
this.$message.error("当前表格未绑定表单!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- // let fieldList = Object.keys(row);
|
|
|
|
|
|
+ res.data.template.dfFormSql &&
|
|
|
|
+ (this.dynamicData = JSON.parse(res.data.template.dfFormSql));
|
|
|
|
+ this.addRealFieldName(res.data.result.resultMap);
|
|
|
|
+ let resultMap = res.data.result.resultMap;
|
|
|
|
+ // let fieldList = Object.keys(resultMap);
|
|
// let tableName = this.longestCommonSubstring(fieldList);
|
|
// let tableName = this.longestCommonSubstring(fieldList);
|
|
// fieldList.forEach((field) => {
|
|
// fieldList.forEach((field) => {
|
|
// let realField = field.replace(tableName, "");
|
|
// let realField = field.replace(tableName, "");
|
|
// realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
// realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
- // row[realField] = row[field];
|
|
|
|
|
|
+ // resultMap[realField] = resultMap[field];
|
|
// });
|
|
// });
|
|
- this.addRealFieldName(row);
|
|
|
|
- Object.assign(this.defaultValue, row);
|
|
|
|
- this.jsonData = JSON.parse(data.dfVueTemplate);
|
|
|
|
|
|
+ console.log(resultMap);
|
|
|
|
+ Object.assign(this.defaultValue, resultMap);
|
|
|
|
+ this.jsonData = JSON.parse(res.data.template.dfVueTemplate);
|
|
this.open = true;
|
|
this.open = true;
|
|
this.title = "修改信息";
|
|
this.title = "修改信息";
|
|
this.form.password = this.initPassword;
|
|
this.form.password = this.initPassword;
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
- this.$refs.addFromRef.setData(row);
|
|
|
|
|
|
+ this.$refs.addFromRef.setData(res.data.result.resultMap);
|
|
});
|
|
});
|
|
- });
|
|
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
|
|
+ // getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
|
|
|
|
+ // if (!data || !data.dfVueTemplate) {
|
|
|
|
+ // this.$message.error("当前表格未绑定表单!");
|
|
|
|
+ // return;
|
|
|
|
+ // }
|
|
|
|
+ // // let fieldList = Object.keys(row);
|
|
|
|
+ // // let tableName = this.longestCommonSubstring(fieldList);
|
|
|
|
+ // // fieldList.forEach((field) => {
|
|
|
|
+ // // let realField = field.replace(tableName, "");
|
|
|
|
+ // // realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
|
|
+ // // row[realField] = row[field];
|
|
|
|
+ // // });
|
|
|
|
+ // this.addRealFieldName(row);
|
|
|
|
+ // Object.assign(this.defaultValue, row);
|
|
|
|
+ // this.jsonData = JSON.parse(data.dfVueTemplate);
|
|
|
|
+ // this.open = true;
|
|
|
|
+ // this.title = "修改信息";
|
|
|
|
+ // this.form.password = this.initPassword;
|
|
|
|
+ // this.$nextTick(() => {
|
|
|
|
+ // this.$refs.addFromRef.setData(row);
|
|
|
|
+ // });
|
|
|
|
+ // });
|
|
|
|
+ // return;
|
|
this.reset();
|
|
this.reset();
|
|
const userId = row.userId || this.ids;
|
|
const userId = row.userId || this.ids;
|
|
getUser(userId).then((response) => {
|
|
getUser(userId).then((response) => {
|
|
@@ -671,7 +724,7 @@ export default {
|
|
*
|
|
*
|
|
* 删除提示信息语句(标识)
|
|
* 删除提示信息语句(标识)
|
|
* */
|
|
* */
|
|
- handleDelete(row) {
|
|
|
|
|
|
+ handleDelete(row, btnData) {
|
|
let delIds = this.ids;
|
|
let delIds = this.ids;
|
|
let primary = camelCase(this.templateInfo.template?.primaryKey);
|
|
let primary = camelCase(this.templateInfo.template?.primaryKey);
|
|
this.addRealFieldName(row);
|
|
this.addRealFieldName(row);
|
|
@@ -681,6 +734,8 @@ export default {
|
|
}
|
|
}
|
|
let data = {
|
|
let data = {
|
|
basicMap: {
|
|
basicMap: {
|
|
|
|
+ btnType: 9,
|
|
|
|
+ btnKey: btnData.btnKey,
|
|
tableName: this.tableName,
|
|
tableName: this.tableName,
|
|
},
|
|
},
|
|
conditionMap: {
|
|
conditionMap: {
|
|
@@ -691,7 +746,8 @@ export default {
|
|
this.$modal
|
|
this.$modal
|
|
.confirm('是否确认删除"' + delIds + '"的数据项?')
|
|
.confirm('是否确认删除"' + delIds + '"的数据项?')
|
|
.then(function () {
|
|
.then(function () {
|
|
- return delTableData(data);
|
|
|
|
|
|
+ // return delTableData(data);
|
|
|
|
+ return btnCommonApi(data);
|
|
})
|
|
})
|
|
.then(() => {
|
|
.then(() => {
|
|
// 调用子组件查询方法 目的是携带上子组件中的查询参数
|
|
// 调用子组件查询方法 目的是携带上子组件中的查询参数
|
|
@@ -780,48 +836,81 @@ export default {
|
|
let data = {
|
|
let data = {
|
|
basicMap: {
|
|
basicMap: {
|
|
tableName: this.tableName,
|
|
tableName: this.tableName,
|
|
|
|
+ // btnKey: btnData.btnKey,
|
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
},
|
|
},
|
|
addListMap: [values],
|
|
addListMap: [values],
|
|
|
|
+ conditionMap: {},
|
|
|
|
+ commMap: {},
|
|
};
|
|
};
|
|
if (Object.keys(this.defaultValue).length) {
|
|
if (Object.keys(this.defaultValue).length) {
|
|
- let updateData = {
|
|
|
|
- // 基本参数
|
|
|
|
- basicMap: {
|
|
|
|
- // 表名
|
|
|
|
- tableName: this.tableName,
|
|
|
|
- },
|
|
|
|
- conditionMap: {},
|
|
|
|
- commMap: {},
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
|
|
+ //修改
|
|
// 后台接收需要是表中字段真实的名称,无所谓驼峰。
|
|
// 后台接收需要是表中字段真实的名称,无所谓驼峰。
|
|
- updateData.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
|
|
|
+ data.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
this.defaultValue[
|
|
this.defaultValue[
|
|
camelCase(this.templateInfo.template?.primaryKey)
|
|
camelCase(this.templateInfo.template?.primaryKey)
|
|
];
|
|
];
|
|
Object.keys(values).map((k) => {
|
|
Object.keys(values).map((k) => {
|
|
- updateData.commMap[k] = values[k];
|
|
|
|
|
|
+ data.commMap[k] = values[k];
|
|
});
|
|
});
|
|
- let res = await batchEdit(updateData);
|
|
|
|
- if (res.code == 200) {
|
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
|
- } else {
|
|
|
|
- this.$modal.msgError("修改失败");
|
|
|
|
- }
|
|
|
|
- this.getList();
|
|
|
|
|
|
+ data.basicMap.btnType = 8;
|
|
|
|
+ data.basicMap.visible = true;
|
|
} else {
|
|
} else {
|
|
- let res = await addTableData(data);
|
|
|
|
|
|
+ data.basicMap.btnType = 10;
|
|
|
|
+ data.basicMap.visible = true;
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ let res = await btnCommonApi(data);
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
- this.$modal.msgSuccess("添加成功");
|
|
|
|
|
|
+ this.$message.success("操作成功");
|
|
} else {
|
|
} else {
|
|
- this.$modal.msgError("添加失败");
|
|
|
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
}
|
|
}
|
|
- this.getList();
|
|
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error);
|
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
}
|
|
}
|
|
|
|
+ // if (Object.keys(this.defaultValue).length) {
|
|
|
|
+ // let updateData = {
|
|
|
|
+ // // 基本参数
|
|
|
|
+ // basicMap: {
|
|
|
|
+ // // 表名
|
|
|
|
+ // tableName: this.tableName,
|
|
|
|
+ // },
|
|
|
|
+ // conditionMap: {},
|
|
|
|
+ // commMap: {},
|
|
|
|
+ // };
|
|
|
|
+
|
|
|
|
+ // // 后台接收需要是表中字段真实的名称,无所谓驼峰。
|
|
|
|
+ // updateData.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
|
+ // this.defaultValue[
|
|
|
|
+ // camelCase(this.templateInfo.template?.primaryKey)
|
|
|
|
+ // ];
|
|
|
|
+ // Object.keys(values).map((k) => {
|
|
|
|
+ // updateData.commMap[k] = values[k];
|
|
|
|
+ // });
|
|
|
|
+ // let res = await batchEdit(updateData);
|
|
|
|
+ // if (res.code == 200) {
|
|
|
|
+ // this.$modal.msgSuccess("修改成功");
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$modal.msgError("修改失败");
|
|
|
|
+ // }
|
|
|
|
+ // this.getList();
|
|
|
|
+ // } else {
|
|
|
|
+ // let res = await addTableData(data);
|
|
|
|
+ // if (res.code == 200) {
|
|
|
|
+ // this.$modal.msgSuccess("添加成功");
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$modal.msgError("添加失败");
|
|
|
|
+ // }
|
|
|
|
+ // this.getList();
|
|
|
|
+ // }
|
|
|
|
+ this.getList();
|
|
this.defaultValue = {};
|
|
this.defaultValue = {};
|
|
this.open = false;
|
|
this.open = false;
|
|
})
|
|
})
|
|
.catch((res) => {
|
|
.catch((res) => {
|
|
|
|
+ console.log(res);
|
|
this.$modal.msgError("表单校验失败,请规范填写数据");
|
|
this.$modal.msgError("表单校验失败,请规范填写数据");
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -952,8 +1041,8 @@ export default {
|
|
},
|
|
},
|
|
|
|
|
|
// 内链页面跳转
|
|
// 内链页面跳转
|
|
- routerHandler(link, type) {
|
|
|
|
- console.log(link);
|
|
|
|
|
|
+ routerHandler(btnData, type) {
|
|
|
|
+ let link = btnData.btnParams;
|
|
if (type == "3") {
|
|
if (type == "3") {
|
|
this.$router.push(link);
|
|
this.$router.push(link);
|
|
} else {
|
|
} else {
|
|
@@ -963,22 +1052,22 @@ export default {
|
|
|
|
|
|
// 操作列回调
|
|
// 操作列回调
|
|
excuteHandler(btnData, row) {
|
|
excuteHandler(btnData, row) {
|
|
- console.log(btnData, row);
|
|
|
|
let { btnType, btnParams } = btnData;
|
|
let { btnType, btnParams } = btnData;
|
|
|
|
+ this.currentBtnData = btnData;
|
|
switch (
|
|
switch (
|
|
btnType //3:内链 6:目录 7:外链 8:修改 9:删除
|
|
btnType //3:内链 6:目录 7:外链 8:修改 9:删除
|
|
) {
|
|
) {
|
|
case "3":
|
|
case "3":
|
|
- this.routerHandler(btnParams, btnType);
|
|
|
|
|
|
+ this.routerHandler(btnData, btnType);
|
|
break;
|
|
break;
|
|
case "7":
|
|
case "7":
|
|
- this.routerHandler(btnParams, btnType);
|
|
|
|
|
|
+ this.routerHandler(btnData, btnType);
|
|
break;
|
|
break;
|
|
case "8":
|
|
case "8":
|
|
- this.handleUpdate(row);
|
|
|
|
|
|
+ this.handleUpdate(row, btnData);
|
|
break;
|
|
break;
|
|
case "9":
|
|
case "9":
|
|
- this.handleDelete(row);
|
|
|
|
|
|
+ this.handleDelete(row, btnData);
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|