<template>
  <a-card>
    <sd-oa-table
      ref="dataTable"
      form-id="kmSystemConfig"
      page-id="km/admin/kmSystemConfig"
      :columns="columns"
      :actions="actions"
      show-selection
      :search-fields="['name']"
    >
      <template v-slot:form>
        <sd-form-item name="name"></sd-form-item>
        <sd-form-item name="value"></sd-form-item>
        <sd-form-item name="funDescription"></sd-form-item>
        <sd-form-item name="valDescription"></sd-form-item>
      </template>
    </sd-oa-table>
  </a-card>
</template>

<script>
import TableActionTypes from '@/common/services/table-action-types'
import components from './_import-components/km-system-configure-import'

export default {
  name: 'KmSystemConfigure',
  metaInfo: {
    title: '系统参数配置',
  },
  components,
  data() {
    return {
      columns: [
        {
          title: '关键字',
          dataIndex: 'name',
        },
        {
          title: '值',
          dataIndex: 'value',
        },
        {
          title: '参数功能说明',
          dataIndex: 'funDescription',
        },
      ],
      actions: [
        {
          label: '编辑',
          id: 'read',
          type: TableActionTypes.inline,
          callback: this.rowClick,
        },
        {
          label: '新建',
          id: 'new',
          type: TableActionTypes.oa.create, // 新建按钮，不需要回调，自动处理
        },
        {
          label: '删除',
          id: 'delete',
          type: TableActionTypes.oa.delete, // 删除按钮，不需要回调，会自动处理
        },
      ],
    }
  },
  methods: {
    rowClick(record) {
      this.$refs.dataTable.showDetailModal(record.id)
    },
  },
}
</script>

<style module lang="scss">
@use '@/common/design' as *;
</style>
