<!--002压力管道监督检验报告-->
<template>
  <div class="app-container" style="margin-top: -15px;">
    <sticky style="margin-bottom: 10px;">
      <div class="sub-navbar">
        <el-button v-if="state === 'create'" type="success" icon="el-icon-edit" size="medium" @click="saveYsjl('add')">
          保存
        </el-button>
        <el-button v-if="state === 'update'" type="primary" icon="el-icon-edit" size="medium" @click="saveYsjl('upd')">
          更新
        </el-button>
        <el-button v-if="state === 'update'" type="primary" icon="el-icon-circle-check-outline" size="medium" @click="toAddJyfa">
          添加检验方案
        </el-button>
        <el-button v-if="state !== 'create'" type="info" icon="el-icon-info" size="medium" @click="getJyfaInfo">
          查看同类报告
        </el-button>
        <el-button v-if="state !== 'create'" type="warning" icon="el-icon-view" size="medium" @click="common.viewYsjl(ysjl.id, 'JYBG')">
          预览报告
        </el-button>
        <el-button v-if="state !== 'create'" type="warning" icon="el-icon-view" size="medium" @click="common.viewYsjl(ysjl.id, 'ZS')">
          预览证书
        </el-button>
      </div>
    </sticky>
    <el-tabs v-model="checkedTab" type="card">
      <el-tab-pane label="压力管道安装安全质量监督检验结论报告" name="first">
        <el-form ref="ysjl" :model="ysjl" class="el-form" label-position="right" label-width="130px">
          <fieldset>
            <legend>基本信息</legend>
            <el-row :gutter="25">
              <el-col v-if="state === 'create'" :span="14">
                <el-form-item label="报告编号">
                  <el-input v-model="jlbh1" style="width:80px" disabled />
                  <el-input v-model="jlbh2" style="width:80px" disabled />
                  <el-input v-model="jlbh3" style="width:80px" disabled />-
                  <el-input v-model="jlbh4" style="width:85px" @blur="judgeRepeat(jlbh1 + jlbh2 + jlbh3 + '-' + jlbh4 + jlbh5 , ysjl.id)" />
                  <el-input v-model="jlbh5" style="width:70px" disabled />
                </el-form-item>
              </el-col>
              <el-col v-if="state !== 'create'" :span="9">
                <el-form-item label="报告编号" prop="baogaobianhao">
                  <el-input v-if="state !== 'create'" v-model="ysjl.baogaobianhao" :disabled="edit" />
                </el-form-item>
              </el-col>
              <el-col v-if="isRepeat" :span="2" style="vertical-align: middle;padding-top: 3px;font-size: 15px;">
                <span style="color:red">编号重复</span>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="18">
                <el-form-item label="监督检验单位" prop="gonghuodanwei">
                  <el-input v-model="param.gonghuodanwei" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="工程名称" prop="gongchengmingcheng">
                  <el-input v-model="param.gongchengmingcheng" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="规划许可证" prop="guihuaxukezheng">
                  <el-input v-model="param.guihuaxukezheng" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="工程地址" prop="gongchengdizhi">
                  <el-input v-model="param.gongchengdizhi" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="建设单位" prop="shiyongdanwei">
                  <el-input v-model="ysjl.shiyongdanwei" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="设计单位" prop="shejidanwei">
                  <el-input v-model="ysjl.shejidanwei" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="设计证编号" prop="shejixukezhengbianhao">
                  <el-input v-model="ysjl.shejixukezhengbianhao" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="安装单位" prop="shigongdanwei">
                  <el-input v-model="ysjl.shigongdanwei" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="安装许可证编号" prop="shigongxukezheng">
                  <el-input v-model="ysjl.shigongxukezheng" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="防腐单位" prop="fangfushigongdanwei">
                  <el-input v-model="param.fangfushigongdanwei" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="防腐资质证编号" prop="fangfuzizhizhengshu">
                  <el-input v-model="param.fangfuzizhizhengshu" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="监理单位" prop="jianlidanwei">
                  <el-input v-model="param.jianlidanwei" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="监理资质证书号" prop="jianlizizhizhengshu">
                  <el-input v-model="param.jianlizizhizhengshu" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="检测单位" prop="jiancedanwei">
                  <el-input v-model="param.jiancedanwei" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="检测资质证书号" prop="jiancezizhizhenghao">
                  <el-input v-model="param.jiancezizhizhenghao" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="输送介质" prop="shusongjiezhi">
                  <el-input v-model="param.shusongjiezhi" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="设计压力" prop="shejiyali">
                  <el-input v-model="param.shejiyali" type="text">
                    <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="gongchengguimo">
                  <el-input v-model="param.gongchengguimo" type="text">
                    <template slot="append">
                      米
                    </template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="管道级别" prop="guandaojibie">
                  <el-input v-model="param.guandaojibie" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="开工时间" prop="kaigongshijian">
                  <el-date-picker v-model="param.kaigongshijian" type="date" placeholder="选择日期" style="width: 100%;" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="竣工时间" prop="jungongshijian">
                  <el-date-picker v-model="param.jungongshijian" type="date" placeholder="选择日期" style="width: 100%;" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="监检开始日期" prop="jianyankaishiriqi">
                  <el-date-picker v-model="ysjl.jianyankaishiriqi" type="date" style="width: 100%;" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="监检结束日期" prop="jianyanjieshuriqi">
                  <el-date-picker v-model="ysjl.jianyanjieshuriqi" type="date" style="width: 100%;" />
                </el-form-item>
              </el-col>
            </el-row>
          </fieldset>
          <fieldset>
            <legend>监督检验结论</legend>
            <el-row :gutter="20" style="text-align:left;margin-left: 50px;font-size: 18px;color: #606266;line-height: 40px;font-weight: bolder;">
              根据《中华人民共和国特种设备安全法》和《压力管道安装安全质量监督检验规则》的规定，依据
              <el-select v-model="biaozhunyaoqiu" style="width: 550px; margin-bottom: 20px" @change="bzyqChange">
                <el-option label="《中华人民共和国特种设备安全法》" value="《中华人民共和国特种设备安全法》" />
                <el-option label="GB50235-2010《工业金属管道工程施工规范》" value="GB50235-2010《工业金属管道工程施工规范》" />
                <el-option label="SBJ14-2007《氢氯氟烃、氢氟烃类制冷系统安装工程施工及验收规范》" value="SBJ14-2007《氢氯氟烃、氢氟烃类制冷系统安装工程施工及验收规范》" />
                <el-option label="GB50184-2011《工业金属管道工程施工质量验收规范》" value="GB50184-2011《工业金属管道工程施工质量验收规范》" />
                <el-option label="SBJ12-2011《氨制冷系统安装工程施工及验收规范》" value="SBJ12-2011《氨制冷系统安装工程施工及验收规范》" />
                <el-option label="设计文件" value="设计文件" />
              </el-select>
              <el-input
                v-model="param.biaozhunyaoqiu"
                :rows="5"
                style="width: 550px"
                type="textarea"
              /> 等标准要求，经过监督检验，该压力管道安全安装质量
              <el-select v-model="ysjl.jianyanjielun" size="small" placeholder="请选择" style="width: 160px;">
                <el-option label="符合规范要求" value="符合规范要求" />
                <el-option label="不符合规范要求" value="不符合规范要求" />
              </el-select>。
            </el-row><br>
            <el-row :gutter="20" style="margin-left:5px">
              <el-col :span="9">
                <el-form-item label="下次检验日期" prop="xiacijianyanriqi">
                  <el-date-picker v-model="ysjl.xiacijianyanriqi" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="证书编号" prop="zhengshubianhao">
                  <el-input v-model="param.zhengshubianhao" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10" style="margin-left:10px">
              <el-col :span="9">
                <el-form-item label="检验人员" prop="jianyanrenyuan">
                  <el-input v-model="jianyanrenyuan" disabled />
                  <el-input v-show="false" v-model="ysjl.jianyanrenyuan" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <sign-name :jianyanrenyuan="jianyanrenyuan" :ysjl="ysjl" @setSignValue="singNameValue" />
              </el-col>
            </el-row><br><br>
          </fieldset>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="监督检验的压力管道基本情况" name="second">
        <el-form ref="ysjl" :model="ysjl" class="el-form" label-position="right" label-width="130px">
          <fieldset style="height: 560px">
            <legend>基本情况</legend>
            <el-row style="text-align:left;margin-left: 50px;font-size: 18px;color: #606266;line-height: 40px;font-weight: bolder;">
              <el-col :span="18">
                <el-form-item label="工程名称" prop="gongchengmingcheng">
                  <el-input v-model="param.gongchengmingcheng" :disabled="true" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row style="text-align:left;margin-left: 50px;font-size: 18px;color: #606266;line-height: 40px;font-weight: bolder;">
              <el-col :span="18">
                <el-form-item label="工程简介" prop="gongchengjianjie">
                  <el-input v-model="param.gongchengjianjie" type="textarea" :rows="18" />
                </el-form-item>
              </el-col>
            </el-row>
          </fieldset>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="监督检验工作内容及工作情况" name="third">
        <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="18">
                <el-form-item label="一、监督检验依据" prop="">
                  <el-select v-model="jianyanyiju" style="width: 550px;" @change="zlscChange">
                    <el-option label="1.《中华人民共和国特种设备安全法》" value="1.《中华人民共和国特种设备安全法》" />
                    <el-option label="2.《压力管道安装质量监督检验规则》" value="2.《压力管道安装质量监督检验规则》" />
                    <el-option label="3.GB50235-2010《工业金属管道工程施工规范》" value="3.GB50235-2010《工业金属管道工程施工规范》" />
                    <el-option label="4.GB/T20801-2006《压力管道规范 工业管道》" value="4.GB/T20801-2006《压力管道规范 工业管道》" />
                    <el-option label="5.TSG D0001-2009《压力管道安全技术监察规程-工业管道》" value="5.TSG D0001-2009《压力管道安全技术监察规程-工业管道》" />
                    <el-option label="6.SBJ14-2007《氢氯氟氟烃、氢氟烃类制冷系统安装工程施工及验收规范》" value="6.SBJ14-2007《氢氯氟氟烃、氢氟烃类制冷系统安装工程施工及验收规范》" />
                    <el-option label="7.GB50184-2011《工业金属管道工程施工质量验收规范》" value="7.GB50184-2011《工业金属管道工程施工质量验收规范》" />
                    <el-option label="8.SBJ12-2011《氨制冷系统安装工程施工及验收规范》" value="8.SBJ12-2011《氨制冷系统安装工程施工及验收规范》" />
                    <el-option label="9.设计文件" value="9.设计文件" />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20" style="height: 200px">
              <el-col :span="22">
                <el-form-item label="" prop="jianyanyiju">
                  <el-input
                    v-model="ysjl.jianyanyiju"
                    :rows="10"
                    type="textarea"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row style="text-align:left;margin-left: 50px;margin-top: 150px;font-size: 18px;color: #606266;line-height: 40px;font-weight: bolder;">
              <el-col :span="18">
                <el-form-item label="二、监督检验内容" prop="" />
              </el-col>
            </el-row>
            <el-row style="text-align:left;margin-left: 85px;font-size: 14px;color: #606266;line-height: 40px;">
              1、对
              <el-select v-model="param.qita1" multiple filterable style="width: 500px;">
                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
              在本工程安装实施过程中的单位资质及应当履行的手续进行<br>核实；对安全质量管理行为及设计资料进行抽查、验证。
            </el-row>
            <el-row style="text-align:left;margin-left: 85px;font-size: 14px;color: #606266;line-height: 40px;">
              <el-col>
                <el-input v-model="param.qita2" :disabled="edit" type="text" />
              </el-col>
            </el-row>
            <el-row style="text-align:left;margin-left: 85px;font-size: 14px;color: #606266;line-height: 40px;">
              <el-col>
                <el-input v-model="param.jianyangongzuofanwei" :disabled="edit" type="text" />
              </el-col>
            </el-row>
            <el-row style="text-align:left;margin-left: 85px;font-size: 14px;color: #606266;line-height: 40px;">
              <el-col>
                <el-input v-model="param.shuoming" :disabled="edit" type="text" />
              </el-col>
            </el-row>
          </fieldset>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="压力管道安装监督检验证书" name="fourth">
        <el-form ref="ysjl" :model="ysjl" class="el-form" label-position="right" label-width="130px">
          <fieldset>
            <legend>基本信息</legend>
            <el-row :gutter="25">
              <el-col v-if="state === 'create'" :span="14">
                <el-form-item label="报告编号">
                  <el-input v-model="jlbh1" style="width:80px" disabled />
                  <el-input v-model="jlbh2" style="width:80px" disabled />
                  <el-input v-model="jlbh3" style="width:80px" disabled />-
                  <el-input v-model="jlbh4" style="width:85px" @blur="judgeRepeat(jlbh1 + jlbh2 + jlbh3 + '-' + jlbh4 + jlbh5 , ysjl.id)" />
                  <el-input v-model="jlbh5" style="width:70px" disabled />
                </el-form-item>
              </el-col>
              <el-col v-if="state !== 'create'" :span="9">
                <el-form-item label="报告编号" prop="baogaobianhao">
                  <el-input v-if="state !== 'create'" v-model="ysjl.baogaobianhao" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col v-if="isRepeat" :span="2" style="vertical-align: middle;padding-top: 3px;font-size: 15px;">
                <span style="color:red">编号重复</span>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="18">
                <el-form-item label="安装单位" prop="shigongdanwei">
                  <el-input v-model="ysjl.shigongdanwei" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="安装许可证编号" prop="shigongxukezheng">
                  <el-input v-model="ysjl.shigongxukezheng" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="工程规模" prop="gongchengguimo">
                  <el-input v-model="param.gongchengguimo" type="text" :disabled="true">
                    <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="guandaojibie">
                  <el-input v-model="param.guandaojibie" type="text" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="18">
                <el-form-item label="使用单位" prop="shiyongdanwei">
                  <el-input v-model="ysjl.shiyongdanwei" type="text" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="使用单位代码" prop="shiyongdanweiCode">
                  <el-input v-model="ysjl.shiyongdanweiCode" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="使用单位地址" prop="shiyongdanweiDizhi">
                  <el-input v-model="ysjl.shiyongdanweiDizhi" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="邮政编码" prop="shiyongdanweiYoubian">
                  <el-input v-model="ysjl.shiyongdanweiYoubian" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="工程名称" prop="gongchengmingcheng">
                  <el-input v-model="param.gongchengmingcheng" type="text" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="工程地址" prop="gongchengdizhi">
                  <el-input v-model="param.gongchengdizhi" type="text" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="18">
                <el-form-item label="设计单位" prop="shejidanwei">
                  <el-input v-model="ysjl.shejidanwei" type="text" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="18">
                <el-form-item label="制造单位" prop="zhizaodanwei">
                  <el-input v-model="ysjl.zhizaodanwei" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="设计压力" prop="shejiyali">
                  <el-input v-model="param.shejiyali" type="text" :disabled="true">
                    <template slot="append">
                      MPa
                    </template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="输送介质" prop="shusongjiezhi">
                  <el-input v-model="param.shusongjiezhi" type="text" :disabled="true" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="开工时间" prop="kaigongshijian">
                  <el-date-picker v-model="param.kaigongshijian" disabled type="date" placeholder="选择日期" style="width: 100%;" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="竣工时间" prop="jungongshijian">
                  <el-date-picker v-model="param.jungongshijian" disabled type="date" placeholder="选择日期" style="width: 100%;" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="防腐施工单位" prop="fangfushigongdanwei">
                  <el-input v-model="param.fangfushigongdanwei" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="检测单位" prop="jiancedanwei">
                  <el-input v-model="param.jiancedanwei" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="9">
                <el-form-item label="强度试验压力" prop="qiangdushiyanyali">
                  <el-input v-model="param.qiangdushiyanyali" :disabled="edit">
                    <template slot="append">
                      MPa
                    </template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="严密性试验压力" prop="yanmixingshiyanyali">
                  <el-input v-model="param.yanmixingshiyanyali" :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="guandaoanzhuangqingkuang">
                  <el-select v-model="param.guandaoanzhuangqingkuang" type="text" placeholder="请选择" style="width:232px">
                    <el-option label="新建" value="新建" />
                    <el-option label="扩建" value="扩建" />
                    <el-option label="改建" value="改建" />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </fieldset>
          <fieldset>
            <legend>检验信息</legend>
            <el-row :gutter="20" style="text-align:left;margin-left: 50px;font-size: 18px;color: #606266;line-height: 40px;font-weight: bolder;">
              按照《中华人民共和国特种设备安全法》、《压力管道安装质量监督检验规则》及有关安全技术规范的规定，经我机构监督检验，该压力管道安装安全质量监督检验
              <el-select v-model="ysjl.jianyanjielun" size="small" :disabled="true" style="width: 150px;">
                <el-option label="符合规范要求" value="符合规范要求" />
                <el-option label="不符合规范要求" value="不符合规范要求" />
              </el-select>,特发此证书。<br>
              安全状况等级为
              <el-select v-model="ysjl.anquanzhuangkuangdengji" size="small" style="width:120px">
                <el-option label="1级" value="1级" />
                <el-option label="2级" value="2级" />
                <el-option label="3级" value="3级" />
                <el-option label="4级" value="4级" />
                <el-option label="5级" value="5级" />
                <el-option label="-" value="-" />
              </el-select>
            </el-row>
            <el-row :gutter="20" style="margin-top: 20px;">
              <el-col :span="9">
                <el-form-item label="监检开始日期" prop="jianyankaishiriqi">
                  <el-date-picker v-model="ysjl.jianyankaishiriqi" :disabled="true" type="date" value-format="yyyy-MM-dd" style="width: 100%;" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <el-form-item label="监检结束日期" prop="jianyanjieshuriqi">
                  <el-date-picker v-model="ysjl.jianyanjieshuriqi" :disabled="true" type="date" value-format="yyyy-MM-dd" style="width: 100%;" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="10">
              <el-col :span="9">
                <el-form-item label="检验人员" prop="jianyanrenyuan">
                  <el-input v-model="jianyanrenyuan" disabled />
                  <el-input v-show="false" v-model="ysjl.jianyanrenyuan" :disabled="true" />
                </el-form-item>
              </el-col>
              <el-col :span="9">
                <sign-name :jianyanrenyuan="jianyanrenyuan" :ysjl="ysjl" :disabled="true" @setSignValue="singNameValue" />
              </el-col>
            </el-row>
          </fieldset>
        </el-form><br>
      </el-tab-pane>
    </el-tabs>
    <el-dialog :visible.sync="jyfaDialogVisible" title="添加检验方案" width="600px" @close="closeJyfaDialog">
      <jyfa ref="jyfa" :info="info" />
    </el-dialog>
    <el-dialog :visible.sync="similarVisible" title="同类报告查看" width="800px" @close="closeJyfaDialog">
      <el-table ref="similarTable" :data="similarTableData" border style="width: 100%;" height="350">
        <el-table-column align="center" label="报告类型" prop="bglx" min-width="50" />
        <el-table-column align="left" label="检验项目" prop="jyxmLabel" width="200">
          <template slot-scope="scope">
            <div style="text-decoration:underline;cursor:pointer;" @click="editChild(scope.row.id, scope.row.jianyanxiangmu, departmentId)">
              {{ scope.row.jyxmLabel }}
            </div>
          </template>
        </el-table-column>
        <el-table-column align="center" label="处理人" prop="renlingren" min-width="40" />
        <el-table-column align="center" label="检验人员" prop="jianyanrenyuan" min-width="40" />
        <el-table-column align="center" label="办结状态" prop="flowstatus" min-width="30">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.flowstatus==='未办结'" type="danger">
              未办结
            </el-tag>
            <el-tag v-if="scope.row.flowstatus==='已办结'" type="success">
              已办结
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column property="" label="操作" align="center" width="95">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" title="删除检验方案" circle icon="el-icon-delete" @click="delYsjl(scope.row.jyxmLabel, scope.row.bglx, scope.row.id)" />
            <el-button v-if="scope.row.bglx ==='分项检测' && scope.row.flowstatus === '未办结'" type="primary" size="mini" title="办结" circle icon="el-icon-check" @click="bjYsjl(scope.row.id, '1')" />
            <el-button v-if="scope.row.bglx ==='分项检测' && scope.row.flowstatus === '已办结'" type="primary" size="mini" title="取消办结" circle icon="el-icon-close" @click="bjYsjl(scope.row.id, '0')" />
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>
<script>
import Sticky from '@/components/Sticky'
import SignName from '@/views/common/SignName'
import Utils from '../../../../utils/contact.js'
import jyfa from '@/views/ysjl/addJyfa'
export default {
  name: 'YlgdAzjjReport',
  components: { SignName, Sticky, jyfa },
  data() {
    return {
      jlbh1: 'WH',
      jlbh2: 'GYJ',
      jlbh3: new Date().getFullYear(),
      jlbh4: '',
      jlbh5: '',
      ysjl: this.$route.query.ysjl,
      defaultParam: {
        qita1: ['设计单位', '建设单位', '安装单位', '监理单位', '检测单位']
      },
      param: (this.$route.query.param === null || this.$route.query.param === undefined) ? Object.assign({}, this.defaultParam) : this.$route.query.param,
      state: this.$route.params.state,
      jianyanrenyuan: '',
      departmentId: this.$route.query.ysjl.departmentId,
      isRepeat: false,
      edit: false,
      // 检验方案
      jyfaDialogVisible: false,
      checkedTab: 'first',
      value: '',
      jianyanyiju: '',
      info: {
        modelId: this.$route.query.ysjl.modelId,
        sbzldm: this.$route.query.ysjl.shebeizhongleidaima,
        ysjlId: this.$route.query.ysjl.id,
        departmentId: this.$route.query.ysjl.departmentId,
        jylb: this.$route.query.ysjl.jianyanleibie,
        nblb: this.$route.query.ysjl.neibuleibie,
        type: 'JYBG'
      },
      options: [{
        value: '设计单位',
        label: '设计单位'
      }, {
        value: '建设单位',
        label: '建设单位'
      }, {
        value: '安装单位',
        label: '安装单位'
      }, {
        value: '监理单位',
        label: '监理单位'
      }, {
        value: '检测单位',
        label: '检测单位'
      }],
      similarVisible: false,
      similarTableData: [],
      biaozhunyaoqiu: ''
    }
  },
  computed: {
    baogaobianhao: function() {
      if (this.state !== 'create') {
        return this.ysjl.baogaobianhao
      }
      return this.jlbh1 + this.jlbh2 + this.jlbh3 + '-' + this.jlbh4 + this.jlbh5
    }
  },
  watch: {
    baogaobianhao: function(newValue) {
      this.judgeRepeat(newValue, this.ysjl.id)
    }
  },
  created() {
    if (this.state === 'create') {
      const tempTime = new Date()
      this.ysjl.createTime = tempTime
      this.ysjl.createBy = this.$store.getters.nickname
      this.$set(this.ysjl, 'jianyankaishiriqi', this.dateFormat(new Date()))
      this.$set(this.ysjl, 'jianyanjieshuriqi', this.dateFormat(new Date()))
      this.$set(this.ysjl, 'source', 'web')
      this.$set(this.param, 'gonghuodanwei', '威海市特种设备检验研究院')
      this.$set(this.param, 'qita1', ['设计单位', '建设单位', '安装单位', '监理单位', '检测单位'])
      this.$set(this.param, 'qita2', '2、安装单位在本工程的施工过程中，按照《压力管道安装质量体系运行情况检查表》监督检查。')
      this.$set(this.param, 'jianyangongzuofanwei', '3、对压力管道安装过程中涉及压力管道安装质量的项目，按照《压力管道安装安全质量检查项目表》进行监督验证。')
      this.$set(this.param, 'shuoming', '4、监检过程中抽查了       个焊口的射线底片，共计       张。抽查比例为        。')
      this.getDepartmentCode()
    } else {
      this.judgeRepeat(this.ysjl.baogaobianhao, this.ysjl.id)
      // 把检验依据中的'\n\r'替换为'\n'
      if (this.ysjl.jianyanyiju !== null && this.ysjl.jianyanyiju !== '' && this.ysjl.jianyanyiju !== undefined) {
        this.ysjl.jianyanyiju = this.ysjl.jianyanyiju.replace(/\n\r/g, '\n')
      }
    }
    if (this.ysjl.id !== null && this.ysjl.id !== undefined) {
      // 根据原始记录id查询参数
      this.api({
        url: '/ysjl/getParamByYsjlId',
        method: 'get',
        params: {
          ysjlId: this.ysjl.id,
          sbzldm: this.ysjl.shebeizhongleidaima
        }
      }).then(data => {
        this.param = data
        if (this.param.qita1 !== null && this.param.qita1 !== undefined && this.param.qita1 !== '') {
          const qita1 = this.param.qita1.split('、')
          this.param.qita1 = JSON.parse(JSON.stringify(qita1))
        }
      })
    }
    this.$nextTick(() => {
      if (this.ysjl.jianyanrenyuan !== null && this.ysjl.jianyanrenyuan !== undefined && this.ysjl.jianyanrenyuan.length > 0) {
        this.jianyanrenyuan = this.common.convertCnName(this.ysjl.jianyanrenyuan)
      }
    })
  },
  methods: {
    // 签名方法
    singNameValue(data) {
      this.jianyanrenyuan = data.name
      this.ysjl.jianyanrenyuan = data.id
      if (this.state !== 'create') {
        this.common.signName(this.ysjl.id, this.ysjl.jianyanrenyuan)
      }
    },
    dateFormat() {
      const year = new Date().getFullYear()
      const month = new Date().getMonth() + 1 > 9 ? (new Date().getMonth() + 1).toString() : '0' + (new Date().getMonth() + 1)
      const day = new Date().getDate() > 9 ? new Date().getDate().toString() : '0' + new Date().getDate()
      return year + '-' + month + '-' + day
    },
    // 查询部门代码
    getDepartmentCode() {
      this.api({
        url: '/department/gainCurrentDepartmentCode',
        method: 'get',
        params: {
          depId: this.$store.getters.departmentId
        }
      }).then(data => {
        this.jlbh5 = data
        this.getMaxBh()
      })
    },
    // 查询最大记录编号
    getMaxBh() {
      const aheadPart = this.jlbh1 + '' + this.jlbh2 + '' + this.jlbh3
      this.api({
        url: '/ysjl/gainCurrentBh',
        method: 'get',
        params: {
          aheadPart: aheadPart + '-',
          hinderPart: this.jlbh5
        }
      }).then(data => {
        this.jlbh4 = data
      })
    },
    saveYsjl: function(operation) {
      if (operation === 'add') {
        if (this.jlbh4.trim() === '') {
          this.$message({ message: '请先确认报告编号是否完整！', type: 'warning' })
          return false
        }
      }
      let url = ''
      this.ysjl.bglx = 1
      this.ysjl.cjState = 'bggl'
      this.ysjl.zfState = '0'
      this.ysjl.jianyanxiangmu = 'azjj'
      this.ysjl.jlprintState = 0
      this.ysjl.flowstatus = 1
      this.ysjl.jigouhezhunzhenghao = 'TS7110433-2024'
      // 检验依据添加'\n\r'来换行
      if (this.ysjl.jianyanyiju !== null && this.ysjl.jianyanyiju !== '' && this.ysjl.jianyanyiju !== undefined) {
        this.ysjl.jianyanyiju = this.ysjl.jianyanyiju.replace(/\n/g, '\n\r')
      }
      let qita1 = ''
      for (let i = 0; i < this.param.qita1.length; i++) {
        qita1 += this.param.qita1[i] + '、'
      }
      this.param.qita1 = qita1.substring(0, qita1.length - 1)
      if (operation === 'add') {
        url = '/ysjl/saveYsjl'
        this.ysjl.baogaobianhao = this.jlbh1 + this.jlbh2 + this.jlbh3 + '-' + this.jlbh4 + this.jlbh5
      } else if (operation === 'upd') {
        url = '/ysjl/updateYsjl'
      }
      if (this.isRepeat) {
        this.$message({ message: '报告编号重复，请先修改报告编号再保存', type: 'error' })
        return false
      } else if (this.common.judgeBianhao(this.ysjl.baogaobianhao) === 0) {
        this.$message({ message: '报告编号中包含中文,不符合编号规则', type: 'error' })
        return false
      } else {
        this.$refs['ysjl'].validate(valid => {
          if (valid) {
            this.api({
              url: url,
              method: 'post',
              data: {
                ysjl: this.ysjl,
                param: this.param,
                flag: operation
              }
            }).then(data => {
              Utils.$emit('bggl-daiban-list')
              if (this.ysjl.jianyanyiju !== null && this.ysjl.jianyanyiju !== '' && this.ysjl.jianyanyiju !== undefined) {
                this.ysjl.jianyanyiju = this.ysjl.jianyanyiju.replace(/\n\r/g, '\n')
              }
              if (operation === 'add' && data !== '') {
                Utils.$emit('task-list')
                this.$message({ message: '保存成功', type: 'success' })
                this.ysjl.id = data
                this.info.ysjlId = this.ysjl.id
                this.param.ysjlId = data
                if (this.param.qita1 !== null && this.param.qita1 !== undefined && this.param.qita1 !== '') {
                  this.param.qita1 = JSON.parse(JSON.stringify(this.param.qita1.split('、')))
                }
              } else if (operation === 'upd') {
                this.$message({ message: '更新成功', type: 'success' })
                if (this.param.qita1 !== null && this.param.qita1 !== undefined && this.param.qita1 !== '') {
                  this.param.qita1 = JSON.parse(JSON.stringify(this.param.qita1.split('、')))
                }
              }
              this.state = 'update'
            }).catch(() => {
              if (this.param.qita1 !== null && this.param.qita1 !== undefined && this.param.qita1 !== '') {
                this.param.qita1 = JSON.parse(JSON.stringify(this.param.qita1.split('、')))
              }
            })
          }
        })
      }
    },
    zlscChange(val) {
      this.ysjl.jianyanyiju = (this.ysjl.jianyanyiju === undefined || this.ysjl.jianyanyiju === null || this.ysjl.jianyanyiju === '') ? val : this.ysjl.jianyanyiju + '\n' + '    ' + val
    },
    bzyqChange(val) {
      this.param.biaozhunyaoqiu = (this.param.biaozhunyaoqiu === undefined || this.param.biaozhunyaoqiu === null || this.param.biaozhunyaoqiu === '') ? val : this.param.biaozhunyaoqiu + '、' + val
    },
    judgeRepeat(bianhao, id) {
      this.api({
        url: '/ysjl/judgeRepeat',
        method: 'get',
        params: {
          ysjlId: id,
          bianhao: bianhao
        }
      }).then(data => {
        if (data > 0) {
          this.isRepeat = true
        } else {
          this.isRepeat = false
        }
      })
    },
    toAddJyfa() {
      this.jyfaDialogVisible = true
    },
    // 查询同类报告
    getJyfaInfo() {
      this.api({
        url: '/ysjl/getJyfaInfo',
        method: 'get',
        params: {
          ysjlId: this.ysjl.id
        }
      }).then(data => {
        this.similarTableData = data
        this.similarVisible = true
      })
    },
    closeJyfaDialog() {
      this.jyfaDialogVisible = false
    },
    // 删除检验方案
    delYsjl(jianyanxiangmu, bglx, ysjlId) {
      this.$confirm('原始记录删除后将无法恢复，是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.api({
          url: '/ysjl/delJyfa',
          method: 'get',
          params: {
            ysjlId: ysjlId,
            bglx: bglx,
            jianyanxiangmu: jianyanxiangmu
          }
        }).then(() => {
          Utils.$emit('modifyMajorInspectionItemBySub')
          this.$message({ message: '删除成功', type: 'success' })
          this.getJyfaInfo()
          this.$refs.jyfa.getJyfaInfo()
        })
      }).catch(e => {
        this.$message({ message: '删除失败:' + e, type: 'error' })
      })
    },
    // 办结分项原始记录 status：0：取消办结，1：办结
    bjYsjl(ysjlId, status) {
      this.api({
        url: '/fenxiang/endFx',
        method: 'get',
        params: {
          ysjlId: ysjlId,
          status: status
        }
      }).then(() => {
        this.getJyfaInfo()
        if (status === '0') {
          this.$message({ message: '取消办结成功', type: 'success' })
        } else if (status === '1') {
          this.$message({ message: '办结成功', type: 'success' })
        }
      })
    },
    editChild(id, jianyanxiangmu, departmentId) {
      this.$router.push({ path: '/bggl/' + this.ysjl.shebeizhongleidaima + '/jd/' + jianyanxiangmu, query: { id: id, jyxm: jianyanxiangmu, departmentId: departmentId }})
      this.similarVisible = false
    }
  }
}
</script>
<style>
  .el-input.is-disabled .el-input__inner {
    color: #606266;
  }
  .el-textarea.is-disabled .el-textarea__inner {
    color: #606266;
  }
</style>
