<!-- 安全附件分项页面 -->
<template>
  <div class="app-container" style="margin-top: -15px;">
    <sticky style="margin-bottom: 10px;">
      <btn ref="btn" />
    </sticky>
    <el-form ref="ysjl" :model="ysjl" class="el-form" label-position="right" label-width="130px">
      <fieldset>
        <legend>安全阀</legend>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="记录编号" prop="jilubianhao">
              <el-input v-model="ysjl.jilubianhao" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="型号" prop="aqfxinghao">
              <el-input v-model="param.aqfxinghao" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="数量" prop="aqfshuliang">
              <el-input v-model="param.aqfshuliang" :disabled="edit"><template slot="append">台</template></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="校验日期" prop="aqfjianyanriqi">
              <el-input v-model="param.aqfjianyanriqi" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="校验报告编号" prop="aqfjiaoyanbaogaobianhao">
              <el-input v-model="param.aqfjiaoyanbaogaobianhao" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="整定压力" prop="aqfzhengdingyali">
              <el-input v-model="param.aqfzhengdingyali" :disabled="edit"><template slot="append">MPa</template></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="安装位置" prop="aqfanzhuangweizhi">
              <el-input v-model="param.aqfanzhuangweizhi" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
      <fieldset>
        <legend>爆破片装置</legend>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="型号" prop="bppxinghao">
              <el-input v-model="param.bppxinghao" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="数量" prop="bppshuliang">
              <el-input v-model="param.bppshuliang" :disabled="edit"><template slot="append">个</template></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="规格" prop="bppguige">
              <el-input v-model="param.bppguige" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="更换周期要求" prop="bppgenghuanzhouqiyaoqiu">
              <el-input v-model="param.bppgenghuanzhouqiyaoqiu" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="更换日期" prop="bppgenghuariqi">
              <el-input v-model="param.bppgenghuariqi" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="安装位置" prop="bppanzhuangweizhi">
              <el-input v-model="param.bppanzhuangweizhi" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
      <fieldset>
        <legend>压力表</legend>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="量程" prop="ylbliangcheng">
              <el-input v-model="param.ylbliangcheng" :disabled="edit"><template slot="append">MPa</template></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="数量" prop="ylbshuliang">
              <el-input v-model="param.ylbshuliang" :disabled="edit"><template slot="append">个</template></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="精度" prop="ylbjingdu">
              <el-input v-model="param.ylbjingdu" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="检定日期" prop="ylbjiandingriqi">
              <el-input v-model="param.ylbjiandingriqi" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="检定记录编号" prop="ylbjiandingbaogaobianhao">
              <el-input v-model="param.ylbjiandingbaogaobianhao" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="安装位置" prop="ylbanzhuangweizhi">
              <el-input v-model="param.ylbanzhuangweizhi" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
      <fieldset>
        <legend>紧急切断装置</legend>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="型式及规格" prop="jjqdzzxingshiguige">
              <el-input v-model="param.jjqdzzxingshiguige" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="数量" prop="jjqdzzshuliang">
              <el-input v-model="param.jjqdzzshuliang" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="耐压试验压力" prop="jjqdzznaiyashiyanyali">
              <el-input v-model="param.jjqdzznaiyashiyanyali" :disabled="edit"><template slot="append">MPa</template></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="密闭试验压力" prop="jjqdzzmibishiyanyali">
              <el-input v-model="param.jjqdzzmibishiyanyali" :disabled="edit"><template slot="append">MPa</template></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="切断时间" prop="jjqdzzqieduanshijian">
              <el-input v-model="param.jjqdzzqieduanshijian" :disabled="edit"><template slot="append">S</template></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="检修记录" prop="jjqdzzjianxiujilu">
              <el-input v-model="param.jjqdzzjianxiujilu" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="安装位置" prop="jjqdzzanzhuangweizhi">
              <el-input v-model="param.jjqdzzanzhuangweizhi" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="外观" prop="jjqdzzwaiguan">
              <el-input v-model="param.jjqdzzwaiguan" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
      <fieldset>
        <legend>液位（面）计</legend>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="型式" prop="ywjxingshi">
              <el-input v-model="param.ywjxingshi" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="数量" prop="ywjshuliang">
              <el-input v-model="param.ywjshuliang" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="容器充装量" prop="ywjrongqichongzhuangliang">
              <el-input v-model="param.ywjrongqichongzhuangliang" :disabled="edit"><template slot="append">m³</template></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="安装位置" prop="ywjanzhuangweizhi">
              <el-input v-model="param.ywjanzhuangweizhi" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="外观" prop="ywjwaiguan">
              <el-input v-model="param.ywjwaiguan" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="误差" prop="ywjwucha">
              <el-input v-model="param.ywjwucha" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
      <fieldset>
        <legend>测温仪表</legend>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="型号" prop="cwybxinghao">
              <el-input v-model="param.cwybxinghao" :disabled="edit"/>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="有效期" prop="cwybyouxiaoqi">
              <el-input v-model="param.cwybyouxiaoqi" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="外观" prop="cwybwaiguan">
              <el-input v-model="param.cwybwaiguan" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
      <fieldset>
        <legend>气相软管</legend>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="试验压力" prop="qxrgshiyanyali">
              <el-input v-model="param.qxrgshiyanyali" :disabled="edit"><template slot="append">MPa</template></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="试验介质" prop="qxrgshiyanjiezhi">
              <el-input v-model="param.qxrgshiyanjiezhi" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="保压时间" prop="qxrgbaoyashijian">
              <el-input v-model="param.qxrgbaoyashijian" :disabled="edit"><template slot="append">min</template></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
      <fieldset>
        <legend>液相软管</legend>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="试验压力" prop="yxrgshiyanyali">
              <el-input v-model="param.yxrgshiyanyali" :disabled="edit"><template slot="append">MPa</template></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="9">
            <el-form-item label="试验介质" prop="yxrgshiyanjiezhi">
              <el-input v-model="param.yxrgshiyanjiezhi" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="保压时间" prop="yxrgshiyanyali">
              <el-input v-model="param.yxrgbaoyashijian" :disabled="edit"><template slot="append">min</template></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
      <fieldset>
        <legend>检验信息</legend>
        <el-row :gutter="20">
          <el-col :span="18">
            <el-form-item label="其它阀门、附件检验" prop="qitajianyan" label-width="150px">
              <el-input v-model="param.qitajianyan" :disabled="edit"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="18">
            <el-form-item label="检验结果" prop="jianyanjielun">
              <el-select v-model="ysjl.jianyanjielun" :disabled="edit" type="text" placeholder="请选择" value="合格">
                <el-option label="合格" value="合格"/>
                <el-option label="不合格" value="不合格"/>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <el-form-item label="检验日期" prop="jianyanjieshuriqi">
              <el-date-picker v-model="ysjl.jianyanjieshuriqi" :disabled="edit" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 100%;"/>
            </el-form-item>
          </el-col>
        </el-row>
      </fieldset>
    </el-form>
  </div>
</template>
<script>
import Sticky from '@/components/Sticky'
import btn from '@/views/common/FxButton'
export default {
  name: 'RqAqfj',
  components: { Sticky, btn },
  data() {
    return {
      ysjl: {},
      param: {},
      state: '',
      edit: false,
      ysjlId: this.$route.query.id,
      info: {
        ysjlId: this.$route.query.id,
        ysjl: this.ysjl,
        param: this.param,
        jyxm: this.$route.query.jyxm,
        state: this.state
      }
    }
  },
  created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      this.api({
        url: '/fx',
        method: 'get',
        params: {
          ysjlId: this.$route.query.id,
          jyxm: this.$route.query.jyxm
        }
      }).then(data => {
        this.ysjl = data.ysjl
        this.state = 'create'
        if (data.param !== null && data.param !== undefined) {
          // 有无损原始记录参数
          this.state = 'update'
          this.param = data.param
        }
        if (this.ysjl.flowstatus === 4) {
          this.state = 'finish'
          this.edit = true
        }
        this.$refs.btn.getParentInfo(this.ysjl, this.param, null, this.state, this.$route.query.jyxm)
      })
    },
    // 表格单击选中行
    onRowClick(row) {
      this.$refs.tableData.toggleRowSelection(row)
    },
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex
    },
    handleSelectionChange(val) {
      this.delRowIndex = []
      for (let i = 0; i < val.length; i++) {
        this.delRowIndex.push(val[i].index)
      }
    },
    beforeSaveBuildData() {
      // TODO
    }
  }
}
</script>
