|
@@ -31,7 +31,6 @@
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
-
|
|
|
>修改
|
|
|
</el-button>
|
|
|
</el-dropdown-item>
|
|
@@ -98,6 +97,7 @@ import {inputDisableComplete} from "@/utils/other";
|
|
|
import {dragGroupTableInfo} from "@/api/relateTable/index"
|
|
|
|
|
|
import {camelCase} from "@/utils";
|
|
|
+import { async } from "@/components/updateModule/k-form-design/lib/k-form-design.common";
|
|
|
export default {
|
|
|
name: "RelateTableCard",
|
|
|
props: ["cardData", "index", "tableKey", "sort"],
|
|
@@ -155,7 +155,6 @@ export default {
|
|
|
preRow:{}
|
|
|
};
|
|
|
},
|
|
|
-
|
|
|
computed: {
|
|
|
// currentValues
|
|
|
cardDataWatcher: function(){
|
|
@@ -200,7 +199,6 @@ export default {
|
|
|
// 请求数据
|
|
|
async gettableListHandler(tableKey, paramsContion = [], defaultVal ={}){
|
|
|
const res = await dragTableInfo({queryMap: {tableKey : tableKey }})
|
|
|
- console.log(123456);
|
|
|
this.getTableHandle(res, paramsContion = [],defaultVal = {})
|
|
|
},
|
|
|
async getTableHandle(res){
|
|
@@ -222,7 +220,7 @@ export default {
|
|
|
JSON.parse(this.templateInfo.template.dtColumnName)
|
|
|
);
|
|
|
|
|
|
- if (this.templateInfo !== {}) {
|
|
|
+ if (this.templateInfo) {
|
|
|
this.tableCondition = this.templateInfo.querySql.tableCondition
|
|
|
this.tableCondition = this.tableCondition.split('AND')
|
|
|
|
|
@@ -235,20 +233,21 @@ export default {
|
|
|
this.queryParams.orderByColumn || ""
|
|
|
);
|
|
|
// 根据sql语句查询当前表数据
|
|
|
-
|
|
|
- if(this.newsort == 0){
|
|
|
- this.getDataHandler()
|
|
|
- // this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
|
|
|
- }else{
|
|
|
+ this.contion = this.templateInfo.template.dtTableName + '.' + this.templateInfo.template.primaryKey
|
|
|
|
|
|
+ this.$nextTick(async ()=>{
|
|
|
+ if(this.newsort == 0){
|
|
|
+ await this.getDataHandler()
|
|
|
+ }else{
|
|
|
if(this.myContion){
|
|
|
- this.getDataHandler(this.myContion,this.preRow)
|
|
|
- }
|
|
|
+ await this.getDataHandler(this.myContion,this.preRow)
|
|
|
+ } else {
|
|
|
+ // this.$emit('getDefaultCardData', this.index)
|
|
|
+ }
|
|
|
}
|
|
|
- let k;
|
|
|
-
|
|
|
- // console.log('conditions', this.tableCondition);
|
|
|
- this.contion = this.templateInfo.template.dtTableName + '.' + this.templateInfo.template.primaryKey
|
|
|
+ })
|
|
|
+
|
|
|
+ // let k;
|
|
|
// this.tableCondition.forEach((item, i) => {
|
|
|
// let val = item.split('=')
|
|
|
// if(i!==0){
|
|
@@ -269,20 +268,17 @@ export default {
|
|
|
// console.log(contion);
|
|
|
this.myContion=contion;
|
|
|
this.preRow=list;
|
|
|
- console.log(list);
|
|
|
+ // console.log(list);
|
|
|
if(contion){
|
|
|
let key = contion.split('.')
|
|
|
this.queryParams.queryMap['#{' + contion] = "'" + list[key[1]] + "'";
|
|
|
}
|
|
|
this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
|
|
|
|
|
|
- // contion?.forEach(item => {
|
|
|
- // this.queryParams.queryMap['#{' + item.key + '.' + item.value] = "'" + list[item.value] + "'";
|
|
|
- // })
|
|
|
this.tableList = [];
|
|
|
let tableLists = await unionListTableData(this.queryParams)
|
|
|
if(tableLists.code == 200){
|
|
|
-
|
|
|
+ this.$emit('getDefaultCardData', this.index)
|
|
|
tableLists.rows.forEach((item) => {
|
|
|
this.tableList.push(item.resultMap);
|
|
|
});
|
|
@@ -349,6 +345,9 @@ export default {
|
|
|
getNextCardData(){
|
|
|
this.handleCurrentChange(this.row)
|
|
|
},
|
|
|
+ getDefaultCard(){
|
|
|
+ this.handleCurrentChange(this.tableList[0])
|
|
|
+ },
|
|
|
// 使用提交数据类型的按钮获取数据
|
|
|
tempSubBtn(getData) {
|
|
|
getData()
|
|
@@ -360,7 +359,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
//提交编辑结果按钮回调
|
|
|
- editConfirmHandler() {
|
|
|
+ editConfirmHandler() {
|
|
|
this.$refs.addFromRef
|
|
|
.getData()
|
|
|
.then(async (values) => {
|
|
@@ -404,7 +403,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
// this.tableList = []
|
|
|
- this.$emit('getChildData', this.index)
|
|
|
+ if(this.index == 0){
|
|
|
+ this.getDataHandler()
|
|
|
+ } else {
|
|
|
+ this.$emit('getChildData', this.index)
|
|
|
+ }
|
|
|
// this.getDataHandler(this.contion, this.row)
|
|
|
// this.gettableListHandler(this.tableKey)
|
|
|
this.defaultValue = {};
|
|
@@ -419,25 +422,32 @@ export default {
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
this.open = false;
|
|
|
+ this.defaultVal = {}
|
|
|
// this.reset();
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
- console.log(row)
|
|
|
+ let obj = {}
|
|
|
+ for(let key in row) {
|
|
|
+ let modifiedTable = key.replace(/[A-Z]/g, (match) => `_${match}`).toLowerCase();
|
|
|
+ obj[modifiedTable] = row[key];
|
|
|
+ }
|
|
|
+
|
|
|
getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({data}) => {
|
|
|
if (!data || !data.dfVueTemplate) {
|
|
|
this.$message.error("当前表格未绑定表单!");
|
|
|
return;
|
|
|
}
|
|
|
- Object.assign(this.defaultValue, row);
|
|
|
-
|
|
|
- // console.log('123', this.defaultValue)
|
|
|
+ Object.assign(this.defaultValue, obj);
|
|
|
+ console.log(this.defaultValue)
|
|
|
this.jsonData = JSON.parse(data.dfVueTemplate);
|
|
|
+ console.log('123', this.jsonData)
|
|
|
this.open = true;
|
|
|
this.title = "修改信息";
|
|
|
// this.form.password = this.initPassword;
|
|
|
this.$nextTick(() => {
|
|
|
- this.$refs.addFromRef.setData(row);
|
|
|
+ console.log(this.$refs.addFromRef);
|
|
|
+ this.$refs.addFromRef.setData(obj);
|
|
|
});
|
|
|
});
|
|
|
return;
|