fjl
fujunling
2023-07-11 5e55262ee63e6587368ebbdb9386d71da5695386
Source/UBCS-WEB/src/views/modeling/cycle.vue
@@ -51,7 +51,7 @@
        v-if="visible"
        class="cycle_flow"
        :type="type"
        :chart-data="rowData.data || {}"
        :chart-data="nodesEdgesData"
        :chart-data-node-items="flowChartNodeItems"
        :rowData="rowData"
        ref="vueFlowchartEditor"
@@ -78,7 +78,7 @@
        pageSize: 10,
        total: 0,
        currentPage: 1,
        layout: "total, sizes, prev, pager, next, jumper"
        layout: "total, sizes, prev, pager, next, jumper",
      },
      option: {
        searchMenuSpan: 12,
@@ -116,6 +116,7 @@
      visible: false,
      flowChartNodeItems: [],
      rowData: {},
      nodesEdgesData: {},
      dialogWidth: "50%",
      type: "detail",
      loading: false,
@@ -136,10 +137,6 @@
        };
      }
      this.loading = true;
      console.log(
        Object.assign({}, params, this.page),
        "Object.assign({}, params, this.page)"
      );
      const { limit, page } = this.page;
      API.getList(Object.assign({}, params, { limit, page })).then((res) => {
        this.loading = false;
@@ -150,35 +147,57 @@
      });
    },
    openDialog(type, row) {
      if (type === "detail") {
        this.title = "预览生命周期流程图";
        this.dialogWidth = "50%";
      } else if (type === "edit") {
      this.type = type;
      if (type === "edit") {
        this.$set(row, "editLoading", true);
        this.title = "编辑生命周期流程图";
        this.dialogWidth = "95%";
      } else if (type === "add") {
      } else if (type === "detail") {
        this.$set(row, "detailLoading", true);
        this.title = "预览生命周期流程图";
        this.dialogWidth = "50%";
      }
      if (type !== "add") {
        API.detail({ id: row.id }).then((res) => {
          this.$set(row, "detailLoading", false);
          this.$set(row, "editLoading", false);
          this.rowData = row;
          this.nodesEdgesData = {nodes: res.nodes, edges: res.edges}
        });
      } else {
        this.title = "新增生命周期流程图";
        this.dialogWidth = "95%";
        this.visible = true;
      }
      this.type = type;
      this.rowData = row;
      this.visible = true;
    },
    async submit() {
      const newRowData = await this.$refs.vueFlowchartEditor.getNewRowData();
      console.log(newRowData, 'newRowDatanewRowData');
      console.log(newRowData, "newRowDatanewRowData");
      if (!newRowData) {
        return;
      }
      const flowData = this.$refs.vueFlowchartEditor.getFlowData();
      if (Array.isArray(flowData.nodes)) {
        flowData.nodes = flowData.nodes.map((item) => {
          item.name = item.id;
          return item;
        });
      }
      if (Array.isArray(flowData.edges)) {
        flowData.edges = flowData.edges.map((item) => {
          item.name = item.label;
          return item;
        });
      }
      let params = {
        ...flowData,
        ...newRowData
      }
        ...newRowData,
      };
      console.log(flowData, newRowData);
      API.add(params).then(res => {
        console.log(res, 'res');
      })
      API.add(params).then((res) => {
        console.log(res, "res");
      });
    },
  },
  watch: {