<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="24">

          <a-col :md="6" :sm="8">
            <a-form-item label="请求地址">
              <a-input placeholder="请输入请求地址" v-model="queryParam.url"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="请求路径">
              <a-input placeholder="请输入请求路径" v-model="queryParam.path"></a-input>
            </a-form-item>
          </a-col>
          <template>
            <a-col :md="6" :sm="8">
              <a-form-item label="令牌">
                <a-input placeholder="请输入令牌" v-model="queryParam.token"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="url参数">
                <a-input placeholder="请输入url参数" v-model="queryParam.urlParam"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="body参数">
                <a-input placeholder="请输入body参数" v-model="queryParam.bodyParam"></a-input>
              </a-form-item>
            </a-col>
          </template>
          <a-col :md="6" :sm="8">
            <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>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
    </div>

    <!-- table区域-begin -->
    <div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">
        <span slot="dataContent" slot-scope="text, record">
          <j-ellipsis :value="text" :length="60"/>
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <kuaishouAppAccount-modal ref="modalForm" @ok="modalFormOk"></kuaishouAppAccount-modal>
  </a-card>
</template>

<script>
  import KuaishouAppAccountModal from './modules/KuaishouAppAccountModal'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import JEllipsis from "@/components/jeecg/JEllipsis";

  export default {
    name: "KuaishouAppAccountList",
    mixins: [JeecgListMixin],
    components: {
      KuaishouAppAccountModal,
      JEllipsis
    },
    data() {
      return {
        description: '快手APP账号表管理页面',
        // 表头
        columns: [
          {
            title: '请求地址',
            align: "center",
            dataIndex: 'url'
          },
          {
            title: '请求路径',
            align: "center",
            dataIndex: 'path'
          },
          {
            title: '令牌',
            align: "center",
            dataIndex: 'token',
            scopedSlots: {customRender: 'dataContent'}
          },
          {
            title: 'url参数',
            align: "center",
            dataIndex: 'urlParam',
            scopedSlots: {customRender: 'dataContent'}
          },
          {
            title: 'body参数',
            align: "center",
            dataIndex: 'bodyParam',
            scopedSlots: {customRender: 'dataContent'}
          },
          {
            title: 'header参数',
            align: "center",
            dataIndex: 'headerParam',
            scopedSlots: {customRender: 'dataContent'}
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: "center",
            scopedSlots: {customRender: 'action'},
          }
        ],
        url: {
          list: "/ctop/kuaishouAppAccount/list",
          delete: "/ctop/kuaishouAppAccount/delete",
          deleteBatch: "/ctop/kuaishouAppAccount/deleteBatch",
          exportXlsUrl: "ctop/kuaishouAppAccount/exportXls",
          importExcelUrl: "ctop/kuaishouAppAccount/importExcel",
        },
      }
    },
    computed: {
      importExcelUrl: function () {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {}
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>