<template>
  <div>
    <el-form ref="form" :model="form" label-width="100px">
      <el-form-item label="任务名称" prop="name">
        <el-input v-model="form.name" placeholder="请输入任务名称" />
      </el-form-item>
      <el-form-item label="类型" prop="type">
        <el-select v-model="form.type" placeholder="请选择类型">
          <el-option
            v-for="dict in dict.type.biz_perf_eval_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <template v-if="form.type === '1'">
        <el-form-item label="故障诊断算法" prop="fdAlgorithmId">
          <el-select v-model="form.fdAlgorithmId" placeholder="请选择模型">
            <el-option
              v-for="item in faultDiagnosisOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="实际标签" prop="truthLabels">
          <el-input v-model="form.truthLabels" placeholder="请输入实际标签" />
        </el-form-item>
        <el-form-item label="数据" prop="testDataIds">
          <el-select v-model="form.testDataIds" placeholder="请选择数据">
            <el-option
              v-for="item in dataOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </template>
      <template v-if="form.type === '2'">
        <el-form-item label="故障诊断算法" prop="fdAlgorithmId">
          <el-select v-model="form.fdAlgorithmId" placeholder="请选择模型">
            <el-option
              v-for="item in faultDiagnosisOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="实际标签" prop="truthLabels">
          <el-input v-model="form.truthLabels" placeholder="请输入实际标签" />
        </el-form-item>
        <el-form-item label="数据" prop="testDataIds">
          <el-select v-model="form.testDataIds" placeholder="请选择数据">
            <el-option
              v-for="item in dataOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="一级指标" prop="primaryIndicatorId">
          <el-input
            v-model="form.primaryIndicatorId"
            placeholder="请选择一级指标"
          />
        </el-form-item>
        <el-form-item label="二级指标" prop="secondaryIndicatorId">
          <el-input
            v-model="form.secondaryIndicatorId"
            placeholder="请选择二级指标"
          />
        </el-form-item>
        <el-form-item label="三级指标" prop="tertiaryIndicatorId">
          <el-input
            v-model="form.tertiaryIndicatorId"
            placeholder="请选择三级指标"
          />
        </el-form-item>
      </template>
      <template v-if="form.type === '3'">
        <el-form-item label="故障诊断算法" prop="fdAlgorithmId">
          <el-select v-model="form.fdAlgorithmId" placeholder="请选择模型">
            <el-option
              v-for="item in faultDiagnosisOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="实际标签" prop="truthLabels">
          <el-input v-model="form.truthLabels" placeholder="请输入实际标签" />
        </el-form-item>
        <el-form-item label="不确定指标" prop="tertiaryIndicatorId">
          <el-input
            v-model="form.tertiaryIndicatorId"
            placeholder="请选择不确定指标"
          />
        </el-form-item>
        <el-form-item label="物理模型" prop="tertiaryIndicatorId">
          <el-input
            v-model="form.tertiaryIndicatorId"
            placeholder="输入物理模型"
          />
        </el-form-item>
        <el-form-item label="参数" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入参数" />
        </el-form-item>
        <el-form-item label="区间" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入参数" />
        </el-form-item>
        <el-form-item label="步长" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入参数" />
        </el-form-item>
        <el-form-item label="噪声数据" prop="noseDataIds">
          <el-input v-model="form.noseDataIds" placeholder="请选择噪声数据" />
        </el-form-item>
      </template>
      <template v-if="form.type === '4'">
        <el-form-item label="故障诊断算法" prop="fdAlgorithmId">
          <el-select v-model="form.fdAlgorithmId" placeholder="请选择模型">
            <el-option
              v-for="item in faultDiagnosisOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="实际标签" prop="truthLabels">
          <el-input v-model="form.truthLabels" placeholder="请输入实际标签" />
        </el-form-item>
        <el-form-item label="不确定指标" prop="tertiaryIndicatorId">
          <el-input
            v-model="form.tertiaryIndicatorId"
            placeholder="请选择不确定指标"
          />
        </el-form-item>
        <el-form-item label="精度指标" prop="tertiaryIndicatorId">
          <el-input
            v-model="form.tertiaryIndicatorId"
            placeholder="请选择不确定指标"
          />
        </el-form-item>
        <el-form-item label="物理模型" prop="phyModelId">
          <el-input v-model="form.phyModelId" placeholder="输入物理模型" />
        </el-form-item>
        <el-form-item label="参数" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入参数" />
        </el-form-item>
        <el-form-item label="区间" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入区间" />
        </el-form-item>
        <el-form-item label="步长" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入步长" />
        </el-form-item>
        <el-form-item label="噪声数据" prop="noseDataIds">
          <el-select v-model="form.noseDataIds" placeholder="请选择数据">
            <el-option
              v-for="item in dataOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </template>
      <template v-if="form.type === '5'">
        <el-form-item label="故障诊断算法" prop="fdAlgorithmId">
          <el-select v-model="form.fdAlgorithmId" placeholder="请选择模型">
            <el-option
              v-for="item in faultDiagnosisOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="实际标签" prop="truthLabels">
          <el-input v-model="form.truthLabels" placeholder="请输入实际标签" />
        </el-form-item>
        <el-form-item label="不确定指标" prop="tertiaryIndicatorId">
          <el-input
            v-model="form.tertiaryIndicatorId"
            placeholder="请选择不确定指标"
          />
        </el-form-item>
        <el-form-item label="精度指标" prop="tertiaryIndicatorId">
          <el-input
            v-model="form.tertiaryIndicatorId"
            placeholder="请选择不确定指标"
          />
        </el-form-item>
        <!-- <el-form-item label="参数" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入参数" />
        </el-form-item>
        <el-form-item label="区间" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入参数" />
        </el-form-item>
        <el-form-item label="步长" prop="tertiaryIndicator">
          <el-input v-model="form.tertiaryIndicator" placeholder="输入参数" />
        </el-form-item> -->
        <el-form-item label="物理模型数据" prop="phyModelId">
          <el-select v-model="form.phyModelId" placeholder="请选择数据">
            <el-option
              v-for="item in dataOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="噪声生成模型" prop="noseModelId">
          <el-input v-model="form.noseModelId" placeholder="请输入噪声参数" />
        </el-form-item>
        <el-form-item label="噪声参数" prop="noseParams">
          <el-input v-model="form.noseParams" placeholder="请输入噪声参数" />
        </el-form-item>
      </template>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </div>
</template>

<script>
import { getDataOptions } from "@/api/data/data";
import { getFaultDiagnosisOptions } from "@/api/model/faultDiagnosis";
export default {
  name: "DdAlgorithmDetail",
  dicts: ["biz_perf_eval_type"],
  props: {
    _form: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      form: {},
      dataOptions: [],
      faultDiagnosisOptions: [],
    };
  },
  created() {
    this.form = this._form;
    getDataOptions().then((resp) => {
      this.dataOptions = resp.data;
    });
    getFaultDiagnosisOptions().then((resp) => {
      this.faultDiagnosisOptions = resp.data;
    });
  },
  methods: {
    submitForm() {
      this.$emit("submitPerfDetail", this.form);
    },
    cancel() {
      this.$emit("cancelPerfDetail");
    },
  },
};
</script>
