/* eslint-disable */
<template>
  <div style="height: 600px;overflow-y: auto;display: flex;flex-direction: column;padding: 8px 16px"  v-loading="isLoading">
    <el-form ref='form' :model='form' label-width='80px' style="flex: 1" >
      <el-row >
        <el-col :span='24'>
          <el-form-item label='到达地面阈值 ' label-width='200px'>
            <el-input v-model='gkcsObj.approachingSurface' size='mini' />
          </el-form-item>
          <el-form-item label='坐卡阈值' label-width='200px'>
            <el-input v-model='gkcsObj.woh' size='mini' />
          </el-form-item>
          <el-form-item label=' 在井底阈值 ' label-width='200px'>
            <el-input v-model='gkcsObj.onBottom ' size='mini' />
          </el-form-item>
<!--          <el-form-item label='停转阈值' label-width='200px'>-->
<!--            <el-input v-model='gkcsObj.isRotationOff' size='mini' disabled/>-->
<!--          </el-form-item>-->
<!--          <el-form-item label='游车静止阈值' label-width='200px'>-->
<!--            <el-input v-model='gkcsObj.blockldle ' size='mini' disabled/>-->
<!--          </el-form-item>-->
<!--          <el-form-item label='停泵阈值' label-width='200px'>-->
<!--            <el-input v-model='gkcsObj.noFlow ' size='mini' disabled/>-->
<!--          </el-form-item>-->
          <el-form-item label='立压为0阈值  ' label-width='200px'>
            <el-input v-model='gkcsObj.pressureZero ' size='mini' />
          </el-form-item>
<!--          <el-form-item label='钻头上行阈值 ' label-width='200px'>-->
<!--            <el-input v-model='gkcsObj.bitMovingUp ' size='mini' disabled/>-->
<!--          </el-form-item>-->
<!--          <el-form-item label=' 游车上行阈值 ' label-width='200px'>-->
<!--            <el-input v-model='gkcsObj.blockMovingUp  ' size='mini' disabled/>-->
<!--          </el-form-item>-->
<!--          <el-form-item label='离开井底阈值 ' label-width='200px'>-->
<!--            <el-input v-model='gkcsObj.farBottom  ' size='mini' disabled/>-->
<!--          </el-form-item>-->
        </el-col>
      </el-row>

    </el-form>
    <el-button type="primary" style="width: 120px;align-self: flex-end" @click="submit">保存</el-button>

  </div>

</template>

<script>
import newWarnApi from '@/api/newWarnApi'
import vue from 'vue'

export default {
  name: 'workConditionParam',
  props: {

  },
  data() {
    return {

      jh: vue.ls.get('TOPLEFT_JH_SELECTED').JH,
      isLoading:false,
      gkcsObj: {
        'id': '',
        'jh': '',
        'approachingSurface': null,
        'woh': null,
        'onBottom': null,
        'isRotationOff': null,
        'blockldle': null,
        'noFlow': null,
        'pressureZero': null,
        'bitMovingUp': null,
        'blockMovingUp': null,
        'farBottom': null
      }
    }
  },

  mounted() {
    this.init()

  },
  methods: {
    init() {

      this.isLoading = true

      newWarnApi.getOperatingCondition({ jh:this.jh}).then((res) => {
        if (res.result != null) {
          this.gkcsObj = res.result
        }
      }).finally(() => {
        this.isLoading = false
      })

    },
    submit() {

      this.isLoading = true
      newWarnApi.setOperatingCondition(this.gkcsObj).then(res => {
        this.$notify({
          title: '提示',
          type: 'success',
          message: "保存成功"
        });
        this.init()
      }).catch(()=>{
        this.$notify.error({
          title: '提示',
          message: '保存失败'
        });
      }).finally(() => {
        this.isLoading = false
      })


    },

  }
}
</script>

<style scoped>
.page {
  width: 100%;
  font-size: 12px;
}

.ant-form {
  font-size: 12px;
}

.ant-form label {
  font-size: 12px;
  line-height: 24px;
}

.ant-select {
  font-size: 12px;
}

.group-box {
  border: 1px solid #e8e8e8;
  position: relative;
  margin-top: 15px;
  padding: 15px 0 10px 5px;
}

h4 {
  position: absolute;
  top: -14px;
  padding: 1px 8px;
  margin-left: 16px;
  border-radius: 2px 2px 0 0;
  background: #fff;
  font-size: 14px;
  width: auto;
}

.input-lable {
  display: inline-block;
  width: 70px;
  text-align: right;
}

.el-form-item {
  margin-bottom: 2px;
}
</style>
