xyc
2024-11-18 2d6c0d1cffe663b3b37ef7e0575cfe6e11d8fd85
web/packages/views/pages/generator.vue
@@ -10,6 +10,11 @@
          <el-button @click="getTableInfo()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-form>
        <el-button type="primary" @click="callPythonCalc()">启动python计算</el-button>
<!--        <el-button type="primary" @click="getPythonCalcResult()">获取python计算进度</el-button>-->
        <el-tag>仿真进度:{{progress}}%</el-tag>
      </el-form>
      <el-table :data="dataForm.tableData" height="320" stripe style="width: 100%">
        <el-table-column prop="columnName" label="CODE"></el-table-column>
        <el-table-column prop="remarks" label="名称">
@@ -114,8 +119,9 @@
          isExport: false,
          tableData: [],
          tableList:[]
        }
        },
        progress: 0,
        timer: null,
      }
    },
@@ -151,6 +157,28 @@
      this.getInfo()
    },
    methods: {
      async callPythonCalc() {
        // 启动python计算
        let res = await this.$http.get('/taskReliability/ModelLine/callPythonCalc')
        if (res.success) {
          this.$alert('启动python计算成功!')
          // 定时获取python计算进度
          this.timer = setInterval(this.getPythonCalcResult, 5000)
        }
      },
      async getPythonCalcResult() {
        // setTimeout(() => {
          let res = await this.$http.get('/taskReliability/ModelLine/getPythonCalcResult')
          if (res.success) {
            this.progress = res.data
            if (this.progress==='100') {
              clearInterval(this.timer)
            }
          }
        // }, 5000)
      },
      // 获取信息
      async getInfo() {
        let res = await this.$http.get(`/sys/generator/properties`)