|
@@ -42,7 +42,7 @@
|
|
|
:underline="false"
|
|
|
style="font-size: 12px; vertical-align: baseline"
|
|
|
@click="importTemplate"
|
|
|
- >下载模板
|
|
|
+ >下载模板
|
|
|
</el-link>
|
|
|
</div>
|
|
|
</el-upload>
|
|
@@ -52,7 +52,8 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<Queryfrom
|
|
|
- :form-vals="templateInfo.where"
|
|
|
+ v-if="QueryfromLoading"
|
|
|
+ :formVals="templateInfo.where"
|
|
|
:statisticList="statisticList"
|
|
|
:showCount="showCount"
|
|
|
:showSearch="showSearch"
|
|
@@ -171,7 +172,7 @@
|
|
|
:style="`color:${
|
|
|
scope.row.styleFieldObj[item.key].fontColor
|
|
|
}`"
|
|
|
- >{{ scope.row[item.key] }}</span
|
|
|
+ >{{ scope.row[item.key] }}</span
|
|
|
>
|
|
|
</template>
|
|
|
<!-- 标签字体样式 -->
|
|
@@ -201,7 +202,7 @@
|
|
|
scope.row.styleFieldObj[item.key].listClass == '' ||
|
|
|
scope.row.styleFieldObj[item.key].listClass == 'default'
|
|
|
"
|
|
|
- >{{ scope.row.styleFieldObj[item.key].dictLabel }}</span
|
|
|
+ >{{ scope.row.styleFieldObj[item.key].dictLabel }}</span
|
|
|
>
|
|
|
<el-tag
|
|
|
v-else
|
|
@@ -210,7 +211,7 @@
|
|
|
? ''
|
|
|
: scope.row.styleFieldObj[item.key].listClass
|
|
|
"
|
|
|
- >{{ scope.row.styleFieldObj[item.key].dictLabel }}
|
|
|
+ >{{ scope.row.styleFieldObj[item.key].dictLabel }}
|
|
|
</el-tag>
|
|
|
</template>
|
|
|
</template>
|
|
@@ -293,7 +294,8 @@
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="editConfirmHandler"
|
|
|
- >确 定</el-button
|
|
|
+ >确 定
|
|
|
+ </el-button
|
|
|
>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
@@ -361,7 +363,7 @@
|
|
|
<template #footer>
|
|
|
<span>
|
|
|
<el-button type="primary" @click="toastShow = false"
|
|
|
- >确认</el-button
|
|
|
+ >确认</el-button
|
|
|
>
|
|
|
</span>
|
|
|
</template>
|
|
@@ -383,17 +385,17 @@ import {
|
|
|
batchEdit,
|
|
|
getStatisticList,
|
|
|
} from "@/api/tablelist/commonTable";
|
|
|
-import { listData } from "@/api/system/tenant/data";
|
|
|
-import { getToken } from "@/utils/auth";
|
|
|
+import {listData} from "@/api/system/tenant/data";
|
|
|
+import {getToken} from "@/utils/auth";
|
|
|
import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
|
|
|
-import { camelCase, toUnderline } from "@/utils";
|
|
|
-import { inputDisableComplete } from "@/utils/other";
|
|
|
+import {camelCase, toUnderline} from "@/utils";
|
|
|
+import {inputDisableComplete} from "@/utils/other";
|
|
|
import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
|
|
|
import BtnMenuList from "@/views/tablelist/commonTable/BtnMenuList.vue";
|
|
|
-import { checkRole } from "@/utils/permission";
|
|
|
+import {checkRole} from "@/utils/permission";
|
|
|
import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
|
|
|
import FormList from "@/components/FormGroup/formList.vue";
|
|
|
-import { v4 as uuidv4 } from "uuid";
|
|
|
+import {v4 as uuidv4} from "uuid";
|
|
|
import printHtml from "./print";
|
|
|
import LayoutIndex from "@/views/tablelist/components/FormGroupLayout/LayoutIndex.vue";
|
|
|
// let times = 2; //请求次数
|
|
@@ -409,6 +411,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ QueryfromLoading: false,
|
|
|
layoutData: "", //表单组布局数据
|
|
|
times: 2, //请求次数
|
|
|
// 提示信息 start
|
|
@@ -480,7 +483,7 @@ export default {
|
|
|
// 是否更新已经存在的数据
|
|
|
updateSupport: 0,
|
|
|
// 设置上传的请求头部
|
|
|
- headers: { Authorization: "Bearer " + getToken() },
|
|
|
+ headers: {Authorization: "Bearer " + getToken()},
|
|
|
// 上传的地址
|
|
|
url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
|
|
|
},
|
|
@@ -494,7 +497,7 @@ export default {
|
|
|
isAsc: "", // desc(降序)或 asc(升序)
|
|
|
// 基本查询参数
|
|
|
basicMap: {
|
|
|
- tableName: "drag_form",
|
|
|
+ tableName: "",
|
|
|
},
|
|
|
// 当前表字段筛选参数
|
|
|
queryMap: {
|
|
@@ -572,27 +575,11 @@ export default {
|
|
|
created() {
|
|
|
// 得到当前展示的table的唯一标识
|
|
|
this.tableKey = this.$route.query.tableKey;
|
|
|
- },
|
|
|
- watch: {},
|
|
|
- computed: {
|
|
|
- // isShowExcuteCol() {
|
|
|
- // let res = false;
|
|
|
- // if (!this.excuteBtnArr || !this.excuteBtnArr.length) {
|
|
|
- // res = false;
|
|
|
- // } else {
|
|
|
- // res = !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
|
|
|
- // }
|
|
|
- // this.$nextTick(() => {
|
|
|
- // // console.log(res);
|
|
|
- // this.$refs.tableRef.doLayout();
|
|
|
- // });
|
|
|
- // return res;
|
|
|
- // },
|
|
|
+ // 优化共通模版查询调用逻辑 (Don't fucking change it)
|
|
|
+ this.getList(this.queryParams);
|
|
|
},
|
|
|
methods: {
|
|
|
- // test
|
|
|
showValue() {
|
|
|
- // console.log(this.$refs.formGroupRef);
|
|
|
this.$refs.formGroupRef.setDefaultValue();
|
|
|
},
|
|
|
// 计算操作列的显示与隐藏
|
|
@@ -609,87 +596,74 @@ export default {
|
|
|
getRowKey(row) {
|
|
|
return row[
|
|
|
camelCase(this.tableName + "_" + this.templateInfo.template?.primaryKey)
|
|
|
- ];
|
|
|
+ ];
|
|
|
},
|
|
|
/** 查询列表 */
|
|
|
getList(queryParams) {
|
|
|
this.loading = true;
|
|
|
+
|
|
|
// 序列化当前查询参数列表
|
|
|
- queryParams && (this.queryParams.queryMap = queryParams.queryMap);
|
|
|
- // 获取当前表单结构信息
|
|
|
- dragTableInfo({ queryMap: { tableKey: this.tableKey } })
|
|
|
- .then((res) => {
|
|
|
- console.log(res);
|
|
|
- // 得到当前模版信息 --- sql columns queryWhere
|
|
|
- this.templateInfo = res.data.resultMap;
|
|
|
- this.styleList = res.data.resultMap.style?.map((item) => {
|
|
|
- item.styleField = camelCase(
|
|
|
- item.styleField.replace(".", "_") || ""
|
|
|
- );
|
|
|
- return item;
|
|
|
- });
|
|
|
- // 获取操作列的按钮数据
|
|
|
- this.excuteBtnArr = res.data.resultMap.button?.filter(
|
|
|
- (item) => item.btnGroupType == "right"
|
|
|
- );
|
|
|
- this.topBtnArr =
|
|
|
- res.data.resultMap.button?.filter(
|
|
|
- (item) => item.btnGroupType == "top"
|
|
|
- ) || [];
|
|
|
- this.calcuteExcuteCol();
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.tableRef.doLayout();
|
|
|
- });
|
|
|
- this.queryParams.orderByColumn =
|
|
|
- res.data.resultMap.querySql.orderByColumn;
|
|
|
- this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);
|
|
|
- // 根据拖拽时设置当前列表排列顺序
|
|
|
- this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC";
|
|
|
- this.tableName = this.templateInfo.template.dtTableName;
|
|
|
- // 得到查询条件
|
|
|
- this.queryFromWhere = res.data.resultMap.where;
|
|
|
- // 得到当前列表信息
|
|
|
- this.columns = this.columnsHandler(
|
|
|
- JSON.parse(this.templateInfo.template.dtColumnName)
|
|
|
- );
|
|
|
- })
|
|
|
- .finally((fes) => {
|
|
|
- if (this.templateInfo == {}) return;
|
|
|
- // 调用查询需要携带当前table的唯一标识
|
|
|
- this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
|
|
|
- this.queryParams.orderByColumn = camelCase(
|
|
|
- this.queryParams.orderByColumn || ""
|
|
|
- );
|
|
|
- // 根据sql语句查询当前表数据
|
|
|
- unionListTableData(this.queryParams).then(async (res) => {
|
|
|
- this.tableList = [];
|
|
|
- res.rows.forEach((item) => {
|
|
|
- this.tableList.push(item.resultMap);
|
|
|
- });
|
|
|
- // 驼峰转换
|
|
|
- let tempTableList = [];
|
|
|
- tempTableList = this.tableList.map((item) => {
|
|
|
- let kv = {};
|
|
|
- for (let itemKey in item) {
|
|
|
- kv[camelCase(itemKey)] = item[itemKey];
|
|
|
- }
|
|
|
- return kv;
|
|
|
- });
|
|
|
- this.tableList = await this.setFieldStyleData(tempTableList);
|
|
|
- this.total = res.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ queryParams && (this.queryParams.queryMap = Object.assign({}, queryParams.queryMap));
|
|
|
|
|
|
- // 查询统计信息
|
|
|
- getStatisticList({
|
|
|
- queryMap: {
|
|
|
- tableKey: this.templateInfo.template.tableKey,
|
|
|
- queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue,
|
|
|
- },
|
|
|
- }).then((res) => {
|
|
|
- this.statisticList = res.data;
|
|
|
+ if (typeof (queryParams.queryMap.timehorizon) != "undefined") {
|
|
|
+ // timehorizon 时间范围转换字符串回传后台
|
|
|
+ this.queryParams.queryMap.timehorizon = JSON.stringify(Object.assign({}, queryParams.queryMap.timehorizon));
|
|
|
+ }
|
|
|
+ // 获取当前表单结构信息
|
|
|
+ dragTableInfo({queryMap: {tableKey: this.tableKey}}).then((res) => {
|
|
|
+ // 得到当前模版信息 --- sql columns queryWhere
|
|
|
+ this.templateInfo = res.data.resultMap;
|
|
|
+ this.QueryfromLoading = true; // 加载查询组件
|
|
|
+ this.styleList = res.data.resultMap.style?.map((item) => {
|
|
|
+ item.styleField = camelCase(item.styleField.replace(".", "_") || "");
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ // 获取操作列的按钮数据
|
|
|
+ this.excuteBtnArr = res.data.resultMap.button?.filter((item) => item.btnGroupType == "right");
|
|
|
+ this.topBtnArr = res.data.resultMap.button?.filter((item) => item.btnGroupType == "top") || [];
|
|
|
+ this.calcuteExcuteCol();
|
|
|
+ this.$nextTick(() => this.$refs.tableRef.doLayout());
|
|
|
+ this.queryParams.orderByColumn = res.data.resultMap.querySql.orderByColumn;
|
|
|
+ this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);
|
|
|
+ // 根据拖拽时设置当前列表排列顺序
|
|
|
+ this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC";
|
|
|
+ this.tableName = this.templateInfo.template.dtTableName;
|
|
|
+ // 得到查询条件
|
|
|
+ this.queryFromWhere = res.data.resultMap.where;
|
|
|
+ // 得到当前列表信息
|
|
|
+ this.columns = this.columnsHandler(JSON.parse(this.templateInfo.template.dtColumnName));
|
|
|
+ }).finally((fes) => {
|
|
|
+ // 调用子组件中查询条件顺序处理事件
|
|
|
+ this.$refs.mychild.handlerFormVals();
|
|
|
+ if (this.templateInfo == {}) return;
|
|
|
+ // 调用查询需要携带当前table的唯一标识
|
|
|
+ this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
|
|
|
+ this.queryParams.orderByColumn = camelCase(this.queryParams.orderByColumn || "");
|
|
|
+ // 根据sql语句查询当前表数据 ->得到列表数据
|
|
|
+ unionListTableData(this.queryParams).then(async (res) => {
|
|
|
+ this.tableList = [];
|
|
|
+ res.rows.forEach((item) => this.tableList.push(item.resultMap));
|
|
|
+ // 驼峰转换
|
|
|
+ let tempTableList = [];
|
|
|
+ tempTableList = this.tableList.map((item) => {
|
|
|
+ let kv = {};
|
|
|
+ for (let itemKey in item) kv[camelCase(itemKey)] = item[itemKey];
|
|
|
+ return kv;
|
|
|
});
|
|
|
+ this.tableList = await this.setFieldStyleData(tempTableList);
|
|
|
+ this.total = res.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ // 查询统计信息
|
|
|
+ getStatisticList({
|
|
|
+ queryMap: {
|
|
|
+ tableKey: this.templateInfo.template.tableKey,
|
|
|
+ queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue,
|
|
|
+ }
|
|
|
+ }).then((res) => {
|
|
|
+ this.statisticList = res.data;
|
|
|
});
|
|
|
+ });
|
|
|
},
|
|
|
isUpperCase(char) {
|
|
|
return char === char.toUpperCase();
|
|
@@ -758,9 +732,9 @@ export default {
|
|
|
this.$refs.mychild.pageList(
|
|
|
row == undefined
|
|
|
? {
|
|
|
- limit: this.queryParams.pageSize,
|
|
|
- page: this.queryParams.pageNum,
|
|
|
- }
|
|
|
+ limit: this.queryParams.pageSize,
|
|
|
+ page: this.queryParams.pageNum,
|
|
|
+ }
|
|
|
: row
|
|
|
);
|
|
|
},
|
|
@@ -772,7 +746,7 @@ export default {
|
|
|
camelCase(
|
|
|
this.tableName + "_" + this.templateInfo.template?.primaryKey
|
|
|
)
|
|
|
- ]
|
|
|
+ ]
|
|
|
);
|
|
|
this.selection = selection;
|
|
|
this.single = selection.length != 1;
|
|
@@ -807,7 +781,7 @@ export default {
|
|
|
},
|
|
|
};
|
|
|
// getInfoBySqlKey(this.templateInfo.template.sqlKey)
|
|
|
- btnCommonApi(payLoad).then(({ data }) => {
|
|
|
+ btnCommonApi(payLoad).then(({data}) => {
|
|
|
if (!data || !data.dfVueTemplate) {
|
|
|
this.jsonData = false;
|
|
|
this.$message.error("当前表格未绑定表单!");
|
|
@@ -859,12 +833,12 @@ export default {
|
|
|
// 延迟
|
|
|
sleep(ms) {
|
|
|
var unixtime_ms = new Date().getTime();
|
|
|
- while (new Date().getTime() < unixtime_ms + ms) {}
|
|
|
+ while (new Date().getTime() < unixtime_ms + ms) {
|
|
|
+ }
|
|
|
return "";
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
async handleUpdate(row, btnData) {
|
|
|
- console.log("handleUpdate");
|
|
|
let nameTable = this.templateInfo.template.dtTableName;
|
|
|
this.rowobj = {};
|
|
|
let obj = {};
|
|
@@ -887,8 +861,7 @@ export default {
|
|
|
|
|
|
// 新的修改请求
|
|
|
try {
|
|
|
- // console.log("btnData", btnData);
|
|
|
- let { btnFormType, btnGroupType } = btnData;
|
|
|
+ let {btnFormType, btnGroupType} = btnData;
|
|
|
this.formType = btnFormType;
|
|
|
let payLoad = {};
|
|
|
let primary = camelCase(
|
|
@@ -919,7 +892,6 @@ export default {
|
|
|
},
|
|
|
conditionMap: {},
|
|
|
};
|
|
|
- console.log("primary111", primary);
|
|
|
payLoad.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
row[primary];
|
|
|
// }
|
|
@@ -945,13 +917,11 @@ export default {
|
|
|
this.$message.error("当前按钮未绑定表单!");
|
|
|
return;
|
|
|
}
|
|
|
- console.log(res);
|
|
|
if (btnFormType == "dragFormGroup") {
|
|
|
//表单组
|
|
|
if (res.code == 200) {
|
|
|
if (res.data.mainForm) {
|
|
|
//表单组
|
|
|
- // console.log(res.data);
|
|
|
// 判断是否有布局数据
|
|
|
this.isLayout =
|
|
|
res.data.layoutJson &&
|
|
@@ -959,18 +929,12 @@ export default {
|
|
|
this.transformDataFormat(res.data);
|
|
|
if (this.isLayout) {
|
|
|
//自定义布局
|
|
|
- console.log(JSON.parse(JSON.stringify(res.data)));
|
|
|
this.layoutData = JSON.parse(JSON.stringify(res.data));
|
|
|
}
|
|
|
-
|
|
|
- // this.tableName = res.data.mainForm.showTemplate.dfTableName;
|
|
|
} else {
|
|
|
this.formList = res.data;
|
|
|
- // this.tableName = res.data.dfTableName;
|
|
|
}
|
|
|
- // console.log(this.formList);
|
|
|
this.open = true;
|
|
|
-
|
|
|
if (btnData.btnFormType == "dragFormGroup") {
|
|
|
this.times--;
|
|
|
if (this.times) {
|
|
@@ -985,7 +949,6 @@ export default {
|
|
|
}
|
|
|
this.$nextTick(() => {
|
|
|
// 手动触发布局组件的数据处理函数
|
|
|
- console.log(111, JSON.parse(JSON.stringify(res.data)));
|
|
|
this.$refs.formGroupLayoutRef?.initLayoutData(
|
|
|
JSON.parse(JSON.stringify(res.data))
|
|
|
);
|
|
@@ -1003,7 +966,6 @@ export default {
|
|
|
// }
|
|
|
// });
|
|
|
} else {
|
|
|
- console.error(res);
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
} else {
|
|
@@ -1084,59 +1046,15 @@ export default {
|
|
|
this.tableCount = res.data;
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- // let fieldList = Object.keys(resultMap);
|
|
|
- // let tableName = this.longestCommonSubstring(fieldList);
|
|
|
- // fieldList.forEach((field) => {
|
|
|
- // let realField = field.replace(tableName, "");
|
|
|
- // realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
|
- // resultMap[realField] = resultMap[field];
|
|
|
- // });
|
|
|
} catch (error) {
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
- console.error(error);
|
|
|
}
|
|
|
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();
|
|
|
- const userId = row.userId || this.ids;
|
|
|
- getUser(userId).then((response) => {
|
|
|
- this.form = response.data;
|
|
|
- this.postOptions = response.posts;
|
|
|
- this.roleOptions = response.roles;
|
|
|
- this.$set(this.form, "postIds", response.postIds);
|
|
|
- this.$set(this.form, "roleIds", response.roleIds);
|
|
|
- this.open = true;
|
|
|
- this.title = "修改当前信息";
|
|
|
- this.form.password = "";
|
|
|
- });
|
|
|
},
|
|
|
// 将表单组数据转换成符合单个表单的数据格式
|
|
|
transformDataFormat(data) {
|
|
|
this.FormNameList = [];
|
|
|
- let { mainForm, subFormList } = data;
|
|
|
+ let {mainForm, subFormList} = data;
|
|
|
this.formList = [];
|
|
|
let showValue = null;
|
|
|
if (mainForm.showValue) {
|
|
@@ -1182,7 +1100,6 @@ export default {
|
|
|
tableName = item.formItem?.split(".")?.[0];
|
|
|
batch[tableName] = item.showValue.map((item) => item.resultMap);
|
|
|
defaultValue = JSON.parse(JSON.stringify(batch));
|
|
|
- console.log(JSON.parse(JSON.stringify(batch)));
|
|
|
// 所有字段驼峰转下划线
|
|
|
batch[tableName].forEach((i) => {
|
|
|
for (const key of Object.keys(i)) {
|
|
@@ -1227,7 +1144,7 @@ export default {
|
|
|
},
|
|
|
// 格式化表单组布局数据
|
|
|
formateLayout(data) {
|
|
|
- let { layoutJson, mainForm, subFormList } = data;
|
|
|
+ let {layoutJson, mainForm, subFormList} = data;
|
|
|
},
|
|
|
// 添加真正的字段名
|
|
|
addRealFieldName(row) {
|
|
@@ -1313,7 +1230,8 @@ export default {
|
|
|
this.$refs.mychild.pageList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
},
|
|
|
// 批量删除接口
|
|
|
handleBatchDelete() {
|
|
@@ -1353,7 +1271,8 @@ export default {
|
|
|
this.$refs.mychild.pageList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
@@ -1391,7 +1310,7 @@ export default {
|
|
|
importTemplate() {
|
|
|
this.download(
|
|
|
process.env.VUE_APP_BASE_API1 +
|
|
|
- `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
|
|
|
+ `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
|
|
|
{},
|
|
|
`下载模版名称${new Date().getTime()}.xlsx`
|
|
|
);
|
|
@@ -1407,10 +1326,10 @@ export default {
|
|
|
this.$refs.upload.clearFiles();
|
|
|
this.$alert(
|
|
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
- response.msg +
|
|
|
- "</div>",
|
|
|
+ response.msg +
|
|
|
+ "</div>",
|
|
|
"导入结果",
|
|
|
- { dangerouslyUseHTMLString: true }
|
|
|
+ {dangerouslyUseHTMLString: true}
|
|
|
);
|
|
|
this.$refs.mychild.pageList({
|
|
|
limit: this.queryParams.pageSize,
|
|
@@ -1450,7 +1369,6 @@ export default {
|
|
|
// }
|
|
|
// // data.addListMap =
|
|
|
// btnCommonApi(data).then(res => {
|
|
|
- // // console.log('弹窗确定', res);
|
|
|
// })
|
|
|
},
|
|
|
// 去掉表名 开头字母小写
|
|
@@ -1471,7 +1389,6 @@ export default {
|
|
|
},
|
|
|
// 添加插入的数据
|
|
|
addInsertData(insertMap, result, res) {
|
|
|
- console.log(insertMap, result, res);
|
|
|
result.addListMap.forEach((i) => {
|
|
|
insertMap.forEach((j) => {
|
|
|
i[j.fieldName?.split(".")[1]] = res.find(
|
|
@@ -1481,10 +1398,10 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
// 处理 动态表单 动态表格 修改数据
|
|
|
- getEditBatchData(values, data) {},
|
|
|
+ getEditBatchData(values, data) {
|
|
|
+ },
|
|
|
// 处理 表单组 含有动态表格 新增数据
|
|
|
getFormGroupBatchData(values, index, result) {
|
|
|
- console.log(values, index, result);
|
|
|
let tableName = Object.keys(values.data.batch)[0];
|
|
|
let res = {
|
|
|
basicMap: {
|
|
@@ -1492,7 +1409,7 @@ export default {
|
|
|
},
|
|
|
addListMap: [],
|
|
|
};
|
|
|
- let { formItem, relateFormItem } = values;
|
|
|
+ let {formItem, relateFormItem} = values;
|
|
|
res.addListMap = values.data.batch[tableName].map((item) => {
|
|
|
delete item.key;
|
|
|
item[formItem.split(".")[1]] =
|
|
@@ -1507,7 +1424,6 @@ export default {
|
|
|
this.$refs.addFromRef
|
|
|
.getData()
|
|
|
.then(async (values) => {
|
|
|
- console.log(values);
|
|
|
for (const key of Object.keys(values)) {
|
|
|
values[key] =
|
|
|
typeof values[key] == "undefined" ? "" : values[key];
|
|
@@ -1536,7 +1452,7 @@ export default {
|
|
|
item.fieldValue
|
|
|
? item.fieldValue
|
|
|
: this.currentRow[
|
|
|
- camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
];
|
|
|
});
|
|
|
conditionData.forEach((item) => {
|
|
@@ -1544,7 +1460,7 @@ export default {
|
|
|
item.fieldValue
|
|
|
? item.fieldValue
|
|
|
: this.currentRow[
|
|
|
- camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
];
|
|
|
});
|
|
|
}
|
|
@@ -1581,7 +1497,6 @@ export default {
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- // console.log(error);
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
this.getList();
|
|
@@ -1589,29 +1504,13 @@ export default {
|
|
|
this.open = false;
|
|
|
})
|
|
|
.catch((res) => {
|
|
|
- console.log(res);
|
|
|
this.$modal.msgError("表单校验失败,请规范填写数据");
|
|
|
});
|
|
|
} else if (this.formType == "dragFormGroup") {
|
|
|
- //表单组
|
|
|
- // // console.log(this.$refs.formGroupRef);
|
|
|
- //有布局的表单组
|
|
|
- // let res = await this.$refs.formGroupLayoutRef.getFormData();
|
|
|
- // console.log(res);
|
|
|
- // let valuesArr = [];
|
|
|
- // res.forEach((item) => {
|
|
|
- // valuesArr.push(...item);
|
|
|
- // });
|
|
|
- // console.log(valuesArr);
|
|
|
- // Promise.all(valuesArr).then((values) => {
|
|
|
- // console.log("布局表单数据", values);
|
|
|
- // });
|
|
|
//无布局
|
|
|
let promiseArray = [];
|
|
|
if (this.isLayout) {
|
|
|
let res = await this.$refs.formGroupLayoutRef.getFormData();
|
|
|
- // let values = await Promise.all(res);
|
|
|
- console.log(res);
|
|
|
res.forEach((item) => {
|
|
|
promiseArray.push(...item);
|
|
|
});
|
|
@@ -1623,7 +1522,6 @@ export default {
|
|
|
Promise.all(promiseArray).then(
|
|
|
async (res) => {
|
|
|
// 获取到所有表单数据
|
|
|
- console.log("res", res);
|
|
|
let mainForm = res.find((item) => item.isMainForm);
|
|
|
let mainFormData = mainForm.data;
|
|
|
let data = {
|
|
@@ -1650,7 +1548,7 @@ export default {
|
|
|
item.fieldValue
|
|
|
? item.fieldValue
|
|
|
: this.currentRow[
|
|
|
- camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
];
|
|
|
});
|
|
|
conditionData.forEach((item) => {
|
|
@@ -1689,7 +1587,7 @@ export default {
|
|
|
item.fieldValue
|
|
|
? item.fieldValue
|
|
|
: this.currentRow[
|
|
|
- camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
];
|
|
|
});
|
|
|
payLoad.updateCommonEntityList.push(result);
|
|
@@ -1741,7 +1639,7 @@ export default {
|
|
|
let value =
|
|
|
this.currentRow[
|
|
|
camelCase(relateFormItem.replace(".", "_"))
|
|
|
- ];
|
|
|
+ ];
|
|
|
result.conditionMap[fieldName] = value;
|
|
|
payLoad.updateCommonEntityList.push(result);
|
|
|
}
|
|
@@ -1752,8 +1650,6 @@ export default {
|
|
|
let uuid = uuidv4().replace("-", "");
|
|
|
payLoad.insertCommonEntityList = res.map((item, index) => {
|
|
|
let result = {};
|
|
|
- console.log(item);
|
|
|
- // return;
|
|
|
if (item.data.batch) {
|
|
|
//动态表格
|
|
|
result = this.getFormGroupBatchData(item, index, res);
|
|
@@ -1768,14 +1664,11 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
};
|
|
|
- let { formItem, relateFormItem } = item;
|
|
|
+ let {formItem, relateFormItem} = item;
|
|
|
if (index == 0) {
|
|
|
//主表单
|
|
|
// 添加新增数据的关联条件
|
|
|
- // console.log(formItem);
|
|
|
-
|
|
|
let mainFormKey = mainForm.data[formItem.split(".")[1]];
|
|
|
- console.log("formItem", formItem);
|
|
|
if (mainFormKey) {
|
|
|
result.addListMap[0][formItem.split(".")[1]] =
|
|
|
mainFormKey;
|
|
@@ -1865,17 +1758,17 @@ export default {
|
|
|
item.fieldValue
|
|
|
? item.fieldValue
|
|
|
: this.currentRow[
|
|
|
- camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
];
|
|
|
});
|
|
|
} else {
|
|
|
// 从表条件
|
|
|
- let { formItem, relateFormItem } = item;
|
|
|
+ let {formItem, relateFormItem} = item;
|
|
|
let fieldName = formItem.split(".")[1];
|
|
|
let value =
|
|
|
this.currentRow[
|
|
|
camelCase(relateFormItem.replace(".", "_"))
|
|
|
- ];
|
|
|
+ ];
|
|
|
result.conditionMap[fieldName] = value;
|
|
|
}
|
|
|
return result;
|
|
@@ -1892,17 +1785,12 @@ export default {
|
|
|
this.defaultValue = {};
|
|
|
this.open = false;
|
|
|
} else {
|
|
|
- console.log(res);
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log(error);
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
},
|
|
|
- (err) => {
|
|
|
- // console.log(err);
|
|
|
- }
|
|
|
);
|
|
|
} else {
|
|
|
// 没有绑定表单
|
|
@@ -1943,11 +1831,9 @@ export default {
|
|
|
if (res.code == 200) {
|
|
|
this.$message.success("操作成功");
|
|
|
} else {
|
|
|
- console.log(res);
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log(error);
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
this.getList();
|
|
@@ -1968,14 +1854,14 @@ export default {
|
|
|
tempSubBtn(getData) {
|
|
|
getData()
|
|
|
.then((values) => {
|
|
|
- // console.log("验证通过", values);
|
|
|
+
|
|
|
})
|
|
|
.catch(() => {
|
|
|
- // console.log("验证未通过,获取失败");
|
|
|
+
|
|
|
});
|
|
|
},
|
|
|
// 判断是否生效行样式
|
|
|
- cellStyle({ row, column, rowIndex, columnIndex }) {
|
|
|
+ cellStyle({row, column, rowIndex, columnIndex}) {
|
|
|
let rowStyleList = this.styleList.filter((item) => item.styleType == 0);
|
|
|
if (!rowStyleList.length) return "";
|
|
|
let mainTableName = this.templateInfo.querySql.tableAlias; //主表名
|
|
@@ -2017,7 +1903,6 @@ export default {
|
|
|
|
|
|
// 设置表格字段样式
|
|
|
async setFieldStyleData(tableList) {
|
|
|
- // console.log(JSON.parse(JSON.stringify(tableList)));
|
|
|
let fieldConditionList = this.styleList.filter(
|
|
|
(item) => item.styleType == 1 || item.styleType == 2
|
|
|
);
|
|
@@ -2030,7 +1915,6 @@ export default {
|
|
|
...item,
|
|
|
};
|
|
|
}, {});
|
|
|
- // // console.log("this.dictStyleObj", this.dictStyleObj);
|
|
|
tableList.forEach((row) => {
|
|
|
// if (!row.styleFieldObj) row.styleFieldObj = {};
|
|
|
for (let i = 0; i < fieldConditionList.length; i++) {
|
|
@@ -2098,7 +1982,7 @@ export default {
|
|
|
|
|
|
// 页面跳转
|
|
|
routerHandler(btnData, type) {
|
|
|
- let { url, commonFieldData } = JSON.parse(btnData.btnParams);
|
|
|
+ let {url, commonFieldData} = JSON.parse(btnData.btnParams);
|
|
|
let tempArr = [];
|
|
|
if (commonFieldData) {
|
|
|
let queryArr = JSON.parse(commonFieldData);
|
|
@@ -2114,8 +1998,6 @@ export default {
|
|
|
if (tempArr.length) {
|
|
|
url += "?" + tempArr.join("&");
|
|
|
}
|
|
|
- // let link = btnData.btnParams;
|
|
|
- console.log(url);
|
|
|
if (type == "INNERLINK") {
|
|
|
this.$router.push(url);
|
|
|
} else {
|
|
@@ -2125,9 +2007,7 @@ export default {
|
|
|
|
|
|
// 操作列回调
|
|
|
excuteHandler(btnData, row) {
|
|
|
- console.log("btnData", btnData);
|
|
|
- console.log("row", row);
|
|
|
- let { btnType, btnParams, btnFormType } = btnData;
|
|
|
+ let {btnType, btnParams, btnFormType} = btnData;
|
|
|
this.currentBtnData = btnData;
|
|
|
this.currentRow = JSON.parse(JSON.stringify(row));
|
|
|
// 无表单
|
|
@@ -2177,16 +2057,14 @@ export default {
|
|
|
},
|
|
|
// 消息提示回调
|
|
|
showToast(btnData, row) {
|
|
|
- console.log(btnData, row);
|
|
|
- let { btnFormKey, btnFormType } = btnData;
|
|
|
+ let {btnFormKey, btnFormType} = btnData;
|
|
|
this.toastMsg = btnFormKey;
|
|
|
this.toastType = btnFormType;
|
|
|
this.toastShow = true;
|
|
|
},
|
|
|
// 顶部按钮回调
|
|
|
topBtnHandler(btnData) {
|
|
|
- console.log(btnData);
|
|
|
- let { btnType, btnParams, btnFormType } = btnData;
|
|
|
+ let {btnType, btnParams, btnFormType} = btnData;
|
|
|
let row = this.selection[0] || [];
|
|
|
this.currentBtnData = btnData;
|
|
|
this.currentRow = JSON.parse(JSON.stringify(row));
|
|
@@ -2275,7 +2153,6 @@ export default {
|
|
|
commMap: {},
|
|
|
btnParametersMap: {},
|
|
|
};
|
|
|
- // console.log(this.currentBtnData, this.currentRow);
|
|
|
if (this.currentBtnData.btnParams) {
|
|
|
let conditionData =
|
|
|
JSON.parse(this.currentBtnData.btnParams).conditionData || [];
|
|
@@ -2293,7 +2170,7 @@ export default {
|
|
|
item.fieldValue
|
|
|
? item.fieldValue
|
|
|
: this.currentRow[
|
|
|
- camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
];
|
|
|
});
|
|
|
}
|
|
@@ -2317,12 +2194,12 @@ export default {
|
|
|
this.$refs.mychild.pageList();
|
|
|
// this.$modal.msgSuccess("操作成功");
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
// k-form-build表单变化回调
|
|
|
formChangeHandler(value, label) {
|
|
|
- // // console.log(value, label);
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -2335,18 +2212,23 @@ export default {
|
|
|
width: 100%;
|
|
|
font-size: 30px;
|
|
|
}
|
|
|
+
|
|
|
::v-deep .el-dialog:not(.is-fullscreen) {
|
|
|
min-width: 610px !important;
|
|
|
}
|
|
|
+
|
|
|
.success {
|
|
|
color: #67c23a;
|
|
|
}
|
|
|
+
|
|
|
.error {
|
|
|
color: #f56c6c;
|
|
|
}
|
|
|
+
|
|
|
.warning {
|
|
|
color: #e6a23c;
|
|
|
}
|
|
|
+
|
|
|
.info {
|
|
|
color: #909399;
|
|
|
}
|