<template>
  <el-dialog
    :title="'工作流日志'"
    :close-on-click-modal="false"
    :visible.sync="visible"
  >
    <!-- <el-form :model="dataForm" ref="dataForm" label-width="160px">
      <el-form-item class="boxformitem"> -->
        <div style="width:'10%',height:'100%',display:'flex'">
          <el-radio-group
            v-model="containertype"
            default-value="main"
            @change="workflowcontainerchange"
          >
            <el-radio label="main" value="main">main</el-radio>
            <el-radio label="init" value="init">init</el-radio>
            <el-radio label="wait" value="wait">wait</el-radio>
          </el-radio-group>
          <a-descriptions
            title=""
            layout="vertical"
            bordered
            style="white-space: pre-wrap"
          >
            
            <a-descriptions-item >
              {{ this.workflowContentlog }}
            </a-descriptions-item>
          </a-descriptions>
          <!-- </a-layout-footer> -->
        </div>
      <!-- </el-form-item>
    </el-form> -->
    <!-- <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
    </span> -->
  </el-dialog>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      dataForm: {
        id: 0,
        modelName: "",
      },

      workflowName: "", //提交后的工作流名称
      workflowContent: { main: "暂无数据", wait: "暂无数据", init: "暂无数据" },
      workflowContentlog: "",

      containertype: "main",
    };
  },
  methods: {
    // init1(cell, celldata, workflowName) {
    //   this.visible = true;
    //   this.workflowName = workflowName;
    //   // this.wftemplateName = celldata.wftemplatename;
    //   //此时celldata.sourcealgocell == null
    // },
    init(workflowName) {
      this.visible = true;
      this.workflowName = workflowName;

      this.$http({
        url: this.$http.adornUrl("/visi/visiworkflow/getworkflowlog"),
        method: "get",
        params: this.$http.adornParams({
          workflowName: this.workflowName,
        }),
      })
        .then(({ data }) => {
          this.workflowContent = data.workflowContent;
          this.workflowContentlog = this.workflowContent.main;
          // this.podlogs = data.podlogs;
          console.log("workflowcontent");
          console.log(this.workflowContent);
          console.log(this.workflowContent.main);
          console.log(this.workflowContent.init);
          console.log(this.workflowContent.wait);
          // console.log("podlogs")
          // console.log(this.podlogs);
        })
        .then(() => {
          // this.visible = true
          // this.$nextTick(() => {
          //   this.$refs['dataForm'].resetFields()
          // })
        });
    },
    init1() {
      this.visible = true;
      this.workflowContentlog = this.workflowContent.main;
      //暂未生成workflowname
      
    },
    //单选控制 日志类型 main init wait
    workflowcontainerchange(e) {
      if (this.containertype == "main") {
        this.workflowContentlog = this.workflowContent.main;
      }
      if (this.containertype == "init") {
        this.workflowContentlog = this.workflowContent.init;
      }
      if (this.containertype == "wait") {
        this.workflowContentlog = this.workflowContent.wait;
      }
    },
  },
};
</script>
<style>
.el-form-item .el-select {
  width: 100%;
}
.el-form-item .el-input {
  width: 100%;
}
</style>
