{{>@macro/front-end/widgets/form-detail/include-form.hbs}}
<script setup lang="ts">
import { Subject } from 'rxjs';
import { SaveOutlined, CloseOutlined } from '@ant-design/icons-vue';
import { ctrlState } from './{{spinalCase ctrl.codeName}}-quick-search-form-state';
import { QuickSearchFormControl, IActionParam, IParam, ControlAction, IContext } from '@core';

interface Props {
  context: IContext;
  viewParams?: IParam;
  controlAction: ControlAction;
  showBusyIndicator?: boolean;
  viewSubject: Subject<IActionParam>;
}

const props = withDefaults(defineProps<Props>(), {
  viewSubject: () => new Subject<IActionParam>(),
  showBusyIndicator: true,
})

// emit声明
interface CtrlEmit {
  (name: "ctrlEvent", value: IActionParam): void;
}

const emit = defineEmits<CtrlEmit>();

// 安装功能模块，提供状态和能力方法
const { state, onEditorEvent } = new QuickSearchFormControl(ctrlState, props, emit).moduleInstall();

</script>
<template>
  <a-form 
    name="{{ctrl.codeName}}" 
    class="app-quick-search-form{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}"
    style="{{#if ctrl.formWidth}}width: {{ctrl.formWidth}}px;{{/if}}"
    :model="state.data" 
    :rules="state.rules">
    <a-row>
      {{#if ctrl.noTabHeader}}
      {{#each ctrl.psDEFormPages as | ctrlPage | }}
        {{#each ctrlPage.psDEFormDetails as | formDetail | }}
        {{>(lookup . 'formDetail.detailType') item=formDetail}}
        {{/each }}
      {{/each}}
      {{else}}
      <a-tabs class="app-form-page">
        {{#each ctrl.psDEFormPages as | ctrlPage | }}
        {{>(lookup . 'ctrlPage.detailType') item=ctrlPage }}
        {{/each}}
      </a-tabs>
      {{/if}}
    </a-row>
  </a-form>
</template>