<template>
  <w-grid
    :title="$t('io.sc.engine.mv.config.scale.grid.title')"
    hide-bottom
    :config-button="true"
    dnd-mode="server"
    db-click-operation="edit"
    selection="multiple"
    :checkbox-selection="true"
    :data-url="Environment.apiContextPath('/api/mv/configure/scale')"
    :pageable="false"
    :sort-by="['order']"
    :toolbar-configure="{ noIcon: false }"
    :toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']"
    :columns="[
      { width: 150, name: 'modelId', label: $t('io.sc.engine.mv.config.scale.grid.entity.modelId') },
      { width: '100%', name: 'modelName', label: $t('io.sc.engine.mv.config.scale.grid.entity.modelName') },
      { width: 100, name: 'level', label: $t('io.sc.engine.mv.config.scale.grid.entity.level') },
      { width: 150, name: 'pd', label: $t('io.sc.engine.mv.config.scale.grid.entity.pd') },
      { width: 100, name: 'order', label: $t('io.sc.engine.mv.config.scale.grid.entity.order'), align: 'right' },
      { width: 100, name: 'lastModifier', label: $t('lastModifier') },
      { width: 150, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() },
    ]"
    :editor="{
      dialog: {
        width: '600px',
      },
      form: {
        colsNum: 1,
        fields: [
          { name: 'modelId', label: $t('io.sc.engine.mv.config.scale.grid.entity.modelId'), type: 'w-text' },
          { name: 'modelName', label: $t('io.sc.engine.mv.config.scale.grid.entity.modelName'), type: 'w-text' },
          { name: 'level', label: $t('io.sc.engine.mv.config.scale.grid.entity.level'), type: 'w-text' },
          { name: 'pd', label: $t('io.sc.engine.mv.config.scale.grid.entity.pd'), type: 'w-text' },
          { name: 'order', label: $t('io.sc.engine.mv.config.scale.grid.entity.order'), type: 'w-text' },
        ],
      },
    }"
    :viewer="{
      panel: {
        columnNum: 1,
        fields: [
          { name: 'id', label: $t('id') },
          { name: 'modelId', label: $t('io.sc.engine.mv.config.scale.grid.entity.modelId') },
          { name: 'modelName', label: $t('io.sc.engine.mv.config.scale.grid.entity.modelName') },
          { name: 'level', label: $t('io.sc.engine.mv.config.scale.grid.entity.level') },
          { name: 'pd', label: $t('io.sc.engine.mv.config.scale.grid.entity.pd') },
          { name: 'order', label: $t('io.sc.engine.mv.config.scale.grid.entity.order') },
          { name: 'creator', label: $t('creator') },
          { name: 'createDate', label: $t('createDate') },
          { name: 'lastModifier', label: $t('lastModifier') },
          { name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
        ],
      },
    }"
  ></w-grid>
</template>
<script setup lang="ts">
import 'tailwindcss/utilities.css';
import { Environment, Formater } from 'platform-core';
</script>
