<template>
  <div style="height: 100%;">
    <div class="iotmenu-content-header">
      <a-icon type="file-text" />
      <span>可视化配置</span>
    </div>
    <a-card :bordered="false" class="iotmenu-content">
      <div>
        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          class="j-table-force-nowrap"
          @change="handleTableChange">
          <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->

          <template slot="dashboardUrl" slot-scope="text">
            <div style="word-wrap: break-word; white-space: pre-wrap;">{{ text }}</div>
          </template>
          <span slot="action" slot-scope="text, record">
            <a-tooltip style="margin-right: 10px;">
              <template slot="title"> 设置 </template>
              <span class="edit-btn" @click="handleEdit(record)"></span>
            </a-tooltip>
          </span>

        </a-table>
      </div>

      <dashboard-url-set-model ref="modalForm" @ok="modalFormOk"></dashboard-url-set-model>
    </a-card>
  </div>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { getSystemSubmenu } from '@/api/api'
  import DashboardUrlSetModel from './modules/DashboardUrlSetModel.vue'

  export default {
    name: 'DashboardUrlSetList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      DashboardUrlSetModel
    },
    data () {
      return {
        description: '可视化路径配置表管理页面',
        // 表头
        columns: [
          {
            title:'可视化统计路径',
            align:"center",
            dataIndex: 'dashboardUrl',
            width: 500,
            scopedSlots: { customRender: 'dashboardUrl' }
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            // fixed:"right",
            width: 100,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          // list: "/interlockLoginConfig/interlockLoginConfig/list",
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    },
    computed: {
      // importExcelUrl: function(){
      //   return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      // },
    },
    methods: {
      loadData() {
        this.loading = true
        // 联锁管理id写死
        getSystemSubmenu({parentId:'1793561497875640322'}).then((res) => {
          if (res.success) {
            // this.dataSource = res.result.filter(item => item.name === '可视化统计')
            this.dataSource = res.result.filter(item => item.id === '1798542858253357057')
            if(this.dataSource.length > 0){
              this.dataSource[0].dashboardUrl = (this.dataSource[0].url.split(')=('))[1]
            }
          }
        }).finally(()=>{
          this.loading = false
        })
      },
      initDictConfig(){
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>