<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <!-- 搜索 -->
        <el-input v-model="query.zxbh" clearable placeholder="中心编号" style="width: 200px" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <date-range-picker v-model="query.createTime" 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="xysj">
                <el-input v-model.number="form.xysj" style="width: 370px;" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8">
            <el-form-item label="响应状态" prop="xyzt">
              <el-input v-model.number="form.xyzt" style="width: 370px;" :disabled="true" />
            </el-form-item>
            <div class="grid-content bg-purple-light" />
          </el-col>
          <el-col :span="8">
            <div class="grid-content bg-purple" />
            <el-form-item label="响应内容" prop="xynr">
              <el-input v-model="form.xynr" style="width: 370px" :disabled="true" />
            </el-form-item>
          </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="entName">
                <el-input v-model="form.entName" 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="xynr">
                <el-input v-model="form.dom" 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="name">
                <el-input v-model="form.name" 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="uniscid">
                <el-input v-model="form.uniscid" 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="estDate">
                <el-input v-model="form.estDate" 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="name">
                <el-input v-model="form.regCap" 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="opFrom">
                <el-input v-model="form.opFrom" 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="opto">
                <el-input v-model="form.opto" 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="regOrgCn">
                <el-input v-model="form.regOrgCn" style="width: 370px" :disabled="true" />
              </el-form-item>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="登记登记状态" prop="regStateCn">
              <el-input v-model="form.regStateCn" style="width: 370px" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="企业经营范围" prop="opScope">
              <el-input v-model="form.opScope" type="textarea" style="width: 370px" :disabled="true" />
            </el-form-item>
          </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">
          <udOperation
            :data="scope.row"
            :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="zxbh" label="中心编号" />
      <el-table-column prop="grzh" 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 udOperation from './Crud/UD.operation'
import pagination from './Crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
import crudOperation from './Crud/CRUD.operation'

const defaultForm = { id: null, name: null, ip: null, port: 22, account: 'root', password: null }
export default {
  name: 'Lxjcjy',
  components: { pagination, rrOperation, udOperation, DateRangePicker, crudOperation },
  cruds() {
    return CRUD({ title: '连续缴存校验', url: 'api/LxjcjyController', crudMethod: {}})
  },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  data() {
    return {
      // currView: 'index',
      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>
