<template>
  <div class="siteManage-main powerScore">
    <el-form
      :model="ruleForm"
      :rules="rules"
      ref="ruleForm"
      label-width="137px"
      class="demo-ruleForm"
    >
      <div class="grid-content bg-purple">
        <div class="el-form-item blockTitle">电能质量各要素权重</div>
        <div></div>
        <el-form-item label="功率因数(100%)：" prop="name">
          <el-input v-model="ruleForm.name"></el-input>
        </el-form-item>

        <el-form-item label="电压合格率(%)：" prop="name">
          <el-input v-model="ruleForm.name"></el-input>
        </el-form-item>
        <el-form-item label="负载率(%)：" prop="name">
          <el-input v-model="ruleForm.name"></el-input>
        </el-form-item>
        <el-form-item label="电流平衡度(%)：" prop="name">
          <el-input v-model="ruleForm.name"></el-input>
        </el-form-item>

        <el-form-item label="电压平衡度(%)：" prop="name">
          <el-input v-model="ruleForm.name"></el-input>
        </el-form-item>
        <el-form-item label="谐波畸变率(%)：" prop="name">
          <el-input v-model="ruleForm.name"></el-input>
          <div class="remarksTxt">当要素权重为0时，该要素不参与电能质量分析</div>
        </el-form-item>

        <div class="el-form-item blockTitle">功率因数</div>
        <el-form-item label="功率因数：" prop="powerFactorTwo">
          <el-input v-model="ruleForm.npowerFactorTwoame"></el-input>
          
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm('ruleForm')">
            保存
          </el-button>
        </el-form-item>
      </div>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'PowerScore',
  data() {
    return {
      ruleForm: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: '',
        planStartTime: '',
        planEndTime: '',
      },
      rules: {
        planStartDate: [
          { required: true, message: '请选择开始日期', trigger: 'change' },
        ],
        planEndDate: [
          { required: true, message: '请输入结束日期', trigger: 'change' },
        ],
        name: [
          { required: true, message: '请输入站点名称', trigger: 'blur' },
          { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' },
        ],
        region: [
          { required: true, message: '请选择活动区域', trigger: 'change' },
        ],
        date1: [
          {
            type: 'date',
            required: true,
            message: '请选择日期',
            trigger: 'change',
          },
        ],
        date2: [
          {
            type: 'date',
            required: true,
            message: '请选择时间',
            trigger: 'change',
          },
        ],
        type: [
          {
            type: 'array',
            required: true,
            message: '请至少选择一个活动性质',
            trigger: 'change',
          },
        ],
        resource: [
          { required: true, message: '请选择活动资源', trigger: 'change' },
        ],
        desc: [{ required: true, message: '请填写活动形式', trigger: 'blur' }],
      },
    }
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert('submit!')
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
  },
}
</script>
<style scoped lang="scss">
</style>
