<template>
  <w-grid
    ref="announcementGridRef"
    :title="$t('system.announcementManager.grid.title')"
    :config-button="true"
    selection="multiple"
    :checkbox-selection="true"
    :data-url="Environment.apiContextPath('/api/system/announcement')"
    :sort-by="['-lastModifyDate']"
    :query-form-cols-num="2"
    :query-form-fields="[{ name: 'title', label: $t('title'), type: 'w-text' }]"
    :toolbar-configure="{ noIcon: false }"
    :toolbar-actions="['query', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']"
    :columns="[
      { width: 300, name: 'title', label: $t('title') },
      { width: '100%', name: 'content', label: $t('content'), sortable: false },
    ]"
    :editor="{
      dialog: {
        width: '800px',
      },
      form: {
        colsNum: 1,
        fields: [
          { name: 'title', label: $t('title'), type: 'w-text', requiredIf: true },
          { name: 'content', label: $t('content'), type: 'q-editor', requiredIf: true, minHeight: '10rem', defaultValue: '' },
        ],
      },
    }"
    :viewer="{
      panel: {
        columnNum: 1,
        fields: [
          { name: 'id', label: $t('id') },
          { name: 'title', label: $t('title') },
          { name: 'content', label: $t('content') },
          { name: 'dataComeFrom', label: $t('dataComeFrom') },
          { name: 'creator', label: $t('creator') },
          { name: 'createDate', label: $t('createDate') },
          { name: 'lastModifier', label: $t('lastModifier') },
          { name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
          { name: 'corporationCode', label: $t('corporationCode') },
        ],
      },
    }"
  ></w-grid>
</template>
<script setup lang="ts">
import 'tailwindcss/utilities.css';
import { Environment, Formater } from 'platform-core';
</script>
