<template>
  <!-- 详情 -->
  <div v-show="open">
    <div class="detail-container">
      <div class="detail-top">
        <div class="left-top">
          <img src="@/assets/images/back.png" @click="cancel()" />
          <div class="left-title"></div>
        </div>
        <div class="right-top">
          {{$t('page.business.study.study.detail')}}
        </div>
      </div>
      <!-- <div class="detail-title"><img src="@/assets/images/detail-title.png" >{{ $t('page.business.study.study.mjyxq') }}<img src="@/assets/images/detail-title.png" /></div> -->
      <div class="detail-content">
        <div class="content-left">
          <div class="content-title">
            <div class="line"></div>
            <div class="subtitle"> {{ $t('page.business.study.study.jbxx') }}</div>
          </div>
          <div class="pal">
            <div class="left">
              <div class="left-title">{{ $t('page.business.study.study.name') }}</div>
              <el-input type="text" :value="form.name" maxlength="50" disabled />
            </div>
            <div class="right">
              <div class="right-title">{{ $t('page.business.study.study.sn') }}</div>
              <el-input type="text" :value="form.sn" maxlength="50" disabled />
            </div>
          </div>
          <div class="pal">
            <div class="left">
              <div class="left-title">{{ $t('page.business.study.study.bdsl') }}</div>
              <el-input type="text" :value="form.formCount" maxlength="50" disabled />
            </div>
            <div class="right">
              <div class="right-title">{{ $t('page.business.study.study.syfzr') }}</div>
              <el-input type="text" :value="form.leaderName" maxlength="50" disabled />
            </div>
          </div>
          <div class="pal">
            <div class="left">
              <div class="left-title">{{ $t('page.business.study.study.createDate') }}</div>
              <el-input type="text" :value="form.createTime" maxlength="50" disabled />
            </div>
            <div class="right">
              <div class="right-title">{{ $t('page.business.study.study.status') }}</div>
              <el-select v-model="form.status" disabled style="width: 100%;">
                <el-option :label="$t('page.business.study.study.statusCg')" :value="1" />
                <el-option :label="$t('page.business.study.study.statusSyz')" :value="3" />
                <el-option :label="$t('page.business.study.study.statusYsd')" :value="5" />
                <el-option :label="$t('page.business.study.study.statusDgd')" :value="7" />
                <el-option :label="$t('page.business.study.study.statusGd')" :value="9" />
                <el-option :label="$t('page.business.study.study.statusDjd')" :value="10" />
              </el-select>
            </div>
          </div>
          <div class="pal">
            <div class="left">
              <div class="left-title">{{ $t('page.business.study.study.borrowStatus') }}</div>
              <el-select v-model="form.borrowStatus" disabled style="width: 100%;">
                <el-option :label="$t('page.business.study.study.borrowStatusWjy')" :value="1" />
                <el-option :label="$t('page.business.study.study.borrowStatusJyz')" :value="5" />
                <el-option :label="$t('page.business.study.study.borrowStatusDjy')" :value="10" />
              </el-select>
            </div>
          </div>
          <div class="pal">
            <div class="left" style="width:100%;margin-right:0">
              <div class="left-title">{{ $t('page.business.study.study.remark') }}</div>
              <el-input type="textarea" :rows="5" v-model="form.remark" maxlength="500" show-word-limit disabled> </el-input>
            </div>
          </div>
        </div>
        <div class="content-right">
          <div class="content-title">
            <div class="line"></div>
            <div class="subtitle"> {{ $t('page.business.study.study.jcgj') }}</div>
          </div>
          <jcgjList ref="jcgjList" :showRy="true" @handleQuery="jcgjListHandleQuery" />
          <pagination
            v-show="jcgjTotal>0"
            :total="jcgjTotal"
            small layout="prev, pager, next"
            :page.sync="queryJcgjParams.pageNum"
            :limit.sync="queryJcgjParams.pageSize"
            @pagination="getJjcgjList"
          />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { study_info, study_jcgjList } from "@/api/business/study/study"
import JcgjList from "@/views/business/comps/common/JcgjList";

export default {
  name: "StudyDetail",
  components: { JcgjList },
  data() {
    return {
      form: {},
      open: false,

      jcgjTotal: 0,
      jcgjList: [],
      queryJcgjParams: {
        pageNum: 1,
        studyId: null,
        pageSize: 10,
      }
    }
  },
  created() {
  },
  methods: {
    jcgjListHandleQuery(val) {
      this.queryJcgjParams.pageNum =1
      study_jcgjList(_.merge({}, this.queryJcgjParams, val)).then(response => {
        this.jcgjList = response.rows
        this.jcgjTotal = response.total
        this.$refs.jcgjList.init(this.jcgjList)
      })
    },
    getJjcgjList() {
      study_jcgjList(this.queryJcgjParams).then(response => {
        this.jcgjList = response.rows
        this.jcgjTotal = response.total
        this.$refs.jcgjList.init(this.jcgjList)
      }).finally(()=>{
      })
    },
    cancel() {
      this.$emit('cancel')
    },
    show(row) {
      this.$modal.loading()
      this.queryJcgjParams.studyId = row.id
      study_info({ id: row.id }).then(response => {
        this.form = response.data
        this.open = true
      }).finally(()=>{
        this.$modal.closeLoading()
      })

      this.getJjcgjList()
    }
  }
}
</script>
