<template>
  <el-dialog width="50%" title="扭矩阈值" :visible.sync="innerVisible" append-to-body>
    <el-form :inline="true" :model="form" class="demo-form-inline" label-width="180px" :label-position="'left'">
      <el-row :gutter="1">
        <el-col :span="12">
          <el-form-item label="井号：">
            <el-input v-model="form.jh" placeholder="井号" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="扭矩监测最小值：">
            <el-input v-model="form.torqueMin" placeholder="扭矩监测最小值"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="扭矩监测最大值：">
            <el-input v-model="form.torqueMax" placeholder="扭矩监测最大值"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="均值阈值：">
            <el-input v-model="form.varianceWarnValue" placeholder="均值阈值"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="波动值阈值：">
            <el-input v-model="form.fluctuateWarn" placeholder="波动值阈值"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="钻头监测阈值：">
            <el-input v-model="form.bitdepth" placeholder="钻头监测阈值"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="排序：">
            <el-input v-model="form.sortCode" placeholder="排序"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="innerVisible = false">取 消</el-button>
      <el-button type="primary" @click="submit">提 交</el-button>
    </div>
  </el-dialog>
</template>

<script>
import torqueWarnValueApi from '@/api/warningThreshold/torqueWarnValueApi'
export default {
  name: 'torqueWarnForm',
  data() {
    return {
      innerVisible: false,
      form: {}
    }
  },
  created() { },
  mounted() { },
  methods: {
    open(jh, row) {
      this.innerVisible = true
      this.form.jh = jh
      if (row != '') {
        this.form = row
      }
    },
    submit() {
      torqueWarnValueApi.saveOrUpd(this.form).then(res => {
        // console.log('res', res)
        if (res.success) {
          this.$message({
            message: '阈值已更新',
            type: 'success'
          });
        } else {
          this.$message({
            message: '阈值更新失败',
            type: 'warning'
          });
        }
        this.$emit('close')
        this.innerVisible = false
      })
    }
  }
}
</script>

<style>
</style>