|
@@ -512,7 +512,7 @@ export default {
|
|
|
this.tableKey = this.$route.query.tableKey;
|
|
|
console.log('this.$route.query',this.$route.query)
|
|
|
// 优化共通模版查询调用逻辑 (Don't fucking change it)
|
|
|
- console.log('this.queryParams',this.queryParams)
|
|
|
+ console.log('this.queryParams',this.queryParams)
|
|
|
this.getList(this.queryParams);
|
|
|
},
|
|
|
mounted() {
|
|
@@ -995,6 +995,193 @@ export default {
|
|
|
console.log(this.times);
|
|
|
return;
|
|
|
},
|
|
|
+
|
|
|
+ async handleCalculate(row, btnData) {
|
|
|
+ let nameTable = this.templateInfo.template.dtTableName;
|
|
|
+ this.rowobj = {};
|
|
|
+ let obj = {};
|
|
|
+ this.formList = [];
|
|
|
+ for (let key in row) {
|
|
|
+ let modifiedTable = key
|
|
|
+ .replace(/[A-Z]/g, (match) => `_${match}`)
|
|
|
+ .toLowerCase();
|
|
|
+
|
|
|
+ this.rowobj[modifiedTable] = row[key];
|
|
|
+
|
|
|
+ let str = modifiedTable.substring(nameTable.length + 1);
|
|
|
+ obj[str] = row[key];
|
|
|
+ }
|
|
|
+ // 新的修改请求
|
|
|
+ try {
|
|
|
+ let { btnFormType, btnGroupType } = btnData;
|
|
|
+ let payLoad = {};
|
|
|
+ let primary = camelCase(
|
|
|
+ this.tableName + "_" + this.templateInfo.template?.primaryKey
|
|
|
+ );
|
|
|
+ payLoad = {
|
|
|
+ basicMap: {
|
|
|
+ btnType: this.currentBtnData.btnType,
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
+ visible: "false",
|
|
|
+ sqlKey: this.templateInfo.template.sqlKey,
|
|
|
+ tableName: this.tableName,
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ };
|
|
|
+ payLoad.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
+ row[primary];
|
|
|
+ // }
|
|
|
+
|
|
|
+ let res = await btnCommonApi(payLoad);
|
|
|
+ // 判断是否绑定dialog弹窗
|
|
|
+ if (!this.currentBtnData.btnTableFormGroupKey) {
|
|
|
+ if (
|
|
|
+ btnGroupType == "right" &&
|
|
|
+ (!res.data || !res.data.template) &&
|
|
|
+ !res.data?.mainForm
|
|
|
+ ) {
|
|
|
+ //右侧判定逻辑
|
|
|
+ this.$message.error("当前按钮未绑定表单!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ btnGroupType == "top" &&
|
|
|
+ (!res.data || !res.data.dfVueTemplate) &&
|
|
|
+ !res.data?.mainForm
|
|
|
+ ) {
|
|
|
+ //顶部判定逻辑
|
|
|
+ this.$message.error("当前按钮未绑定表单!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (btnFormType == "dragFormGroup") {
|
|
|
+ //表单组
|
|
|
+ if (res.code == 200) {
|
|
|
+ if (res.data.mainForm) {
|
|
|
+ //表单组
|
|
|
+ // 判断是否有布局数据
|
|
|
+ this.isLayout =
|
|
|
+ res.data.layoutJson &&
|
|
|
+ JSON.parse(res.data.layoutJson)?.list.length > 0;
|
|
|
+ this.transformDataFormat(res.data);
|
|
|
+ if (this.isLayout) {
|
|
|
+ //自定义布局
|
|
|
+ this.layoutData = JSON.parse(JSON.stringify(res.data));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.formList = res.data;
|
|
|
+ }
|
|
|
+ this.open = true;
|
|
|
+ if (btnData.btnFormType == "dragFormGroup") {
|
|
|
+ if (this.times) {
|
|
|
+ this.times = 0;
|
|
|
+ // debugger;
|
|
|
+ this.$nextTick(async () => {
|
|
|
+ // debugger;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.handleUpdate(row, btnData).then((res) => {
|
|
|
+ this.formListShow = true;
|
|
|
+ });
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.times = 0;
|
|
|
+ // }, 1000);
|
|
|
+ }, 1000);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (this.isLayout) {
|
|
|
+ //布局样式
|
|
|
+ this.$nextTick(() => {
|
|
|
+ // 手动触发布局组件的数据处理函数
|
|
|
+ this.$refs.formGroupLayoutRef?.initLayoutData(
|
|
|
+ JSON.parse(JSON.stringify(res.data))
|
|
|
+ );
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let optionsData = "",
|
|
|
+ templateData = "";
|
|
|
+ if (btnGroupType == "top") {
|
|
|
+ optionsData = res.data.dfFormSql;
|
|
|
+ templateData = res.data.dfVueTemplate;
|
|
|
+ } else {
|
|
|
+ //修改
|
|
|
+ optionsData = res.data.template.dfFormSql;
|
|
|
+ templateData = res.data.template.dfVueTemplate;
|
|
|
+
|
|
|
+ this.addRealFieldName(res.data.result.resultMap);
|
|
|
+ let resultMap = res.data.result.resultMap;
|
|
|
+
|
|
|
+ Object.assign(this.defaultValue, resultMap);
|
|
|
+ }
|
|
|
+ //单个表单
|
|
|
+ optionsData && (this.dynamicData = JSON.parse(optionsData));
|
|
|
+ this.jsonData = JSON.parse(templateData);
|
|
|
+ // console.log('[----- this.jsonData -----]', this.jsonData )
|
|
|
+ this.open = true;
|
|
|
+ this.title = "计算表单";
|
|
|
+ this.form.password = this.initPassword;
|
|
|
+ if (btnGroupType == "right") {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.addFromRef.setData(res.data.result.resultMap);
|
|
|
+ console.log('[----- res.data.result.resultMap -----]', res.data.result.resultMap )
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.subTableName = res.data.result.dragTables[1].dtTableName;
|
|
|
+ this.btnDialogVisible = true;
|
|
|
+ this.groupKey = this.currentBtnData.btnTableFormGroupKey;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let refChild = this.$refs.dialogRef;
|
|
|
+ refChild.getLists(this.groupKey);
|
|
|
+ });
|
|
|
+
|
|
|
+ let tablesubKey = res.data.result.dragTables[1].tableKey;
|
|
|
+
|
|
|
+ // 查询统计信息
|
|
|
+ getStatisticList({
|
|
|
+ queryMap: {
|
|
|
+ tableKey: tablesubKey,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ this.subCount = res.data;
|
|
|
+ });
|
|
|
+
|
|
|
+ let prmKey = this.templateInfo.template.primaryKey;
|
|
|
+ let pkey = prmKey.replace(/_([a-z])/g, (match, p1) =>
|
|
|
+ p1.toUpperCase()
|
|
|
+ );
|
|
|
+
|
|
|
+ let data = {
|
|
|
+ queryMap: {
|
|
|
+ tableKey: res.data.result.dragTables[2].tableKey,
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+ let key =
|
|
|
+ "#{" +
|
|
|
+ this.templateInfo.template.dtTableName +
|
|
|
+ "." +
|
|
|
+ this.templateInfo.template.primaryKey;
|
|
|
+
|
|
|
+ data.queryMap[key] =
|
|
|
+ "'" + obj[this.templateInfo.template.primaryKey] + "'";
|
|
|
+
|
|
|
+ getStatisticList(data).then((res) => {
|
|
|
+ this.tableCount = res.data;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ console.log(this.times);
|
|
|
+ return;
|
|
|
+ },
|
|
|
// 将表单组数据转换成符合单个表单的数据格式
|
|
|
transformDataFormat(data) {
|
|
|
this.FormNameList = [];
|
|
@@ -1915,6 +2102,9 @@ export default {
|
|
|
case "TOAST":
|
|
|
this.showToast(btnData, row);
|
|
|
break;
|
|
|
+ case "CALCULATE":
|
|
|
+ this.handleCalculate(row, btnData);
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|