|
@@ -1284,6 +1284,7 @@ export default {
|
|
|
async (res) => {
|
|
|
// 获取到所有表单数据
|
|
|
console.log(res);
|
|
|
+ let mainFormData = res[0].data;
|
|
|
let data = {
|
|
|
basicMap: {
|
|
|
tableName: this.tableName,
|
|
@@ -1295,30 +1296,32 @@ export default {
|
|
|
commMap: {},
|
|
|
btnParametersMap: {},
|
|
|
};
|
|
|
- if (this.currentBtnData.btnParams) {
|
|
|
- let btnParams =
|
|
|
- JSON.parse(this.currentBtnData.btnParams)?.commonFieldData ||
|
|
|
- [];
|
|
|
- // let conditionData =
|
|
|
- // JSON.parse(this.currentBtnData.btnParams)?.conditionData || [];
|
|
|
- // let
|
|
|
- btnParams.forEach((item) => {
|
|
|
- data.btnParametersMap[item.fieldName.split(".")[1]] =
|
|
|
- item.fieldValue
|
|
|
- ? item.fieldValue
|
|
|
- : this.currentRow[
|
|
|
- camelCase(item.fieldName.replace(".", "_"))
|
|
|
- ];
|
|
|
- });
|
|
|
- // conditionData.forEach((item) => {
|
|
|
- // data.conditionMap[item.fieldName.split(".")[1]] =
|
|
|
- // item.fieldValue
|
|
|
- // ? item.fieldValue
|
|
|
- // : this.currentRow[
|
|
|
- // camelCase(item.fieldName.replace(".", "_"))
|
|
|
- // ];
|
|
|
- // });
|
|
|
- }
|
|
|
+
|
|
|
+ let btnParams =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams)?.conditionData || [];
|
|
|
+ Object.keys(mainFormData).map((k) => {
|
|
|
+ data.commMap[k] = mainFormData[k];
|
|
|
+ });
|
|
|
+ btnParams.forEach((item) => {
|
|
|
+ data.btnParametersMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log("mainFormData", mainFormData);
|
|
|
+ console.log("btnParams", btnParams);
|
|
|
+ console.log("conditionData", conditionData);
|
|
|
+ console.log("btnType", this.currentBtnData.btnType);
|
|
|
data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
data.basicMap.visible = true;
|
|
|
let payLoad = {};
|
|
@@ -1381,6 +1384,92 @@ export default {
|
|
|
result.addListMap[0][formItem.split(".")[1]] = uuid;
|
|
|
return result;
|
|
|
});
|
|
|
+ } else if (this.currentBtnData.btnType == "INITIATED") {
|
|
|
+ // 按照单独的表单投产逻辑收集主表单数据
|
|
|
+ // let mainFormData = res[0].data;//主表单数据
|
|
|
+ // payLoad = {
|
|
|
+ // basicMap: {
|
|
|
+ // tableName: this.tableName,
|
|
|
+ // // btnKey: btnData.btnKey,
|
|
|
+ // btnKey: this.currentBtnData.btnKey,
|
|
|
+ // },
|
|
|
+ // addListMap: mainFormData,
|
|
|
+ // conditionMap: {},
|
|
|
+ // commMap: {},
|
|
|
+ // btnParametersMap: {},
|
|
|
+ // };
|
|
|
+ // if (this.currentBtnData.btnParams) {
|
|
|
+ // let btnParams =
|
|
|
+ // JSON.parse(this.currentBtnData.btnParams)?.commonFieldData ||
|
|
|
+ // [];
|
|
|
+ // let conditionData =
|
|
|
+ // JSON.parse(this.currentBtnData.btnParams).conditionData || [];
|
|
|
+ // // let
|
|
|
+ // btnParams.forEach((item) => {
|
|
|
+ // payLoad.btnParametersMap[item.fieldName.split(".")[1]] =
|
|
|
+ // item.fieldValue
|
|
|
+ // ? item.fieldValue
|
|
|
+ // : this.currentRow[
|
|
|
+ // camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ // ];
|
|
|
+ // });
|
|
|
+ // conditionData.forEach((item) => {
|
|
|
+ // payLoad.conditionMap[item.fieldName.split(".")[1]] =
|
|
|
+ // item.fieldValue
|
|
|
+ // ? item.fieldValue
|
|
|
+ // : this.currentRow[
|
|
|
+ // camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ // ];
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // if (Object.keys(this.defaultValue).length) {
|
|
|
+ // // data.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
+ // // this.defaultValue[this.templateInfo.template?.primaryKey];
|
|
|
+ // Object.keys(mainFormData).map((k) => {
|
|
|
+ // data.commMap[k] = mainFormData[k];
|
|
|
+ // });
|
|
|
+ // data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
+ // data.basicMap.visible = true;
|
|
|
+ // } else {
|
|
|
+ // data.basicMap.btnType = "INSERT";
|
|
|
+ // data.basicMap.visible = true;
|
|
|
+ // }
|
|
|
+ // 添加表单组数据处理逻辑
|
|
|
+ payLoad.updateCommonEntityList = res.map((item, index) => {
|
|
|
+ let result = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: item.tableName,
|
|
|
+ },
|
|
|
+ commMap: {
|
|
|
+ ...item.data,
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ };
|
|
|
+ if (index == 0) {
|
|
|
+ //主表条件
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams).conditionData ||
|
|
|
+ [];
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ result.conditionMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 从表条件
|
|
|
+ let { formItem, relateFormItem } = item;
|
|
|
+ let fieldName = formItem.split(".")[1];
|
|
|
+ let value =
|
|
|
+ this.currentRow[
|
|
|
+ camelCase(relateFormItem.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ result.conditionMap[fieldName] = value;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
data.basicMap.BpmRunNodeFormDateVo = payLoad;
|