<!--
 * @Author: 曹捷
 * @Date: 2021-03-15 14:54:07
 * @LastEditors: 曹捷
 * @LastEditTime: 2021-05-31 12:48:38
 * @Description: 系统参数管理
-->
<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" rowKey="paramCode" :columns="tableColumns" :dataSource="pageDataList"
      :pagination="false" class="com-table" highlight-current-row style="width: 100%">
      <template #operation="{ record  }" :key="record.paramCode">
        <a-button type="link" @click="editDialog(record)">编辑</a-button>
        <a-divider type="vertical" style="height: 16px;" />
        <a-button type="link" @click="remove(record)"> 删除</a-button>
      </template>
    </a-table>
  </obitUniversalTable>
  <paramAdd :addType="pageType" v-model:open="pageVisable" :detailsInfo="detailsInfo" @reload="pageQuery(true)">
  </paramAdd>
</template>

<script>
import { getCurrentInstance, onMounted, reactive, toRefs } from 'vue'
import paramAdd from './paramAdd.vue'
import page from './../../../hook/page.js'
export default {
  components: { paramAdd },
  setup (props, contenxt) {
    let { proxy } = getCurrentInstance()
    let pageIns = page({
      tableRequest: 'getSystemParamsList',
      removeKey: 'remveSystemParams',
    })
    let _data = reactive({
      tableColumns: [
        { dataIndex: 'paramName', title: '参数名称' },
        { dataIndex: 'paramCode', title: '参数编码' },
        { dataIndex: 'paramValue', title: '参数值' },
        { title: '操作', slots: { customRender: 'operation' } },
      ],
      paramList: [
        { name: '参数编码', key: 'paramCode' },
        { name: '参数名', key: 'paramName' }
      ],
    })
    let _methods = {
    }
    onMounted(() => {
      pageIns._method.pageQuery()
    })
    return {
      ...toRefs(pageIns._data),
      ...pageIns._method,
      ...toRefs(_data),
      ..._methods,
    }
  },
}
</script>

<style>
</style>