|
@@ -270,7 +270,7 @@
|
|
|
<el-select
|
|
|
v-model="scope.row.type"
|
|
|
value-key=""
|
|
|
- placeholder=""
|
|
|
+ placeholder="请选择类型"
|
|
|
filterable
|
|
|
@change="changeType(scope.row)"
|
|
|
>
|
|
@@ -291,6 +291,7 @@
|
|
|
value-key=""
|
|
|
placeholder=""
|
|
|
filterable
|
|
|
+ disabled
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in operatorOptions"
|
|
@@ -306,12 +307,20 @@
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
v-model="scope.row.value"
|
|
|
- :disabled="scope.row.type == '2'"
|
|
|
+ :disabled="scope.row.type == '1'|| scope.row.type == '2'"
|
|
|
placeholder="请输入参照值"
|
|
|
size="normal"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="danger"
|
|
|
+ @click="delContionHandler(scope.$index, queryContionTableData)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<template #footer>
|
|
@@ -328,7 +337,7 @@
|
|
|
:fullscreen="false"
|
|
|
>
|
|
|
<el-form
|
|
|
- :model="columnAttibute"
|
|
|
+ :model="column_attribute"
|
|
|
ref="columnAttibuteForm"
|
|
|
:rules="columnAttibuteRules"
|
|
|
label-width="100px"
|
|
@@ -336,14 +345,14 @@
|
|
|
size="normal"
|
|
|
>
|
|
|
<el-form-item label="是否是日期">
|
|
|
- <el-radio-group v-model="columnAttibute.isDateColumn">
|
|
|
+ <el-radio-group v-model="column_attribute.isDateColumn">
|
|
|
<el-radio :label="true"> 是 </el-radio>
|
|
|
<el-radio :label="false"> 否 </el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="日期格式">
|
|
|
<el-select
|
|
|
- v-model="columnAttibute.dateFormat"
|
|
|
+ v-model="column_attribute.dateFormat"
|
|
|
placeholder="请选择日期格式"
|
|
|
filterable
|
|
|
>
|
|
@@ -357,7 +366,7 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="是否显示" prop="isShow">
|
|
|
<el-switch
|
|
|
- v-model="columnAttibute.isShow"
|
|
|
+ v-model="column_attribute.isShow"
|
|
|
active-text="显示"
|
|
|
inactive-text="隐藏"
|
|
|
>
|
|
@@ -388,6 +397,7 @@ export default {
|
|
|
dicts: ["sys_time_format"],
|
|
|
props: {
|
|
|
datas: Object,
|
|
|
+ echoMessage: Object
|
|
|
},
|
|
|
components: { vuedraggable },
|
|
|
data() {
|
|
@@ -395,11 +405,12 @@ export default {
|
|
|
if (value.length === 0) callback(new Error("请输入有效数字"));
|
|
|
};
|
|
|
return {
|
|
|
+ tablelistSort: null,
|
|
|
tableQueryConditions: [],
|
|
|
tableList: [],
|
|
|
fieldList: [],
|
|
|
currentRow: {}, //当前正在编辑的列
|
|
|
- columnAttibute: {
|
|
|
+ column_attribute: {
|
|
|
isDateColumn: false,
|
|
|
dateFormat: "yyyy-MM-dd",
|
|
|
isShow: false,
|
|
@@ -438,10 +449,10 @@ export default {
|
|
|
value: 0,
|
|
|
label: "默认值",
|
|
|
},
|
|
|
- // {
|
|
|
- // value: 1,
|
|
|
- // label: "检索字段",
|
|
|
- // },
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: "输入值",
|
|
|
+ },
|
|
|
{
|
|
|
value: 2,
|
|
|
label: "系统值",
|
|
@@ -472,6 +483,10 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
+ console.log('tableName', this.datas.tableName);
|
|
|
+ if (this.datas.tableName) {
|
|
|
+ this.getFieldOptions1(this.datas.tableName);
|
|
|
+ }
|
|
|
this.getAllTable();
|
|
|
},
|
|
|
watch: {
|
|
@@ -513,6 +528,7 @@ export default {
|
|
|
immediate: true,
|
|
|
},
|
|
|
},
|
|
|
+ mounted() { },
|
|
|
methods: {
|
|
|
// 列名变化回调
|
|
|
changeModel() {
|
|
@@ -528,7 +544,13 @@ export default {
|
|
|
// this.lieData = this.datas.jsonData[0].fieldName;
|
|
|
},
|
|
|
changeType(row) {
|
|
|
- row.value = "#{userID}";
|
|
|
+ if (row.type == 1) {
|
|
|
+ row.value = "#{x}";
|
|
|
+ } else if(row.type == 2){
|
|
|
+ row.value = "#{userID}";
|
|
|
+ } else {
|
|
|
+ row.value = "";
|
|
|
+ }
|
|
|
},
|
|
|
// 查询条件变化回调
|
|
|
// changeContionField(row) {
|
|
@@ -536,6 +558,9 @@ export default {
|
|
|
// (item) => item.fieldName == row.fieldName
|
|
|
// )?.fieldDescription;
|
|
|
// },
|
|
|
+ delContionHandler(index, row) {
|
|
|
+ row.splice(index, 1);
|
|
|
+ },
|
|
|
// 添加查询条件回调
|
|
|
addContionHandler() {
|
|
|
if (!this.listQueryData.mainForm.mainTableName) {
|
|
@@ -548,13 +573,13 @@ export default {
|
|
|
fieldDescription: "",
|
|
|
value: "",
|
|
|
operator: "=",
|
|
|
- type: "0",
|
|
|
+ type: "",
|
|
|
});
|
|
|
},
|
|
|
// 保存字段配置回调
|
|
|
onSaveAttibute() {
|
|
|
- this.currentRow.columnAttibute = JSON.parse(
|
|
|
- JSON.stringify(this.columnAttibute)
|
|
|
+ this.currentRow.column_attribute = JSON.parse(
|
|
|
+ JSON.stringify(this.column_attribute)
|
|
|
);
|
|
|
console.log(this.mainTableData);
|
|
|
this.$message.success("保存成功");
|
|
@@ -562,10 +587,11 @@ export default {
|
|
|
},
|
|
|
// 字段配置回调
|
|
|
fieldEditHandler(row, index) {
|
|
|
- if (Object.keys(row.columnAttibute || {}).length) {
|
|
|
- this.columnAttibute = JSON.parse(JSON.stringify(row.columnAttibute));
|
|
|
+ console.log(row);
|
|
|
+ if (Object.keys(row.column_attribute || {}).length) {
|
|
|
+ this.column_attribute = JSON.parse(JSON.stringify(row.column_attribute));
|
|
|
} else {
|
|
|
- Object.assign(this.columnAttibute, {
|
|
|
+ Object.assign(this.column_attribute, {
|
|
|
isDateColumn: false,
|
|
|
dateFormat: "yyyy-MM-dd",
|
|
|
isShow: false,
|
|
@@ -611,6 +637,31 @@ export default {
|
|
|
this.$nextTick(() => {
|
|
|
this.initDragTable();
|
|
|
});
|
|
|
+ if(this.echoMessage) {
|
|
|
+ console.log("回显数据", this.echoMessage);
|
|
|
+ let echoMessage = this.echoMessage;
|
|
|
+ // 主表
|
|
|
+ let tableColumnName = JSON.parse(echoMessage.tableColumnName);
|
|
|
+ this.listQueryData.mainForm.mainTableName = tableColumnName[0].tbname;
|
|
|
+ // 表格主键
|
|
|
+ let tablelistSort = JSON.parse(echoMessage.tablelistSort);
|
|
|
+ let dataSortFromEcho = tablelistSort.DataSort; // "student.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 => ({
|
|
|
+ ...item,
|
|
|
+ fieldDescription : item.field_des,
|
|
|
+ column_attribute:JSON.parse(item.column_attribute),
|
|
|
+ }))
|
|
|
+ }
|
|
|
},
|
|
|
confirmHandler() {
|
|
|
let res = {};
|
|
@@ -635,15 +686,15 @@ export default {
|
|
|
this.mainTableData.forEach((item, index) => {
|
|
|
let nameItem = {},
|
|
|
descItem = {};
|
|
|
- let { tableName, fieldName, fieldDescription, columnAttibute } = item;
|
|
|
+ let { tableName, fieldName, fieldDescription, column_attribute } = item;
|
|
|
const columnAttributeString = JSON.stringify({
|
|
|
- isDateColumn: columnAttibute?.isDateColumn
|
|
|
- ? columnAttibute?.isDateColumn
|
|
|
+ isDateColumn: column_attribute?.isDateColumn
|
|
|
+ ? column_attribute?.isDateColumn
|
|
|
: false,
|
|
|
- dateFormat: columnAttibute?.dateFormat
|
|
|
- ? columnAttibute?.dateFormat
|
|
|
+ dateFormat: column_attribute?.dateFormat
|
|
|
+ ? column_attribute?.dateFormat
|
|
|
: "",
|
|
|
- isShow: columnAttibute?.isShow ? columnAttibute?.isShow : false,
|
|
|
+ isShow: column_attribute?.isShow ? column_attribute?.isShow : false,
|
|
|
});
|
|
|
nameItem = {
|
|
|
tbname: tableName,
|
|
@@ -668,7 +719,7 @@ export default {
|
|
|
queryData.fieldName = tableName + "." + fieldName;
|
|
|
queryData.value = value;
|
|
|
queryData.operator = operator;
|
|
|
- queryData.type = type;
|
|
|
+ queryData.type = String(type);
|
|
|
|
|
|
});
|
|
|
this.tableQueryConditions.push(queryData)
|
|
@@ -676,14 +727,14 @@ export default {
|
|
|
let tableQueryConditionsString = JSON.stringify(this.tableQueryConditions);
|
|
|
res.tableQueryConditions = tableQueryConditionsString;
|
|
|
// 排序
|
|
|
- let tablelistSort = {
|
|
|
+ this.tablelistSort = {
|
|
|
DataSort:
|
|
|
this.listQueryData.mainForm.mainTableName +
|
|
|
"." +
|
|
|
this.listQueryData.mainForm.sortFieldName,
|
|
|
DataSortType: this.listQueryData.mainForm.sortType,
|
|
|
};
|
|
|
- let tablelistSortString = JSON.stringify(tablelistSort);
|
|
|
+ let tablelistSortString = JSON.stringify(this.tablelistSort);
|
|
|
res.tablelistSort = tablelistSortString;
|
|
|
res.listMapValue = {};
|
|
|
const key = this.datas.componentKey;
|