|
@@ -211,6 +211,7 @@ import Approve from "@/components/FormGroup/Approve.vue";
|
|
import receiptDocuments from "@/utils/print/receiptDocuments";
|
|
import receiptDocuments from "@/utils/print/receiptDocuments";
|
|
import qrCodeList from "@/utils/print/qrCodeList.js";
|
|
import qrCodeList from "@/utils/print/qrCodeList.js";
|
|
import { xmlStr2XmlObj } from "@/utils/bpmn/tool";
|
|
import { xmlStr2XmlObj } from "@/utils/bpmn/tool";
|
|
|
|
+import { submitNodeForm } from "@/api/bpmprocess/runDialogApi/index";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "processMange",
|
|
name: "processMange",
|
|
@@ -474,6 +475,8 @@ export default {
|
|
);
|
|
);
|
|
let res = await this.$refs.approveRef.getformInfo();
|
|
let res = await this.$refs.approveRef.getformInfo();
|
|
if (!res.flag) return;
|
|
if (!res.flag) return;
|
|
|
|
+ // this.afterNodeExecute(this.row, res);
|
|
|
|
+ // return;
|
|
// 准备审批数据
|
|
// 准备审批数据
|
|
let payLoad = {
|
|
let payLoad = {
|
|
taskProcessKey: this.row.bepTaskKey, //当前任务流程编码
|
|
taskProcessKey: this.row.bepTaskKey, //当前任务流程编码
|
|
@@ -499,15 +502,116 @@ export default {
|
|
subformData.append(key, payLoad[key] == null ? "" : payLoad[key]);
|
|
subformData.append(key, payLoad[key] == null ? "" : payLoad[key]);
|
|
}
|
|
}
|
|
let result = await processNodeExecutionApproval(subformData);
|
|
let result = await processNodeExecutionApproval(subformData);
|
|
- console.log(result);
|
|
|
|
if (result.code == 200) {
|
|
if (result.code == 200) {
|
|
this.$message.success("审批成功");
|
|
this.$message.success("审批成功");
|
|
|
|
+ this.afterNodeExecute(this.row, res);
|
|
this.show = false;
|
|
this.show = false;
|
|
this.getList();
|
|
this.getList();
|
|
} else {
|
|
} else {
|
|
this.$message.error("审批失败");
|
|
this.$message.error("审批失败");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ // 节点后操作
|
|
|
|
+ async afterNodeExecute(row, formData) {
|
|
|
|
+ let { benTask3 } = row;
|
|
|
|
+ let timing = formData.data.approvalStatus;
|
|
|
|
+ if (!benTask3) return;
|
|
|
|
+ let tempData = JSON.parse(benTask3);
|
|
|
|
+ console.log(tempData, this.formList, formData);
|
|
|
|
+ let timingList = tempData.filter((item) => item.timing == timing);
|
|
|
|
+ if (timingList.length == 0) return; //没有指定时机的操作
|
|
|
|
+ let ExecuteTypeObj = {
|
|
|
|
+ insert: {}, //insertCommonEntityList
|
|
|
|
+ update: {}, //updateCommonEntityList
|
|
|
|
+ };
|
|
|
|
+ // let ExecuteTypeObj=new Object();
|
|
|
|
+ timingList.forEach((item) => {
|
|
|
|
+ let exeType = item.exeType;
|
|
|
|
+ if (exeType == "insert") {
|
|
|
|
+ item.tableData.forEach((i) => {
|
|
|
|
+ // let insertTableName = i.fieldName.split(".")[0];
|
|
|
|
+ // let insertField = i.fieldName.split(".")[1];
|
|
|
|
+ let insertTableName = i.relaTableName;
|
|
|
|
+ let insertField = i.relaFieldName;
|
|
|
|
+ if (!ExecuteTypeObj.insert[insertTableName]) {
|
|
|
|
+ //新的表 添加初始结构
|
|
|
|
+ ExecuteTypeObj.insert[insertTableName] = {
|
|
|
|
+ basicMap: {
|
|
|
|
+ tableName: insertTableName,
|
|
|
|
+ },
|
|
|
|
+ addListMap: [{}],
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ // 在保证有基础结构后 进行赋值
|
|
|
|
+ ExecuteTypeObj.insert[insertTableName].addListMap[0][insertField] =
|
|
|
|
+ i.defaultValue ? i.defaultValue : this.getRelateValue(i);
|
|
|
|
+ });
|
|
|
|
+ } else if (exeType == "update") {
|
|
|
|
+ item.tableData.forEach((i) => {
|
|
|
|
+ // let insertTableName = i.fieldName.split(".")[0];
|
|
|
|
+ // let insertField = i.fieldName.split(".")[1];
|
|
|
|
+ let insertTableName = i.relaTableName;
|
|
|
|
+ let insertField = i.relaFieldName;
|
|
|
|
+ if (!ExecuteTypeObj.update[insertTableName]) {
|
|
|
|
+ //新的表 添加初始结构
|
|
|
|
+ ExecuteTypeObj.update[insertTableName] = {
|
|
|
|
+ basicMap: {
|
|
|
|
+ tableName: insertTableName,
|
|
|
|
+ },
|
|
|
|
+ commMap: {},
|
|
|
|
+ conditionMap: {},
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ if (i.isCondition == "false") {
|
|
|
|
+ //非条件
|
|
|
|
+ ExecuteTypeObj.update[insertTableName].commMap[insertField] =
|
|
|
|
+ i.defaultValue ? i.defaultValue : this.getRelateValue(i);
|
|
|
|
+ } else {
|
|
|
|
+ //条件
|
|
|
|
+ ExecuteTypeObj.update[insertTableName].conditionMap[insertField] =
|
|
|
|
+ i.defaultValue ? i.defaultValue : this.getRelateValue(i);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ console.log(ExecuteTypeObj);
|
|
|
|
+ let payload = {
|
|
|
|
+ insertCommonEntityList: [],
|
|
|
|
+ updateCommonEntityList: [],
|
|
|
|
+ };
|
|
|
|
+ let tempInsert = ExecuteTypeObj.insert;
|
|
|
|
+ if (Object.keys(tempInsert).length > 0) {
|
|
|
|
+ for (const val of Object.keys(tempInsert)) {
|
|
|
|
+ payload.insertCommonEntityList.push(tempInsert[val]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let tempUpdate = ExecuteTypeObj.update;
|
|
|
|
+ if (Object.keys(tempUpdate).length > 0) {
|
|
|
|
+ for (const iterator of Object.keys(tempUpdate)) {
|
|
|
|
+ payload.updateCommonEntityList.push(tempUpdate[iterator]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ console.log(payload);
|
|
|
|
+ let res = await submitNodeForm(payload);
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
+ // this.$message.success("提交成功");
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.log(error);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 获取表单对应的值
|
|
|
|
+ getRelateValue(i) {
|
|
|
|
+ let { relaTableName, relaFieldName, fieldName } = i;
|
|
|
|
+ let tableName = fieldName.split(".")[0];
|
|
|
|
+ let field = fieldName.split(".")[1];
|
|
|
|
+ let relaForm = this.formList.find((item) => item.tableName == tableName);
|
|
|
|
+ if (!relaForm || !relaForm.template.defaultValue) return "";
|
|
|
|
+ return relaForm.template.defaultValue[field];
|
|
|
|
+ },
|
|
// 取消审批回调
|
|
// 取消审批回调
|
|
async cancelHandler(row) {
|
|
async cancelHandler(row) {
|
|
console.log(row);
|
|
console.log(row);
|