<template>
  <!-- 详情 -->
  <div class="detail-container" v-if="open">
    <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">
        <el-button @click="cancel()">{{ $t('form.cancel') }}</el-button>
      </div>
    </div>
    <div class="detail-title"><img src="@/assets/images/detail-title.png">{{ $t('page.business.resource.mjy.ffjlxq')
    }}<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.resource.mjy.jbxx') }}</div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.mc') }}</div>
            <el-input type="text" :value="form.mc" maxlength="50" disabled />
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.bh') }}</div>
            <el-input type="text" :value="form.bh" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.sxrq') }}</div>
            <el-input type="text" :value="form.sxrq" maxlength="50" disabled />
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.nd') }}</div>
            <el-input type="text" :value="form.nd" maxlength="50" disabled> <template slot="append">{{ form.nddw
            }}</template>
            </el-input>
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.cctj') }}</div>
            <el-input type="text" :value="form.cctj" maxlength="50" disabled />
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.ccwz') }}</div>
            <el-input type="text" :value="form.ccwz" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.ckl') }}</div>
            <el-input type="text" :value="form.ckl" maxlength="50" disabled> <template slot="append">{{ form.ckldw
            }}</template>
            </el-input>
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.ckmz') }}</div>
            <el-input type="text" :value="form.ckmz" maxlength="50" disabled> <template slot="append">{{ form.ckmzdw
            }}</template>
            </el-input>
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.lqsj') }}</div>
            <el-input type="text" :value="form.ffrq" maxlength="50" disabled> <template slot="append">{{ form.ckldw
            }}</template>
            </el-input>
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.md') }}</div>
            <el-input type="text" v-if="form.mdOther && form.mdOther != '' && form.mdMcs && form.mdMcs != ''"
              :value="form.mdMcs + ',' + form.mdOther" maxlength="50" disabled />
            <el-input type="text" v-else :value="form.mdMcs + form.mdOther" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.ffzytj') }}</div>
            <el-input type="text" :value="form.ffzytj" maxlength="50" disabled />
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.lqr1') }}</div>
            <el-input type="text" :value="form.lqr1Mc" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.lqr2') }}</div>
            <el-input type="text" :value="form.lqr2Mc" maxlength="50" disabled />
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.ghr1Id') }}</div>
            <el-input type="text" :value="form.ghr1Mc" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.ghr2Id') }}</div>
            <el-input type="text" :value="form.ghr2Mc" maxlength="50" disabled />
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.ghzytj') }}</div>
            <el-input type="text" :value="form.ghzytj" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.rkmz') }}</div>
            <el-input type="text" :value="form.rkmz" maxlength="50" disabled> <template slot="append">{{ form.rkmzdw
            }}</template>
            </el-input>
          </div>
        </div>
        <div class="pal">
          <div class="left" style="width: 100%;">
            <div class="left-title">{{ $t('page.business.resource.mjy.ffbz') }}</div>
            <el-input type="text" :value="form.ffbz" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="right" style="width: 100%;">
            <div class="right-title">{{ $t('page.business.resource.mjy.ghbz') }}</div>
            <el-input type="text" :value="form.ghbz" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.gdsqrId') }}</div>
            <el-input type="text" :value="form.gdsqrMc" maxlength="50" disabled />
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.cjsj') }}</div>
            <el-input type="text" :value="form.createTime" maxlength="50" disabled />
          </div>
        </div>
        <div class="pal">
          <div class="left">
            <div class="left-title">{{ $t('page.business.resource.mjy.jlzt') }}</div>
            <el-select v-model="form.jlzt" disabled style="width: 100%;">
              <el-option :label="$t('page.business.resource.resource.jlzt.wsd')" :value="1" />
              <el-option :label="$t('page.business.resource.resource.jlzt.ysd')" :value="3" />
              <el-option :label="$t('page.business.resource.resource.jlzt.dgd')" :value="5" />
              <el-option :label="$t('page.business.resource.resource.jlzt.gd')" :value="7" />
              <el-option :label="$t('page.business.resource.resource.jlzt.djd')" :value="9" />
            </el-select>
          </div>
          <div class="right">
            <div class="right-title">{{ $t('page.business.resource.mjy.jyzt') }}</div>
            <el-select v-model="form.jyzt" disabled style="width: 100%;">
              <el-option :label="$t('page.business.resource.resource.jyzt.wjy')" :value="1" />
              <el-option :label="$t('page.business.resource.resource.jyzt.djy')" :value="3" />
              <el-option :label="$t('page.business.resource.resource.jyzt.jyz')" :value="5" />
            </el-select>
          </div>
        </div>
      </div>
      <div class="content-right">
        <div class="content-title">
          <div class="line"></div>
          <div class="subtitle"> {{ $t('page.business.resource.mjy.jcgj') }}</div>
        </div>
        <jcgjList ref="jcgjList" @handleQuery="getJjcgjList" :showBcsm="true" :showBj="false"/>

        <pagination v-show="jcgjTotal > 0" small layout="prev, pager, next" :total="jcgjTotal"
          @pagination="getJjcgjList" :limit="queryJcgjParams.pageSize" />
      </div>
    </div>
  </div>
</template>

<script>
import { info, jcgjList } from "@/api/business/mjy/mjyFfjl"
import JcgjList from "@/views/business/comps/common/JcgjList";

export default {
  name: "Xq",
  components: { JcgjList },
  data() {
    return {
      form: {},
      jcgjTotal: 0,
      jcgjList: [],
      open: false,
      queryJcgjParams: {
        pageNum: 1,
        ffjlId: null,
        pageSize: 5,
      }
    }
  },
  created() {
  },
  methods: {
    cancel() {
      this.open = false
      this.$emit('callback')
    },
    getJjcgjList(val) {
      this.$modal.loading()
      jcgjList(_.merge({}, this.queryJcgjParams, val)).then(response => {
        this.jcgjList = response.rows
        this.jcgjTotal = response.total
        if (this.queryJcgjParams.pageNum == 1) {
          this.$refs.jcgjList.init(this.jcgjList)
        } else {
          this.$refs.jcgjList.add(this.jcgjList)
        }
        this.$modal.closeLoading()
      }).finally(() => {
        this.$modal.closeLoading()
      })
    },
    show(row) {
      this.$modal.loading()
      this.queryJcgjParams.ffjlId = row.id
      info({ id: row.id }).then(response => {
        this.form = response.data
        this.open = true
        this.getJjcgjList()
      })
    }
  }
}
</script>
