<template>
  <el-dialog width="60%" 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="井号"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="钻杆重量：">
            <el-input v-model="form.rodWeight" 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.sustainWoh" placeholder="持续起下钻钩载阈值"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="第一种活动钻具阈值：">
            <el-input v-model="form.activityOne" placeholder="第一种活动钻具阈值"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="第二种活动钻具阈值">
            <el-input v-model="form.activityTwo" 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 wohWarnValueApi from '@/api/warningThreshold/wohWarnValueApi'
export default {
  name: 'wohWarnForm',
  data() {
    return {
      innerVisible: false,
      form: {
        id: '',
        jh: '',
        rodWeight: '',
        sustainWoh: '',
        activityOne: '',
        activityTwo: '',
        bitdepth: ''
      }
    }
  },
  created() { },
  mounted() { },
  methods: {
    open(row) {
      this.innerVisible = true
      if (row != '') {
        this.form = row
      }
    },
    submit() {
      wohWarnValueApi.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>