<template>
  <a-card>
    <sd-data-table-ex
      ref="dataTable"
      form-id="weAppMenu"
      page-id="app/appmenu/weAppMenu"
      :columns="columns"
      :show-selection="(item) => item.appId !== '0'"
      :actions="actions"
      :search-fields="['name']"
    >
      <!-- 详情表单 -->
      <template v-slot:form>
        <sd-form-item name="name" />
        <sd-form-item name="menuType" />
        <sd-form-item name="url" />
        <sd-form-item name="sortNumber" />
        <sd-form-item name="status" />
        <sd-form-item name="appId" :hidden="true" :input-props="{ defaultValue: '0' }" />
      </template>
    </sd-data-table-ex>
  </a-card>
</template>

<script>
import TableActionTypes from '@/common/services/table-action-types'
import TableColumnTypes from '@/common/services/table-column-types'
import components from './_import-components/sd-application-menu-import'

export default {
  name: 'SdApplicationMenu',
  metaInfo: {
    title: '应用菜单',
  },
  components,
  data() {
    return {
      columns: [
        {
          title: '排序号',
          dataIndex: 'sortNumber',
          defaultSortOrder: 'ascend',
          width: '100px',
        },
        {
          title: '菜单名称',
          dataIndex: 'name',
          sdClickable: true,
        },
        {
          title: '菜单类型',
          dataIndex: 'menuType',
        },
        {
          title: '菜单URL',
          dataIndex: 'url',
        },
        {
          title: '状态',
          dataIndex: 'status',
          width: '100px',
          sdRender: TableColumnTypes.ex.switch,
        },
        {
          title: '创建时间',
          dataIndex: 'creationTime',
          sorter: true,
          sdRender: TableColumnTypes.dateTime,
        },
      ],
      actions: [
        {
          label: '新建',
          id: 'new',
          type: TableActionTypes.ex.create,
        },
        {
          label: '删除',
          id: 'delete',
          type: TableActionTypes.ex.delete,
        },
      ],
    }
  },
  methods: {},
}
</script>

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