<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-input v-model="query.xingming" clearable placeholder="姓名" style="width: 200px" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <date-range-picker v-model="query.crrq" class="date-item" />
        <rrOperation />
      </div>
      <crudOperation :permission="permission" />
    </div>
    <!--表单组件-->
    <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="100%" hight="100%">
      <el-form ref="form" :model="form" :rules="rules" size="small" label-width="130px">
        <el-row :gutter="20">
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item label="证件类型" prop="zjlx">
                <el-input v-model="form.zjlx" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple-light">
              <el-form-item label="证件号码" prop="zjhm">
                <el-input v-model="form.zjhm" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item label="状态" prop="status">
                <el-input v-model="form.status" type="textarea" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item label="姓名" prop="xingming">
                <el-input v-model.number="form.xingming" style="width: 370px;" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8">
            <el-form-item label="插入日期" prop="crrq">
              <el-input v-model.number="form.crrq" style="width: 370px;" :disabled="true" />
            </el-form-item>
            <div class="grid-content bg-purple-light" />
          </el-col>
        </el-row>
        <el-divider content-position="left">返回参数</el-divider>
        <el-row :gutter="20">
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item label="贷款笔数" prop="DKBS">
                <el-input v-model="form.DKBS" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple-light">
              <el-form-item label="结清笔数" prop="JQBS">
                <el-input v-model="form.JQBS" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item label="未结清笔数" prop="WJQBS">
                <el-input v-model="form.WJQBS" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item label="逾期笔数" prop="YQBS">
                <el-input v-model="form.YQBS" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple-light">
              <el-form-item label="插入日期" prop="CRRQ">
                <el-input v-model="form.CRRQ" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item label="中心账务日期" prop="ZXZWRQ">
                <el-input v-model="form.ZXZWRQ" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <div class="grid-content bg-purple">
              <el-form-item label="中心编号" prop="ZXBH">
                <el-input v-model="form.ZXBH" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer" style="text-align: center">
        <el-button type="primary" size="medium" @click="crud.cancelCU">确认</el-button>
      </div>
    </el-dialog>
    <!--表格渲染-->
    <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%" @selection-change="crud.selectionChangeHandler">
      <el-table-column v-if="checkPer(['admin','serverDeploy:edit'])" label="操作" width="150px" align="center">
        <template slot-scope="scope">
          <Retrieve
            :data="scope.row"
            :query-list="queryList"
            :permission="permission"
          />
        </template>
      </el-table-column>
      <!--            <el-table-column type="selection" width="55" />-->
      <el-table-column prop="zjlx" label="证件类型" />
      <el-table-column prop="zjhm" label="证件号码" />
      <el-table-column prop="status" label="状态" />
      <el-table-column prop="xingming" label="姓名" />
      <el-table-column prop="crrq" label="插入日期" />
    </el-table>
    <!--分页组件-->
    <pagination />
  </div>
</template>

<script>

import { testServerConnect } from '@/api/mnt/connect'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
import crudOperation from '@crud/CRUD.operation'
import Retrieve from '@crud/Retrieve'

const defaultForm = { id: null, name: null, ip: null, port: 22, account: 'root', password: null }
export default {
  name: 'Dkbscx',
  components: { Retrieve, pagination, rrOperation, DateRangePicker, crudOperation },
  cruds() {
    return CRUD({ title: '贷款笔数查询', url: 'api/DkbscxController', crudMethod: {}})
  },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  data() {
    return {
      // currView: 'index',
      queryList: {
        status: true,
        url: 'api/DkbscxController/QueryDkbscxFhmx'
      },
      accountList: [],
      accountMap: {},
      loading: false,
      permission: {},
      // 规则验证
      rules: {
        Demo: [
          { required: true, message: '请输入Demo', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    testConnectServer() {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          this.loading = true
          testServerConnect(this.form).then((res) => {
            this.loading = false
            this.$notify({
              title: res ? '连接成功' : '连接失败',
              type: res ? 'success' : 'error',
              duration: 2500
            })
          }).catch(() => {
            this.loading = false
          })
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
  text-align: left;
}
</style>
