<!-- eslint-disable unicorn/prefer-ternary -->
<script setup lang="ts" name="replace-mgr">
import type { MjGridProps } from '#/components/mj/mj-table'

import { promotionService } from '#/api/service/promotion'
import MjTable from '#/components/mj/mj-table'
import obj from '#/utils/obj'

const gridRef = ref()

// 编辑表单
const editForm = {
  modal: {
    width: 720,
  },
  form: {
    titleWidth: 110,
    items: [],
  },
  updateFields: ['id'],
} as any

// 搜索表单
const searchForm = {
  items: obj.joinObjs<any>(),
} as any

// 表格
const grid = {
  columns: obj.joinObjs<any>({ type: 'seq' }),
  beforeLoadData(params) {
    return params
  },
} as MjGridProps
</script>

<template>
  <div class="promotion-mgr g-container">
    <MjTable
      ref="gridRef"
      :edit-form="editForm"
      :search-form="searchForm"
      :grid="grid"
      :service="promotionService"
    />
  </div>
</template>

<style lang="scss" scoped>
.promotion-mgr {
  height: 100% !important;
}
</style>
