|
@@ -307,7 +307,7 @@
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
v-model="scope.row.value"
|
|
|
- :disabled="scope.row.type == '1'|| scope.row.type == '2'"
|
|
|
+ :disabled="scope.row.type == '1' || scope.row.type == '2'"
|
|
|
placeholder="请输入参照值"
|
|
|
size="normal"
|
|
|
></el-input>
|
|
@@ -318,7 +318,9 @@
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="danger"
|
|
|
- @click="delContionHandler(scope.$index, queryContionTableData)">删除</el-button>
|
|
|
+ @click="delContionHandler(scope.$index, queryContionTableData)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -397,7 +399,7 @@ export default {
|
|
|
dicts: ["sys_time_format"],
|
|
|
props: {
|
|
|
datas: Object,
|
|
|
- echoMessage: Object
|
|
|
+ echoMessage: Object,
|
|
|
},
|
|
|
components: { vuedraggable },
|
|
|
data() {
|
|
@@ -405,6 +407,8 @@ export default {
|
|
|
if (value.length === 0) callback(new Error("请输入有效数字"));
|
|
|
};
|
|
|
return {
|
|
|
+ nameItem: [],
|
|
|
+ descItem: [],
|
|
|
tablelistSort: null,
|
|
|
tableQueryConditions: [],
|
|
|
tableList: [],
|
|
@@ -489,7 +493,7 @@ export default {
|
|
|
mainTableFieldOptions: {
|
|
|
handler(val) {
|
|
|
if (val.length) {
|
|
|
- // console.log(val);
|
|
|
+ console.log(val);
|
|
|
this.mainTableData = val.map((item, index) => {
|
|
|
return {
|
|
|
sort: parseInt(index) + 1,
|
|
@@ -519,19 +523,18 @@ export default {
|
|
|
// });
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
deep: true,
|
|
|
immediate: true,
|
|
|
},
|
|
|
},
|
|
|
- mounted() { },
|
|
|
+ mounted() {},
|
|
|
methods: {
|
|
|
// 列名变化回调
|
|
|
changeModel() {
|
|
|
console.log("列", this.datas);
|
|
|
- let newObject = { }
|
|
|
+ let newObject = {};
|
|
|
// newObject.fieldName = `${this.datas.tableName}.${this.datas.fieldName}`;
|
|
|
- // newObject.value = "#{x}";
|
|
|
+ // newObject.value = "#{x}";
|
|
|
// newObject.operator = "=";
|
|
|
// newObject.type = "1";
|
|
|
// console.log(newObject);
|
|
@@ -542,7 +545,7 @@ export default {
|
|
|
changeType(row) {
|
|
|
if (row.type == 1) {
|
|
|
row.value = "#{x}";
|
|
|
- } else if(row.type == 2){
|
|
|
+ } else if (row.type == 2) {
|
|
|
row.value = "#{userID}";
|
|
|
} else {
|
|
|
row.value = "";
|
|
@@ -587,7 +590,9 @@ export default {
|
|
|
fieldEditHandler(row, index) {
|
|
|
console.log(row);
|
|
|
if (Object.keys(row.column_attribute || {}).length) {
|
|
|
- this.column_attribute = JSON.parse(JSON.stringify(row.column_attribute));
|
|
|
+ this.column_attribute = JSON.parse(
|
|
|
+ JSON.stringify(row.column_attribute)
|
|
|
+ );
|
|
|
} else {
|
|
|
Object.assign(this.column_attribute, {
|
|
|
isDateColumn: false,
|
|
@@ -635,33 +640,40 @@ export default {
|
|
|
this.$nextTick(() => {
|
|
|
this.initDragTable();
|
|
|
});
|
|
|
- if(this.echoMessage) {
|
|
|
+ if (this.echoMessage) {
|
|
|
console.log("回显数据", this.echoMessage);
|
|
|
- let echoMessage = this.echoMessage;
|
|
|
+ let echoMessage = this.echoMessage;
|
|
|
// 主表
|
|
|
- let tableColumnName = JSON.parse(echoMessage.tableColumnName);
|
|
|
- this.listQueryData.mainForm.mainTableName = tableColumnName[0].tbname;
|
|
|
- if (this.listQueryData.mainForm.mainTableName) {
|
|
|
- this.mainTableFieldOptions = await this.getFieldOptions(this.listQueryData.mainForm.mainTableName);
|
|
|
- }
|
|
|
+ this.nameItem = JSON.parse(echoMessage.tableColumnName);
|
|
|
+ console.log(this.nameItem);
|
|
|
+ this.listQueryData.mainForm.mainTableName = this.nameItem[0].tbname;
|
|
|
// 表格主键
|
|
|
let tablelistSort = JSON.parse(echoMessage.tablelistSort);
|
|
|
let dataSortFromEcho = tablelistSort.DataSort; // "student.id"
|
|
|
- const idOnly = dataSortFromEcho.split('.').pop(); // "id"
|
|
|
+ const idOnly = dataSortFromEcho.split(".").pop(); // "id"
|
|
|
this.listQueryData.mainForm.tablePrimaryKey = idOnly;
|
|
|
this.listQueryData.mainForm.sortFieldName = idOnly;
|
|
|
this.listQueryData.mainForm.sortType = tablelistSort.DataSortType;
|
|
|
// 查询条件
|
|
|
let tableQueryConditions = JSON.parse(echoMessage.tableQueryConditions);
|
|
|
- this.queryContionTableData = tableQueryConditions.map(item => ({
|
|
|
- ...item
|
|
|
- }))
|
|
|
- // 表格
|
|
|
- this.mainTableData = tableColumnName.map(item => ({
|
|
|
+ this.queryContionTableData = tableQueryConditions.map((item) => ({
|
|
|
...item,
|
|
|
- fieldDescription : item.field_des,
|
|
|
- column_attribute:JSON.parse(item.column_attribute),
|
|
|
- }))
|
|
|
+ }));
|
|
|
+ if (this.listQueryData.mainForm.mainTableName) {
|
|
|
+ this.mainTableFieldOptions = await this.getFieldOptions(
|
|
|
+ this.listQueryData.mainForm.mainTableName
|
|
|
+ );
|
|
|
+ }
|
|
|
+ // 表格
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.mainTableData = this.nameItem.map((item, index) => ({
|
|
|
+ ...item,
|
|
|
+ fieldDescription: item.field_des,
|
|
|
+ column_attribute: JSON.parse(item.column_attribute),
|
|
|
+ }));
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(this.mainTableData);
|
|
|
}
|
|
|
},
|
|
|
confirmHandler() {
|
|
@@ -684,10 +696,10 @@ export default {
|
|
|
// 展示描述
|
|
|
res.tableColumnName = [];
|
|
|
res.tableColumnDesc = [];
|
|
|
+ console.log("this.mainTableData", this.mainTableData);
|
|
|
this.mainTableData.forEach((item, index) => {
|
|
|
- let nameItem = {},
|
|
|
- descItem = {};
|
|
|
- let { tableName, fieldName, fieldDescription, column_attribute } = item;
|
|
|
+ // console.log('item', item);
|
|
|
+ let { tbname, fieldName, fieldDescription, column_attribute } = item;
|
|
|
const columnAttributeString = JSON.stringify({
|
|
|
isDateColumn: column_attribute?.isDateColumn
|
|
|
? column_attribute?.isDateColumn
|
|
@@ -697,20 +709,20 @@ export default {
|
|
|
: "",
|
|
|
isShow: column_attribute?.isShow ? column_attribute?.isShow : false,
|
|
|
});
|
|
|
- nameItem = {
|
|
|
- tbname: tableName,
|
|
|
+ this.nameItem = {
|
|
|
+ tbname: tbname,
|
|
|
fieldName: fieldName,
|
|
|
- fieldAsName: camelCase(tableName + "_" + fieldName),
|
|
|
+ fieldAsName: camelCase(tbname + "_" + fieldName),
|
|
|
field_des: fieldDescription,
|
|
|
column_attribute: columnAttributeString,
|
|
|
};
|
|
|
- descItem = {
|
|
|
- column: camelCase(tableName + "_" + fieldName),
|
|
|
+ this.descItem = {
|
|
|
+ column: camelCase(tbname + "_" + fieldName),
|
|
|
columnDes: fieldDescription,
|
|
|
columnSort: index + 1,
|
|
|
};
|
|
|
- res.tableColumnName.push(nameItem);
|
|
|
- res.tableColumnDesc.push(descItem);
|
|
|
+ res.tableColumnName.push(this.nameItem);
|
|
|
+ res.tableColumnDesc.push(this.descItem);
|
|
|
});
|
|
|
// 查询条件
|
|
|
// let queryData = {}
|
|
@@ -721,24 +733,26 @@ export default {
|
|
|
// queryData.value = value;
|
|
|
// queryData.operator = operator;
|
|
|
// queryData.type = String(type);
|
|
|
-
|
|
|
+
|
|
|
// });
|
|
|
// console.log(this.queryContionTableData);
|
|
|
// this.tableQueryConditions.push(queryData)
|
|
|
// console.log(this.tableQueryConditions);
|
|
|
let queryDataArray = this.queryContionTableData.map((item) => {
|
|
|
- let { fieldName, tableName, value, operator, type } = item;
|
|
|
- return {
|
|
|
- fieldName: tableName + "." + fieldName,
|
|
|
+ let { fieldName, tableName, value, operator, type } = item;
|
|
|
+ return {
|
|
|
+ fieldName: fieldName,
|
|
|
value: value,
|
|
|
operator: operator,
|
|
|
- type: String(type)
|
|
|
- };
|
|
|
+ type: String(type),
|
|
|
+ };
|
|
|
});
|
|
|
- console.log(this.queryContionTableData);
|
|
|
+ // console.log(this.queryContionTableData);
|
|
|
this.tableQueryConditions.push(...queryDataArray);
|
|
|
- console.log(this.tableQueryConditions);
|
|
|
- let tableQueryConditionsString = JSON.stringify(this.tableQueryConditions);
|
|
|
+ // console.log(this.tableQueryConditions);
|
|
|
+ let tableQueryConditionsString = JSON.stringify(
|
|
|
+ this.tableQueryConditions
|
|
|
+ );
|
|
|
res.tableQueryConditions = tableQueryConditionsString;
|
|
|
// 排序
|
|
|
this.tablelistSort = {
|
|
@@ -781,7 +795,6 @@ export default {
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({
|