<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="小区名称">
              <j-input placeholder="请输入小区名称" v-model="queryParam.advName"></j-input>
            </a-form-item>
          </a-col>
          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="6" :sm="24">
              <a-button type="primary" @click="searchQuery">查询</a-button>
              <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
            </a-col>
          </span>
        </a-row>
      </a-form>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns"
        :dataSource="dataSource1" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a type="primary" @click="onStatus(record)">解绑/绑定</a>
        </span>
      </a-table>
    </div>
  </a-card>
</template>

<script>
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'CommunityLlist',
  mixins: [JeecgListMixin, mixinDevice],
  data() {
    return {
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '小区名称',
          align: 'center',
          dataIndex: 'name',
        },
        {
          title: '所属区域',
          align: 'center',
          dataIndex: 'domain',
        },
        {
          title: '占地面积（m2）',
          align: 'center',
          dataIndex: 'area',
        },
        {
          title: '总栋数',
          align: 'center',
          dataIndex: 'num1',
        },
        {
          title: '房屋数量',
          align: 'center',
          dataIndex: 'num2',
        },
        {
          title: '商铺数量',
          align: 'center',
          dataIndex: 'num3',
        },
        {
          title: '联系人',
          align: 'center',
          dataIndex: 'name1',
        },
        {
          title: '详细地址',
          dataIndex: 'add',
          align: 'center',
        },
        {
          title: '操作',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          fixed: 'right',
          width: 150,
        },
      ],
      dataSource1:[ 
        {name:'汉江之星小区',domain:'汉江',area:3000,num1:10,num2:20,num3:30,name1:'李四',add:'武汉市'}
      ],
      url: {
        list: '/property-central/property/propertyAdv/list',
      },
      dictOptions: [],
    }
  },
  created() {},
  methods: {
    onStatus(record) {
      let that = this
      this.$confirm({
          title: `确认${record.propertyStatus === 'normal' ? '绑定' : '解绑'}此小区?`,
          closable: true,
          okText: `${record.propertyStatus === 'normal' ? '绑定' : '解绑'}`,
          onOk() {
            // return freezeOrPropertyApi({
            //   id: record.id,
            //   status: `${record.propertyStatus === 'normal' ? 'freeze' : 'normal'}`,
            // }).then((res) => {
            //   that.searchQuery()
            // })
          },
          onCancel() {},
        })
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>