|
@@ -31,6 +31,7 @@
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
+
|
|
|
>修改
|
|
|
</el-button>
|
|
|
</el-dropdown-item>
|
|
@@ -68,8 +69,10 @@
|
|
|
<k-form-build
|
|
|
class="formBuild"
|
|
|
ref="addFromRef"
|
|
|
+ :dynamicData="dynamicData"
|
|
|
:defaultValue="defaultValue"
|
|
|
@submit="tempSubBtn"
|
|
|
+ @change="formChangeHandler"
|
|
|
:value="jsonData"
|
|
|
/>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -124,7 +127,8 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
columns: [],
|
|
|
- defaultValue: '',
|
|
|
+ // 回显表格数据,
|
|
|
+ defaultValue: {},
|
|
|
currentValue:{},
|
|
|
//存放表单渲染数据
|
|
|
jsonData: {},
|
|
@@ -133,7 +137,6 @@ export default {
|
|
|
// cru 弹窗
|
|
|
open: false,
|
|
|
// 回显表格数据,
|
|
|
- defaultValue: '',
|
|
|
currentRow: null,
|
|
|
// 用户表格数据
|
|
|
tableList: [],
|
|
@@ -144,12 +147,14 @@ export default {
|
|
|
tableName: '',
|
|
|
queryFromWhere:'',
|
|
|
condition: [],
|
|
|
- // 表名
|
|
|
dtName: '',
|
|
|
+ // 下拉框动态数据
|
|
|
+ dynamicData: {},
|
|
|
};
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
+ // currentValues
|
|
|
cardDataWatcher: function(){
|
|
|
return this.cardData
|
|
|
},
|
|
@@ -172,7 +177,7 @@ export default {
|
|
|
},
|
|
|
tableKeyWatcher: {
|
|
|
handler(newval){
|
|
|
- console.log(newval)
|
|
|
+ // console.log(newval)
|
|
|
this.gettableListHandler(newval);
|
|
|
},
|
|
|
deep: true,
|
|
@@ -205,6 +210,7 @@ export default {
|
|
|
this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC"
|
|
|
this.tableName = this.templateInfo.template.dtTableName;
|
|
|
this.dtName = this.templateInfo.template.dtName;
|
|
|
+
|
|
|
// 得到查询条件
|
|
|
this.queryFromWhere = res.data.resultMap.where;
|
|
|
// 得到当前列表信息
|
|
@@ -278,8 +284,7 @@ export default {
|
|
|
}
|
|
|
return kv;
|
|
|
})
|
|
|
-
|
|
|
- console.log(this.tableList);
|
|
|
+ // console.log(this.tableList);
|
|
|
}
|
|
|
this.total = tableLists.total;
|
|
|
this.loading = false;
|
|
@@ -310,11 +315,15 @@ export default {
|
|
|
handleAdd(row) {
|
|
|
// this.reset();
|
|
|
this.defaultValue = {};
|
|
|
- getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({data}) => {
|
|
|
+ getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
|
|
|
if (!data || !data.dfVueTemplate) {
|
|
|
this.$message.error("当前表格未绑定表单!");
|
|
|
return;
|
|
|
}
|
|
|
+ if (data.dfFormSql) {
|
|
|
+ let dynamicData = JSON.parse(data.dfFormSql);
|
|
|
+ Object.assign(this.dynamicData, dynamicData);
|
|
|
+ }
|
|
|
this.jsonData = JSON.parse(data.dfVueTemplate);
|
|
|
this.open = true;
|
|
|
this.title = "添加信息";
|
|
@@ -367,11 +376,10 @@ export default {
|
|
|
});
|
|
|
let res = await batchEdit(updateData);
|
|
|
if (res.code == 200) {
|
|
|
- this.$modal.msgSuccess("修改成功");this.$modal.msgSuccess("删除成功");
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
} else {
|
|
|
this.$modal.msgError("修改失败");
|
|
|
}
|
|
|
- this.getDataHandler();
|
|
|
} else {
|
|
|
let res = await addTableData(data);
|
|
|
if (res.code == 200) {
|
|
@@ -379,10 +387,10 @@ export default {
|
|
|
} else {
|
|
|
this.$modal.msgError("添加失败");
|
|
|
}
|
|
|
- this.getDataHandler();
|
|
|
}
|
|
|
+ this.tableList = []
|
|
|
+ this.gettableListHandler(this.tableKey)
|
|
|
this.defaultValue = {};
|
|
|
- this.getDataHandler();
|
|
|
this.open = false;
|
|
|
})
|
|
|
.catch((res) => {
|
|
@@ -397,12 +405,15 @@ export default {
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
+ console.log(row)
|
|
|
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)
|
|
|
this.jsonData = JSON.parse(data.dfVueTemplate);
|
|
|
this.open = true;
|
|
|
this.title = "修改信息";
|
|
@@ -424,6 +435,10 @@ export default {
|
|
|
this.title = "修改当前信息";
|
|
|
this.form.password = "";
|
|
|
});
|
|
|
+ },
|
|
|
+ // k-form-build表单变化回调
|
|
|
+ formChangeHandler(value, label) {
|
|
|
+ // console.log(value, label);
|
|
|
},
|
|
|
/** 删除按钮操作
|
|
|
*
|
|
@@ -448,16 +463,14 @@ export default {
|
|
|
this.$modal
|
|
|
.confirm('是否确认删除"' + delIds + '"的数据项?')
|
|
|
.then(function () {
|
|
|
- console.log('123')
|
|
|
- return delTableData(data)
|
|
|
+ return delTableData(data);
|
|
|
})
|
|
|
.then(() => {
|
|
|
// 调用子组件查询方法 目的是携带上子组件中的查询参数
|
|
|
// this.$refs.mychild.pageList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
this.gettableListHandler(this.tableKey)
|
|
|
- // console.log('删除')
|
|
|
-
|
|
|
+
|
|
|
})
|
|
|
.catch(() => {
|
|
|
});
|