<template>
  <div>
    <el-row :gutter="12" style="margin-top: 10px">
      <el-table :data="patientData"  border :row-style="{ color: '#303133' }" :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)', color: '#606266' }" >
        <el-table-column label="同步时间" align="center" width="200">
          <template slot-scope="scope">{{getTime( scope.row.sync_time ,'{y}-{m}-{d} {h}:{i}:{s}')}}</template>
        </el-table-column>

        <el-table-column label="同步结果" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.sync_result_type == 1">成功</span>
            <span v-if="scope.row.sync_result_type == 2">失败</span>
          </template>
        </el-table-column>

        <el-table-column label="同步信息" align="center">
          <template slot-scope="scope">{{scope.row.sync_result_remark }}</template>
        </el-table-column>

        <el-table-column label="同步条数" align="center">
          <template slot-scope="scope">{{scope.row.sync_total_num }}</template>
        </el-table-column>

        <el-table-column label="上传条数" align="center">
            <template slot-scope="scope">{{scope.row.sync_success_num }}</template>
        </el-table-column>
      </el-table>

      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :page-sizes="[10, 50, 100]"
        :page-size="10"
        background
        style="margin-top:20px;float: right"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </el-row>
  </div>
</template>

<script>
import { getsynclist } from '@/api/integration'
import { uParseTime } from '@/utils/tools'

export default {
  name: 'patientHisConfig',

  created() {
    this.getsynclist()
  },
  data() {
    return {
      dialogFormVisible: false,
      page: 1,
      limit: 10,
      total: 0,
      pageTotal: 0,
      pageSelect: 0,
      adminUserOptions: [],
      patientData: [],
      contagions: [],
      patient_id: 0,
      his_record_id: 0,
      his_id: '',
      current_index: 0,
      name: '',

      form: {
        his_user_id: '',
        name: '',
        sex: '',
        other_age: '',
        infectious: ''
      },
      rules: {
        his_user_id: [
          { required: true, message: '请输入his_id', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {
    getsynclist: function() {
      const Params = {
        page: this.page,
        limit: this.limit
      }
      getsynclist(Params).then(response => {
        if (response.data.state == 0) {
          this.$message.error(response.data.msg)
          return false
        } else {
          this.total = response.data.data.total
          this.patientData = response.data.data.list
        }
      })
    },
    handleSizeChange(val) {
      this.limit = val
      this.getsynclist()
    },
    handleCurrentChange(val) {
      this.page = val
      this.getsynclist()
    },
    getTime(value, temp) {
      if (value != undefined) {
        return uParseTime(value, temp)
      }
      return ''
    }

  }
}
</script>

<style rel="stylesheet/css" lang="scss" scoped>
.information {
  border: 1px #dcdfe6 solid;
  padding: 30px 20px 30px 20px;

  .border {
    border-bottom: 1px #dcdfe6 solid;
    margin: 0px 0 20px 0;
  }
}

.edit_separater {
  border-top: 1px solid rgb(233, 233, 233);
  margin-top: 15px;
  margin-bottom: 15px;
}
</style>

<style>
.sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  font-size: 12px;
}

.sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  background: #6fb5fa;
}

.count {
  color: #bd2c00;
}

.el-table td,
.el-table th.is-leaf,
.el-table--border,
.el-table--group {
  border-color: #d0d3da;
}

.el-table--border::after,
.el-table--group::after,
.el-table::before {
  background-color: #d0d3da;
}
</style>
