<template>
  <obitUniversalTable name="应用管理" :pagination="pagination">
    <template #search>
      <obit-search-form :params="params" :paramList="paramList" @search="pageQuery(true)">
      </obit-search-form>
    </template>
    <template #btn>
      <a-button type="primary" @click="addDialog">
        <i class="iconfont icon-add-bold p-r-5">
        </i> 新 增

      </a-button>
    </template>
    <a-table :loading="pageLoading" class="obit-atable" rowKey="appId" :columns="tableColumns"
      :dataSource="pageDataList" :pagination="false" highlight-current-row style="width: 100%">
      <template #operation="{ record  }">
        <a-button class="operation-btn" type="link" @click="editDialog(record)"> 编辑
        </a-button>
        <a-button class="operation-btn" type="link" @click="remove(record)"> 删除
        </a-button>
      </template>
    </a-table>
  </obitUniversalTable>
  <sysAppAdd :detailsInfo="detailsInfo" v-model:open="pageVisable" :addType="pageType" @reload="pageQuery(true)">
  </sysAppAdd>
</template>  
<script>
import { computed, getCurrentInstance, provide, onMounted, reactive, toRefs, inject } from 'vue'
import sysAppAdd from './sysAppAdd.vue'

export default {
  components: { sysAppAdd },
  setup (props, context) {
    let { proxy } = getCurrentInstance()
    let hook = inject('hook')
    let pageIns = hook.page({
      url: 'manager/sysParameter/getList',
      key: 'appId', removeUrl: ''
    })
    let _data = reactive({
      tableColumns: [{ dataIndex: 'appAccount', title: '应用账户' },
      { dataIndex: 'appCode', title: '应用编码' },
      { dataIndex: 'appName', title: '应用名称' },
      { dataIndex: 'appIcon', title: '应用图标路径' },
      { dataIndex: 'appDesc', title: '应用介绍' },
      { dataIndex: 'useStatus', title: '使用状态' },
      { dataIndex: 'appType', title: '应用类型' },
      { dataIndex: 'linkUrl', title: '单点登录路径' },
      { dataIndex: 'tenantId', title: '租户id' },
      { slots: { customRender: 'operation' }, title: '操作' }],
      paramList: [{ name: '应用账户', type: 'input', key: 'appAccount', id: 100 },
      { name: '应用编码', type: 'input', key: 'appCode', id: 101 },
      { name: '应用名称', type: 'input', key: 'appName', id: 102 },
      { name: '应用图标路径', type: 'input', key: 'appIcon', id: 103 },
      { name: '应用介绍', type: 'input', key: 'appDesc', id: 104 }],
    })
    let _methods = {
    }
    onMounted(() => {
      pageIns._method.pageQuery()
    })
    return {
      ...toRefs(pageIns._data),
      ...pageIns._method,
      ...toRefs(_data),
      ..._methods,
    }
  }
}
    </script>