|
@@ -243,6 +243,7 @@
|
|
|
>
|
|
|
</iframe> -->
|
|
|
<k-form-build
|
|
|
+ v-if="jsonData"
|
|
|
class="formBuild"
|
|
|
ref="addFromRef"
|
|
|
:dynamicData="dynamicData"
|
|
@@ -625,7 +626,10 @@ export default {
|
|
|
this.defaultValue = {};
|
|
|
getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
|
|
|
if (!data || !data.dfVueTemplate) {
|
|
|
+ this.jsonData = false;
|
|
|
this.$message.error("当前表格未绑定表单!");
|
|
|
+ this.title = "运行";
|
|
|
+ this.open = true;
|
|
|
return;
|
|
|
}
|
|
|
if (data.dfFormSql) {
|
|
@@ -1041,103 +1045,105 @@ export default {
|
|
|
return toUnderline(temp[0].toLowerCase() + temp.slice(1));
|
|
|
},
|
|
|
//提交编辑结果按钮回调
|
|
|
- editConfirmHandler() {
|
|
|
- this.$refs.addFromRef
|
|
|
- .getData()
|
|
|
- .then(async (values) => {
|
|
|
- let data = {
|
|
|
- basicMap: {
|
|
|
- tableName: this.tableName,
|
|
|
- // btnKey: btnData.btnKey,
|
|
|
- btnKey: this.currentBtnData.btnKey,
|
|
|
- },
|
|
|
- addListMap: [values],
|
|
|
- conditionMap: {},
|
|
|
- commMap: {},
|
|
|
- btnParametersMap: {},
|
|
|
- };
|
|
|
- if (this.currentBtnData.btnParams) {
|
|
|
- let btnParams = JSON.parse(this.currentBtnData.btnParams);
|
|
|
- btnParams.forEach((item) => {
|
|
|
- data.btnParametersMap[
|
|
|
- this.formatField(item.fieldName, camelCase(this.tableName))
|
|
|
- ] = item.fieldValue
|
|
|
- ? item.fieldValue
|
|
|
- : this.currentRow[item.fieldName];
|
|
|
- });
|
|
|
- }
|
|
|
- if (Object.keys(this.defaultValue).length) {
|
|
|
- //修改
|
|
|
- // 后台接收需要是表中字段真实的名称,无所谓驼峰。
|
|
|
- // data.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
- // this.defaultValue[
|
|
|
- // camelCase(this.templateInfo.template?.primaryKey)
|
|
|
- // ];
|
|
|
- data.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
- this.defaultValue[this.templateInfo.template?.primaryKey];
|
|
|
- Object.keys(values).map((k) => {
|
|
|
- data.commMap[k] = values[k];
|
|
|
- });
|
|
|
- data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
- data.basicMap.visible = true;
|
|
|
- } else {
|
|
|
- data.basicMap.btnType = "INSERT";
|
|
|
- data.basicMap.visible = true;
|
|
|
- }
|
|
|
- try {
|
|
|
- let res = await btnCommonApi(data);
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message.success("操作成功");
|
|
|
+ async editConfirmHandler() {
|
|
|
+ if (this.$refs.addFromRef) {
|
|
|
+ this.$refs.addFromRef
|
|
|
+ .getData()
|
|
|
+ .then(async (values) => {
|
|
|
+ let data = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: this.tableName,
|
|
|
+ // btnKey: btnData.btnKey,
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
+ },
|
|
|
+ addListMap: [values],
|
|
|
+ conditionMap: {},
|
|
|
+ commMap: {},
|
|
|
+ btnParametersMap: {},
|
|
|
+ };
|
|
|
+ if (this.currentBtnData.btnParams) {
|
|
|
+ let btnParams = JSON.parse(this.currentBtnData.btnParams);
|
|
|
+ btnParams.forEach((item) => {
|
|
|
+ data.btnParametersMap[
|
|
|
+ this.formatField(item.fieldName, camelCase(this.tableName))
|
|
|
+ ] = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[item.fieldName];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (Object.keys(this.defaultValue).length) {
|
|
|
+ data.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
+ this.defaultValue[this.templateInfo.template?.primaryKey];
|
|
|
+ Object.keys(values).map((k) => {
|
|
|
+ data.commMap[k] = values[k];
|
|
|
+ });
|
|
|
+ data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
+ data.basicMap.visible = true;
|
|
|
} else {
|
|
|
+ data.basicMap.btnType = "INSERT";
|
|
|
+ data.basicMap.visible = true;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ let res = await btnCommonApi(data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ } else {
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.log(error);
|
|
|
+ this.getList();
|
|
|
+ this.defaultValue = {};
|
|
|
+ this.open = false;
|
|
|
+ })
|
|
|
+ .catch((res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.$modal.msgError("表单校验失败,请规范填写数据");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 没有绑定表单
|
|
|
+ let data = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: this.tableName,
|
|
|
+ // btnKey: btnData.btnKey,
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
+ btnType: this.currentBtnData.btnType,
|
|
|
+ visible: true,
|
|
|
+ },
|
|
|
+ addListMap: [],
|
|
|
+ conditionMap: {},
|
|
|
+ commMap: {},
|
|
|
+ btnParametersMap: {},
|
|
|
+ };
|
|
|
+ if (this.currentBtnData.btnParams) {
|
|
|
+ let btnParams = JSON.parse(this.currentBtnData.btnParams);
|
|
|
+ btnParams.forEach((item) => {
|
|
|
+ data.btnParametersMap[
|
|
|
+ this.formatField(item.fieldName, camelCase(this.tableName))
|
|
|
+ ] = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[item.fieldName];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
+ // data.basicMap.visible = true;
|
|
|
+ try {
|
|
|
+ let res = await btnCommonApi(data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ } else {
|
|
|
this.$message.error("网络异常,请稍后再试");
|
|
|
}
|
|
|
- // if (Object.keys(this.defaultValue).length) {
|
|
|
- // let updateData = {
|
|
|
- // // 基本参数
|
|
|
- // basicMap: {
|
|
|
- // // 表名
|
|
|
- // tableName: this.tableName,
|
|
|
- // },
|
|
|
- // conditionMap: {},
|
|
|
- // commMap: {},
|
|
|
- // };
|
|
|
-
|
|
|
- // // 后台接收需要是表中字段真实的名称,无所谓驼峰。
|
|
|
- // updateData.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
- // this.defaultValue[
|
|
|
- // camelCase(this.templateInfo.template?.primaryKey)
|
|
|
- // ];
|
|
|
- // Object.keys(values).map((k) => {
|
|
|
- // updateData.commMap[k] = values[k];
|
|
|
- // });
|
|
|
- // let res = await batchEdit(updateData);
|
|
|
- // if (res.code == 200) {
|
|
|
- // this.$modal.msgSuccess("修改成功");
|
|
|
- // } else {
|
|
|
- // this.$modal.msgError("修改失败");
|
|
|
- // }
|
|
|
- // this.getList();
|
|
|
- // } else {
|
|
|
- // let res = await addTableData(data);
|
|
|
- // if (res.code == 200) {
|
|
|
- // this.$modal.msgSuccess("添加成功");
|
|
|
- // } else {
|
|
|
- // this.$modal.msgError("添加失败");
|
|
|
- // }
|
|
|
- // this.getList();
|
|
|
- // }
|
|
|
- this.getList();
|
|
|
- this.defaultValue = {};
|
|
|
- this.open = false;
|
|
|
- })
|
|
|
- .catch((res) => {
|
|
|
- console.log(res);
|
|
|
- this.$modal.msgError("表单校验失败,请规范填写数据");
|
|
|
- });
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ this.getList();
|
|
|
+ this.defaultValue = {};
|
|
|
+ this.open = false;
|
|
|
+ }
|
|
|
},
|
|
|
// 使用提交数据类型的按钮获取数据
|
|
|
tempSubBtn(getData) {
|
|
@@ -1304,6 +1310,12 @@ export default {
|
|
|
case "UPDATE":
|
|
|
this.handleUpdate(row, btnData);
|
|
|
break;
|
|
|
+ case "EXECUTE":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
+ case "INITIATED":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
case "DELETE":
|
|
|
this.handleDelete(row, btnData);
|
|
|
break;
|