<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 :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="客户编号">
              <j-input placeholder="请输入客户编号" v-model="queryParam.customerNo"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="客户名称">
              <j-input placeholder="请输入客户名称" v-model="queryParam.customerName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">
        <!-- 任务名称可点击 -->
        <template v-slot:customerNo="text, record">
          <a @click="showTaskList(record)">{{ text }}</a>
        </template>
      </a-table>
    </div>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import SmsCheckWorkLogModal from '../smscheck/modules/SmsCheckWorkLogModal'
import {getAction} from "@api/manage";

export default {
  name: 'CompanyList',
  mixins: [JeecgListMixin],
  components: {
    SmsCheckWorkLogModal
  },
  props: {
    task: {
      type: Object,
      require: true
    }
  },

  data() {
    return {
      description: '行短公司列表',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '客户编号',
          align: "center",
          dataIndex: 'customerNo',
          scopedSlots: {customRender: 'customerNo'},
        },
        {
          title: '客户名称',
          align: "center",
          dataIndex: 'customerName',
          customRender: function (text, record, index) {
            if (!text) {
              return '无'
            }
            return text
          }
        },
        {
          title: '入网时间',
          align: "center",
          dataIndex: 'networkAccessTime',
          customRender: function (text, record, index) {
            if (!text) {
              return '无'
            }
            return text
          }
        },
        {
          title: '服务号码',
          align: "center",
          dataIndex: 'smsNumber',
          customRender: function (text, record, index) {
            if (!text) {
              return '无'
            }
            return text
          }
        },
      ],
      url: {
        list: "/smsCheck/customerInfo/selectCompanyList"
      },
      dictOptions: {},
      superFieldList: [],

      dataSource1: {}
    }
  },
  created() {
    /*this.init()*/
  },
  methods: {
    init() {
      getAction("/smsCheck/customerInfo/selectCompanyList", this.queryParam).then(resp => {
        if (resp.success) {
          this.dataSource = resp.resultList
        }
      })
    },
    showTaskList(record) {
      let taskInfo = Object.assign({}, this.task);
      let info = {
        task: this.task,
        info: record
      };
      this.$emit("goTaskList", info)
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>