<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-change__changeRelocation} resi-container">
      <el-card ref="searchCard" class="search-card">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item label="姓名"
                      prop="name">
          <el-input v-model="dataForm.name"
                    size="small"
                    class="list_item_width_1"
                    clearable
                    placeholder="请输入姓名">
          </el-input>
        </el-form-item>
        <el-form-item label="身份证"
                      prop="idCard">
          <el-input v-model="dataForm.idCard"
                    size="small"
                    class="list_item_width_1"
                    clearable
                    placeholder="请输入身份证">
          </el-input>
        </el-form-item>
        <el-form-item label="手机"
                      prop="mobile">
          <el-input v-model="dataForm.mobile"
                    size="small"
                    class="list_item_width_1"
                    clearable
                    placeholder="请输入手机">
          </el-input>
        </el-form-item>
        <el-form-item label="迁出时间"
                      prop="startTime">
          <el-date-picker v-model="timeRange"
                          type="daterange"
                          clearable
                          size="small"
                          range-separator="至"
                          start-placeholder="选择日期"
                          end-placeholder="选择日期"
                          value-format="yyyy-MM-dd">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="small" @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="warning" size="small" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        <!--<el-form-item>-->
          <!--<el-button type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>-->
        <!--</el-form-item>-->
<!--        <el-form-item>-->
<!--          <el-button type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>-->
<!--        </el-form-item>-->
      </el-form>
      </el-card>
      <el-card class="resi-card-table">
      <el-table class="resi-table" v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%">
        <!--<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>-->
        <el-table-column label="序号"
                         type="index"
                         fixed="left"
                         align="center"
                         width="50">
        </el-table-column>
        <!--<el-table-column prop="id" label="主键" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="name" label="姓名" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <el-table-column prop="gender" label="性别" header-align="center" align="center" min-width="70" show-overflow-tooltip></el-table-column>
        <el-table-column prop="age" label="年龄" header-align="center" align="center" min-width="90" show-overflow-tooltip></el-table-column>
        <el-table-column prop="mobile" label="手机号" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <el-table-column prop="idCard" label="身份证号" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <!--<el-table-column prop="pid" label="组织PID" header-align="center" align="center"></el-table-column>-->
        <!--<el-table-column prop="agencyId" label="组织ID" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="agencyName" label="组织名" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <!--<el-table-column prop="villageId" label="房屋小区ID" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="villageName" label="房屋小区" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <!--<el-table-column prop="buildId" label="楼号ID" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="buildName" label="楼号" header-align="center" align="center" min-width="100" show-overflow-tooltip></el-table-column>
        <!--<el-table-column prop="unitId" label="单元ID" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="unitName" label="单元" header-align="center" align="center" min-width="100" show-overflow-tooltip></el-table-column>
        <!--<el-table-column prop="homeId" label="房屋ID" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="homeName" label="房屋" header-align="center" align="center" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column prop="address" label="外迁详细地址" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <el-table-column prop="type" label="操作类型" header-align="center" align="center" min-width="90" show-overflow-tooltip>
          <template slot-scope="scope">
            {{
            scope.row.type == 'out'
            ? "客户外"
            : scope.row.type == 'in'
            ? "客户内"
            : ""
            }}
          </template>
        </el-table-column>
        <el-table-column prop="ownerName" label="原房主姓名" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <el-table-column prop="oldDept" label="原网格信息" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <el-table-column prop="oldAddress" label="原房屋信息" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <el-table-column prop="oldHome" label="原房间号" header-align="center" align="center" min-width="90" show-overflow-tooltip></el-table-column>
        <el-table-column prop="reason" label="迁出原因" header-align="center" align="center" min-width="120" show-overflow-tooltip></el-table-column>
        <!--<el-table-column prop="delFlag" label="删除标记 0：未删除，1：已删除" header-align="center" align="center"></el-table-column>-->
        <!--<el-table-column prop="revision" label="乐观锁" header-align="center" align="center"></el-table-column>-->
        <!--<el-table-column prop="createdBy" label="创建人" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="outOfTime" label="迁出时间" header-align="center" align="center" min-width="160"></el-table-column>
        <el-table-column prop="createdTime" label="创建时间" header-align="center" align="center" min-width="160"></el-table-column>
        <!--<el-table-column prop="updatedBy" label="更新人" header-align="center" align="center"></el-table-column>-->
        <!--<el-table-column prop="updatedTime" label="更新时间" header-align="center" align="center"></el-table-column>-->
        <!--<el-table-column prop="customerId" label="客户ID" header-align="center" align="center"></el-table-column>-->
        <!--<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">-->
          <!--<template slot-scope="scope">-->
            <!--<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>-->
            <!--<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>-->
          <!--</template>-->
        <!--</el-table-column>-->
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      </el-card>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './changerelocation-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/pli/power/changeRelocation/page',
        getDataListIsPage: true,
        deleteURL: '/pli/power/changeRelocation',
        deleteIsBatch: true,
        exportURL: '/pli/power/changeRelocation/export'
      },
        timeRange: '',
      dataForm: {
        id: '',
          name: '',
          mobile: '',
          idCard: ''
      }
    }
  },
  components: {
    AddOrUpdate
  },
    watch: {
        timeRange (val) {
            if (Array.isArray(val) && val.length == 2) {
                this.dataForm.startTime = val[0];
                this.dataForm.endTime = val[1];
            } else {
                this.dataForm.startTime = '';
                this.dataForm.endTime = '';
            }
        }
    },
}
</script>
<style lang="scss" scoped>
  @import "@/assets/scss/buttonstyle.scss";

  .resi-container .resi-card-table {
    ::v-deep .el-table th {
      color: #fff;
      background-color: rgba(33, 149, 254, 1);
      // border-right: 1px solid rgba(33, 149, 254, 1);
    }
  }
  .resi-table {
    ::v-deep .el-button--text {
      text-decoration: underline;
    }
    ::v-deep .btn-color-del {
      margin-left: 10px;
      color: rgba(213, 16, 16, 1);
    }
    ::v-deep .btn-color-edit {
      color: rgba(0, 167, 169, 1);
    }
  }
  .form-wr {
    .input-width {
      width: 260px;

    }
    .input-width-textarea {
      width: 500px;
    }
    .imsg-list {
      display: flex;
      align-items: center;
      .imgs-item {
        position: relative;
        margin-right: 10px;
        .el-icon-delete {
          position: absolute;
          top: 0;
          right: 0;
          font-size: 18px;
          color: red;
          z-index: 3;
          cursor: pointer;
        }
      }
    }
  }
  .div-content {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
</style>
