<!--对安装单位安全质量管理行为的评价-->
<template>
  <div class="app-container" style="margin-top: -15px;height: 100%">
    <sticky style="margin-bottom: 10px;">
      <btn ref="btn" />
    </sticky>
    <el-form ref="ysjl" :model="ysjl" class="el-form" label-width="100px" style="height: max-content">
      <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-row>
      <el-table :data="tableData" border style="width: 100%;">
        <el-table-column type="index" label="序号" width="50" align="center" :resizable="false" />
        <el-table-column prop="jianyanneirong" label="监督检验内容" width="450" align="center" :resizable="false" />
        <el-table-column prop="jianyanjieguo" label="监督检验结果" width="350" align="center" :resizable="false">
          <template slot-scope="scope">
            <el-select v-model="scope.row.jianyanjieguo" :disabled="edit">
              <el-option label="是" value="是" />
              <el-option label="否" value="否" />
            </el-select>
          </template>
        </el-table-column>
        <el-table-column prop="beizhu" label="备注" width="350" align="center" :resizable="false">
          <template slot-scope="scope">
            <el-input v-model="scope.row.beizhu" :disabled="edit" placeholder="请输入备注" />
          </template>
        </el-table-column>
      </el-table>
      <el-row style="font-size: 18px;margin-top: 30px;color: #606266;line-height: 40px;font-weight: bolder;width: 75%">
        <el-form-item label="综合评价：" prop="zonghepingjia">
          <el-input v-model="param.zonghepingjia" type="textarea" :rows="6" />
        </el-form-item>
      </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="选择日期" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
import Sticky from '@/components/Sticky'
import btn from '@/views/common/FxButton'
export default {
  name: 'YlgdAzdwReport',
  components: { Sticky, btn },
  data() {
    return {
      ysjl: {},
      param: {},
      ysjlId: this.$route.query.id,
      multipleSelection: [],
      selected: {},
      defaultParam: {},
      state: '',
      edit: false,
      tableData: []
    }
  },
  created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
      this.api({
        url: '/fenxiang/getFxByYsjlId',
        method: 'get',
        params: {
          ysjlId: this.$route.query.id,
          jyxm: this.$route.query.jyxm
        }
      }).then(data => {
        this.ysjl = data.ysjl
        this.state = 'create'
        if (this.state === 'create') {
          const pingjia = '安装单位在本工程的施工过程中，能够遵守相关的法令、法规的要求，执行施工和验收规范，' +
            '建立了适宜的压力管道安装质量体系，并能有效的实施，施工安全质量符合设计文件及有关标准要求。'
          this.$set(this.param, 'zonghepingjia', pingjia)
        }
        if (data.param !== null && data.param !== undefined) {
          // 有无损原始记录参数
          this.state = 'update'
          this.param = data.param
          this.tableData = JSON.parse(this.param.fubiao)
        } else {
          this.getJyxm()
        }
        if (this.ysjl.flowstatus === 4) {
          this.state = 'finish'
          this.edit = true
        }
        this.$refs.btn.getParentInfo(this.ysjl, this.param, null, this.tableData, this.state, this.$route.query.jyxm)
      })
    },
    getJyxm() {
      // 查询检验项目
      this.api({
        url: '/jyxm/getCyJyxm',
        method: 'get',
        params: {
          templateId: this.ysjl.modelId,
          order: 1
        }
      }).then(data => {
        this.tableData = data
        this.$refs.btn.getParentInfo(this.ysjl, this.param, null, this.tableData, this.state, this.$route.query.jyxm)
      })
    }
  }
}
</script>

